Skip to content

Commit

Permalink
Merge pull request #121 from FreeBear-nc/main
Browse files Browse the repository at this point in the history
PIL uses a width,height tuple for resize() and thumbnail().
  • Loading branch information
fvanroie authored May 12, 2024
2 parents ee7172a + f7b555c commit 10833d3
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.LANCZOS)
im.thumbnail((width, height), Image.LANCZOS)
else:
im = im.resize((height, width), Image.LANCZOS)
im = im.resize((width, height), Image.LANCZOS)
width, height = im.size # actual size after resize

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

0 comments on commit 10833d3

Please sign in to comment.