Upscale small previews to fill canvas

This commit is contained in:
lm 2025-10-19 18:10:24 +02:00
parent f467e0b2e5
commit 27c0e55711
1 changed files with 3 additions and 1 deletions

View File

@ -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)