From: Cristy Date: Fri, 8 Sep 2017 15:42:45 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.7-1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53e7c83c2bc357884e1a53c29c60df105e4e6ce6;p=imagemagick ... --- diff --git a/coders/jp2.c b/coders/jp2.c index 358a350dd..5d47a8460 100644 --- a/coders/jp2.c +++ b/coders/jp2.c @@ -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)