GdkPixbuf: ICO files with multiple sizes
This issues is related to this mailinglist posting https://mail.gnome.org/archives/python-hackers-list/2019-June/msg00000.html where I was recommanded to open a bug report for it.
Short: Loading a ico
-file containing different resolutions as a GdkPixbuf.Pixbuf
causing picutre noise like on an old TV.
This is about PyGobject
with Python 3.
Please see this example ico file. I am not sure if the problem is me or the ico file itself is not valid.
In Firefox the icon looks like expected. When I open the (with aiohttp
)
downloaded ico file with IrfanView (via wine on Debian stable) or with
Gimp it looks like expected. Especially in Gimp I can see the icon in
multiple sizes (each in one GIMP layer). Fine.
I want to open it with GdkPixbuf
"scale" it to 16x16 (or select the
correct size). I want to use this Pixbuf
as an icon in a Gtk.TreeView
and I want to store it back into an ico file.
This doesn't work because the scaled result looks like picture noise on an old TV.
What I tried so far...
org = GdkPixbuf.Pixbuf.new_from_file('_favicon.ico')
small = org.scale_simple(16, 16, 2)
small.savev('small.ico', 'ico', '', '')
and
org = GdkPixbuf.Pixbuf.new_from_file_at_size('_favicon.ico', 16, 16)