From: cristy Date: Thu, 24 May 2012 18:14:16 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5537 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f040d0af707db28370157e028c1dfa058b227da;p=imagemagick --- diff --git a/coders/jp2.c b/coders/jp2.c index ddd231ff9..47a9fbaf6 100644 --- a/coders/jp2.c +++ b/coders/jp2.c @@ -402,10 +402,14 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) (void) jas_stream_close(jp2_stream); ThrowReaderException(DelegateError,"UnableToDecodeImageFile"); } + image->columns=jas_image_width(jp2_image); + image->rows=jas_image_height(jp2_image); + image->compression=JPEG2000Compression; switch (jas_clrspc_fam(jas_image_clrspc(jp2_image))) { case JAS_CLRSPC_FAM_RGB: { + SetImageColorspace(image,RGBColorspace,exception); components[0]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_RGB_R); components[1]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_RGB_G); components[2]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_RGB_B); @@ -426,6 +430,7 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) } case JAS_CLRSPC_FAM_GRAY: { + SetImageColorspace(image,GRAYColorspace,exception); components[0]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_GRAY_Y); if (components[0] < 0) { @@ -438,6 +443,7 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) } case JAS_CLRSPC_FAM_YCBCR: { + SetImageColorspace(image,YCbCrColorspace,exception); components[0]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_YCBCR_Y); components[1]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_YCBCR_CB); components[2]=jas_image_getcmptbytype(jp2_image,JAS_IMAGE_CT_YCBCR_CR); @@ -454,7 +460,6 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) image->matte=MagickTrue; number_components++; } - SetImageColorspace(image,YCbCrColorspace,exception); break; } default: @@ -464,11 +469,6 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CoderError,"ColorspaceModelIsNotSupported"); } } - image->columns=jas_image_width(jp2_image); - image->rows=jas_image_height(jp2_image); - image->compression=JPEG2000Compression; - if (number_components == 1) - SetImageColorspace(image,GRAYColorspace,exception); for (i=0; i < (ssize_t) number_components; i++) { size_t