diff --git a/coders/art.c b/coders/art.c
index 52b8d7b..c6f037d 100644
--- a/coders/art.c
+++ b/coders/art.c
@@ -132,7 +132,7 @@
       image=DestroyImageList(image);
       return((Image *) NULL);
     }
-  image->colorspace=GRAYColorspace;
+  SetImageColorspace(image,GRAYColorspace,exception);
   image->depth=1;
   image->endian=MSBEndian;
   (void) ReadBlobLSBShort(image);
diff --git a/coders/bgr.c b/coders/bgr.c
index 9864e71..62a019c 100644
--- a/coders/bgr.c
+++ b/coders/bgr.c
@@ -141,7 +141,7 @@
   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 @@
     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:
diff --git a/coders/cin.c b/coders/cin.c
index b49e97e..58f258d 100644
--- a/coders/cin.c
+++ b/coders/cin.c
@@ -744,7 +744,7 @@
   if (EOFBlob(image) != MagickFalse)
     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
       image->filename);
-  image->colorspace=LogColorspace;
+  SetImageColorspace(image,LogColorspace,exception);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
 }
diff --git a/coders/cmyk.c b/coders/cmyk.c
index 583b93c..f93498a 100644
--- a/coders/cmyk.c
+++ b/coders/cmyk.c
@@ -140,7 +140,7 @@
   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 @@
     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:
diff --git a/coders/dpx.c b/coders/dpx.c
index 0738159..8190e04 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -598,6 +598,7 @@
   /*
     Read DPX file header.
   */
+  SetImageColorspace(image,RGBColorspace,exception);
   offset=0;
   count=ReadBlob(image,4,(unsigned char *) magick);
   offset+=count;
@@ -1046,21 +1047,21 @@
     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;
     }
   }
diff --git a/coders/exr.c b/coders/exr.c
index cec60d0..7e61d89 100644
--- a/coders/exr.c
+++ b/coders/exr.c
@@ -200,7 +200,7 @@
   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)
     {
diff --git a/coders/fits.c b/coders/fits.c
index 1642863..6aa2f15 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -416,7 +416,7 @@
       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;
diff --git a/coders/gray.c b/coders/gray.c
index 09b8999..2072309 100644
--- a/coders/gray.c
+++ b/coders/gray.c
@@ -150,7 +150,7 @@
   /*
     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,
diff --git a/coders/hdr.c b/coders/hdr.c
index dec8167..ea6fa09 100644
--- a/coders/hdr.c
+++ b/coders/hdr.c
@@ -373,7 +373,7 @@
   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)
diff --git a/coders/ipl.c b/coders/ipl.c
index 7a8559b..ecf7819 100644
--- a/coders/ipl.c
+++ b/coders/ipl.c
@@ -246,7 +246,7 @@
   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); 
diff --git a/coders/jp2.c b/coders/jp2.c
index 17f1980..ddd231f 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -454,7 +454,7 @@
           image->matte=MagickTrue;
           number_components++;
         }
-      image->colorspace=YCbCrColorspace;
+      SetImageColorspace(image,YCbCrColorspace,exception);
       break;
     }
     default:
@@ -468,7 +468,7 @@
   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
diff --git a/coders/jpeg.c b/coders/jpeg.c
index 31f13c6..75f2f11 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1069,12 +1069,12 @@
     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 @@
   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)
diff --git a/coders/mat.c b/coders/mat.c
index 244b8d6..06ecfe6 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -783,7 +783,7 @@
         ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))
       {
         image->type=GrayscaleType;
-        image->colorspace=GRAYColorspace;
+        SetImageColorspace(image,GRAYColorspace,exception);
       }
 
     switch (CellType)
diff --git a/coders/pcd.c b/coders/pcd.c
index 54b2f5d..964e5c5 100644
--- a/coders/pcd.c
+++ b/coders/pcd.c
@@ -681,7 +681,7 @@
         }
         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 @@
   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));
 }
 
diff --git a/coders/png.c b/coders/png.c
index 3067a3e..2ebc89e 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -2724,7 +2724,7 @@
   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))
     {
diff --git a/coders/pnm.c b/coders/pnm.c
index fe9b47b..2677656 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -380,12 +380,12 @@
                 }
               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 @@
               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 @@
         /*
           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 @@
         /*
           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 @@
         /*
           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 @@
         /*
           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 @@
           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;
diff --git a/coders/psd.c b/coders/psd.c
index 4f66b88..0306045 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -834,12 +834,12 @@
     }
   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 @@
       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 @@
             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;
diff --git a/coders/rgb.c b/coders/rgb.c
index cc73129..9241357 100644
--- a/coders/rgb.c
+++ b/coders/rgb.c
@@ -140,7 +140,7 @@
   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 @@
     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:
diff --git a/coders/sct.c b/coders/sct.c
index e412062..2294d88 100644
--- a/coders/sct.c
+++ b/coders/sct.c
@@ -213,7 +213,7 @@
   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)
diff --git a/coders/tiff.c b/coders/tiff.c
index 8f96fb5..f3efe25 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1012,11 +1012,11 @@
       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);
diff --git a/coders/uyvy.c b/coders/uyvy.c
index ce0d7c4..83a9363 100644
--- a/coders/uyvy.c
+++ b/coders/uyvy.c
@@ -175,7 +175,7 @@
     if (status == MagickFalse)
       break;
   }
-  image->colorspace=YCbCrColorspace;
+  SetImageColorspace(image,YCbCrColorspace,exception);
   if (EOFBlob(image) != MagickFalse)
     ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
       image->filename);
diff --git a/coders/xcf.c b/coders/xcf.c
index e78ca4b..3d69997 100644
--- a/coders/xcf.c
+++ b/coders/xcf.c
@@ -1055,10 +1055,10 @@
   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");
diff --git a/coders/ycbcr.c b/coders/ycbcr.c
index a3f063b..a983d0e 100644
--- a/coders/ycbcr.c
+++ b/coders/ycbcr.c
@@ -147,7 +147,7 @@
   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 @@
     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:
diff --git a/coders/yuv.c b/coders/yuv.c
index 418824e..45abc5b 100644
--- a/coders/yuv.c
+++ b/coders/yuv.c
@@ -414,7 +414,7 @@
         break;
     }
     resize_image=DestroyImage(resize_image);
-    image->colorspace=YCbCrColorspace;
+    SetImageColorspace(image,YCbCrColorspace,exception);
     if (interlace == PartitionInterlace)
       (void) CopyMagickString(image->filename,image_info->filename,
         MaxTextExtent);