mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #4272 from radarhere/thumbnail
Allow thumbnail to accept non-integer size arguments
This commit is contained in:
commit
16220d9a87
|
@ -43,6 +43,11 @@ class TestImageThumbnail(PillowTestCase):
|
|||
im.thumbnail((33, 33))
|
||||
self.assertEqual(im.size, (21, 33)) # ratio is 0.6363636364
|
||||
|
||||
def test_float(self):
|
||||
im = Image.new("L", (128, 128))
|
||||
im.thumbnail((99.9, 99.9))
|
||||
self.assertEqual(im.size, (100, 100))
|
||||
|
||||
def test_no_resize(self):
|
||||
# Check that draft() can resize the image to the destination size
|
||||
with Image.open("Tests/images/hopper.jpg") as im:
|
||||
|
|
|
@ -2138,10 +2138,10 @@ class Image:
|
|||
x, y = self.size
|
||||
if x > size[0]:
|
||||
y = max(round(y * size[0] / x), 1)
|
||||
x = size[0]
|
||||
x = round(size[0])
|
||||
if y > size[1]:
|
||||
x = max(round(x * size[1] / y), 1)
|
||||
y = size[1]
|
||||
y = round(size[1])
|
||||
size = x, y
|
||||
|
||||
if size == self.size:
|
||||
|
|
Loading…
Reference in New Issue
Block a user