mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Allow size argument to resize() to be a list
This commit is contained in:
parent
776dd63f33
commit
936012e861
|
@ -285,14 +285,14 @@ class TestReducingGapResize:
|
|||
|
||||
class TestImageResize:
|
||||
def test_resize(self) -> None:
|
||||
def resize(mode: str, size: tuple[int, int]) -> None:
|
||||
def resize(mode: str, size: tuple[int, int] | list[int]) -> None:
|
||||
out = hopper(mode).resize(size)
|
||||
assert out.mode == mode
|
||||
assert out.size == size
|
||||
assert out.size == tuple(size)
|
||||
|
||||
for mode in "1", "P", "L", "RGB", "I", "F":
|
||||
resize(mode, (112, 103))
|
||||
resize(mode, (188, 214))
|
||||
resize(mode, [188, 214])
|
||||
|
||||
# Test unknown resampling filter
|
||||
with hopper() as im:
|
||||
|
|
|
@ -2203,7 +2203,7 @@ class Image:
|
|||
|
||||
def resize(
|
||||
self,
|
||||
size: tuple[int, int],
|
||||
size: tuple[int, int] | list[int],
|
||||
resample: int | None = None,
|
||||
box: tuple[float, float, float, float] | None = None,
|
||||
reducing_gap: float | None = None,
|
||||
|
@ -2276,6 +2276,7 @@ class Image:
|
|||
if box is None:
|
||||
box = (0, 0) + self.size
|
||||
|
||||
size = tuple(size)
|
||||
if self.size == size and box == (0, 0) + self.size:
|
||||
return self.copy()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user