Update Image.py

This commit is contained in:
thodnev 2016-08-25 03:14:42 +03:00 committed by GitHub
parent 651432b723
commit b568220ae4

View File

@ -1790,8 +1790,8 @@ class Image(object):
# preserve aspect ratio # preserve aspect ratio
x, y = self.size x, y = self.size
if x > size[0] or y > size[1]: if x > size[0] or y > size[1]:
factor = max(x/size[0], y/size[1]) factor = min(float(size[0])/x, float(size[1])/y)
x, y = int(x/factor), int(y/factor) x, y = int(x*factor), int(y*factor)
size = x, y size = x, y
self.draft(None, size) self.draft(None, size)