From 53e7c83c2bc357884e1a53c29c60df105e4e6ce6 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 8 Sep 2017 11:42:45 -0400 Subject: [PATCH] ... --- coders/jp2.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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) -- 2.50.1