From: Dirk Lemstra Date: Sat, 17 Jun 2017 15:36:34 +0000 (+0200) Subject: When the image has a color profile it won't be converted to gray-scale. X-Git-Tag: 7.0.6-1~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4532fdf570d3745d70327830962fb66b8a3de41;p=imagemagick When the image has a color profile it won't be converted to gray-scale. --- diff --git a/coders/psd.c b/coders/psd.c index bf8dc0ae2..5f1cd82d3 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -3140,7 +3140,9 @@ static MagickBooleanType WritePSDImage(const ImageInfo *image_info, (void) WriteBlobMSBShort(image,psd_info.version); /* version */ for (i=1; i <= 6; i++) (void) WriteBlobByte(image, 0); /* 6 bytes of reserved */ - if (SetImageGray(image,exception) != MagickFalse) + /* When the image has a color profile it won't be converted to gray scale */ + if ((GetImageProfile(image,"icc") == (StringInfo *) NULL) && + (SetImageGray(image,exception) != MagickFalse)) num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL); else if ((image_info->type != TrueColorType) && (image_info->type !=