Skip to content

Commit

Permalink
Merge pull request #6821 from radarhere/pyaccess
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Dec 23, 2022
2 parents 54eb835 + b0f1d2e commit 6fc0456
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Tests/test_file_ico.py
Expand Up @@ -71,6 +71,19 @@ def test_save_to_bytes():
)


def test_getpixel(tmp_path):
temp_file = str(tmp_path / "temp.ico")

im = hopper()
im.save(temp_file, "ico", sizes=[(32, 32), (64, 64)])

with Image.open(temp_file) as reloaded:
reloaded.load()
reloaded.size = (32, 32)

assert reloaded.getpixel((0, 0)) == (18, 20, 62)


def test_no_duplicates(tmp_path):
temp_file = str(tmp_path / "temp.ico")
temp_file2 = str(tmp_path / "temp2.ico")
Expand Down
1 change: 1 addition & 0 deletions src/PIL/IcoImagePlugin.py
Expand Up @@ -327,6 +327,7 @@ def load(self):
# if tile is PNG, it won't really be loaded yet
im.load()
self.im = im.im
self.pyaccess = None
self.mode = im.mode
if im.size != self.size:
warnings.warn("Image was not the expected size")
Expand Down

0 comments on commit 6fc0456

Please sign in to comment.