Home / Errors / antialias-removed

PIL.Image has no attribute ANTIALIAS

Pillow 10 removed Image.ANTIALIAS. Use Image.Resampling.LANCZOS instead, which is what ANTIALIAS always meant.

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The fix

im = im.resize((320, 240), Image.ANTIALIAS)

im = im.resize((320, 240), Image.Resampling.LANCZOS)

What happened

Pillow 9.1 grouped the loose constants into enums and marked the old spellings as deprecated. Pillow 10, released in July 2023, removed them. Any tutorial, book or answer written before 2022 uses the old name, which is why this error turns up so often.

ANTIALIAS was never a separate algorithm. It was an alias for the Lanczos filter, so the replacement gives you identical output.

The same change, elsewhere

OldNew
Image.ANTIALIASImage.Resampling.LANCZOS
Image.LINEARImage.Resampling.BILINEAR
Image.CUBICImage.Resampling.BICUBIC
Image.FLIP_LEFT_RIGHTImage.Transpose.FLIP_LEFT_RIGHT
Image.ROTATE_90Image.Transpose.ROTATE_90

If you cannot change the code

When the call lives inside a dependency you do not control, pin Pillow below 10 while you wait for an update:

pip install "Pillow<10"

Treat that as temporary. You are holding back security fixes in image decoders, which is not a good place to stay.

A simpler option

If you are making a thumbnail, you do not need the constant at all. thumbnail already uses a good filter and keeps the aspect ratio:

im.thumbnail((320, 240))

The resampling comparison shows what each filter does.

Still stuck

The PIL to Pillow converter finds most of these automatically, and the other error pages cover the rest.