djangosnippets.org: Latest snippets tagged with 'ico'https://djangosnippets.org/tags/ico/2009-01-17T07:38:09.541368-06:00Load Windows ICO files
2009-01-17T07:38:09.541368-06:00dchttps://djangosnippets.org/snippets/1287/<p>PIL IcoImagePlugin is twelve year old and it can't handle recent Windows ICO files. Here is a function that handles all ICO versions and preserve transparency.</p>
<p>Usage:</p>
<pre><code># Load biggest icon from file
image = load_icon('icon.ico')
# Save third icon as PNG
load_icon('icon.ico', 2).save('icon.png')
</code></pre>
Freely redistributable