diff --git a/MagickCore/segment.c b/MagickCore/segment.c
index e8dcc8d..7653683 100644
--- a/MagickCore/segment.c
+++ b/MagickCore/segment.c
@@ -1825,7 +1825,7 @@
           image->filename)
       }
   }
-  if (colorspace != RGBColorspace)
+  if (IsRGBColorspace(colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,colorspace);
   /*
     Initialize histogram.
@@ -1841,7 +1841,7 @@
     Classify using the fuzzy c-Means technique.
   */
   status=Classify(image,extrema,cluster_threshold,WeightingExponent,verbose);
-  if (colorspace != RGBColorspace)
+  if (IsRGBColorspace(colorspace) == MagickFalse)
     (void) TransformImageColorspace(image,colorspace);
   /*
     Relinquish resources.