diff --git a/coders/aai.c b/coders/aai.c
index e0a01e7..214b175 100644
--- a/coders/aai.c
+++ b/coders/aai.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -357,7 +358,7 @@
     /*
       Write AAI header.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     (void) WriteBlobLSBLong(image,(unsigned int) image->columns);
     (void) WriteBlobLSBLong(image,(unsigned int) image->rows);
diff --git a/coders/art.c b/coders/art.c
index aa25dd0..bb9f8ae 100644
--- a/coders/art.c
+++ b/coders/art.c
@@ -46,6 +46,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -315,7 +316,7 @@
   (void) WriteBlobLSBShort(image,(unsigned short) image->columns);
   (void) WriteBlobLSBShort(image,0);
   (void) WriteBlobLSBShort(image,(unsigned short) image->rows);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   length=(image->columns+7)/8;
   pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
diff --git a/coders/avs.c b/coders/avs.c
index cc22df2..5f8441b 100644
--- a/coders/avs.c
+++ b/coders/avs.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -354,7 +355,7 @@
     /*
       Write AVS header.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     (void) WriteBlobMSBLong(image,(unsigned int) image->columns);
     (void) WriteBlobMSBLong(image,(unsigned int) image->rows);
diff --git a/coders/bgr.c b/coders/bgr.c
index 3ff1429..c882751 100644
--- a/coders/bgr.c
+++ b/coders/bgr.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -1101,7 +1102,7 @@
     /*
       Convert MIFF to BGR raster pixels.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     if ((LocaleCompare(image_info->magick,"BGRA") == 0) &&
         (image->matte == MagickFalse))
diff --git a/coders/bmp.c b/coders/bmp.c
index f45f9e7..b0bc283 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -1507,7 +1508,7 @@
     /*
       Initialize BMP raster file header.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     (void) ResetMagickMemory(&bmp_info,0,sizeof(bmp_info));
     bmp_info.file_size=14+12;
diff --git a/coders/cip.c b/coders/cip.c
index 3071f0b..5dcf3a3 100644
--- a/coders/cip.c
+++ b/coders/cip.c
@@ -44,6 +44,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -228,7 +229,7 @@
   (void) FormatLocaleString(buffer,MaxTextExtent,"<Depth>2</Depth>\n");
   (void) WriteBlobString(image,buffer);
   (void) WriteBlobString(image,"<Data>");
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
diff --git a/coders/dib.c b/coders/dib.c
index 507d586..658a7ac 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -49,6 +49,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/draw.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -1003,7 +1004,7 @@
   /*
     Initialize DIB raster file header.
   */
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   if (image->storage_class == DirectClass)
     {
diff --git a/coders/fax.c b/coders/fax.c
index 78660b8..4490420 100644
--- a/coders/fax.c
+++ b/coders/fax.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/compress.h"
@@ -323,7 +324,7 @@
     /*
       Convert MIFF to monochrome.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     status=HuffmanEncodeImage(write_info,image,image);
     if (GetNextImageInList(image) == (Image *) NULL)
diff --git a/coders/fits.c b/coders/fits.c
index edbde04..9058fc6 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -46,6 +46,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -632,7 +633,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Allocate image memory.
diff --git a/coders/fpx.c b/coders/fpx.c
index b2482a5..4c7d4a6 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -847,7 +847,7 @@
     Initialize FPX toolkit.
   */
   image->depth=8;
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   memory_limit=20000000;
   fpx_status=FPX_SetToolkitMemoryLimit(&memory_limit);
diff --git a/coders/gif.c b/coders/gif.c
index 5a18d4f..def3599 100644
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -49,6 +49,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -1553,7 +1554,7 @@
   one=1;
   do
   {
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     opacity=(-1);
     if (IsImageOpaque(image,&image->exception) != MagickFalse)
diff --git a/coders/gray.c b/coders/gray.c
index d6bfe83..c9d6e5e 100644
--- a/coders/gray.c
+++ b/coders/gray.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -407,7 +408,7 @@
     /*
       Write grayscale pixels.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     quantum_type=GrayQuantum;
     quantum_info=AcquireQuantumInfo(image_info,image);
diff --git a/coders/hdr.c b/coders/hdr.c
index 1e7feb5..d5978aa 100644
--- a/coders/hdr.c
+++ b/coders/hdr.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -682,7 +683,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Write header.
diff --git a/coders/hrz.c b/coders/hrz.c
index cf1292c..72e2dd9 100644
--- a/coders/hrz.c
+++ b/coders/hrz.c
@@ -301,7 +301,7 @@
     &image->exception);
   if (hrz_image == (Image *) NULL)
     return(MagickFalse);
-  if (hrz_image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(hrz_image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(hrz_image,RGBColorspace);
   /*
     Allocate memory for pixels.
diff --git a/coders/html.c b/coders/html.c
index d9a2762..434cc39 100644
--- a/coders/html.c
+++ b/coders/html.c
@@ -45,6 +45,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -245,7 +246,7 @@
   if (status == MagickFalse)
     return(status);
   (void) CloseBlob(image);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   *url='\0';
   if ((LocaleCompare(image_info->magick,"FTP") == 0) ||
diff --git a/coders/ipl.c b/coders/ipl.c
index 2c777cb..5582186 100644
--- a/coders/ipl.c
+++ b/coders/ipl.c
@@ -46,6 +46,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -573,10 +574,10 @@
   ipl_info.width = (unsigned int) image->columns;
   ipl_info.height = (unsigned int) image->rows;
   
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   
-  if(image->colorspace == RGBColorspace) { ipl_info.colors = 3; }
+  if(IsRGBColorspace(image->colorspace) == MagickTrue) { ipl_info.colors = 3; }
   else{ ipl_info.colors = 1; }
   
   ipl_info.size = (unsigned int) (28 + 
diff --git a/coders/jbig.c b/coders/jbig.c
index c739679..aedc8ad 100644
--- a/coders/jbig.c
+++ b/coders/jbig.c
@@ -440,7 +440,7 @@
     /*
       Allocate pixel data.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     number_packets=(image->columns+7)/8;
     pixels=(unsigned char *) AcquireQuantumMemory(number_packets,
diff --git a/coders/jp2.c b/coders/jp2.c
index c22d97e..c8667dc 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -45,6 +45,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/exception.h"
@@ -849,7 +850,7 @@
   /*
     Initialize JPEG 2000 API.
   */
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   jp2_stream=JP2StreamManager(image);
   if (jp2_stream == (jas_stream_t *) NULL)
diff --git a/coders/jpeg.c b/coders/jpeg.c
index e059453..7808d02 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -53,6 +53,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -1806,7 +1807,7 @@
     }
     default:
     {
-      if (image->colorspace != RGBColorspace)
+      if (IsRGBColorspace(image->colorspace) == MagickFalse)
         (void) TransformImageColorspace(image,RGBColorspace);
       break;
     }
diff --git a/coders/map.c b/coders/map.c
index 3d226d5..0a08aee 100644
--- a/coders/map.c
+++ b/coders/map.c
@@ -49,6 +49,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/histogram.h"
@@ -368,7 +369,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Allocate colormap.
diff --git a/coders/mat.c b/coders/mat.c
index b6aa1ef..c35d967 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -54,6 +54,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -1213,7 +1214,7 @@
   scene=0;
   do
   {
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
 
     is_gray = IsImageGray(image,&image->exception);
diff --git a/coders/mono.c b/coders/mono.c
index c5c0d95..138b257 100644
--- a/coders/mono.c
+++ b/coders/mono.c
@@ -46,6 +46,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -308,7 +309,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Convert image to a bi-level image.
diff --git a/coders/mtv.c b/coders/mtv.c
index 3e85bbc..e3a2b9a 100644
--- a/coders/mtv.c
+++ b/coders/mtv.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -359,7 +360,7 @@
     /*
       Allocate memory for pixels.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     pixels=(unsigned char *) AcquireQuantumMemory((size_t) image->columns,
       3UL*sizeof(*pixels));
diff --git a/coders/otb.c b/coders/otb.c
index 45f7221..621650f 100644
--- a/coders/otb.c
+++ b/coders/otb.c
@@ -45,6 +45,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -327,7 +328,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Convert image to a bi-level image.
diff --git a/coders/palm.c b/coders/palm.c
index b6aadf9..cc85499 100644
--- a/coders/palm.c
+++ b/coders/palm.c
@@ -50,6 +50,7 @@
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/histogram.h"
@@ -732,7 +733,7 @@
   scene=0;
   do
   {
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     count=GetNumberColors(image,NULL,&exception);
     for (bits_per_pixel=1;  (one << bits_per_pixel) < count; bits_per_pixel*=2) ;
diff --git a/coders/pcd.c b/coders/pcd.c
index 5cfa1ce..62fb2a7 100644
--- a/coders/pcd.c
+++ b/coders/pcd.c
@@ -46,6 +46,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/client.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/decorate.h"
 #include "MagickCore/exception.h"
@@ -1008,7 +1009,7 @@
       tile_image=bordered_image;
     }
   (void) TransformImage(&tile_image,(char *) NULL,tile_geometry);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(tile_image,YCCColorspace);
   downsample_image=ResizeImage(tile_image,tile_image->columns/2,
     tile_image->rows/2,TriangleFilter,1.0,&image->exception);
@@ -1096,7 +1097,7 @@
   status=OpenBlob(image_info,pcd_image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(pcd_image,RGBColorspace);
   /*
     Write PCD image header.
diff --git a/coders/pcl.c b/coders/pcl.c
index aaca876..ae35056 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -47,6 +47,7 @@
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/delegate.h"
 #include "MagickCore/draw.h"
@@ -710,7 +711,7 @@
   one=1;
   do
   {
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     /*
       Initialize the printer.
diff --git a/coders/pcx.c b/coders/pcx.c
index 7b4d9f2..91e0ab0 100644
--- a/coders/pcx.c
+++ b/coders/pcx.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -872,7 +873,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   page_table=(MagickOffsetType *) NULL;
   if ((LocaleCompare(image_info->magick,"DCX") == 0) ||
diff --git a/coders/pdb.c b/coders/pdb.c
index 9b65775..dc4b374 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -55,6 +55,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -737,7 +738,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
 
   if (image -> colors <= 2  ||  GetImageType( image, &image -> exception ) == BilevelType) { /* TS */
@@ -812,7 +813,7 @@
     sizeof(*scanline));
   if (scanline == (unsigned char *) NULL)
     ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Convert to GRAY raster scanline.
diff --git a/coders/pdf.c b/coders/pdf.c
index de42c78..06483d9 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -47,6 +47,7 @@
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/compress.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/delegate.h"
@@ -547,7 +548,7 @@
       page.width=page.height;
       page.height=swap;
     }
-  if (image_info->colorspace == RGBColorspace)
+  if (IsRGBColorspace(image_info->colorspace) != MagickFalse)
     cmyk=MagickFalse;
   /*
     Create Ghostscript control file.
@@ -1246,7 +1247,7 @@
     }
     if (compression == JPEG2000Compression)
       {
-        if (image->colorspace != RGBColorspace)
+        if (IsRGBColorspace(image->colorspace) == MagickFalse)
           (void) TransformImageColorspace(image,RGBColorspace);
       }
     /*
diff --git a/coders/pict.c b/coders/pict.c
index d514d69..c2e3776 100644
--- a/coders/pict.c
+++ b/coders/pict.c
@@ -47,6 +47,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/composite.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
@@ -1381,7 +1382,7 @@
         (void) SetImageExtent(image,
           MagickMax(image->columns,tile_image->columns),
           MagickMax(image->rows,tile_image->rows));
-        if (image->colorspace != RGBColorspace)
+        if (IsRGBColorspace(image->colorspace) == MagickFalse)
           (void) TransformImageColorspace(image,tile_image->colorspace);
         (void) CompositeImage(image,CopyCompositeOp,tile_image,frame.left,
           frame.right);
@@ -1594,7 +1595,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Initialize image info.
diff --git a/coders/png.c b/coders/png.c
index f88cd96..6ff261d 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -51,6 +51,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/enhance.h"
 #include "MagickCore/exception.h"
@@ -7624,7 +7625,7 @@
         }
     }
 
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
 
   /*
diff --git a/coders/pnm.c b/coders/pnm.c
index b5b555b..f82ba75 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -47,6 +47,7 @@
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -1547,7 +1548,7 @@
       }
     if (format != '7')
       {
-        if (image->colorspace != RGBColorspace)
+        if (IsRGBColorspace(image->colorspace) == MagickFalse)
           (void) TransformImageColorspace(image,RGBColorspace);
         (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g %.20g\n",
           (double) image->columns,(double) image->rows);
diff --git a/coders/ps.c b/coders/ps.c
index 5796321..9ea57be 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -47,6 +47,7 @@
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/delegate.h"
 #include "MagickCore/delegate-private.h"
@@ -673,7 +674,7 @@
       }
   }
   (void) CloseBlob(image);
-  if (image_info->colorspace == RGBColorspace)
+  if (IsRGBColorspace(image_info->colorspace) != MagickFalse)
     cmyk=MagickFalse;
   /*
     Create Ghostscript control file.
@@ -1418,7 +1419,7 @@
     /*
       Scale relative to dots-per-inch.
     */
-    if ((image->colorspace != RGBColorspace) &&
+    if ((IsRGBColorspace(image->colorspace) == MagickFalse) &&
         (image->colorspace != CMYKColorspace))
       (void) TransformImageColorspace(image,RGBColorspace);
     delta.x=DefaultResolution;
diff --git a/coders/psd.c b/coders/psd.c
index fdb4f7d..6b3e793 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -48,6 +48,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/enhance.h"
 #include "MagickCore/exception.h"
@@ -703,7 +704,7 @@
         }
         case 4:
         {
-          if ((image->colorspace == RGBColorspace) && (channels > 3))
+          if ((IsRGBColorspace(image->colorspace) == MagickTrue) && (channels > 3))
             break;
           SetPixelAlpha(image,pixel,q);
           break;
@@ -2135,7 +2136,7 @@
            (image->colorspace != CMYKColorspace)) &&
           (image_info->colorspace != CMYKColorspace))
         {
-          if (image->colorspace != RGBColorspace)
+          if (IsRGBColorspace(image->colorspace) == MagickFalse)
             (void) TransformImageColorspace(image,RGBColorspace);
           (void) WriteBlobMSBShort(image,(unsigned short)
             (image->storage_class == PseudoClass ? IndexedMode : RGBMode));
diff --git a/coders/rgb.c b/coders/rgb.c
index e663199..8f9e990 100644
--- a/coders/rgb.c
+++ b/coders/rgb.c
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -1129,7 +1130,7 @@
     /*
       Convert MIFF to RGB raster pixels.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     if ((LocaleCompare(image_info->magick,"RGBA") == 0) &&
         (image->matte == MagickFalse))
diff --git a/coders/sgi.c b/coders/sgi.c
index 3adfcfa..c72b488 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -900,7 +901,7 @@
     /*
       Initialize SGI raster file header.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     (void) ResetMagickMemory(&iris_info,0,sizeof(iris_info));
     iris_info.magic=0x01DA;
diff --git a/coders/sun.c b/coders/sun.c
index 630668c..b020379 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -754,7 +755,7 @@
     /*
       Initialize SUN raster file header.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     sun_info.magic=0x59a66a95;
     if ((image->columns != (unsigned int) image->columns) ||
diff --git a/coders/tga.c b/coders/tga.c
index 12f7a6e..90ce761 100644
--- a/coders/tga.c
+++ b/coders/tga.c
@@ -48,6 +48,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -674,7 +675,7 @@
   */
   if ((image->columns > 65535L) || (image->rows > 65535L))
     ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   targa_info.id_length=0;
   value=GetImageProperty(image,"comment");
diff --git a/coders/tiff.c b/coders/tiff.c
index 5e0123c..ea73e3b 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/enhance.h"
 #include "MagickCore/exception.h"
@@ -2687,7 +2688,7 @@
             }
           else
             {
-              if (image->colorspace != RGBColorspace)
+              if (IsRGBColorspace(image->colorspace) == MagickFalse)
                 (void) TransformImageColorspace(image,RGBColorspace);
               photometric=PHOTOMETRIC_RGB;
             }
@@ -2859,7 +2860,7 @@
         if (image_info->quality != UndefinedCompressionQuality)
           (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality);
         (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW);
-        if (image->colorspace == RGBColorspace)
+        if (IsRGBColorspace(image->colorspace) == MagickTrue)
           {
             const char
               *value;
diff --git a/coders/uil.c b/coders/uil.c
index 08ed812..da10b53 100644
--- a/coders/uil.c
+++ b/coders/uil.c
@@ -46,6 +46,7 @@
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image-private.h"
@@ -209,7 +210,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   exception=(&image->exception);
   transparent=MagickFalse;
diff --git a/coders/vicar.c b/coders/vicar.c
index 07d9365..354d71c 100644
--- a/coders/vicar.c
+++ b/coders/vicar.c
@@ -45,6 +45,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -452,7 +453,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Write header.
diff --git a/coders/viff.c b/coders/viff.c
index 2db3ea9..a4fae9d 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -969,7 +970,7 @@
     /*
       Initialize VIFF image structure.
     */
-    if (image->colorspace != RGBColorspace)
+    if (IsRGBColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,RGBColorspace);
     if (IsImageGray(image,&image->exception) != MagickFalse)
       (void) SetImageStorageClass(image,DirectClass);
diff --git a/coders/wbmp.c b/coders/wbmp.c
index 8a30559..5330f5f 100644
--- a/coders/wbmp.c
+++ b/coders/wbmp.c
@@ -45,6 +45,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -373,7 +374,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Convert image to a bi-level image.
diff --git a/coders/xbm.c b/coders/xbm.c
index 6fe22d7..8e0c5fe 100644
--- a/coders/xbm.c
+++ b/coders/xbm.c
@@ -46,6 +46,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -504,7 +505,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Write X bitmap header.
diff --git a/coders/xpm.c b/coders/xpm.c
index 49fbb3a..d13703c 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -48,6 +48,7 @@
 #include "MagickCore/color-private.h"
 #include "MagickCore/colormap.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/geometry.h"
@@ -629,7 +630,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   SetGeometry(image,&geometry);
   (void) ParseMetaGeometry(PiconGeometry,&geometry.x,&geometry.y,
@@ -874,7 +875,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   opacity=(-1);
   if (image->matte == MagickFalse)
diff --git a/coders/xwd.c b/coders/xwd.c
index b9fa920..3223e46 100644
--- a/coders/xwd.c
+++ b/coders/xwd.c
@@ -47,6 +47,7 @@
 #include "MagickCore/colormap.h"
 #include "MagickCore/colormap-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/image.h"
@@ -642,7 +643,7 @@
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     return(status);
-  if (image->colorspace != RGBColorspace)
+  if (IsRGBColorspace(image->colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,RGBColorspace);
   /*
     Initialize XWD file header.