From 1e67b4aa49b0abb0652e91fcffafdcae5b40e237 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 9 Sep 2023 22:28:55 -0400 Subject: [PATCH] support alpha mask --- coders/bmp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/coders/bmp.c b/coders/bmp.c index 3ca1df8fe..4a6078d7d 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -75,6 +75,9 @@ #define BI_JPEG 4 #undef BI_PNG #define BI_PNG 5 +#ifndef BI_ALPHABITFIELDS + #define BI_ALPHABITFIELDS 6 +#endif #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__) #undef BI_RGB #define BI_RGB 0 @@ -809,6 +812,13 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) bmp_info.green_mask=ReadBlobLSBLong(image); bmp_info.blue_mask=ReadBlobLSBLong(image); } + if ((bmp_info.size > 40) || (bmp_info.compression == BI_ALPHABITFIELDS)) + { + bmp_info.red_mask=ReadBlobLSBLong(image); + bmp_info.green_mask=ReadBlobLSBLong(image); + bmp_info.blue_mask=ReadBlobLSBLong(image); + bmp_info.alpha_mask=ReadBlobLSBLong(image); + } if (bmp_info.size > 40) { double