From cebfde3174f2fb7864b0006b88fd8bf2f8d18e7e Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Sun, 13 Feb 2022 16:24:40 -0800 Subject: [PATCH] don't rotate small images --- mangle/image.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mangle/image.py b/mangle/image.py index 5fd7e38..7a68e46 100644 --- a/mangle/image.py +++ b/mangle/image.py @@ -185,6 +185,9 @@ def orientImage(image, size): widthDev, heightDev = size widthImg, heightImg = image.size + if widthImg <= widthDev and heightImg <= heightDev: + return image + if (widthImg > heightImg) != (widthDev > heightDev): return image.rotate(90, Image.BICUBIC, True) return image