GraphicsMagick: coders/bmp.c When alpha is to be used, writer mu...

GraphicsMagick Commits <[email protected]> Sun, 20 Aug 2023 17:53:21 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.10360.1692572012.1374.graphicsmagick-commit@lists.sourceforge.net>
changeset 42b384c4a64b in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=42b384c4a64b
summary: coders/bmp.c When alpha is to be used, writer must not use BI_BITFIELDS compression that instructs to strip alpha.

diffstat:

 ChangeLog    |  5 +++++
 coders/bmp.c |  8 +++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 6ea7e0724669 -r 42b384c4a64b ChangeLog
--- a/ChangeLog	Sun Aug 20 21:17:22 2023 +0200
+++ b/ChangeLog	Mon Aug 21 00:52:58 2023 +0200
@@ -1,3 +1,8 @@
+2023-08-21  Fojtik Jaroslav  <[email protected]>
+
+	* coders/bmp.c When alpha is to be used, writer must not use
+	BI_BITFIELDS compression that instructs to strip alpha.
+
 2023-08-20  Fojtik Jaroslav  <[email protected]>
 
 	* tiff/libtiff/stdbool2.h MSVC2010 does not have stdbool.h nor inttypes.h
diff -r 6ea7e0724669 -r 42b384c4a64b coders/bmp.c
--- a/coders/bmp.c	Sun Aug 20 21:17:22 2023 +0200
+++ b/coders/bmp.c	Mon Aug 21 00:52:58 2023 +0200
@@ -1983,7 +1983,7 @@
           bmp_info.number_colors=0;
           bmp_info.bits_per_pixel=((type > 3) && image->matte) ? 32 : 24;
           bmp_info.compression=
-            (type > 3) && image->matte ?  BI_BITFIELDS : BI_RGB;
+            (type > 3) && image->matte ?  BI_ALPHABITFIELDS : BI_RGB;
         }
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                             "Final: Scene %lu, storage_class %s, colors %u",
@@ -2297,6 +2297,12 @@
                                       "   Compression=BI_BITFIELDS");
                 break;
               }
+            case BI_ALPHABITFIELDS:
+              {
+                (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                      "   Compression=BI_ALPHABITFIELDS");
+                break;
+              }
             default:
               {
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),