Backwards Incompatible Changes#
Pillow has dropped support for Python 3.5, which reached end-of-life on 2020-09-13.
Pillow has dropped support for PyPy3 7.1.1. PyPy3 7.2.0, released on 2019-10-14, is now the minimum compatible version.
im.offset() has been removed, call
Image.fromstring, im.fromstring and im.tostring#
Some attributes in
PIL.ImageCms.CmsProfile have been removed:
Fixed issue where passing
stroke_width with a non-zero value
ImageDraw.text() would cause the text to be offset by that amount.
anchor parameter of
ImageDraw.text() has been implemented.
Use this parameter to change the position of text relative to the
xy point. See Text anchors for details.
Add MIME type to PsdImagePlugin#
“image/vnd.adobe.photoshop” is now registered as the
PsdImagePlugin.PsdImageFile MIME type.
Image.open: add formats parameter#
Added a new
formats parameter to
A list or tuple of formats to attempt to load the file in. This can be used to restrict the set of formats checked. Pass
Noneto try all supported formats. You can print the set of available formats by running
python3 -m PILor using the
ImageOps.autocontrast: add mask parameter#
ImageOps.autocontrast() can now take a
Histogram used in contrast operation is computed using pixels within the mask. If no mask is given the entire image is used for histogram computation.
cutoff parameter of
ImageOps.autocontrast() could only
be a single number, used as the percent to cut off from the histogram on the low and
Now, it can also be a tuple
A new method
ImageDraw.regular_polygon(), draws a regular polygon of
n_sides, inscribed in a
draw.regular_polygon(((100, 100), 50), 5)
draws a pentagon centered at the point
(100, 100) with a polygon radius of
To render text with embedded color data, use the parameter
Support for CBDT fonts requires FreeType 2.5 compiled with libpng. Support for SBIX fonts requires FreeType 2.5.1 compiled with libpng. Support for COLR fonts requires FreeType 2.10. SVG fonts are not yet supported.
These can be used for word-wrapping or rendering text in parts.
These functions accept an
anchor parameter, see Text anchors for details.
Improved ellipse-drawing algorithm#
The ellipse-drawing algorithm has been changed from drawing a 360-sided polygon to one which resembles Bresenham’s algorithm for circles. It should be faster and produce smoother curves, especially for smaller ellipses.
ImageDraw.text and ImageDraw.multiline_text#
align parameter of
ImageDraw.multiline_text() now gives better results in some cases.
TrueType fonts with embedded bitmaps are now supported.
Added writing of subIFDs#
When saving EXIF data, Pillow is now able to write subIFDs, such as the GPS IFD. This
should happen automatically when saving an image using the EXIF data that it was opened
with, such as in
Previously, the code of the first tag of the subIFD was incorrectly written as the offset.
Error for large BMP files#
Previously, if a BMP file was too large, an
OSError would be raised. Now,
DecompressionBombError is used instead, as Pillow already uses for other formats.
Dark theme for docs#
The https://pillow.readthedocs.io documentation will use a dark theme if the user has requested the system use one. Uses the
prefers-color-scheme CSS media query.