Keep user-specified ordering of icon sizes

Some consumers of icon files such as py2exe care about the order that icon sizes are added, so the user should be fully in charge of this, instead of force sorting them.
This commit is contained in:
Karim Bahgat 2015-04-14 20:17:57 +02:00
parent 5be6f810a5
commit 740ab40c6d

View File

@ -48,7 +48,6 @@ def _save(im, fp, filename):
width, height = im.size width, height = im.size
filter(lambda x: False if (x[0] > width or x[1] > height or filter(lambda x: False if (x[0] > width or x[1] > height or
x[0] > 255 or x[1] > 255) else True, sizes) x[0] > 255 or x[1] > 255) else True, sizes)
sizes = sorted(sizes, key=lambda x: x[0])
fp.write(struct.pack("H", len(sizes))) # idCount(2) fp.write(struct.pack("H", len(sizes))) # idCount(2)
offset = fp.tell() + len(sizes)*16 offset = fp.tell() + len(sizes)*16
for size in sizes: for size in sizes: