Handle deprecation
This commit is contained in:
@@ -161,10 +161,16 @@ def generate_thumbnail(
|
||||
img = Transpose().process(img)
|
||||
original_format = img.format
|
||||
|
||||
try:
|
||||
method = PILImage.Resampling.LANCZOS
|
||||
except AttributeError:
|
||||
# Deprecated since version 9.1.0
|
||||
method = PILImage.ANTIALIAS
|
||||
|
||||
if fit:
|
||||
img = ImageOps.fit(img, box, PILImage.Resampling.LANCZOS, centering=thumb_fit_centering)
|
||||
img = ImageOps.fit(img, box, method, centering=thumb_fit_centering)
|
||||
else:
|
||||
img.thumbnail(box, PILImage.Resampling.LANCZOS)
|
||||
img.thumbnail(box, method)
|
||||
|
||||
outformat = img.format or original_format or 'JPEG'
|
||||
logger.debug('Save thumnail image: %s (%s)', outname, outformat)
|
||||
|
||||
Reference in New Issue
Block a user