mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 02:46:18 +03:00
Only save relevant sizes
This commit is contained in:
parent
ed4c0a58e8
commit
880464f46c
|
@ -46,8 +46,9 @@ def _save(im, fp, filename):
|
||||||
[(16, 16), (24, 24), (32, 32), (48, 48),
|
[(16, 16), (24, 24), (32, 32), (48, 48),
|
||||||
(64, 64), (128, 128), (256, 256)])
|
(64, 64), (128, 128), (256, 256)])
|
||||||
width, height = im.size
|
width, height = im.size
|
||||||
filter(lambda x: False if (x[0] > width or x[1] > height or
|
sizes = filter(lambda x: False if (x[0] > width or x[1] > height or
|
||||||
x[0] > 256 or x[1] > 256) else True, sizes)
|
x[0] > 256 or x[1] > 256) else True,
|
||||||
|
sizes)
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user