Make ratio comparison more explicit
This commit is contained in:
parent
b70da17f80
commit
7df96e86eb
@ -138,8 +138,11 @@ def scaleCropImage(image, size):
|
|||||||
widthDev, heightDev = size
|
widthDev, heightDev = size
|
||||||
widthImg, heightImg = image.size
|
widthImg, heightImg = image.size
|
||||||
|
|
||||||
|
imgRatio = float(widthImg) / float(heightImg)
|
||||||
|
devRatio = float(widthDev) / float(heightDev)
|
||||||
|
|
||||||
# don't crop 2 page spreads.
|
# don't crop 2 page spreads.
|
||||||
if (float(widthImg) / float(heightImg)) > (float(widthDev) / float(heightDev)):
|
if imgRatio > devRatio:
|
||||||
return resizeImage(image, size)
|
return resizeImage(image, size)
|
||||||
|
|
||||||
return ImageOps.fit(image, size, Image.ANTIALIAS)
|
return ImageOps.fit(image, size, Image.ANTIALIAS)
|
||||||
|
Loading…
Reference in New Issue
Block a user