]> granicus.if.org Git - imagemagick/commitdiff
When the image has a color profile it won't be converted to gray-scale.
authorDirk Lemstra <dirk@git.imagemagick.org>
Sat, 17 Jun 2017 15:36:34 +0000 (17:36 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sat, 17 Jun 2017 15:37:46 +0000 (17:37 +0200)
coders/psd.c

index bf8dc0ae2fcdbab2086457dd47fa0c52d43210c4..5f1cd82d380dfc3101dc91da1d8d437f31df45a5 100644 (file)
@@ -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 !=