Answers for LLM inference engineers

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' (or 'ImageDraw' object has no attribute 'textsize', 'getsize', any name): which Pillow removed it and what to use

Pillow 10.0.0 (2023-07-01) removed Image.ANTIALIAS (use Image.LANCZOS), Image.LINEAR and Image.CUBIC (BILINEAR, BICUBIC), ImageDraw.textsize (use textbbox or textlength) and font.getsize (use getbbox or getlength); 9.1 to 9.5 warned. Pillow 12.0.0 removed ImageMath.eval (use lambda_eval or unsafe_eval). If the error comes from a library you did not write, upgrade the library or pin Pillow below the release that removed the name. Paste the error below for the release-by-release answer.

Published 2026-11-25 · 28 Pillow releases installed and run, 7.0.0 to 13.0.0 (26,068 lookups) · how

Examples:

Runs in your browser on the data in this page (pillow_names.json); nothing you paste is sent anywhere.

Which release removed it, and what replaces it?

42 names that one Pillow release has and a later one does not (28 of them in 10.0.0). "Instead" is Pillow's own deprecation text from the last release that had the name (38 of 42), except where marked.

NameRemoved inInstead
PIL.Image.fromstring8.0.0Use Image.frombytes(mode, size, data). (our note)
PIL.Image.Image.fromstring8.0.0Use im.frombytes(...). (our note)
PIL.Image.Image.offset8.0.0From PIL.ImageChops import offset (still there in 13.0.0).
PIL.Image.Image.tostring8.0.0Use im.tobytes(). (our note)
PIL.ImageFile.raise_ioerror9.0.0raise_ioerror is deprecated and will be removed in Pillow 9 (2022-01-02). Use raise_oserror instead.
PIL.Image.ANTIALIAS10.0.0ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use LANCZOS or Resampling.LANCZOS instead.
PIL.Image.coerce_e10.0.0coerce_e is deprecated and will be removed in Pillow 10.
PIL.Image.CONTAINER10.0.0Image categories are deprecated and will be removed in Pillow 10 (2023-07-01). Use is_animated instead.
PIL.Image.CUBIC10.0.0CUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use BICUBIC or Resampling.BICUBIC instead.
PIL.Image.LINEAR10.0.0LINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use BILINEAR or Resampling.BILINEAR instead.
PIL.Image.NORMAL10.0.0Image categories are deprecated and will be removed in Pillow 10 (2023-07-01). Use is_animated instead.
PIL.Image.SEQUENCE10.0.0Image categories are deprecated and will be removed in Pillow 10 (2023-07-01). Use is_animated instead.
PIL.ImageCms.DIRECTION_INPUT10.0.0DIRECTION_INPUT is deprecated and will be removed in Pillow 10 (2023-07-01). Use Direction.INPUT instead.
PIL.ImageCms.DIRECTION_OUTPUT10.0.0DIRECTION_OUTPUT is deprecated and will be removed in Pillow 10 (2023-07-01). Use Direction.OUTPUT instead.
PIL.ImageCms.DIRECTION_PROOF10.0.0DIRECTION_PROOF is deprecated and will be removed in Pillow 10 (2023-07-01). Use Direction.PROOF instead.
PIL.ImageCms.INTENT_ABSOLUTE_COLORIMETRIC10.0.0INTENT_ABSOLUTE_COLORIMETRIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Intent.ABSOLUTE_COLORIMETRIC instead.
PIL.ImageCms.INTENT_PERCEPTUAL10.0.0INTENT_PERCEPTUAL is deprecated and will be removed in Pillow 10 (2023-07-01). Use Intent.PERCEPTUAL instead.
PIL.ImageCms.INTENT_RELATIVE_COLORIMETRIC10.0.0INTENT_RELATIVE_COLORIMETRIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Intent.RELATIVE_COLORIMETRIC instead.
PIL.ImageCms.INTENT_SATURATION10.0.0INTENT_SATURATION is deprecated and will be removed in Pillow 10 (2023-07-01). Use Intent.SATURATION instead.
PIL.ImageDraw.ImageDraw.multiline_textsize10.0.0multiline_textsize is deprecated and will be removed in Pillow 10. Use multiline_textbbox instead.
PIL.ImageDraw.ImageDraw.textsize10.0.0textsize is deprecated and will be removed in Pillow 10. Use textbbox or textlength instead.
PIL.ImageFont.LAYOUT_BASIC10.0.0LAYOUT_BASIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Layout.BASIC instead.
PIL.ImageFont.LAYOUT_RAQM10.0.0LAYOUT_RAQM is deprecated and will be removed in Pillow 10 (2023-07-01). Use Layout.RAQM instead.
PIL.ImageFont.FreeTypeFont.getoffset10.0.0getoffset is deprecated and will be removed in Pillow 10. Use getbbox instead.
PIL.ImageFont.FreeTypeFont.getsize10.0.0getsize is deprecated and will be removed in Pillow 10. Use getbbox or getlength instead.
PIL.ImageFont.FreeTypeFont.getsize_multiline10.0.0getsize_multiline is deprecated and will be removed in Pillow 10. Use ImageDraw.multiline_textbbox instead.
PIL.ImageFont.ImageFont.getsize10.0.0getsize is deprecated and will be removed in Pillow 10. Use getbbox or getlength instead.
PIL.JpegImagePlugin.convert_dict_qtables10.0.0convert_dict_qtables is deprecated and will be removed in Pillow 10. Use Conversion is no longer needed instead.
PIL.PngImagePlugin.APNG_BLEND_OP_OVER10.0.0APNG_BLEND_OP_OVER is deprecated and will be removed in Pillow 10 (2023-07-01). Use Blend.OP_OVER instead.
PIL.PngImagePlugin.APNG_BLEND_OP_SOURCE10.0.0APNG_BLEND_OP_SOURCE is deprecated and will be removed in Pillow 10 (2023-07-01). Use Blend.OP_SOURCE instead.
PIL.PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND10.0.0APNG_DISPOSE_OP_BACKGROUND is deprecated and will be removed in Pillow 10 (2023-07-01). Use Disposal.OP_BACKGROUND instead.
PIL.PngImagePlugin.APNG_DISPOSE_OP_NONE10.0.0APNG_DISPOSE_OP_NONE is deprecated and will be removed in Pillow 10 (2023-07-01). Use Disposal.OP_NONE instead.
PIL.PngImagePlugin.APNG_DISPOSE_OP_PREVIOUS10.0.0APNG_DISPOSE_OP_PREVIOUS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Disposal.OP_PREVIOUS instead.
PIL.Image.isImageType12.0.0Image.isImageType(im) is deprecated and will be removed in Pillow 12. Use isinstance(im, Image.Image) instead.
PIL.ImageCms.DESCRIPTION12.0.0PIL.ImageCms.DESCRIPTION is deprecated and will be removed in Pillow 12 (2025-10-15)
PIL.ImageCms.FLAGS12.0.0PIL.ImageCms.FLAGS is deprecated and will be removed in Pillow 12 (2025-10-15). Use PIL.ImageCms.Flags instead.
PIL.ImageCms.VERSION12.0.0PIL.ImageCms.VERSION is deprecated and will be removed in Pillow 12 (2025-10-15)
PIL.ImageCms.versions12.0.0PIL.ImageCms.versions() is deprecated and will be removed in Pillow 12. Use (PIL.features.version("littlecms2"), sys.version, PIL.__version__) instead.
PIL.ImageFile.raise_oserror12.0.0raise_oserror is deprecated and will be removed in Pillow 12. Use It is only useful for translating error codes returned by a codec's decode() method, which ImageFile already does automatically. instead.
PIL.ImageMath.eval12.0.0ImageMath.eval is deprecated and will be removed in Pillow 12. Use ImageMath.lambda_eval or ImageMath.unsafe_eval instead.
PIL.Image.Image.get_child_images13.0.0Image.Image.get_child_images is deprecated and will be removed in Pillow 13.
PIL.ImageSequence.Image13.0.0Image.Image.getdata is deprecated and will be removed in Pillow 14. Use get_flattened_data instead.

How was this measured?

Each of 28 Pillow releases (every minor from 7.0.0, plus the latest) was installed from PyPI in its own environment, the public names of the PIL modules and of the Image, ImageDraw, FreeTypeFont and ImageFont classes were listed with dir(), and getattr was run for the union of all names in every release. Releases: 7.0.0 (Python 3.8), 7.1.0 (Python 3.8), 7.2.0 (Python 3.8), 8.0.0 (Python 3.8), 8.1.0 (Python 3.8), 8.2.0 (Python 3.8), 8.3.0 (Python 3.8), 8.4.0 (Python 3.8), 9.0.0 (Python 3.8), 9.1.0 (Python 3.8), 9.2.0 (Python 3.8), 9.3.0 (Python 3.8), 9.4.0 (Python 3.8), 9.5.0 (Python 3.8), 10.0.0 (Python 3.8), 10.1.0 (Python 3.8), 10.2.0 (Python 3.8), 10.3.0 (Python 3.8), 10.4.0 (Python 3.8), 11.0.0 (Python 3.9), 11.1.0 (Python 3.9), 11.2.1 (Python 3.9), 11.3.0 (Python 3.9), 12.0.0 (Python 3.12), 12.1.0 (Python 3.12), 12.2.0 (Python 3.12), 12.3.0 (Python 3.13), 13.0.0 (Python 3.13). Pillow's modules have no __all__, so the table keeps class members and the names Pillow itself deprecated (a warning on access, or a deprecate() call or warning in the definition); helpers a module merely imported are left out, but the lookup still answers for them. The text is read from the installed source of the last release that had the name; Pillow's deprecate("textsize", 10, "textbbox or textlength") calls are turned into the sentence its helper prints. ImageTk, ImageQt and ImageGrab were not read (their import depends on tkinter, Qt or a display).

Patch releases were not read: a name removed in x.y.1 shows at the next minor.

Questions

How do I fix "module 'PIL.Image' has no attribute 'ANTIALIAS'"?

Pillow 10.0.0 (2023-07-01) removed Image.ANTIALIAS; 9.1 to 9.5 warned. Use Image.LANCZOS (the same filter), or Image.Resampling.LANCZOS, which exists from 9.1.0: img.resize((w, h), Image.LANCZOS). The same release removed Image.LINEAR (use BILINEAR) and Image.CUBIC (use BICUBIC). If the error comes from a library, upgrade it, or pin pillow<10.

How do I fix "'ImageDraw' object has no attribute 'textsize'"?

Pillow 10.0.0 removed ImageDraw.textsize and multiline_textsize. Use draw.textbbox((0, 0), text, font=font), which returns (left, top, right, bottom): width = right - left, height = bottom - top; or draw.textlength(text, font=font) for the width alone.

How do I fix "'FreeTypeFont' object has no attribute 'getsize'"?

Pillow 10.0.0 removed font.getsize, getsize_multiline and getoffset. Use font.getbbox(text) (left, top, right, bottom) or font.getlength(text) for the advance width.

How do I fix "module 'PIL.ImageMath' has no attribute 'eval'"?

Pillow 12.0.0 (2025-10-15) removed ImageMath.eval. Use ImageMath.lambda_eval with a function, or ImageMath.unsafe_eval for a string expression you trust (it runs Python code).

Sources

The same data as JSON: pillow_names.json, licensed CC BY 4.0.

Related: "No module named 'torchvision.transforms.functional_tensor'" · "module 'numpy' has no attribute 'float_'" · "cannot import name 'imread' from 'scipy.misc'".