]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 8 Sep 2017 15:42:45 +0000 (11:42 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 8 Sep 2017 15:42:45 +0000 (11:42 -0400)
coders/jp2.c

index 358a350ddfaa133c888c1bca90db7c7fd6fe76b8..5d47a8460520eb9a5def32d87acc1ad9024b69d9 100644 (file)
@@ -408,15 +408,18 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
   if (status == MagickFalse)
     return(DestroyImageList(image));
   image->compression=JPEG2000Compression;
-  if (jp2_image->color_space == 2)
-    {
-      SetImageColorspace(image,GRAYColorspace,exception);
-      if (jp2_image->numcomps > 1)
-        image->alpha_trait=BlendPixelTrait;
-    }
+  if (jp2_image->numcomps == 1)
+    SetImageColorspace(image,GRAYColorspace,exception);
   else
-    if (jp2_image->color_space == 3)
-      SetImageColorspace(image,Rec601YCbCrColorspace,exception);
+    if (jp2_image->color_space == 2)
+      {
+        SetImageColorspace(image,GRAYColorspace,exception);
+        if (jp2_image->numcomps > 1)
+          image->alpha_trait=BlendPixelTrait;
+      }
+    else
+      if (jp2_image->color_space == 3)
+        SetImageColorspace(image,Rec601YCbCrColorspace,exception);
   if (jp2_image->numcomps > 3)
     image->alpha_trait=BlendPixelTrait;
   if (jp2_image->icc_profile_buf != (unsigned char *) NULL)