diff --git a/src/PIL/Image.py b/src/PIL/Image.py index e1ae4a678..0e9c4722b 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2236,8 +2236,11 @@ class Image: :returns: None """ - # preserve aspect ratio x, y = size + if x >= self.width and y >= self.height: + return + + # preserve aspect ratio aspect = self.width / self.height if x / y >= aspect: x = max(y * aspect, 1) @@ -2245,9 +2248,6 @@ class Image: y = max(x / aspect, 1) size = (round(x), round(y)) - if size == self.size: - return - box = None if reducing_gap is not None: res = self.draft(None, (size[0] * reducing_gap, size[1] * reducing_gap))