Renamed IsImageGray to SetImageGray and IsImageMonochrome to SetImageMonochrome since they change the type of the image.
Added new IsImageGray and IsImageMonochrome that only check if the image is gray or monochrome.
diff --git a/coders/cut.c b/coders/cut.c
index 78dd94e..85b0022 100644
--- a/coders/cut.c
+++ b/coders/cut.c
@@ -562,7 +562,7 @@
   if(palette==NULL)
     {    /*attempt to detect binary (black&white) images*/
       if ((image->storage_class == PseudoClass) &&
-          (IsImageGray(image,exception) != MagickFalse))
+          (SetImageGray(image,exception) != MagickFalse))
         {
           if(GetCutColors(image,exception)==2)
             {
diff --git a/coders/dcm.c b/coders/dcm.c
index 1f11d15..a6b67d0 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -4055,7 +4055,7 @@
               }
           }
       }
-    if (IsImageGray(image,exception) != MagickFalse)
+    if (SetImageGray(image,exception) != MagickFalse)
       (void) SetImageColorspace(image,GRAYColorspace,exception);
     if (EOFBlob(image) != MagickFalse)
       {
diff --git a/coders/dib.c b/coders/dib.c
index 5ab95f3..b324f20 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -1059,7 +1059,7 @@
       dib_info.bits_per_pixel=8;
       if (image_info->depth > 8)
         dib_info.bits_per_pixel=16;
-      if (IsImageMonochrome(image,exception) != MagickFalse)
+      if (SetImageMonochrome(image,exception) != MagickFalse)
         dib_info.bits_per_pixel=1;
       dib_info.number_colors=(dib_info.bits_per_pixel == 16) ? 0 :
         (1UL << dib_info.bits_per_pixel);
diff --git a/coders/dpx.c b/coders/dpx.c
index df692fe..c1b1d34 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -1638,7 +1638,7 @@
             dpx.image.image_element[i].descriptor=RGBAComponentType;
           if ((image_info->type != TrueColorType) &&
               (image->alpha_trait == UndefinedPixelTrait) &&
-              (IsImageGray(image,exception) != MagickFalse))
+              (SetImageGray(image,exception) != MagickFalse))
             dpx.image.image_element[i].descriptor=LumaComponentType;
           break;
         }
@@ -1972,7 +1972,7 @@
     dpx.image.image_element[0].packing == 0 ? MagickFalse : MagickTrue);
   if ((image_info->type != TrueColorType) &&
       (image->alpha_trait == UndefinedPixelTrait) &&
-      (IsImageGray(image,exception) != MagickFalse))
+      (SetImageGray(image,exception) != MagickFalse))
     {
       quantum_type=GrayQuantum;
       extent=GetBytesPerRow(image->columns,1UL,image->depth,
diff --git a/coders/fits.c b/coders/fits.c
index c6157a2..254cb51 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -679,7 +679,7 @@
   (void) strncpy(fits_info+offset,header,strlen(header));
   offset+=80;
   (void) FormatLocaleString(header,FITSBlocksize,"NAXIS   =           %10lu",
-    IsImageGray(image,exception) != MagickFalse ? 2UL : 3UL);
+    SetImageGray(image,exception) != MagickFalse ? 2UL : 3UL);
   (void) strncpy(fits_info+offset,header,strlen(header));
   offset+=80;
   (void) FormatLocaleString(header,FITSBlocksize,"NAXIS1  =           %10lu",
@@ -690,7 +690,7 @@
     (unsigned long) image->rows);
   (void) strncpy(fits_info+offset,header,strlen(header));
   offset+=80;
-  if (IsImageGray(image,exception) == MagickFalse)
+  if (SetImageGray(image,exception) == MagickFalse)
     {
       (void) FormatLocaleString(header,FITSBlocksize,
         "NAXIS3  =           %10lu",3UL);
@@ -729,7 +729,7 @@
     Convert image to fits scale PseudoColor class.
   */
   pixels=GetQuantumPixels(quantum_info);
-  if (IsImageGray(image,exception) != MagickFalse)
+  if (SetImageGray(image,exception) != MagickFalse)
     {
       length=GetQuantumExtent(image,quantum_info,GrayQuantum);
       for (y=(ssize_t) image->rows-1; y >= 0; y--)
diff --git a/coders/fpx.c b/coders/fpx.c
index 571b1ad..2db31f2 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -837,7 +837,7 @@
   if (image->alpha_trait != UndefinedPixelTrait)
     colorspace.numberOfComponents=4;
   if ((image_info->type != TrueColorType) &&
-      (IsImageGray(image,exception) != MagickFalse))
+      (SetImageGray(image,exception) != MagickFalse))
     {
       colorspace.numberOfComponents=1;
       colorspace.theComponents[0].myColor=MONOCHROME;
diff --git a/coders/jpeg.c b/coders/jpeg.c
index 46823ca..ea86abd 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -2231,7 +2231,7 @@
       (void) TransformImageColorspace(image,sRGBColorspace,exception);
       if (image_info->type == TrueColorType)
         break;
-      if (IsImageGray(image,exception) != MagickFalse)
+      if (SetImageGray(image,exception) != MagickFalse)
         {
           jpeg_info.input_components=1;
           jpeg_info.in_color_space=JCS_GRAYSCALE;
diff --git a/coders/json.c b/coders/json.c
index d81a7d1..37b919d 100644
--- a/coders/json.c
+++ b/coders/json.c
@@ -618,7 +618,7 @@
       if (channel_statistics == (ChannelStatistics *) NULL)
         return(MagickFalse);
       colorspace=image->colorspace;
-      if (IsImageGray(image,exception) != MagickFalse)
+      if (SetImageGray(image,exception) != MagickFalse)
         colorspace=GRAYColorspace;
       (void) FormatLocaleFile(file,"Channel %s locations:\n",locate);
       switch (colorspace)
@@ -702,7 +702,7 @@
         (void) FormatLocaleFile(file,"  Depth: %.20g/%.20g-bit\n",(double)
           image->depth,(double) depth);
       (void) FormatLocaleFile(file,"  Channel depth:\n");
-      if (IsImageGray(image,exception) != MagickFalse)
+      if (SetImageGray(image,exception) != MagickFalse)
         colorspace=GRAYColorspace;
       switch (colorspace)
       {
diff --git a/coders/mat.c b/coders/mat.c
index cd58d73..913c827 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -1232,7 +1232,7 @@
   do
   {
     (void) TransformImageColorspace(image,sRGBColorspace,exception);
-    is_gray = IsImageGray(image,exception);
+    is_gray = SetImageGray(image,exception);
     z = is_gray ? 0 : 3;
 
     /*
diff --git a/coders/pcl.c b/coders/pcl.c
index 3a92922..07bfe80 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -738,7 +738,7 @@
       density);
     (void) WriteBlobString(image,buffer);
     (void) WriteBlobString(image,"\033&l0E");  /* top margin 0 */
-    if (IsImageMonochrome(image,exception) != MagickFalse)
+    if (SetImageMonochrome(image,exception) != MagickFalse)
       {
         /*
           Monochrome image: use default printer monochrome setup.
diff --git a/coders/pcx.c b/coders/pcx.c
index 617694a..8505d50 100644
--- a/coders/pcx.c
+++ b/coders/pcx.c
@@ -919,7 +919,7 @@
     pcx_info.encoding=image_info->compression == NoCompression ? 0 : 1;
     pcx_info.bits_per_pixel=8;
     if ((image->storage_class == PseudoClass) &&
-        (IsImageMonochrome(image,exception) != MagickFalse))
+        (SetImageMonochrome(image,exception) != MagickFalse))
       pcx_info.bits_per_pixel=1;
     pcx_info.left=0;
     pcx_info.top=0;
diff --git a/coders/pdf.c b/coders/pdf.c
index 4f3eb8f..5a0dae0 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -1324,7 +1324,7 @@
       case FaxCompression:
       case Group4Compression:
       {
-        if ((IsImageMonochrome(image,exception) == MagickFalse) ||
+        if ((SetImageMonochrome(image,exception) == MagickFalse) ||
             (image->alpha_trait != UndefinedPixelTrait))
           compression=RLECompression;
         break;
@@ -1675,7 +1675,7 @@
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     if ((compression == FaxCompression) || (compression == Group4Compression) ||
         ((image_info->type != TrueColorType) &&
-         (IsImageGray(image,exception) != MagickFalse)))
+         (SetImageGray(image,exception) != MagickFalse)))
       {
         switch (compression)
         {
@@ -2026,7 +2026,7 @@
       if ((compression == FaxCompression) ||
           (compression == Group4Compression) ||
           ((image_info->type != TrueColorType) &&
-           (IsImageGray(image,exception) != MagickFalse)))
+           (SetImageGray(image,exception) != MagickFalse)))
           (void) CopyMagickString(buffer,"/DeviceGray\n",MaxTextExtent);
       else
         if ((image->storage_class == DirectClass) || (image->colors > 256) ||
@@ -2132,7 +2132,7 @@
     if ((compression == FaxCompression) ||
         (compression == Group4Compression) ||
         ((image_info->type != TrueColorType) &&
-         (IsImageGray(tile_image,exception) != MagickFalse)))
+         (SetImageGray(tile_image,exception) != MagickFalse)))
       {
         switch (compression)
         {
diff --git a/coders/png.c b/coders/png.c
index 05b6fd4..701f915 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -12244,7 +12244,7 @@
 
   /* Check if image is grayscale. */
   if (image_info->type != TrueColorAlphaType && image_info->type !=
-    TrueColorType && IsImageGray(image,exception))
+    TrueColorType && SetImageGray(image,exception))
     jng_color_type-=2;
 
   if (logging != MagickFalse)
@@ -13030,7 +13030,7 @@
 
         if (need_local_plte == 0)
           {
-            if (IsImageGray(image,exception) == MagickFalse)
+            if (SetImageGray(image,exception) == MagickFalse)
               all_images_are_gray=MagickFalse;
             mng_info->equal_palettes=PalettesAreEqual(image,next_image);
             if (use_global_plte == 0)
diff --git a/coders/pnm.c b/coders/pnm.c
index a0e1e6a..6a2a6f1 100644
--- a/coders/pnm.c
+++ b/coders/pnm.c
@@ -1598,7 +1598,7 @@
       case 'f':
       {
         format='F';
-        if (IsImageGray(image,exception) != MagickFalse)
+        if (SetImageGray(image,exception) != MagickFalse)
           format='f';
         break;
       }
@@ -1614,12 +1614,12 @@
       case 'n':
       {
         if ((image_info->type != TrueColorType) &&
-            (IsImageGray(image,exception) != MagickFalse))
+            (SetImageGray(image,exception) != MagickFalse))
           {
             format='5';
             if (image_info->compression == NoCompression)
               format='2';
-            if (IsImageMonochrome(image,exception) != MagickFalse)
+            if (SetImageMonochrome(image,exception) != MagickFalse)
               {
                 format='4';
                 if (image_info->compression == NoCompression)
diff --git a/coders/ps.c b/coders/ps.c
index adddfbd..0e605e7 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -1887,9 +1887,9 @@
     index=0;
     x=0;
     if ((image_info->type != TrueColorType) &&
-        (IsImageGray(image,exception) != MagickFalse))
+        (SetImageGray(image,exception) != MagickFalse))
       {
-        if (IsImageMonochrome(image,exception) == MagickFalse)
+        if (SetImageMonochrome(image,exception) == MagickFalse)
           {
             Quantum
               pixel;
diff --git a/coders/ps2.c b/coders/ps2.c
index 7052f14..908e321 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -733,7 +733,7 @@
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     if ((compression == FaxCompression) || (compression == Group4Compression) ||
         ((image_info->type != TrueColorType) &&
-         (IsImageGray(image,exception) != MagickFalse)))
+         (SetImageGray(image,exception) != MagickFalse)))
       {
         (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g %.20g\n1\n%d\n",
           (double) image->columns,(double) image->rows,(int)
diff --git a/coders/ps3.c b/coders/ps3.c
index 687ebf3..58c81ae 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -334,7 +334,7 @@
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   status=MagickTrue;
-  pack=IsImageMonochrome(image,exception) == MagickFalse ? 1UL : 8UL;
+  pack=SetImageMonochrome(image,exception) == MagickFalse ? 1UL : 8UL;
   padded_columns=((image->columns+pack-1)/pack)*pack;
   *length=(size_t) padded_columns*image->rows/pack;
   *pixel_info=AcquireVirtualMemory(*length,sizeof(*q));
@@ -899,7 +899,7 @@
     case FaxCompression:
     case Group4Compression:
     { 
-      if ((IsImageMonochrome(image,exception) == MagickFalse) ||
+      if ((SetImageMonochrome(image,exception) == MagickFalse) ||
           (image->alpha_trait != UndefinedPixelTrait))
         compression=RLECompression;
       break;
@@ -1042,7 +1042,7 @@
               (void) WriteBlobString(image,
                 "%%DocumentProcessColors: Cyan Magenta Yellow Black\n");
             else
-              if (IsImageGray(image,exception) != MagickFalse)
+              if (SetImageGray(image,exception) != MagickFalse)
                 (void) WriteBlobString(image,
                   "%%DocumentProcessColors: Black\n");
           }
@@ -1128,7 +1128,7 @@
       (void) WriteBlobString(image,
         "%%PageProcessColors: Cyan Magenta Yellow Black\n");
     else
-      if (IsImageGray(image,exception) != MagickFalse)
+      if (SetImageGray(image,exception) != MagickFalse)
         (void) WriteBlobString(image,"%%PageProcessColors: Black\n");
     /*
       Adjust document bounding box to bound page bounding box.
@@ -1257,7 +1257,7 @@
     */
     option=GetImageOption(image_info,"ps3:imagemask");
     (void) WriteBlobString(image,((option != (const char *) NULL) &&
-      (IsImageMonochrome(image,exception) != MagickFalse)) ?
+      (SetImageMonochrome(image,exception) != MagickFalse)) ?
       "true\n" : "false\n");
     /*
       Output pixel data.
@@ -1269,8 +1269,8 @@
         (image_info->type != ColorSeparationType) &&
         (image_info->type != ColorSeparationAlphaType) &&
         (image->colorspace != CMYKColorspace) &&
-        ((IsImageGray(image,exception) != MagickFalse) ||
-         (IsImageMonochrome(image,exception) != MagickFalse)))
+        ((SetImageGray(image,exception) != MagickFalse) ||
+         (SetImageMonochrome(image,exception) != MagickFalse)))
       {
         /*
           Gray images.
@@ -1319,7 +1319,7 @@
           1 bit or 8 bit components?
         */
         (void) FormatLocaleString(buffer,MaxTextExtent,"%d\n",
-          IsImageMonochrome(image,exception) != MagickFalse ? 1 : 8);
+          SetImageMonochrome(image,exception) != MagickFalse ? 1 : 8);
         (void) WriteBlobString(image,buffer);
         /*
           Image data.
diff --git a/coders/psd.c b/coders/psd.c
index 6a56d1f..e0a52b2 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -2152,7 +2152,7 @@
     (void) WriteBlobMSBShort(image,0);
   if (next_image->depth > 8)
     next_image->depth=16;
-  monochrome=IsImageMonochrome(image,exception) && (image->depth == 1) ?
+  monochrome=SetImageMonochrome(image,exception) && (image->depth == 1) ?
     MagickTrue : MagickFalse;
   packet_size=next_image->depth > 8UL ? 2UL : 1UL;
   (void) packet_size;
@@ -2204,7 +2204,7 @@
       if (compact_pixels == (unsigned char *) NULL)
         ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     }
-  if (IsImageGray(next_image,exception) != MagickFalse)
+  if (SetImageGray(next_image,exception) != MagickFalse)
     {
       if (next_image->compression == RLECompression)
         {
@@ -2511,7 +2511,7 @@
   (void) WriteBlobMSBShort(image,psd_info.version);  /* version */
   for (i=1; i <= 6; i++)
     (void) WriteBlobByte(image, 0);  /* 6 bytes of reserved */
-  if (IsImageGray(image,exception) != MagickFalse)
+  if (SetImageGray(image,exception) != MagickFalse)
     num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL);
   else
     if (image->storage_class == PseudoClass)
@@ -2526,7 +2526,7 @@
   (void) WriteBlobMSBShort(image,(unsigned short) num_channels);
   (void) WriteBlobMSBLong(image,(unsigned int) image->rows);
   (void) WriteBlobMSBLong(image,(unsigned int) image->columns);
-  if (IsImageGray(image,exception) != MagickFalse)
+  if (SetImageGray(image,exception) != MagickFalse)
     {
       MagickBooleanType
         monochrome;
@@ -2534,7 +2534,7 @@
       /*
         Write depth & mode.
       */
-      monochrome=IsImageMonochrome(image,exception) && (image->depth == 1) ?
+      monochrome=SetImageMonochrome(image,exception) && (image->depth == 1) ?
         MagickTrue : MagickFalse;
       (void) WriteBlobMSBShort(image,(unsigned short)
         (monochrome != MagickFalse ? 1 : image->depth > 8 ? 16 : 8));
@@ -2561,7 +2561,7 @@
           (void) WriteBlobMSBShort(image,CMYKMode);
         }
     }
-  if ((IsImageGray(image,exception) != MagickFalse) ||
+  if ((SetImageGray(image,exception) != MagickFalse) ||
       (image->storage_class == DirectClass) || (image->colors > 256))
     (void) WriteBlobMSBLong(image,0);
   else
@@ -2630,7 +2630,7 @@
   while ( next_image != NULL )
   {
     packet_size=next_image->depth > 8 ? 2UL : 1UL;
-    if (IsImageGray(next_image,exception) != MagickFalse)
+    if (SetImageGray(next_image,exception) != MagickFalse)
       num_channels=next_image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL;
     else
       if (next_image->storage_class == PseudoClass)
@@ -2689,7 +2689,7 @@
         packet_size=next_image->depth > 8 ? 2UL : 1UL;
         channel_size=(unsigned int) ((packet_size*next_image->rows*
           next_image->columns)+2);
-        if ((IsImageGray(next_image,exception) != MagickFalse) ||
+        if ((SetImageGray(next_image,exception) != MagickFalse) ||
             (next_image->storage_class == PseudoClass))
           {
              (void) WriteBlobMSBShort(image,(unsigned short)
diff --git a/coders/sgi.c b/coders/sgi.c
index 0991b19..0be78b1 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -944,7 +944,7 @@
     else
       {
         if ((image_info->type != TrueColorType) &&
-            (IsImageGray(image,exception) != MagickFalse))
+            (SetImageGray(image,exception) != MagickFalse))
           {
             iris_info.dimension=2;
             iris_info.depth=1;
diff --git a/coders/sun.c b/coders/sun.c
index f77d5b9..8d605da 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -793,7 +793,7 @@
           0;
       }
     else
-      if (IsImageMonochrome(image,exception) != MagickFalse)
+      if (SetImageMonochrome(image,exception) != MagickFalse)
         {
           /*
             Monochrome SUN raster.
@@ -886,7 +886,7 @@
         pixels=(unsigned char *) RelinquishMagickMemory(pixels);
       }
     else
-      if (IsImageMonochrome(image,exception) != MagickFalse)
+      if (SetImageMonochrome(image,exception) != MagickFalse)
         {
           register unsigned char
             bit,
diff --git a/coders/tga.c b/coders/tga.c
index dc27bc5..b09638d 100644
--- a/coders/tga.c
+++ b/coders/tga.c
@@ -776,7 +776,7 @@
       (image_info->type != TrueColorAlphaType) &&
       (image_info->type != PaletteType) &&
       (image->alpha_trait == UndefinedPixelTrait) &&
-      (IsImageGray(image,exception) != MagickFalse))
+      (SetImageGray(image,exception) != MagickFalse))
     tga_info.image_type=compression == RLECompression ? TGARLEMonochrome :
       TGAMonochrome;
   else
diff --git a/coders/tiff.c b/coders/tiff.c
index 43ea0a8..d502f56 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -3219,7 +3219,7 @@
             (image_info->type != TrueColorAlphaType))
           {
             if ((image_info->type != PaletteType) &&
-                (IsImageGray(image,exception) != MagickFalse))
+                (SetImageGray(image,exception) != MagickFalse))
               {
                 photometric=(uint16) (quantum_info->min_is_white !=
                   MagickFalse ? PHOTOMETRIC_MINISWHITE :
@@ -3227,7 +3227,7 @@
                 (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);
                 if ((image_info->depth == 0) &&
                     (image->alpha_trait == UndefinedPixelTrait) &&
-                    (IsImageMonochrome(image,exception) != MagickFalse))
+                    (SetImageMonochrome(image,exception) != MagickFalse))
                   {
                     status=SetQuantumDepth(image,quantum_info,1);
                     if (status == MagickFalse)
diff --git a/coders/viff.c b/coders/viff.c
index 923155c..f950bde 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -1011,7 +1011,7 @@
         viff_info.color_space_model=VFF_CM_NONE;
         viff_info.data_storage_type=VFF_TYP_1_BYTE;
         packets=number_pixels;
-        if (IsImageGray(image,exception) == MagickFalse)
+        if (SetImageGray(image,exception) == MagickFalse)
           {
             /*
               Colormapped VIFF raster.
@@ -1112,7 +1112,7 @@
         }
       }
     else
-      if (IsImageGray(image,exception) == MagickFalse)
+      if (SetImageGray(image,exception) == MagickFalse)
         {
           unsigned char
             *viff_colormap;
diff --git a/coders/vips.c b/coders/vips.c
index ab18bf5..39d4dda 100644
--- a/coders/vips.c
+++ b/coders/vips.c
@@ -652,7 +652,7 @@
   (void) WriteBlobLong(image,(unsigned int) image->rows);
   (void) SetImageStorageClass(image,DirectClass,exception);
   channels=image->alpha_trait != UndefinedPixelTrait ? 4 : 3;
-  if (IsImageGray(image,exception) != MagickFalse)
+  if (SetImageGray(image,exception) != MagickFalse)
     channels=image->alpha_trait != UndefinedPixelTrait ? 2 : 1;
   else if (image->colorspace == CMYKColorspace)
     channels=image->alpha_trait != UndefinedPixelTrait ? 5 : 4;
diff --git a/coders/xpm.c b/coders/xpm.c
index ba5cc5c..6d8229e 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -686,7 +686,7 @@
   blob_info=CloneImageInfo(image_info);
   (void) AcquireUniqueFilename(blob_info->filename);
   if ((image_info->type != TrueColorType) &&
-      (IsImageGray(image,exception) != MagickFalse))
+      (SetImageGray(image,exception) != MagickFalse))
     affinity_image=BlobToImage(blob_info,Graymap,GraymapExtent,exception);
   else
     affinity_image=BlobToImage(blob_info,Colormap,ColormapExtent,exception);