]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/mogrify.c
(no commit message)
[imagemagick] / MagickWand / mogrify.c
index 6fb3c2de48c4f65e73b2eaf9684c1d28a635ffcb..5ed3161a8680ca8891699ad4042182c92ef36f8d 100644 (file)
@@ -384,14 +384,6 @@ static MagickBooleanType MonitorProgress(const char *text,
   return(MagickTrue);
 }
 
-/*
-** SparseColorOption() parses the complex -sparse-color argument into an
-** an array of floating point values then calls SparseColorImage().
-** Argument is a complex mix of floating-point pixel coodinates, and color
-** specifications (or direct floating point numbers).  The number of floats
-** needed to represent a color varies depending on the current channel
-** setting.
-*/
 static Image *SparseColorOption(const Image *image,
   const SparseColorMethod method,const char *arguments,
   const MagickBooleanType color_from_image,ExceptionInfo *exception)
@@ -421,6 +413,14 @@ static Image *SparseColorOption(const Image *image,
     number_arguments,
     number_colors;
 
+  /*
+    SparseColorOption() parses the complex -sparse-color argument into an
+    an array of floating point values then calls SparseColorImage().
+    Argument is a complex mix of floating-point pixel coodinates, and color
+    specifications (or direct floating point numbers).  The number of floats
+    needed to represent a color varies depending on the current channel
+    setting.
+  */
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
   if (image->debug != MagickFalse)
@@ -617,6 +617,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
   ChannelType
     channel;
 
+  CompositeOperator
+    compose;
+
   const char
     *format,
     *option;
@@ -642,6 +645,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
   MagickStatusType
     flags;
 
+  PixelInterpolateMethod
+    interpolate_method;
+
   QuantizeInfo
     *quantize_info;
 
@@ -669,6 +675,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
   SetGeometryInfo(&geometry_info);
   GetPixelInfo(*image,&fill);
   SetPixelInfoPacket(*image,&(*image)->background_color,&fill);
+  compose=(*image)->compose;
+  interpolate_method=UndefinedInterpolatePixel;
   channel=mogrify_info->channel;
   format=GetImageOption(mogrify_info,"format");
   SetGeometry(*image,&region_geometry);
@@ -706,8 +714,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=0.0;
             mogrify_image=AdaptiveBlurImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("adaptive-resize",option+1) == 0)
@@ -718,7 +728,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
             mogrify_image=AdaptiveResizeImage(*image,geometry.width,
-              geometry.height,exception);
+              geometry.height,interpolate_method,exception);
             break;
           }
         if (LocaleCompare("adaptive-sharpen",option+1) == 0)
@@ -730,8 +740,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=0.0;
             mogrify_image=AdaptiveSharpenImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("affine",option+1) == 0)
@@ -772,8 +784,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=geometry_info.rho;
-            text=InterpretImageProperties(mogrify_info,*image,argv[i+2]);
-            InheritException(exception,&(*image)->exception);
+            text=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+              exception);
             if (text == (char *) NULL)
               break;
             (void) CloneString(&draw_info->text,text);
@@ -789,8 +801,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               fmod(geometry_info.sigma,360.0))));
             draw_info->affine.sy=cos(DegreesToRadians(
               fmod(geometry_info.sigma,360.0)));
-            (void) AnnotateImage(*image,draw_info);
-            InheritException(exception,&(*image)->exception);
+            (void) AnnotateImage(*image,draw_info,exception);
             break;
           }
         if (LocaleCompare("antialias",option+1) == 0)
@@ -901,8 +912,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=0.0;
             mogrify_image=BlurImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("border",option+1) == 0)
@@ -914,15 +927,15 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
             if ((flags & SigmaValue) == 0)
               geometry.height=geometry.width;
-            mogrify_image=BorderImage(*image,&geometry,exception);
+            mogrify_image=BorderImage(*image,&geometry,compose,exception);
             break;
           }
         if (LocaleCompare("bordercolor",option+1) == 0)
           {
             if (*option == '+')
               {
-                (void) QueryColorDatabase(MogrifyBorderColor,&draw_info->border_color,
-                  exception);
+                (void) QueryColorDatabase(MogrifyBorderColor,
+                  &draw_info->border_color,exception);
                 break;
               }
             (void) QueryColorDatabase(argv[i+1],&draw_info->border_color,
@@ -1000,8 +1013,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=1.0;
             mogrify_image=CharcoalImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("chop",option+1) == 0)
@@ -1029,12 +1044,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             if (*option == '+')
               {
-                (void) SetImageClipMask(*image,(Image *) NULL);
-                InheritException(exception,&(*image)->exception);
+                (void) SetImageClipMask(*image,(Image *) NULL,exception);
                 break;
               }
-            (void) ClipImage(*image);
-            InheritException(exception,&(*image)->exception);
+            (void) ClipImage(*image,exception);
             break;
           }
         if (LocaleCompare("clip-mask",option+1) == 0)
@@ -1060,8 +1073,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
                 /*
                   Remove a mask.
                 */
-                (void) SetImageMask(*image,(Image *) NULL);
-                InheritException(exception,&(*image)->exception);
+                (void) SetImageMask(*image,(Image *) NULL,exception);
                 break;
               }
             /*
@@ -1078,7 +1090,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             {
               q=GetCacheViewAuthenticPixels(mask_view,0,y,mask_image->columns,1,
                 exception);
-              if (q == (const Quantum *) NULL)
+              if (q == (Quantum *) NULL)
                 break;
               for (x=0; x < (ssize_t) mask_image->columns; x++)
               {
@@ -1094,8 +1106,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             }
             mask_view=DestroyCacheView(mask_view);
             mask_image->matte=MagickTrue;
-            (void) SetImageClipMask(*image,mask_image);
-            mask_image=DestroyImage(mask_image);
+            (void) SetImageClipMask(*image,mask_image,exception);
             InheritException(exception,&(*image)->exception);
             break;
           }
@@ -1103,8 +1114,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
           {
             (void) SyncImageSettings(mogrify_info,*image);
             (void) ClipImagePath(*image,argv[i+1],*option == '-' ? MagickTrue :
-              MagickFalse);
-            InheritException(exception,&(*image)->exception);
+              MagickFalse,exception);
             break;
           }
         if (LocaleCompare("colorize",option+1) == 0)
@@ -1141,10 +1151,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               break;
             if (((*image)->storage_class == DirectClass) ||
                 (*image)->colors > quantize_info->number_colors)
-              (void) QuantizeImage(quantize_info,*image);
+              (void) QuantizeImage(quantize_info,*image,exception);
             else
-              (void) CompressImageColormap(*image);
-            InheritException(exception,&(*image)->exception);
+              (void) CompressImageColormap(*image,exception);
             break;
           }
         if (LocaleCompare("colorspace",option+1) == 0)
@@ -1165,6 +1174,13 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             InheritException(exception,&(*image)->exception);
             break;
           }
+        if (LocaleCompare("compose",option+1) == 0)
+          {
+            (void) SyncImageSettings(mogrify_info,*image);
+            compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions,
+              MagickFalse,argv[i+1]);
+            break;
+          }
         if (LocaleCompare("contrast",option+1) == 0)
           {
             (void) SyncImageSettings(mogrify_info,*image);
@@ -1230,8 +1246,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Cycle an image colormap.
             */
             (void) SyncImageSettings(mogrify_info,*image);
-            (void) CycleColormapImage(*image,(ssize_t) StringToLong(argv[i+1]));
-            InheritException(exception,&(*image)->exception);
+            (void) CycleColormapImage(*image,(ssize_t) StringToLong(argv[i+1]),
+              exception);
             break;
           }
         break;
@@ -1346,8 +1362,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
                       resize_args,MagickTrue,exception);
                  break;
               }
-            args=InterpretImageProperties(mogrify_info,*image,argv[i+2]);
-            InheritException(exception,&(*image)->exception);
+            args=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+              exception);
             if (args == (char *) NULL)
               break;
             p=(char *) args;
@@ -1400,8 +1416,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             */
             (void) SyncImageSettings(mogrify_info,*image);
             (void) CloneString(&draw_info->primitive,argv[i+1]);
-            (void) DrawImage(*image,draw_info);
-            InheritException(exception,&(*image)->exception);
+            (void) DrawImage(*image,draw_info,exception);
             break;
           }
         break;
@@ -1417,7 +1432,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
-            mogrify_image=EdgeImage(*image,geometry_info.rho,exception);
+            mogrify_image=EdgeImage(*image,geometry_info.rho,
+              geometry_info.sigma,exception);
             break;
           }
         if (LocaleCompare("emboss",option+1) == 0)
@@ -1619,7 +1635,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             frame_info.y=(ssize_t) frame_info.height;
             frame_info.width=(*image)->columns+2*frame_info.width;
             frame_info.height=(*image)->rows+2*frame_info.height;
-            mogrify_image=FrameImage(*image,&frame_info,exception);
+            mogrify_image=FrameImage(*image,&frame_info,compose,exception);
             break;
           }
         if (LocaleCompare("function",option+1) == 0)
@@ -1649,8 +1665,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             function=(MagickFunction) ParseCommandOption(MagickFunctionOptions,
               MagickFalse,argv[i+1]);
-            arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2]);
-            InheritException(exception,&(*image)->exception);
+            arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+              exception);
             if (arguments == (char *) NULL)
               break;
             p=(char *) arguments;
@@ -1709,8 +1725,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=0.0;
             mogrify_image=GaussianBlurImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("geometry",option+1) == 0)
@@ -1765,12 +1783,12 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             if (format == (char *) NULL)
               {
-                (void) IdentifyImage(*image,stdout,mogrify_info->verbose);
-                InheritException(exception,&(*image)->exception);
+                (void) IdentifyImage(*image,stdout,mogrify_info->verbose,
+                  exception);
                 break;
               }
-            text=InterpretImageProperties(mogrify_info,*image,format);
-            InheritException(exception,&(*image)->exception);
+            text=InterpretImageProperties(mogrify_info,*image,format,
+              exception);
             if (text == (char *) NULL)
               break;
             (void) fputs(text,stdout);
@@ -1785,7 +1803,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             */
             (void) SyncImageSettings(mogrify_info,*image);
             (void) ParseGeometry(argv[i+1],&geometry_info);
-            mogrify_image=ImplodeImage(*image,geometry_info.rho,exception);
+            mogrify_image=ImplodeImage(*image,geometry_info.rho,
+              interpolate_method,exception);
             break;
           }
         if (LocaleCompare("interline-spacing",option+1) == 0)
@@ -1797,6 +1816,12 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             draw_info->interline_spacing=geometry_info.rho;
             break;
           }
+        if (LocaleCompare("interpolate",option+1) == 0)
+          {
+            interpolate_method=(PixelInterpolateMethod) ParseCommandOption(
+              MagickInterpolateOptions,MagickFalse,argv[i+1]);
+            break;
+          }
         if (LocaleCompare("interword-spacing",option+1) == 0)
           {
             if (*option == '+')
@@ -1981,8 +2006,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             remap_image=GetImageCache(mogrify_info,argv[i+1],exception);
             if (remap_image == (Image *) NULL)
               break;
-            (void) RemapImage(quantize_info,*image,remap_image);
-            InheritException(exception,&(*image)->exception);
+            (void) RemapImage(quantize_info,*image,remap_image,exception);
             remap_image=DestroyImage(remap_image);
             break;
           }
@@ -1997,8 +2021,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
                 /*
                   Remove a mask.
                 */
-                (void) SetImageMask(*image,(Image *) NULL);
-                InheritException(exception,&(*image)->exception);
+                (void) SetImageMask(*image,(Image *) NULL,exception);
                 break;
               }
             /*
@@ -2007,9 +2030,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             mask=GetImageCache(mogrify_info,argv[i+1],exception);
             if (mask == (Image *) NULL)
               break;
-            (void) SetImageMask(*image,mask);
+            (void) SetImageMask(*image,mask,exception);
             mask=DestroyImage(mask);
-            InheritException(exception,&(*image)->exception);
             break;
           }
         if (LocaleCompare("matte",option+1) == 0)
@@ -2024,9 +2046,11 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Median filter image.
             */
             (void) SyncImageSettings(mogrify_info,*image);
-            (void) ParseGeometry(argv[i+1],&geometry_info);
+            flags=ParseGeometry(argv[i+1],&geometry_info);
+            if ((flags & SigmaValue) == 0)
+              geometry_info.sigma=geometry_info.rho;
             mogrify_image=StatisticImage(*image,MedianStatistic,(size_t)
-              geometry_info.rho,(size_t) geometry_info.rho,exception);
+              geometry_info.rho,(size_t) geometry_info.sigma,exception);
             break;
           }
         if (LocaleCompare("mode",option+1) == 0)
@@ -2035,9 +2059,11 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Mode image.
             */
             (void) SyncImageSettings(mogrify_info,*image);
-            (void) ParseGeometry(argv[i+1],&geometry_info);
+            flags=ParseGeometry(argv[i+1],&geometry_info);
+            if ((flags & SigmaValue) == 0)
+              geometry_info.sigma=geometry_info.rho;
             mogrify_image=StatisticImage(*image,ModeStatistic,(size_t)
-              geometry_info.rho,(size_t) geometry_info.rho,exception);
+              geometry_info.rho,(size_t) geometry_info.sigma,exception);
             break;
           }
         if (LocaleCompare("modulate",option+1) == 0)
@@ -2061,8 +2087,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
         if (LocaleCompare("monochrome",option+1) == 0)
           {
             (void) SyncImageSettings(mogrify_info,*image);
-            (void) SetImageType(*image,BilevelType);
-            InheritException(exception,&(*image)->exception);
+            (void) SetImageType(*image,BilevelType,exception);
             break;
           }
         if (LocaleCompare("morphology",option+1) == 0)
@@ -2088,8 +2113,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             p=argv[i+1];
             GetMagickToken(p,&p,token);
-            method=(MorphologyMethod) ParseCommandOption(MagickMorphologyOptions,
-              MagickFalse,token);
+            method=(MorphologyMethod) ParseCommandOption(
+              MagickMorphologyOptions,MagickFalse,token);
             iterations=1L;
             GetMagickToken(p,&p,token);
             if ((*p == ':') || (*p == ','))
@@ -2119,7 +2144,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
             mogrify_image=MotionBlurImage(*image,geometry_info.rho,
-              geometry_info.sigma,geometry_info.xi,exception);
+              geometry_info.sigma,geometry_info.xi,geometry_info.psi,
+              exception);
             break;
           }
         break;
@@ -2138,9 +2164,11 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             if (*option == '-')
               {
-                (void) ParseGeometry(argv[i+1],&geometry_info);
+                flags=ParseGeometry(argv[i+1],&geometry_info);
+                if ((flags & SigmaValue) == 0)
+                  geometry_info.sigma=geometry_info.rho;
                 mogrify_image=StatisticImage(*image,NonpeakStatistic,(size_t)
-                  geometry_info.rho,(size_t) geometry_info.rho,exception);
+                  geometry_info.rho,(size_t) geometry_info.sigma,exception);
               }
             else
               {
@@ -2232,7 +2260,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
                 flags=ParseGeometry(argv[i+1],&geometry_info);
                 angle=geometry_info.rho;
               }
-            mogrify_image=PolaroidImage(*image,draw_info,angle,exception);
+            mogrify_image=PolaroidImage(*image,draw_info,angle,
+              interpolate_method,exception);
             break;
           }
         if (LocaleCompare("posterize",option+1) == 0)
@@ -2242,8 +2271,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             */
             (void) SyncImageSettings(mogrify_info,*image);
             (void) PosterizeImage(*image,StringToUnsignedLong(argv[i+1]),
-              quantize_info->dither);
-            InheritException(exception,&(*image)->exception);
+              quantize_info->dither,exception);
             break;
           }
         if (LocaleCompare("preview",option+1) == 0)
@@ -2258,8 +2286,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if (*option == '+')
               preview_type=UndefinedPreview;
             else
-              preview_type=(PreviewType) ParseCommandOption(MagickPreviewOptions,
-                MagickFalse,argv[i+1]);
+              preview_type=(PreviewType) ParseCommandOption(
+                MagickPreviewOptions,MagickFalse,argv[i+1]);
             mogrify_image=PreviewImage(*image,preview_type,exception);
             break;
           }
@@ -2354,8 +2382,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Radial blur image.
             */
             (void) SyncImageSettings(mogrify_info,*image);
-            mogrify_image=RadialBlurImage(*image,InterpretLocaleValue(argv[i+1],
-              (char **) NULL),exception);
+            flags=ParseGeometry(argv[i+1],&geometry_info);
+            mogrify_image=RadialBlurImage(*image,geometry_info.rho,
+              geometry_info.sigma,exception);
             break;
           }
         if (LocaleCompare("raise",option+1) == 0)
@@ -2443,8 +2472,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             remap_image=GetImageCache(mogrify_info,argv[i+1],exception);
             if (remap_image == (Image *) NULL)
               break;
-            (void) RemapImage(quantize_info,*image,remap_image);
-            InheritException(exception,&(*image)->exception);
+            (void) RemapImage(quantize_info,*image,remap_image,exception);
             remap_image=DestroyImage(remap_image);
             break;
           }
@@ -2555,7 +2583,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if ((flags & PercentValue) != 0)
               geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
             mogrify_image=SelectiveBlurImage(*image,geometry_info.rho,
-              geometry_info.sigma,geometry_info.xi,exception);
+              geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
             break;
           }
         if (LocaleCompare("separate",option+1) == 0)
@@ -2590,8 +2618,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
             (void) SegmentImage(*image,(*image)->colorspace,
-              mogrify_info->verbose,geometry_info.rho,geometry_info.sigma);
-            InheritException(exception,&(*image)->exception);
+              mogrify_info->verbose,geometry_info.rho,geometry_info.sigma,
+              exception);
             break;
           }
         if (LocaleCompare("set",option+1) == 0)
@@ -2616,7 +2644,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
                     (void) DeleteImageProperty(*image,argv[i+1]);
                 break;
               }
-            value=InterpretImageProperties(mogrify_info,*image,argv[i+2]);
+            value=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+              exception);
             if (value == (char *) NULL)
               break;
             if (LocaleNCompare(argv[i+1],"registry:",9) == 0)
@@ -2674,8 +2703,10 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             flags=ParseGeometry(argv[i+1],&geometry_info);
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
+            if ((flags & XiValue) == 0)
+              geometry_info.xi=0.0;
             mogrify_image=SharpenImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,geometry_info.xi,exception);
             break;
           }
         if (LocaleCompare("shave",option+1) == 0)
@@ -2728,7 +2759,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
             mogrify_image=SketchImage(*image,geometry_info.rho,
-              geometry_info.sigma,geometry_info.xi,exception);
+              geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
             break;
           }
         if (LocaleCompare("solarize",option+1) == 0)
@@ -2738,8 +2769,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
 
             (void) SyncImageSettings(mogrify_info,*image);
             threshold=SiPrefixToDouble(argv[i+1],QuantumRange);
-            (void) SolarizeImage(*image,threshold);
-            InheritException(exception,&(*image)->exception);
+            (void) SolarizeImage(*image,threshold,exception);
             break;
           }
         if (LocaleCompare("sparse-color",option+1) == 0)
@@ -2756,8 +2786,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image);
             method=(SparseColorMethod) ParseCommandOption(
               MagickSparseColorOptions,MagickFalse,argv[i+1]);
-            arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2]);
-            InheritException(exception,&(*image)->exception);
+            arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+              exception);
             if (arguments == (char *) NULL)
               break;
             mogrify_image=SparseColorOption(*image,method,arguments,
@@ -2782,7 +2812,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             */
             (void) SyncImageSettings(mogrify_info,*image);
             (void) ParseGeometry(argv[i+1],&geometry_info);
-            mogrify_image=SpreadImage(*image,geometry_info.rho,exception);
+            mogrify_image=SpreadImage(*image,geometry_info.rho,
+              interpolate_method,exception);
             break;
           }
         if (LocaleCompare("statistic",option+1) == 0)
@@ -2864,7 +2895,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             */
             (void) SyncImageSettings(mogrify_info,*image);
             (void) ParseGeometry(argv[i+1],&geometry_info);
-            mogrify_image=SwirlImage(*image,geometry_info.rho,exception);
+            mogrify_image=SwirlImage(*image,geometry_info.rho,
+              interpolate_method,exception);
             break;
           }
         break;
@@ -2917,7 +2949,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Tint the image.
             */
             (void) SyncImageSettings(mogrify_info,*image);
-            mogrify_image=TintImage(*image,argv[i+1],draw_info->fill,exception);
+            mogrify_image=TintImage(*image,argv[i+1],&fill,exception);
             break;
           }
         if (LocaleCompare("transform",option+1) == 0)
@@ -2986,8 +3018,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               type=(ImageType) ParseCommandOption(MagickTypeOptions,MagickFalse,
                 argv[i+1]);
             (*image)->type=UndefinedType;
-            (void) SetImageType(*image,type);
-            InheritException(exception,&(*image)->exception);
+            (void) SetImageType(*image,type,exception);
             break;
           }
         break;
@@ -3092,7 +3123,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if ((flags & SigmaValue) == 0)
               geometry_info.sigma=1.0;
             mogrify_image=WaveImage(*image,geometry_info.rho,
-              geometry_info.sigma,exception);
+              geometry_info.sigma,interpolate_method,exception);
             break;
           }
         if (LocaleCompare("weight",option+1) == 0)
@@ -3230,7 +3261,7 @@ static MagickBooleanType MogrifyUsage(void)
       "-brightness-contrast geometry",
       "                     improve brightness / contrast of the image",
       "-cdl filename        color correct with a color decision list",
-      "-charcoal radius     simulate a charcoal drawing",
+      "-charcoal geometry   simulate a charcoal drawing",
       "-chop geometry       remove pixels from the image interior",
       "-clamp               restrict pixel range from 0 to the quantum depth",
       "-clip                clip along the first path from the 8BIM profile",
@@ -3682,7 +3713,7 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
               *quantize_info;
 
             quantize_info=AcquireQuantizeInfo(image_info);
-            (void) RemapImages(quantize_info,images,(Image *) NULL);
+            (void) RemapImages(quantize_info,images,(Image *) NULL,exception);
             quantize_info=DestroyQuantizeInfo(quantize_info);
           }
         *backup_filename='\0';
@@ -7216,6 +7247,9 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
   MagickStatusType
     status;
 
+  PixelInterpolateMethod
+   interpolate_method;
+
   QuantizeInfo
     *quantize_info;
 
@@ -7239,6 +7273,7 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
       (*images)->filename);
   if ((argc <= 0) || (*argv == (char *) NULL))
     return(MagickTrue);
+  interpolate_method=UndefinedInterpolatePixel;
   mogrify_info=CloneImageInfo(image_info);
   quantize_info=AcquireQuantizeInfo(mogrify_info);
   status=MagickTrue;
@@ -7263,8 +7298,8 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
             (void) SyncImagesSettings(mogrify_info,*images);
             if (*option == '+')
               {
-                (void) RemapImages(quantize_info,*images,(Image *) NULL);
-                InheritException(exception,&(*images)->exception);
+                (void) RemapImages(quantize_info,*images,(Image *) NULL,
+                  exception);
                 break;
               }
             i++;
@@ -7339,7 +7374,7 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
                 status=MagickFalse;
                 break;
               }
-            (void) ClutImage(image,clut_image,exception);
+            (void) ClutImage(image,clut_image,interpolate_method,exception);
             clut_image=DestroyImage(clut_image);
             *images=DestroyImageList(*images);
             *images=image;
@@ -7418,8 +7453,8 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
                   {
                     /*
                       Set a blending mask for the composition.
+                      Posible error, what if image->mask already set.
                     */
-                    /* POSIBLE ERROR; what if image->mask already set */
                     image->mask=mask_image;
                     (void) NegateImage(image->mask,MagickFalse,exception);
                   }
@@ -7434,29 +7469,6 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
             *images=image;
             break;
           }
-#if 0
-This has been merged completely into MogrifyImage()
-        if (LocaleCompare("crop",option+1) == 0)
-          {
-            MagickStatusType
-              flags;
-
-            RectangleInfo
-              geometry;
-
-            /*
-              Crop Image.
-            */
-            (void) SyncImagesSettings(mogrify_info,*images);
-            flags=ParseGravityGeometry(*images,argv[i+1],&geometry,exception);
-            if (((geometry.width == 0) && (geometry.height == 0)) ||
-                ((flags & XValue) != 0) || ((flags & YValue) != 0))
-              break;
-            (void) TransformImages(images,argv[i+1],(char *) NULL);
-            InheritException(exception,&(*images)->exception);
-            break;
-          }
-#endif
         break;
       }
       case 'd':
@@ -7539,8 +7551,8 @@ This has been merged completely into MogrifyImage()
               op;
 
             (void) SyncImageSettings(mogrify_info,*images);
-            op=(MagickEvaluateOperator) ParseCommandOption(MagickEvaluateOptions,
-              MagickFalse,argv[i+1]);
+            op=(MagickEvaluateOperator) ParseCommandOption(
+              MagickEvaluateOptions,MagickFalse,argv[i+1]);
             evaluate_image=EvaluateImages(*images,op,exception);
             if (evaluate_image == (Image *) NULL)
               {
@@ -7695,6 +7707,12 @@ This has been merged completely into MogrifyImage()
             *images=GetFirstImageInList(q);
             break;
           }
+        if (LocaleCompare("interpolate",option+1) == 0)
+          {
+            interpolate_method=(PixelInterpolateMethod) ParseCommandOption(
+              MagickInterpolateOptions,MagickFalse,argv[i+1]);
+            break;
+          }
         break;
       }
       case 'l':
@@ -7775,7 +7793,6 @@ This has been merged completely into MogrifyImage()
                     status=MagickFalse;
                     break;
                   }
-                InheritException(exception,&layers->exception);
                 *images=DestroyImageList(*images);
                 *images=layers;
                 layers=OptimizeImageLayers(*images,exception);
@@ -7784,13 +7801,12 @@ This has been merged completely into MogrifyImage()
                     status=MagickFalse;
                     break;
                   }
-                InheritException(exception,&layers->exception);
                 *images=DestroyImageList(*images);
                 *images=layers;
                 layers=(Image *) NULL;
                 OptimizeImageTransparency(*images,exception);
-                InheritException(exception,&(*images)->exception);
-                (void) RemapImages(quantize_info,*images,(Image *) NULL);
+                (void) RemapImages(quantize_info,*images,(Image *) NULL,
+                  exception);
                 break;
               }
               case CompositeLayer:
@@ -7876,8 +7892,8 @@ This has been merged completely into MogrifyImage()
             (void) SyncImagesSettings(mogrify_info,*images);
             if (*option == '+')
               {
-                (void) RemapImages(quantize_info,*images,(Image *) NULL);
-                InheritException(exception,&(*images)->exception);
+                (void) RemapImages(quantize_info,*images,(Image *) NULL,
+                  exception);
                 break;
               }
             i++;
@@ -7964,10 +7980,10 @@ This has been merged completely into MogrifyImage()
               *string;
 
             (void) SyncImagesSettings(mogrify_info,*images);
-            string=InterpretImageProperties(mogrify_info,*images,argv[i+1]);
+            string=InterpretImageProperties(mogrify_info,*images,argv[i+1],
+              exception);
             if (string == (char *) NULL)
               break;
-            InheritException(exception,&(*images)->exception);
             (void) FormatLocaleFile(stdout,"%s",string);
             string=DestroyString(string);
           }
@@ -8244,7 +8260,7 @@ WandExport MagickBooleanType MogrifyImages(ImageInfo *image_info,
   */
   i=0;
   n=GetImageListLength(*images);
-  for (;;)
+  for ( ; ; )
   {
 #if 0
   (void) FormatLocaleFile(stderr,"mogrify %ld of %ld\n",(long)