]> granicus.if.org Git - imagemagick/commitdiff
Fixed setting the alpha channel for the merged image in a grayscale image (https...
authorDirk Lemstra <dirk@git.imagemagick.org>
Sun, 4 Mar 2018 21:06:42 +0000 (22:06 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sun, 4 Mar 2018 21:06:42 +0000 (22:06 +0100)
coders/psd.c

index dcacb60a1c7bffa17a2e882f0ec18799540d9c08..b41e7d8f2a65771608e71479ca7595d1345f6e9c 100644 (file)
@@ -1093,10 +1093,10 @@ static MagickBooleanType ReadPSDChannelRaw(Image *image,const size_t channels,
 
     count=ReadBlob(image,row_size,pixels);
     if (count != row_size)
-    {
-      status=MagickFalse;
-      break;
-    }
+      {
+        status=MagickFalse;
+        break;
+      }
 
     status=ReadPSDChannelPixels(image,channels,y,type,pixels,exception);
     if (status == MagickFalse)
@@ -2012,11 +2012,18 @@ static MagickBooleanType ReadPSDMergedImage(const ImageInfo *image_info,
   status=MagickTrue;
   for (i=0; i < (ssize_t) psd_info->channels; i++)
   {
+    ssize_t
+      type;
+
+    type=i;
+    if ((type == 1) && (psd_info->channels == 2))
+      type=-1;
+
     if (compression == RLE)
-      status=ReadPSDChannelRLE(image,psd_info,i,sizes+(i*image->rows),
+      status=ReadPSDChannelRLE(image,psd_info,type,sizes+(i*image->rows),
         exception);
     else
-      status=ReadPSDChannelRaw(image,psd_info->channels,i,exception);
+      status=ReadPSDChannelRaw(image,psd_info->channels,type,exception);
 
     if (status != MagickFalse)
       status=SetImageProgress(image,LoadImagesTag,i,psd_info->channels);