]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/magick-property.c
(no commit message)
[imagemagick] / MagickWand / magick-property.c
index b431aaffdcf52d8388f2bed0f719386a2f51ac14..291d67b64528d5fe2d1994ec7f2df27094566a5f 100644 (file)
 %            Set or Get MagickWand Properties, Options, or Profiles           %
 %                                                                             %
 %                               Software Design                               %
-%                                 John Cristy                                 %
+%                                    Cristy                                   %
 %                                 August 2003                                 %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
 #include "MagickWand/wand.h"
 #include "MagickCore/string-private.h"
 \f
-/*
-  Define declarations.
-*/
-#define ThrowWandException(severity,tag,context) \
-{ \
-  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
-    tag,"`%s'",context); \
-  return(MagickFalse); \
-}
-\f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -92,8 +82,9 @@ WandExport MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -133,8 +124,9 @@ WandExport MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -174,8 +166,9 @@ WandExport MagickBooleanType MagickDeleteOption(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(DeleteImageOption(wand->image_info,option));
 }
 \f
@@ -206,8 +199,9 @@ WandExport MagickBooleanType MagickGetAntialias(const MagickWand *wand)
 {
   assert(wand != (const MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->antialias);
 }
 \f
@@ -240,10 +234,11 @@ WandExport PixelWand *MagickGetBackgroundColor(MagickWand *wand)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   background_color=NewPixelWand();
-  PixelSetQuantumPacket(background_color,&wand->image_info->background_color);
+  PixelSetPixelColor(background_color,&wand->image_info->background_color);
   return(background_color);
 }
 \f
@@ -273,8 +268,9 @@ WandExport ColorspaceType MagickGetColorspace(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->colorspace);
 }
 \f
@@ -304,8 +300,9 @@ WandExport CompressionType MagickGetCompression(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->compression);
 }
 \f
@@ -335,8 +332,9 @@ WandExport size_t MagickGetCompressionQuality(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->quality);
 }
 \f
@@ -390,8 +388,9 @@ WandExport char *MagickGetFilename(const MagickWand *wand)
 {
   assert(wand != (const MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(AcquireString(wand->image_info->filename));
 }
 \f
@@ -421,8 +420,9 @@ WandExport char *MagickGetFont(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->image_info->font == (char *) NULL)
     return((char *) NULL);
   return(AcquireString(wand->image_info->font));
@@ -454,8 +454,9 @@ WandExport char *MagickGetFormat(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(AcquireString(wand->image_info->magick));
 }
 \f
@@ -491,8 +492,9 @@ WandExport GravityType MagickGetGravity(MagickWand *wand)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   option=GetImageOption(wand->image_info,"gravity");
   if (option == (const char *) NULL)
     return(UndefinedGravity);
@@ -556,8 +558,9 @@ WandExport char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -617,8 +620,9 @@ WandExport char **MagickGetImageArtifacts(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -635,7 +639,7 @@ WandExport char **MagickGetImageArtifacts(MagickWand *wand,
   for (i=0; artifact != (const char *) NULL; )
   {
     if ((*artifact != '[') &&
-        (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
+        (IfMagickTrue(GlobExpression(artifact,pattern,MagickFalse))))
       {
         if ((i+1) >= (ssize_t) length)
           {
@@ -698,8 +702,9 @@ WandExport unsigned char *MagickGetImageProfile(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -740,7 +745,7 @@ WandExport unsigned char *MagickGetImageProfile(MagickWand *wand,
 %
 %  The format of the MagickGetImageProfiles method is:
 %
-%      char *MagickGetImageProfiles(MagickWand *wand,
+%      char *MagickGetImageProfiles(MagickWand *wand,const char *pattern,
 %        size_t *number_profiles)
 %
 %  A description of each parameter follows:
@@ -769,8 +774,9 @@ WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -787,7 +793,7 @@ WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
   for (i=0; property != (const char *) NULL; )
   {
     if ((*property != '[') &&
-        (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
+        (IfMagickTrue(GlobExpression(property,pattern,MagickFalse))))
       {
         if ((i+1) >= (ssize_t) length)
           {
@@ -845,8 +851,9 @@ WandExport char *MagickGetImageProperty(MagickWand *wand,const char *property)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -906,8 +913,9 @@ WandExport char **MagickGetImageProperties(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -924,7 +932,7 @@ WandExport char **MagickGetImageProperties(MagickWand *wand,
   for (i=0; property != (const char *) NULL; )
   {
     if ((*property != '[') &&
-        (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
+        (IfMagickTrue(GlobExpression(property,pattern,MagickFalse))))
       {
         if ((i+1) >= (ssize_t) length)
           {
@@ -975,8 +983,9 @@ WandExport InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->interlace);
 }
 \f
@@ -1012,8 +1021,9 @@ WandExport PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   option=GetImageOption(wand->image_info,"interpolate");
   if (option == (const char *) NULL)
     return(UndefinedInterpolatePixel);
@@ -1055,8 +1065,9 @@ WandExport char *MagickGetOption(MagickWand *wand,const char *key)
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   option=GetImageOption(wand->image_info,key);
   return(ConstantString(option));
 }
@@ -1066,7 +1077,7 @@ WandExport char *MagickGetOption(MagickWand *wand,const char *key)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   M a g i c k G e t O p t i o n                                             %
+%   M a g i c k G e t O p t i o n s                                           %
 %                                                                             %
 %                                                                             %
 %                                                                             %
@@ -1079,7 +1090,8 @@ WandExport char *MagickGetOption(MagickWand *wand,const char *key)
 %
 %  The format of the MagickGetOptions method is:
 %
-%      char *MagickGetOptions(MagickWand *wand,size_t *number_options)
+%      char *MagickGetOptions(MagickWand *wand,const char *pattern,
+%        size_t *number_options)
 %
 %  A description of each parameter follows:
 %
@@ -1107,8 +1119,9 @@ WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -1124,7 +1137,7 @@ WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
   for (i=0; option != (const char *) NULL; )
   {
     if ((*option != '[') &&
-        (GlobExpression(option,pattern,MagickFalse) != MagickFalse))
+        (IfMagickTrue(GlobExpression(option,pattern,MagickFalse))))
       {
         if ((i+1) >= (ssize_t) length)
           {
@@ -1175,8 +1188,9 @@ WandExport OrientationType MagickGetOrientation(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->orientation);
 }
 \f
@@ -1244,8 +1258,9 @@ WandExport MagickBooleanType MagickGetPage(const MagickWand *wand,
 
   assert(wand != (const MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   (void) ResetMagickMemory(&geometry,0,sizeof(geometry));
   (void) ParseAbsoluteGeometry(wand->image_info->page,&geometry);
   *width=geometry.width;
@@ -1282,8 +1297,9 @@ WandExport double MagickGetPointsize(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->pointsize);
 }
 \f
@@ -1399,8 +1415,9 @@ WandExport MagickBooleanType MagickGetResolution(const MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   *x=72.0;
   *y=72.0;
   if (wand->image_info->density != (char *) NULL)
@@ -1414,7 +1431,7 @@ WandExport MagickBooleanType MagickGetResolution(const MagickWand *wand,
       flags=ParseGeometry(wand->image_info->density,&geometry_info);
       *x=geometry_info.rho;
       *y=geometry_info.sigma;
-      if ((flags & SigmaValue) == MagickFalse)
+      if ((flags & SigmaValue) == 0)
         *y=(*x);
     }
   return(MagickTrue);
@@ -1513,8 +1530,9 @@ WandExport double *MagickGetSamplingFactors(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   *number_factors=0;
   sampling_factors=(double *) NULL;
   if (wand->image_info->sampling_factor == (char *) NULL)
@@ -1527,7 +1545,7 @@ WandExport double *MagickGetSamplingFactors(MagickWand *wand,
       p++;
     i++;
   }
-  sampling_factors=(double *) AcquireQuantumMemory((size_t) i,
+  sampling_factors=(double *) AcquireQuantumMemory((size_t) i+1,
     sizeof(*sampling_factors));
   if (sampling_factors == (double *) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
@@ -1538,7 +1556,7 @@ WandExport double *MagickGetSamplingFactors(MagickWand *wand,
     while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||
            (*p == ',')))
       p++;
-    sampling_factors[i]=InterpretLocaleValue(p,(char **) NULL);
+    sampling_factors[i]=StringToDouble(p,(char **) NULL);
     i++;
   }
   *number_factors=(size_t) i;
@@ -1580,8 +1598,9 @@ WandExport MagickBooleanType MagickGetSize(const MagickWand *wand,
 
   assert(wand != (const MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   (void) ResetMagickMemory(&geometry,0,sizeof(geometry));
   (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
   *columns=geometry.width;
@@ -1623,8 +1642,9 @@ WandExport MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
 
   assert(wand != (const MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   (void) ResetMagickMemory(&geometry,0,sizeof(geometry));
   (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
   *offset=geometry.x;
@@ -1657,8 +1677,9 @@ WandExport ImageType MagickGetType(MagickWand *wand)
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(wand->image_info->type);
 }
 \f
@@ -1727,8 +1748,9 @@ WandExport MagickBooleanType MagickProfileImage(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   return(ProfileImage(wand->images,name,profile,length,wand->exception));
@@ -1772,8 +1794,9 @@ WandExport unsigned char *MagickRemoveImageProfile(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     {
       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
@@ -1825,8 +1848,9 @@ WandExport MagickBooleanType MagickSetAntialias(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->antialias=antialias;
   return(MagickTrue);
 }
@@ -1861,8 +1885,9 @@ WandExport MagickBooleanType MagickSetBackgroundColor(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   PixelGetQuantumPacket(background,&wand->image_info->background_color);
   return(MagickTrue);
 }
@@ -1897,8 +1922,9 @@ WandExport MagickBooleanType MagickSetColorspace(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->colorspace=colorspace;
   return(MagickTrue);
 }
@@ -1933,8 +1959,9 @@ WandExport MagickBooleanType MagickSetCompression(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->compression=compression;
   return(MagickTrue);
 }
@@ -1969,8 +1996,9 @@ WandExport MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->quality=quality;
   return(MagickTrue);
 }
@@ -2005,8 +2033,9 @@ WandExport MagickBooleanType MagickSetDepth(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->depth=depth;
   return(MagickTrue);
 }
@@ -2045,8 +2074,10 @@ WandExport MagickBooleanType MagickSetExtract(MagickWand *wand,
   assert(wand->signature == WandSignature);
   if (wand->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  if (wand->image_info->extract != (char *) NULL)
+    wand->image_info->extract=DestroyString(wand->image_info->extract);
   if (geometry != (const char *) NULL)
-    (void) CopyMagickString(wand->image_info->extract,geometry,MaxTextExtent);
+    (void) CloneString(&wand->image_info->extract,geometry);
   return(MagickTrue);
 }
 \f
@@ -2080,10 +2111,11 @@ WandExport MagickBooleanType MagickSetFilename(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (filename != (const char *) NULL)
-    (void) CopyMagickString(wand->image_info->filename,filename,MaxTextExtent);
+    (void) CopyMagickString(wand->image_info->filename,filename,MagickPathExtent);
   return(MagickTrue);
 }
 \f
@@ -2117,8 +2149,9 @@ WandExport MagickBooleanType MagickSetFont(MagickWand *wand,const char *font)
     return(MagickFalse);
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   (void) CloneString(&wand->image_info->font,font);
   return(MagickTrue);
 }
@@ -2155,8 +2188,9 @@ WandExport MagickBooleanType MagickSetFormat(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if ((format == (char *) NULL) || (*format == '\0'))
     {
       *wand->image_info->magick='\0';
@@ -2166,7 +2200,7 @@ WandExport MagickBooleanType MagickSetFormat(MagickWand *wand,
   if (magick_info == (const MagickInfo *) NULL)
     return(MagickFalse);
   ClearMagickException(wand->exception);
-  (void) CopyMagickString(wand->image_info->magick,format,MaxTextExtent);
+  (void) CopyMagickString(wand->image_info->magick,format,MagickPathExtent);
   return(MagickTrue);
 }
 \f
@@ -2203,8 +2237,9 @@ WandExport MagickBooleanType MagickSetGravity(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   status=SetImageOption(wand->image_info,"gravity",CommandOptionToMnemonic(
     MagickGravityOptions,(ssize_t) type));
   return(status);
@@ -2242,8 +2277,9 @@ WandExport MagickBooleanType MagickSetImageArtifact(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   return(SetImageArtifact(wand->images,artifact,value));
@@ -2292,8 +2328,9 @@ WandExport MagickBooleanType MagickSetImageProfile(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   profile_info=AcquireStringInfo((size_t) length);
@@ -2338,8 +2375,9 @@ WandExport MagickBooleanType MagickSetImageProperty(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->images == (Image *) NULL)
     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   status=SetImageProperty(wand->images,property,value,wand->exception);
@@ -2377,8 +2415,9 @@ WandExport MagickBooleanType MagickSetInterlaceScheme(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->interlace=interlace_scheme;
   return(MagickTrue);
 }
@@ -2416,8 +2455,9 @@ WandExport MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   status=SetImageOption(wand->image_info,"interpolate",
     CommandOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method));
   return(status);
@@ -2456,8 +2496,9 @@ WandExport MagickBooleanType MagickSetOption(MagickWand *wand,const char *key,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   return(SetImageOption(wand->image_info,key,value));
 }
 \f
@@ -2491,8 +2532,9 @@ WandExport MagickBooleanType MagickSetOrientation(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->orientation=orientation;
   return(MagickTrue);
 }
@@ -2534,13 +2576,14 @@ WandExport MagickBooleanType MagickSetPage(MagickWand *wand,
   const ssize_t y)
 {
   char
-    geometry[MaxTextExtent];
+    geometry[MagickPathExtent];
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
-  (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
+
+  (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g%+.20g%+.20g",
     (double) width,(double) height,(double) x,(double) y);
   (void) CloneString(&wand->image_info->page,geometry);
   return(MagickTrue);
@@ -2576,8 +2619,9 @@ WandExport MagickBooleanType MagickSetPassphrase(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   (void) SetImageOption(wand->image_info,"authenticate",passphrase);
   return(MagickTrue);
 }
@@ -2612,8 +2656,9 @@ WandExport MagickBooleanType MagickSetPointsize(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->pointsize=pointsize;
   return(MagickTrue);
 }
@@ -2663,8 +2708,9 @@ WandExport MagickProgressMonitor MagickSetProgressMonitor(MagickWand *wand,
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   previous_monitor=SetImageInfoProgressMonitor(wand->image_info,
     progress_monitor,client_data);
   return(previous_monitor);
@@ -2719,7 +2765,7 @@ WandExport MagickBooleanType MagickSetResourceLimit(const ResourceType type,
 %  The format of the MagickSetResolution method is:
 %
 %      MagickBooleanType MagickSetResolution(MagickWand *wand,
-%        const double x_resolution,const doubtl y_resolution)
+%        const double x_resolution,const double y_resolution)
 %
 %  A description of each parameter follows:
 %
@@ -2734,13 +2780,14 @@ WandExport MagickBooleanType MagickSetResolution(MagickWand *wand,
   const double x_resolution,const double y_resolution)
 {
   char
-    density[MaxTextExtent];
+    density[MagickPathExtent];
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
-  (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",x_resolution,
+
+  (void) FormatLocaleString(density,MagickPathExtent,"%gx%g",x_resolution,
     y_resolution);
   (void) CloneString(&wand->image_info->density,density);
   return(MagickTrue);
@@ -2778,15 +2825,16 @@ WandExport MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
   const size_t number_factors,const double *sampling_factors)
 {
   char
-    sampling_factor[MaxTextExtent];
+    sampling_factor[MagickPathExtent];
 
   register ssize_t
     i;
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   if (wand->image_info->sampling_factor != (char *) NULL)
     wand->image_info->sampling_factor=(char *)
       RelinquishMagickMemory(wand->image_info->sampling_factor);
@@ -2794,12 +2842,12 @@ WandExport MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
     return(MagickTrue);
   for (i=0; i < (ssize_t) (number_factors-1); i++)
   {
-    (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%g,",
+    (void) FormatLocaleString(sampling_factor,MagickPathExtent,"%g,",
       sampling_factors[i]);
     (void) ConcatenateString(&wand->image_info->sampling_factor,
       sampling_factor);
   }
-  (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%g",
+  (void) FormatLocaleString(sampling_factor,MagickPathExtent,"%g",
     sampling_factors[i]);
   (void) ConcatenateString(&wand->image_info->sampling_factor,sampling_factor);
   return(MagickTrue);
@@ -2837,13 +2885,14 @@ WandExport MagickBooleanType MagickSetSize(MagickWand *wand,
   const size_t columns,const size_t rows)
 {
   char
-    geometry[MaxTextExtent];
+    geometry[MagickPathExtent];
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
-  (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
+
+  (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",(double)
     columns,(double) rows);
   (void) CloneString(&wand->image_info->size,geometry);
   return(MagickTrue);
@@ -2884,13 +2933,14 @@ WandExport MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
   const size_t columns,const size_t rows,const ssize_t offset)
 {
   char
-    geometry[MaxTextExtent];
+    geometry[MagickPathExtent];
 
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
-  (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g",
+
+  (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g%+.20g",
     (double) columns,(double) rows,(double) offset);
   (void) CloneString(&wand->image_info->size,geometry);
   return(MagickTrue);
@@ -2919,8 +2969,8 @@ WandExport MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
 %    o wand: the magick wand.
 %
 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
-%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
-%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
+%      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
+%      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
 %      or OptimizeType.
 %
 */
@@ -2929,8 +2979,9 @@ WandExport MagickBooleanType MagickSetType(MagickWand *wand,
 {
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
+  if( IfMagickTrue(wand->debug) )
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+
   wand->image_info->type=image_type;
   return(MagickTrue);
 }