From 27c0e5571148f93f1dffbd4f629f2ebd2a4db9a3 Mon Sep 17 00:00:00 2001 From: lm Date: Sun, 19 Oct 2025 18:10:24 +0200 Subject: [PATCH] Upscale small previews to fill canvas --- app/logic/image_processing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/logic/image_processing.py b/app/logic/image_processing.py index ab15edd..f0c2819 100644 --- a/app/logic/image_processing.py +++ b/app/logic/image_processing.py @@ -194,7 +194,9 @@ class ImageProcessingMixin: return width, height = self.orig_img.size max_w, max_h = PREVIEW_MAX_SIZE - scale = min(max_w / width, max_h / height, 1.0) + scale = min(max_w / width, max_h / height) + if scale <= 0: + scale = 1.0 size = (max(1, int(width * scale)), max(1, int(height * scale))) self.preview_img = self.orig_img.resize(size, Image.LANCZOS) self.preview_tk = ImageTk.PhotoImage(self.preview_img)