Skip to content

Commit aaffca9

Browse files
authored
Merge pull request #2834 from bagerard/fix_pillow_deprecation_warning
Fix pillow deprecation warning related with LANCZOS filter
2 parents d600932 + 4e391db commit aaffca9

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ If you utilize a ``DateTimeField``, you might also use a more flexible date pars
6666

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

69-
- Pillow>=2.0.0
69+
- Pillow>=7.0.0
7070

7171
If you need to use signals:
7272

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changelog
77
Development
88
===========
99
- (Fill this out as you fix issues and develop your features).
10+
- Fix pillow deprecation warning related with LANCZOS filter #2824
1011
- Allow gt/gte/lt/lte/ne operators to be used with a list as value on ListField #2813
1112
- Switch tox to use pytest instead of legacy `python setup.py test` #2804
1213
- Add support for timeseries collection #2661

mongoengine/fields.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@
4949
try:
5050
from PIL import Image, ImageOps
5151

52-
LANCZOS = Image.LANCZOS if hasattr(Image, "LANCZOS") else Image.ANTIALIAS
52+
if hasattr(Image, "Resampling"):
53+
LANCZOS = Image.Resampling.LANCZOS
54+
else:
55+
LANCZOS = Image.LANCZOS
5356
except ImportError:
57+
# pillow is optional so may not be installed
5458
Image = None
5559
ImageOps = None
5660

0 commit comments

Comments
 (0)