Upscale small previews to fill canvas
This commit is contained in:
parent
f467e0b2e5
commit
27c0e55711
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue