Skip to content

Commit

Permalink
Update image.py
Browse files Browse the repository at this point in the history
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.

(This is the exact same algorithm that ANTIALIAS referred to, you just can no longer access it through the name ANTIALIAS.)
  • Loading branch information
fvanroie authored Aug 5, 2023
1 parent 1427244 commit 932e5dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/openhasp/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def image_to_rgb565(in_image, size, fitscreen):
if not fitscreen:
width = min(w for w in [width, original_width] if w is not None and w > 0)
height = min(h for h in [height, original_height] if h is not None and h > 0)
im.thumbnail((height, width), Image.ANTIALIAS)
im.thumbnail((height, width), Image.LANCZOS)
else:
im = im.resize((height, width), Image.ANTIALIAS)
im = im.resize((height, width), Image.LANCZOS)
width, height = im.size # actual size after resize

out_image = tempfile.NamedTemporaryFile(mode="w+b")
Expand Down

0 comments on commit 932e5dd

Please sign in to comment.