]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/409
authorCristy <urban-warrior@imagemagick.org>
Sat, 25 Mar 2017 18:02:52 +0000 (14:02 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 25 Mar 2017 18:02:52 +0000 (14:02 -0400)
coders/jp2.c

index f0d821c75f141f16b39a2a9627bfa1a666e9ed3f..1cf68e007a521ce8fa1bd03f0601e5c7d61f9220 100644 (file)
@@ -403,17 +403,17 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
   if (status == MagickFalse)
     return(DestroyImageList(image));
   image->compression=JPEG2000Compression;
-  if (jp2_image->numcomps <= 2)
+  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;
-  for (i=0; i < (ssize_t) jp2_image->numcomps; i++)
-    if ((jp2_image->comps[i].dx > 1) || (jp2_image->comps[i].dy > 1))
-      SetImageColorspace(image,YUVColorspace,exception);
   if (jp2_image->icc_profile_buf != (unsigned char *) NULL)
     {
       StringInfo