From 740ab40c6da4200ad2387c53fe6c13067e7c5747 Mon Sep 17 00:00:00 2001 From: Karim Bahgat Date: Tue, 14 Apr 2015 20:17:57 +0200 Subject: [PATCH] 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. --- PIL/IcoImagePlugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PIL/IcoImagePlugin.py b/PIL/IcoImagePlugin.py index b4817db27..c4e24d99c 100644 --- a/PIL/IcoImagePlugin.py +++ b/PIL/IcoImagePlugin.py @@ -48,7 +48,6 @@ def _save(im, fp, filename): width, height = im.size filter(lambda x: False if (x[0] > width or x[1] > height or 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) offset = fp.tell() + len(sizes)*16 for size in sizes: