🐛 Fix error due to Image.Resampling missing in PIL < 9.1

This commit is contained in:
Maxr1998 2023-09-21 23:22:53 +02:00
parent 54937caadb
commit ebcc2ff184
No known key found for this signature in database
GPG key ID: ECECF0D4F4816C81

View file

@ -47,7 +47,11 @@ def update_preview_cb(file_chooser, preview):
try:
i = Image.open(filename)
r = cropgui_common.image_rotation(i)
i.thumbnail((PREVIEW_SIZE, PREVIEW_SIZE), Image.Resampling.LANCZOS)
if hasattr(Image, 'Resampling'):
thumb_filter = Image.Resampling.LANCZOS
else:
thumb_filter = Image.LANCZOS
i.thumbnail((PREVIEW_SIZE, PREVIEW_SIZE), thumb_filter)
i = i.convert('RGB')
i = apply_rotation(r, i)
try: