After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674724 - ico files are limited to 255 x 255 when they should be 256 x 256
ico files are limited to 255 x 255 when they should be 256 x 256
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: loaders
git master
Other All
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2012-04-24 14:35 UTC by Robert Nordan
Modified: 2014-10-26 11:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert Nordan 2012-04-24 14:35:12 UTC
In the Pinta project we fixed a crash when users tried to save images larger than 256 x 256 as .ico files via gdk-pixbuf, but then when I checked the gdk-pixbuf source code to make sure [1] it turned out that the limit is set to 255 x 255. Now, I know from [2] and [3] that classic .ico files can be 256 x 256 pixels. However, it appears that 256 x 256 is supposed to be stored as 0 x 0 , and this is where gdk-pixbuf goes wrong by throwing an error when a file is 256 x 256 pixels. It should instead store the file and write 0 x 0 in the header.

[1]: http://git.gnome.org/browse/gdk-pixbuf/tree/gdk-pixbuf/io-ico.c#n998
[2]: http://msdn.microsoft.com/en-us/library/aa511280.aspx
[3]: https://en.wikipedia.org/wiki/ICO_%28file_format%29
Comment 1 Bastien Nocera 2014-10-22 17:15:18 UTC
Do you have a 256x256 example file that we could use for testing? (we can test loading 256x256 files, and then check that we can load the 256x256 file that we saved ourselves)
Comment 2 Bastien Nocera 2014-10-24 13:32:58 UTC
commit 3997cbb736ec67dd1b5a4205ab7aea3d5aecae1f
Author: Bastien Nocera <hadess@hadess.net>
Date:   Fri Oct 24 15:19:49 2014 +0200

    ico: Fix support for 256x256 icons
    
    In both loading and saving them. The ico format uses "0" as the width
    or height to mean 256:
    https://en.wikipedia.org/wiki/ICO_%28file_format%29#Icon_resource_structure
    
    Also add a test for that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674724
Comment 3 Robert Nordan 2014-10-26 11:14:06 UTC
Hi, sorry I didn't get back to you in time (I was up a mountain), but didn't have any particular 256 x 256 file to test with. Any 256px file would be fine though, so I believe your approach is entirely correct. Thanks for fixing it!