mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-25 00:34:14 +03:00
Merge pull request #255 from pterk/master
Fix for ZeroDivisionError in ImageOps.fit for image.size == (1,1)
This commit is contained in:
commit
1c55e01f62
|
@ -274,6 +274,10 @@ def fit(image, size, method=Image.NEAREST, bleed=0.0, centering=(0.5, 0.5)):
|
|||
# kevin@cazabon.com
|
||||
# http://www.cazabon.com
|
||||
|
||||
# No cropping/fit possible. Prevents ZeroDivisionError @ liveAreaAspectRatio
|
||||
if image.size == (1,1):
|
||||
return image
|
||||
|
||||
# ensure inputs are valid
|
||||
if not isinstance(centering, list):
|
||||
centering = [centering[0], centering[1]]
|
||||
|
|
|
@ -37,6 +37,7 @@ def test_sanity():
|
|||
|
||||
ImageOps.fit(lena("L"), (128, 128))
|
||||
ImageOps.fit(lena("RGB"), (128, 128))
|
||||
ImageOps.fit(lena("RGB").resize((1,1)), (35,35))
|
||||
|
||||
ImageOps.flip(lena("L"))
|
||||
ImageOps.flip(lena("RGB"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user