From f7b555cc569ac36556bed9ef4282cee4ea9c5850 Mon Sep 17 00:00:00 2001 From: FreeBear Date: Thu, 2 May 2024 14:10:14 +0100 Subject: [PATCH] PIL uses a width,height tuple for resize() and thumbnail(). --- custom_components/openhasp/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/openhasp/image.py b/custom_components/openhasp/image.py index 6b2998a..7a1b904 100644 --- a/custom_components/openhasp/image.py +++ b/custom_components/openhasp/image.py @@ -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")