mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Don't upscale if the image is smaller than the size
This commit is contained in:
parent
e9ef1d236d
commit
e226e4ed64
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user