Add append_images support for ICO #4568
Conversation
Co-Authored-By: Andrew Murray <3112309+radarhere@users.noreply.github.com>
src/PIL/IcoImagePlugin.py
Outdated
| alt_images = {im.size: im for im in im.encoderinfo.get("append_images", [])} | ||
| for size in sizes: |
It looks like if someone were to add an unusual sized image to append_images (e.g. (20,20)), it would not be saved unless it is added to the sizes parameter as well. I feel like this could be confusing behaviour. Perhaps adding sizes.extend(alt_images.keys()) would be a good idea (sizes would have to be changed to a set to avoid duplicates).
That is correct. I believe the ICNS saving currently suffers from the same issue. I don't know if it should be fixed for .ICOs; the documentation would need to mention the role of append_images either way, since if the behavior is changed as you suggest, it would then also save other sizes than the ones the user requested (via the sizes parameter).
|
I've created https://github.com/ziplantil/Pillow/pull/1 with some suggestions. |
ICO append images suggestions
This adds support for the append_images parameter when saving .ICO files. Its behavior is much the same as for .ICNS files, and can be used to provide alternative sprites for particular icon sizes instead of simply resizing the main image to fit that size.
The text was updated successfully, but these errors were encountered: