Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bb2639

Browse files
committed
replacing Image.ANTIALIAS with Image.LANCZOS for Pillow 10.0.0+ in the image compressor code
1 parentc5c955e commit4bb2639

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
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
ifnew_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
elifwidthandheight:
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)

[8]ページ先頭

©2009-2025 Movatter.jp