Skip to content

Commit 4bb2639

Browse files
committed
replacing Image.ANTIALIAS with Image.LANCZOS for Pillow 10.0.0+ in the image compressor code
1 parent c5c955e commit 4bb2639

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python-for-multimedia/compress-image/compress_image.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def compress_img(image_name, new_size_ratio=0.9, quality=90, width=None, height=
2828
print("[*] Size before compression:", get_size_format(image_size))
2929
if new_size_ratio < 1.0:
3030
# if resizing ratio is below 1.0, then multiply width & height with this ratio to reduce image size
31-
img = img.resize((int(img.size[0] * new_size_ratio), int(img.size[1] * new_size_ratio)), Image.ANTIALIAS)
31+
img = img.resize((int(img.size[0] * new_size_ratio), int(img.size[1] * new_size_ratio)), Image.LANCZOS)
3232
# print new image shape
3333
print("[+] New Image shape:", img.size)
3434
elif width and height:
3535
# if width and height are set, resize with them instead
36-
img = img.resize((width, height), Image.ANTIALIAS)
36+
img = img.resize((width, height), Image.LANCZOS)
3737
# print new image shape
3838
print("[+] New Image shape:", img.size)
3939
# split the filename and extension

0 commit comments

Comments
 (0)