Skip to content

Latest commit

 

History

History
96 lines (67 loc) · 3.32 KB

8.0.0.rst

File metadata and controls

96 lines (67 loc) · 3.32 KB

8.0.0

Backwards Incompatible Changes

Python 3.5

Pillow has dropped support for Python 3.5, which reached end-of-life on 2020-09-13.

im.offset

im.offset() has been removed, call :py.ImageChops.offset() instead.

Image.fromstring, im.fromstring and im.tostring

  • Image.fromstring() has been removed, call :py.Image.frombytes() instead.
  • im.fromstring() has been removed, call :py~PIL.Image.Image.frombytes() instead.
  • im.tostring() has been removed, call :py~PIL.Image.Image.tobytes() instead.

ImageCms.CmsProfile attributes

Some attributes in :pyPIL.ImageCms.CmsProfile have been removed:

Removed Use instead
color_space Padded :py~.CmsProfile.xcolor_space
pcs Padded :py~.CmsProfile.connection_space
product_copyright Unicode :py~.CmsProfile.copyright
product_desc Unicode :py~.CmsProfile.profile_description
product_description Unicode :py~.CmsProfile.profile_description
product_manufacturer Unicode :py~.CmsProfile.manufacturer
product_model Unicode :py~.CmsProfile.model

API Changes

Add MIME type to PsdImagePlugin

"image/vnd.adobe.photoshop" is now registered as the :py.PsdImagePlugin.PsdImageFile MIME type.

API Additions

Image.open: add formats parameter

Added a new formats parameter to :py.Image.open:

  • 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 None to try all supported formats. You can print the set of available formats by running python -m PIL or using the :pyPIL.features.pilinfo function.

ImageOps.autocontrast: add mask parameter

:py.ImageOps.autocontrast can now take a mask parameter:

  • 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.

ImageOps.autocontrast cutoffs

Previously, the cutoff parameter of :py.ImageOps.autocontrast could only be a single number, used as the percent to cut off from the histogram on the low and high ends.

Now, it can also be a tuple (low, high).

ImageDraw.regular_polygon

A new method :py.ImageDraw.regular_polygon, draws a regular polygon of n_sides, inscribed in a bounding_circle.

For example draw.regular_polygon(((100, 100), 50), 5) draws a pentagon centered at the point (100, 100) with a polygon radius of 50.

Other Changes

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.