Skip to main content

A library to draw MDI icons onto PIL Image objects.

Project description

MDI PIL

This is a small library made to easily generate PIL Image objects of mdi (Material Design Icon) icons. It also comes with a tool to convert user supplied image files into image objects that adhere to the main sizing principles of mdi icons. There are also two additional functions, parse_weather_icon and make_battery_icon. The former returns a string with the mdi icon corresponding to a given weather condition. The latter creates an image that is similar to the icon showing the battery status in phones, with additional options like fill icons and the like. See the doc strings of those functions for how they work.

Examples

Make an PIL image object of the icon "mdi:test-tube" and open a window to show it:

from PIL import Image
import mdi_pil as mdi

icon = "mdi:test-tube"
img = Image.new("RGBA", (100,100), None)

img = mdi.draw_mdi_icon(img, icon, icon_color="steelblue")
img.show()

Convert the image file "speaker-outline.png" into an mdi-like icon:

from PIL import Image
import mdi_pil as mdi

img = "speaker-outline.png"

img = mdi.make_mdi_icon(img, 100, color="steelblue")
img.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdi_pil-1.0.0.tar.gz (663.7 kB view hashes)

Uploaded Source

Built Distribution

mdi_pil-1.0.0-py3-none-any.whl (660.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page