GraphicsMagick: coders/bmp.c Default bit split for older BMPs wi...
GraphicsMagick Commits <[email protected]> Mon, 04 Sep 2023 01:51:14 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.13835.1693810284.1374.graphicsmagick-commit@lists.sourceforge.net> |
changeset d338cdc9c5ab in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=d338cdc9c5ab summary: coders/bmp.c Default bit split for older BMPs with 32bpp and BI_BITFIELDS set is crazy. diffstat: ChangeLog | 6 ++++++ coders/bmp.c | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diffs (47 lines): diff -r f6375160b0de -r d338cdc9c5ab ChangeLog --- a/ChangeLog Sat Sep 02 09:50:59 2023 -0500 +++ b/ChangeLog Mon Sep 04 08:50:51 2023 +0200 @@ -1,3 +1,9 @@ +2023-09-04 Fojtik Jaroslav <[email protected]> + + * coders/bmp.c Default bit split for older BMPs with 32bpp and + BI_BITFIELDS set is crazy. Verified against IrFanView and + bmpsuite-2.7.zip - image g/rgb32bf.bmp. + 2023-09-02 Bob Friesenhahn <[email protected]> * magick/resize.c (ResizeImage): Restore vertical/horizontal diff -r f6375160b0de -r d338cdc9c5ab coders/bmp.c --- a/coders/bmp.c Sat Sep 02 09:50:59 2023 -0500 +++ b/coders/bmp.c Mon Sep 04 08:50:51 2023 +0200 @@ -1416,14 +1416,24 @@ } if ( bmp_info.bits_per_pixel == 32) { - if(bmp_info.compression==BI_RGB || bmp_info.compression==BI_ALPHABITFIELDS) + if(bmp_info.size<=52 && bmp_info.compression==BI_BITFIELDS) + { + bmp_info.blue_mask=0xFF0000; + bmp_info.green_mask=0xFF0; /* This is crazy :(. */ + bmp_info.red_mask=0xFF000000; + /*bmp_info.alpha_mask=0x0; */ + } + else { - image->matte = True; - bmp_info.alpha_mask=0xff000000U; + if(bmp_info.compression==BI_RGB || bmp_info.compression==BI_ALPHABITFIELDS) + { + image->matte = True; + bmp_info.alpha_mask=0xff000000U; + } + bmp_info.red_mask=0x00ff0000U; + bmp_info.green_mask=0x0000ff00U; + bmp_info.blue_mask=0x000000ffU; } - bmp_info.red_mask=0x00ff0000U; - bmp_info.green_mask=0x0000ff00U; - bmp_info.blue_mask=0x000000ffU; } }