Version 0.2

Changes:

ImageTools class removed

Into development of version 0.2 I realised that the ImageTools class doesnt fully follow the same style of PIL and also had a few problems when trying to add new features to.

To solve this I have remade the structure of both the class and the ImageTools module as a whole and now to access the class you will need to use this method:

# From base module
import PILTools
image_draw = PILTools.ImageTools.Draw(image)

# From the submodule
from PILTools import ImageTools
image_draw = ImageTools.Draw(image)

Function docstrings

Removed descriptions of arguements from the docstrings of functions to help keep it look clean.

All descriptions of both functions and their arguements can be found in the documentation.

Additions:

Alias functions added to docs

Any (currently just greyscale()) alias functions have been added to the documentation.

ImageTools.open_online

Added the ability to open images directly from the internet into PIL making use of the requests module.

This can be done via the use of open_online().

Example:

from PILTools import ImageTools

image = ImageTools.open_online(url="http://example.com/image.png", mode="RGB")
# Note: http://example.com/image.png isn't actually an image it is just there for example purposes

Rainbow text rendering

With this addition comes 2 functions rainbow_text() and rainbow_multiline_text().

These functions allow you to render text in the same way PIL.ImageDraw does but with a few changes, the main one being that it renders each letter as a different colour of either the rainbow or a list of user defined colours.

Note: Parsing in a string with new line characters into the rainbow_text() function will cause the module to automaticly pass it onto the rainbow_multiline_text() function. Do not rely on this to often though as using the rainbow_multiline_text() function gives you access to more customisation arguments that you can not pass though the rainbow_text() function.

Example:

from PIL import Image, ImageFont
from PILTools import ImageTools

image = ImageTools.open_online(url="http://example.com/image.png", mode="RGB")
font = ImageFont.truetype("test.ttf", 25)

image_draw = ImageTools.Draw(image)

# Single line text
image_draw.rainbow_text((0, 0), text="Hello world!", font=font)

# Multiline text
image_draw.rainbow_multiline_text((0, 200), text="Hello\nworld!", font=font)

# Defining custom colours (same method on both)
colours = [(0, 0, 0), (50, 50, 50), (100, 100, 100), (150, 150, 150), (200, 200, 200), (250, 250, 250)]
image_draw.rainbow_text((0, 100), text="Hello world!", font=font, fill=colours)