matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.27k stars 275 forks source link

Pillow deprecating ANTIALIAS #566

Closed chemeng closed 1 year ago

chemeng commented 1 year ago

Installing the latest version of Pillow 10.0.0 breaks part of the resizing code:

  File "/home/appuser/.local/lib/python3.10/site-packages/pilkit/processors/resize.py", line 24, in process
    img = img.resize((self.width, self.height), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

reference: https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#constants

Alexerson commented 1 year ago

See also https://github.com/matthewwithanm/pilkit/issues/64

vnagendra commented 1 year ago

In case anyone else is running into this issue, I was able to get around this by using a fork of the pilkit package.

In my requirements.in..

django-imagekit
git+https://github.com/sereema/pilkit

That added the correct library to my requirements.txt..

pilkit @ git+https://github.com/sereema/pilkit
    # via
    #   -r requirements.in
    #   django-imagekit

The only funny thing I had to do was to uninstall (on my local) and reinstall. I wasn't using this library extensively or anything, just making 1 thumbnail. YMMW.

jtremesay-sereema commented 1 year ago

Hi @vnagendra. I’m the "maintainer" of sereema/pilkit. For your information, this is a temporary fork until upstream fix the issue. You should not rely on it :)

vnagendra commented 1 year ago

Noted. There just wasn’t anything that had small changes like this. I’ll keep any eye out for upstream fix and then change to it when fixed

vstoykov commented 1 year ago

The new release of pilkit is uploaded to PyPi that adds compatibility with Pillow 10. You can update your dependencies and it will start working.