]> granicus.if.org Git - imagemagick/blobdiff - PerlMagick/Magick.xs
(no commit message)
[imagemagick] / PerlMagick / Magick.xs
index 10c979a524517ca53dbbbf4e9fc445c6de608f4f..31d421069e35017a0fe2b12d5164ffad7d2d9f8f 100644 (file)
@@ -23,7 +23,7 @@
 %                             February 1997                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
 /*
   Include declarations.
 */
-#if !defined(WIN32)
-#define MagickExport
-#endif
-
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
@@ -210,15 +206,16 @@ static struct
   {
     { "Comment", { {"comment", StringReference} } },
     { "Label", { {"label", StringReference} } },
-    { "AddNoise", { {"noise", MagickNoiseOptions},
+    { "AddNoise", { {"noise", MagickNoiseOptions}, {"attenuate", RealReference},
       {"channel", MagickChannelOptions} } },
-    { "Colorize", { {"fill", StringReference}, {"opacity", StringReference} } },
+    { "Colorize", { {"fill", StringReference}, {"blend", StringReference} } },
     { "Border", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference}, {"fill", StringReference},
       {"bordercolor", StringReference}, {"color", StringReference},
       {"compose", MagickComposeOptions} } },
     { "Blur", { {"geometry", StringReference}, {"radius", RealReference},
-      {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
+      {"sigma", RealReference}, {"bias", RealReference},
+      {"channel", MagickChannelOptions} } },
     { "Chop", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference}, {"x", IntegerReference},
       {"y", IntegerReference} } },
@@ -241,10 +238,10 @@ static struct
       {"interpolate", MagickInterpolateOptions} } },
     { "Magnify", },
     { "MedianFilter", { {"geometry", StringReference},
-      {"width", IntegerReference},{"height", IntegerReference},
+      {"width", IntegerReference}, {"height", IntegerReference},
       {"channel", MagickChannelOptions} } },
     { "Minify", },
-    { "OilPaint", { {"radius", RealReference} } },
+    { "OilPaint", { {"radius", RealReference}, {"sigma", RealReference} } },
     { "ReduceNoise", { {"geometry", StringReference},
       {"width", IntegerReference},{"height", IntegerReference},
       {"channel", MagickChannelOptions} } },
@@ -259,11 +256,13 @@ static struct
     { "Shade", { {"geometry", StringReference}, {"azimuth", RealReference},
       {"elevation", RealReference}, {"gray", MagickBooleanOptions} } },
     { "Sharpen", { {"geometry", StringReference}, {"radius", RealReference},
-      {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
+      {"sigma", RealReference}, {"bias", RealReference},
+      {"channel", MagickChannelOptions} } },
     { "Shear", { {"geometry", StringReference}, {"x", RealReference},
       {"y", RealReference}, { "fill", StringReference},
       {"color", StringReference} } },
-    { "Spread", { {"radius", RealReference} } },
+    { "Spread", { {"radius", RealReference},
+      {"interpolate", MagickInterpolateOptions} } },
     { "Swirl", { {"degrees", RealReference},
       {"interpolate", MagickInterpolateOptions} } },
     { "Resize", { {"geometry", StringReference}, {"width", IntegerReference},
@@ -371,7 +370,7 @@ static struct
     { "Threshold", { {"threshold", StringReference},
       {"channel", MagickChannelOptions} } },
     { "Charcoal", { {"geometry", StringReference}, {"radius", RealReference},
-      {"sigma", RealReference} } },
+      {"sigma", RealReference}, {"biabias", RealReference} } },
     { "Trim", { {"fuzz", StringReference} } },
     { "Wave", { {"geometry", StringReference}, {"amplitude", RealReference},
       {"wavelength", RealReference},
@@ -384,9 +383,10 @@ static struct
     { "Deconstruct", },
     { "GaussianBlur", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"channel", MagickChannelOptions} } },
+      {"bias", RealReference}, {"channel", MagickChannelOptions} } },
     { "Convolve", { {"coefficients", ArrayReference},
-      {"channel", MagickChannelOptions}, {"bias", StringReference} } },
+      {"channel", MagickChannelOptions}, {"bias", StringReference},
+      {"kernel", StringReference} } },
     { "Profile", { {"name", StringReference}, {"profile", StringReference},
       { "rendering-intent", MagickIntentOptions},
       { "black-point-compensation", MagickBooleanOptions} } },
@@ -396,7 +396,8 @@ static struct
       {"channel", MagickChannelOptions} } },
     { "MotionBlur", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"angle", RealReference}, {"channel", MagickChannelOptions} } },
+      {"angle", RealReference}, {"bias", RealReference},
+      {"channel", MagickChannelOptions} } },
     { "OrderedDither", { {"threshold", StringReference},
       {"channel", MagickChannelOptions} } },
     { "Shave", { {"geometry", StringReference}, {"width", IntegerReference},
@@ -413,7 +414,7 @@ static struct
     { "Difference", { {"image", ImageReference}, {"fuzz", StringReference} } },
     { "AdaptiveThreshold", { {"geometry", StringReference},
       {"width", IntegerReference}, {"height", IntegerReference},
-      {"offset", IntegerReference} } },
+      {"bias", RealReference} } },
     { "Resample", { {"density", StringReference}, {"x", RealReference},
       {"y", RealReference}, {"filter", MagickFilterOptions},
       {"support", RealReference }, {"blur", RealReference } } },
@@ -423,11 +424,11 @@ static struct
     { "WhiteThreshold", { {"threshold", StringReference},
       {"channel", MagickChannelOptions} } },
     { "RadialBlur", { {"geometry", StringReference}, {"angle", RealReference},
-      {"channel", MagickChannelOptions} } },
+      {"bias", RealReference}, {"channel", MagickChannelOptions} } },
     { "Thumbnail", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference} } },
     { "Strip", },
-    { "Tint", { {"fill", StringReference}, {"opacity", StringReference} } },
+    { "Tint", { {"fill", StringReference}, {"blend", StringReference} } },
     { "Channel", { {"channel", MagickChannelOptions} } },
     { "Splice", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference}, {"x", IntegerReference},
@@ -435,7 +436,7 @@ static struct
       {"background", StringReference}, {"gravity", MagickGravityOptions} } },
     { "Posterize", { {"levels", IntegerReference},
       {"dither", MagickBooleanOptions} } },
-    { "Shadow", { {"geometry", StringReference}, {"opacity", RealReference},
+    { "Shadow", { {"geometry", StringReference}, {"alpha", RealReference},
       {"sigma", RealReference}, {"x", IntegerReference},
       {"y", IntegerReference} } },
     { "Identify", { {"file", FileReference}, {"features", StringReference},
@@ -458,31 +459,32 @@ static struct
     { "Sans1", },
     { "AdaptiveSharpen", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"channel", MagickChannelOptions} } },
+      {"bias", RealReference}, {"channel", MagickChannelOptions} } },
     { "Transpose", },
     { "Transverse", },
     { "AutoOrient", },
     { "AdaptiveBlur", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"channel", MagickChannelOptions} } },
+      {"bias", RealReference}, {"channel", MagickChannelOptions} } },
     { "Sketch", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"angle", RealReference} } },
+      {"angle", RealReference}, {"bias", RealReference} } },
     { "UniqueColors", },
     { "AdaptiveResize", { {"geometry", StringReference},
       {"width", IntegerReference}, {"height", IntegerReference},
       {"filter", MagickFilterOptions}, {"support", StringReference },
-      {"blur", RealReference } } },
+      {"blur", RealReference }, {"interpolate", MagickInterpolateOptions} } },
     { "ClipMask", { {"mask", ImageReference} } },
     { "LinearStretch", { {"levels", StringReference},
       {"black-point", RealReference},{"white-point", RealReference} } },
-    { "Recolor", { {"matrix", ArrayReference} } },
+    { "ColorMatrix", { {"matrix", ArrayReference} } },
     { "Mask", { {"mask", ImageReference} } },
     { "Polaroid", { {"caption", StringReference}, {"angle", RealReference},
       {"font", StringReference}, {"stroke", StringReference},
       {"fill", StringReference}, {"strokewidth", RealReference},
       {"pointsize", RealReference}, {"gravity", MagickGravityOptions},
-      {"background", StringReference} } },
+      {"background", StringReference},
+      {"interpolate", MagickInterpolateOptions} } },
     { "FloodfillPaint", { {"geometry", StringReference},
       {"x", IntegerReference}, {"y", IntegerReference},
       {"fill", StringReference}, {"bordercolor", StringReference},
@@ -492,6 +494,7 @@ static struct
       {"virtual-pixel", MagickVirtualPixelOptions},
       {"best-fit", MagickBooleanOptions} } },
     { "Clut", { {"image", ImageReference},
+      {"interpolate", MagickInterpolateOptions},
       {"channel", MagickChannelOptions} } },
     { "LiquidRescale", { {"geometry", StringReference},
       {"width", IntegerReference}, {"height", IntegerReference},
@@ -511,7 +514,8 @@ static struct
       {"virtual-pixel", MagickVirtualPixelOptions} } },
     { "SelectiveBlur", { {"geometry", StringReference},
       {"radius", RealReference}, {"sigma", RealReference},
-      {"threshold", RealReference}, {"channel", MagickChannelOptions} } },
+      {"threshold", RealReference}, {"bias", RealReference},
+      {"channel", MagickChannelOptions} } },
     { "HaldClut", { {"image", ImageReference},
       {"channel", MagickChannelOptions} } },
     { "BlueShift", { {"factor", StringReference} } },
@@ -525,15 +529,13 @@ static struct
       {"black-point", StringReference}, {"white-point", StringReference},
       {"channel", MagickChannelOptions}, {"invert", MagickBooleanOptions} } },
     { "Clamp", { {"channel", MagickChannelOptions} } },
-    { "Filter", { {"kernel", StringReference},
-      {"channel", MagickChannelOptions}, {"bias", StringReference} } },
     { "BrightnessContrast", { {"levels", StringReference},
       {"brightness", RealReference},{"contrast", RealReference},
       {"channel", MagickChannelOptions} } },
     { "Morphology", { {"kernel", StringReference},
       {"channel", MagickChannelOptions}, {"method", MagickMorphologyOptions},
       {"iterations", IntegerReference} } },
-    { "ColorMatrix", { {"matrix", ArrayReference} } },
+    { "Sans", { {"matrix", ArrayReference} } },
     { "Color", { {"color", StringReference} } },
     { "Mode", { {"geometry", StringReference},
       {"width", IntegerReference},{"height", IntegerReference},
@@ -1024,32 +1026,37 @@ static struct PackageInfo *GetPackageInfo(pTHX_ void *reference,
 %
 */
 
-static double SiPrefixToDouble(const char *string,const double interval)
+static double SiPrefixToDoubleInterval(const char *string,const double interval)
+{
+  char
+    *q;
+
+  double
+    value;
+
+  value=InterpretSiPrefixValue(string,&q);
+  if (*q == '%')
+    value*=interval/100.0;
+  return(value);
+}
+
+static inline double StringToDouble(const char *restrict string,
+  char **restrict sentinal)
+{
+  return(InterpretLocaleValue(string,sentinal));
+}
+
+static double StringToDoubleInterval(const char *string,const double interval)
 {
   char
     *q;
 
   double
-    scale,
     value;
 
   value=InterpretLocaleValue(string,&q);
-  scale=1000.0;
-  if ((*q != '\0') && (tolower((int) ((unsigned char) *(q+1))) == 'i'))
-    scale=1024.0;
-  switch (tolower((int) ((unsigned char) *q)))
-  {
-    case '%': value*=pow(scale,0)*interval/100.0; break;
-    case 'k': value*=pow(scale,1); break;
-    case 'm': value*=pow(scale,2); break;
-    case 'g': value*=pow(scale,3); break;
-    case 't': value*=pow(scale,4); break;
-    case 'p': value*=pow(scale,5); break;
-    case 'e': value*=pow(scale,6); break;
-    case 'z': value*=pow(scale,7); break;
-    case 'y': value*=pow(scale,8); break;
-    default:  break;
-  }
+  if (*q == '%')
+    value*=interval/100.0;
   return(value);
 }
 
@@ -1074,7 +1081,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
   MagickStatusType
     flags;
 
-  PixelPacket
+  PixelInfo
     *color,
     target_color;
 
@@ -1111,7 +1118,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
               break;
             }
           for ( ; image; image=image->next)
-            (void) SetImageAlphaChannel(image,(AlphaChannelType) sp);
+            (void) SetImageAlphaChannel(image,(AlphaChannelType) sp,exception);
           break;
         }
       if (LocaleCompare(attribute,"antialias") == 0)
@@ -1135,7 +1142,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(AreaResource,limit);
           break;
         }
@@ -1148,13 +1156,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"authenticate") == 0)
         {
           if (info)
-            (void) CloneString(&info->image_info->authenticate,SvPV(sval,na));
+            SetImageOption(info->image_info,attribute,SvPV(sval,na));
           break;
         }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'B':
@@ -1162,7 +1170,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
     {
       if (LocaleCompare(attribute,"background") == 0)
         {
-          (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
+          (void) QueryColorCompliance(SvPV(sval,na),AllCompliance,&target_color,
+            exception);
           if (info)
             info->image_info->background_color=target_color;
           for ( ; image; image=image->next)
@@ -1172,7 +1181,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"bias") == 0)
         {
           for ( ; image; image=image->next)
-            image->bias=SiPrefixToDouble(SvPV(sval,na),QuantumRange);
+            image->bias=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           break;
         }
       if (LocaleCompare(attribute,"blue-primary") == 0)
@@ -1190,7 +1200,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
         }
       if (LocaleCompare(attribute,"bordercolor") == 0)
         {
-          (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
+          (void) QueryColorCompliance(SvPV(sval,na),AllCompliance,&target_color,
+            exception);
           if (info)
             info->image_info->border_color=target_color;
           for ( ; image; image=image->next)
@@ -1200,7 +1211,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'C':
@@ -1209,9 +1220,9 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"cache-threshold") == 0)
         {
           (void) SetMagickResourceLimit(MemoryResource,(MagickSizeType)
-            SiPrefixToDouble(SvPV(sval,na),100.0));
+            SiPrefixToDoubleInterval(SvPV(sval,na),100.0));
           (void) SetMagickResourceLimit(MapResource,(MagickSizeType)
-            (2*SiPrefixToDouble(SvPV(sval,na),100.0)));
+            (2.0*SiPrefixToDoubleInterval(SvPV(sval,na),100.0)));
           break;
         }
       if (LocaleCompare(attribute,"clip-mask") == 0)
@@ -1223,7 +1234,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           if (SvPOK(sval))
             clip_mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
           for ( ; image; image=image->next)
-            SetImageClipMask(image,clip_mask);
+            SetImageClipMask(image,clip_mask,exception);
           break;
         }
       if (LocaleNCompare(attribute,"colormap",8) == 0)
@@ -1245,7 +1256,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
               i%=image->colors;
             if ((strchr(SvPV(sval,na),',') == 0) ||
                 (strchr(SvPV(sval,na),')') != 0))
-              QueryColorDatabase(SvPV(sval,na),image->colormap+i,exception);
+              QueryColorCompliance(SvPV(sval,na),AllCompliance,
+                image->colormap+i,exception);
             else
               {
                 color=image->colormap+i;
@@ -1274,7 +1286,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
               break;
             }
           for ( ; image; image=image->next)
-            (void) TransformImageColorspace(image,(ColorspaceType) sp);
+            (void) TransformImageColorspace(image,(ColorspaceType) sp,
+              exception);
           break;
         }
       if (LocaleCompare(attribute,"comment") == 0)
@@ -1282,7 +1295,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           for ( ; image; image=image->next)
             (void) SetImageProperty(image,"Comment",InterpretImageProperties(
               info ? info->image_info : (ImageInfo *) NULL,image,
-              SvPV(sval,na)));
+              SvPV(sval,na),exception),exception);
           break;
         }
       if (LocaleCompare(attribute,"compression") == 0)
@@ -1304,7 +1317,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'D':
@@ -1334,7 +1347,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(DiskResource,limit);
           break;
         }
@@ -1351,10 +1365,10 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           for ( ; image; image=image->next)
           {
             flags=ParseGeometry(SvPV(sval,na),&geometry_info);
-            image->x_resolution=geometry_info.rho;
-            image->y_resolution=geometry_info.sigma;
+            image->resolution.x=geometry_info.rho;
+            image->resolution.y=geometry_info.sigma;
             if ((flags & SigmaValue) == 0)
-              image->y_resolution=image->x_resolution;
+              image->resolution.y=image->resolution.x;
           }
           break;
         }
@@ -1363,7 +1377,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           if (info)
             info->image_info->depth=SvIV(sval);
           for ( ; image; image=image->next)
-            (void) SetImageDepth(image,SvIV(sval));
+            (void) SetImageDepth(image,SvIV(sval),exception);
           break;
         }
       if (LocaleCompare(attribute,"dispose") == 0)
@@ -1406,7 +1420,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'E':
@@ -1439,7 +1453,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'F':
@@ -1499,15 +1513,17 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"fuzz") == 0)
         {
           if (info)
-            info->image_info->fuzz=SiPrefixToDouble(SvPV(sval,na),QuantumRange);
+            info->image_info->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           for ( ; image; image=image->next)
-            image->fuzz=SiPrefixToDouble(SvPV(sval,na),QuantumRange);
+            image->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           break;
         }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'G':
@@ -1551,7 +1567,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'I':
@@ -1618,7 +1634,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'L':
@@ -1629,7 +1645,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           for ( ; image; image=image->next)
             (void) SetImageProperty(image,"label",InterpretImageProperties(
               info ? info->image_info : (ImageInfo *) NULL,image,
-              SvPV(sval,na)));
+              SvPV(sval,na),exception),exception);
           break;
         }
       if (LocaleCompare(attribute,"loop") == 0)
@@ -1637,7 +1653,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'M':
@@ -1659,7 +1675,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(MapResource,limit);
           break;
         }
@@ -1672,12 +1689,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           if (SvPOK(sval))
             mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
           for ( ; image; image=image->next)
-            SetImageMask(image,mask);
+            SetImageMask(image,mask,exception);
           break;
         }
       if (LocaleCompare(attribute,"mattecolor") == 0)
         {
-          (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
+          (void) QueryColorCompliance(SvPV(sval,na),AllCompliance,&target_color,
+            exception);
           if (info)
             info->image_info->matte_color=target_color;
           for ( ; image; image=image->next)
@@ -1705,7 +1723,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(MemoryResource,limit);
           break;
         }
@@ -1722,13 +1741,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           if (info)
             info->image_info->monochrome=sp != 0 ? MagickTrue : MagickFalse;
           for ( ; image; image=image->next)
-            (void) SetImageType(image,BilevelType);
+            (void) SetImageType(image,BilevelType,exception);
           break;
         }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'O':
@@ -1759,7 +1778,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'P':
@@ -1800,7 +1819,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           for ( ; image; image=image->next)
           {
-            if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+            if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
               break;
             x=0;
             y=0;
@@ -1812,7 +1831,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
               {
                 if ((strchr(SvPV(sval,na),',') == 0) ||
                     (strchr(SvPV(sval,na),')') != 0))
-                  QueryMagickColor(SvPV(sval,na),&pixel,exception);
+                  QueryColorCompliance(SvPV(sval,na),AllCompliance,
+                    &pixel,exception);
                 else
                   {
                     GetPixelInfo(image,&pixel);
@@ -1865,7 +1885,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'Q':
@@ -1882,7 +1902,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'R':
@@ -1958,7 +1978,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'S':
@@ -2008,7 +2028,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'T':
@@ -2027,7 +2047,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(ThreadResource,limit);
           break;
         }
@@ -2052,13 +2073,15 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) SiPrefixToDouble(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(TimeResource,limit);
           break;
         }
       if (LocaleCompare(attribute,"transparent-color") == 0)
         {
-          (void) QueryColorDatabase(SvPV(sval,na),&target_color,exception);
+          (void) QueryColorCompliance(SvPV(sval,na),AllCompliance,&target_color,
+            exception);
           if (info)
             info->image_info->transparent_color=target_color;
           for ( ; image; image=image->next)
@@ -2078,13 +2101,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           if (info)
             info->image_info->type=(ImageType) sp;
           for ( ; image; image=image->next)
-            SetImageType(image,(ImageType) sp);
+            SetImageType(image,(ImageType) sp,exception);
           break;
         }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'U':
@@ -2116,8 +2139,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
                 {
                   if (units == PixelsPerCentimeterResolution)
                     {
-                      image->x_resolution*=2.54;
-                      image->y_resolution*=2.54;
+                      image->resolution.x*=2.54;
+                      image->resolution.y*=2.54;
                     }
                   break;
                 }
@@ -2125,8 +2148,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
                 {
                   if (units == PixelsPerInchResolution)
                     {
-                      image->x_resolution/=2.54;
-                      image->y_resolution/=2.54;
+                      image->resolution.x/=2.54;
+                      image->resolution.y/=2.54;
                     }
                   break;
                 }
@@ -2138,7 +2161,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'V':
@@ -2183,7 +2206,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     case 'W':
@@ -2205,7 +2228,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
     default:
@@ -2213,7 +2236,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
-        SetImageProperty(image,attribute,SvPV(sval,na));
+        SetImageProperty(image,attribute,SvPV(sval,na),exception);
       break;
     }
   }
@@ -2423,9 +2446,8 @@ Animate(ref,...)
         for (i=2; i < items; i+=2)
           SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
             exception);
-    (void) AnimateImages(package_info->image_info,image);
+    (void) AnimateImages(package_info->image_info,image,exception);
     (void) CatchImageException(image);
-    InheritException(exception,&image->exception);
 
   PerlException:
     if (package_info != (struct PackageInfo *) NULL)
@@ -3065,7 +3087,7 @@ void
 Compare(ref,...)
   Image::Magick ref=NO_INIT
   ALIAS:
-    CompareImage = 1
+    CompareImages = 1
     compare      = 2
     compareimage = 3
   PPCODE:
@@ -3076,9 +3098,6 @@ Compare(ref,...)
     char
       *attribute;
 
-    ChannelType
-      channel;
-
     double
       distortion;
 
@@ -3141,7 +3160,6 @@ Compare(ref,...)
     /*
       Get attribute.
     */
-    channel=DefaultChannels;
     reconstruct_image=image;
     metric=RootMeanSquaredErrorMetric;
     for (i=2; i < items; i+=2)
@@ -3164,7 +3182,7 @@ Compare(ref,...)
                     "UnrecognizedType",SvPV(ST(i),na));
                   return;
                 }
-              channel=(ChannelType) option;
+              SetPixelChannelMapMask(image,(ChannelType) option);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -3176,7 +3194,7 @@ Compare(ref,...)
         {
           if (LocaleCompare(attribute,"fuzz") == 0)
             {
-              image->fuzz=SiPrefixToDouble(SvPV(ST(i),na),100.0);
+              image->fuzz=StringToDoubleInterval(SvPV(ST(i),na),100.0);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -3224,8 +3242,8 @@ Compare(ref,...)
         }
       }
     }
-    difference_image=CompareImageChannels(image,reconstruct_image,channel,
-      metric,&distortion,exception);
+    difference_image=CompareImages(image,reconstruct_image,metric,&distortion,
+      exception);
     if (difference_image != (Image *) NULL)
       {
         difference_image->error.mean_error_per_pixel=distortion;
@@ -3264,7 +3282,7 @@ void
 CompareLayers(ref)
   Image::Magick ref=NO_INIT
   ALIAS:
-    CompareImageLayers   = 1
+    CompareImagesLayers   = 1
     comparelayers        = 2
     compareimagelayers   = 3
   PPCODE:
@@ -3360,7 +3378,7 @@ CompareLayers(ref)
         }
       }
     }
-    image=CompareImageLayers(image,method,exception);
+    image=CompareImagesLayers(image,method,exception);
     if ((image == (Image *) NULL) || (exception->severity >= ErrorException))
       goto PerlException;
     for ( ; image; image=image->next)
@@ -3534,9 +3552,8 @@ Display(ref,...)
         for (i=2; i < items; i+=2)
           SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
             exception);
-    (void) DisplayImages(package_info->image_info,image);
+    (void) DisplayImages(package_info->image_info,image,exception);
     (void) CatchImageException(image);
-    InheritException(exception,&image->exception);
 
   PerlException:
     if (package_info != (struct PackageInfo *) NULL)
@@ -3856,8 +3873,7 @@ Features(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
-      channel_features=GetImageChannelFeatures(image,distance,
-        &image->exception);
+      channel_features=GetImageFeatures(image,distance,exception);
       if (channel_features == (ChannelFeatures *) NULL)
         continue;
       count++;
@@ -3919,7 +3935,7 @@ Flatten(ref)
     Image
       *image;
 
-    PixelPacket
+    PixelInfo
       background_color;
 
     register ssize_t
@@ -3956,8 +3972,8 @@ Flatten(ref)
       }
     background_color=image->background_color;
     if (items == 2)
-      (void) QueryColorDatabase((char *) SvPV(ST(1),na),&background_color,
-        exception);
+      (void) QueryColorCompliance((char *) SvPV(ST(1),na),AllCompliance,
+        &background_color,exception);
     else
       for (i=2; i < items; i+=2)
       {
@@ -3969,8 +3985,8 @@ Flatten(ref)
           {
             if (LocaleCompare(attribute,"background") == 0)
               {
-                (void) QueryColorDatabase((char *) SvPV(ST(1),na),
-                  &background_color,exception);
+                (void) QueryColorCompliance((char *) SvPV(ST(1),na),
+                  AllCompliance,&background_color,exception);
                 break;
               }
             ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -4048,7 +4064,8 @@ Fx(ref,...)
       expression[MaxTextExtent];
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     ExceptionInfo
       *exception;
@@ -4154,7 +4171,10 @@ Fx(ref,...)
           }
         }
       }
-    image=FxImageChannel(image,channel,expression,exception);
+    channel_mask=SetPixelChannelMask(image,channel);
+    image=FxImage(image,expression,exception);
+    if (image != (Image *) NULL)
+      (void) SetPixelChannelMask(image,channel_mask);
     if ((image == (Image *) NULL) || (exception->severity >= ErrorException))
       goto PerlException;
     for ( ; image; image=image->next)
@@ -4277,7 +4297,7 @@ Get(ref,...)
               const char
                 *value;
 
-              value=GetImageProperty(image,attribute);
+              value=GetImageProperty(image,attribute,exception);
               if (value != (const char *) NULL)
                 s=newSVpv(value,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -4286,7 +4306,14 @@ Get(ref,...)
           if (LocaleCompare(attribute,"authenticate") == 0)
             {
               if (info)
-                s=newSVpv(info->image_info->authenticate,0);
+                {
+                  const char
+                    *option;
+
+                  option=GetImageOption(info->image_info,attribute);
+                  if (option != (const char *) NULL)
+                    s=newSVpv(option,0);
+                }
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -4301,10 +4328,10 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
-                QuantumFormat "," QuantumFormat "," QuantumFormat,
-                image->background_color.red,image->background_color.green,
-                image->background_color.blue,image->background_color.alpha);
+              (void) FormatLocaleString(color,MaxTextExtent,
+                "%.20g,%.20g,%.20g,%.20g",image->background_color.red,
+                image->background_color.green,image->background_color.blue,
+                image->background_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4366,10 +4393,10 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
-                QuantumFormat "," QuantumFormat "," QuantumFormat,
-                image->border_color.red,image->border_color.green,
-                image->border_color.blue,image->border_color.alpha);
+              (void) FormatLocaleString(color,MaxTextExtent,
+                "%.20g,%.20g,%.20g,%.20g",image->border_color.red,
+                image->border_color.green,image->border_color.blue,
+                image->border_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4384,7 +4411,7 @@ Get(ref,...)
 
               if (image == (Image *) NULL)
                 break;
-              page=GetImageBoundingBox(image,&image->exception);
+              page=GetImageBoundingBox(image,exception);
               (void) FormatLocaleString(geometry,MaxTextExtent,
                 "%.20gx%.20g%+.20g%+.20g",(double) page.width,(double)
                 page.height,(double) page.x,(double) page.y);
@@ -4419,7 +4446,7 @@ Get(ref,...)
 
                   sv=NULL;
                   if (image->mask == (Image *) NULL)
-                    ClipImage(image);
+                    ClipImage(image,exception);
                   if (image->mask != (Image *) NULL)
                     {
                       AddImageToRegistry(sv,image->mask);
@@ -4438,7 +4465,7 @@ Get(ref,...)
 
                   sv=NULL;
                   if (image->clip_mask == (Image *) NULL)
-                    ClipImage(image);
+                    ClipImage(image,exception);
                   if (image->clip_mask != (Image *) NULL)
                     {
                       AddImageToRegistry(sv,image->clip_mask);
@@ -4476,7 +4503,7 @@ Get(ref,...)
             {
               if (image != (Image *) NULL)
                 s=newSViv((ssize_t) GetNumberColors(image,(FILE *) NULL,
-                  &image->exception));
+                  exception));
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -4492,10 +4519,10 @@ Get(ref,...)
               (void) items;
               if (j > (ssize_t) image->colors)
                 j%=image->colors;
-              (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
-                QuantumFormat "," QuantumFormat "," QuantumFormat,
-                image->colormap[j].red,image->colormap[j].green,
-                image->colormap[j].blue,image->colormap[j].alpha);
+              (void) FormatLocaleString(color,MaxTextExtent,
+                "%.20g,%.20g,%.20g,%.20g",image->colormap[j].red,
+                image->colormap[j].green,image->colormap[j].blue,
+                image->colormap[j].alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4512,7 +4539,7 @@ Get(ref,...)
               const char
                 *value;
 
-              value=GetImageProperty(image,attribute);
+              value=GetImageProperty(image,attribute,exception);
               if (value != (const char *) NULL)
                 s=newSVpv(value,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -4539,7 +4566,7 @@ Get(ref,...)
               if (image == (Image *) NULL)
                 break;
               (void) FormatLocaleString(geometry,MaxTextExtent,"%.15gx%.15g",
-                image->x_resolution,image->y_resolution);
+                image->resolution.x,image->resolution.y);
               s=newSVpv(geometry,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4555,7 +4582,7 @@ Get(ref,...)
             {
               s=newSViv(MAGICKCORE_QUANTUM_DEPTH);
               if (image != (Image *) NULL)
-                s=newSViv((ssize_t) GetImageDepth(image,&image->exception));
+                s=newSViv((ssize_t) GetImageDepth(image,exception));
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -4680,7 +4707,7 @@ Get(ref,...)
               if (info && (*info->image_info->magick != '\0'))
                 magick_info=GetMagickInfo(info->image_info->magick,exception);
               if (image != (Image *) NULL)
-                magick_info=GetMagickInfo(image->magick,&image->exception);
+                magick_info=GetMagickInfo(image->magick,exception);
               if ((magick_info != (const MagickInfo *) NULL) &&
                   (*magick_info->description != '\0'))
                 s=newSVpv((char *) magick_info->description,0);
@@ -4804,7 +4831,7 @@ Get(ref,...)
                   (void) FormatLocaleString(key,MaxTextExtent,"%.20g\n",(double)
                     id);
                   status=SetImageRegistry(ImageRegistryType,key,image,
-                    &image->exception);
+                    exception);
                   (void) status;
                   s=newSViv(id++);
                 }
@@ -4838,7 +4865,7 @@ Get(ref,...)
               items=sscanf(attribute,"%*[^[][%ld%*[,/]%ld",&x,&y);
               (void) items;
               image_view=AcquireCacheView(image);
-              p=GetCacheViewVirtualPixels(image_view,x,y,1,1,&image->exception);
+              p=GetCacheViewVirtualPixels(image_view,x,y,1,1,exception);
               if (p != (const Quantum *) NULL)
                 {
                   (void) FormatLocaleString(name,MaxTextExtent,QuantumFormat,
@@ -4896,7 +4923,7 @@ Get(ref,...)
 
               if (image == (Image *) NULL)
                 break;
-              value=GetImageProperty(image,"Label");
+              value=GetImageProperty(image,"Label",exception);
               if (value != (const char *) NULL)
                 s=newSVpv(value,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -4964,10 +4991,10 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
-                QuantumFormat "," QuantumFormat "," QuantumFormat,
-                image->matte_color.red,image->matte_color.green,
-                image->matte_color.blue,image->matte_color.alpha);
+              (void) FormatLocaleString(color,MaxTextExtent,
+                "%.20g,%.20g,%.20g,%.20g",image->matte_color.red,
+                image->matte_color.green,image->matte_color.blue,
+                image->matte_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5006,7 +5033,7 @@ Get(ref,...)
               if (image == (Image *) NULL)
                 continue;
               j=info ? info->image_info->monochrome :
-                IsImageMonochrome(image,&image->exception);
+                IsImageMonochrome(image,exception);
               s=newSViv(j);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5234,8 +5261,8 @@ Get(ref,...)
 
               if (image == (Image *) NULL)
                 break;
-              (void) SignatureImage(image);
-              value=GetImageProperty(image,"Signature");
+              (void) SignatureImage(image,exception);
+              value=GetImageProperty(image,"Signature",exception);
               if (value != (const char *) NULL)
                 s=newSVpv(value,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -5266,7 +5293,7 @@ Get(ref,...)
             {
               s=newSViv(MAGICKCORE_QUANTUM_DEPTH);
               if (image != (Image *) NULL)
-                s=newSVnv(GetImageTotalInkDensity(image));
+                s=newSVnv(GetImageTotalInkDensity(image,exception));
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -5274,10 +5301,10 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,QuantumFormat ","
-                QuantumFormat "," QuantumFormat "," QuantumFormat,
-                image->transparent_color.red,image->transparent_color.green,
-                image->transparent_color.blue,image->transparent_color.alpha);
+              (void) FormatLocaleString(color,MaxTextExtent,
+                "%.20g,%.20g,%.20g,%.20g",image->transparent_color.red,
+                image->transparent_color.green,image->transparent_color.blue,
+                image->transparent_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5286,7 +5313,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              j=(ssize_t) GetImageType(image,&image->exception);
+              j=(ssize_t) GetImageType(image,exception);
               s=newSViv(j);
               (void) sv_setpv(s,CommandOptionToMnemonic(MagickTypeOptions,j));
               SvIOK_on(s);
@@ -5398,7 +5425,7 @@ Get(ref,...)
           if (LocaleCompare(attribute,"x-resolution") == 0)
             {
               if (image != (Image *) NULL)
-                s=newSVnv(image->x_resolution);
+                s=newSVnv(image->resolution.x);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -5412,7 +5439,7 @@ Get(ref,...)
           if (LocaleCompare(attribute,"y-resolution") == 0)
             {
               if (image != (Image *) NULL)
-                s=newSVnv(image->y_resolution);
+                s=newSVnv(image->resolution.y);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
@@ -5428,7 +5455,7 @@ Get(ref,...)
           attribute)
       else
         {
-          value=GetImageProperty(image,attribute);
+          value=GetImageProperty(image,attribute,exception);
           if (value != (const char *) NULL)
             {
               s=newSVpv(value,0);
@@ -5444,7 +5471,7 @@ Get(ref,...)
                    *meta;
 
                  meta=InterpretImageProperties(info ? info->image_info :
-                   (ImageInfo *) NULL,image,attribute);
+                   (ImageInfo *) NULL,image,attribute,exception);
                  s=newSVpv(meta,0);
                  PUSHs(s ? sv_2mortal(s) : &sv_undef);
                  meta=(char *) RelinquishMagickMemory(meta);
@@ -5934,7 +5961,7 @@ Histogram(ref,...)
     char
       message[MaxTextExtent];
 
-    PixelPacket
+    PixelInfo
       *histogram;
 
     ExceptionInfo
@@ -5984,36 +6011,36 @@ Histogram(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
-      histogram=GetImageHistogram(image,&number_colors,&image->exception);
-      if (histogram == (PixelPacket *) NULL)
+      histogram=GetImageHistogram(image,&number_colors,exception);
+      if (histogram == (PixelInfo *) NULL)
         continue;
       count+=(ssize_t) number_colors;
       EXTEND(sp,6*count);
       for (i=0; i < (ssize_t) number_colors; i++)
       {
-        (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
+        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
           histogram[i].red);
         PUSHs(sv_2mortal(newSVpv(message,0)));
-        (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
+        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
           histogram[i].green);
         PUSHs(sv_2mortal(newSVpv(message,0)));
-        (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
+        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
           histogram[i].blue);
         PUSHs(sv_2mortal(newSVpv(message,0)));
         if (image->colorspace == CMYKColorspace)
           {
-            (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
+            (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
               histogram[i].black);
             PUSHs(sv_2mortal(newSVpv(message,0)));
           }
-        (void) FormatLocaleString(message,MaxTextExtent,QuantumFormat,
+        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
           histogram[i].alpha);
         PUSHs(sv_2mortal(newSVpv(message,0)));
         (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double)
           histogram[i].count);
         PUSHs(sv_2mortal(newSVpv(message,0)));
       }
-      histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
+      histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
     }
 
   PerlException:
@@ -6048,9 +6075,6 @@ GetPixel(ref,...)
     char
       *attribute;
 
-    ChannelType
-      channel;
-
     ExceptionInfo
       *exception;
 
@@ -6094,7 +6118,6 @@ GetPixel(ref,...)
           PackageName);
         goto PerlException;
       }
-    channel=DefaultChannels;
     normalize=MagickTrue;
     region.x=0;
     region.y=0;
@@ -6122,7 +6145,7 @@ GetPixel(ref,...)
                     SvPV(ST(i),na));
                   return;
                 }
-               channel=(ChannelType) option;
+              SetPixelChannelMapMask(image,(ChannelType) option);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -6204,16 +6227,16 @@ GetPixel(ref,...)
         scale=1.0;
         if (normalize != MagickFalse)
           scale=1.0/QuantumRange;
-        if ((GetPixelRedTraits(image) & ActivePixelTrait) != 0)
+        if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
           PUSHs(sv_2mortal(newSVnv(scale*GetPixelRed(image,p))));
-        if ((GetPixelGreenTraits(image) & ActivePixelTrait) != 0)
+        if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
           PUSHs(sv_2mortal(newSVnv(scale*GetPixelGreen(image,p))));
-        if ((GetPixelBlueTraits(image) & ActivePixelTrait) != 0)
+        if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
           PUSHs(sv_2mortal(newSVnv(scale*GetPixelBlue(image,p))));
-        if (((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
+        if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
             (image->colorspace == CMYKColorspace))
           PUSHs(sv_2mortal(newSVnv(scale*GetPixelBlack(image,p))));
-        if ((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0)
+        if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
           PUSHs(sv_2mortal(newSVnv(scale*GetPixelAlpha(image,p))));
       }
 
@@ -6554,7 +6577,7 @@ ImageToBlob(ref,...)
       next->scene=scene++;
     }
     SetImageInfo(package_info->image_info,(unsigned int)
-      GetImageListLength(image),&image->exception);
+      GetImageListLength(image),exception);
     EXTEND(sp,(ssize_t) GetImageListLength(image));
     for ( ; image; image=image->next)
     {
@@ -6725,7 +6748,7 @@ Layers(ref,...)
       case CompareOverlayLayer:
       default:
       {
-        layers=CompareImageLayers(image,method,exception);
+        layers=CompareImagesLayers(image,method,exception);
         break;
       }
       case MergeLayer:
@@ -6753,19 +6776,16 @@ Layers(ref,...)
       case OptimizeTransLayer:
       {
         OptimizeImageTransparency(image,exception);
-        InheritException(&(image->exception),exception);
         break;
       }
       case RemoveDupsLayer:
       {
         RemoveDuplicateLayers(&image,exception);
-        InheritException(&(image->exception),exception);
         break;
       }
       case RemoveZeroLayer:
       {
         RemoveZeroDelayLayers(&image,exception);
-        InheritException(&(image->exception),exception);
         break;
       }
       case OptimizeLayer:
@@ -6779,19 +6799,16 @@ Layers(ref,...)
         layers=CoalesceImages(image,exception);
         if (layers == (Image *) NULL)
           break;
-        InheritException(&(layers->exception),exception);
         image=layers;
         layers=OptimizeImageLayers(image,exception);
         if (layers == (Image *) NULL)
           break;
-        InheritException(&(layers->exception),exception);
         image=DestroyImageList(image);
         image=layers;
         layers=(Image *) NULL;
         OptimizeImageTransparency(image,exception);
-        InheritException(&(image->exception),exception);
         quantize_info=AcquireQuantizeInfo(info->image_info);
-        (void) RemapImages(quantize_info,image,(Image *) NULL);
+        (void) RemapImages(quantize_info,image,(Image *) NULL,exception);
         quantize_info=DestroyQuantizeInfo(quantize_info);
         break;
       }
@@ -6848,15 +6865,11 @@ Layers(ref,...)
           image->rows,image->gravity,&geometry);
         CompositeLayers(image,compose,source,geometry.x,geometry.y,exception);
         source=DestroyImageList(source);
-        InheritException(&(image->exception),exception);
         break;
       }
     }
     if (layers != (Image *) NULL)
-      {
-        InheritException(&(layers->exception),exception);
-        image=layers;
-      }
+      image=layers;
     if ((image == (Image *) NULL) || (exception->severity >= ErrorException))
       goto PerlException;
     for ( ; image; image=image->next)
@@ -6963,7 +6976,7 @@ Mogrify(ref,...)
     Magnify            =  33
     MagnifyImage       =  34
     MedianFilter       =  35
-    MedianFilterImage  =  36
+    MedianConvolveImage  =  36
     Minify             =  37
     MinifyImage        =  38
     OilPaint           =  39
@@ -7140,8 +7153,8 @@ Mogrify(ref,...)
     ClipMaskImage      = 212
     LinearStretch      = 213
     LinearStretchImage = 214
-    RecolorImage       = 215
-    Recolor            = 216
+    ColorMatrix        = 215
+    ColorMatrixImage   = 216
     Mask               = 217
     MaskImage          = 218
     Polaroid           = 219
@@ -7183,23 +7196,19 @@ Mogrify(ref,...)
     AutoLevel          = 255
     AutoLevelImage     = 256
     LevelColors        = 257
-    LevelColorsImage   = 258
+    LevelImageColors   = 258
     Clamp              = 259
     ClampImage         = 260
-    Filter             = 261
-    FilterImage        = 262
-    BrightnessContrast = 263
-    BrightnessContrastImage = 264
-    Morphology         = 265
-    MorphologyImage    = 266
-    ColorMatrix        = 267
-    ColorMatrixImage   = 268
-    Color              = 269
-    ColorImage         = 270
-    Mode               = 271
-    ModeImage          = 272
-    Statistic          = 273
-    StatisticImage     = 274
+    BrightnessContrast = 261
+    BrightnessContrastImage = 262
+    Morphology         = 263
+    MorphologyImage    = 264
+    Color              = 265
+    ColorImage         = 266
+    Mode               = 267
+    ModeImage          = 268
+    Statistic          = 269
+    StatisticImage     = 270
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -7212,7 +7221,8 @@ Mogrify(ref,...)
       message[MaxTextExtent];
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     CompositeOperator
       compose;
@@ -7241,7 +7251,7 @@ Mogrify(ref,...)
     MagickStatusType
       flags;
 
-    PixelPacket
+    PixelInfo
       fill_color;
 
     RectangleInfo
@@ -7481,7 +7491,7 @@ Mogrify(ref,...)
             argument_list[0].string_reference=(char *) NULL;
           (void) SetImageProperty(image,"comment",InterpretImageProperties(
             info ? info->image_info : (ImageInfo *) NULL,image,
-            argument_list[0].string_reference));
+            argument_list[0].string_reference,exception),exception);
           break;
         }
         case 2:  /* Label */
@@ -7490,36 +7500,56 @@ Mogrify(ref,...)
             argument_list[0].string_reference=(char *) NULL;
           (void) SetImageProperty(image,"label",InterpretImageProperties(
             info ? info->image_info : (ImageInfo *) NULL,image,
-            argument_list[0].string_reference));
+            argument_list[0].string_reference,exception),exception);
           break;
         }
         case 3:  /* AddNoise */
         {
+          double
+            attenuate;
+
           if (attribute_flag[0] == 0)
             argument_list[0].integer_reference=UniformNoise;
+          attenuate=1.0;
           if (attribute_flag[1] != 0)
-            channel=(ChannelType) argument_list[1].integer_reference;
-          image=AddNoiseImageChannel(image,channel,(NoiseType)
-            argument_list[0].integer_reference,exception);
+            attenuate=argument_list[1].real_reference;
+          if (attribute_flag[2] != 0)
+            channel=(ChannelType) argument_list[2].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=AddNoiseImage(image,(NoiseType)
+            argument_list[0].integer_reference,attenuate,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 4:  /* Colorize */
         {
-          PixelPacket
+          PixelInfo
             target;
 
-          (void) GetOneVirtualPixel(image,0,0,&target,exception);
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
+          GetPixelInfo(image,&target);
+          (void) GetOneVirtualPixel(image,0,0,virtual_pixel,exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           if (attribute_flag[0] != 0)
-            (void) QueryColorDatabase(argument_list[0].string_reference,&target,
-              exception);
+            (void) QueryColorCompliance(argument_list[0].string_reference,
+              AllCompliance,&target,exception);
           if (attribute_flag[1] == 0)
             argument_list[1].string_reference="100%";
-          image=ColorizeImage(image,argument_list[1].string_reference,target,
+          image=ColorizeImage(image,argument_list[1].string_reference,&target,
             exception);
           break;
         }
         case 5:  /* Border */
         {
+          CompositeOperator
+            compose;
+
           geometry.width=0;
           geometry.height=0;
           if (attribute_flag[0] != 0)
@@ -7534,17 +7564,18 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry.height=argument_list[2].integer_reference;
           if (attribute_flag[3] != 0)
-            QueryColorDatabase(argument_list[3].string_reference,
-              &image->border_color,exception);
+            QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&image->border_color,exception);
           if (attribute_flag[4] != 0)
-            QueryColorDatabase(argument_list[4].string_reference,
-              &image->border_color,exception);
+            QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&image->border_color,exception);
           if (attribute_flag[5] != 0)
-            QueryColorDatabase(argument_list[5].string_reference,
-              &image->border_color,exception);
+            QueryColorCompliance(argument_list[5].string_reference,
+              AllCompliance,&image->border_color,exception);
+          compose=image->compose;
           if (attribute_flag[6] != 0)
-            image->compose=(CompositeOperator) argument_list[6].integer_reference;
-          image=BorderImage(image,&geometry,exception);
+            compose=(CompositeOperator) argument_list[6].integer_reference;
+          image=BorderImage(image,&geometry,compose,exception);
           break;
         }
         case 6:  /* Blur */
@@ -7561,9 +7592,14 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            channel=(ChannelType) argument_list[3].integer_reference;
-          image=BlurImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,exception);
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            channel=(ChannelType) argument_list[4].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=BlurImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 7:  /* Chop */
@@ -7598,8 +7634,8 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=
-              SiPrefixToDouble(argument_list[5].string_reference,QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           image=CropImage(image,&geometry,exception);
           break;
         }
@@ -7612,7 +7648,8 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             geometry_info.rho=argument_list[0].real_reference;
-          image=EdgeImage(image,geometry_info.rho,exception);
+          image=EdgeImage(image,geometry_info.rho,geometry_info.sigma,
+            exception);
           break;
         }
         case 11:  /* Emboss */
@@ -7649,6 +7686,9 @@ Mogrify(ref,...)
         }
         case 15:  /* Frame */
         {
+          CompositeOperator
+            compose;
+
           FrameInfo
             frame_info;
 
@@ -7672,31 +7712,35 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             frame_info.outer_bevel=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            QueryColorDatabase(argument_list[5].string_reference,&fill_color,
-              exception);
+            QueryColorCompliance(argument_list[5].string_reference,
+              AllCompliance,&fill_color,exception);
           if (attribute_flag[6] != 0)
-            QueryColorDatabase(argument_list[6].string_reference,&fill_color,
-              exception);
+            QueryColorCompliance(argument_list[6].string_reference,
+              AllCompliance,&fill_color,exception);
           frame_info.x=(ssize_t) frame_info.width;
           frame_info.y=(ssize_t) frame_info.height;
           frame_info.width=image->columns+2*frame_info.x;
           frame_info.height=image->rows+2*frame_info.y;
           if ((attribute_flag[5] != 0) || (attribute_flag[6] != 0))
             image->matte_color=fill_color;
+          compose=image->compose;
           if (attribute_flag[7] != 0)
-            image->compose=(CompositeOperator) argument_list[7].integer_reference;
-          image=FrameImage(image,&frame_info,exception);
+            compose=(CompositeOperator) argument_list[7].integer_reference;
+          image=FrameImage(image,&frame_info,compose,exception);
           break;
         }
         case 16:  /* Implode */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] == 0)
             argument_list[0].real_reference=0.5;
+          method=UndefinedInterpolatePixel;
           if (attribute_flag[1] != 0)
-            image->interpolate=(InterpolatePixelMethod)
-              argument_list[1].integer_reference;
+            method=(PixelInterpolateMethod) argument_list[1].integer_reference;
           image=ImplodeImage(image,argument_list[0].real_reference,
-            exception);
+            method,exception);
           break;
         }
         case 17:  /* Magnify */
@@ -7711,7 +7755,7 @@ Mogrify(ref,...)
               flags=ParseGeometry(argument_list[0].string_reference,
                 &geometry_info);
               if ((flags & SigmaValue) == 0)
-                geometry_info.sigma=1.0;
+                geometry_info.sigma=geometry_info.rho;
             }
           if (attribute_flag[1] != 0)
             geometry_info.rho=argument_list[1].real_reference;
@@ -7719,8 +7763,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          image=StatisticImageChannel(image,channel,MedianStatistic,
-            (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=StatisticImage(image,MedianStatistic,(size_t) geometry_info.rho,
+            (size_t) geometry_info.sigma,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 19:  /* Minify */
@@ -7732,8 +7779,10 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] == 0)
             argument_list[0].real_reference=0.0;
+          if (attribute_flag[1] == 0)
+            argument_list[1].real_reference=1.0;
           image=OilPaintImage(image,argument_list[0].real_reference,
-            exception);
+            argument_list[1].real_reference,exception);
           break;
         }
         case 21:  /* ReduceNoise */
@@ -7751,8 +7800,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          image=StatisticImageChannel(image,channel,NonpeakStatistic,
-            (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=StatisticImage(image,NonpeakStatistic,(size_t)
+            geometry_info.rho,(size_t) geometry_info.sigma,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 22:  /* Roll */
@@ -7772,14 +7824,14 @@ Mogrify(ref,...)
           if (attribute_flag[0] == 0)
             argument_list[0].real_reference=90.0;
           if (attribute_flag[1] != 0)
-            QueryColorDatabase(argument_list[1].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[1].string_reference,
+              AllCompliance,&image->background_color,exception);
           if (attribute_flag[2] != 0)
-            QueryColorDatabase(argument_list[2].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[2].string_reference,
+              AllCompliance,&image->background_color,exception);
           if (attribute_flag[3] != 0)
-            QueryColorDatabase(argument_list[3].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&image->background_color,exception);
           image=RotateImage(image,argument_list[0].real_reference,exception);
           break;
         }
@@ -7839,9 +7891,14 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            channel=(ChannelType) argument_list[3].integer_reference;
-          image=SharpenImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,exception);
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            channel=(ChannelType) argument_list[4].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=SharpenImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 28:  /* Shear */
@@ -7858,30 +7915,41 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            QueryColorDatabase(argument_list[3].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&image->background_color,exception);
           if (attribute_flag[4] != 0)
-            QueryColorDatabase(argument_list[4].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&image->background_color,exception);
           image=ShearImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
           break;
         }
         case 29:  /* Spread */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] == 0)
             argument_list[0].real_reference=1.0;
-          image=SpreadImage(image,argument_list[0].real_reference,exception);
+          method=UndefinedInterpolatePixel;
+          if (attribute_flag[1] != 0)
+            method=(PixelInterpolateMethod) argument_list[1].integer_reference;
+          image=SpreadImage(image,argument_list[0].real_reference,method,
+            exception);
           break;
         }
         case 30:  /* Swirl */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] == 0)
             argument_list[0].real_reference=50.0;
+          method=UndefinedInterpolatePixel;
           if (attribute_flag[1] != 0)
-            image->interpolate=(InterpolatePixelMethod)
-              argument_list[1].integer_reference;
-          image=SwirlImage(image,argument_list[0].real_reference,exception);
+            method=(PixelInterpolateMethod) argument_list[1].integer_reference;
+          image=SwirlImage(image,argument_list[0].real_reference,
+            method,exception);
           break;
         }
         case 31:  /* Resize */
@@ -7919,7 +7987,8 @@ Mogrify(ref,...)
                 *text;
 
               text=InterpretImageProperties(info ? info->image_info :
-                (ImageInfo *) NULL,image,argument_list[0].string_reference);
+                (ImageInfo *) NULL,image,argument_list[0].string_reference,
+                exception);
               (void) CloneString(&draw_info->text,text);
               text=DestroyString(text);
             }
@@ -7932,20 +8001,20 @@ Mogrify(ref,...)
             (void) CloneString(&draw_info->density,
               argument_list[3].string_reference);
           if (attribute_flag[4] != 0)
-            (void) QueryColorDatabase(argument_list[4].string_reference,
-              &draw_info->undercolor,exception);
+            (void) QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&draw_info->undercolor,exception);
           if (attribute_flag[5] != 0)
             {
-              (void) QueryColorDatabase(argument_list[5].string_reference,
-                &draw_info->stroke,exception);
+              (void) QueryColorCompliance(argument_list[5].string_reference,
+                AllCompliance,&draw_info->stroke,exception);
               if (argument_list[5].image_reference != (Image *) NULL)
                 draw_info->stroke_pattern=CloneImage(
                   argument_list[5].image_reference,0,0,MagickTrue,exception);
             }
           if (attribute_flag[6] != 0)
             {
-              (void) QueryColorDatabase(argument_list[6].string_reference,
-                &draw_info->fill,exception);
+              (void) QueryColorCompliance(argument_list[6].string_reference,
+                AllCompliance,&draw_info->fill,exception);
               if (argument_list[6].image_reference != (Image *) NULL)
                 draw_info->fill_pattern=CloneImage(
                   argument_list[6].image_reference,0,0,MagickTrue,exception);
@@ -7960,10 +8029,11 @@ Mogrify(ref,...)
                 geometry_info.sigma=geometry_info.xi;
             }
           if (attribute_flag[8] != 0)
-            (void) QueryColorDatabase(argument_list[8].string_reference,
-              &draw_info->fill,exception);
+            (void) QueryColorCompliance(argument_list[8].string_reference,
+              AllCompliance,&draw_info->fill,exception);
           if (attribute_flag[11] != 0)
-            draw_info->gravity=(GravityType) argument_list[11].integer_reference;
+            draw_info->gravity=(GravityType)
+              argument_list[11].integer_reference;
           if (attribute_flag[25] != 0)
             {
               AV
@@ -8120,7 +8190,7 @@ Mogrify(ref,...)
           if (attribute_flag[32] != 0)
             draw_info->direction=(DirectionType)
               argument_list[32].integer_reference;
-          (void) AnnotateImage(image,draw_info);
+          (void) AnnotateImage(image,draw_info,exception);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -8135,6 +8205,9 @@ Mogrify(ref,...)
           PixelInfo
             target;
 
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
           draw_info=CloneDrawInfo(info ? info->image_info :
             (ImageInfo *) NULL,(DrawInfo *) NULL);
           if (attribute_flag[0] != 0)
@@ -8145,24 +8218,28 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry.y=argument_list[2].integer_reference;
           if (attribute_flag[3] != 0)
-            (void) QueryColorDatabase(argument_list[3].string_reference,
-              &draw_info->fill,exception);
-          (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
+            (void) QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&draw_info->fill,exception);
+          (void) GetOneVirtualPixel(image,geometry.x,geometry.y,virtual_pixel,
             exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           invert=MagickFalse;
           if (attribute_flag[4] != 0)
             {
-              QueryMagickColor(argument_list[4].string_reference,&target,
-                exception);
+              QueryColorCompliance(argument_list[4].string_reference,
+                AllCompliance,&target,exception);
               invert=MagickTrue;
             }
           if (attribute_flag[5] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             invert=(MagickBooleanType) argument_list[6].integer_reference;
-          (void) FloodfillPaintImage(image,DefaultChannels,draw_info,&target,
-            geometry.x,geometry.y,invert);
+          (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
+            geometry.y,invert,exception);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -8192,9 +8269,9 @@ Mogrify(ref,...)
           if (attribute_flag[6] != 0) /* opacity  */
             {
               if (compose != DissolveCompositeOp)
-                (void) SetImageOpacity(composite_image,(Quantum)
-                  SiPrefixToDouble(argument_list[6].string_reference,
-                  QuantumRange));
+                (void) SetImageAlpha(composite_image,(Quantum)
+                  StringToDoubleInterval(argument_list[6].string_reference,
+                  (double) QuantumRange+1.0),exception);
               else
                 {
                   CacheView
@@ -8221,10 +8298,11 @@ Mogrify(ref,...)
                   */
                   (void) CloneString(&image->geometry,
                     argument_list[6].string_reference);
-                  opacity=(Quantum) SiPrefixToDouble(
-                    argument_list[6].string_reference,QuantumRange);
+                  opacity=(Quantum) StringToDoubleInterval(
+                    argument_list[6].string_reference,(double) QuantumRange+
+                    1.0);
                   if (composite_image->matte != MagickTrue)
-                    (void) SetImageOpacity(composite_image,OpaqueAlpha);
+                    (void) SetImageAlpha(composite_image,OpaqueAlpha,exception);
                   composite_view=AcquireCacheView(composite_image);
                   for (y=0; y < (ssize_t) composite_image->rows ; y++)
                   {
@@ -8233,7 +8311,8 @@ Mogrify(ref,...)
                     for (x=0; x < (ssize_t) composite_image->columns; x++)
                     {
                       if (GetPixelAlpha(image,q) == OpaqueAlpha)
-                        SetPixelAlpha(composite_image,ClampToQuantum(opacity),q);
+                        SetPixelAlpha(composite_image,ClampToQuantum(opacity),
+                          q);
                       q+=GetPixelChannels(composite_image);
                     }
                     sync=SyncCacheViewAuthenticPixels(composite_view,exception);
@@ -8244,10 +8323,10 @@ Mogrify(ref,...)
                 }
             }
           if (attribute_flag[9] != 0)    /* "color=>" */
-            QueryColorDatabase(argument_list[9].string_reference,
-              &composite_image->background_color,exception);
+            QueryColorCompliance(argument_list[9].string_reference,
+              AllCompliance,&composite_image->background_color,exception);
           if (attribute_flag[12] != 0) /* "interpolate=>" */
-            image->interpolate=(InterpolatePixelMethod)
+            image->interpolate=(PixelInterpolateMethod)
               argument_list[12].integer_reference;
           if (attribute_flag[13] != 0)   /* "args=>" */
             (void) SetImageArtifact(composite_image,"compose:args",
@@ -8269,7 +8348,8 @@ Mogrify(ref,...)
                if (rotate_image == (Image *) NULL)
                  break;
             }
-          if (attribute_flag[7] && argument_list[7].integer_reference) /* tile */
+          if ((attribute_flag[7] != 0) &&
+              (argument_list[7].integer_reference != 0)) /* tile */
             {
               ssize_t
                 x,
@@ -8288,9 +8368,11 @@ Mogrify(ref,...)
                 for (x=0; x < (ssize_t) image->columns; x+=(ssize_t) composite_image->columns)
                 {
                   if (attribute_flag[8] != 0) /* rotate */
-                    (void) CompositeImage(image,compose,rotate_image,x,y);
+                    (void) CompositeImage(image,compose,rotate_image,x,y,
+                      exception);
                   else
-                    (void) CompositeImage(image,compose,composite_image,x,y);
+                    (void) CompositeImage(image,compose,composite_image,x,y,
+                      exception);
                 }
               if (attribute_flag[8] != 0) /* rotate */
                 rotate_image=DestroyImage(rotate_image);
@@ -8322,9 +8404,9 @@ Mogrify(ref,...)
                     Merge Y displacement into X displacement image.
                   */
                   composite_image=CloneImage(composite_image,0,0,MagickTrue,
-                    &image->exception);
+                    exception);
                   (void) CompositeImage(composite_image,CopyGreenCompositeOp,
-                    argument_list[10].image_reference,0,0);
+                    argument_list[10].image_reference,0,0,exception);
                 }
               else
                 {
@@ -8332,8 +8414,8 @@ Mogrify(ref,...)
                     Set a blending mask for the composition.
                   */
                   image->mask=CloneImage(argument_list[10].image_reference,0,0,
-                    MagickTrue,&image->exception);
-                  (void) NegateImage(image->mask,MagickFalse);
+                    MagickTrue,exception);
+                  (void) NegateImage(image->mask,MagickFalse,exception);
                 }
             }
           if (attribute_flag[11] != 0) /* channel */
@@ -8347,9 +8429,10 @@ Mogrify(ref,...)
             geometry.y);
           flags=ParseGravityGeometry(image,composite_geometry,&geometry,
             exception);
+          channel_mask=SetPixelChannelMask(image,channel);
           if (attribute_flag[8] == 0) /* no rotate */
-            CompositeImageChannel(image,channel,compose,composite_image,
-              geometry.x,geometry.y);
+            CompositeImage(image,compose,composite_image,geometry.x,geometry.y,
+              exception);
           else
             {
               /*
@@ -8359,8 +8442,8 @@ Mogrify(ref,...)
                 composite_image->columns)/2;
               geometry.y-=(ssize_t) (rotate_image->rows-
                 composite_image->rows)/2;
-              CompositeImageChannel(image,channel,compose,rotate_image,
-                geometry.x,geometry.y);
+              CompositeImage(image,compose,rotate_image,geometry.x,geometry.y,
+                exception);
               rotate_image=DestroyImage(rotate_image);
             }
           if (attribute_flag[10] != 0) /* mask */
@@ -8371,6 +8454,7 @@ Mogrify(ref,...)
               else
                 image->mask=DestroyImage(image->mask);
             }
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 36:  /* Contrast */
@@ -8378,14 +8462,15 @@ Mogrify(ref,...)
           if (attribute_flag[0] == 0)
             argument_list[0].integer_reference=0;
           (void) ContrastImage(image,argument_list[0].integer_reference != 0 ?
-            MagickTrue : MagickFalse);
+            MagickTrue : MagickFalse,exception);
           break;
         }
         case 37:  /* CycleColormap */
         {
           if (attribute_flag[0] == 0)
             argument_list[0].integer_reference=6;
-          (void) CycleColormapImage(image,argument_list[0].integer_reference);
+          (void) CycleColormapImage(image,argument_list[0].integer_reference,
+            exception);
           break;
         }
         case 38:  /* Draw */
@@ -8430,16 +8515,16 @@ Mogrify(ref,...)
             }
           if (attribute_flag[3] != 0)
             {
-              (void) QueryColorDatabase(argument_list[3].string_reference,
-                &draw_info->stroke,exception);
+              (void) QueryColorCompliance(argument_list[3].string_reference,
+                AllCompliance,&draw_info->stroke,exception);
               if (argument_list[3].image_reference != (Image *) NULL)
                 draw_info->stroke_pattern=CloneImage(
                   argument_list[3].image_reference,0,0,MagickTrue,exception);
             }
           if (attribute_flag[4] != 0)
             {
-              (void) QueryColorDatabase(argument_list[4].string_reference,
-                &draw_info->fill,exception);
+              (void) QueryColorCompliance(argument_list[4].string_reference,
+                AllCompliance,&draw_info->fill,exception);
               if (argument_list[4].image_reference != (Image *) NULL)
                 draw_info->fill_pattern=CloneImage(
                   argument_list[4].image_reference,0,0,MagickTrue,exception);
@@ -8450,8 +8535,8 @@ Mogrify(ref,...)
             (void) CloneString(&draw_info->font,
               argument_list[6].string_reference);
           if (attribute_flag[7] != 0)
-            (void) QueryColorDatabase(argument_list[7].string_reference,
-              &draw_info->border_color,exception);
+            (void) QueryColorCompliance(argument_list[7].string_reference,
+              AllCompliance,&draw_info->border_color,exception);
           if (attribute_flag[8] != 0)
             draw_info->affine.tx=argument_list[8].real_reference;
           if (attribute_flag[9] != 0)
@@ -8593,7 +8678,7 @@ Mogrify(ref,...)
                 }
             }
           if (attribute_flag[23] != 0)
-            image->interpolate=(InterpolatePixelMethod)
+            image->interpolate=(PixelInterpolateMethod)
               argument_list[23].integer_reference;
           if ((attribute_flag[24] != 0) &&
               (draw_info->fill_pattern != (Image *) NULL))
@@ -8625,7 +8710,7 @@ Mogrify(ref,...)
           if (attribute_flag[32] != 0)
             draw_info->direction=(DirectionType)
               argument_list[32].integer_reference;
-          DrawImage(image,draw_info);
+          DrawImage(image,draw_info,exception);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -8633,7 +8718,9 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          EqualizeImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          EqualizeImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 40:  /* Gamma */
@@ -8654,11 +8741,8 @@ Mogrify(ref,...)
                 (double) argument_list[4].real_reference);
               argument_list[0].string_reference=message;
             }
-          if (strchr(argument_list[0].string_reference,',') != (char *) NULL)
-            (void) GammaImage(image,argument_list[0].string_reference);
-          else
-            (void) GammaImageChannel(image,channel,InterpretLocaleValue(
-              argument_list[0].string_reference,(char **) NULL));
+          (void) GammaImage(image,StringToDouble(
+            argument_list[0].string_reference,(char **) NULL),exception);
           break;
         }
         case 41:  /* Map */
@@ -8680,7 +8764,7 @@ Mogrify(ref,...)
             quantize_info->dither_method=(DitherMethod)
               argument_list[2].integer_reference;
           (void) RemapImages(quantize_info,image,
-            argument_list[0].image_reference);
+            argument_list[0].image_reference,exception);
           quantize_info=DestroyQuantizeInfo(quantize_info);
           break;
         }
@@ -8695,9 +8779,11 @@ Mogrify(ref,...)
           PixelInfo
             target;
 
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
           draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
             (DrawInfo *) NULL);
-          if (attribute_flag[0] != 0)
           if (attribute_flag[0] != 0)
             flags=ParsePageGeometry(image,argument_list[0].string_reference,
               &geometry,exception);
@@ -8706,23 +8792,30 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry.y=argument_list[2].integer_reference;
           if (image->matte == MagickFalse)
-            (void) SetImageOpacity(image,OpaqueAlpha);
-          (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
+            (void) SetImageAlpha(image,OpaqueAlpha,exception);
+          (void) GetOneVirtualPixel(image,geometry.x,geometry.y,virtual_pixel,
             exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           if (attribute_flag[4] != 0)
-            QueryMagickColor(argument_list[4].string_reference,&target,
-              exception);
+            QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&target,exception);
           if (attribute_flag[3] != 0)
-            target.alpha=SiPrefixToDouble(argument_list[3].string_reference,
-              QuantumRange);
+            target.alpha=StringToDoubleInterval(
+              argument_list[3].string_reference,(double) (double) QuantumRange+
+              1.0);
           if (attribute_flag[5] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           invert=MagickFalse;
           if (attribute_flag[6] != 0)
             invert=(MagickBooleanType) argument_list[6].integer_reference;
-          (void) FloodfillPaintImage(image,AlphaChannel,draw_info,&target,
-            geometry.x,geometry.y,invert);
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
+          (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
+            geometry.y,invert,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -8763,7 +8856,7 @@ Mogrify(ref,...)
             }
           (void) FormatLocaleString(modulate,MaxTextExtent,"%.15g,%.15g,%.15g",
             geometry_info.rho,geometry_info.sigma,geometry_info.xi);
-          (void) ModulateImage(image,modulate);
+          (void) ModulateImage(image,modulate,exception);
           break;
         }
         case 44:  /* Negate */
@@ -8772,15 +8865,19 @@ Mogrify(ref,...)
             argument_list[0].integer_reference=0;
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          (void) NegateImageChannel(image,channel,
-            argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) NegateImage(image,argument_list[0].integer_reference != 0 ?
+            MagickTrue : MagickFalse,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 45:  /* Normalize */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          NormalizeImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          NormalizeImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 46:  /* NumberColors */
@@ -8794,24 +8891,27 @@ Mogrify(ref,...)
             fill_color,
             target;
 
-          (void) QueryMagickColor("none",&target,exception);
-          (void) QueryMagickColor("none",&fill_color,exception);
+          (void) QueryColorCompliance("none",AllCompliance,&target,
+             exception);
+          (void) QueryColorCompliance("none",AllCompliance,&fill_color,
+            exception);
           if (attribute_flag[0] != 0)
-            (void) QueryMagickColor(argument_list[0].string_reference,
-              &target,exception);
+            (void) QueryColorCompliance(argument_list[0].string_reference,
+              AllCompliance,&target,exception);
           if (attribute_flag[1] != 0)
-            (void) QueryMagickColor(argument_list[1].string_reference,
-              &fill_color,exception);
+            (void) QueryColorCompliance(argument_list[1].string_reference,
+              AllCompliance,&fill_color,exception);
           if (attribute_flag[2] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[2].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
           invert=MagickFalse;
           if (attribute_flag[4] != 0)
             invert=(MagickBooleanType) argument_list[4].integer_reference;
-          (void) OpaquePaintImageChannel(image,channel,&target,&fill_color,
-            invert);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) OpaquePaintImage(image,&target,&fill_color,invert,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 48:  /* Quantize */
@@ -8834,13 +8934,14 @@ Mogrify(ref,...)
               MagickTrue : MagickFalse;
           if (attribute_flag[4] != 0)
             quantize_info->measure_error=
-              argument_list[4].integer_reference != 0 ? MagickTrue : MagickFalse;
+              argument_list[4].integer_reference != 0 ? MagickTrue :
+              MagickFalse;
           if (attribute_flag[5] != 0)
-            (void) QueryColorDatabase(argument_list[5].string_reference,
-              &image->transparent_color,exception);
+            (void) QueryColorCompliance(argument_list[5].string_reference,
+              AllCompliance,&image->transparent_color,exception);
           if (attribute_flag[5] && argument_list[5].integer_reference)
             {
-              (void) QuantizeImages(quantize_info,image);
+              (void) QuantizeImages(quantize_info,image,exception);
               goto PerlException;
             }
           if (attribute_flag[6] != 0)
@@ -8849,9 +8950,9 @@ Mogrify(ref,...)
           if ((image->storage_class == DirectClass) ||
               (image->colors > quantize_info->number_colors) ||
               (quantize_info->colorspace == GRAYColorspace))
-            (void) QuantizeImage(quantize_info,image);
+            (void) QuantizeImage(quantize_info,image,exception);
           else
-            CompressImageColormap(image);
+            CompressImageColormap(image,exception);
           quantize_info=DestroyQuantizeInfo(quantize_info);
           break;
         }
@@ -8866,8 +8967,9 @@ Mogrify(ref,...)
             geometry.height=argument_list[2].integer_reference;
           if (attribute_flag[3] == 0)
             argument_list[3].integer_reference=1;
-          (void) RaiseImage(image,&geometry,argument_list[3].integer_reference !=
-            0 ? MagickTrue : MagickFalse);
+          (void) RaiseImage(image,&geometry,
+            argument_list[3].integer_reference != 0 ? MagickTrue : MagickFalse,
+            exception);
           break;
         }
         case 50:  /* Segment */
@@ -8904,12 +9006,12 @@ Mogrify(ref,...)
             verbose=argument_list[4].integer_reference != 0 ?
               MagickTrue : MagickFalse;
           (void) SegmentImage(image,colorspace,verbose,cluster_threshold,
-            smoothing_threshold);
+            smoothing_threshold,exception);
           break;
         }
         case 51:  /* Signature */
         {
-          (void) SignatureImage(image);
+          (void) SignatureImage(image,exception);
           break;
         }
         case 52:  /* Solarize */
@@ -8919,21 +9021,21 @@ Mogrify(ref,...)
             flags=ParseGeometry(argument_list[0].string_reference,
               &geometry_info);
           if (attribute_flag[1] != 0)
-            geometry_info.rho=SiPrefixToDouble(argument_list[1].string_reference,
-             QuantumRange);
-          (void) SolarizeImage(image,geometry_info.rho);
+            geometry_info.rho=StringToDoubleInterval(
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
+          (void) SolarizeImage(image,geometry_info.rho,exception);
           break;
         }
         case 53:  /* Sync */
         {
-          (void) SyncImage(image);
+          (void) SyncImage(image,exception);
           break;
         }
         case 54:  /* Texture */
         {
           if (attribute_flag[0] == 0)
             break;
-          TextureImage(image,argument_list[0].image_reference);
+          TextureImage(image,argument_list[0].image_reference,exception);
           break;
         }
         case 55:  /* Evalute */
@@ -8948,8 +9050,10 @@ Mogrify(ref,...)
             op=(MagickEvaluateOperator) argument_list[1].integer_reference;
           if (attribute_flag[2] != MagickFalse)
             channel=(ChannelType) argument_list[2].integer_reference;
-          (void) EvaluateImageChannel(image,channel,op,
-            argument_list[0].real_reference,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) EvaluateImage(image,op,argument_list[0].real_reference,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 56:  /* Transparent */
@@ -8963,24 +9067,25 @@ Mogrify(ref,...)
           PixelInfo
             target;
 
-          (void) QueryMagickColor("none",&target,exception);
+          (void) QueryColorCompliance("none",AllCompliance,&target,
+            exception);
           if (attribute_flag[0] != 0)
-            (void) QueryMagickColor(argument_list[0].string_reference,&target,
-              exception);
+            (void) QueryColorCompliance(argument_list[0].string_reference,
+              AllCompliance,&target,exception);
           opacity=TransparentAlpha;
           if (attribute_flag[1] != 0)
-            opacity=SiPrefixToDouble(argument_list[1].string_reference,
-              QuantumRange);
+            opacity=StringToDoubleInterval(argument_list[1].string_reference,
+              (double) QuantumRange+1.0);
           if (attribute_flag[2] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[2].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[3] == 0)
             argument_list[3].integer_reference=0;
           invert=MagickFalse;
           if (attribute_flag[3] != 0)
             invert=(MagickBooleanType) argument_list[3].integer_reference;
           (void) TransparentPaintImage(image,&target,ClampToQuantum(opacity),
-            invert);
+            invert,exception);
           break;
         }
         case 57:  /* Threshold */
@@ -8992,9 +9097,11 @@ Mogrify(ref,...)
             argument_list[0].string_reference="50%";
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          threshold=SiPrefixToDouble(argument_list[0].string_reference,
-            QuantumRange);
-          (void) BilevelImageChannel(image,channel,threshold);
+          threshold=StringToDoubleInterval(argument_list[0].string_reference,
+            (double) QuantumRange+1.0);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) BilevelImage(image,threshold,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 58:  /* Charcoal */
@@ -9010,20 +9117,25 @@ Mogrify(ref,...)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
+          if (attribute_flag[3] != 0)
+            geometry_info.xi=argument_list[3].real_reference;
           image=CharcoalImage(image,geometry_info.rho,geometry_info.sigma,
-            exception);
+            geometry_info.xi,exception);
           break;
         }
         case 59:  /* Trim */
         {
           if (attribute_flag[0] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[0].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[0].string_reference,(double) QuantumRange+1.0);
           image=TrimImage(image,exception);
           break;
         }
         case 60:  /* Wave */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] != 0)
             {
               flags=ParseGeometry(argument_list[0].string_reference,
@@ -9035,18 +9147,20 @@ Mogrify(ref,...)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
+          method=UndefinedInterpolatePixel;
           if (attribute_flag[3] != 0)
-            image->interpolate=(InterpolatePixelMethod)
-              argument_list[3].integer_reference;
+            method=(PixelInterpolateMethod) argument_list[3].integer_reference;
           image=WaveImage(image,geometry_info.rho,geometry_info.sigma,
-            exception);
+            method,exception);
           break;
         }
         case 61:  /* Separate */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          (void) SeparateImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) SeparateImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 63:  /* Stereo */
@@ -9081,7 +9195,7 @@ Mogrify(ref,...)
         }
         case 65:  /* Deconstruct */
         {
-          image=CompareImageLayers(image,CompareAnyLayer,exception);
+          image=CompareImagesLayers(image,CompareAnyLayer,exception);
           break;
         }
         case 66:  /* GaussianBlur */
@@ -9098,44 +9212,70 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            channel=(ChannelType) argument_list[3].integer_reference;
-          image=GaussianBlurImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,exception);
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            channel=(ChannelType) argument_list[4].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=GaussianBlurImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 67:  /* Convolve */
         {
-          AV
-            *av;
-
-          double
+          KernelInfo
             *kernel;
 
-          size_t
-            order;
-
-          if (attribute_flag[0] == 0)
+          kernel=(KernelInfo *) NULL;
+          if ((attribute_flag[0] == 0) && (attribute_flag[3] == 0))
             break;
+          if (attribute_flag[0] != 0)
+            {
+              AV
+                *av;
+
+              size_t
+                order;
+
+              kernel=AcquireKernelInfo((const char *) NULL);
+              if (kernel == (KernelInfo *) NULL)
+                break;
+              av=(AV *) argument_list[0].array_reference;
+              order=(size_t) sqrt(av_len(av)+1);
+              kernel->width=order;
+              kernel->height=order;
+              kernel->values=(double *) AcquireAlignedMemory(order,order*
+                sizeof(*kernel->values));
+              if (kernel->values == (double *) NULL)
+                {
+                  kernel=DestroyKernelInfo(kernel);
+                  ThrowPerlException(exception,ResourceLimitFatalError,
+                    "MemoryAllocationFailed",PackageName);
+                  goto PerlException;
+                }
+              for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
+                kernel->values[j]=(double) SvNV(*(av_fetch(av,j,0)));
+              for ( ; j < (ssize_t) (order*order); j++)
+                kernel->values[j]=0.0;
+            }
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
           if (attribute_flag[2] != 0)
-            image->bias=SiPrefixToDouble(argument_list[2].string_reference,
-              QuantumRange);
-          av=(AV *) argument_list[0].array_reference;
-          order=(size_t) sqrt(av_len(av)+1);
-          kernel=(double *) AcquireQuantumMemory(order,order*sizeof(*kernel));
-          if (kernel == (double *) NULL)
+            image->bias=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
+          if (attribute_flag[3] != 0)
             {
-              ThrowPerlException(exception,ResourceLimitFatalError,
-                "MemoryAllocationFailed",PackageName);
-              goto PerlException;
+              kernel=AcquireKernelInfo(argument_list[3].string_reference);
+              if (kernel == (KernelInfo *) NULL)
+                break;
             }
-          for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
-            kernel[j]=(double) SvNV(*(av_fetch(av,j,0)));
-          for ( ; j < (ssize_t) (order*order); j++)
-            kernel[j]=0.0;
-          image=ConvolveImageChannel(image,channel,order,kernel,exception);
-          kernel=(double *) RelinquishMagickMemory(kernel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          kernel->bias=image->bias;
+          image=ConvolveImage(image,kernel,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
+          kernel=DestroyKernelInfo(kernel);
           break;
         }
         case 68:  /* Profile */
@@ -9169,7 +9309,7 @@ Mogrify(ref,...)
                     Remove a profile from the image.
                   */
                   (void) ProfileImage(image,name,(const unsigned char *) NULL,0,
-                    MagickTrue);
+                    exception);
                   break;
                 }
               /*
@@ -9179,7 +9319,7 @@ Mogrify(ref,...)
               SetStringInfoDatum(profile,(const unsigned char *)
                 argument_list[1].string_reference);
               (void) ProfileImage(image,name,GetStringInfoDatum(profile),
-                (size_t) GetStringInfoLength(profile),MagickFalse);
+                (size_t) GetStringInfoLength(profile),exception);
               profile=DestroyStringInfo(profile);
               break;
             }
@@ -9189,7 +9329,7 @@ Mogrify(ref,...)
           profile_info=
             CloneImageInfo(info ? info->image_info : (ImageInfo *) NULL);
           (void) CopyMagickString(profile_info->filename,name,MaxTextExtent);
-          profile_image=ReadImages(profile_info,&image->exception);
+          profile_image=ReadImages(profile_info,exception);
           if (profile_image == (Image *) NULL)
             break;
           ResetImageProfileIterator(profile_image);
@@ -9202,7 +9342,7 @@ Mogrify(ref,...)
             profile=GetImageProfile(profile_image,name);
             if (profile != (const StringInfo *) NULL)
               (void) ProfileImage(image,name,GetStringInfoDatum(profile),
-                (size_t) GetStringInfoLength(profile),MagickFalse);
+                (size_t) GetStringInfoLength(profile),exception);
             name=GetNextImageProfile(profile_image);
           }
           profile_image=DestroyImage(profile_image);
@@ -9232,8 +9372,11 @@ Mogrify(ref,...)
             geometry_info.psi=argument_list[4].real_reference;
           if (attribute_flag[5] != 0)
             channel=(ChannelType) argument_list[5].integer_reference;
-          image=UnsharpMaskImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=UnsharpMaskImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,geometry_info.psi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 70:  /* MotionBlur */
@@ -9254,9 +9397,14 @@ Mogrify(ref,...)
           if (attribute_flag[3] != 0)
             geometry_info.xi=argument_list[3].real_reference;
           if (attribute_flag[4] != 0)
-            channel=(ChannelType) argument_list[4].integer_reference;
-          image=MotionBlurImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,geometry_info.xi,exception);
+            geometry_info.psi=argument_list[4].real_reference;
+          if (attribute_flag[5] != 0)
+            channel=(ChannelType) argument_list[5].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=MotionBlurImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,geometry_info.psi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 71:  /* OrderedDither */
@@ -9265,8 +9413,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="o8x8";
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          (void) OrderedPosterizeImageChannel(image,channel,
-            argument_list[0].string_reference,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) OrderedPosterizeImage(image,argument_list[0].string_reference,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 72:  /* Shave */
@@ -9321,7 +9471,9 @@ Mogrify(ref,...)
               argument_list[0].real_reference=argument_list[5].real_reference;
               attribute_flag[0]=attribute_flag[5];
             }
-          (void) LevelImageChannel(image,channel,black_point,white_point,gamma);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) LevelImage(image,black_point,white_point,gamma,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 74:  /* Clip */
@@ -9331,7 +9483,8 @@ Mogrify(ref,...)
           if (attribute_flag[1] == 0)
             argument_list[1].integer_reference=MagickTrue;
           (void) ClipImagePath(image,argument_list[0].string_reference,
-            argument_list[1].integer_reference != 0 ? MagickTrue : MagickFalse);
+            argument_list[1].integer_reference != 0 ? MagickTrue : MagickFalse,
+            exception);
           break;
         }
         case 75:  /* AffineTransform */
@@ -9444,11 +9597,11 @@ Mogrify(ref,...)
               current.rx*affine.tx+current.sy*affine.ty+current.ty;
           }
           if (attribute_flag[6] != 0)
-            image->interpolate=(InterpolatePixelMethod)
+            image->interpolate=(PixelInterpolateMethod)
               argument_list[6].integer_reference;
           if (attribute_flag[7] != 0)
-            QueryColorDatabase(argument_list[7].string_reference,
-              &image->background_color,exception);
+            QueryColorCompliance(argument_list[7].string_reference,
+              AllCompliance,&image->background_color,exception);
           image=AffineTransformImage(image,&draw_info->affine,exception);
           draw_info=DestroyDrawInfo(draw_info);
           break;
@@ -9462,9 +9615,10 @@ Mogrify(ref,...)
               goto PerlException;
             }
           if (attribute_flag[1] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[1].string_reference,
-              QuantumRange);
-          (void) IsImagesEqual(image,argument_list[0].image_reference);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
+          (void) IsImagesEqual(image,argument_list[0].image_reference,
+            exception);
           break;
         }
         case 77:  /* AdaptiveThreshold */
@@ -9483,8 +9637,7 @@ Mogrify(ref,...)
           if (attribute_flag[3] != 0)
             geometry_info.xi=argument_list[3].integer_reference;;
           image=AdaptiveThresholdImage(image,(size_t) geometry_info.rho,
-            (size_t) geometry_info.sigma,(ssize_t) geometry_info.xi,
-            exception);
+            (size_t) geometry_info.sigma,(double) geometry_info.xi,exception);
           break;
         }
         case 78:  /* Resample */
@@ -9512,16 +9665,16 @@ Mogrify(ref,...)
           if (attribute_flag[5] != 0)
             argument_list[5].real_reference=1.0;
           width=(size_t) (geometry_info.rho*image->columns/
-            (image->x_resolution == 0.0 ? 72.0 : image->x_resolution)+0.5);
+            (image->resolution.x == 0.0 ? 72.0 : image->resolution.x)+0.5);
           height=(size_t) (geometry_info.sigma*image->rows/
-            (image->y_resolution == 0.0 ? 72.0 : image->y_resolution)+0.5);
+            (image->resolution.y == 0.0 ? 72.0 : image->resolution.y)+0.5);
           image=ResizeImage(image,width,height,(FilterTypes)
             argument_list[3].integer_reference,argument_list[5].real_reference,
             exception);
           if (image != (Image *) NULL)
             {
-              image->x_resolution=geometry_info.rho;
-              image->y_resolution=geometry_info.sigma;
+              image->resolution.x=geometry_info.rho;
+              image->resolution.y=geometry_info.sigma;
             }
           break;
         }
@@ -9533,7 +9686,7 @@ Mogrify(ref,...)
             (void) SetImageArtifact(image,"identify:features",
               argument_list[1].string_reference);
           (void) IdentifyImage(image,argument_list[0].file_reference,
-            MagickTrue);
+            MagickTrue,exception);
           break;
         }
         case 80:  /* BlackThreshold */
@@ -9542,8 +9695,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="50%";
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
-          BlackThresholdImageChannel(image,channel,
-            argument_list[0].string_reference,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          BlackThresholdImage(image,argument_list[0].string_reference,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 81:  /* WhiteThreshold */
@@ -9552,8 +9707,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="50%";
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
-          WhiteThresholdImageChannel(image,channel,
-            argument_list[0].string_reference,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          WhiteThresholdImage(image,argument_list[0].string_reference,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 82:  /* RadialBlur */
@@ -9562,15 +9719,18 @@ Mogrify(ref,...)
             {
               flags=ParseGeometry(argument_list[0].string_reference,
                 &geometry_info);
-              if ((flags & SigmaValue) == 0)
-                geometry_info.sigma=1.0;
             }
           if (attribute_flag[1] != 0)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
-            channel=(ChannelType) argument_list[2].integer_reference;
-          image=RadialBlurImageChannel(image,channel,geometry_info.rho,
+            geometry_info.sigma=argument_list[2].real_reference;
+          if (attribute_flag[3] != 0)
+            channel=(ChannelType) argument_list[3].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=RadialBlurImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 83:  /* Thumbnail */
@@ -9587,21 +9747,21 @@ Mogrify(ref,...)
         }
         case 84:  /* Strip */
         {
-          (void) StripImage(image);
+          (void) StripImage(image,exception);
           break;
         }
         case 85:  /* Tint */
         {
-          PixelPacket
-            target;
+          PixelInfo
+            tint;
 
-          (void) GetOneVirtualPixel(image,0,0,&target,exception);
+          GetPixelInfo(image,&tint);
           if (attribute_flag[0] != 0)
-            (void) QueryColorDatabase(argument_list[0].string_reference,&target,
-              exception);
+            (void) QueryColorCompliance(argument_list[0].string_reference,
+              AllCompliance,&tint,exception);
           if (attribute_flag[1] == 0)
             argument_list[1].string_reference="100";
-          image=TintImage(image,argument_list[1].string_reference,target,
+          image=TintImage(image,argument_list[1].string_reference,&tint,
             exception);
           break;
         }
@@ -9609,7 +9769,9 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          (void) SeparateImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) SeparateImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 87:  /* Splice */
@@ -9626,11 +9788,11 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
-            (void) QueryColorDatabase(argument_list[6].string_reference,
-              &image->background_color,exception);
+            (void) QueryColorCompliance(argument_list[6].string_reference,
+              AllCompliance,&image->background_color,exception);
           if (attribute_flag[7] != 0)
             image->gravity=(GravityType) argument_list[7].integer_reference;
           image=SpliceImage(image,&geometry,exception);
@@ -9643,7 +9805,8 @@ Mogrify(ref,...)
           if (attribute_flag[1] == 0)
             argument_list[1].integer_reference=0;
           (void) PosterizeImage(image,argument_list[0].integer_reference,
-            argument_list[1].integer_reference ? MagickTrue : MagickFalse);
+            argument_list[1].integer_reference ? MagickTrue : MagickFalse,
+            exception);
           break;
         }
         case 89:  /* Shadow */
@@ -9667,9 +9830,9 @@ Mogrify(ref,...)
             geometry_info.xi=argument_list[3].integer_reference;
           if (attribute_flag[4] != 0)
             geometry_info.psi=argument_list[4].integer_reference;
-          image=ShadowImage(image,geometry_info.rho,geometry_info.sigma,
-            (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-
-            0.5),exception);
+          image=ShadowImage(image,geometry_info.rho,geometry_info.sigma,0.0,
+            (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t)
+            ceil(geometry_info.psi-0.5),exception);
           break;
         }
         case 90:  /* Identify */
@@ -9683,7 +9846,7 @@ Mogrify(ref,...)
               (argument_list[2].integer_reference != 0))
             (void) SetImageArtifact(image,"identify:unique","true");
           (void) IdentifyImage(image,argument_list[0].file_reference,
-            MagickTrue);
+            MagickTrue,exception);
           break;
         }
         case 91:  /* SepiaTone */
@@ -9718,8 +9881,10 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             sharpen=argument_list[4].integer_reference != 0 ? MagickTrue :
               MagickFalse;
-          (void) SigmoidalContrastImageChannel(image,channel,sharpen,
-            geometry_info.rho,geometry_info.sigma);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) SigmoidalContrastImage(image,sharpen,geometry_info.rho,
+            geometry_info.sigma,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 93:  /* Extent */
@@ -9748,11 +9913,11 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
-            (void) QueryColorDatabase(argument_list[6].string_reference,
-              &image->background_color,exception);
+            (void) QueryColorCompliance(argument_list[6].string_reference,
+              AllCompliance,&image->background_color,exception);
           image=ExtentImage(image,&geometry,exception);
           break;
         }
@@ -9778,11 +9943,11 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry_info.psi=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            (void) QueryColorDatabase(argument_list[5].string_reference,
-              &image->background_color,exception);
-          image=VignetteImage(image,geometry_info.rho,geometry_info.sigma,
-            (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-
-            0.5),exception);
+            (void) QueryColorCompliance(argument_list[5].string_reference,
+              AllCompliance,&image->background_color,exception);
+          image=VignetteImage(image,geometry_info.rho,geometry_info.sigma,0.0,
+            (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t)
+            ceil(geometry_info.psi-0.5),exception);
           break;
         }
         case 95:  /* ContrastStretch */
@@ -9814,8 +9979,9 @@ Mogrify(ref,...)
             white_point=argument_list[2].real_reference;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          (void) ContrastStretchImageChannel(image,channel,black_point,
-            white_point);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) ContrastStretchImage(image,black_point,white_point,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 96:  /* Sans0 */
@@ -9834,15 +10000,22 @@ Mogrify(ref,...)
                 &geometry_info);
               if ((flags & SigmaValue) == 0)
                 geometry_info.sigma=1.0;
+              if ((flags & XiValue) == 0)
+                geometry_info.xi=0.0;
             }
           if (attribute_flag[1] != 0)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            channel=(ChannelType) argument_list[3].integer_reference;
-          image=AdaptiveSharpenImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,exception);
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            channel=(ChannelType) argument_list[4].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=AdaptiveSharpenImage(image,geometry_info.rho,
+            geometry_info.sigma,geometry_info.xi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 99:  /* Transpose */
@@ -9907,15 +10080,22 @@ Mogrify(ref,...)
                 &geometry_info);
               if ((flags & SigmaValue) == 0)
                 geometry_info.sigma=1.0;
+              if ((flags & XiValue) == 0)
+                geometry_info.xi=0.0;
             }
           if (attribute_flag[1] != 0)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
-            channel=(ChannelType) argument_list[3].integer_reference;
-          image=AdaptiveBlurImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,exception);
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            channel=(ChannelType) argument_list[4].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=AdaptiveBlurImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 103:  /* Sketch */
@@ -9935,8 +10115,10 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            geometry_info.psi=argument_list[4].real_reference;
           image=SketchImage(image,geometry_info.rho,geometry_info.sigma,
-            geometry_info.xi,exception);
+            geometry_info.xi,geometry_info.psi,exception);
           break;
         }
         case 104:  /* UniqueColors */
@@ -9946,6 +10128,9 @@ Mogrify(ref,...)
         }
         case 105:  /* AdaptiveResize */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] != 0)
             flags=ParseRegionGeometry(image,argument_list[0].string_reference,
               &geometry,exception);
@@ -9960,8 +10145,11 @@ Mogrify(ref,...)
               argument_list[4].string_reference);
           if (attribute_flag[5] != 0)
             image->blur=argument_list[5].real_reference;
+          method=UndefinedInterpolatePixel;
+          if (attribute_flag[6] != 0)
+            method=(PixelInterpolateMethod) argument_list[6].integer_reference;
           image=AdaptiveResizeImage(image,geometry.width,geometry.height,
-            exception);
+            method,exception);
           break;
         }
         case 106:  /* ClipMask */
@@ -9974,7 +10162,7 @@ Mogrify(ref,...)
             }
           image->clip_mask=CloneImage(argument_list[0].image_reference,0,0,
             MagickTrue,exception);
-          (void) NegateImage(image->clip_mask,MagickFalse);
+          (void) NegateImage(image->clip_mask,MagickFalse,exception);
           break;
         }
         case 107:  /* LinearStretch */
@@ -10003,7 +10191,49 @@ Mogrify(ref,...)
             black_point=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             white_point=argument_list[2].real_reference;
-          (void) LinearStretchImage(image,black_point,white_point);
+          (void) LinearStretchImage(image,black_point,white_point,exception);
+          break;
+        }
+        case 108:  /* ColorMatrix */
+        {
+          AV
+            *av;
+
+          double
+            *color_matrix;
+
+          KernelInfo
+            *kernel_info;
+
+          size_t
+            order;
+
+          if (attribute_flag[0] == 0)
+            break;
+          av=(AV *) argument_list[0].array_reference;
+          order=(size_t) sqrt(av_len(av)+1);
+          color_matrix=(double *) AcquireQuantumMemory(order,order*
+            sizeof(*color_matrix));
+          if (color_matrix == (double *) NULL)
+            {
+              ThrowPerlException(exception,ResourceLimitFatalError,
+                "MemoryAllocationFailed",PackageName);
+              goto PerlException;
+           }
+          for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
+            color_matrix[j]=(double) SvNV(*(av_fetch(av,j,0)));
+          for ( ; j < (ssize_t) (order*order); j++)
+            color_matrix[j]=0.0;
+          kernel_info=AcquireKernelInfo((const char *) NULL);
+          if (kernel_info == (KernelInfo *) NULL)
+            break;
+          kernel_info->width=order;
+          kernel_info->height=order;
+          kernel_info->values=color_matrix;
+          image=ColorMatrixImage(image,kernel_info,exception);
+          kernel_info->values=(double *) NULL;
+          kernel_info=DestroyKernelInfo(kernel_info);
+          color_matrix=(double *) RelinquishMagickMemory(color_matrix);
           break;
         }
         case 109:  /* Mask */
@@ -10016,23 +10246,30 @@ Mogrify(ref,...)
             }
           image->mask=CloneImage(argument_list[0].image_reference,0,0,
             MagickTrue,exception);
-          (void) NegateImage(image->mask,MagickFalse);
+          (void) NegateImage(image->mask,MagickFalse,exception);
           break;
         }
         case 110:  /* Polaroid */
         {
+          char
+            *caption;
+
           DrawInfo
             *draw_info;
 
           double
             angle;
 
+          PixelInterpolateMethod
+            method;
+
           draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
             (DrawInfo *) NULL);
+          caption=(char *) NULL;
           if (attribute_flag[0] != 0)
-            (void) SetImageProperty(image,"caption",InterpretImageProperties(
-              info ? info->image_info : (ImageInfo *) NULL,image,
-              argument_list[0].string_reference));
+            caption=InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,argument_list[0].string_reference,
+              exception);
           angle=0.0;
           if (attribute_flag[1] != 0)
             angle=argument_list[1].real_reference;
@@ -10040,11 +10277,11 @@ Mogrify(ref,...)
             (void) CloneString(&draw_info->font,
               argument_list[2].string_reference);
           if (attribute_flag[3] != 0)
-            (void) QueryColorDatabase(argument_list[3].string_reference,
-              &draw_info->stroke,exception);
+            (void) QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&draw_info->stroke,exception);
           if (attribute_flag[4] != 0)
-            (void) QueryColorDatabase(argument_list[4].string_reference,
-              &draw_info->fill,exception);
+            (void) QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&draw_info->fill,exception);
           if (attribute_flag[5] != 0)
             draw_info->stroke_width=argument_list[5].real_reference;
           if (attribute_flag[6] != 0)
@@ -10052,10 +10289,15 @@ Mogrify(ref,...)
           if (attribute_flag[7] != 0)
             draw_info->gravity=(GravityType) argument_list[7].integer_reference;
           if (attribute_flag[8] != 0)
-            (void) QueryColorDatabase(argument_list[8].string_reference,
-              &image->background_color,exception);
-          image=PolaroidImage(image,draw_info,angle,exception);
+            (void) QueryColorCompliance(argument_list[8].string_reference,
+              AllCompliance,&image->background_color,exception);
+          method=UndefinedInterpolatePixel;
+          if (attribute_flag[9] != 0)
+            method=(PixelInterpolateMethod) argument_list[9].integer_reference;
+          image=PolaroidImage(image,draw_info,caption,angle,method,exception);
           draw_info=DestroyDrawInfo(draw_info);
+          if (caption != (char *) NULL)
+            caption=DestroyString(caption);
           break;
         }
         case 111:  /* FloodfillPaint */
@@ -10069,6 +10311,9 @@ Mogrify(ref,...)
           PixelInfo
             target;
 
+          Quantum
+            virtual_pixel[MaxPixelChannels];
+
           draw_info=CloneDrawInfo(info ? info->image_info :
             (ImageInfo *) NULL,(DrawInfo *) NULL);
           if (attribute_flag[0] != 0)
@@ -10079,23 +10324,29 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry.y=argument_list[2].integer_reference;
           if (attribute_flag[3] != 0)
-            (void) QueryColorDatabase(argument_list[3].string_reference,
-              &draw_info->fill,exception);
-          (void) GetOneVirtualMagickPixel(image,geometry.x,geometry.y,&target,
+            (void) QueryColorCompliance(argument_list[3].string_reference,
+              AllCompliance,&draw_info->fill,exception);
+          (void) GetOneVirtualPixel(image,geometry.x,geometry.y,virtual_pixel,
             exception);
+          target.red=virtual_pixel[RedPixelChannel];
+          target.green=virtual_pixel[GreenPixelChannel];
+          target.blue=virtual_pixel[BluePixelChannel];
+          target.alpha=virtual_pixel[AlphaPixelChannel];
           if (attribute_flag[4] != 0)
-            QueryMagickColor(argument_list[4].string_reference,&target,
-              exception);
+            QueryColorCompliance(argument_list[4].string_reference,
+              AllCompliance,&target,exception);
           if (attribute_flag[5] != 0)
-            image->fuzz=SiPrefixToDouble(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             channel=(ChannelType) argument_list[6].integer_reference;
           invert=MagickFalse;
           if (attribute_flag[7] != 0)
             invert=(MagickBooleanType) argument_list[7].integer_reference;
-          (void) FloodfillPaintImage(image,channel,draw_info,&target,geometry.x,
-            geometry.y,invert);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
+            geometry.y,invert,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -10147,16 +10398,24 @@ Mogrify(ref,...)
         }
         case 113:  /* Clut */
         {
+          PixelInterpolateMethod
+            method;
+
           if (attribute_flag[0] == 0)
             {
               ThrowPerlException(exception,OptionError,"ClutImageRequired",
                 PackageName);
               goto PerlException;
             }
+          method=UndefinedInterpolatePixel;
           if (attribute_flag[1] != 0)
-            channel=(ChannelType) argument_list[1].integer_reference;
-          (void) ClutImageChannel(image,channel,
-            argument_list[0].image_reference);
+            method=(PixelInterpolateMethod) argument_list[1].integer_reference;
+          if (attribute_flag[2] != 0)
+            channel=(ChannelType) argument_list[2].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) ClutImage(image,argument_list[0].image_reference,method,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 114:  /* LiquidRescale */
@@ -10196,8 +10455,8 @@ Mogrify(ref,...)
             flags=ParseGeometry(argument_list[0].string_reference,
               &geometry_info);
           if (attribute_flag[1] != 0)
-            geometry_info.rho=SiPrefixToDouble(
-              argument_list[1].string_reference,QuantumRange);
+            geometry_info.rho=StringToDoubleInterval(
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
           image=DeskewImage(image,geometry_info.rho,exception);
           break;
         }
@@ -10220,7 +10479,7 @@ Mogrify(ref,...)
             quantize_info->dither_method=(DitherMethod)
               argument_list[2].integer_reference;
           (void) RemapImages(quantize_info,image,
-            argument_list[0].image_reference);
+            argument_list[0].image_reference,exception);
           quantize_info=DestroyQuantizeInfo(quantize_info);
           break;
         }
@@ -10264,8 +10523,11 @@ Mogrify(ref,...)
               argument_list[2].integer_reference);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          image=SparseColorImage(image,channel,method,number_coordinates,
-            coordinates,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=SparseColorImage(image,method,number_coordinates,coordinates,
+            exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           if ((attribute_flag[2] != 0) && (image != (Image *) NULL))
             virtual_pixel=SetImageVirtualPixelMethod(image,virtual_pixel);
           coordinates=(double *) RelinquishMagickMemory(coordinates);
@@ -10334,9 +10596,14 @@ Mogrify(ref,...)
           if (attribute_flag[3] != 0)
             geometry_info.xi=argument_list[3].integer_reference;;
           if (attribute_flag[4] != 0)
-            channel=(ChannelType) argument_list[4].integer_reference;
-          image=SelectiveBlurImageChannel(image,channel,geometry_info.rho,
-            geometry_info.sigma,geometry_info.xi,exception);
+            geometry_info.psi=argument_list[4].integer_reference;;
+          if (attribute_flag[5] != 0)
+            channel=(ChannelType) argument_list[5].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=SelectiveBlurImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,geometry_info.psi,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 122:  /* HaldClut */
@@ -10349,8 +10616,10 @@ Mogrify(ref,...)
             }
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          (void) HaldClutImageChannel(image,channel,
-            argument_list[0].image_reference);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) HaldClutImage(image,argument_list[0].image_reference,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 123:  /* BlueShift */
@@ -10380,21 +10649,25 @@ Mogrify(ref,...)
           if (attribute_flag[0] == 0)
             argument_list[0].string_reference=(char *) NULL;
           (void) ColorDecisionListImage(image,
-            argument_list[0].string_reference);
+            argument_list[0].string_reference,exception);
           break;
         }
         case 127:  /* AutoGamma */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          (void) AutoGammaImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) AutoGammaImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 128:  /* AutoLevel */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          (void) AutoLevelImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) AutoLevelImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 129:  /* LevelColors */
@@ -10403,48 +10676,37 @@ Mogrify(ref,...)
             black_point,
             white_point;
 
-          (void) QueryMagickColor("#000000",&black_point,exception);
-          (void) QueryMagickColor("#ffffff",&white_point,exception);
+          (void) QueryColorCompliance("#000000",AllCompliance,
+            &black_point,exception);
+          (void) QueryColorCompliance("#ffffff",AllCompliance,
+            &white_point,exception);
           if (attribute_flag[1] != 0)
-             (void) QueryMagickColor(argument_list[1].string_reference,
-               &black_point,exception);
+             (void) QueryColorCompliance(
+               argument_list[1].string_reference,AllCompliance,&black_point,
+               exception);
           if (attribute_flag[2] != 0)
-             (void) QueryMagickColor(argument_list[2].string_reference,
-               &white_point,exception);
+             (void) QueryColorCompliance(
+               argument_list[2].string_reference,AllCompliance,&white_point,
+               exception);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          (void) LevelColorsImageChannel(image,channel,&black_point,
-            &white_point,argument_list[0].integer_reference != 0 ? MagickTrue :
-            MagickFalse);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) LevelImageColors(image,&black_point,&white_point,
+            argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse,
+            exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 130:  /* Clamp */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          (void) ClampImageChannel(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) ClampImage(image,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
-        case 131:  /* Filter */
-        {
-          KernelInfo
-            *kernel;
-
-          if (attribute_flag[0] == 0)
-            break;
-          kernel=AcquireKernelInfo(argument_list[0].string_reference);
-          if (kernel == (KernelInfo *) NULL)
-            break;
-          if (attribute_flag[1] != 0)
-            channel=(ChannelType) argument_list[1].integer_reference;
-          if (attribute_flag[2] != 0)
-            image->bias=SiPrefixToDouble(argument_list[2].string_reference,
-              QuantumRange);
-          image=FilterImageChannel(image,channel,kernel,exception);
-          kernel=DestroyKernelInfo(kernel);
-          break;
-        }
-        case 132:  /* BrightnessContrast */
+        case 131:  /* BrightnessContrast */
         {
           double
             brightness,
@@ -10466,11 +10728,12 @@ Mogrify(ref,...)
             contrast=argument_list[2].real_reference;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          (void) BrightnessContrastImageChannel(image,channel,brightness,
-            contrast);
+          channel_mask=SetPixelChannelMask(image,channel);
+          (void) BrightnessContrastImage(image,brightness,contrast,exception);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
-        case 133:  /* Morphology */
+        case 132:  /* Morphology */
         {
           KernelInfo
             *kernel;
@@ -10493,68 +10756,15 @@ Mogrify(ref,...)
             method=argument_list[2].integer_reference;
           iterations=1;
           if (attribute_flag[3] != 0)
-            iterations=argument_list[4].integer_reference;
-          image=MorphologyImageChannel(image,channel,method,iterations,kernel,
-            exception);
+            iterations=argument_list[3].integer_reference;
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=MorphologyImage(image,method,iterations,kernel,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           kernel=DestroyKernelInfo(kernel);
           break;
         }
-        case 108:  /* Recolor */
-        case 134:  /* ColorMatrix */
-        {
-          AV
-            *av;
-
-          double
-            *color_matrix;
-
-          KernelInfo
-            *kernel_info;
-
-          size_t
-            order;
-
-          if (attribute_flag[0] == 0)
-            break;
-          av=(AV *) argument_list[0].array_reference;
-          order=(size_t) sqrt(av_len(av)+1);
-          color_matrix=(double *) AcquireQuantumMemory(order,order*
-            sizeof(*color_matrix));
-          if (color_matrix == (double *) NULL)
-            {
-              ThrowPerlException(exception,ResourceLimitFatalError,
-                "MemoryAllocationFailed",PackageName);
-              goto PerlException;
-           }
-          for (j=0; (j < (ssize_t) (order*order)) && (j < (av_len(av)+1)); j++)
-            color_matrix[j]=(double) SvNV(*(av_fetch(av,j,0)));
-          for ( ; j < (ssize_t) (order*order); j++)
-            color_matrix[j]=0.0;
-          kernel_info=AcquireKernelInfo("1");
-          if (kernel_info == (KernelInfo *) NULL)
-            break;
-          kernel_info->width=order;
-          kernel_info->height=order;
-          kernel_info->values=color_matrix;
-          image=ColorMatrixImage(image,kernel_info,exception);
-          kernel_info->values=(double *) NULL;
-          kernel_info=DestroyKernelInfo(kernel_info);
-          color_matrix=(double *) RelinquishMagickMemory(color_matrix);
-          break;
-        }
-        case 135:  /* Color */
-        {
-          PixelInfo
-            color;
-
-          (void) QueryMagickColor("none",&color,exception);
-          if (attribute_flag[0] != 0)
-            (void) QueryMagickColor(argument_list[0].string_reference,
-              &color,exception);
-          (void) SetImageColor(image,&color);
-          break;
-        }
-        case 136:  /* Mode */
+        case 133:  /* Mode */
         {
           if (attribute_flag[0] != 0)
             {
@@ -10569,11 +10779,14 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          image=StatisticImageChannel(image,channel,ModeStatistic,
-            (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=StatisticImage(image,ModeStatistic,(size_t) geometry_info.rho,
+            (size_t) geometry_info.sigma,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
-        case 137:  /* Statistic */
+        case 134:  /* Statistic */
         {
           StatisticType
             statistic;
@@ -10594,8 +10807,11 @@ Mogrify(ref,...)
             channel=(ChannelType) argument_list[3].integer_reference;
           if (attribute_flag[4] != 0)
             statistic=(StatisticType) argument_list[4].integer_reference;
-          image=StatisticImageChannel(image,channel,statistic,
-            (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
+          channel_mask=SetPixelChannelMask(image,channel);
+          image=StatisticImage(image,statistic,(size_t) geometry_info.rho,
+            (size_t) geometry_info.sigma,exception);
+          if (image != (Image *) NULL)
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
       }
@@ -10605,9 +10821,9 @@ Mogrify(ref,...)
         {
           /*
             Composite region.
-          */
+          */ 
           status=CompositeImage(region_image,CopyCompositeOp,image,
-            region_info.x,region_info.y);
+            region_info.x,region_info.y,exception);
           (void) status;
           (void) CatchImageException(region_image);
           image=DestroyImage(image);
@@ -10619,6 +10835,8 @@ Mogrify(ref,...)
           if (next && (next != image))
             {
               image->next=next->next;
+              if (image->next != (Image *) NULL)
+                image->next->previous=image;
               DeleteImageFromRegistry(*pv,next);
             }
           sv_setiv(*pv,(IV) image);
@@ -10727,7 +10945,8 @@ Montage(ref,...)
     */
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
     montage_info=CloneMontageInfo(info->image_info,(MontageInfo *) NULL);
-    (void) QueryMagickColor("none",&transparent_color,exception);
+    (void) QueryColorCompliance("none",AllCompliance,&transparent_color,
+      exception);
     for (i=2; i < items; i+=2)
     {
       attribute=(char *) SvPV(ST(i-1),na);
@@ -10738,7 +10957,7 @@ Montage(ref,...)
         {
           if (LocaleCompare(attribute,"background") == 0)
             {
-              (void) QueryColorDatabase(SvPV(ST(i),na),
+              (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
                 &montage_info->background_color,exception);
               for (next=image; next; next=next->next)
                 next->background_color=montage_info->background_color;
@@ -10751,7 +10970,7 @@ Montage(ref,...)
             }
           if (LocaleCompare(attribute,"bordercolor") == 0)
             {
-              (void) QueryColorDatabase(SvPV(ST(i),na),
+              (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
                 &montage_info->border_color,exception);
               for (next=image; next; next=next->next)
                 next->border_color=montage_info->border_color;
@@ -10792,8 +11011,8 @@ Montage(ref,...)
         {
           if (LocaleCompare(attribute,"fill") == 0)
             {
-              (void) QueryColorDatabase(SvPV(ST(i),na),&montage_info->fill,
-                exception);
+              (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                &montage_info->fill,exception);
               break;
             }
           if (LocaleCompare(attribute,"font") == 0)
@@ -10872,7 +11091,7 @@ Montage(ref,...)
               for (next=image; next; next=next->next)
                 (void) SetImageProperty(next,"label",InterpretImageProperties(
                   info ? info->image_info : (ImageInfo *) NULL,next,
-                  SvPV(ST(i),na)));
+                  SvPV(ST(i),na),exception),exception);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -10884,7 +11103,7 @@ Montage(ref,...)
         {
           if (LocaleCompare(attribute,"mattecolor") == 0)
             {
-              (void) QueryColorDatabase(SvPV(ST(i),na),
+              (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
                 &montage_info->matte_color,exception);
               for (next=image; next; next=next->next)
                 next->matte_color=montage_info->matte_color;
@@ -10895,8 +11114,8 @@ Montage(ref,...)
               ssize_t
                 in;
 
-              in=!SvPOK(ST(i)) ? SvIV(ST(i)) :
-                ParseCommandOption(MagickModeOptions,MagickFalse,SvPV(ST(i),na));
+              in=!SvPOK(ST(i)) ? SvIV(ST(i)) : ParseCommandOption(
+                MagickModeOptions,MagickFalse,SvPV(ST(i),na));
               switch (in)
               {
                 default:
@@ -10962,8 +11181,8 @@ Montage(ref,...)
             }
           if (LocaleCompare(attribute,"stroke") == 0)
             {
-              (void) QueryColorDatabase(SvPV(ST(i),na),&montage_info->stroke,
-                exception);
+              (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                &montage_info->stroke,exception);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -11002,10 +11221,11 @@ Montage(ref,...)
               PixelInfo
                 transparent_color;
 
-              QueryMagickColor(SvPV(ST(i),na),&transparent_color,exception);
+              QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                &transparent_color,exception);
               for (next=image; next; next=next->next)
                 (void) TransparentPaintImage(next,&transparent_color,
-                  TransparentAlpha,MagickFalse);
+                  TransparentAlpha,MagickFalse,exception);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -11027,7 +11247,7 @@ Montage(ref,...)
     if (transparent_color.alpha != TransparentAlpha)
       for (next=image; next; next=next->next)
         (void) TransparentPaintImage(next,&transparent_color,
-          TransparentAlpha,MagickFalse);
+          TransparentAlpha,MagickFalse,exception);
     for (  ; image; image=image->next)
     {
       AddImageToRegistry(sv,image);
@@ -11254,9 +11474,9 @@ Mosaic(ref)
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    (void) CopyMagickString(image->filename,info->image_info->filename,
+    (void) CopyMagickString(info->image_info->filename,image->filename,
       MaxTextExtent);
-    SetImageInfo(info->image_info,0,&image->exception);
+    SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
     XSRETURN(1);
@@ -11639,7 +11859,7 @@ QueryColor(ref,...)
     for (i=1; i < items; i++)
     {
       name=(char *) SvPV(ST(i),na);
-      if (QueryMagickColor(name,&color,exception) == MagickFalse)
+      if (QueryColorCompliance(name,AllCompliance,&color,exception) == MagickFalse)
         {
           PUSHs(&sv_undef);
           continue;
@@ -11690,7 +11910,7 @@ QueryColorname(ref,...)
     Image
       *image;
 
-    PixelPacket
+    PixelInfo
       target_color;
 
     register ssize_t
@@ -11721,7 +11941,8 @@ QueryColorname(ref,...)
     EXTEND(sp,items);
     for (i=1; i < items; i++)
     {
-      (void) QueryColorDatabase(SvPV(ST(i),na),&target_color,exception);
+      (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,&target_color,
+        exception);
       (void) QueryColorname(image,&target_color,SVGCompliance,message,
         exception);
       PUSHs(sv_2mortal(newSVpv(message,0)));
@@ -12011,8 +12232,8 @@ QueryFontMetrics(ref,...)
           if (LocaleCompare(attribute,"fill") == 0)
             {
               if (info)
-                (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->fill,
-                  &image->exception);
+                (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                  &draw_info->fill,exception);
               break;
             }
           if (LocaleCompare(attribute,"font") == 0)
@@ -12133,8 +12354,8 @@ QueryFontMetrics(ref,...)
           if (LocaleCompare(attribute,"stroke") == 0)
             {
               if (info)
-                (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->stroke,
-                  &image->exception);
+                (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                  &draw_info->stroke,exception);
               break;
             }
           if (LocaleCompare(attribute,"style") == 0)
@@ -12234,7 +12455,7 @@ QueryFontMetrics(ref,...)
         (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
           "%.15g,%.15g",x,y);
       }
-    status=GetTypeMetrics(image,draw_info,&metrics);
+    status=GetTypeMetrics(image,draw_info,&metrics,exception);
     (void) CatchImageException(image);
     if (status == MagickFalse)
       PUSHs(&sv_undef);
@@ -12416,8 +12637,8 @@ QueryMultilineFontMetrics(ref,...)
           if (LocaleCompare(attribute,"fill") == 0)
             {
               if (info)
-                (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->fill,
-                  &image->exception);
+                (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                  &draw_info->fill,exception);
               break;
             }
           if (LocaleCompare(attribute,"font") == 0)
@@ -12506,8 +12727,8 @@ QueryMultilineFontMetrics(ref,...)
           if (LocaleCompare(attribute,"stroke") == 0)
             {
               if (info)
-                (void) QueryColorDatabase(SvPV(ST(i),na),&draw_info->stroke,
-                  &image->exception);
+                (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
+                  &draw_info->stroke,exception);
               break;
             }
           if (LocaleCompare(attribute,"style") == 0)
@@ -12607,8 +12828,8 @@ QueryMultilineFontMetrics(ref,...)
         (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
           "%.15g,%.15g",x,y);
       }
-    status=GetMultilineTypeMetrics(image,draw_info,&metrics);
-    (void) CatchImageException(image);
+    status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception);
+    (void) CatchException(exception);
     if (status == MagickFalse)
       PUSHs(&sv_undef);
     else
@@ -13156,7 +13377,8 @@ SetPixel(ref,...)
       *attribute;
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     ExceptionInfo
       *exception;
@@ -13202,7 +13424,6 @@ SetPixel(ref,...)
         goto PerlException;
       }
     av=(AV *) NULL;
-    channel=DefaultChannels;
     normalize=MagickTrue;
     region.x=0;
     region.y=0;
@@ -13210,6 +13431,7 @@ SetPixel(ref,...)
     region.height=1;
     if (items == 1)
       (void) ParseAbsoluteGeometry(SvPV(ST(1),na),&region);
+    channel=DefaultChannels;
     for (i=2; i < items; i+=2)
     {
       attribute=(char *) SvPV(ST(i-1),na);
@@ -13230,7 +13452,7 @@ SetPixel(ref,...)
                     SvPV(ST(i),na));
                   return;
                 }
-               channel=(ChannelType) option;
+              channel=(ChannelType) option;
               break;
             }
           if (LocaleCompare(attribute,"color") == 0)
@@ -13316,9 +13538,10 @@ SetPixel(ref,...)
         }
       }
     }
-    (void) SetImageStorageClass(image,DirectClass);
+    (void) SetImageStorageClass(image,DirectClass,exception);
+    channel_mask=SetPixelChannelMask(image,channel);
     q=GetAuthenticPixels(image,region.x,region.y,1,1,exception);
-    if ((q == (const Quantum *) NULL) || (av == (AV *) NULL) ||
+    if ((q == (Quantum *) NULL) || (av == (AV *) NULL) ||
         (SvTYPE(av) != SVt_PVAV))
       PUSHs(&sv_undef);
     else
@@ -13333,32 +13556,36 @@ SetPixel(ref,...)
         scale=1.0;
         if (normalize != MagickFalse)
           scale=QuantumRange;
-        if (((GetPixelRedTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+        if (((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) &&
+            (i <= av_len(av)))
           {
             SetPixelRed(image,ClampToQuantum(scale*SvNV(*(
               av_fetch(av,i,0)))),q);
             i++;
           }
-        if (((GetPixelGreenTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+        if (((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) &&
+            (i <= av_len(av)))
           {
             SetPixelGreen(image,ClampToQuantum(scale*SvNV(*(
               av_fetch(av,i,0)))),q);
             i++;
           }
-        if (((GetPixelBlueTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+        if (((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) &&
+            (i <= av_len(av)))
           {
             SetPixelBlue(image,ClampToQuantum(scale*SvNV(*(
               av_fetch(av,i,0)))),q);
             i++;
           }
-        if ((((GetPixelBlackTraits(image) & ActivePixelTrait) != 0) &&
+        if ((((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
             (image->colorspace == CMYKColorspace)) && (i <= av_len(av)))
           {
             SetPixelBlack(image,ClampToQuantum(scale*
               SvNV(*(av_fetch(av,i,0)))),q);
             i++;
           }
-        if (((GetPixelAlphaTraits(image) & ActivePixelTrait) != 0) && (i <= av_len(av)))
+        if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
+            (i <= av_len(av)))
           {
             SetPixelAlpha(image,ClampToQuantum(scale*
               SvNV(*(av_fetch(av,i,0)))),q);
@@ -13366,6 +13593,7 @@ SetPixel(ref,...)
           }
         (void) SyncAuthenticPixels(image,exception);
       }
+    (void) SetPixelChannelMask(image,channel_mask);
 
   PerlException:
     InheritPerlException(exception,perl_exception);
@@ -13625,7 +13853,7 @@ Statistics(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
-      channel_statistics=GetImageChannelStatistics(image,&image->exception);
+      channel_statistics=GetImageStatistics(image,exception);
       if (channel_statistics == (ChannelStatistics *) NULL)
         continue;
       count++;
@@ -13708,7 +13936,6 @@ SyncAuthenticPixels(ref,...)
     status=SyncAuthenticPixels(image,exception);
     if (status != MagickFalse)
       return;
-    InheritException(exception,&image->exception);
 
   PerlException:
     InheritPerlException(exception,perl_exception);
@@ -13861,7 +14088,7 @@ Transform(ref,...)
       clone=CloneImage(image,0,0,MagickTrue,exception);
       if ((clone == (Image *) NULL) || (exception->severity >= ErrorException))
         goto PerlException;
-      TransformImage(&clone,crop_geometry,geometry);
+      TransformImage(&clone,crop_geometry,geometry,exception);
       for ( ; clone; clone=clone->next)
       {
         AddImageToRegistry(sv,clone);
@@ -13967,13 +14194,10 @@ Write(ref,...)
       next->scene=scene++;
     }
     SetImageInfo(package_info->image_info,(unsigned int)
-      GetImageListLength(image),&image->exception);
+      GetImageListLength(image),exception);
     for (next=image; next; next=next->next)
     {
-      (void) WriteImage(package_info->image_info,next);
-      if (next->exception.severity >= ErrorException)
-        InheritException(exception,&next->exception);
-      GetImageException(next,exception);
+      (void) WriteImage(package_info->image_info,next,exception);
       number_images++;
       if (package_info->image_info->adjoin)
         break;