Deprecations and removals¶
This page lists Pillow features that are deprecated, or have been removed in past major releases, and gives the alternatives to use instead.
Deprecated features¶
Below are features which are considered deprecated. Where appropriate,
a DeprecationWarning is issued.
FreeType 2.7¶
Deprecated since version 8.1.0.
Support for FreeType 2.7 is deprecated and will be removed in Pillow 9.0.0 (2022-01-02), when FreeType 2.8 will be the minimum supported.
We recommend upgrading to at least FreeType 2.10.4, which fixed a severe vulnerability introduced in FreeType 2.6 (:cve:`CVE-2020-15999`).
Tk/Tcl 8.4¶
Deprecated since version 8.2.0.
Support for Tk/Tcl 8.4 is deprecated and will be removed in Pillow 10.0.0 (2023-01-02), when Tk/Tcl 8.5 will be the minimum supported.
Categories¶
Deprecated since version 8.2.0.
im.category is deprecated and will be removed in Pillow 10.0.0 (2023-01-02),
along with the related Image.NORMAL, Image.SEQUENCE and
Image.CONTAINER attributes.
To determine if an image has multiple frames or not,
getattr(im, "is_animated", False) can be used instead.
Image.show command parameter¶
Deprecated since version 7.2.0.
The command parameter will be removed in Pillow 9.0.0 (2022-01-02).
Use a subclass of ImageShow.Viewer instead.
Image._showxv¶
Deprecated since version 7.2.0.
Image._showxv will be removed in Pillow 9.0.0 (2022-01-02).
Use Image.Image.show() instead. If custom behaviour is required, use
ImageShow.register() to add a custom ImageShow.Viewer class.
ImageFile.raise_ioerror¶
Deprecated since version 7.2.0.
IOError was merged into OSError in Python 3.3.
So, ImageFile.raise_ioerror will be removed in Pillow 9.0.0 (2022-01-02).
Use ImageFile.raise_oserror instead.
PILLOW_VERSION constant¶
Deprecated since version 5.2.0.
PILLOW_VERSION will be removed in Pillow 9.0.0 (2022-01-02).
Use __version__ instead.
It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projects more time to upgrade.
Removed features¶
Deprecated features are only removed in major releases after an appropriate period of deprecation has passed.
im.offset¶
Deprecated since version 1.1.2.
Removed in version 8.0.0.
im.offset() has been removed, call ImageChops.offset() instead.
It was documented as deprecated in PIL 1.1.2,
raised a DeprecationWarning since 1.1.5,
an Exception since Pillow 3.0.0
and NotImplementedError since 3.3.0.
Image.fromstring, im.fromstring and im.tostring¶
Deprecated since version 2.0.0.
Removed in version 8.0.0.
Image.fromstring()has been removed, callImage.frombytes()instead.im.fromstring()has been removed, callfrombytes()instead.im.tostring()has been removed, calltobytes()instead.
They issued a DeprecationWarning since 2.0.0,
an Exception since 3.0.0
and NotImplementedError since 3.3.0.
ImageCms.CmsProfile attributes¶
Deprecated since version 3.2.0.
Removed in version 8.0.0.
Some attributes in PIL.ImageCms.CmsProfile have been removed. From 6.0.0,
they issued a DeprecationWarning:
Removed |
Use instead |
|---|---|
|
Padded |
|
Padded |
|
Unicode |
|
Unicode |
|
Unicode |
|
Unicode |
|
Unicode |
Python 2.7¶
Deprecated since version 6.0.0.
Removed in version 7.0.0.
Python 2.7 reached end-of-life on 2020-01-01. Pillow 6.x was the last series to support Python 2.
Image.__del__¶
Deprecated since version 6.1.0.
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 a
deterministic way.
Previous method:
im = Image.open("hopper.png")
im.save("out.jpg")
Use instead:
with Image.open("hopper.png") as im:
im.save("out.jpg")
PIL.*ImagePlugin.__version__ attributes¶
Deprecated since version 6.0.0.
Removed in version 7.0.0.
The version constants of individual plugins have been removed. Use PIL.__version__
instead.
Removed |
Removed |
Removed |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyQt4 and PySide¶
Deprecated since version 6.0.0.
Removed in version 7.0.0.
Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since 2018-08-31 and PySide since 2015-10-14.
Support for PyQt4 and PySide has been removed from ImageQt. Please upgrade to PyQt5
or PySide2.
Setting the size of TIFF images¶
Deprecated since version 5.3.0.
Removed in version 7.0.0.
Setting the size of a TIFF image directly (eg. im.size = (256, 256)) throws
an error. Use Image.resize instead.
VERSION constant¶
Deprecated since version 5.2.0.
Removed in version 6.0.0.
VERSION (the old PIL version, always 1.1.7) has been removed. Use
__version__ instead.
Undocumented ImageOps functions¶
Deprecated since version 4.3.0.
Removed in version 6.0.0.
Several undocumented functions in ImageOps have been removed. Use the equivalents
in ImageFilter instead:
Removed |
Use instead |
|---|---|
|
|
|
|
|
|
|
|
|
|
PIL.OleFileIO¶
Deprecated since version 4.0.0.
Removed in version 6.0.0.
PIL.OleFileIO was removed as a vendored file and in Pillow 4.0.0 (2017-01) in favour of
the 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 from
PyPI (eg. python3 -m pip install olefile).