Merge pull request #49 from axu2/crop

Don't crop 2 page spreads
This commit is contained in:
Alex Yatskov 2022-02-05 20:39:53 -08:00 committed by GitHub
commit aeb813f76b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -135,6 +135,16 @@ def quantizeImage(image, palette):
@protect_bad_image
def scaleCropImage(image, size):
widthDev, heightDev = size
widthImg, heightImg = image.size
imgRatio = float(widthImg) / float(heightImg)
devRatio = float(widthDev) / float(heightDev)
# don't crop 2 page spreads.
if imgRatio > devRatio:
return resizeImage(image, size)
return ImageOps.fit(image, size, Image.ANTIALIAS)

View File

@ -217,7 +217,7 @@
<item>
<widget class="QRadioButton" name="checkboxScaleCrop">
<property name="text">
<string>Scale and crop images to fill the screen</string>
<string>Scale and crop images to fill screen width</string>
</property>
</widget>
</item>