Skip to content

Commit 935e9e4

Browse files
authored
Return PixelAccess from first load of ICO and IPTC images (#8922)
2 parents c96b277 + 1e365d8 commit 935e9e4

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

Tests/test_file_ico.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def test_getpixel(tmp_path: Path) -> None:
9999
reloaded.load()
100100
reloaded.size = (32, 32)
101101

102+
assert reloaded.load() is not None
102103
assert reloaded.getpixel((0, 0)) == (18, 20, 62)
103104

104105

Tests/test_file_iptc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def test_open() -> None:
2323
assert im.tile == [("iptc", (0, 0, 1, 1), 25, "raw")]
2424
assert_image_equal(im, expected)
2525

26+
with Image.open(f) as im:
27+
assert im.load() is not None
28+
2629

2730
def test_getiptcinfo_jpg_none() -> None:
2831
# Arrange

src/PIL/IcoImagePlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def load(self) -> Image.core.PixelAccess | None:
362362
self.info["sizes"] = set(sizes)
363363

364364
self.size = im.size
365-
return None
365+
return Image.Image.load(self)
366366

367367
def load_seek(self, pos: int) -> None:
368368
# Flag the ImageFile.Parser so that it

src/PIL/IptcImagePlugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def load(self) -> Image.core.PixelAccess | None:
179179
with Image.open(o) as _im:
180180
_im.load()
181181
self.im = _im.im
182-
return None
182+
self.tile = []
183+
return Image.Image.load(self)
183184

184185

185186
Image.register_open(IptcImageFile.format, IptcImageFile)

0 commit comments

Comments
 (0)