GNOME Bugzilla – Bug 766890
io-bmp.c: unsupported header size returned for BMP v3 with RGBA bitmasks
Last modified: 2016-12-19 17:33:51 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).
Created attachment 328536 [details] Non-working 32-bit BMP saved by GIMP ("Don't write color space info" checked)
Created attachment 328537 [details] Working 32-bit BMP saved by GIMP ("Don't write color space info" left unchecked)
Created attachment 342229 [details] [review] tests: Add test for bug 766890
Created attachment 342230 [details] [review] bmp: Add support for BMP headers with bitmask Header size 52 and 56 failed to load before this patch.
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