Skip to content

Commit 6fc0456

Browse files
authored
Merge pull request #6821 from radarhere/pyaccess
2 parents 54eb835 + b0f1d2e commit 6fc0456

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Tests/test_file_ico.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ def test_save_to_bytes():
7171
)
7272

7373

74+
def test_getpixel(tmp_path):
75+
temp_file = str(tmp_path / "temp.ico")
76+
77+
im = hopper()
78+
im.save(temp_file, "ico", sizes=[(32, 32), (64, 64)])
79+
80+
with Image.open(temp_file) as reloaded:
81+
reloaded.load()
82+
reloaded.size = (32, 32)
83+
84+
assert reloaded.getpixel((0, 0)) == (18, 20, 62)
85+
86+
7487
def test_no_duplicates(tmp_path):
7588
temp_file = str(tmp_path / "temp.ico")
7689
temp_file2 = str(tmp_path / "temp2.ico")

src/PIL/IcoImagePlugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def load(self):
327327
# if tile is PNG, it won't really be loaded yet
328328
im.load()
329329
self.im = im.im
330+
self.pyaccess = None
330331
self.mode = im.mode
331332
if im.size != self.size:
332333
warnings.warn("Image was not the expected size")

0 commit comments

Comments
 (0)