(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 !=