diff --git a/Tests/test_image_resize.py b/Tests/test_image_resize.py index 04b7c8c97..6961afa60 100644 --- a/Tests/test_image_resize.py +++ b/Tests/test_image_resize.py @@ -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) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 2e8279583..aa7e3c2e6 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2024,6 +2024,7 @@ class Image: size = tuple(size) + self.load() if box is None: box = (0, 0) + self.size else: