mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-15 02:32:29 +03:00
Fix resizing test
This commit is contained in:
parent
c373c498d9
commit
efb647ff79
|
@ -292,8 +292,11 @@ class TestImageResize:
|
||||||
|
|
||||||
def resize_scale(mode: str, scale: float) -> None:
|
def resize_scale(mode: str, scale: float) -> None:
|
||||||
img = hopper(mode)
|
img = hopper(mode)
|
||||||
size = (int(self.width * scale), int(self.height * scale))
|
size = (
|
||||||
out = img.resize(scale=scale)
|
int(self.width * scale),
|
||||||
|
int(self.height * scale)
|
||||||
|
)
|
||||||
|
out = img.resize(img.size, scale=scale)
|
||||||
assert out.mode == mode
|
assert out.mode == mode
|
||||||
assert out.size == tuple(size)
|
assert out.size == tuple(size)
|
||||||
|
|
||||||
|
|
|
@ -2230,8 +2230,8 @@ class Image:
|
||||||
:param size: The requested size in pixels, as a tuple or array:
|
:param size: The requested size in pixels, as a tuple or array:
|
||||||
(width, height).
|
(width, height).
|
||||||
:param scale: An optional scale factor to upsample/downsample the image:
|
:param scale: An optional scale factor to upsample/downsample the image:
|
||||||
(e.g. 0.5 means that an image (width, height) will be
|
(e.g. 0.5 means that an image input size will be
|
||||||
resized to (width/2, height/2)). If provided overwrite size.
|
resized to (size[0]/2, size[1]/2)).
|
||||||
:param resample: An optional resampling filter. This can be
|
:param resample: An optional resampling filter. This can be
|
||||||
one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
|
one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
|
||||||
:py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
|
:py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
|
||||||
|
@ -2292,7 +2292,10 @@ class Image:
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
if scale:
|
if scale:
|
||||||
size = (int(self.width * scale), int(self.height * scale))
|
size = (
|
||||||
|
int(size[0] * scale),
|
||||||
|
int(size[1] * scale)
|
||||||
|
)
|
||||||
|
|
||||||
self.load()
|
self.load()
|
||||||
if box is None:
|
if box is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user