]> granicus.if.org Git - imagemagick/blobdiff - PerlMagick/Magick.xs
...
[imagemagick] / PerlMagick / Magick.xs
index f7cf876002adf145afc58ce23f0fc02308cfd298..cc1661358b6450391570b898574826721553a143 100644 (file)
 %                                                                             %
 %                            Software Design                                  %
 %                              Kyle Shorter                                   %
-%                              John Cristy                                    %
+%                                 Cristy                                      %
 %                             February 1997                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2017 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  %
@@ -53,11 +53,11 @@ extern "C" {
 #endif
 
 #define PERL_NO_GET_CONTEXT
+#include <MagickCore/MagickCore.h>
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
 #include <math.h>
-#include <MagickCore/MagickCore.h>
 #undef tainted
 
 #if defined(__cplusplus) || defined(c_plusplus)
@@ -74,6 +74,7 @@ extern "C" {
 #endif
 #define DegreesToRadians(x)  (MagickPI*(x)/180.0)
 #define EndOf(array)  (&array[NumberOf(array)])
+#define MagickPI  3.14159265358979323846264338327950288419716939937510
 #define MaxArguments  33
 #ifndef na
 #define na  PL_na
@@ -112,11 +113,11 @@ extern "C" {
 #define InheritPerlException(exception,perl_exception) \
 { \
   char \
-    message[MaxTextExtent]; \
+    message[MagickPathExtent]; \
  \
   if ((exception)->severity != UndefinedException) \
     { \
-      (void) FormatLocaleString(message,MaxTextExtent,"Exception %d: %s%s%s%s",\
+      (void) FormatLocaleString(message,MagickPathExtent,"Exception %d: %s%s%s%s",\
         (exception)->severity, (exception)->reason ? \
         GetLocaleExceptionMessage((exception)->severity,(exception)->reason) : \
         "Unknown", (exception)->description ? " (" : "", \
@@ -217,7 +218,7 @@ static struct
       {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
     { "Chop", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference}, {"x", IntegerReference},
-      {"y", IntegerReference} } },
+      {"y", IntegerReference}, {"gravity", MagickGravityOptions} } },
     { "Crop", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference}, {"x", IntegerReference},
       {"y", IntegerReference}, {"fuzz", StringReference},
@@ -419,8 +420,8 @@ static struct
       {"channel", MagickChannelOptions} } },
     { "WhiteThreshold", { {"threshold", StringReference},
       {"channel", MagickChannelOptions} } },
-    { "RadialBlur", { {"geometry", StringReference}, {"angle", RealReference},
-      {"channel", MagickChannelOptions} } },
+    { "RotationalBlur", { {"geometry", StringReference},
+      {"angle", RealReference}, {"channel", MagickChannelOptions} } },
     { "Thumbnail", { {"geometry", StringReference}, {"width", IntegerReference},
       {"height", IntegerReference} } },
     { "Strip", },
@@ -530,8 +531,6 @@ static struct
     { "Morphology", { {"kernel", StringReference},
       {"channel", MagickChannelOptions}, {"method", MagickMorphologyOptions},
       {"iterations", IntegerReference} } },
-    { "Sans", { {"matrix", ArrayReference} } },
-    { "Color", { {"color", StringReference} } },
     { "Mode", { {"geometry", StringReference},
       {"width", IntegerReference},{"height", IntegerReference},
       {"channel", MagickChannelOptions} } },
@@ -543,6 +542,28 @@ static struct
     { "Poly", { {"terms", ArrayReference},
       {"channel", MagickChannelOptions} } },
     { "Grayscale", { {"method", MagickNoiseOptions} } },
+    { "CannyEdge", { {"geometry", StringReference},
+      {"radius", RealReference}, {"sigma", RealReference},
+      {"lower-percent", RealReference}, {"upper-percent", RealReference} } },
+    { "HoughLine", { {"geometry", StringReference},
+      {"width", IntegerReference}, {"height", IntegerReference},
+      {"threshold", IntegerReference} } },
+    { "MeanShift", { {"geometry", StringReference},
+      {"width", IntegerReference}, {"height", IntegerReference},
+      {"distance", RealReference} } },
+    { "Kuwahara", { {"geometry", StringReference}, {"radius", RealReference},
+      {"sigma", RealReference}, {"channel", MagickChannelOptions} } },
+    { "ConnectedComponents", { {"connectivity", IntegerReference} } },
+    { "CopyPixels", { {"image", ImageReference}, {"geometry", StringReference},
+      {"width", IntegerReference}, {"height", IntegerReference},
+      {"x", IntegerReference}, {"y", IntegerReference},
+      {"gravity", MagickGravityOptions}, {"offset", StringReference}, 
+      {"dx", IntegerReference}, {"dy", IntegerReference} } },
+    { "Color", { {"color", StringReference} } },
+    { "WaveletDenoise", {  {"geometry", StringReference},
+      {"threshold", RealReference}, {"softness", RealReference},
+      {"channel", MagickChannelOptions} } },
+    { "Colorspace", { {"colorspace", MagickColorspaceOptions} } },
   };
 
 static SplayTreeInfo
@@ -973,7 +994,7 @@ static struct PackageInfo *GetPackageInfo(pTHX_ void *reference,
   struct PackageInfo *package_info,ExceptionInfo *exception)
 {
   char
-    message[MaxTextExtent];
+    message[MagickPathExtent];
 
   struct PackageInfo
     *clone_info;
@@ -981,7 +1002,7 @@ static struct PackageInfo *GetPackageInfo(pTHX_ void *reference,
   SV
     *sv;
 
-  (void) FormatLocaleString(message,MaxTextExtent,"%s::package%s%p",
+  (void) FormatLocaleString(message,MagickPathExtent,"%s::package%s%p",
     PackageName,XS_VERSION,reference);
   sv=perl_get_sv(message,(TRUE | 0x02));
   if (sv == (SV *) NULL)
@@ -1227,7 +1248,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)
-            SetImageMask(image,clip_mask,exception);
+            SetImageMask(image,ReadPixelMask,clip_mask,exception);
           break;
         }
       if (LocaleNCompare(attribute,"colormap",8) == 0)
@@ -1279,8 +1300,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
               break;
             }
           for ( ; image; image=image->next)
-            (void) TransformImageColorspace(image,(ColorspaceType) sp,
-              exception);
+            (void) SetImageColorspace(image,(ColorspaceType) sp,exception);
           break;
         }
       if (LocaleCompare(attribute,"comment") == 0)
@@ -1456,10 +1476,10 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
         {
           if (info)
             (void) CopyMagickString(info->image_info->filename,SvPV(sval,na),
-              MaxTextExtent);
+              MagickPathExtent);
           for ( ; image; image=image->next)
             (void) CopyMagickString(image->filename,SvPV(sval,na),
-              MaxTextExtent);
+              MagickPathExtent);
           break;
         }
       if (LocaleCompare(attribute,"file") == 0)
@@ -1655,10 +1675,10 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"magick") == 0)
         {
           if (info)
-            (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
+            (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
               "%s:",SvPV(sval,na));
           for ( ; image; image=image->next)
-            (void) CopyMagickString(image->magick,SvPV(sval,na),MaxTextExtent);
+            (void) CopyMagickString(image->magick,SvPV(sval,na),MagickPathExtent);
           break;
         }
       if (LocaleCompare(attribute,"map-limit") == 0)
@@ -1682,7 +1702,7 @@ 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,exception);
+            SetImageMask(image,ReadPixelMask,mask,exception);
           break;
         }
       if (LocaleCompare(attribute,"mattecolor") == 0)
@@ -1690,9 +1710,9 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           (void) QueryColorCompliance(SvPV(sval,na),AllCompliance,&target_color,
             exception);
           if (info)
-            info->image_info->matte_color=target_color;
+            info->image_info->alpha_color=target_color;
           for ( ; image; image=image->next)
-            image->matte_color=target_color;
+            image->alpha_color=target_color;
           break;
         }
       if (LocaleCompare(attribute,"matte") == 0)
@@ -1855,20 +1875,6 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
             }
           break;
         }
-      if (LocaleCompare(attribute,"preview") == 0)
-        {
-          sp=SvPOK(sval) ? ParseCommandOption(MagickPreviewOptions,MagickFalse,
-            SvPV(sval,na)) : SvIV(sval);
-          if (sp < 0)
-            {
-              ThrowPerlException(exception,OptionError,"UnrecognizedType",
-                SvPV(sval,na));
-              break;
-            }
-          if (info)
-            info->image_info->preview_type=(PreviewType) sp;
-          break;
-        }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
@@ -1895,6 +1901,18 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
     case 'R':
     case 'r':
     {
+      if (LocaleCompare(attribute,"read-mask") == 0)
+        {
+          Image
+            *mask;
+
+          mask=(Image *) NULL;
+          if (SvPOK(sval))
+            mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
+          for ( ; image; image=image->next)
+            SetImageMask(image,ReadPixelMask,mask,exception);
+          break;
+        }
       if (LocaleCompare(attribute,"red-primary") == 0)
         {
           for ( ; image; image=image->next)
@@ -2168,12 +2186,6 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
             info->image_info->verbose=sp != 0 ? MagickTrue : MagickFalse;
           break;
         }
-      if (LocaleCompare(attribute,"view") == 0)
-        {
-          if (info)
-            (void) CloneString(&info->image_info->view,SvPV(sval,na));
-          break;
-        }
       if (LocaleCompare(attribute,"virtual-pixel") == 0)
         {
           sp=SvPOK(sval) ? ParseCommandOption(MagickVirtualPixelOptions,
@@ -2210,6 +2222,18 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
           }
           break;
         }
+      if (LocaleCompare(attribute,"write-mask") == 0)
+        {
+          Image
+            *mask;
+
+          mask=(Image *) NULL;
+          if (SvPOK(sval))
+            mask=SetupList(aTHX_ SvRV(sval),&info,(SV ***) NULL,exception);
+          for ( ; image; image=image->next)
+            SetImageMask(image,WritePixelMask,mask,exception);
+          break;
+        }
       if (info)
         SetImageOption(info->image_info,attribute,SvPV(sval,na));
       for ( ; image; image=image->next)
@@ -2662,11 +2686,11 @@ Average(ref)
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
-      "average-%.*s",(int) (MaxTextExtent-9),
+    (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
+      "average-%.*s",(int) (MagickPathExtent-9),
       ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
     (void) CopyMagickString(image->filename,info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
@@ -2863,7 +2887,7 @@ ChannelFx(ref,...)
 
     char
       *attribute,
-      expression[MaxTextExtent];
+      expression[MagickPathExtent];
 
     ChannelType
       channel,
@@ -2921,9 +2945,9 @@ ChannelFx(ref,...)
       Get options.
     */
     channel=DefaultChannels;
-    (void) CopyMagickString(expression,"u",MaxTextExtent);
+    (void) CopyMagickString(expression,"u",MagickPathExtent);
     if (items == 2)
-      (void) CopyMagickString(expression,(char *) SvPV(ST(1),na),MaxTextExtent);
+      (void) CopyMagickString(expression,(char *) SvPV(ST(1),na),MagickPathExtent);
     else
       for (i=2; i < items; i+=2)
       {
@@ -2958,7 +2982,7 @@ ChannelFx(ref,...)
             if (LocaleCompare(attribute,"expression") == 0)
               {
                 (void) CopyMagickString(expression,SvPV(ST(i),na),
-                  MaxTextExtent);
+                  MagickPathExtent);
                 break;
               }
             ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -3330,7 +3354,7 @@ Compare(ref,...)
                     "UnrecognizedType",SvPV(ST(i),na));
                   return;
                 }
-              SetPixelChannelMask(image,(ChannelType) option);
+              (void) SetPixelChannelMask(image,(ChannelType) option);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -3552,11 +3576,11 @@ ComplexImages(ref)
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
-      "complex-%.*s",(int) (MaxTextExtent-9),
+    (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
+      "complex-%.*s",(int) (MagickPathExtent-9),
       ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
     (void) CopyMagickString(image->filename,info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
@@ -3736,7 +3760,7 @@ DESTROY(ref)
       case SVt_PVAV:
       {
         char
-          message[MaxTextExtent];
+          message[MagickPathExtent];
 
         const SV
           *key;
@@ -3756,7 +3780,7 @@ DESTROY(ref)
         /*
           Array (AV *) reference
         */
-        (void) FormatLocaleString(message,MaxTextExtent,"package%s%p",
+        (void) FormatLocaleString(message,MagickPathExtent,"package%s%p",
           XS_VERSION,reference);
         hv=gv_stashpv(PackageName, FALSE);
         if (!hv)
@@ -4009,11 +4033,11 @@ EvaluateImages(ref)
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
-      "evaluate-%.*s",(int) (MaxTextExtent-9),
+    (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
+      "evaluate-%.*s",(int) (MagickPathExtent-9),
       ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
     (void) CopyMagickString(image->filename,info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
@@ -4051,46 +4075,46 @@ Features(ref,...)
   {
 #define ChannelFeatures(channel,direction) \
 { \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].angular_second_moment[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].contrast[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].contrast[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].variance_sum_of_squares[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].inverse_difference_moment[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].sum_average[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].sum_variance[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].sum_entropy[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].entropy[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].difference_variance[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].difference_entropy[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].measure_of_correlation_1[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].measure_of_correlation_2[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_features[channel].maximum_correlation_coefficient[direction]); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
 }
@@ -4100,7 +4124,7 @@ Features(ref,...)
 
     char
       *attribute,
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     ChannelFeatures
       *channel_features;
@@ -4148,8 +4172,7 @@ Features(ref,...)
           PackageName);
         goto PerlException;
       }
-    info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    distance=1;
+    distance=1.0;
     for (i=2; i < items; i+=2)
     {
       attribute=(char *) SvPV(ST(i-1),na);
@@ -4178,20 +4201,24 @@ Features(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
+      register ssize_t
+        j;
+
       channel_features=GetImageFeatures(image,distance,exception);
       if (channel_features == (ChannelFeatures *) NULL)
         continue;
       count++;
-      EXTEND(sp,75*count);
-      for (i=0; i < 4; i++)
+      for (j=0; j < 4; j++)
       {
-        ChannelFeatures(RedChannel,i);
-        ChannelFeatures(GreenChannel,i);
-        ChannelFeatures(BlueChannel,i);
-        if (image->colorspace == CMYKColorspace)
-          ChannelFeatures(BlackChannel,i);
-        if (image->alpha_trait == BlendPixelTrait)
-          ChannelFeatures(AlphaChannel,i);
+        for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+        {
+          PixelChannel channel=GetPixelChannelChannel(image,i);
+          PixelTrait traits=GetPixelChannelTraits(image,channel);
+          if (traits == UndefinedPixelTrait)
+            continue;
+          EXTEND(sp,14*(i+1)*count);
+          ChannelFeatures(channel,j);
+        }
       }
       channel_features=(ChannelFeatures *)
         RelinquishMagickMemory(channel_features);
@@ -4321,11 +4348,11 @@ Flatten(ref)
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
     info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    (void) FormatLocaleString(info->image_info->filename,MaxTextExtent,
-      "flatten-%.*s",(int) (MaxTextExtent-9),
+    (void) FormatLocaleString(info->image_info->filename,MagickPathExtent,
+      "flatten-%.*s",(int) (MagickPathExtent-9),
       ((p=strrchr(image->filename,'/')) ? p+1 : image->filename));
     (void) CopyMagickString(image->filename,info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
@@ -4366,7 +4393,7 @@ Fx(ref,...)
 
     char
       *attribute,
-      expression[MaxTextExtent];
+      expression[MagickPathExtent];
 
     ChannelType
       channel,
@@ -4424,9 +4451,9 @@ Fx(ref,...)
       Get options.
     */
     channel=DefaultChannels;
-    (void) CopyMagickString(expression,"u",MaxTextExtent);
+    (void) CopyMagickString(expression,"u",MagickPathExtent);
     if (items == 2)
-      (void) CopyMagickString(expression,(char *) SvPV(ST(1),na),MaxTextExtent);
+      (void) CopyMagickString(expression,(char *) SvPV(ST(1),na),MagickPathExtent);
     else
       for (i=2; i < items; i+=2)
       {
@@ -4461,7 +4488,7 @@ Fx(ref,...)
             if (LocaleCompare(attribute,"expression") == 0)
               {
                 (void) CopyMagickString(expression,SvPV(ST(i),na),
-                  MaxTextExtent);
+                  MagickPathExtent);
                 break;
               }
             ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -4528,7 +4555,7 @@ Get(ref,...)
   {
     char
       *attribute,
-      color[MaxTextExtent];
+      color[MagickPathExtent];
 
     const char
       *value;
@@ -4633,10 +4660,11 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,
-                "%.20g,%.20g,%.20g,%.20g",image->background_color.red,
-                image->background_color.green,image->background_color.blue,
-                image->background_color.alpha);
+              (void) FormatLocaleString(color,MagickPathExtent,
+                "%.20g,%.20g,%.20g,%.20g",(double) image->background_color.red,
+                (double) image->background_color.green,
+                (double) image->background_color.blue,
+                (double) image->background_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4680,7 +4708,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
+              (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
                 image->chromaticity.blue_primary.x,
                 image->chromaticity.blue_primary.y);
               s=newSVpv(color,0);
@@ -4691,10 +4719,11 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,
-                "%.20g,%.20g,%.20g,%.20g",image->border_color.red,
-                image->border_color.green,image->border_color.blue,
-                image->border_color.alpha);
+              (void) FormatLocaleString(color,MagickPathExtent,
+                "%.20g,%.20g,%.20g,%.20g",(double) image->border_color.red,
+                (double) image->border_color.green,
+                (double) image->border_color.blue,
+                (double) image->border_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4702,7 +4731,7 @@ Get(ref,...)
           if (LocaleCompare(attribute,"bounding-box") == 0)
             {
               char
-                geometry[MaxTextExtent];
+                geometry[MagickPathExtent];
 
               RectangleInfo
                 page;
@@ -4710,7 +4739,7 @@ Get(ref,...)
               if (image == (Image *) NULL)
                 break;
               page=GetImageBoundingBox(image,exception);
-              (void) FormatLocaleString(geometry,MaxTextExtent,
+              (void) FormatLocaleString(geometry,MagickPathExtent,
                 "%.20gx%.20g%+.20g%+.20g",(double) page.width,(double)
                 page.height,(double) page.x,(double) page.y);
               s=newSVpv(geometry,0);
@@ -4748,7 +4777,7 @@ Get(ref,...)
                   sv=NULL;
                   if (image->read_mask == MagickFalse)
                     ClipImage(image,exception);
-                  mask_image=GetImageMask(image,exception);
+                  mask_image=GetImageMask(image,ReadPixelMask,exception);
                   if (mask_image != (Image *) NULL)
                     {
                       AddImageToRegistry(sv,mask_image);
@@ -4771,7 +4800,7 @@ Get(ref,...)
                   sv=NULL;
                   if (image->read_mask != MagickFalse)
                     ClipImage(image,exception);
-                  mask_image=GetImageMask(image,exception);
+                  mask_image=GetImageMask(image,ReadPixelMask,exception);
                   if (mask_image != (Image *) NULL)
                     {
                       AddImageToRegistry(sv,mask_image);
@@ -4825,10 +4854,11 @@ Get(ref,...)
               (void) items;
               if (j > (ssize_t) image->colors)
                 j%=image->colors;
-              (void) FormatLocaleString(color,MaxTextExtent,
-                "%.20g,%.20g,%.20g,%.20g",image->colormap[j].red,
-                image->colormap[j].green,image->colormap[j].blue,
-                image->colormap[j].alpha);
+              (void) FormatLocaleString(color,MagickPathExtent,
+                "%.20g,%.20g,%.20g,%.20g",(double) image->colormap[j].red,
+                (double) image->colormap[j].green,
+                (double) image->colormap[j].blue,
+                (double) image->colormap[j].alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -4867,11 +4897,11 @@ Get(ref,...)
           if (LocaleCompare(attribute,"density") == 0)
             {
               char
-                geometry[MaxTextExtent];
+                geometry[MagickPathExtent];
 
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(geometry,MaxTextExtent,"%.15gx%.15g",
+              (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",
                 image->resolution.x,image->resolution.y);
               s=newSVpv(geometry,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -5063,7 +5093,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
+              (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
                 image->chromaticity.green_primary.x,
                 image->chromaticity.green_primary.y);
               s=newSVpv(color,0);
@@ -5126,7 +5156,7 @@ Get(ref,...)
               if (image != (Image *) NULL)
                 {
                   char
-                    key[MaxTextExtent];
+                    key[MagickPathExtent];
 
                   MagickBooleanType
                     status;
@@ -5134,7 +5164,7 @@ Get(ref,...)
                   static ssize_t
                     id = 0;
 
-                  (void) FormatLocaleString(key,MaxTextExtent,"%.20g\n",(double)
+                  (void) FormatLocaleString(key,MagickPathExtent,"%.20g\n",(double)
                     id);
                   status=SetImageRegistry(ImageRegistryType,key,image,
                     exception);
@@ -5147,7 +5177,7 @@ Get(ref,...)
           if (LocaleNCompare(attribute,"index",5) == 0)
             {
               char
-                name[MaxTextExtent];
+                name[MagickPathExtent];
 
               int
                 items;
@@ -5174,7 +5204,7 @@ Get(ref,...)
               p=GetCacheViewVirtualPixels(image_view,x,y,1,1,exception);
               if (p != (const Quantum *) NULL)
                 {
-                  (void) FormatLocaleString(name,MaxTextExtent,QuantumFormat,
+                  (void) FormatLocaleString(name,MagickPathExtent,QuantumFormat,
                     GetPixelIndex(image,p));
                   s=newSVpv(name,0);
                   PUSHs(s ? sv_2mortal(s) : &sv_undef);
@@ -5297,10 +5327,11 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,
-                "%.20g,%.20g,%.20g,%.20g",image->matte_color.red,
-                image->matte_color.green,image->matte_color.blue,
-                image->matte_color.alpha);
+              (void) FormatLocaleString(color,MagickPathExtent,
+                "%.20g,%.20g,%.20g,%.20g",(double) image->alpha_color.red,
+                (double) image->alpha_color.green,
+                (double) image->alpha_color.blue,
+                (double) image->alpha_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5308,7 +5339,7 @@ Get(ref,...)
           if (LocaleCompare(attribute,"matte") == 0)
             {
               if (image != (Image *) NULL)
-                s=newSViv((ssize_t) image->alpha_trait == BlendPixelTrait ?
+                s=newSViv((ssize_t) image->alpha_trait != UndefinedPixelTrait ?
                   1 : 0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5340,7 +5371,7 @@ Get(ref,...)
               if (image == (Image *) NULL)
                 continue;
               j=info ? info->image_info->monochrome :
-                IsImageMonochrome(image,exception);
+                SetImageMonochrome(image,exception);
               s=newSViv(j);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5384,9 +5415,9 @@ Get(ref,...)
               if (image != (Image *) NULL)
                 {
                   char
-                    geometry[MaxTextExtent];
+                    geometry[MagickPathExtent];
 
-                  (void) FormatLocaleString(geometry,MaxTextExtent,
+                  (void) FormatLocaleString(geometry,MagickPathExtent,
                     "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,
                     (double) image->page.height,(double) image->page.x,(double)
                     image->page.y);
@@ -5412,7 +5443,7 @@ Get(ref,...)
           if (LocaleNCompare(attribute,"pixel",5) == 0)
             {
               char
-                tuple[MaxTextExtent];
+                tuple[MagickPathExtent];
 
               int
                 items;
@@ -5432,12 +5463,12 @@ Get(ref,...)
               (void) items;
               p=GetVirtualPixels(image,x,y,1,1,exception);
               if (image->colorspace != CMYKColorspace)
-                (void) FormatLocaleString(tuple,MaxTextExtent,QuantumFormat ","
+                (void) FormatLocaleString(tuple,MagickPathExtent,QuantumFormat ","
                   QuantumFormat "," QuantumFormat "," QuantumFormat,
                   GetPixelRed(image,p),GetPixelGreen(image,p),
                   GetPixelBlue(image,p),GetPixelAlpha(image,p));
               else
-                (void) FormatLocaleString(tuple,MaxTextExtent,QuantumFormat ","
+                (void) FormatLocaleString(tuple,MagickPathExtent,QuantumFormat ","
                   QuantumFormat "," QuantumFormat "," QuantumFormat ","
                   QuantumFormat,GetPixelRed(image,p),GetPixelGreen(image,p),
                   GetPixelBlue(image,p),GetPixelBlack(image,p),
@@ -5453,15 +5484,6 @@ Get(ref,...)
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
-          if (LocaleCompare(attribute,"preview") == 0)
-            {
-              s=newSViv(info->image_info->preview_type);
-              (void) sv_setpv(s,CommandOptionToMnemonic(MagickPreviewOptions,
-                info->image_info->preview_type));
-              SvIOK_on(s);
-              PUSHs(s ? sv_2mortal(s) : &sv_undef);
-              continue;
-            }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
             attribute);
           break;
@@ -5505,7 +5527,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
+              (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
                 image->chromaticity.red_primary.x,
                 image->chromaticity.red_primary.y);
               s=newSVpv(color,0);
@@ -5608,10 +5630,11 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,
-                "%.20g,%.20g,%.20g,%.20g",image->transparent_color.red,
-                image->transparent_color.green,image->transparent_color.blue,
-                image->transparent_color.alpha);
+              (void) FormatLocaleString(color,MagickPathExtent,
+                "%.20g,%.20g,%.20g,%.20g",(double) image->transparent_color.red,
+                (double) image->transparent_color.green,
+                (double) image->transparent_color.blue,
+                (double) image->transparent_color.alpha);
               s=newSVpv(color,0);
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
@@ -5620,7 +5643,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              j=(ssize_t) GetImageType(image,exception);
+              j=(ssize_t) GetImageType(image);
               s=newSViv(j);
               (void) sv_setpv(s,CommandOptionToMnemonic(MagickTypeOptions,j));
               SvIOK_on(s);
@@ -5678,13 +5701,6 @@ Get(ref,...)
               PUSHs(s ? sv_2mortal(s) : &sv_undef);
               continue;
             }
-          if (LocaleCompare(attribute,"view") == 0)
-            {
-              if (info && info->image_info->view)
-                s=newSVpv(info->image_info->view,0);
-              PUSHs(s ? sv_2mortal(s) : &sv_undef);
-              continue;
-            }
           if (LocaleCompare(attribute,"virtual-pixel") == 0)
             {
               if (image == (Image *) NULL)
@@ -5708,7 +5724,7 @@ Get(ref,...)
             {
               if (image == (Image *) NULL)
                 break;
-              (void) FormatLocaleString(color,MaxTextExtent,"%.15g,%.15g",
+              (void) FormatLocaleString(color,MagickPathExtent,"%.20g,%.20g",
                 image->chromaticity.white_point.x,
                 image->chromaticity.white_point.y);
               s=newSVpv(color,0);
@@ -5729,6 +5745,21 @@ Get(ref,...)
         case 'X':
         case 'x':
         {
+          if (LocaleCompare(attribute,"xmp") == 0)
+            {
+              if (image != (Image *) NULL)
+                {
+                  const StringInfo
+                    *profile;
+
+                  profile=GetImageProfile(image,"xmp");
+                  if (profile != (StringInfo *) NULL)
+                    s=newSVpv((const char *) GetStringInfoDatum(profile),
+                      GetStringInfoLength(profile));
+                }
+              PUSHs(s ? sv_2mortal(s) : &sv_undef);
+              continue;
+            }
           if (LocaleCompare(attribute,"x-resolution") == 0)
             {
               if (image != (Image *) NULL)
@@ -6266,7 +6297,7 @@ Histogram(ref,...)
       *av;
 
     char
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     PixelInfo
       *histogram;
@@ -6314,7 +6345,6 @@ Histogram(ref,...)
           PackageName);
         goto PerlException;
       }
-    info=GetPackageInfo(aTHX_ (void *) av,info,exception);
     count=0;
     for ( ; image; image=image->next)
     {
@@ -6325,25 +6355,25 @@ Histogram(ref,...)
       EXTEND(sp,6*count);
       for (i=0; i < (ssize_t) number_colors; i++)
       {
-        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
+        (void) FormatLocaleString(message,MagickPathExtent,"%.20g",
           histogram[i].red);
         PUSHs(sv_2mortal(newSVpv(message,0)));
-        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
+        (void) FormatLocaleString(message,MagickPathExtent,"%.20g",
           histogram[i].green);
         PUSHs(sv_2mortal(newSVpv(message,0)));
-        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
+        (void) FormatLocaleString(message,MagickPathExtent,"%.20g",
           histogram[i].blue);
         PUSHs(sv_2mortal(newSVpv(message,0)));
         if (image->colorspace == CMYKColorspace)
           {
-            (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
+            (void) FormatLocaleString(message,MagickPathExtent,"%.20g",
               histogram[i].black);
             PUSHs(sv_2mortal(newSVpv(message,0)));
           }
-        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",
+        (void) FormatLocaleString(message,MagickPathExtent,"%.20g",
           histogram[i].alpha);
         PUSHs(sv_2mortal(newSVpv(message,0)));
-        (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double)
+        (void) FormatLocaleString(message,MagickPathExtent,"%.20g",(double)
           histogram[i].count);
         PUSHs(sv_2mortal(newSVpv(message,0)));
       }
@@ -6452,7 +6482,7 @@ GetPixel(ref,...)
                     SvPV(ST(i),na));
                   return;
                 }
-              SetPixelChannelMask(image,(ChannelType) option);
+              (void) SetPixelChannelMask(image,(ChannelType) option);
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
@@ -6624,12 +6654,12 @@ GetPixels(ref,...)
         goto PerlException;
       }
     map="RGB";
-    if (image->alpha_trait == BlendPixelTrait)
+    if (image->alpha_trait != UndefinedPixelTrait)
       map="RGBA";
     if (image->colorspace == CMYKColorspace)
       {
         map="CMYK";
-        if (image->alpha_trait == BlendPixelTrait)
+        if (image->alpha_trait != UndefinedPixelTrait)
           map="CMYKA";
       }
     normalize=MagickFalse;
@@ -6824,7 +6854,7 @@ ImageToBlob(ref,...)
   PPCODE:
   {
     char
-      filename[MaxTextExtent];
+      filename[MagickPathExtent];
 
     ExceptionInfo
       *exception;
@@ -6876,11 +6906,11 @@ ImageToBlob(ref,...)
     for (i=2; i < items; i+=2)
       SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),exception);
     (void) CopyMagickString(filename,package_info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     scene=0;
     for (next=image; next; next=next->next)
     {
-      (void) CopyMagickString(next->filename,filename,MaxTextExtent);
+      (void) CopyMagickString(next->filename,filename,MagickPathExtent);
       next->scene=scene++;
     }
     SetImageInfo(package_info->image_info,(unsigned int)
@@ -7410,8 +7440,8 @@ Mogrify(ref,...)
     BlackThresholdImage= 160
     WhiteThreshold     = 161
     WhiteThresholdImage= 162
-    RadialBlur         = 163
-    RadialBlurImage    = 164
+    RotationalBlur     = 163
+    RotationalBlurImage= 164
     Thumbnail          = 165
     ThumbnailImage     = 166
     Strip              = 167
@@ -7512,18 +7542,34 @@ Mogrify(ref,...)
     BrightnessContrastImage = 262
     Morphology         = 263
     MorphologyImage    = 264
-    Color              = 265
-    ColorImage         = 266
-    Mode               = 267
-    ModeImage          = 268
-    Statistic          = 269
-    StatisticImage     = 270
-    Perceptible        = 271
-    PerceptibleImage   = 272
-    Poly               = 273
-    PolyImage          = 274
-    Grayscale          = 275
-    GrayscaleImage     = 276
+    Mode               = 265
+    ModeImage          = 266
+    Statistic          = 267
+    StatisticImage     = 268
+    Perceptible        = 269
+    PerceptibleImage   = 270
+    Poly               = 271
+    PolyImage          = 272
+    Grayscale          = 273
+    GrayscaleImage     = 274
+    CannyEdge          = 275
+    CannyEdgeImage     = 276
+    HoughLine          = 277
+    HoughLineImage     = 278
+    MeanShift          = 279
+    MeanShiftImage     = 280
+    Kuwahara           = 281
+    KuwaharaImage      = 282
+    ConnectedComponent = 283
+    ConnectedComponentImage = 284
+    CopyPixels         = 285
+    CopyImagePixels    = 286
+    Color              = 287
+    ColorImage         = 288
+    WaveletDenoise     = 289
+    WaveletDenoiseImage= 290
+    Colorspace         = 291
+    ColorspaceImage    = 292
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -7533,7 +7579,7 @@ Mogrify(ref,...)
 
     char
       attribute_flag[MaxArguments],
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     ChannelType
       channel,
@@ -7707,7 +7753,7 @@ Mogrify(ref,...)
         {
           if (SvTYPE(sv) != SVt_RV)
             {
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "invalid %.60s value",pp->method);
               ThrowPerlException(exception,OptionError,message,SvPV(sv,na));
               goto continue_outer_loop;
@@ -7767,7 +7813,7 @@ Mogrify(ref,...)
             al->integer_reference=ParseChannelOption(SvPV(sv,na));
           if ((al->integer_reference < 0) && ((al->integer_reference=SvIV(sv)) <= 0))
             {
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "invalid %.60s value",pp->method);
               ThrowPerlException(exception,OptionError,message,SvPV(sv,na));
               goto continue_outer_loop;
@@ -7795,7 +7841,7 @@ Mogrify(ref,...)
       {
         default:
         {
-          (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double) ix);
+          (void) FormatLocaleString(message,MagickPathExtent,"%.20g",(double) ix);
           ThrowPerlException(exception,OptionError,
             "UnrecognizedPerlMagickMethod",message);
           goto PerlException;
@@ -7906,6 +7952,8 @@ Mogrify(ref,...)
         }
         case 7:  /* Chop */
         {
+          if (attribute_flag[5] != 0)
+            image->gravity=(GravityType) argument_list[5].integer_reference;
           if (attribute_flag[0] != 0)
             flags=ParseGravityGeometry(image,argument_list[0].string_reference,
               &geometry,exception);
@@ -8021,7 +8069,7 @@ Mogrify(ref,...)
           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;
+            image->alpha_color=fill_color;
           compose=image->compose;
           if (attribute_flag[7] != 0)
             compose=(CompositeOperator) argument_list[7].integer_reference;
@@ -8126,8 +8174,8 @@ Mogrify(ref,...)
             {
               QueryColorCompliance(argument_list[1].string_reference,
                 AllCompliance,&image->background_color,exception);
-              if ((image->background_color.alpha_trait == BlendPixelTrait) &&
-                  (image->alpha_trait != BlendPixelTrait))
+              if ((image->background_color.alpha_trait != UndefinedPixelTrait) &&
+                  (image->alpha_trait == UndefinedPixelTrait))
                 (void) SetImageAlpha(image,OpaqueAlpha,exception);
             }
           image=RotateImage(image,argument_list[0].real_reference,exception);
@@ -8230,7 +8278,7 @@ Mogrify(ref,...)
           method=UndefinedInterpolatePixel;
           if (attribute_flag[1] != 0)
             method=(PixelInterpolateMethod) argument_list[1].integer_reference;
-          image=SpreadImage(image,argument_list[0].real_reference,method,
+          image=SpreadImage(image,method,argument_list[0].real_reference,
             exception);
           break;
         }
@@ -8264,7 +8312,7 @@ Mogrify(ref,...)
             SetImageArtifact(image,"filter:support",
               argument_list[4].string_reference);
           image=ResizeImage(image,geometry.width,geometry.height,
-            (FilterTypes) argument_list[3].integer_reference,
+            (FilterType) argument_list[3].integer_reference,
             exception);
           break;
         }
@@ -8437,9 +8485,9 @@ Mogrify(ref,...)
           if ((attribute_flag[9] != 0) || (attribute_flag[10] != 0))
             {
               char
-                geometry[MaxTextExtent];
+                geometry[MagickPathExtent];
 
-              (void) FormatLocaleString(geometry,MaxTextExtent,"%+f%+f",
+              (void) FormatLocaleString(geometry,MagickPathExtent,"%+f%+f",
                 (double) argument_list[9].real_reference+draw_info->affine.tx,
                 (double) argument_list[10].real_reference+draw_info->affine.ty);
               (void) CloneString(&draw_info->geometry,geometry);
@@ -8533,7 +8581,7 @@ Mogrify(ref,...)
         case 35:  /* Composite */
         {
           char
-            composite_geometry[MaxTextExtent];
+            composite_geometry[MagickPathExtent];
 
           Image
             *composite_image,
@@ -8591,7 +8639,7 @@ Mogrify(ref,...)
                   opacity=(Quantum) StringToDoubleInterval(
                     argument_list[6].string_reference,(double) QuantumRange+
                     1.0);
-                  if (composite_image->alpha_trait == BlendPixelTrait)
+                  if (composite_image->alpha_trait != UndefinedPixelTrait)
                     (void) SetImageAlpha(composite_image,OpaqueAlpha,exception);
                   composite_view=AcquireAuthenticCacheView(composite_image,exception);
                   for (y=0; y < (ssize_t) composite_image->rows ; y++)
@@ -8713,7 +8761,8 @@ Mogrify(ref,...)
                   */
                   mask_image=CloneImage(argument_list[10].image_reference,0,0,
                     MagickTrue,exception);
-                  (void) SetImageMask(composite_image,mask_image,exception);
+                  (void) SetImageMask(composite_image,ReadPixelMask,mask_image,
+                    exception);
                   mask_image=DestroyImage(mask_image);
                 }
             }
@@ -8722,7 +8771,7 @@ Mogrify(ref,...)
           /*
             Composite two images (normal composition).
           */
-          (void) FormatLocaleString(composite_geometry,MaxTextExtent,
+          (void) FormatLocaleString(composite_geometry,MagickPathExtent,
             "%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,
             (double) composite_image->rows,(double) geometry.x,(double)
             geometry.y);
@@ -8751,7 +8800,8 @@ Mogrify(ref,...)
                   (image->compose == DistortCompositeOp))
                 composite_image=DestroyImage(composite_image);
               else
-                (void) SetImageMask(image,(Image *) NULL,exception);
+                (void) SetImageMask(image,ReadPixelMask,(Image *) NULL,
+                  exception);
             }
           (void) SetImageChannelMask(image,channel_mask);
           break;
@@ -9034,8 +9084,8 @@ Mogrify(ref,...)
             argument_list[4].real_reference=1.0;
           if (attribute_flag[0] == 0)
             {
-              (void) FormatLocaleString(message,MaxTextExtent,
-                "%.15g,%.15g,%.15g",(double) argument_list[2].real_reference,
+              (void) FormatLocaleString(message,MagickPathExtent,
+                "%.20g,%.20g,%.20g",(double) argument_list[2].real_reference,
                 (double) argument_list[3].real_reference,
                 (double) argument_list[4].real_reference);
               argument_list[0].string_reference=message;
@@ -9084,7 +9134,7 @@ Mogrify(ref,...)
             geometry.x=argument_list[1].integer_reference;
           if (attribute_flag[2] != 0)
             geometry.y=argument_list[2].integer_reference;
-          if (image->alpha_trait != BlendPixelTrait)
+          if (image->alpha_trait == UndefinedPixelTrait)
             (void) SetImageAlpha(image,OpaqueAlpha,exception);
           (void) GetOneVirtualPixelInfo(image,UndefinedVirtualPixelMethod,
             geometry.x,geometry.y,&target,exception);
@@ -9111,7 +9161,7 @@ Mogrify(ref,...)
         case 43:  /* Modulate */
         {
           char
-            modulate[MaxTextExtent];
+            modulate[MagickPathExtent];
 
           geometry_info.rho=100.0;
           geometry_info.sigma=100.0;
@@ -9143,7 +9193,7 @@ Mogrify(ref,...)
               geometry_info.rho=argument_list[6].real_reference;
               SetImageArtifact(image,"modulate:colorspace","HWB");
             }
-          (void) FormatLocaleString(modulate,MaxTextExtent,"%.15g,%.15g,%.15g",
+          (void) FormatLocaleString(modulate,MagickPathExtent,"%.20g,%.20g,%.20g",
             geometry_info.rho,geometry_info.sigma,geometry_info.xi);
           (void) ModulateImage(image,modulate,exception);
           break;
@@ -9222,25 +9272,23 @@ Mogrify(ref,...)
             quantize_info->dither_method=(DitherMethod)
               argument_list[3].integer_reference;
           if (attribute_flag[4] != 0)
-            quantize_info->measure_error=argument_list[4].integer_reference !=
-              0 ? MagickTrue : MagickFalse;
-          if (attribute_flag[5] != 0)
-            (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,exception);
-              goto PerlException;
-            }
+            quantize_info->measure_error=
+              argument_list[4].integer_reference != 0 ? MagickTrue : MagickFalse;
           if (attribute_flag[6] != 0)
+            (void) QueryColorCompliance(argument_list[6].string_reference,
+              AllCompliance,&image->transparent_color,exception);
+          if (attribute_flag[7] != 0)
             quantize_info->dither_method=(DitherMethod)
-              argument_list[6].integer_reference;
-          if ((image->storage_class == DirectClass) ||
-              (image->colors > quantize_info->number_colors) ||
-              (quantize_info->colorspace == GRAYColorspace))
-            (void) QuantizeImage(quantize_info,image,exception);
+              argument_list[7].integer_reference;
+          if (attribute_flag[5] && argument_list[5].integer_reference)
+            (void) QuantizeImages(quantize_info,image,exception);
           else
-            CompressImageColormap(image,exception);
+            if ((image->storage_class == DirectClass) ||
+               (image->colors > quantize_info->number_colors) ||
+               (quantize_info->colorspace == GRAYColorspace))
+             (void) QuantizeImage(quantize_info,image,exception);
+           else
+             CompressImageColormap(image,exception);
           quantize_info=DestroyQuantizeInfo(quantize_info);
           break;
         }
@@ -9520,7 +9568,7 @@ Mogrify(ref,...)
               size_t
                 order;
 
-              kernel=AcquireKernelInfo((const char *) NULL);
+              kernel=AcquireKernelInfo((const char *) NULL,exception);
               if (kernel == (KernelInfo *) NULL)
                 break;
               av=(AV *) argument_list[0].array_reference;
@@ -9548,7 +9596,8 @@ Mogrify(ref,...)
               argument_list[2].string_reference);
           if (attribute_flag[3] != 0)
             {
-              kernel=AcquireKernelInfo(argument_list[3].string_reference);
+              kernel=AcquireKernelInfo(argument_list[3].string_reference,
+                exception);
               if (kernel == (KernelInfo *) NULL)
                 break;
             }
@@ -9692,7 +9741,7 @@ Mogrify(ref,...)
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
           channel_mask=SetImageChannelMask(image,channel);
-          (void) OrderedPosterizeImage(image,argument_list[0].string_reference,
+          (void) OrderedDitherImage(image,argument_list[0].string_reference,
             exception);
           (void) SetImageChannelMask(image,channel_mask);
           break;
@@ -9895,7 +9944,7 @@ Mogrify(ref,...)
           if (attribute_flag[1] != 0)
             image->fuzz=StringToDoubleInterval(
               argument_list[1].string_reference,(double) QuantumRange+1.0);
-          (void) IsImagesEqual(image,argument_list[0].image_reference,
+          (void) SetImageColorMetric(image,argument_list[0].image_reference,
             exception);
           break;
         }
@@ -9944,7 +9993,7 @@ Mogrify(ref,...)
             (image->resolution.x == 0.0 ? 72.0 : image->resolution.x)+0.5);
           height=(size_t) (geometry_info.sigma*image->rows/
             (image->resolution.y == 0.0 ? 72.0 : image->resolution.y)+0.5);
-          image=ResizeImage(image,width,height,(FilterTypes)
+          image=ResizeImage(image,width,height,(FilterType)
             argument_list[3].integer_reference,exception);
           if (image != (Image *) NULL)
             {
@@ -9988,7 +10037,7 @@ Mogrify(ref,...)
           (void) SetImageChannelMask(image,channel_mask);
           break;
         }
-        case 82:  /* RadialBlur */
+        case 82:  /* RotationalBlur */
         {
           if (attribute_flag[0] != 0)
             {
@@ -10000,7 +10049,7 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
           channel_mask=SetImageChannelMask(image,channel);
-          image=RadialBlurImage(image,geometry_info.rho,exception);
+          image=RotationalBlurImage(image,geometry_info.rho,exception);
           if (image != (Image *) NULL)
             (void) SetImageChannelMask(image,channel_mask);
           break;
@@ -10046,6 +10095,8 @@ Mogrify(ref,...)
         }
         case 87:  /* Splice */
         {
+          if (attribute_flag[7] != 0)
+            image->gravity=(GravityType) argument_list[7].integer_reference;
           if (attribute_flag[0] != 0)
             flags=ParseGravityGeometry(image,argument_list[0].string_reference,
               &geometry,exception);
@@ -10063,8 +10114,6 @@ Mogrify(ref,...)
           if (attribute_flag[6] != 0)
             (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);
           break;
         }
@@ -10363,7 +10412,7 @@ Mogrify(ref,...)
           if (attribute_flag[2] != 0)
             geometry.height=argument_list[2].integer_reference;
           if (attribute_flag[3] != 0)
-            image->filter=(FilterTypes) argument_list[4].integer_reference;
+            image->filter=(FilterType) argument_list[4].integer_reference;
           if (attribute_flag[4] != 0)
             SetImageArtifact(image,"filter:support",
               argument_list[4].string_reference);
@@ -10384,7 +10433,7 @@ Mogrify(ref,...)
             }
           mask_image=CloneImage(argument_list[0].image_reference,0,0,MagickTrue,
             exception);
-          (void) SetImageMask(image,mask_image,exception);
+          (void) SetImageMask(image,ReadPixelMask,mask_image,exception);
           mask_image=DestroyImage(mask_image);
           break;
         }
@@ -10447,7 +10496,7 @@ Mogrify(ref,...)
             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);
+          kernel_info=AcquireKernelInfo((const char *) NULL,exception);
           if (kernel_info == (KernelInfo *) NULL)
             break;
           kernel_info->width=order;
@@ -10477,7 +10526,7 @@ Mogrify(ref,...)
             }
           mask_image=CloneImage(argument_list[0].image_reference,0,0,
             MagickTrue,exception);
-          (void) SetImageMask(image,mask_image,exception);
+          (void) SetImageMask(image,ReadPixelMask,mask_image,exception);
           mask_image=DestroyImage(mask_image);
           break;
         }
@@ -10583,7 +10632,7 @@ Mogrify(ref,...)
           double
             *coordinates;
 
-          DistortImageMethod
+          DistortMethod
             method;
 
           size_t
@@ -10596,7 +10645,7 @@ Mogrify(ref,...)
             break;
           method=UndefinedDistortion;
           if (attribute_flag[1] != 0)
-            method=(DistortImageMethod) argument_list[1].integer_reference;
+            method=(DistortMethod) argument_list[1].integer_reference;
           av=(AV *) argument_list[0].array_reference;
           number_coordinates=(size_t) av_len(av)+1;
           coordinates=(double *) AcquireQuantumMemory(number_coordinates,
@@ -10969,7 +11018,7 @@ Mogrify(ref,...)
 
           if (attribute_flag[0] == 0)
             break;
-          kernel=AcquireKernelInfo(argument_list[0].string_reference);
+          kernel=AcquireKernelInfo(argument_list[0].string_reference,exception);
           if (kernel == (KernelInfo *) NULL)
             break;
           if (attribute_flag[1] != 0)
@@ -11093,6 +11142,211 @@ Mogrify(ref,...)
           (void) GrayscaleImage(image,method,exception);
           break;
         }
+        case 138:  /* Canny */
+        {
+          if (attribute_flag[0] != 0)
+            {
+              flags=ParseGeometry(argument_list[0].string_reference,
+                &geometry_info);
+              if ((flags & SigmaValue) == 0)
+                geometry_info.sigma=1.0;
+              if ((flags & XiValue) == 0)
+                geometry_info.xi=0.10;
+              if ((flags & PsiValue) == 0)
+                geometry_info.psi=0.30;
+              if ((flags & PercentValue) != 0)
+                {
+                  geometry_info.xi/=100.0;
+                  geometry_info.psi/=100.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)
+            geometry_info.xi=argument_list[3].real_reference;
+          if (attribute_flag[4] != 0)
+            geometry_info.psi=argument_list[4].real_reference;
+          if (attribute_flag[5] != 0)
+            channel=(ChannelType) argument_list[5].integer_reference;
+          channel_mask=SetImageChannelMask(image,channel);
+          image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
+            geometry_info.xi,geometry_info.psi,exception);
+          if (image != (Image *) NULL)
+            (void) SetImageChannelMask(image,channel_mask);
+          break;
+        }
+        case 139:  /* HoughLine */
+        {
+          if (attribute_flag[0] != 0)
+            {
+              flags=ParseGeometry(argument_list[0].string_reference,
+                &geometry_info);
+              if ((flags & SigmaValue) == 0)
+                geometry_info.sigma=geometry_info.rho;
+              if ((flags & XiValue) == 0)
+                geometry_info.xi=40;
+            }
+          if (attribute_flag[1] != 0)
+            geometry_info.rho=(double) argument_list[1].integer_reference;
+          if (attribute_flag[2] != 0)
+            geometry_info.sigma=(double) argument_list[2].integer_reference;
+          if (attribute_flag[3] != 0)
+            geometry_info.xi=(double) argument_list[3].integer_reference;
+          image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
+            geometry_info.sigma,(size_t) geometry_info.xi,exception);
+          break;
+        }
+        case 140:  /* MeanShift */
+        {
+          if (attribute_flag[0] != 0)
+            {
+              flags=ParseGeometry(argument_list[0].string_reference,
+                &geometry_info);
+              if ((flags & SigmaValue) == 0)
+                geometry_info.sigma=geometry_info.rho;
+              if ((flags & XiValue) == 0)
+                geometry_info.xi=0.10*QuantumRange;
+              if ((flags & PercentValue) != 0)
+                geometry_info.xi=QuantumRange*geometry_info.xi/100.0;
+            }
+          if (attribute_flag[1] != 0)
+            geometry_info.rho=(double) argument_list[1].integer_reference;
+          if (attribute_flag[2] != 0)
+            geometry_info.sigma=(double) argument_list[2].integer_reference;
+          if (attribute_flag[3] != 0)
+            geometry_info.xi=(double) argument_list[3].integer_reference;
+          image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
+            geometry_info.sigma,geometry_info.xi,exception);
+          break;
+        }
+        case 141:  /* Kuwahara */
+        {
+          if (attribute_flag[0] != 0)
+            {
+              flags=ParseGeometry(argument_list[0].string_reference,
+                &geometry_info);
+              if ((flags & SigmaValue) == 0)
+                geometry_info.sigma=geometry_info.rho-0.5;
+            }
+          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;
+          channel_mask=SetImageChannelMask(image,channel);
+          image=KuwaharaImage(image,geometry_info.rho,geometry_info.sigma,
+            exception);
+          if (image != (Image *) NULL)
+            (void) SetImageChannelMask(image,channel_mask);
+          break;
+        }
+        case 142:  /* ConnectedComponent */
+        {
+          size_t
+            connectivity;
+
+          connectivity=4;
+          if (attribute_flag[0] != 0)
+            connectivity=argument_list[0].integer_reference;
+          image=ConnectedComponentsImage(image,connectivity,
+            (CCObjectInfo **) NULL,exception);
+          break;
+        }
+        case 143:  /* Copy */
+        {
+          Image
+            *source_image;
+
+          OffsetInfo
+            offset;
+
+          RectangleInfo
+            offset_geometry;
+
+          source_image=image;
+          if (attribute_flag[0] != 0)
+            source_image=argument_list[0].image_reference;
+          SetGeometry(source_image,&geometry);
+          if (attribute_flag[1] != 0)
+            flags=ParseGravityGeometry(source_image,
+              argument_list[1].string_reference,&geometry,exception);
+          if (attribute_flag[2] != 0)
+            geometry.width=argument_list[2].integer_reference;
+          if (attribute_flag[3] != 0)
+            geometry.height=argument_list[3].integer_reference;
+          if (attribute_flag[4] != 0)
+            geometry.x=argument_list[4].integer_reference;
+          if (attribute_flag[5] != 0)
+            geometry.y=argument_list[5].integer_reference;
+          if (attribute_flag[6] != 0)
+            image->gravity=(GravityType) argument_list[6].integer_reference;
+          SetGeometry(image,&offset_geometry);
+          if (attribute_flag[7] != 0)
+            flags=ParseGravityGeometry(image,argument_list[7].string_reference,
+              &offset_geometry,exception);
+          offset.x=offset_geometry.x;
+          offset.y=offset_geometry.y;
+          if (attribute_flag[8] != 0)
+            offset.x=argument_list[8].integer_reference;
+          if (attribute_flag[9] != 0)
+            offset.y=argument_list[9].integer_reference;
+          (void) CopyImagePixels(image,source_image,&geometry,&offset,
+            exception);
+          break;
+        }
+        case 144:  /* Color */
+        {
+          PixelInfo
+            color;
+
+          (void) QueryColorCompliance("none",AllCompliance,&color,exception);
+          if (attribute_flag[0] != 0)
+            (void) QueryColorCompliance(argument_list[0].string_reference,
+              AllCompliance,&color,exception);
+          (void) SetImageColor(image,&color,exception);
+          break;
+        }
+        case 145:  /* WaveletDenoise */
+        {
+          if (attribute_flag[0] != 0)
+            {
+              flags=ParseGeometry(argument_list[0].string_reference,
+                &geometry_info);
+              if ((flags & PercentValue) != 0)
+                {
+                  geometry_info.rho=QuantumRange*geometry_info.rho/100.0;
+                  geometry_info.sigma=QuantumRange*geometry_info.sigma/100.0;
+                }
+              if ((flags & SigmaValue) == 0)
+                geometry_info.sigma=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;
+          channel_mask=SetImageChannelMask(image,channel);
+          image=WaveletDenoiseImage(image,geometry_info.rho,geometry_info.sigma,
+            exception);
+          if (image != (Image *) NULL)
+            (void) SetImageChannelMask(image,channel_mask);
+          break;
+        }
+        case 146:  /* Colorspace */
+        {
+          ColorspaceType
+            colorspace;
+
+          colorspace=sRGBColorspace;
+          if (attribute_flag[0] != 0)
+            colorspace=(ColorspaceType) argument_list[0].integer_reference;
+          (void) TransformImageColorspace(image,colorspace,exception);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
@@ -11383,9 +11637,9 @@ Montage(ref,...)
           if (LocaleCompare(attribute,"mattecolor") == 0)
             {
               (void) QueryColorCompliance(SvPV(ST(i),na),AllCompliance,
-                &montage_info->matte_color,exception);
+                &montage_info->alpha_color,exception);
               for (next=image; next; next=next->next)
-                next->matte_color=montage_info->matte_color;
+                next->alpha_color=montage_info->alpha_color;
               break;
             }
           if (LocaleCompare(attribute,"mode") == 0)
@@ -11752,9 +12006,8 @@ Mosaic(ref)
     rv=newRV(sv);
     av_push(av,sv_bless(rv,hv));
     SvREFCNT_dec(sv);
-    info=GetPackageInfo(aTHX_ (void *) av,info,exception);
     (void) CopyMagickString(info->image_info->filename,image->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     SetImageInfo(info->image_info,0,exception);
     exception=DestroyExceptionInfo(exception);
     SvREFCNT_dec(perl_exception);
@@ -11934,7 +12187,7 @@ Ping(ref,...)
     for (i=0; i < n; i++)
     {
       (void) CopyMagickString(package_info->image_info->filename,list[i],
-        MaxTextExtent);
+        MagickPathExtent);
       image=PingImage(package_info->image_info,exception);
       if (image == (Image *) NULL)
         break;
@@ -12148,7 +12401,7 @@ QueryColor(ref,...)
       PUSHs(sv_2mortal(newSViv((size_t) floor(color.blue+0.5))));
       if (color.colorspace == CMYKColorspace)
         PUSHs(sv_2mortal(newSViv((size_t) floor(color.black+0.5))));
-      if (color.alpha_trait == BlendPixelTrait)
+      if (color.alpha_trait != UndefinedPixelTrait)
         PUSHs(sv_2mortal(newSViv((size_t) floor(color.alpha+0.5))));
     }
 
@@ -12181,7 +12434,7 @@ QueryColorname(ref,...)
       *av;
 
     char
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     ExceptionInfo
       *exception;
@@ -12254,7 +12507,7 @@ QueryFont(ref,...)
   {
     char
       *name,
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     ExceptionInfo
       *exception;
@@ -12322,7 +12575,7 @@ QueryFont(ref,...)
       else
         PUSHs(sv_2mortal(newSVpv(CommandOptionToMnemonic(MagickStretchOptions,
           type_info->stretch),0)));
-      (void) FormatLocaleString(message,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(message,MagickPathExtent,"%.20g",(double)
         type_info->weight);
       PUSHs(sv_2mortal(newSVpv(message,0)));
       if (type_info->encoding == (char *) NULL)
@@ -12731,8 +12984,8 @@ QueryFontMetrics(ref,...)
     if (draw_info->geometry == (char *) NULL)
       {
         draw_info->geometry=AcquireString((char *) NULL);
-        (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
-          "%.15g,%.15g",x,y);
+        (void) FormatLocaleString(draw_info->geometry,MagickPathExtent,
+          "%.20g,%.20g",x,y);
       }
     status=GetTypeMetrics(image,draw_info,&metrics,exception);
     (void) CatchImageException(image);
@@ -13104,8 +13357,8 @@ QueryMultilineFontMetrics(ref,...)
     if (draw_info->geometry == (char *) NULL)
       {
         draw_info->geometry=AcquireString((char *) NULL);
-        (void) FormatLocaleString(draw_info->geometry,MaxTextExtent,
-          "%.15g,%.15g",x,y);
+        (void) FormatLocaleString(draw_info->geometry,MagickPathExtent,
+          "%.20g,%.20g",x,y);
       }
     status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception);
     (void) CatchException(exception);
@@ -13178,7 +13431,7 @@ QueryFormat(ref,...)
     if (items == 1)
       {
         char
-          format[MaxTextExtent];
+          format[MagickPathExtent];
 
         const MagickInfo
           **format_list;
@@ -13190,7 +13443,7 @@ QueryFormat(ref,...)
         EXTEND(sp,types);
         for (i=0; i < (ssize_t) types; i++)
         {
-          (void) CopyMagickString(format,format_list[i]->name,MaxTextExtent);
+          (void) CopyMagickString(format,format_list[i]->name,MagickPathExtent);
           LocaleLower(format);
           PUSHs(sv_2mortal(newSVpv(format,0)));
         }
@@ -13208,11 +13461,6 @@ QueryFormat(ref,...)
           PUSHs(&sv_undef);
           continue;
         }
-      PUSHs(sv_2mortal(newSViv(magick_info->adjoin)));
-      PUSHs(sv_2mortal(newSViv(magick_info->blob_support)));
-      PUSHs(sv_2mortal(newSViv(magick_info->raw)));
-      PUSHs(sv_2mortal(newSViv((long) magick_info->decoder)));
-      PUSHs(sv_2mortal(newSViv((long) magick_info->encoder)));
       if (magick_info->description == (char *) NULL)
         PUSHs(&sv_undef);
       else
@@ -13736,9 +13984,9 @@ SetPixel(ref,...)
               if (SvTYPE(ST(i)) != SVt_RV)
                 {
                   char
-                    message[MaxTextExtent];
+                    message[MagickPathExtent];
 
-                  (void) FormatLocaleString(message,MaxTextExtent,
+                  (void) FormatLocaleString(message,MagickPathExtent,
                     "invalid %.60s value",attribute);
                   ThrowPerlException(exception,OptionError,message,
                     SvPV(ST(i),na));
@@ -14053,41 +14301,41 @@ Statistics(ref,...)
   {
 #define ChannelStatistics(channel) \
 { \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.20g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     (double) channel_statistics[channel].depth); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
-    channel_statistics[channel].minima/scale); \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+    channel_statistics[channel].minima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
-    channel_statistics[channel].maxima/scale); \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+    channel_statistics[channel].maxima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
-    channel_statistics[channel].mean/scale); \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+    channel_statistics[channel].mean/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
-    channel_statistics[channel].standard_deviation/scale); \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+    channel_statistics[channel].standard_deviation/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_statistics[channel].kurtosis); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
-  (void) FormatLocaleString(message,MaxTextExtent,"%.15g", \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_statistics[channel].skewness); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
+  (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
+    channel_statistics[channel].entropy); \
+  PUSHs(sv_2mortal(newSVpv(message,0))); \
 }
 
     AV
       *av;
 
     char
-      message[MaxTextExtent];
+      message[MagickPathExtent];
 
     ChannelStatistics
       *channel_statistics;
 
-    double
-      scale;
-
     ExceptionInfo
       *exception;
 
@@ -14125,23 +14373,27 @@ Statistics(ref,...)
           PackageName);
         goto PerlException;
       }
-    info=GetPackageInfo(aTHX_ (void *) av,info,exception);
     count=0;
     for ( ; image; image=image->next)
     {
+      register size_t
+        i;
+
       channel_statistics=GetImageStatistics(image,exception);
       if (channel_statistics == (ChannelStatistics *) NULL)
         continue;
       count++;
-      EXTEND(sp,35*count);
-      scale=(double) QuantumRange;
-      ChannelStatistics(RedChannel);
-      ChannelStatistics(GreenChannel);
-      ChannelStatistics(BlueChannel);
-      if (image->colorspace == CMYKColorspace)
-        ChannelStatistics(BlackChannel);
-      if (image->alpha_trait == BlendPixelTrait)
-        ChannelStatistics(AlphaChannel);
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel channel=GetPixelChannelChannel(image,i);
+        PixelTrait traits=GetPixelChannelTraits(image,channel);
+        if (traits == UndefinedPixelTrait)
+          continue;
+        EXTEND(sp,8*(i+1)*count);
+        ChannelStatistics(channel);
+      }
+      EXTEND(sp,8*(i+1)*count);
+      ChannelStatistics(CompositePixelChannel);
       channel_statistics=(ChannelStatistics *)
         RelinquishMagickMemory(channel_statistics);
     }
@@ -14224,154 +14476,6 @@ SyncAuthenticPixels(ref,...)
 #                                                                             #
 #                                                                             #
 #                                                                             #
-#   T r a n s f o r m                                                         #
-#                                                                             #
-#                                                                             #
-#                                                                             #
-###############################################################################
-#
-#
-void
-Transform(ref,...)
-  Image::Magick ref=NO_INIT
-  ALIAS:
-    TransformImage = 1
-    transform      = 2
-    transformimage = 3
-  PPCODE:
-  {
-    AV
-      *av;
-
-    char
-      *attribute,
-      *crop_geometry,
-      *geometry;
-
-    ExceptionInfo
-      *exception;
-
-    HV
-      *hv;
-
-    Image
-      *clone,
-      *image;
-
-    register ssize_t
-      i;
-
-    struct PackageInfo
-      *info;
-
-    SV
-      *av_reference,
-      *perl_exception,
-      *reference,
-      *rv,
-      *sv;
-
-    PERL_UNUSED_VAR(ref);
-    PERL_UNUSED_VAR(ix);
-    exception=AcquireExceptionInfo();
-    perl_exception=newSVpv("",0);
-    sv=NULL;
-    av=NULL;
-    attribute=NULL;
-    if (sv_isobject(ST(0)) == 0)
-      {
-        ThrowPerlException(exception,OptionError,"ReferenceIsNotMyType",
-          PackageName);
-        goto PerlException;
-      }
-    reference=SvRV(ST(0));
-    hv=SvSTASH(reference);
-    av=newAV();
-    av_reference=sv_2mortal(sv_bless(newRV((SV *) av),hv));
-    SvREFCNT_dec(av);
-    image=SetupList(aTHX_ reference,&info,(SV ***) NULL,exception);
-    if (image == (Image *) NULL)
-      {
-        ThrowPerlException(exception,OptionError,"NoImagesDefined",
-          PackageName);
-        goto PerlException;
-      }
-    info=GetPackageInfo(aTHX_ (void *) av,info,exception);
-    /*
-      Get attribute.
-    */
-    crop_geometry=(char *) NULL;
-    geometry=(char *) NULL;
-    for (i=2; i < items; i+=2)
-    {
-      attribute=(char *) SvPV(ST(i-1),na);
-      switch (*attribute)
-      {
-        case 'c':
-        case 'C':
-        {
-          if (LocaleCompare(attribute,"crop") == 0)
-            {
-              crop_geometry=SvPV(ST(i),na);
-              break;
-            }
-          ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
-            attribute);
-          break;
-        }
-        case 'g':
-        case 'G':
-        {
-          if (LocaleCompare(attribute,"geometry") == 0)
-            {
-              geometry=SvPV(ST(i),na);
-              break;
-            }
-          ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
-            attribute);
-          break;
-        }
-        default:
-        {
-          ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
-            attribute);
-          break;
-        }
-      }
-    }
-    for ( ; image; image=image->next)
-    {
-      clone=CloneImage(image,0,0,MagickTrue,exception);
-      if (clone == (Image *) NULL)
-        goto PerlException;
-      TransformImage(&clone,crop_geometry,geometry,exception);
-      for ( ; clone; clone=clone->next)
-      {
-        AddImageToRegistry(sv,clone);
-        rv=newRV(sv);
-        av_push(av,sv_bless(rv,hv));
-        SvREFCNT_dec(sv);
-      }
-    }
-    exception=DestroyExceptionInfo(exception);
-    ST(0)=av_reference;
-    SvREFCNT_dec(perl_exception);  /* can't return warning messages */
-    XSRETURN(1);
-
-  PerlException:
-    InheritPerlException(exception,perl_exception);
-    exception=DestroyExceptionInfo(exception);
-    sv_setiv(perl_exception,(IV) SvCUR(perl_exception) != 0);
-    SvPOK_on(perl_exception);
-    ST(0)=sv_2mortal(perl_exception);
-    XSRETURN(1);
-  }
-\f
-#
-###############################################################################
-#                                                                             #
-#                                                                             #
-#                                                                             #
 #   W r i t e                                                                 #
 #                                                                             #
 #                                                                             #
@@ -14389,7 +14493,7 @@ Write(ref,...)
   PPCODE:
   {
     char
-      filename[MaxTextExtent];
+      filename[MagickPathExtent];
 
     ExceptionInfo
       *exception;
@@ -14442,13 +14546,14 @@ Write(ref,...)
           SetAttribute(aTHX_ package_info,image,SvPV(ST(i-1),na),ST(i),
             exception);
     (void) CopyMagickString(filename,package_info->image_info->filename,
-      MaxTextExtent);
+      MagickPathExtent);
     scene=0;
     for (next=image; next; next=next->next)
     {
-      (void) CopyMagickString(next->filename,filename,MaxTextExtent);
+      (void) CopyMagickString(next->filename,filename,MagickPathExtent);
       next->scene=scene++;
     }
+    *package_info->image_info->magick='\0';
     SetImageInfo(package_info->image_info,(unsigned int)
       GetImageListLength(image),exception);
     for (next=image; next; next=next->next)