mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-16 18:24:45 +03:00
Update Image.py
This commit is contained in:
parent
651432b723
commit
b568220ae4
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user