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 766890 - io-bmp.c: unsupported header size returned for BMP v3 with RGBA bitmasks
io-bmp.c: unsupported header size returned for BMP v3 with RGBA bitmasks
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: loaders
git master
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2016-05-25 22:24 UTC by Gokul Krishnan
Modified: 2016-12-19 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to support bmp header with bitmasks (header size 52 and 56) (2.04 KB, patch)
2016-05-25 22:24 UTC, Gokul Krishnan
none Details | Review
Non-working 32-bit BMP saved by GIMP ("Don't write color space info" checked) (546.94 KB, image/bmp)
2016-05-25 22:32 UTC, Gokul Krishnan
  Details
Working 32-bit BMP saved by GIMP ("Don't write color space info" left unchecked) (547.01 KB, image/bmp)
2016-05-25 22:33 UTC, Gokul Krishnan
  Details
tests: Add test for bug 766890 (292.41 KB, patch)
2016-12-19 17:31 UTC, Bastien Nocera
committed Details | Review
bmp: Add support for BMP headers with bitmask (2.66 KB, patch)
2016-12-19 17:31 UTC, Bastien Nocera
committed Details | Review

Description Gokul Krishnan 2016-05-25 22:24:33 UTC
Created attachment 328535 [details] [review]
Patch to support bmp header with bitmasks (header size 52 and 56)

gdk-pixbuf returns an "unsupported header size" error when loading bitmaps with header size 56, which is a v3 header with mandatory bitmasks (40 + 16 for RGBA bitmask).

This format appears to be undocumented, but is used by both GIMP and Photoshop for saving a 32-bit BMP without color space information. It's unfortunate that these bitmaps can't be displayed by programs using gdk-pixbuf.

I've quickly added support for it by modifying io-bmp.c from master. I haven't tested it myself as I haven't compiled it, but I'm attaching a patch in case devs are interested. The patch adds support for both BITMAPV2INFOHEADER (52) and BITMAPV3INFOHEADER (56).
Comment 1 Gokul Krishnan 2016-05-25 22:32:36 UTC
Created attachment 328536 [details]
Non-working 32-bit BMP saved by GIMP ("Don't write color space info" checked)
Comment 2 Gokul Krishnan 2016-05-25 22:33:33 UTC
Created attachment 328537 [details]
Working 32-bit BMP saved by GIMP ("Don't write color space info" left unchecked)
Comment 3 Bastien Nocera 2016-12-19 17:31:20 UTC
Created attachment 342229 [details] [review]
tests: Add test for bug 766890
Comment 4 Bastien Nocera 2016-12-19 17:31:27 UTC
Created attachment 342230 [details] [review]
bmp: Add support for BMP headers with bitmask

Header size 52 and 56 failed to load before this patch.
Comment 5 Bastien Nocera 2016-12-19 17:33:37 UTC
In the future, please attach git-formatted patches, it makes things much easier to merge.

Attachment 342229 [details] pushed as 69962e2 - tests: Add test for bug 766890
Attachment 342230 [details] pushed as cd302dd - bmp: Add support for BMP headers with bitmask