From c1e8a8c2e45620e29a4eabbfad93630ec7882829 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 24 Mar 2021 20:51:21 -0700 Subject: [PATCH] Scale and Crop instead of Stretch --- mangle/image.py | 6 ++---- mangle/ui/options.ui | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mangle/image.py b/mangle/image.py index b9ba9e5..431afab 100644 --- a/mangle/image.py +++ b/mangle/image.py @@ -16,7 +16,7 @@ import os -from PIL import Image, ImageDraw, ImageStat, ImageChops +from PIL import Image, ImageDraw, ImageStat, ImageChops, ImageOps class ImageFlags: @@ -135,9 +135,7 @@ def quantizeImage(image, palette): @protect_bad_image def stretchImage(image, size): - widthDev, heightDev = size - - return image.resize((widthDev, heightDev), Image.ANTIALIAS) + return ImageOps.fit(image, size, Image.ANTIALIAS) @protect_bad_image diff --git a/mangle/ui/options.ui b/mangle/ui/options.ui index dded245..d82b049 100644 --- a/mangle/ui/options.ui +++ b/mangle/ui/options.ui @@ -217,7 +217,7 @@ - Stretch images to fill the screen + Scale and crop images to fill the screen