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.

PSFile

Deprecated since version 9.5.0.

The PSFile class has been deprecated and will be removed in Pillow 11 (2024-10-15). This class was only made as a helper to be used internally, so there is no replacement. If you need this functionality though, it is a very short class that can easily be recreated in your own code.

PyAccess and Image.USE_CFFI_ACCESS

Deprecated since version 10.0.0.

Since Pillow’s C API is now faster than PyAccess on PyPy, PyAccess has been deprecated and will be removed in Pillow 11.0.0 (2024-10-15). Pillow’s C API will now be used by default on PyPy instead.

Image.USE_CFFI_ACCESS, for switching from the C API to PyAccess, is similarly deprecated.

ImageFile.raise_oserror

Deprecated since version 10.2.0.

ImageFile.raise_oserror() has been deprecated and will be removed in Pillow 12.0.0 (2025-10-15). The function is undocumented and is only useful for translating error codes returned by a codec’s decode() method, which ImageFile already does automatically.

IptcImageFile helper functions

Deprecated since version 10.2.0.

The functions IptcImageFile.dump and IptcImageFile.i, and the constant IptcImageFile.PAD have been deprecated and will be removed in Pillow 12.0.0 (2025-10-15). These are undocumented helper functions intended for internal use, so there is no replacement. They can each be replaced by a single line of code using builtin functions in Python.

Removed features

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

Tk/Tcl 8.4

Deprecated since version 8.2.0.

Support for Tk/Tcl 8.4 was removed in Pillow 10.0.0 (2023-07-01).

Categories

Deprecated since version 8.2.0.

im.category was removed 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.

JpegImagePlugin.convert_dict_qtables

Deprecated since version 8.3.0.

Since deprecation in Pillow 8.3.0, the convert_dict_qtables method no longer performed any operations on the data given to it, and has been removed.

ImagePalette size parameter

Deprecated since version 8.4.0.

Before Pillow 8.3.0, ImagePalette required palette data of particular lengths by default, and the size parameter could be used to override that. Pillow 8.3.0 removed the default required length, also removing the need for the size parameter.

ImageShow.Viewer.show_file file argument

Deprecated since version 9.1.0.

The file argument in show_file() has been removed and replaced by path.

In effect, viewer.show_file("test.jpg") will continue to work unchanged.

Constants

Deprecated since version 9.1.0.

A number of constants have been removed. Instead, enum.IntEnum classes have been added.

Note

Additional Image constants were deprecated in Pillow 9.1.0, but that was reversed in Pillow 9.4.0 and those constants will now remain available. See Constants

Removed

Use instead

Image.LINEAR

Image.BILINEAR or Image.Resampling.BILINEAR

Image.CUBIC

Image.BICUBIC or Image.Resampling.BICUBIC

Image.ANTIALIAS

Image.LANCZOS or Image.Resampling.LANCZOS

ImageCms.INTENT_PERCEPTUAL

ImageCms.Intent.PERCEPTUAL

ImageCms.INTENT_RELATIVE_COLORMETRIC

ImageCms.Intent.RELATIVE_COLORMETRIC

ImageCms.INTENT_SATURATION

ImageCms.Intent.SATURATION

ImageCms.INTENT_ABSOLUTE_COLORIMETRIC

ImageCms.Intent.ABSOLUTE_COLORIMETRIC

ImageCms.DIRECTION_INPUT

ImageCms.Direction.INPUT

ImageCms.DIRECTION_OUTPUT

ImageCms.Direction.OUTPUT

ImageCms.DIRECTION_PROOF

ImageCms.Direction.PROOF

ImageFont.LAYOUT_BASIC

ImageFont.Layout.BASIC

ImageFont.LAYOUT_RAQM

ImageFont.Layout.RAQM

BlpImagePlugin.BLP_FORMAT_JPEG

BlpImagePlugin.Format.JPEG

BlpImagePlugin.BLP_ENCODING_UNCOMPRESSED

BlpImagePlugin.Encoding.UNCOMPRESSED

BlpImagePlugin.BLP_ENCODING_DXT

BlpImagePlugin.Encoding.DXT

BlpImagePlugin.BLP_ENCODING_UNCOMPRESSED_RAW_RGBA

BlpImagePlugin.Encoding.UNCOMPRESSED_RAW_RGBA

BlpImagePlugin.BLP_ALPHA_ENCODING_DXT1

BlpImagePlugin.AlphaEncoding.DXT1

BlpImagePlugin.BLP_ALPHA_ENCODING_DXT3

BlpImagePlugin.AlphaEncoding.DXT3

BlpImagePlugin.BLP_ALPHA_ENCODING_DXT5

BlpImagePlugin.AlphaEncoding.DXT5

FtexImagePlugin.FORMAT_DXT1

FtexImagePlugin.Format.DXT1

FtexImagePlugin.FORMAT_UNCOMPRESSED

FtexImagePlugin.Format.UNCOMPRESSED

PngImagePlugin.APNG_DISPOSE_OP_NONE

PngImagePlugin.Disposal.OP_NONE

PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND

PngImagePlugin.Disposal.OP_BACKGROUND

PngImagePlugin.APNG_DISPOSE_OP_PREVIOUS

PngImagePlugin.Disposal.OP_PREVIOUS

PngImagePlugin.APNG_BLEND_OP_SOURCE

PngImagePlugin.Blend.OP_SOURCE

PngImagePlugin.APNG_BLEND_OP_OVER

PngImagePlugin.Blend.OP_OVER

FitsStubImagePlugin

Deprecated since version 9.1.0.

The stub image plugin FitsStubImagePlugin has been removed. FITS images can be read without a handler through FitsImagePlugin instead.

Font size and offset methods

Deprecated since version 9.2.0.

Several functions for computing the size and offset of rendered text have been removed:

Removed

Use instead

FreeTypeFont.getsize() and FreeTypeFont.getoffset()

FreeTypeFont.getbbox() and FreeTypeFont.getlength()

FreeTypeFont.getsize_multiline()

ImageDraw.multiline_textbbox()

ImageFont.getsize()

ImageFont.getbbox() and ImageFont.getlength()

TransposedFont.getsize()

TransposedFont.getbbox() and TransposedFont.getlength()

ImageDraw.textsize() and ImageDraw.multiline_textsize()

ImageDraw.textbbox(), ImageDraw.textlength() and ImageDraw.multiline_textbbox()

ImageDraw2.Draw.textsize()

ImageDraw2.Draw.textbbox() and ImageDraw2.Draw.textlength()

Previous code:

from PIL import Image, ImageDraw, ImageFont

font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
width, height = font.getsize("Hello world")
left, top = font.getoffset("Hello world")

im = Image.new("RGB", (100, 100))
draw = ImageDraw.Draw(im)
width, height = draw.textsize("Hello world")

width, height = font.getsize_multiline("Hello\nworld")
width, height = draw.multiline_textsize("Hello\nworld")

Use instead:

from PIL import Image, ImageDraw, ImageFont

font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
left, top, right, bottom = <