]> granicus.if.org Git - imagemagick/commitdiff
Force PNG decoder to return image->matte=MagickTrue when the PNG has
authorglennrp <glennrp@git.imagemagick.org>
Wed, 23 Mar 2011 12:38:38 +0000 (12:38 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Wed, 23 Mar 2011 12:38:38 +0000 (12:38 +0000)
colortype 4 or 6, or if the tRNS chunk is present, even when the image
is actually fully opaque.

ChangeLog
coders/png.c

index 2befc9c394bce6eb85e4ba2e524935fbcb6408d5..cc37fa46fe2704f843d259d67166df7f70639a1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
     colors into one (the background color), to reduce the compressed filesize.
   * First try the 4-4-4 and 3-3-3 palettes instead of 3-3-2, to preserve
     colors (especially gray) better, when reducing to PNG8.
+  * Force the PNG encoder to return image->matte==MagickTrue when the
+    format is RGBA or GA or if the tRNS chunk is present, even when the
+    image is fully opaque (reference
+    http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=18349).
 
 2011-03-21  6.6.8-6 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.8-6.
index 11d25e45723838c3866d699514f2fb27b883312f..8062c34da4995a3ace80653969d1b85b4e0035ec 100644 (file)
@@ -2994,6 +2994,16 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
         }
     }
 #endif
+
+   /* Set image->matte to MagickTrue if the input colortype supports
+    * alpha or if a valid tRNS chunk is present, no matter whether there
+    * is actual transparency present.
+    */
+    image->matte=(((int) ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA) ||
+        ((int) ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) ||
+        (png_get_valid(ping,ping_info,PNG_INFO_tRNS))) ?
+        MagickTrue : MagickFalse;
+
   /*
     Relinquish resources.
   */