This commit is contained in:
ziplantil 2020-04-19 16:54:53 +03:00
parent 52b9b4310c
commit 39f4738775
2 changed files with 2 additions and 4 deletions

View File

@ -90,7 +90,7 @@ def test_only_save_append_images(tmp_path):
im = hopper()
provided_im = Image.new("RGBA", (32, 32), (255, 0, 0, 255))
outfile = str(tmp_path / "temp_saved_multi_icon.ico")
im.save(outfile, sizes = [(32, 32), (64, 64)], append_images = [provided_im])
im.save(outfile, sizes=[(32, 32), (64, 64)], append_images=[provided_im])
with Image.open(outfile) as reread:
reread.size = (64, 64)

View File

@ -52,9 +52,7 @@ def _save(im, fp, filename):
sizes = list(sizes)
fp.write(struct.pack("<H", len(sizes))) # idCount(2)
offset = fp.tell() + len(sizes) * 16
alt_images = {
im.size: im for im in im.encoderinfo.get("append_images", [])
}
alt_images = {im.size: im for im in im.encoderinfo.get("append_images", [])}
for size in sizes:
width, height = size
# 0 means 256