|
63 | 63 | ) |
64 | 64 | from ._binary import i32le, o32be, o32le |
65 | 65 | from ._deprecate import deprecate |
66 | | -from ._typing import StrOrBytesPath, TypeGuard |
67 | 66 | from ._util import DeferredError, is_path |
68 | 67 |
|
69 | 68 | ElementTree: ModuleType | None |
@@ -220,6 +219,7 @@ class Quantize(IntEnum): |
220 | 219 |
|
221 | 220 | if TYPE_CHECKING: |
222 | 221 | from . import ImageFile, ImagePalette |
| 222 | + from ._typing import NumpyArray, StrOrBytesPath, TypeGuard |
223 | 223 | ID: list[str] = [] |
224 | 224 | OPEN: dict[ |
225 | 225 | str, |
@@ -2203,15 +2203,15 @@ def _get_safe_box(self, size, resample, box): |
2203 | 2203 |
|
2204 | 2204 | def resize( |
2205 | 2205 | self, |
2206 | | - size: tuple[int, int], |
| 2206 | + size: tuple[int, int] | list[int] | NumpyArray, |
2207 | 2207 | resample: int | None = None, |
2208 | 2208 | box: tuple[float, float, float, float] | None = None, |
2209 | 2209 | reducing_gap: float | None = None, |
2210 | 2210 | ) -> Image: |
2211 | 2211 | """ |
2212 | 2212 | Returns a resized copy of this image. |
2213 | 2213 |
|
2214 | | - :param size: The requested size in pixels, as a 2-tuple: |
| 2214 | + :param size: The requested size in pixels, as a tuple or array: |
2215 | 2215 | (width, height). |
2216 | 2216 | :param resample: An optional resampling filter. This can be |
2217 | 2217 | one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, |
@@ -2276,6 +2276,7 @@ def resize( |
2276 | 2276 | if box is None: |
2277 | 2277 | box = (0, 0) + self.size |
2278 | 2278 |
|
| 2279 | + size = tuple(size) |
2279 | 2280 | if self.size == size and box == (0, 0) + self.size: |
2280 | 2281 | return self.copy() |
2281 | 2282 |
|
|
0 commit comments