mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-05 05:33:10 +03:00
71 lines
2.1 KiB
ReStructuredText
71 lines
2.1 KiB
ReStructuredText
11.2.0
|
|
------
|
|
|
|
Security
|
|
========
|
|
|
|
Undefined shift when loading compressed DDS images
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
When loading some compressed DDS formats, an integer was bitshifted by 24 places to
|
|
generate the 32 bits of the lookup table. This was undefined behaviour, and has been
|
|
present since Pillow 3.4.0.
|
|
|
|
Deprecations
|
|
============
|
|
|
|
Image.Image.get_child_images()
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
.. deprecated:: 11.2.0
|
|
|
|
``Image.Image.get_child_images()`` has been deprecated. and will be removed in Pillow
|
|
13 (2026-10-15). It will be moved to ``ImageFile.ImageFile.get_child_images()``. The
|
|
method uses an image's file pointer, and so child images could only be retrieved from
|
|
an :py:class:`PIL.ImageFile.ImageFile` instance.
|
|
|
|
API Changes
|
|
===========
|
|
|
|
``append_images`` no longer requires ``save_all``
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Previously, ``save_all`` was required to in order to use ``append_images``. Now,
|
|
``save_all`` will default to ``True`` if ``append_images`` is not empty and the format
|
|
supports saving multiple frames::
|
|
|
|
im.save("out.gif", append_images=ims)
|
|
|
|
API Additions
|
|
=============
|
|
|
|
``"justify"`` multiline text alignment
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
In addition to ``"left"``, ``"center"`` and ``"right"``, multiline text can also be
|
|
aligned using ``"justify"`` in :py:mod:`~PIL.ImageDraw`::
|
|
|
|
from PIL import Image, ImageDraw
|
|
im = Image.new("RGB", (50, 25))
|
|
draw = ImageDraw.Draw(im)
|
|
draw.multiline_text((0, 0), "Multiline\ntext 1", align="justify")
|
|
draw.multiline_textbbox((0, 0), "Multiline\ntext 2", align="justify")
|
|
|
|
Check for MozJPEG
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
You can check if Pillow has been built against the MozJPEG version of the
|
|
libjpeg library, and what version of MozJPEG is being used::
|
|
|
|
from PIL import features
|
|
features.check_feature("mozjpeg") # True or False
|
|
features.version_feature("mozjpeg") # "4.1.1" for example, or None
|
|
|
|
Saving compressed DDS images
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Compressed DDS images can now be saved using a ``pixel_format`` argument. DXT1, DXT3,
|
|
DXT5, BC2, BC3 and BC5 are supported::
|
|
|
|
im.save("out.dds", pixel_format="DXT1")
|