Skip to content

Commit 03ed194

Browse files
authored
Merge pull request PySimpleGUI#6539 from PySimpleGUI/Dev-latest
Replaced PIL's deprecated constant ANTIALIAS with LANCZOS
2 parents 77ba1eb + 3776730 commit 03ed194

13 files changed

+16
-16
lines changed

DemoPrograms/Demo_Buttons_Nice_Graphics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def resize_base64_image(image64, size):
2626
'''
2727
image_file = io.BytesIO(base64.b64decode(image64))
2828
img = Image.open(image_file)
29-
img.thumbnail(size, Image.ANTIALIAS)
29+
img.thumbnail(size, Image.LANCZOS)
3030
bio = io.BytesIO()
3131
img.save(bio, format='PNG')
3232
imgbytes = bio.getvalue()

DemoPrograms/Demo_Desktop_Widget_Digital_Picture_Frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def convert_to_bytes(source, size=(None, None), subsample=None, zoom=None, fill=
8181
elif zoom is not None:
8282
scale = zoom
8383

84-
resized_image = image.resize((int(width * scale), int(height * scale)), Image.ANTIALIAS) if scale is not None else image
84+
resized_image = image.resize((int(width * scale), int(height * scale)), Image.LANCZOS) if scale is not None else image
8585
if fill and scale is not None:
8686
resized_image = make_square(resized_image)
8787
# encode a PNG formatted version of image into BASE64

DemoPrograms/Demo_Emoji_Toolbar_PIL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def convert_to_bytes(file_or_bytes, resize=None, fill=False):
9292
if resize:
9393
new_width, new_height = resize
9494
scale = min(new_height / cur_height, new_width / cur_width)
95-
img = img.resize((int(cur_width * scale), int(cur_height * scale)), PIL.Image.ANTIALIAS)
95+
img = img.resize((int(cur_width * scale), int(cur_height * scale)), PIL. Image.LANCZOS)
9696
if fill:
9797
if resize is not None:
9898
img = make_square(img, resize[0])

DemoPrograms/Demo_Graph_Elem_Image_Album.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def convert_to_bytes(file_or_bytes, resize=None):
4444
if resize:
4545
new_width, new_height = resize
4646
scale = min(new_height/cur_height, new_width/cur_width)
47-
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL.Image.ANTIALIAS)
47+
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL. Image.LANCZOS)
4848
bio = io.BytesIO()
4949
img.save(bio, format="PNG")
5050
del img

DemoPrograms/Demo_Image_Elem_Image_Viewer_PIL_Based.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def convert_to_bytes(file_or_bytes, resize=None):
4545
if resize:
4646
new_width, new_height = resize
4747
scale = min(new_height/cur_height, new_width/cur_width)
48-
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL.Image.ANTIALIAS)
48+
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL. Image.LANCZOS)
4949
with io.BytesIO() as bio:
5050
img.save(bio, format="PNG")
5151
del img

DemoPrograms/Demo_Image_Resize_and_Base64_Encode.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def resize(input_file, size, output_file=None, encode_format='PNG'):
5555
new_width, new_height = size
5656
if new_width != width or new_height != height: # if the requested size is different than original size
5757
scale = min(new_height / height, new_width / width)
58-
resized_image = image.resize((int(width * scale), int(height * scale)), Image.ANTIALIAS)
58+
resized_image = image.resize((int(width * scale), int(height * scale)), Image.LANCZOS)
5959
else:
6060
resized_image = image
6161

DemoPrograms/Demo_Image_Viewer_Thumbnails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def convert_to_bytes(file_or_bytes, resize=None, fill=False):
5656
if resize:
5757
new_width, new_height = resize
5858
scale = min(new_height / cur_height, new_width / cur_width)
59-
img = img.resize((int(cur_width * scale), int(cur_height * scale)), PIL.Image.ANTIALIAS)
59+
img = img.resize((int(cur_width * scale), int(cur_height * scale)), PIL. Image.LANCZOS)
6060
if fill:
6161
img = make_square(img, THUMBNAIL_SIZE[0])
6262
with io.BytesIO() as bio:

DemoPrograms/Demo_Matplotlib_Grid_of_Graphs_Using_PIL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def convert_to_bytes(file_or_bytes, resize=None):
890890
if resize:
891891
new_width, new_height = resize
892892
scale = min(new_height/cur_height, new_width/cur_width)
893-
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL.Image.ANTIALIAS)
893+
img = img.resize((int(cur_width*scale), int(cur_height*scale)), PIL. Image.LANCZOS)
894894
with io.BytesIO() as bio:
895895
img.save(bio, format="PNG")
896896
del img

DemoPrograms/Demo_Nice_Buttons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
def image_file_to_bytes(image64, size):
1616
image_file = io.BytesIO(base64.b64decode(image64))
1717
img = Image.open(image_file)
18-
img.thumbnail(size, Image.ANTIALIAS)
18+
img.thumbnail(size, Image.LANCZOS)
1919
bio = io.BytesIO()
2020
img.save(bio, format='PNG')
2121
imgbytes = bio.getvalue()

DemoPrograms/Demo_PIL_Use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def convert_to_bytes(source, size=(None, None), subsample=None, zoom=None, fill=
6060
elif zoom is not None:
6161
scale = zoom
6262

63-
resized_image = image.resize((int(width * scale), int(height * scale)), Image.ANTIALIAS) if scale is not None else image
63+
resized_image = image.resize((int(width * scale), int(height * scale)), Image.LANCZOS) if scale is not None else image
6464
if fill and scale is not None:
6565
resized_image = make_square(resized_image)
6666
# encode a PNG formatted version of image into BASE64

0 commit comments

Comments
 (0)