Skip to content

Commit

Permalink
image-compressor@schorschii: Fix PIL bug (#585)
Browse files Browse the repository at this point in the history
There is a bug in img = img.resize((newWidth,newHeight), Image.ANTIALIAS)
ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions). Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS.

https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#constants
  • Loading branch information
ernemir authored Jan 7, 2025
1 parent fd1d77a commit 85ea084
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self):
print(" Old width is smaller than target width, adjusting: newWidth = oldWidth")
newWidth = oldWidth
newHeight = int(oldHeight * newWidth / oldWidth)
img = img.resize((newWidth,newHeight), Image.ANTIALIAS)
img = img.resize((newWidth,newHeight), Image.Resampling.LANCZOS)
img.save(newFileName, optimize=True, quality=TARGET_QUALITY)
print("Saved: " + newFileName)

Expand Down

0 comments on commit 85ea084

Please sign in to comment.