diff --git a/PIL/Image.py b/PIL/Image.py index ec995c8f4..5540de4bd 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1926,18 +1926,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 = min(float(size[0])/x, float(size[1])/y) + x, y = int(x*factor), int(y*factor) + size = x, y self.draft(None, size)