Pillow/docs/releasenotes/5.4.0.rst

68 lines
1.7 KiB
ReStructuredText
Raw Normal View History

2018-12-31 14:48:06 +03:00
5.4.0
2018-10-18 10:58:20 +03:00
-----
API Changes
===========
2018-12-31 14:48:06 +03:00
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)
2018-10-18 10:58:20 +03:00
2018-12-31 14:48:06 +03:00
New custom TIFF tags
^^^^^^^^^^^^^^^^^^^^
TIFF images can now be saved with custom integer, float and string TIFF tags::
2018-12-31 14:48:06 +03:00
im = Image.new("RGB", (200, 100))
custom = {
37000: 4,
37001: 4.2,
37002: "custom tag value",
37003: u"custom tag value",
37004: b"custom tag value",
}
im.save("output.tif", tiffinfo=custom)
im2 = Image.open("output.tif")
print(im2.tag_v2[37000]) # 4
print(im2.tag_v2[37002]) # "custom tag value"
print(im2.tag_v2[37004]) # b"custom tag value"
2018-10-18 10:58:20 +03:00
Other Changes
=============
ImageOps.fit
^^^^^^^^^^^^
2018-10-18 11:40:32 +03:00
Now uses one resize operation with ``box`` parameter internally
instead of a crop and scale operations sequence.
2018-10-18 10:58:20 +03:00
This improves the performance and accuracy of cropping since
2018-10-18 11:40:32 +03:00
the ``box`` parameter accepts float values.