diff --git a/PIL/Image.py b/PIL/Image.py index 839700a0f..851ef0b9c 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1785,18 +1785,14 @@ class Image(object): :returns: None """ - # preserve aspect ratio - x, y = self.size - if x > size[0]: - y = int(max(y * size[0] / x, 1)) - x = int(size[0]) - if y > size[1]: - x = int(max(x * size[1] / y, 1)) - y = int(size[1]) - size = x, y - if size == self.size: return + # preserve aspect ratio + x, y = self.size + if x > size[0] or y > size[1]: + factor = max(x/size[0], y/size[1]) + x, y = int(x/factor), int(y/factor) + size = x, y self.draft(None, size)