Skip to content

Commit

Permalink
Fix pillow deprecation warning related with LANCZOS filter
Browse files Browse the repository at this point in the history
  • Loading branch information
bagerard committed Aug 25, 2024
1 parent cfc942f commit ea74df2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ If you utilize a ``DateTimeField``, you might also use a more flexible date pars

If you need to use an ``ImageField`` or ``ImageGridFsProxy``:

- Pillow>=2.0.0
- Pillow>=7.0.0

If you need to use signals:

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
Development
===========
- (Fill this out as you fix issues and develop your features).
- Fix pillow deprecation warning related with LANCZOS filter #2824
- Allow gt/gte/lt/lte/ne operators to be used with a list as value on ListField #2813
- Switch tox to use pytest instead of legacy `python setup.py test` #2804
- Add support for timeseries collection #2661
Expand Down
6 changes: 5 additions & 1 deletion mongoengine/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@
try:
from PIL import Image, ImageOps

LANCZOS = Image.LANCZOS if hasattr(Image, "LANCZOS") else Image.ANTIALIAS
if hasattr(Image, "Resampling"):
LANCZOS = Image.Resampling.LANCZOS
else:
LANCZOS = Image.LANCZOS
except ImportError:
# pillow is optional so may not be installed
Image = None
ImageOps = None

Expand Down

0 comments on commit ea74df2

Please sign in to comment.