From: Dirk Lemstra Date: Sat, 26 May 2018 09:22:37 +0000 (+0200) Subject: Fixed determining PNG color_type when image type is set to grayscale. X-Git-Tag: 7.0.7-36~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f54bf442f34f51bfe0afc089f64bdeb68e54202d;p=imagemagick Fixed determining PNG color_type when image type is set to grayscale. --- diff --git a/coders/png.c b/coders/png.c index 869853c02..0848cad86 100644 --- a/coders/png.c +++ b/coders/png.c @@ -10191,27 +10191,20 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Selecting PNG colortype:"); - ping_color_type=(png_byte) ((matte != MagickFalse)? - PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB); - if (image_info->type == TrueColorType) { ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB; image_matte=MagickFalse; } - - if (image_info->type == TrueColorAlphaType) + else if (image_info->type == TrueColorAlphaType) { ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA; image_matte=MagickTrue; } - - if (image_info->type == PaletteType || - image_info->type == PaletteAlphaType) + else if (image_info->type == PaletteType || + image_info->type == PaletteAlphaType) ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE; - - if (mng_info->write_png_colortype == 0 && - image_info->type == UndefinedType) + else { if (ping_have_color == MagickFalse) {