5.4.0#
API Changes#
APNG extension to PNG plugin#
Animated Portable Network Graphics (APNG) images are not fully supported but can be opened via the PNG plugin to get some basic info:
im = Image.open("image.apng")
print(im.mode) # "RGBA"
print(im.size) # (245, 245)
im.show() # Shows a single frame
Check for libjpeg-turbo#
You can check if Pillow has been built against the libjpeg-turbo version of the libjpeg library:
from PIL import features
features.check_feature("libjpeg_turbo") # True or False
Negative indexes in pixel access#
When accessing individual image pixels, negative indexes are now also accepted. For example, to get or set the farthest pixel in the lower right of an image:
px = im.load()
print(px[-1, -1])
px[-1, -1] = (0, 0, 0)
Other Changes#
ImageOps.fit#
Now uses one resize operation with box
parameter internally
instead of a crop and scale operations sequence.
This improves the performance and accuracy of cropping since
the box
parameter accepts float values.