Load before getting size in resize()

This commit is contained in:
Andrew Murray 2022-04-08 19:11:27 +10:00
parent 4996f84fb3
commit 0b5cdba431
2 changed files with 8 additions and 0 deletions

View File

@ -264,6 +264,13 @@ class TestImageResize:
with pytest.raises(ValueError):
im.resize((10, 10), "unknown")
def test_load_first(self):
# load() may change the size of the image
# Test that resize() is calling it before getting the size
with Image.open("Tests/images/g4_orientation_5.tif") as im:
im = im.resize((64, 64))
assert im.size == (64, 64)
def test_default_filter(self):
for mode in "L", "RGB", "I", "F":
im = hopper(mode)

View File

@ -2024,6 +2024,7 @@ class Image:
size = tuple(size)
self.load()
if box is None:
box = (0, 0) + self.size
else: