From: glennrp Date: Tue, 22 Apr 2014 23:45:20 +0000 (+0000) Subject: Fixed bug with PNG00 when the input file is a PNG32. X-Git-Tag: 7.0.1-0~2426 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=197c8e6d7a6d3658c44fa95f56c19f88f5d64390;p=imagemagick Fixed bug with PNG00 when the input file is a PNG32. --- diff --git a/coders/png.c b/coders/png.c index 9ae064775..a3f7af494 100644 --- a/coders/png.c +++ b/coders/png.c @@ -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); }