]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 12 May 2012 14:11:53 +0000 (14:11 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 12 May 2012 14:11:53 +0000 (14:11 +0000)
30 files changed:
MagickCore/channel.c
MagickCore/colorspace-private.h
MagickCore/colorspace.c
MagickCore/image.c
MagickCore/paint.c
coders/art.c
coders/bgr.c
coders/cin.c
coders/cmyk.c
coders/dpx.c
coders/exr.c
coders/fits.c
coders/gray.c
coders/hdr.c
coders/ipl.c
coders/jp2.c
coders/jpeg.c
coders/mat.c
coders/pcd.c
coders/png.c
coders/pnm.c
coders/psd.c
coders/rgb.c
coders/sct.c
coders/tiff.c
coders/uyvy.c
coders/xcf.c
coders/ycbcr.c
coders/yuv.c
tests/validate.c

index 56473a15f582632b033a68bff3f910a4e9143252..37f7a5dd9cced1634fed93d42f6ceca92dfc816f 100644 (file)
@@ -645,7 +645,7 @@ MagickExport Image *SeparateImage(const Image *image,
       separate_image=DestroyImage(separate_image);
       return((Image *) NULL);
     }
-  separate_image->colorspace=GRAYColorspace;
+  SetImageColorspace(separate_image,GRAYColorspace,exception);
   separate_image->matte=MagickFalse;
   /*
     Separate image.
index 9276a132f902c2f4ae69e0f103a91a42560c6b64..6bc12ccb2460ac7d09981c6d85668b37eac4ac5f 100644 (file)
@@ -68,11 +68,17 @@ static inline MagickBooleanType IsGrayColorspace(
   return(MagickFalse);
 }
 
+static inline MagickBooleanType IsRGBColorspace(const ColorspaceType colorspace)
+{
+  if (colorspace == RGBColorspace)
+    return(MagickTrue);
+  return(MagickFalse);
+}
+
 static inline MagickBooleanType IssRGBColorspace(
   const ColorspaceType colorspace)
 {
-  if ((IsGrayColorspace(colorspace) != MagickFalse) ||
-      (colorspace == sRGBColorspace) || (colorspace == TransparentColorspace))
+  if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace))
     return(MagickTrue);
   return(MagickFalse);
 }
index a8685d0bb92200024fac651e2176fea9f39778bd..dbf6b4c3c69aa2d4d851ddba9f2bc7a074c56877 100644 (file)
@@ -1251,6 +1251,26 @@ MagickExport MagickBooleanType SetImageColorspace(Image *image,
   const ColorspaceType colorspace,ExceptionInfo *exception)
 {
   image->colorspace=colorspace;
+  image->rendering_intent=UndefinedIntent;
+  image->gamma=1.000f;
+  ResetMagickMemory(&image->chromaticity,0,sizeof(image->chromaticity));
+  if (IssRGBColorspace(colorspace) != MagickFalse)
+    {
+      image->rendering_intent=PerceptualIntent;
+      image->gamma=1.000f/2.200f;
+      image->chromaticity.red_primary.x=0.6400f;
+      image->chromaticity.red_primary.y=0.3300f;
+      image->chromaticity.red_primary.z=0.0300f;
+      image->chromaticity.green_primary.x=0.3000f;
+      image->chromaticity.green_primary.y=0.6000f;
+      image->chromaticity.green_primary.z=0.1000f;
+      image->chromaticity.blue_primary.x=0.1500f;
+      image->chromaticity.blue_primary.y=0.0600f;
+      image->chromaticity.blue_primary.z=0.7900f;
+      image->chromaticity.white_point.x=0.3127f;
+      image->chromaticity.white_point.y=0.3290f;
+      image->chromaticity.white_point.z=0.3583f;
+    }
   return(SyncImagePixelCache(image,exception));
 }
 \f
@@ -1299,10 +1319,11 @@ MagickExport MagickBooleanType TransformImageColorspace(Image *image,
   /*
     Convert the reference image from an alternate colorspace to sRGB.
   */
-  if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace))
+  if (IssRGBColorspace(colorspace) != MagickFalse)
     return(TransformsRGBImage(image,colorspace,exception));
   status=MagickTrue;
-  if (image->colorspace == RGBColorspace)
+  if ((IsRGBColorspace(image->colorspace) != MagickFalse) ||
+      (IsGrayColorspace(image->colorspace) != MagickFalse))
     status=TransformsRGBImage(image,sRGBColorspace,exception);
   if (status == MagickFalse)
     return(status);
index f02b7d6afcba66f84f3b603bfaaf1607630084dc..fdb9edcee874d4627f7459628ae03f840c80160f 100644 (file)
@@ -1303,7 +1303,7 @@ MagickExport Image *GetImageMask(const Image *image,ExceptionInfo *exception)
   if (mask_image == (Image *) NULL)
     return((Image *) NULL);
   status=MagickTrue;
-  mask_image->colorspace=GRAYColorspace;
+  SetImageColorspace(mask_image,GRAYColorspace,exception);
   mask_image->mask=MagickFalse;
   image_view=AcquireVirtualCacheView(image,exception);
   mask_view=AcquireAuthenticCacheView(mask_image,exception);
index cf0299dcaa61a25e372a47207310334a773fc1ae..05695c99614a2df76b8e662e41beb7375abcf686 100644 (file)
@@ -183,7 +183,7 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image,
     exception);
   if (floodplane_image == (Image *) NULL)
     return(MagickFalse);
-  floodplane_image->colorspace=GRAYColorspace;
+  SetImageColorspace(floodplane_image,GRAYColorspace,exception);
   (void) EvaluateImage(floodplane_image,SetEvaluateOperator,0.0,exception);
   segment_stack=(SegmentInfo *) AcquireQuantumMemory(MaxStacksize,
     sizeof(*segment_stack));
index 52b8d7be1ac9ccaa9af43dbb80f5cb95f73d80e3..c6f037ddcd0063fa6e61699b7f8e98996ded8f78 100644 (file)
@@ -132,7 +132,7 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image=DestroyImageList(image);
       return((Image *) NULL);
     }
-  image->colorspace=GRAYColorspace;
+  SetImageColorspace(image,GRAYColorspace,exception);
   image->depth=1;
   image->endian=MSBEndian;
   (void) ReadBlobLSBShort(image);
index 9864e71cf28f8249225bedf8ed7698a0e0ceb008..62a019c4d712d0fa34eabad57354ef32e3b8fc61 100644 (file)
@@ -141,7 +141,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
   image=AcquireImage(image_info,exception);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowReaderException(OptionError,"MustSpecifyImageSize");
-  image->colorspace=sRGBColorspace;
+  SetImageColorspace(image,sRGBColorspace,exception);
   if (image_info->interlace != PartitionInterlace)
     {
       status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
@@ -197,7 +197,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
     if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))
         break;
-    image->colorspace=sRGBColorspace;
+    SetImageColorspace(image,sRGBColorspace,exception);
     switch (image_info->interlace)
     {
       case NoInterlace:
index b49e97e3b7b1668b1328f49c469fb708d9a6c702..58f258d10ca58ad6f4c9761a6027b483e113af84 100644 (file)
@@ -744,7 +744,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (EOFBlob(image) != MagickFalse)
     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
       image->filename);
-  image->colorspace=LogColorspace;
+  SetImageColorspace(image,LogColorspace,exception);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
 }
index 583b93cea8cdddee53e619dd864d03abbb3fe072..f93498abe17f854de7f4582b0f3a7012b520aafd 100644 (file)
@@ -140,7 +140,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
   image=AcquireImage(image_info,exception);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowReaderException(OptionError,"MustSpecifyImageSize");
-  image->colorspace=CMYKColorspace;
+  SetImageColorspace(image,CMYKColorspace,exception);
   if (image_info->interlace != PartitionInterlace)
     {
       status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
@@ -196,7 +196,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
     if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))
         break;
-    image->colorspace=CMYKColorspace;
+    SetImageColorspace(image,CMYKColorspace,exception);
     switch (image_info->interlace)
     {
       case NoInterlace:
index 0738159d01b4bbad7dd0c8f3345c679c9ef816d5..8190e048a4aafeff0748d7c175d46deeb7a6f790 100644 (file)
@@ -598,6 +598,7 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
   /*
     Read DPX file header.
   */
+  SetImageColorspace(image,RGBColorspace,exception);
   offset=0;
   count=ReadBlob(image,4,(unsigned char *) magick);
   offset+=count;
@@ -1046,21 +1047,21 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     case CbYACrYA4224ComponentType:
     case CbYCr444ComponentType:
     {
-      image->colorspace=Rec709YCbCrColorspace;
+      SetImageColorspace(image,Rec709YCbCrColorspace,exception);
       break;
     }
     case LumaComponentType:
     {
-      image->colorspace=sRGBColorspace;
+      SetImageColorspace(image,sRGBColorspace,exception);
       break;
     }
     default:
     {
-      image->colorspace=sRGBColorspace;
+      SetImageColorspace(image,sRGBColorspace,exception);
       if (dpx.image.image_element[0].transfer == LogarithmicColorimetric)
-        image->colorspace=LogColorspace;
+        SetImageColorspace(image,LogColorspace,exception);
       if (dpx.image.image_element[0].transfer == PrintingDensityColorimetric)
-        image->colorspace=LogColorspace;
+        SetImageColorspace(image,LogColorspace,exception);
       break;
     }
   }
index cec60d0ecd5f902703e575e5a3d4b873584fc9e3..7e61d8936a301d111a78bd2de04845b314ebb5ec 100644 (file)
@@ -200,7 +200,7 @@ static Image *ReadEXRImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image->columns=max_x-min_x+1UL;
   image->rows=max_y-min_y+1UL;
   image->matte=MagickTrue;
-  image->colorspace=RGBColorspace;
+  SetImageColorspace(image,RGBColorspace,exception);
   image->gamma=1.0;
   if (image_info->ping != MagickFalse)
     {
index 16428632150d1cbea2fc306693bca178c70b6fe5..6aa2f15c68c0bcc3d28ee795e3e270227fd0baaf 100644 (file)
@@ -416,7 +416,7 @@ static Image *ReadFITSImage(const ImageInfo *image_info,
       fits_info.bits_per_pixel;
     image->endian=fits_info.endian;
     image->scene=(size_t) scene;
-    image->colorspace=GRAYColorspace;
+    SetImageColorspace(image,GRAYColorspace,exception);
     if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))
         break;
index 09b89999512972ac5b5c9fd8ba0dba03d1193538..20723099734277da141e03467741c206cd3ea9fb 100644 (file)
@@ -150,7 +150,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
   /*
     Create virtual canvas to support cropping (i.e. image.gray[100x100+10+20]).
   */
-  image->colorspace=GRAYColorspace;
+  SetImageColorspace(image,GRAYColorspace,exception);
   canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
     exception);
   (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
index dec816777a53f6b29a660d1e603940f82a5a8674..ea6fa0954b00b1b280cf6df11796631d36802ecd 100644 (file)
@@ -373,7 +373,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if ((image->columns == 0) || (image->rows == 0))
     ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");
   if (LocaleCompare(format,"32-bit_rle_xyze") == 0)
-    image->colorspace=XYZColorspace;
+    SetImageColorspace(image,XYZColorspace,exception);
   image->compression=(image->columns < 8) || (image->columns > 0x7ffff) ?
     NoCompression : RLECompression;
   if (image_info->ping != MagickFalse)
index 7a8559b2b54aaba3697adefd048affc7a4a11c0e..ecf7819d56525db4d5183cc4872fbb961961b6fe 100644 (file)
@@ -246,7 +246,7 @@ static Image *ReadIPLImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if((ipl_info.width == 0UL) || (ipl_info.height == 0UL))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   ipl_info.colors=ReadBlobLong(image); 
-  if(ipl_info.colors == 3){ image->colorspace=sRGBColorspace;}
+  if(ipl_info.colors == 3){ SetImageColorspace(image,sRGBColorspace,exception);}
   else { image->colorspace = GRAYColorspace; }
   ipl_info.z=ReadBlobLong(image); 
   ipl_info.time=ReadBlobLong(image); 
index 17f1980194334fcc83ef0fa531cc2b6d9aa66571..ddd231ff959a27a3340faf4123f3107be0119e58 100644 (file)
@@ -454,7 +454,7 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
           image->matte=MagickTrue;
           number_components++;
         }
-      image->colorspace=YCbCrColorspace;
+      SetImageColorspace(image,YCbCrColorspace,exception);
       break;
     }
     default:
@@ -468,7 +468,7 @@ static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
   image->rows=jas_image_height(jp2_image);
   image->compression=JPEG2000Compression;
   if (number_components == 1)
-    image->colorspace=GRAYColorspace;
+    SetImageColorspace(image,GRAYColorspace,exception);
   for (i=0; i < (ssize_t) number_components; i++)
   {
     size_t
index 31f13c6452b5885474da2343f0979ea63176cfce..75f2f11c98f4cd1cd414a6b8c72466ebadf396c4 100644 (file)
@@ -1069,12 +1069,12 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
     jpeg_info.out_color_space=JCS_YCbCr;
   if (IsITUFaxImage(image) != MagickFalse)
     {
-      image->colorspace=LabColorspace;
+      SetImageColorspace(image,LabColorspace,exception);
       jpeg_info.out_color_space=JCS_YCbCr;
     }
   else
     if (jpeg_info.out_color_space == JCS_CMYK)
-      image->colorspace=CMYKColorspace;
+      SetImageColorspace(image,CMYKColorspace,exception);
   /*
     Set image resolution.
   */
@@ -1196,9 +1196,9 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
   image->rows=jpeg_info.output_height;
   image->depth=(size_t) jpeg_info.data_precision;
   if (jpeg_info.out_color_space == JCS_YCbCr)
-    image->colorspace=YCbCrColorspace;
+    SetImageColorspace(image,YCbCrColorspace,exception);
   if (jpeg_info.out_color_space == JCS_CMYK)
-    image->colorspace=CMYKColorspace;
+    SetImageColorspace(image,CMYKColorspace,exception);
   option=GetImageOption(image_info,"jpeg:colors");
   if (option != (const char *) NULL)
     if (AcquireImageColormap(image,StringToUnsignedLong(option),exception)
index 244b8d6c798844da3c74aa0f4ea6e3141b12d8d2..06ecfe668145032c8c061aaddb449f4c0d3606c3 100644 (file)
@@ -783,7 +783,7 @@ MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader");
         ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))
       {
         image->type=GrayscaleType;
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
       }
 
     switch (CellType)
index 54b2f5d91797aab39303fd6ced7eac599e2e7ef0..964e5c5e16ae8c8d76fb358c4565a1132a7bda4f 100644 (file)
@@ -681,7 +681,7 @@ static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception)
         }
         image->colorspace=YCCColorspace;
         if (LocaleCompare(image_info->magick,"PCDS") == 0)
-          image->colorspace=sRGBColorspace;
+          SetImageColorspace(image,sRGBColorspace,exception);
         if (j < (ssize_t) number_images)
           {
             /*
@@ -835,7 +835,7 @@ static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image->gamma=1.000f/2.200f;
   image->colorspace=YCCColorspace;
   if (LocaleCompare(image_info->magick,"PCDS") == 0)
-    image->colorspace=sRGBColorspace;
+    SetImageColorspace(image,sRGBColorspace,exception);
   return(GetFirstImageInList(image));
 }
 \f
index 3067a3e2db8ce84facdd8e34731027c36e2b26f6..2ebc89e4414ceb34d2e0b0c7b5cc7eca74c575c9 100644 (file)
@@ -2724,7 +2724,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
   image->rows=ping_height;
   if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||
       ((int) ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
-    image->colorspace=GRAYColorspace;
+    SetImageColorspace(image,GRAYColorspace,exception);
   if (((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||
       ((int) ping_color_type == PNG_COLOR_TYPE_GRAY))
     {
index fe9b47b556ceac350d8dd3868748bb5af4cb89ee..2677656f2a6222099c0103fa3cfafaad41f3c57f 100644 (file)
@@ -380,12 +380,12 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 }
               if (LocaleCompare(value,"GRAYSCALE") == 0)
                 {
-                  image->colorspace=GRAYColorspace;
+                  SetImageColorspace(image,GRAYColorspace,exception);
                   quantum_type=GrayQuantum;
                 }
               if (LocaleCompare(value,"GRAYSCALE_ALPHA") == 0)
                 {
-                  image->colorspace=GRAYColorspace;
+                  SetImageColorspace(image,GRAYColorspace,exception);
                   image->matte=MagickTrue;
                   quantum_type=GrayAlphaQuantum;
                 }
@@ -397,12 +397,12 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (LocaleCompare(value,"CMYK") == 0)
                 {
                   quantum_type=CMYKQuantum;
-                  image->colorspace=CMYKColorspace;
+                  SetImageColorspace(image,CMYKColorspace,exception);
                 }
               if (LocaleCompare(value,"CMYK_ALPHA") == 0)
                 {
                   quantum_type=CMYKAQuantum;
-                  image->colorspace=CMYKColorspace;
+                  SetImageColorspace(image,CMYKColorspace,exception);
                   image->matte=MagickTrue;
                 }
             }
@@ -431,7 +431,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         /*
           Convert PBM image to pixel packets.
         */
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
         for (y=0; y < (ssize_t) image->rows; y++)
         {
           register ssize_t
@@ -470,7 +470,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         /*
           Convert PGM image to pixel packets.
         */
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
         scale=(Quantum *) NULL;
         if (max_value != (1U*QuantumRange))
           {
@@ -589,7 +589,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         /*
           Convert PBM raw image to pixel packets.
         */
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
         quantum_type=GrayQuantum;
         if (image->storage_class == PseudoClass)
           quantum_type=IndexQuantum;
@@ -664,7 +664,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         /*
           Convert PGM raw image to pixel packets.
         */
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
         range=GetQuantumRange(image->depth);
         quantum_type=GrayQuantum;
         extent=(image->depth <= 8 ? 1 : 2)*image->columns;
@@ -1165,7 +1165,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           Convert PFM raster image to pixel packets.
         */
         if (format == 'f')
-          image->colorspace=GRAYColorspace;
+          SetImageColorspace(image,GRAYColorspace,exception);
         quantum_type=format == 'f' ? GrayQuantum : RGBQuantum;
         image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian;
         image->depth=32;
index 4f66b88cf05f33348b01e8aeb24ee2a0c4e68e48..03060457bed0b5370377bc17551576c291acbfc4 100644 (file)
@@ -834,12 +834,12 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)
     }
   image->matte=psd_info.channels >= 4 ? MagickTrue : MagickFalse;
   if (psd_info.mode == LabMode)
-    image->colorspace=LabColorspace;
+    SetImageColorspace(image,LabColorspace,exception);
   psd_info.color_channels=3;
   if (psd_info.mode == CMYKMode)
     {
       psd_info.color_channels=4;
-      image->colorspace=CMYKColorspace;
+      SetImageColorspace(image,CMYKColorspace,exception);
       image->matte=psd_info.channels >= 5 ? MagickTrue : MagickFalse;
     }
   if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) ||
@@ -852,7 +852,7 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)
       if (image->debug != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "  Image colormap allocated");
-      image->colorspace=GRAYColorspace;
+      SetImageColorspace(image,GRAYColorspace,exception);
     }
   image->matte=MagickFalse;
   /*
@@ -1235,11 +1235,11 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (layer_info[i].visible == MagickFalse)
               layer_info[i].image->compose=NoCompositeOp;
             if (psd_info.mode == CMYKMode)
-              layer_info[i].image->colorspace=CMYKColorspace;
+              SetImageColorspace(layer_info[i].image,CMYKColorspace,exception);
             if ((psd_info.mode == BitmapMode) ||
                 (psd_info.mode == GrayscaleMode) ||
                 (psd_info.mode == DuotoneMode))
-              layer_info[i].image->colorspace=GRAYColorspace;
+              SetImageColorspace(layer_info[i].image,GRAYColorspace,exception);
             for (j=0; j < (ssize_t) layer_info[i].channels; j++)
               if (layer_info[i].channel_info[j].type == -1)
                 layer_info[i].image->matte=MagickTrue;
index cc731294e9987666c6d4fd5bbdedf2929bd97751..9241357e65343217bb64770273eabbd7297a2232 100644 (file)
@@ -140,7 +140,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image=AcquireImage(image_info,exception);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowReaderException(OptionError,"MustSpecifyImageSize");
-  image->colorspace=sRGBColorspace;
+  SetImageColorspace(image,sRGBColorspace,exception);
   if (image_info->interlace != PartitionInterlace)
     {
       status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
@@ -202,7 +202,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))
         break;
-    image->colorspace=sRGBColorspace;
+    SetImageColorspace(image,sRGBColorspace,exception);
     switch (image_info->interlace)
     {
       case NoInterlace:
index e4120626bc20b8235e8b02d588ac21c4565b311a..2294d881ce4d2ebac58da167b6f603b2ecbbf46a 100644 (file)
@@ -213,7 +213,7 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   count=ReadBlob(image,200,buffer);
   count=ReadBlob(image,768,buffer);
   if (separations_mask == 0x0f)
-    image->colorspace=CMYKColorspace;
+    SetImageColorspace(image,CMYKColorspace,exception);
   image->resolution.x=1.0*image->columns/width;
   image->resolution.y=1.0*image->rows/height;
   if (image_info->ping != MagickFalse)
index 8f96fb531d15481c2b168aa7993f3eaa2ee6154d..f3efe250db4e22580ab7bd9e108f846a542218ab 100644 (file)
@@ -1012,11 +1012,11 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
       image->endian=LSBEndian;
     if ((photometric == PHOTOMETRIC_MINISBLACK) ||
         (photometric == PHOTOMETRIC_MINISWHITE))
-      image->colorspace=GRAYColorspace;
+      SetImageColorspace(image,GRAYColorspace,exception);
     if (photometric == PHOTOMETRIC_SEPARATED)
-      image->colorspace=CMYKColorspace;
+      SetImageColorspace(image,CMYKColorspace,exception);
     if (photometric == PHOTOMETRIC_CIELAB)
-      image->colorspace=LabColorspace;
+      SetImageColorspace(image,LabColorspace,exception);
     (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,
       &samples_per_pixel);
     (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units);
index ce0d7c44bba9725920eca77eeb1f22b546127c2a..83a936314032b95c51e64015ff08c89f6f112867 100644 (file)
@@ -175,7 +175,7 @@ static Image *ReadUYVYImage(const ImageInfo *image_info,
     if (status == MagickFalse)
       break;
   }
-  image->colorspace=YCbCrColorspace;
+  SetImageColorspace(image,YCbCrColorspace,exception);
   if (EOFBlob(image) != MagickFalse)
     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
       image->filename);
index e78ca4b5c3b036a2d79878e6ed4d975ec116494c..3d699978cf56d9863d05cb717efb380ae66b0ded 100644 (file)
@@ -1055,10 +1055,10 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)
   image->compression=NoCompression;
   image->depth=8;
   if (image_type == GIMP_RGB)
-    image->colorspace=sRGBColorspace;
+    SetImageColorspace(image,sRGBColorspace,exception);
   else
     if (image_type == GIMP_GRAY)
-      image->colorspace=GRAYColorspace;
+      SetImageColorspace(image,GRAYColorspace,exception);
     else
       if (image_type == GIMP_INDEXED)
         ThrowReaderException(CoderError,"ColormapTypeNotSupported");
index a3f063b61fd3dd2efdde13352eb402bd86d9273e..a983d0eb1c04524afffac3beeecaf35c18d164c8 100644 (file)
@@ -147,7 +147,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
   image=AcquireImage(image_info,exception);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowReaderException(OptionError,"MustSpecifyImageSize");
-  image->colorspace=YCbCrColorspace;
+  SetImageColorspace(image,YCbCrColorspace,exception);
   if (image_info->interlace != PartitionInterlace)
     {
       status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
@@ -203,7 +203,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
     if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))
         break;
-    image->colorspace=YCbCrColorspace;
+    SetImageColorspace(image,YCbCrColorspace,exception);
     switch (image_info->interlace)
     {
       case NoInterlace:
index 418824e08add800a5de51627429928de6ec6d94d..45abc5b10ff81e7e7055fd0ce4ea025db14500b8 100644 (file)
@@ -414,7 +414,7 @@ static Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception)
         break;
     }
     resize_image=DestroyImage(resize_image);
-    image->colorspace=YCbCrColorspace;
+    SetImageColorspace(image,YCbCrColorspace,exception);
     if (interlace == PartitionInterlace)
       (void) CopyMagickString(image->filename,image_info->filename,
         MaxTextExtent);
index ae4a1919a822445d7a2c0724310702a199d1eb62..c03c315f1b3ece0665d1343fa3186ed3d1b3ff59 100644 (file)
@@ -935,7 +935,7 @@ static size_t ValidateImportExportPixels(ImageInfo *image_info,
           continue;
         }
       if (LocaleNCompare(reference_map[i],"cmy",3) == 0)
-        reference_image->colorspace=CMYKColorspace;
+        SetImageColorspace(reference_image,CMYKColorspace,exception);
       length=strlen(reference_map[i])*reference_image->columns*
         reference_image->rows*reference_storage[j].quantum;
       pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));