Deprecations and removals

This page lists Pillow features that are deprecated, or have been removed inpast major releases, and gives the alternatives to use instead.

Deprecated features

Below are features which are considered deprecated. Where appropriate,a DeprecationWarning is issued.

PILLOW_VERSION constant

Deprecated since version 5.2.0.

PILLOWVERSION has been deprecated and will be removed in a future release. Use_version instead.

It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projectsmore time to upgrade.

ImageCms.CmsProfile attributes

Deprecated since version 3.2.0.

Some attributes in ImageCms.CmsProfile are deprecated. From 6.0.0, they issue aDeprecationWarning:

DeprecatedUse instead
color_spacePadded xcolor_space
pcsPadded connection_space
product_copyrightUnicode copyright
product_descUnicode profile_description
product_descriptionUnicode profile_description
product_manufacturerUnicode manufacturer
product_modelUnicode model

Removed features

Deprecated features are only removed in major releases after an appropriateperiod of deprecation has passed.

Python 2.7

Removed in version 7.0.0.

Python 2.7 reached end-of-life on 2020-01-01. Pillow 6.x was the last series tosupport Python 2.

Image.del

Removed in version 7.0.0.

Implicitly closing the image’s underlying file in Image.del has been removed.Use a context manager or call Image.close() instead to close the file in adeterministic way.

Previous method:

  1. im = Image.open("hopper.png")
  2. im.save("out.jpg")

Use instead:

  1. with Image.open("hopper.png") as im:
  2. im.save("out.jpg")

PIL.*ImagePlugin.version attributes

Removed in version 7.0.0.

The version constants of individual plugins have been removed. Use PIL.versioninstead.

RemovedRemovedRemoved
BmpImagePlugin.versionJpeg2KImagePlugin.versionPngImagePlugin.version
CurImagePlugin.versionJpegImagePlugin.versionPpmImagePlugin.version
DcxImagePlugin.versionMcIdasImagePlugin.versionPsdImagePlugin.version
EpsImagePlugin.versionMicImagePlugin.versionSgiImagePlugin.version
FliImagePlugin.versionMpegImagePlugin.versionSunImagePlugin.version
FpxImagePlugin.versionMpoImagePlugin.versionTgaImagePlugin.version
GdImageFile.versionMspImagePlugin.versionTiffImagePlugin.version
GifImagePlugin.versionPalmImagePlugin.versionWmfImagePlugin.version
IcoImagePlugin.versionPcdImagePlugin.versionXbmImagePlugin.version
ImImagePlugin.versionPcxImagePlugin.versionXpmImagePlugin.version
ImtImagePlugin.versionPdfImagePlugin.versionXVThumbImagePlugin.version
IptcImagePlugin.versionPixarImagePlugin.version

PyQt4 and PySide

Removed in version 7.0.0.

Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since2018-08-31 and PySide since 2015-10-14.

Support for PyQt4 and PySide has been removed from ImageQt. Please upgrade to PyQt5or PySide2.

Setting the size of TIFF images

Removed in version 7.0.0.

Setting the size of a TIFF image directly (eg. im.size = (256, 256)) throwsan error. Use Image.resize instead.

VERSION constant

Removed in version 6.0.0.

VERSION (the old PIL version, always 1.1.7) has been removed. Useversion instead.

Undocumented ImageOps functions

Removed in version 6.0.0.

Several undocumented functions in ImageOps have been removed. Use the equivalentsin ImageFilter instead:

RemovedUse instead
ImageOps.box_blurImageFilter.BoxBlur
ImageOps.gaussian_blurImageFilter.GaussianBlur
ImageOps.gblurImageFilter.GaussianBlur
ImageOps.usmImageFilter.UnsharpMask
ImageOps.unsharp_maskImageFilter.UnsharpMask

PIL.OleFileIO

Removed in version 6.0.0.

PIL.OleFileIO was removed as a vendored file and in Pillow 4.0.0 (2017-01) in favour ofthe upstream olefile Python package, and replaced with an ImportError in 5.0.0(2018-01). The deprecated file has now been removed from Pillow. If needed, install fromPyPI (eg. python3 -m pip install olefile).