]> granicus.if.org Git - imagemagick/commitdiff
Fixed bug with PNG00 when the input file is a PNG32.
authorglennrp <glennrp@git.imagemagick.org>
Tue, 22 Apr 2014 23:45:20 +0000 (23:45 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Tue, 22 Apr 2014 23:45:20 +0000 (23:45 +0000)
coders/png.c

index 9ae064775be0a68c5d07d7fb39ccf95987c74ded..a3f7af494370b47ba3d19b5df891013260e2046e 100644 (file)
@@ -8525,7 +8525,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
   number_transparent = 0;
   number_semitransparent = 0;
 
-  if (image->storage_class != PseudoClass && mng_info->write_png_colortype &&
+  if (mng_info->write_png_colortype &&
      (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&
      mng_info->write_png_colortype < 4 &&
      image->alpha_trait != BlendPixelTrait)))
@@ -8544,7 +8544,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
        }
   }
 
-  else
+  if (mng_info->write_png_colortype < 7)
   {
   /* BUILD_PALETTE
    *
@@ -9446,8 +9446,11 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
   image_colors=(int) image->colors;
   image_matte=image->alpha_trait == BlendPixelTrait ? MagickTrue : MagickFalse;
 
-  mng_info->IsPalette=image->storage_class == PseudoClass &&
-    image_colors <= 256 && image->colormap != NULL;
+  if (mng_info->write_png_colortype > 4)
+    mng_info->IsPalette=image->storage_class == PseudoClass &&
+      image_colors <= 256 && image->colormap != NULL;
+  else
+    mng_info->IsPalette = MagickFalse;
 
   if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&
      (image->colors == 0 || image->colormap == NULL))
@@ -11739,13 +11742,9 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info,
       mng_info->write_png_colortype = /* 6 */  7;
       mng_info->write_png_depth = 8;
       image->depth = 8;
+      image->alpha_trait == BlendPixelTrait;
 
-      if (image->alpha_trait == BlendPixelTrait)
-        (void) SetImageType(image,TrueColorMatteType,exception);
-
-      else
-        (void) SetImageType(image,TrueColorType,exception);
-
+      (void) SetImageType(image,TrueColorMatteType,exception);
       (void) SyncImage(image,exception);
     }
 
@@ -11769,13 +11768,9 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info,
       mng_info->write_png_colortype = /* 6 */  7;
       mng_info->write_png_depth = 16;
       image->depth = 16;
+      image->alpha_trait == BlendPixelTrait;
 
-      if (image->alpha_trait == BlendPixelTrait)
-        (void) SetImageType(image,TrueColorMatteType,exception);
-
-      else
-        (void) SetImageType(image,TrueColorType,exception);
-
+      (void) SetImageType(image,TrueColorMatteType,exception);
       (void) SyncImage(image,exception);
     }