From f54bf442f34f51bfe0afc089f64bdeb68e54202d Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sat, 26 May 2018 11:22:37 +0200 Subject: [PATCH] Fixed determining PNG color_type when image type is set to grayscale. --- coders/png.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) 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) { -- 2.40.0