Merge pull request #50 from axu2/patch-2

don't rotate small images
This commit is contained in:
Alex Yatskov 2022-02-17 19:28:53 -08:00 committed by GitHub
commit 0dbc45fc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,6 +185,9 @@ def orientImage(image, size):
widthDev, heightDev = size widthDev, heightDev = size
widthImg, heightImg = image.size widthImg, heightImg = image.size
if widthImg <= widthDev and heightImg <= heightDev:
return image
if (widthImg > heightImg) != (widthDev > heightDev): if (widthImg > heightImg) != (widthDev > heightDev):
return image.rotate(90, Image.BICUBIC, True) return image.rotate(90, Image.BICUBIC, True)
return image return image