Home | History | Annotate | Download | only in MagickWand
      1 /*
      2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      3 %                                                                             %
      4 %                                                                             %
      5 %                                                                             %
      6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
      7 %                 MM MM  A   A  G        I    C      K  K                     %
      8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
      9 %                 M   M  A   A  G   G    I    C      K  K                     %
     10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
     11 %                                                                             %
     12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
     13 %                       I    MM MM  A   A  G      E                           %
     14 %                       I    M M M  AAAAA  G  GG  EEE                         %
     15 %                       I    M   M  A   A  G   G  E                           %
     16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
     17 %                                                                             %
     18 %                                                                             %
     19 %                          MagickWand Image Methods                           %
     20 %                                                                             %
     21 %                               Software Design                               %
     22 %                                    Cristy                                   %
     23 %                                 August 2003                                 %
     24 %                                                                             %
     25 %                                                                             %
     26 %  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
     27 %  dedicated to making software imaging solutions freely available.           %
     28 %                                                                             %
     29 %  You may not use this file except in compliance with the License.  You may  %
     30 %  obtain a copy of the License at                                            %
     31 %                                                                             %
     32 %    http://www.imagemagick.org/script/license.php                            %
     33 %                                                                             %
     34 %  Unless required by applicable law or agreed to in writing, software        %
     35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
     36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
     37 %  See the License for the specific language governing permissions and        %
     38 %  limitations under the License.                                             %
     39 %                                                                             %
     40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     41 %
     42 %
     43 %
     44 */
     45 
     46 /*
     48   Include declarations.
     49 */
     50 #include "MagickWand/studio.h"
     51 #include "MagickWand/MagickWand.h"
     52 #include "MagickWand/magick-wand-private.h"
     53 #include "MagickWand/wand.h"
     54 #include "MagickWand/pixel-wand-private.h"
     55 #include "MagickCore/image-private.h"
     56 
     57 /*
     59   Define declarations.
     60 */
     61 #define MagickWandId  "MagickWand"
     62 
     63 /*
     65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     66 %                                                                             %
     67 %                                                                             %
     68 %                                                                             %
     69 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
     70 %                                                                             %
     71 %                                                                             %
     72 %                                                                             %
     73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     74 %
     75 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
     76 %  list.
     77 %
     78 %  The format of the CloneMagickWandFromImages method is:
     79 %
     80 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
     81 %        Image *images)
     82 %
     83 %  A description of each parameter follows:
     84 %
     85 %    o wand: the magick wand.
     86 %
     87 %    o images: replace the image list with these image(s).
     88 %
     89 */
     90 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
     91   Image *images)
     92 {
     93   MagickWand
     94     *clone_wand;
     95 
     96   assert(wand != (MagickWand *) NULL);
     97   assert(wand->signature == MagickWandSignature);
     98   if (wand->debug != MagickFalse)
     99     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    100   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
    101   if (clone_wand == (MagickWand *) NULL)
    102     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
    103       images->filename);
    104   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
    105   clone_wand->id=AcquireWandId();
    106   (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
    107     MagickWandId,(double) clone_wand->id);
    108   clone_wand->exception=AcquireExceptionInfo();
    109   InheritException(clone_wand->exception,wand->exception);
    110   clone_wand->image_info=CloneImageInfo(wand->image_info);
    111   clone_wand->images=images;
    112   clone_wand->debug=IsEventLogging();
    113   clone_wand->signature=MagickWandSignature;
    114   if (clone_wand->debug != MagickFalse)
    115     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
    116   return(clone_wand);
    117 }
    118 
    119 /*
    121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    122 %                                                                             %
    123 %                                                                             %
    124 %                                                                             %
    125 %   G e t I m a g e F r o m M a g i c k W a n d                               %
    126 %                                                                             %
    127 %                                                                             %
    128 %                                                                             %
    129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    130 %
    131 %  GetImageFromMagickWand() returns the current image from the magick wand.
    132 %
    133 %  The format of the GetImageFromMagickWand method is:
    134 %
    135 %      Image *GetImageFromMagickWand(const MagickWand *wand)
    136 %
    137 %  A description of each parameter follows:
    138 %
    139 %    o wand: the magick wand.
    140 %
    141 */
    142 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
    143 {
    144   assert(wand != (MagickWand *) NULL);
    145   assert(wand->signature == MagickWandSignature);
    146   if (wand->debug != MagickFalse)
    147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    148   if (wand->images == (Image *) NULL)
    149     {
    150       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
    151         "ContainsNoImages","`%s'",wand->name);
    152       return((Image *) NULL);
    153     }
    154   return(wand->images);
    155 }
    156 
    157 /*
    159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    160 %                                                                             %
    161 %                                                                             %
    162 %                                                                             %
    163 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
    164 %                                                                             %
    165 %                                                                             %
    166 %                                                                             %
    167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    168 %
    169 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
    170 %  less intensely near image edges and more intensely far from edges. We
    171 %  blur the image with a Gaussian operator of the given radius and standard
    172 %  deviation (sigma).  For reasonable results, radius should be larger than
    173 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
    174 %  suitable radius for you.
    175 %
    176 %  The format of the MagickAdaptiveBlurImage method is:
    177 %
    178 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
    179 %        const double radius,const double sigma)
    180 %
    181 %  A description of each parameter follows:
    182 %
    183 %    o wand: the magick wand.
    184 %
    185 %    o radius: the radius of the Gaussian, in pixels, not counting the center
    186 %      pixel.
    187 %
    188 %    o sigma: the standard deviation of the Gaussian, in pixels.
    189 %
    190 */
    191 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
    192   const double radius,const double sigma)
    193 {
    194   Image
    195     *sharp_image;
    196 
    197   assert(wand != (MagickWand *) NULL);
    198   assert(wand->signature == MagickWandSignature);
    199   if (wand->debug != MagickFalse)
    200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    201   if (wand->images == (Image *) NULL)
    202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    203   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
    204   if (sharp_image == (Image *) NULL)
    205     return(MagickFalse);
    206   ReplaceImageInList(&wand->images,sharp_image);
    207   return(MagickTrue);
    208 }
    209 
    210 /*
    212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    213 %                                                                             %
    214 %                                                                             %
    215 %                                                                             %
    216 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
    217 %                                                                             %
    218 %                                                                             %
    219 %                                                                             %
    220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    221 %
    222 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
    223 %  triangulation.
    224 %
    225 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
    226 %        const size_t columns,const size_t rows)
    227 %
    228 %  A description of each parameter follows:
    229 %
    230 %    o wand: the magick wand.
    231 %
    232 %    o columns: the number of columns in the scaled image.
    233 %
    234 %    o rows: the number of rows in the scaled image.
    235 %
    236 */
    237 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
    238   const size_t columns,const size_t rows)
    239 {
    240   Image
    241     *resize_image;
    242 
    243   assert(wand != (MagickWand *) NULL);
    244   assert(wand->signature == MagickWandSignature);
    245   if (wand->debug != MagickFalse)
    246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    247   if (wand->images == (Image *) NULL)
    248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    249   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
    250   if (resize_image == (Image *) NULL)
    251     return(MagickFalse);
    252   ReplaceImageInList(&wand->images,resize_image);
    253   return(MagickTrue);
    254 }
    255 
    256 /*
    258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    259 %                                                                             %
    260 %                                                                             %
    261 %                                                                             %
    262 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
    263 %                                                                             %
    264 %                                                                             %
    265 %                                                                             %
    266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    267 %
    268 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
    269 %  more intensely near image edges and less intensely far from edges. We
    270 %  sharpen the image with a Gaussian operator of the given radius and standard
    271 %  deviation (sigma).  For reasonable results, radius should be larger than
    272 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
    273 %  suitable radius for you.
    274 %
    275 %  The format of the MagickAdaptiveSharpenImage method is:
    276 %
    277 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
    278 %        const double radius,const double sigma)
    279 %
    280 %  A description of each parameter follows:
    281 %
    282 %    o wand: the magick wand.
    283 %
    284 %    o radius: the radius of the Gaussian, in pixels, not counting the center
    285 %      pixel.
    286 %
    287 %    o sigma: the standard deviation of the Gaussian, in pixels.
    288 %
    289 */
    290 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
    291   const double radius,const double sigma)
    292 {
    293   Image
    294     *sharp_image;
    295 
    296   assert(wand != (MagickWand *) NULL);
    297   assert(wand->signature == MagickWandSignature);
    298   if (wand->debug != MagickFalse)
    299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    300   if (wand->images == (Image *) NULL)
    301     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    302   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
    303   if (sharp_image == (Image *) NULL)
    304     return(MagickFalse);
    305   ReplaceImageInList(&wand->images,sharp_image);
    306   return(MagickTrue);
    307 }
    308 
    309 /*
    311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    312 %                                                                             %
    313 %                                                                             %
    314 %                                                                             %
    315 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
    316 %                                                                             %
    317 %                                                                             %
    318 %                                                                             %
    319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    320 %
    321 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
    322 %  based on the range of intensity values in its local neighborhood.  This
    323 %  allows for thresholding of an image whose global intensity histogram
    324 %  doesn't contain distinctive peaks.
    325 %
    326 %  The format of the AdaptiveThresholdImage method is:
    327 %
    328 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
    329 %        const size_t width,const size_t height,const double bias)
    330 %
    331 %  A description of each parameter follows:
    332 %
    333 %    o wand: the magick wand.
    334 %
    335 %    o width: the width of the local neighborhood.
    336 %
    337 %    o height: the height of the local neighborhood.
    338 %
    339 %    o offset: the mean bias.
    340 %
    341 */
    342 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
    343   const size_t width,const size_t height,const double bias)
    344 {
    345   Image
    346     *threshold_image;
    347 
    348   assert(wand != (MagickWand *) NULL);
    349   assert(wand->signature == MagickWandSignature);
    350   if (wand->debug != MagickFalse)
    351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    352   if (wand->images == (Image *) NULL)
    353     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    354   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
    355     wand->exception);
    356   if (threshold_image == (Image *) NULL)
    357     return(MagickFalse);
    358   ReplaceImageInList(&wand->images,threshold_image);
    359   return(MagickTrue);
    360 }
    361 
    362 /*
    364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    365 %                                                                             %
    366 %                                                                             %
    367 %                                                                             %
    368 %   M a g i c k A d d I m a g e                                               %
    369 %                                                                             %
    370 %                                                                             %
    371 %                                                                             %
    372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    373 %
    374 %  MagickAddImage() adds a clone of the images from the second wand and
    375 %  inserts them into the first wand.
    376 %
    377 %  Use MagickSetLastIterator(), to append new images into an existing wand,
    378 %  current image will be set to last image so later adds with also be
    379 %  appened to end of wand.
    380 %
    381 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
    382 %  images added will also be prepended before other images in the wand.
    383 %  However the order of a list of new images will not change.
    384 %
    385 %  Otherwise the new images will be inserted just after the current image,
    386 %  and any later image will also be added after this current image but
    387 %  before the previously added images.  Caution is advised when multiple
    388 %  image adds are inserted into the middle of the wand image list.
    389 %
    390 %  The format of the MagickAddImage method is:
    391 %
    392 %      MagickBooleanType MagickAddImage(MagickWand *wand,
    393 %        const MagickWand *add_wand)
    394 %
    395 %  A description of each parameter follows:
    396 %
    397 %    o wand: the magick wand.
    398 %
    399 %    o add_wand: A wand that contains the image list to be added
    400 %
    401 */
    402 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
    403   Image *images)
    404 {
    405   if (wand->images == (Image *) NULL)
    406     {
    407       /*
    408         No images in wand, just add them, set current as appropriate.
    409       */
    410       if (wand->insert_before != MagickFalse)
    411         wand->images=GetFirstImageInList(images);
    412       else
    413         wand->images=GetLastImageInList(images);
    414       return(MagickTrue);
    415     }
    416   /* user jumped to first image, so prepend new images - remain active */
    417   if ((wand->insert_before != MagickFalse) &&
    418        (wand->images->previous == (Image *) NULL))
    419     {
    420       PrependImageToList(&wand->images,images);
    421       wand->images=GetFirstImageInList(images);
    422       return(MagickTrue);
    423     }
    424   /*
    425     Note you should never have 'insert_before' true when current image is not
    426     the first image in the wand!  That is no insert before current image, only
    427     after current image
    428   */
    429   if (wand->images->next == (Image *) NULL)
    430     {
    431       /*
    432         At last image, append new images.
    433       */
    434       InsertImageInList(&wand->images,images);
    435       wand->images=GetLastImageInList(images);
    436       return(MagickTrue);
    437     }
    438   /*
    439     Insert new images, just after the current image.
    440   */
    441   InsertImageInList(&wand->images,images);
    442   return(MagickTrue);
    443 }
    444 
    445 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
    446   const MagickWand *add_wand)
    447 {
    448   Image
    449     *images;
    450 
    451   assert(wand != (MagickWand *) NULL);
    452   assert(wand->signature == MagickWandSignature);
    453   if (wand->debug != MagickFalse)
    454     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    455   assert(add_wand != (MagickWand *) NULL);
    456   assert(add_wand->signature == MagickWandSignature);
    457   if (add_wand->images == (Image *) NULL)
    458     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
    459   /*
    460     Clone images in second wand, and insert into first.
    461   */
    462   images=CloneImageList(add_wand->images,wand->exception);
    463   if (images == (Image *) NULL)
    464     return(MagickFalse);
    465   return(InsertImageInWand(wand,images));
    466 }
    467 
    468 /*
    470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    471 %                                                                             %
    472 %                                                                             %
    473 %                                                                             %
    474 %     M a g i c k A d d N o i s e I m a g e                                   %
    475 %                                                                             %
    476 %                                                                             %
    477 %                                                                             %
    478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    479 %
    480 %  MagickAddNoiseImage() adds random noise to the image.
    481 %
    482 %  The format of the MagickAddNoiseImage method is:
    483 %
    484 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
    485 %        const NoiseType noise_type,const double attenuate)
    486 %
    487 %  A description of each parameter follows:
    488 %
    489 %    o wand: the magick wand.
    490 %
    491 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
    492 %      Impulse, Laplacian, or Poisson.
    493 %
    494 %    o attenuate:  attenuate the random distribution.
    495 %
    496 */
    497 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
    498   const NoiseType noise_type,const double attenuate)
    499 {
    500   Image
    501     *noise_image;
    502 
    503   assert(wand != (MagickWand *) NULL);
    504   assert(wand->signature == MagickWandSignature);
    505   if (wand->debug != MagickFalse)
    506     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    507   if (wand->images == (Image *) NULL)
    508     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    509   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
    510   if (noise_image == (Image *) NULL)
    511     return(MagickFalse);
    512   ReplaceImageInList(&wand->images,noise_image);
    513   return(MagickTrue);
    514 }
    515 
    516 /*
    518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    519 %                                                                             %
    520 %                                                                             %
    521 %                                                                             %
    522 %   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
    523 %                                                                             %
    524 %                                                                             %
    525 %                                                                             %
    526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    527 %
    528 %  MagickAffineTransformImage() transforms an image as dictated by the affine
    529 %  matrix of the drawing wand.
    530 %
    531 %  The format of the MagickAffineTransformImage method is:
    532 %
    533 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
    534 %        const DrawingWand *drawing_wand)
    535 %
    536 %  A description of each parameter follows:
    537 %
    538 %    o wand: the magick wand.
    539 %
    540 %    o drawing_wand: the draw wand.
    541 %
    542 */
    543 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
    544   const DrawingWand *drawing_wand)
    545 {
    546   DrawInfo
    547     *draw_info;
    548 
    549   Image
    550     *affine_image;
    551 
    552   assert(wand != (MagickWand *) NULL);
    553   assert(wand->signature == MagickWandSignature);
    554   if (wand->debug != MagickFalse)
    555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    556   if (wand->images == (Image *) NULL)
    557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    558   draw_info=PeekDrawingWand(drawing_wand);
    559   if (draw_info == (DrawInfo *) NULL)
    560     return(MagickFalse);
    561   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
    562     wand->exception);
    563   draw_info=DestroyDrawInfo(draw_info);
    564   if (affine_image == (Image *) NULL)
    565     return(MagickFalse);
    566   ReplaceImageInList(&wand->images,affine_image);
    567   return(MagickTrue);
    568 }
    569 
    570 /*
    572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    573 %                                                                             %
    574 %                                                                             %
    575 %                                                                             %
    576 %   M a g i c k A n n o t a t e I m a g e                                     %
    577 %                                                                             %
    578 %                                                                             %
    579 %                                                                             %
    580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    581 %
    582 %  MagickAnnotateImage() annotates an image with text.
    583 %
    584 %  The format of the MagickAnnotateImage method is:
    585 %
    586 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
    587 %        const DrawingWand *drawing_wand,const double x,const double y,
    588 %        const double angle,const char *text)
    589 %
    590 %  A description of each parameter follows:
    591 %
    592 %    o wand: the magick wand.
    593 %
    594 %    o drawing_wand: the draw wand.
    595 %
    596 %    o x: x ordinate to left of text
    597 %
    598 %    o y: y ordinate to text baseline
    599 %
    600 %    o angle: rotate text relative to this angle.
    601 %
    602 %    o text: text to draw
    603 %
    604 */
    605 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
    606   const DrawingWand *drawing_wand,const double x,const double y,
    607   const double angle,const char *text)
    608 {
    609   char
    610     geometry[MagickPathExtent];
    611 
    612   DrawInfo
    613     *draw_info;
    614 
    615   MagickBooleanType
    616     status;
    617 
    618   assert(wand != (MagickWand *) NULL);
    619   assert(wand->signature == MagickWandSignature);
    620   if (wand->debug != MagickFalse)
    621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    622   if (wand->images == (Image *) NULL)
    623     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    624   draw_info=PeekDrawingWand(drawing_wand);
    625   if (draw_info == (DrawInfo *) NULL)
    626     return(MagickFalse);
    627   (void) CloneString(&draw_info->text,text);
    628   (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
    629   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
    630   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
    631   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
    632   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
    633   (void) CloneString(&draw_info->geometry,geometry);
    634   status=AnnotateImage(wand->images,draw_info,wand->exception);
    635   draw_info=DestroyDrawInfo(draw_info);
    636   return(status);
    637 }
    638 
    639 /*
    641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    642 %                                                                             %
    643 %                                                                             %
    644 %                                                                             %
    645 %   M a g i c k A n i m a t e I m a g e s                                     %
    646 %                                                                             %
    647 %                                                                             %
    648 %                                                                             %
    649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    650 %
    651 %  MagickAnimateImages() animates an image or image sequence.
    652 %
    653 %  The format of the MagickAnimateImages method is:
    654 %
    655 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
    656 %        const char *server_name)
    657 %
    658 %  A description of each parameter follows:
    659 %
    660 %    o wand: the magick wand.
    661 %
    662 %    o server_name: the X server name.
    663 %
    664 */
    665 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
    666   const char *server_name)
    667 {
    668   MagickBooleanType
    669     status;
    670 
    671   assert(wand != (MagickWand *) NULL);
    672   assert(wand->signature == MagickWandSignature);
    673   if (wand->debug != MagickFalse)
    674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    675   (void) CloneString(&wand->image_info->server_name,server_name);
    676   status=AnimateImages(wand->image_info,wand->images,wand->exception);
    677   return(status);
    678 }
    679 
    680 /*
    682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    683 %                                                                             %
    684 %                                                                             %
    685 %                                                                             %
    686 %   M a g i c k A p p e n d I m a g e s                                       %
    687 %                                                                             %
    688 %                                                                             %
    689 %                                                                             %
    690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    691 %
    692 %  MagickAppendImages() append the images in a wand from the current image
    693 %  onwards, creating a new wand with the single image result.  This is
    694 %  affected by the gravity and background settings of the first image.
    695 %
    696 %  Typically you would call either MagickResetIterator() or
    697 %  MagickSetFirstImage() before calling this function to ensure that all
    698 %  the images in the wand's image list will be appended together.
    699 %
    700 %  The format of the MagickAppendImages method is:
    701 %
    702 %      MagickWand *MagickAppendImages(MagickWand *wand,
    703 %        const MagickBooleanType stack)
    704 %
    705 %  A description of each parameter follows:
    706 %
    707 %    o wand: the magick wand.
    708 %
    709 %    o stack: By default, images are stacked left-to-right. Set stack to
    710 %      MagickTrue to stack them top-to-bottom.
    711 %
    712 */
    713 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
    714   const MagickBooleanType stack)
    715 {
    716   Image
    717     *append_image;
    718 
    719   assert(wand != (MagickWand *) NULL);
    720   assert(wand->signature == MagickWandSignature);
    721   if (wand->debug != MagickFalse)
    722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    723   if (wand->images == (Image *) NULL)
    724     return((MagickWand *) NULL);
    725   append_image=AppendImages(wand->images,stack,wand->exception);
    726   if (append_image == (Image *) NULL)
    727     return((MagickWand *) NULL);
    728   return(CloneMagickWandFromImages(wand,append_image));
    729 }
    730 
    731 /*
    733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    734 %                                                                             %
    735 %                                                                             %
    736 %                                                                             %
    737 %   M a g i c k A u t o G a m m a I m a g e                                   %
    738 %                                                                             %
    739 %                                                                             %
    740 %                                                                             %
    741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    742 %
    743 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
    744 %  image to try make set its gamma appropriatally.
    745 %
    746 %  The format of the MagickAutoGammaImage method is:
    747 %
    748 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
    749 %
    750 %  A description of each parameter follows:
    751 %
    752 %    o wand: the magick wand.
    753 %
    754 */
    755 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
    756 {
    757   MagickBooleanType
    758     status;
    759 
    760   assert(wand != (MagickWand *) NULL);
    761   assert(wand->signature == MagickWandSignature);
    762   if (wand->debug != MagickFalse)
    763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    764   if (wand->images == (Image *) NULL)
    765     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    766   status=AutoGammaImage(wand->images,wand->exception);
    767   return(status);
    768 }
    769 
    770 /*
    772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    773 %                                                                             %
    774 %                                                                             %
    775 %                                                                             %
    776 %   M a g i c k A u t o L e v e l I m a g e                                   %
    777 %                                                                             %
    778 %                                                                             %
    779 %                                                                             %
    780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    781 %
    782 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
    783 %  scaling the minimum and maximum values to the full quantum range.
    784 %
    785 %  The format of the MagickAutoLevelImage method is:
    786 %
    787 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
    788 %
    789 %  A description of each parameter follows:
    790 %
    791 %    o wand: the magick wand.
    792 %
    793 */
    794 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
    795 {
    796   MagickBooleanType
    797     status;
    798 
    799   assert(wand != (MagickWand *) NULL);
    800   assert(wand->signature == MagickWandSignature);
    801   if (wand->debug != MagickFalse)
    802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    803   if (wand->images == (Image *) NULL)
    804     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    805   status=AutoLevelImage(wand->images,wand->exception);
    806   return(status);
    807 }
    808 
    809 /*
    810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    811 %                                                                             %
    812 %                                                                             %
    813 %                                                                             %
    814 %   M a g i c k A u t o O r i e n t I m a g e                                 %
    815 %                                                                             %
    816 %                                                                             %
    817 %                                                                             %
    818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    819 %
    820 %  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
    821 $  for viewing (i.e. top-left orientation).
    822 %
    823 %  The format of the MagickAutoOrientImage method is:
    824 %
    825 %      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
    826 %
    827 %  A description of each parameter follows:
    828 %
    829 %    o wand: the magick wand.
    830 %
    831 */
    832 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
    833 {
    834 
    835   Image
    836     *orient_image;
    837 
    838   assert(wand != (MagickWand *) NULL);
    839   assert(wand->signature == MagickWandSignature);
    840   if (wand->debug != MagickFalse)
    841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    842   if (wand->images == (Image *) NULL)
    843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    844   orient_image=AutoOrientImage(wand->images,wand->images->orientation,
    845     wand->exception);
    846   if (orient_image == (Image *) NULL)
    847     return(MagickFalse);
    848   ReplaceImageInList(&wand->images,orient_image);
    849   return(MagickTrue);
    850 }
    851 
    852 /*
    854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    855 %                                                                             %
    856 %                                                                             %
    857 %                                                                             %
    858 %   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
    859 %                                                                             %
    860 %                                                                             %
    861 %                                                                             %
    862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    863 %
    864 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
    865 %  pixels below the threshold into black while leaving all pixels above the
    866 %  threshold unchanged.
    867 %
    868 %  The format of the MagickBlackThresholdImage method is:
    869 %
    870 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
    871 %        const PixelWand *threshold)
    872 %
    873 %  A description of each parameter follows:
    874 %
    875 %    o wand: the magick wand.
    876 %
    877 %    o threshold: the pixel wand.
    878 %
    879 */
    880 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
    881   const PixelWand *threshold)
    882 {
    883   char
    884     thresholds[MagickPathExtent];
    885 
    886   MagickBooleanType
    887     status;
    888 
    889   assert(wand != (MagickWand *) NULL);
    890   assert(wand->signature == MagickWandSignature);
    891   if (wand->debug != MagickFalse)
    892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    893   if (wand->images == (Image *) NULL)
    894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    895   (void) FormatLocaleString(thresholds,MagickPathExtent,
    896     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
    897     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
    898     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
    899   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
    900   return(status);
    901 }
    902 
    903 /*
    905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    906 %                                                                             %
    907 %                                                                             %
    908 %                                                                             %
    909 %   M a g i c k B l u e S h i f t I m a g e                                   %
    910 %                                                                             %
    911 %                                                                             %
    912 %                                                                             %
    913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    914 %
    915 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
    916 %  nighttime in the moonlight.
    917 %
    918 %  The format of the MagickBlueShiftImage method is:
    919 %
    920 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
    921 %        const double factor)
    922 %
    923 %  A description of each parameter follows:
    924 %
    925 %    o wand: the magick wand.
    926 %
    927 %    o factor: the blue shift factor (default 1.5)
    928 %
    929 */
    930 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
    931   const double factor)
    932 {
    933   Image
    934     *shift_image;
    935 
    936   assert(wand != (MagickWand *) NULL);
    937   assert(wand->signature == MagickWandSignature);
    938   if (wand->debug != MagickFalse)
    939     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    940   if (wand->images == (Image *) NULL)
    941     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    942   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
    943   if (shift_image == (Image *) NULL)
    944     return(MagickFalse);
    945   ReplaceImageInList(&wand->images,shift_image);
    946   return(MagickTrue);
    947 }
    948 
    949 /*
    951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    952 %                                                                             %
    953 %                                                                             %
    954 %                                                                             %
    955 %   M a g i c k B l u r I m a g e                                             %
    956 %                                                                             %
    957 %                                                                             %
    958 %                                                                             %
    959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    960 %
    961 %  MagickBlurImage() blurs an image.  We convolve the image with a
    962 %  gaussian operator of the given radius and standard deviation (sigma).
    963 %  For reasonable results, the radius should be larger than sigma.  Use a
    964 %  radius of 0 and BlurImage() selects a suitable radius for you.
    965 %
    966 %  The format of the MagickBlurImage method is:
    967 %
    968 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
    969 %        const double sigma)
    970 %
    971 %  A description of each parameter follows:
    972 %
    973 %    o wand: the magick wand.
    974 %
    975 %    o radius: the radius of the , in pixels, not counting the center
    976 %      pixel.
    977 %
    978 %    o sigma: the standard deviation of the , in pixels.
    979 %
    980 */
    981 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
    982   const double radius,const double sigma)
    983 {
    984   Image
    985     *blur_image;
    986 
    987   assert(wand != (MagickWand *) NULL);
    988   assert(wand->signature == MagickWandSignature);
    989   if (wand->debug != MagickFalse)
    990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
    991   if (wand->images == (Image *) NULL)
    992     ThrowWandException(WandError,"ContainsNoImages",wand->name);
    993   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
    994   if (blur_image == (Image *) NULL)
    995     return(MagickFalse);
    996   ReplaceImageInList(&wand->images,blur_image);
    997   return(MagickTrue);
    998 }
    999 
   1000 /*
   1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1003 %                                                                             %
   1004 %                                                                             %
   1005 %                                                                             %
   1006 %   M a g i c k B o r d e r I m a g e                                         %
   1007 %                                                                             %
   1008 %                                                                             %
   1009 %                                                                             %
   1010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1011 %
   1012 %  MagickBorderImage() surrounds the image with a border of the color defined
   1013 %  by the bordercolor pixel wand.
   1014 %
   1015 %  The format of the MagickBorderImage method is:
   1016 %
   1017 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
   1018 %        const PixelWand *bordercolor,const size_t width,
   1019 %        const size_t height,const CompositeOperator compose)
   1020 %
   1021 %  A description of each parameter follows:
   1022 %
   1023 %    o wand: the magick wand.
   1024 %
   1025 %    o bordercolor: the border color pixel wand.
   1026 %
   1027 %    o width: the border width.
   1028 %
   1029 %    o height: the border height.
   1030 %
   1031 %    o compose: the composite operator.
   1032 %
   1033 */
   1034 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
   1035   const PixelWand *bordercolor,const size_t width,const size_t height,
   1036   const CompositeOperator compose)
   1037 {
   1038   Image
   1039     *border_image;
   1040 
   1041   RectangleInfo
   1042     border_info;
   1043 
   1044   assert(wand != (MagickWand *) NULL);
   1045   assert(wand->signature == MagickWandSignature);
   1046   if (wand->debug != MagickFalse)
   1047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1048   if (wand->images == (Image *) NULL)
   1049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1050   border_info.width=width;
   1051   border_info.height=height;
   1052   border_info.x=0;
   1053   border_info.y=0;
   1054   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
   1055   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
   1056   if (border_image == (Image *) NULL)
   1057     return(MagickFalse);
   1058   ReplaceImageInList(&wand->images,border_image);
   1059   return(MagickTrue);
   1060 }
   1061 
   1062 /*
   1064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1065 %                                                                             %
   1066 %                                                                             %
   1067 %                                                                             %
   1068 %   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
   1069 %                                                                             %
   1070 %                                                                             %
   1071 %                                                                             %
   1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1073 %
   1074 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
   1075 %  of an image.  It converts the brightness and contrast parameters into slope
   1076 %  and intercept and calls a polynomical function to apply to the image.
   1077 
   1078 %
   1079 %  The format of the MagickBrightnessContrastImage method is:
   1080 %
   1081 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
   1082 %        const double brightness,const double contrast)
   1083 %
   1084 %  A description of each parameter follows:
   1085 %
   1086 %    o wand: the magick wand.
   1087 %
   1088 %    o brightness: the brightness percent (-100 .. 100).
   1089 %
   1090 %    o contrast: the contrast percent (-100 .. 100).
   1091 %
   1092 */
   1093 WandExport MagickBooleanType MagickBrightnessContrastImage(
   1094   MagickWand *wand,const double brightness,const double contrast)
   1095 {
   1096   MagickBooleanType
   1097     status;
   1098 
   1099   assert(wand != (MagickWand *) NULL);
   1100   assert(wand->signature == MagickWandSignature);
   1101   if (wand->debug != MagickFalse)
   1102     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1103   if (wand->images == (Image *) NULL)
   1104     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1105   status=BrightnessContrastImage(wand->images,brightness,contrast,
   1106     wand->exception);
   1107   return(status);
   1108 }
   1109 
   1110 /*
   1112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1113 %                                                                             %
   1114 %                                                                             %
   1115 %                                                                             %
   1116 %   M a g i c k C h a n n e l F x I m a g e                                   %
   1117 %                                                                             %
   1118 %                                                                             %
   1119 %                                                                             %
   1120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1121 %
   1122 %  MagickChannelFxImage() applies a channel expression to the specified image.
   1123 %  The expression consists of one or more channels, either mnemonic or numeric
   1124 %  (e.g. red, 1), separated by actions as follows:
   1125 %
   1126 %    <=>     exchange two channels (e.g. red<=>blue)
   1127 %    =>      transfer a channel to another (e.g. red=>green)
   1128 %    ,       separate channel operations (e.g. red, green)
   1129 %    |       read channels from next input image (e.g. red | green)
   1130 %    ;       write channels to next output image (e.g. red; green; blue)
   1131 %
   1132 %  A channel without a operation symbol implies extract. For example, to create
   1133 %  3 grayscale images from the red, green, and blue channels of an image, use:
   1134 %
   1135 %    -channel-fx "red; green; blue"
   1136 %
   1137 %  The format of the MagickChannelFxImage method is:
   1138 %
   1139 %      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
   1140 %
   1141 %  A description of each parameter follows:
   1142 %
   1143 %    o wand: the magick wand.
   1144 %
   1145 %    o expression: the expression.
   1146 %
   1147 */
   1148 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
   1149   const char *expression)
   1150 {
   1151   Image
   1152     *fx_image;
   1153 
   1154   assert(wand != (MagickWand *) NULL);
   1155   assert(wand->signature == MagickWandSignature);
   1156   if (wand->debug != MagickFalse)
   1157     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1158   if (wand->images == (Image *) NULL)
   1159     return((MagickWand *) NULL);
   1160   fx_image=ChannelFxImage(wand->images,expression,wand->exception);
   1161   if (fx_image == (Image *) NULL)
   1162     return((MagickWand *) NULL);
   1163   return(CloneMagickWandFromImages(wand,fx_image));
   1164 }
   1165 
   1166 /*
   1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1169 %                                                                             %
   1170 %                                                                             %
   1171 %                                                                             %
   1172 %   M a g i c k C h a r c o a l I m a g e                                     %
   1173 %                                                                             %
   1174 %                                                                             %
   1175 %                                                                             %
   1176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1177 %
   1178 %  MagickCharcoalImage() simulates a charcoal drawing.
   1179 %
   1180 %  The format of the MagickCharcoalImage method is:
   1181 %
   1182 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
   1183 %        const double radius,const double sigma)
   1184 %
   1185 %  A description of each parameter follows:
   1186 %
   1187 %    o wand: the magick wand.
   1188 %
   1189 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   1190 %      pixel.
   1191 %
   1192 %    o sigma: the standard deviation of the Gaussian, in pixels.
   1193 %
   1194 */
   1195 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
   1196   const double radius,const double sigma)
   1197 {
   1198   Image
   1199     *charcoal_image;
   1200 
   1201   assert(wand != (MagickWand *) NULL);
   1202   assert(wand->signature == MagickWandSignature);
   1203   if (wand->debug != MagickFalse)
   1204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1205   if (wand->images == (Image *) NULL)
   1206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1207   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
   1208   if (charcoal_image == (Image *) NULL)
   1209     return(MagickFalse);
   1210   ReplaceImageInList(&wand->images,charcoal_image);
   1211   return(MagickTrue);
   1212 }
   1213 
   1214 /*
   1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1217 %                                                                             %
   1218 %                                                                             %
   1219 %                                                                             %
   1220 %   M a g i c k C h o p I m a g e                                             %
   1221 %                                                                             %
   1222 %                                                                             %
   1223 %                                                                             %
   1224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1225 %
   1226 %  MagickChopImage() removes a region of an image and collapses the image to
   1227 %  occupy the removed portion
   1228 %
   1229 %  The format of the MagickChopImage method is:
   1230 %
   1231 %      MagickBooleanType MagickChopImage(MagickWand *wand,
   1232 %        const size_t width,const size_t height,const ssize_t x,
   1233 %        const ssize_t y)
   1234 %
   1235 %  A description of each parameter follows:
   1236 %
   1237 %    o wand: the magick wand.
   1238 %
   1239 %    o width: the region width.
   1240 %
   1241 %    o height: the region height.
   1242 %
   1243 %    o x: the region x offset.
   1244 %
   1245 %    o y: the region y offset.
   1246 %
   1247 %
   1248 */
   1249 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
   1250   const size_t width,const size_t height,const ssize_t x,
   1251   const ssize_t y)
   1252 {
   1253   Image
   1254     *chop_image;
   1255 
   1256   RectangleInfo
   1257     chop;
   1258 
   1259   assert(wand != (MagickWand *) NULL);
   1260   assert(wand->signature == MagickWandSignature);
   1261   if (wand->debug != MagickFalse)
   1262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1263   if (wand->images == (Image *) NULL)
   1264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1265   chop.width=width;
   1266   chop.height=height;
   1267   chop.x=x;
   1268   chop.y=y;
   1269   chop_image=ChopImage(wand->images,&chop,wand->exception);
   1270   if (chop_image == (Image *) NULL)
   1271     return(MagickFalse);
   1272   ReplaceImageInList(&wand->images,chop_image);
   1273   return(MagickTrue);
   1274 }
   1275 
   1276 /*
   1278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1279 %                                                                             %
   1280 %                                                                             %
   1281 %                                                                             %
   1282 %   M a g i c k C l a m p I m a g e                                           %
   1283 %                                                                             %
   1284 %                                                                             %
   1285 %                                                                             %
   1286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1287 %
   1288 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
   1289 %
   1290 %  The format of the MagickClampImage method is:
   1291 %
   1292 %      MagickBooleanType MagickClampImage(MagickWand *wand)
   1293 %
   1294 %  A description of each parameter follows:
   1295 %
   1296 %    o wand: the magick wand.
   1297 %
   1298 %    o channel: the channel.
   1299 %
   1300 */
   1301 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
   1302 {
   1303   assert(wand != (MagickWand *) NULL);
   1304   assert(wand->signature == MagickWandSignature);
   1305   if (wand->debug != MagickFalse)
   1306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1307   if (wand->images == (Image *) NULL)
   1308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1309   return(ClampImage(wand->images,wand->exception));
   1310 }
   1311 
   1312 /*
   1314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1315 %                                                                             %
   1316 %                                                                             %
   1317 %                                                                             %
   1318 %   M a g i c k C l i p I m a g e                                             %
   1319 %                                                                             %
   1320 %                                                                             %
   1321 %                                                                             %
   1322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1323 %
   1324 %  MagickClipImage() clips along the first path from the 8BIM profile, if
   1325 %  present.
   1326 %
   1327 %  The format of the MagickClipImage method is:
   1328 %
   1329 %      MagickBooleanType MagickClipImage(MagickWand *wand)
   1330 %
   1331 %  A description of each parameter follows:
   1332 %
   1333 %    o wand: the magick wand.
   1334 %
   1335 */
   1336 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
   1337 {
   1338   MagickBooleanType
   1339     status;
   1340 
   1341   assert(wand != (MagickWand *) NULL);
   1342   assert(wand->signature == MagickWandSignature);
   1343   if (wand->debug != MagickFalse)
   1344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1345   if (wand->images == (Image *) NULL)
   1346     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1347   status=ClipImage(wand->images,wand->exception);
   1348   return(status);
   1349 }
   1350 
   1351 /*
   1353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1354 %                                                                             %
   1355 %                                                                             %
   1356 %                                                                             %
   1357 %   M a g i c k C l i p I m a g e P a t h                                     %
   1358 %                                                                             %
   1359 %                                                                             %
   1360 %                                                                             %
   1361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1362 %
   1363 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
   1364 %  present. Later operations take effect inside the path.  Id may be a number
   1365 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
   1366 %  path.
   1367 %
   1368 %  The format of the MagickClipImagePath method is:
   1369 %
   1370 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
   1371 %        const char *pathname,const MagickBooleanType inside)
   1372 %
   1373 %  A description of each parameter follows:
   1374 %
   1375 %    o wand: the magick wand.
   1376 %
   1377 %    o pathname: name of clipping path resource. If name is preceded by #, use
   1378 %      clipping path numbered by name.
   1379 %
   1380 %    o inside: if non-zero, later operations take effect inside clipping path.
   1381 %      Otherwise later operations take effect outside clipping path.
   1382 %
   1383 */
   1384 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
   1385   const char *pathname,const MagickBooleanType inside)
   1386 {
   1387   MagickBooleanType
   1388     status;
   1389 
   1390   assert(wand != (MagickWand *) NULL);
   1391   assert(wand->signature == MagickWandSignature);
   1392   if (wand->debug != MagickFalse)
   1393     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1394   if (wand->images == (Image *) NULL)
   1395     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1396   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
   1397   return(status);
   1398 }
   1399 
   1400 /*
   1402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1403 %                                                                             %
   1404 %                                                                             %
   1405 %                                                                             %
   1406 %   M a g i c k C l u t I m a g e                                             %
   1407 %                                                                             %
   1408 %                                                                             %
   1409 %                                                                             %
   1410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1411 %
   1412 %  MagickClutImage() replaces colors in the image from a color lookup table.
   1413 %
   1414 %  The format of the MagickClutImage method is:
   1415 %
   1416 %      MagickBooleanType MagickClutImage(MagickWand *wand,
   1417 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
   1418 %
   1419 %  A description of each parameter follows:
   1420 %
   1421 %    o wand: the magick wand.
   1422 %
   1423 %    o clut_image: the clut image.
   1424 %
   1425 %    o method: the pixel interpolation method.
   1426 %
   1427 */
   1428 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
   1429   const MagickWand *clut_wand,const PixelInterpolateMethod method)
   1430 {
   1431   MagickBooleanType
   1432     status;
   1433 
   1434   assert(wand != (MagickWand *) NULL);
   1435   assert(wand->signature == MagickWandSignature);
   1436   if (wand->debug != MagickFalse)
   1437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1438   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
   1439     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1440   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
   1441   return(status);
   1442 }
   1443 
   1444 /*
   1446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1447 %                                                                             %
   1448 %                                                                             %
   1449 %                                                                             %
   1450 %   M a g i c k C o a l e s c e I m a g e s                                   %
   1451 %                                                                             %
   1452 %                                                                             %
   1453 %                                                                             %
   1454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1455 %
   1456 %  MagickCoalesceImages() composites a set of images while respecting any page
   1457 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
   1458 %  typically start with an image background and each subsequent image
   1459 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
   1460 %  where each image in the sequence is the same size as the first and
   1461 %  composited with the next image in the sequence.
   1462 %
   1463 %  The format of the MagickCoalesceImages method is:
   1464 %
   1465 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
   1466 %
   1467 %  A description of each parameter follows:
   1468 %
   1469 %    o wand: the magick wand.
   1470 %
   1471 */
   1472 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
   1473 {
   1474   Image
   1475     *coalesce_image;
   1476 
   1477   assert(wand != (MagickWand *) NULL);
   1478   assert(wand->signature == MagickWandSignature);
   1479   if (wand->debug != MagickFalse)
   1480     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1481   if (wand->images == (Image *) NULL)
   1482     return((MagickWand *) NULL);
   1483   coalesce_image=CoalesceImages(wand->images,wand->exception);
   1484   if (coalesce_image == (Image *) NULL)
   1485     return((MagickWand *) NULL);
   1486   return(CloneMagickWandFromImages(wand,coalesce_image));
   1487 }
   1488 
   1489 /*
   1491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1492 %                                                                             %
   1493 %                                                                             %
   1494 %                                                                             %
   1495 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
   1496 %                                                                             %
   1497 %                                                                             %
   1498 %                                                                             %
   1499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1500 %
   1501 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
   1502 %  Collection (CCC) file which solely contains one or more color corrections
   1503 %  and applies the color correction to the image.  Here is a sample CCC file:
   1504 %
   1505 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
   1506 %          <ColorCorrection id="cc03345">
   1507 %                <SOPNode>
   1508 %                     <Slope> 0.9 1.2 0.5 </Slope>
   1509 %                     <Offset> 0.4 -0.5 0.6 </Offset>
   1510 %                     <Power> 1.0 0.8 1.5 </Power>
   1511 %                </SOPNode>
   1512 %                <SATNode>
   1513 %                     <Saturation> 0.85 </Saturation>
   1514 %                </SATNode>
   1515 %          </ColorCorrection>
   1516 %    </ColorCorrectionCollection>
   1517 %
   1518 %  which includes the offset, slope, and power for each of the RGB channels
   1519 %  as well as the saturation.
   1520 %
   1521 %  The format of the MagickColorDecisionListImage method is:
   1522 %
   1523 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
   1524 %        const char *color_correction_collection)
   1525 %
   1526 %  A description of each parameter follows:
   1527 %
   1528 %    o wand: the magick wand.
   1529 %
   1530 %    o color_correction_collection: the color correction collection in XML.
   1531 %
   1532 */
   1533 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
   1534   const char *color_correction_collection)
   1535 {
   1536   MagickBooleanType
   1537     status;
   1538 
   1539   assert(wand != (MagickWand *) NULL);
   1540   assert(wand->signature == MagickWandSignature);
   1541   if (wand->debug != MagickFalse)
   1542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1543   if (wand->images == (Image *) NULL)
   1544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1545   status=ColorDecisionListImage(wand->images,color_correction_collection,
   1546     wand->exception);
   1547   return(status);
   1548 }
   1549 
   1550 /*
   1552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1553 %                                                                             %
   1554 %                                                                             %
   1555 %                                                                             %
   1556 %   M a g i c k C o l o r i z e I m a g e                                     %
   1557 %                                                                             %
   1558 %                                                                             %
   1559 %                                                                             %
   1560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1561 %
   1562 %  MagickColorizeImage() blends the fill color with each pixel in the image.
   1563 %
   1564 %  The format of the MagickColorizeImage method is:
   1565 %
   1566 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
   1567 %        const PixelWand *colorize,const PixelWand *blend)
   1568 %
   1569 %  A description of each parameter follows:
   1570 %
   1571 %    o wand: the magick wand.
   1572 %
   1573 %    o colorize: the colorize pixel wand.
   1574 %
   1575 %    o alpha: the alpha pixel wand.
   1576 %
   1577 */
   1578 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
   1579   const PixelWand *colorize,const PixelWand *blend)
   1580 {
   1581   char
   1582     percent_blend[MagickPathExtent];
   1583 
   1584   Image
   1585     *colorize_image;
   1586 
   1587   PixelInfo
   1588     target;
   1589 
   1590   assert(wand != (MagickWand *) NULL);
   1591   assert(wand->signature == MagickWandSignature);
   1592   if (wand->debug != MagickFalse)
   1593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1594   if (wand->images == (Image *) NULL)
   1595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1596   GetPixelInfo(wand->images,&target);
   1597   if (target.colorspace != CMYKColorspace)
   1598     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   1599       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
   1600       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   1601       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   1602       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   1603       PixelGetAlphaQuantum(blend)));
   1604   else
   1605     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   1606       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
   1607       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   1608       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   1609       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   1610       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
   1611       PixelGetAlphaQuantum(blend)));
   1612   target=PixelGetPixel(colorize);
   1613   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
   1614     wand->exception);
   1615   if (colorize_image == (Image *) NULL)
   1616     return(MagickFalse);
   1617   ReplaceImageInList(&wand->images,colorize_image);
   1618   return(MagickTrue);
   1619 }
   1620 
   1621 /*
   1623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1624 %                                                                             %
   1625 %                                                                             %
   1626 %                                                                             %
   1627 %   M a g i c k C o l o r M a t r i x I m a g e                               %
   1628 %                                                                             %
   1629 %                                                                             %
   1630 %                                                                             %
   1631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1632 %
   1633 %  MagickColorMatrixImage() apply color transformation to an image. The method
   1634 %  permits saturation changes, hue rotation, luminance to alpha, and various
   1635 %  other effects.  Although variable-sized transformation matrices can be used,
   1636 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
   1637 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
   1638 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
   1639 %  and offsets are normalized (divide Flash offset by 255).
   1640 %
   1641 %  The format of the MagickColorMatrixImage method is:
   1642 %
   1643 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
   1644 %        const KernelInfo *color_matrix)
   1645 %
   1646 %  A description of each parameter follows:
   1647 %
   1648 %    o wand: the magick wand.
   1649 %
   1650 %    o color_matrix:  the color matrix.
   1651 %
   1652 */
   1653 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
   1654   const KernelInfo *color_matrix)
   1655 {
   1656   Image
   1657     *color_image;
   1658 
   1659   assert(wand != (MagickWand *) NULL);
   1660   assert(wand->signature == MagickWandSignature);
   1661   if (wand->debug != MagickFalse)
   1662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1663   if (color_matrix == (const KernelInfo *) NULL)
   1664     return(MagickFalse);
   1665   if (wand->images == (Image *) NULL)
   1666     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1667   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
   1668   if (color_image == (Image *) NULL)
   1669     return(MagickFalse);
   1670   ReplaceImageInList(&wand->images,color_image);
   1671   return(MagickTrue);
   1672 }
   1673 
   1674 /*
   1676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1677 %                                                                             %
   1678 %                                                                             %
   1679 %                                                                             %
   1680 %   M a g i c k C o m b i n e I m a g e s                                     %
   1681 %                                                                             %
   1682 %                                                                             %
   1683 %                                                                             %
   1684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1685 %
   1686 %  MagickCombineImages() combines one or more images into a single image.  The
   1687 %  grayscale value of the pixels of each image in the sequence is assigned in
   1688 %  order to the specified  hannels of the combined image.   The typical
   1689 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
   1690 %
   1691 %  The format of the MagickCombineImages method is:
   1692 %
   1693 %      MagickWand *MagickCombineImages(MagickWand *wand,
   1694 %        const ColorspaceType colorspace)
   1695 %
   1696 %  A description of each parameter follows:
   1697 %
   1698 %    o wand: the magick wand.
   1699 %
   1700 %    o colorspace: the colorspace.
   1701 %
   1702 */
   1703 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
   1704   const ColorspaceType colorspace)
   1705 {
   1706   Image
   1707     *combine_image;
   1708 
   1709   assert(wand != (MagickWand *) NULL);
   1710   assert(wand->signature == MagickWandSignature);
   1711   if (wand->debug != MagickFalse)
   1712     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1713   if (wand->images == (Image *) NULL)
   1714     return((MagickWand *) NULL);
   1715   combine_image=CombineImages(wand->images,colorspace,wand->exception);
   1716   if (combine_image == (Image *) NULL)
   1717     return((MagickWand *) NULL);
   1718   return(CloneMagickWandFromImages(wand,combine_image));
   1719 }
   1720 
   1721 /*
   1723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1724 %                                                                             %
   1725 %                                                                             %
   1726 %                                                                             %
   1727 %   M a g i c k C o m m e n t I m a g e                                       %
   1728 %                                                                             %
   1729 %                                                                             %
   1730 %                                                                             %
   1731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1732 %
   1733 %  MagickCommentImage() adds a comment to your image.
   1734 %
   1735 %  The format of the MagickCommentImage method is:
   1736 %
   1737 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
   1738 %        const char *comment)
   1739 %
   1740 %  A description of each parameter follows:
   1741 %
   1742 %    o wand: the magick wand.
   1743 %
   1744 %    o comment: the image comment.
   1745 %
   1746 */
   1747 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
   1748   const char *comment)
   1749 {
   1750   MagickBooleanType
   1751     status;
   1752 
   1753   assert(wand != (MagickWand *) NULL);
   1754   assert(wand->signature == MagickWandSignature);
   1755   if (wand->debug != MagickFalse)
   1756     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1757   if (wand->images == (Image *) NULL)
   1758     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1759   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
   1760   return(status);
   1761 }
   1762 
   1763 /*
   1765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1766 %                                                                             %
   1767 %                                                                             %
   1768 %                                                                             %
   1769 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
   1770 %                                                                             %
   1771 %                                                                             %
   1772 %                                                                             %
   1773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1774 %
   1775 %  MagickCompareImagesLayers() compares each image with the next in a sequence
   1776 %  and returns the maximum bounding region of any pixel differences it
   1777 %  discovers.
   1778 %
   1779 %  The format of the MagickCompareImagesLayers method is:
   1780 %
   1781 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
   1782 %        const LayerMethod method)
   1783 %
   1784 %  A description of each parameter follows:
   1785 %
   1786 %    o wand: the magick wand.
   1787 %
   1788 %    o method: the compare method.
   1789 %
   1790 */
   1791 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
   1792   const LayerMethod method)
   1793 {
   1794   Image
   1795     *layers_image;
   1796 
   1797   assert(wand != (MagickWand *) NULL);
   1798   assert(wand->signature == MagickWandSignature);
   1799   if (wand->debug != MagickFalse)
   1800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1801   if (wand->images == (Image *) NULL)
   1802     return((MagickWand *) NULL);
   1803   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
   1804   if (layers_image == (Image *) NULL)
   1805     return((MagickWand *) NULL);
   1806   return(CloneMagickWandFromImages(wand,layers_image));
   1807 }
   1808 
   1809 /*
   1811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1812 %                                                                             %
   1813 %                                                                             %
   1814 %                                                                             %
   1815 %   M a g i c k C o m p a r e I m a g e s                                     %
   1816 %                                                                             %
   1817 %                                                                             %
   1818 %                                                                             %
   1819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1820 %
   1821 %  MagickCompareImages() compares an image to a reconstructed image and returns
   1822 %  the specified difference image.
   1823 %
   1824 %  The format of the MagickCompareImages method is:
   1825 %
   1826 %      MagickWand *MagickCompareImages(MagickWand *wand,
   1827 %        const MagickWand *reference,const MetricType metric,
   1828 %        double *distortion)
   1829 %
   1830 %  A description of each parameter follows:
   1831 %
   1832 %    o wand: the magick wand.
   1833 %
   1834 %    o reference: the reference wand.
   1835 %
   1836 %    o metric: the metric.
   1837 %
   1838 %    o distortion: the computed distortion between the images.
   1839 %
   1840 */
   1841 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
   1842   const MagickWand *reference,const MetricType metric,double *distortion)
   1843 {
   1844   Image
   1845     *compare_image;
   1846 
   1847 
   1848   assert(wand != (MagickWand *) NULL);
   1849   assert(wand->signature == MagickWandSignature);
   1850   if (wand->debug != MagickFalse)
   1851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1852   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   1853     {
   1854       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   1855         "ContainsNoImages","`%s'",wand->name);
   1856       return((MagickWand *) NULL);
   1857     }
   1858   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
   1859     wand->exception);
   1860   if (compare_image == (Image *) NULL)
   1861     return((MagickWand *) NULL);
   1862   return(CloneMagickWandFromImages(wand,compare_image));
   1863 }
   1864 
   1865 /*
   1867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1868 %                                                                             %
   1869 %                                                                             %
   1870 %                                                                             %
   1871 %   M a g i c k C o m p o s i t e I m a g e                                   %
   1872 %                                                                             %
   1873 %                                                                             %
   1874 %                                                                             %
   1875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1876 %
   1877 %  MagickCompositeImage() composite one image onto another at the specified
   1878 %  offset.
   1879 %
   1880 %  The format of the MagickCompositeImage method is:
   1881 %
   1882 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
   1883 %        const MagickWand *source_wand,const CompositeOperator compose,
   1884 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
   1885 %
   1886 %  A description of each parameter follows:
   1887 %
   1888 %    o wand: the magick wand holding the destination images
   1889 %
   1890 %    o source_image: the magick wand holding source image.
   1891 %
   1892 %    o compose: This operator affects how the composite is applied to the
   1893 %      image.  The default is Over.  These are some of the compose methods
   1894 %      availble.
   1895 %
   1896 %        OverCompositeOp       InCompositeOp         OutCompositeOp
   1897 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
   1898 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
   1899 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
   1900 %        DisplaceCompositeOp
   1901 %
   1902 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
   1903 %
   1904 %    o x: the column offset of the composited image.
   1905 %
   1906 %    o y: the row offset of the composited image.
   1907 %
   1908 */
   1909 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
   1910   const MagickWand *source_wand,const CompositeOperator compose,
   1911   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
   1912 {
   1913   MagickBooleanType
   1914     status;
   1915 
   1916   assert(wand != (MagickWand *) NULL);
   1917   assert(wand->signature == MagickWandSignature);
   1918   if (wand->debug != MagickFalse)
   1919     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1920   if ((wand->images == (Image *) NULL) ||
   1921       (source_wand->images == (Image *) NULL))
   1922     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1923   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
   1924     x,y,wand->exception);
   1925   return(status);
   1926 }
   1927 
   1928 /*
   1930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1931 %                                                                             %
   1932 %                                                                             %
   1933 %                                                                             %
   1934 %   M a g i c k C o m p o s i t e I m a g e G r a v i t y                     %
   1935 %                                                                             %
   1936 %                                                                             %
   1937 %                                                                             %
   1938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1939 %
   1940 %  MagickCompositeImageGravity() composite one image onto another using the
   1941 %  specified gravity.
   1942 %
   1943 %  The format of the MagickCompositeImageGravity method is:
   1944 %
   1945 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
   1946 %        const MagickWand *source_wand,const CompositeOperator compose,
   1947 %        const GravityType gravity)
   1948 %
   1949 %  A description of each parameter follows:
   1950 %
   1951 %    o wand: the magick wand holding the destination images
   1952 %
   1953 %    o source_image: the magick wand holding source image.
   1954 %
   1955 %    o compose: This operator affects how the composite is applied to the
   1956 %      image.  The default is Over.  These are some of the compose methods
   1957 %      availble.
   1958 %
   1959 %        OverCompositeOp       InCompositeOp         OutCompositeOp
   1960 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
   1961 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
   1962 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
   1963 %        DisplaceCompositeOp
   1964 %
   1965 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
   1966 %               NorthEastGravity, WestGravity, CenterGravity,
   1967 %               EastGravity, SouthWestGravity, SouthGravity,
   1968 %               SouthEastGravity)
   1969 %
   1970 */
   1971 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
   1972   const MagickWand *source_wand,const CompositeOperator compose,
   1973   const GravityType gravity)
   1974 {
   1975   MagickBooleanType
   1976     status;
   1977 
   1978   RectangleInfo
   1979     geometry;
   1980 
   1981   assert(wand != (MagickWand *) NULL);
   1982   assert(wand->signature == MagickWandSignature);
   1983   if (wand->debug != MagickFalse)
   1984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1985   if ((wand->images == (Image *) NULL) ||
   1986       (source_wand->images == (Image *) NULL))
   1987     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1988   SetGeometry(source_wand->images,&geometry);
   1989   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
   1990     &geometry);
   1991   status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
   1992     geometry.x,geometry.y,wand->exception);
   1993   return(status);
   1994 }
   1995 
   1996 /*
   1998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1999 %                                                                             %
   2000 %                                                                             %
   2001 %                                                                             %
   2002 %   M a g i c k C o m p o s i t e L a y e r s                                 %
   2003 %                                                                             %
   2004 %                                                                             %
   2005 %                                                                             %
   2006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2007 %
   2008 %  MagickCompositeLayers() composite the images in the source wand over the
   2009 %  images in the destination wand in sequence, starting with the current
   2010 %  image in both lists.
   2011 %
   2012 %  Each layer from the two image lists are composted together until the end of
   2013 %  one of the image lists is reached.  The offset of each composition is also
   2014 %  adjusted to match the virtual canvas offsets of each layer. As such the
   2015 %  given offset is relative to the virtual canvas, and not the actual image.
   2016 %
   2017 %  Composition uses given x and y offsets, as the 'origin' location of the
   2018 %  source images virtual canvas (not the real image) allowing you to compose a
   2019 %  list of 'layer images' into the destiantioni images.  This makes it well
   2020 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
   2021 %  Animations' onto a static or other 'Coaleased Animation' destination image
   2022 %  list.  GIF disposal handling is not looked at.
   2023 %
   2024 %  Special case:- If one of the image sequences is the last image (just a
   2025 %  single image remaining), that image is repeatally composed with all the
   2026 %  images in the other image list.  Either the source or destination lists may
   2027 %  be the single image, for this situation.
   2028 %
   2029 %  In the case of a single destination image (or last image given), that image
   2030 %  will ve cloned to match the number of images remaining in the source image
   2031 %  list.
   2032 %
   2033 %  This is equivelent to the "-layer Composite" Shell API operator.
   2034 %
   2035 %  The format of the MagickCompositeLayers method is:
   2036 %
   2037 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
   2038 %        const MagickWand *source_wand, const CompositeOperator compose,
   2039 %        const ssize_t x,const ssize_t y)
   2040 %
   2041 %  A description of each parameter follows:
   2042 %
   2043 %    o wand: the magick wand holding destaintion images
   2044 %
   2045 %    o source_wand: the wand holding the source images
   2046 %
   2047 %    o compose, x, y:  composition arguments
   2048 %
   2049 */
   2050 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
   2051   const MagickWand *source_wand,const CompositeOperator compose,
   2052   const ssize_t x,const ssize_t y)
   2053 {
   2054   MagickBooleanType
   2055     status;
   2056 
   2057   assert(wand != (MagickWand *) NULL);
   2058   assert(wand->signature == MagickWandSignature);
   2059   if (wand->debug != MagickFalse)
   2060     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2061   if ((wand->images == (Image *) NULL) ||
   2062       (source_wand->images == (Image *) NULL))
   2063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2064   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
   2065   status=MagickTrue;  /* FUTURE: determine status from exceptions */
   2066   return(status);
   2067 }
   2068 
   2069 /*
   2071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2072 %                                                                             %
   2073 %                                                                             %
   2074 %                                                                             %
   2075 %   M a g i c k C o n t r a s t I m a g e                                     %
   2076 %                                                                             %
   2077 %                                                                             %
   2078 %                                                                             %
   2079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2080 %
   2081 %  MagickContrastImage() enhances the intensity differences between the lighter
   2082 %  and darker elements of the image.  Set sharpen to a value other than 0 to
   2083 %  increase the image contrast otherwise the contrast is reduced.
   2084 %
   2085 %  The format of the MagickContrastImage method is:
   2086 %
   2087 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
   2088 %        const MagickBooleanType sharpen)
   2089 %
   2090 %  A description of each parameter follows:
   2091 %
   2092 %    o wand: the magick wand.
   2093 %
   2094 %    o sharpen: Increase or decrease image contrast.
   2095 %
   2096 %
   2097 */
   2098 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
   2099   const MagickBooleanType sharpen)
   2100 {
   2101   MagickBooleanType
   2102     status;
   2103 
   2104   assert(wand != (MagickWand *) NULL);
   2105   assert(wand->signature == MagickWandSignature);
   2106   if (wand->debug != MagickFalse)
   2107     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2108   if (wand->images == (Image *) NULL)
   2109     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2110   status=ContrastImage(wand->images,sharpen,wand->exception);
   2111   return(status);
   2112 }
   2113 
   2114 /*
   2116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2117 %                                                                             %
   2118 %                                                                             %
   2119 %                                                                             %
   2120 %   M a g i c k C o n t r a s t S t r e t c h I m a g e                       %
   2121 %                                                                             %
   2122 %                                                                             %
   2123 %                                                                             %
   2124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2125 %
   2126 %  MagickContrastStretchImage() enhances the contrast of a color image by
   2127 %  adjusting the pixels color to span the entire range of colors available.
   2128 %  You can also reduce the influence of a particular channel with a gamma
   2129 %  value of 0.
   2130 %
   2131 %  The format of the MagickContrastStretchImage method is:
   2132 %
   2133 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
   2134 %        const double black_point,const double white_point)
   2135 %
   2136 %  A description of each parameter follows:
   2137 %
   2138 %    o wand: the magick wand.
   2139 %
   2140 %    o black_point: the black point.
   2141 %
   2142 %    o white_point: the white point.
   2143 %
   2144 */
   2145 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
   2146   const double black_point,const double white_point)
   2147 {
   2148   MagickBooleanType
   2149     status;
   2150 
   2151   assert(wand != (MagickWand *) NULL);
   2152   assert(wand->signature == MagickWandSignature);
   2153   if (wand->debug != MagickFalse)
   2154     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2155   if (wand->images == (Image *) NULL)
   2156     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2157   status=ContrastStretchImage(wand->images,black_point,white_point,
   2158     wand->exception);
   2159   return(status);
   2160 }
   2161 
   2162 /*
   2164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2165 %                                                                             %
   2166 %                                                                             %
   2167 %                                                                             %
   2168 %   M a g i c k C o n v o l v e I m a g e                                     %
   2169 %                                                                             %
   2170 %                                                                             %
   2171 %                                                                             %
   2172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2173 %
   2174 %  MagickConvolveImage() applies a custom convolution kernel to the image.
   2175 %
   2176 %  The format of the MagickConvolveImage method is:
   2177 %
   2178 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
   2179 %        const KernelInfo *kernel)
   2180 %
   2181 %  A description of each parameter follows:
   2182 %
   2183 %    o wand: the magick wand.
   2184 %
   2185 %    o kernel: An array of doubles representing the convolution kernel.
   2186 %
   2187 */
   2188 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
   2189   const KernelInfo *kernel)
   2190 {
   2191   Image
   2192     *filter_image;
   2193 
   2194   assert(wand != (MagickWand *) NULL);
   2195   assert(wand->signature == MagickWandSignature);
   2196   if (wand->debug != MagickFalse)
   2197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2198   if (kernel == (const KernelInfo *) NULL)
   2199     return(MagickFalse);
   2200   if (wand->images == (Image *) NULL)
   2201     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2202   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
   2203   if (filter_image == (Image *) NULL)
   2204     return(MagickFalse);
   2205   ReplaceImageInList(&wand->images,filter_image);
   2206   return(MagickTrue);
   2207 }
   2208 
   2209 /*
   2211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2212 %                                                                             %
   2213 %                                                                             %
   2214 %                                                                             %
   2215 %   M a g i c k C r o p I m a g e                                             %
   2216 %                                                                             %
   2217 %                                                                             %
   2218 %                                                                             %
   2219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2220 %
   2221 %  MagickCropImage() extracts a region of the image.
   2222 %
   2223 %  The format of the MagickCropImage method is:
   2224 %
   2225 %      MagickBooleanType MagickCropImage(MagickWand *wand,
   2226 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   2227 %
   2228 %  A description of each parameter follows:
   2229 %
   2230 %    o wand: the magick wand.
   2231 %
   2232 %    o width: the region width.
   2233 %
   2234 %    o height: the region height.
   2235 %
   2236 %    o x: the region x-offset.
   2237 %
   2238 %    o y: the region y-offset.
   2239 %
   2240 */
   2241 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
   2242   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   2243 {
   2244   Image
   2245     *crop_image;
   2246 
   2247   RectangleInfo
   2248     crop;
   2249 
   2250   assert(wand != (MagickWand *) NULL);
   2251   assert(wand->signature == MagickWandSignature);
   2252   if (wand->debug != MagickFalse)
   2253     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2254   if (wand->images == (Image *) NULL)
   2255     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2256   crop.width=width;
   2257   crop.height=height;
   2258   crop.x=x;
   2259   crop.y=y;
   2260   crop_image=CropImage(wand->images,&crop,wand->exception);
   2261   if (crop_image == (Image *) NULL)
   2262     return(MagickFalse);
   2263   ReplaceImageInList(&wand->images,crop_image);
   2264   return(MagickTrue);
   2265 }
   2266 
   2267 /*
   2269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2270 %                                                                             %
   2271 %                                                                             %
   2272 %                                                                             %
   2273 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
   2274 %                                                                             %
   2275 %                                                                             %
   2276 %                                                                             %
   2277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2278 %
   2279 %  MagickCycleColormapImage() displaces an image's colormap by a given number
   2280 %  of positions.  If you cycle the colormap a number of times you can produce
   2281 %  a psychodelic effect.
   2282 %
   2283 %  The format of the MagickCycleColormapImage method is:
   2284 %
   2285 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
   2286 %        const ssize_t displace)
   2287 %
   2288 %  A description of each parameter follows:
   2289 %
   2290 %    o wand: the magick wand.
   2291 %
   2292 %    o pixel_wand: the pixel wand.
   2293 %
   2294 */
   2295 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
   2296   const ssize_t displace)
   2297 {
   2298   MagickBooleanType
   2299     status;
   2300 
   2301   assert(wand != (MagickWand *) NULL);
   2302   assert(wand->signature == MagickWandSignature);
   2303   if (wand->debug != MagickFalse)
   2304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2305   if (wand->images == (Image *) NULL)
   2306     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2307   status=CycleColormapImage(wand->images,displace,wand->exception);
   2308   return(status);
   2309 }
   2310 
   2311 /*
   2313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2314 %                                                                             %
   2315 %                                                                             %
   2316 %                                                                             %
   2317 %   M a g i c k C o n s t i t u t e I m a g e                                 %
   2318 %                                                                             %
   2319 %                                                                             %
   2320 %                                                                             %
   2321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2322 %
   2323 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
   2324 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
   2325 %  The data can be char, short int, int, float, or double.  Float and double
   2326 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
   2327 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
   2328 %  example, to create a 640x480 image from unsigned red-green-blue character
   2329 %  data, use
   2330 %
   2331 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
   2332 %
   2333 %  The format of the MagickConstituteImage method is:
   2334 %
   2335 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
   2336 %        const size_t columns,const size_t rows,const char *map,
   2337 %        const StorageType storage,void *pixels)
   2338 %
   2339 %  A description of each parameter follows:
   2340 %
   2341 %    o wand: the magick wand.
   2342 %
   2343 %    o columns: width in pixels of the image.
   2344 %
   2345 %    o rows: height in pixels of the image.
   2346 %
   2347 %    o map:  This string reflects the expected ordering of the pixel array.
   2348 %      It can be any combination or order of R = red, G = green, B = blue,
   2349 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   2350 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   2351 %      P = pad.
   2352 %
   2353 %    o storage: Define the data type of the pixels.  Float and double types are
   2354 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   2355 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
   2356 %      LongPixel, QuantumPixel, or ShortPixel.
   2357 %
   2358 %    o pixels: This array of values contain the pixel components as defined by
   2359 %      map and type.  You must preallocate this array where the expected
   2360 %      length varies depending on the values of width, height, map, and type.
   2361 %
   2362 %
   2363 */
   2364 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
   2365   const size_t columns,const size_t rows,const char *map,
   2366   const StorageType storage,const void *pixels)
   2367 {
   2368   Image
   2369     *images;
   2370 
   2371   assert(wand != (MagickWand *) NULL);
   2372   assert(wand->signature == MagickWandSignature);
   2373   if (wand->debug != MagickFalse)
   2374     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2375   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
   2376   if (images == (Image *) NULL)
   2377     return(MagickFalse);
   2378   return(InsertImageInWand(wand,images));
   2379 }
   2380 
   2381 /*
   2383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2384 %                                                                             %
   2385 %                                                                             %
   2386 %                                                                             %
   2387 %   M a g i c k D e c i p h e r I m a g e                                     %
   2388 %                                                                             %
   2389 %                                                                             %
   2390 %                                                                             %
   2391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2392 %
   2393 %  MagickDecipherImage() converts cipher pixels to plain pixels.
   2394 %
   2395 %  The format of the MagickDecipherImage method is:
   2396 %
   2397 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
   2398 %        const char *passphrase)
   2399 %
   2400 %  A description of each parameter follows:
   2401 %
   2402 %    o wand: the magick wand.
   2403 %
   2404 %    o passphrase: the passphrase.
   2405 %
   2406 */
   2407 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
   2408   const char *passphrase)
   2409 {
   2410   assert(wand != (MagickWand *) NULL);
   2411   assert(wand->signature == MagickWandSignature);
   2412   if (wand->debug != MagickFalse)
   2413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2414   if (wand->images == (Image *) NULL)
   2415     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2416   return(DecipherImage(wand->images,passphrase,wand->exception));
   2417 }
   2418 
   2419 /*
   2421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2422 %                                                                             %
   2423 %                                                                             %
   2424 %                                                                             %
   2425 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
   2426 %                                                                             %
   2427 %                                                                             %
   2428 %                                                                             %
   2429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2430 %
   2431 %  MagickDeconstructImages() compares each image with the next in a sequence
   2432 %  and returns the maximum bounding region of any pixel differences it
   2433 %  discovers.
   2434 %
   2435 %  The format of the MagickDeconstructImages method is:
   2436 %
   2437 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
   2438 %
   2439 %  A description of each parameter follows:
   2440 %
   2441 %    o wand: the magick wand.
   2442 %
   2443 */
   2444 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
   2445 {
   2446   Image
   2447     *deconstruct_image;
   2448 
   2449   assert(wand != (MagickWand *) NULL);
   2450   assert(wand->signature == MagickWandSignature);
   2451   if (wand->debug != MagickFalse)
   2452     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2453   if (wand->images == (Image *) NULL)
   2454     return((MagickWand *) NULL);
   2455   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
   2456     wand->exception);
   2457   if (deconstruct_image == (Image *) NULL)
   2458     return((MagickWand *) NULL);
   2459   return(CloneMagickWandFromImages(wand,deconstruct_image));
   2460 }
   2461 
   2462 /*
   2464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2465 %                                                                             %
   2466 %                                                                             %
   2467 %                                                                             %
   2468 %     M a g i c k D e s k e w I m a g e                                       %
   2469 %                                                                             %
   2470 %                                                                             %
   2471 %                                                                             %
   2472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2473 %
   2474 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
   2475 %  occurs in scanned images because of the camera being misaligned,
   2476 %  imperfections in the scanning or surface, or simply because the paper was
   2477 %  not placed completely flat when scanned.
   2478 %
   2479 %  The format of the MagickDeskewImage method is:
   2480 %
   2481 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
   2482 %        const double threshold)
   2483 %
   2484 %  A description of each parameter follows:
   2485 %
   2486 %    o wand: the magick wand.
   2487 %
   2488 %    o threshold: separate background from foreground.
   2489 %
   2490 */
   2491 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
   2492   const double threshold)
   2493 {
   2494   Image
   2495     *sepia_image;
   2496 
   2497   assert(wand != (MagickWand *) NULL);
   2498   assert(wand->signature == MagickWandSignature);
   2499   if (wand->debug != MagickFalse)
   2500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2501   if (wand->images == (Image *) NULL)
   2502     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2503   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
   2504   if (sepia_image == (Image *) NULL)
   2505     return(MagickFalse);
   2506   ReplaceImageInList(&wand->images,sepia_image);
   2507   return(MagickTrue);
   2508 }
   2509 
   2510 /*
   2512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2513 %                                                                             %
   2514 %                                                                             %
   2515 %                                                                             %
   2516 %     M a g i c k D e s p e c k l e I m a g e                                 %
   2517 %                                                                             %
   2518 %                                                                             %
   2519 %                                                                             %
   2520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2521 %
   2522 %  MagickDespeckleImage() reduces the speckle noise in an image while
   2523 %  perserving the edges of the original image.
   2524 %
   2525 %  The format of the MagickDespeckleImage method is:
   2526 %
   2527 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
   2528 %
   2529 %  A description of each parameter follows:
   2530 %
   2531 %    o wand: the magick wand.
   2532 %
   2533 */
   2534 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
   2535 {
   2536   Image
   2537     *despeckle_image;
   2538 
   2539   assert(wand != (MagickWand *) NULL);
   2540   assert(wand->signature == MagickWandSignature);
   2541   if (wand->debug != MagickFalse)
   2542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2543   if (wand->images == (Image *) NULL)
   2544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2545   despeckle_image=DespeckleImage(wand->images,wand->exception);
   2546   if (despeckle_image == (Image *) NULL)
   2547     return(MagickFalse);
   2548   ReplaceImageInList(&wand->images,despeckle_image);
   2549   return(MagickTrue);
   2550 }
   2551 
   2552 /*
   2554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2555 %                                                                             %
   2556 %                                                                             %
   2557 %                                                                             %
   2558 %   M a g i c k D e s t r o y I m a g e                                       %
   2559 %                                                                             %
   2560 %                                                                             %
   2561 %                                                                             %
   2562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2563 %
   2564 %  MagickDestroyImage() dereferences an image, deallocating memory associated
   2565 %  with the image if the reference count becomes zero.
   2566 %
   2567 %  The format of the MagickDestroyImage method is:
   2568 %
   2569 %      Image *MagickDestroyImage(Image *image)
   2570 %
   2571 %  A description of each parameter follows:
   2572 %
   2573 %    o image: the image.
   2574 %
   2575 */
   2576 WandExport Image *MagickDestroyImage(Image *image)
   2577 {
   2578   return(DestroyImage(image));
   2579 }
   2580 
   2581 /*
   2583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2584 %                                                                             %
   2585 %                                                                             %
   2586 %                                                                             %
   2587 %   M a g i c k D i s p l a y I m a g e                                       %
   2588 %                                                                             %
   2589 %                                                                             %
   2590 %                                                                             %
   2591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2592 %
   2593 %  MagickDisplayImage() displays an image.
   2594 %
   2595 %  The format of the MagickDisplayImage method is:
   2596 %
   2597 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
   2598 %        const char *server_name)
   2599 %
   2600 %  A description of each parameter follows:
   2601 %
   2602 %    o wand: the magick wand.
   2603 %
   2604 %    o server_name: the X server name.
   2605 %
   2606 */
   2607 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
   2608   const char *server_name)
   2609 {
   2610   Image
   2611     *image;
   2612 
   2613   MagickBooleanType
   2614     status;
   2615 
   2616   assert(wand != (MagickWand *) NULL);
   2617   assert(wand->signature == MagickWandSignature);
   2618   if (wand->debug != MagickFalse)
   2619     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2620   if (wand->images == (Image *) NULL)
   2621     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2622   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   2623   if (image == (Image *) NULL)
   2624     return(MagickFalse);
   2625   (void) CloneString(&wand->image_info->server_name,server_name);
   2626   status=DisplayImages(wand->image_info,image,wand->exception);
   2627   image=DestroyImage(image);
   2628   return(status);
   2629 }
   2630 
   2631 /*
   2633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2634 %                                                                             %
   2635 %                                                                             %
   2636 %                                                                             %
   2637 %   M a g i c k D i s p l a y I m a g e s                                     %
   2638 %                                                                             %
   2639 %                                                                             %
   2640 %                                                                             %
   2641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2642 %
   2643 %  MagickDisplayImages() displays an image or image sequence.
   2644 %
   2645 %  The format of the MagickDisplayImages method is:
   2646 %
   2647 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
   2648 %        const char *server_name)
   2649 %
   2650 %  A description of each parameter follows:
   2651 %
   2652 %    o wand: the magick wand.
   2653 %
   2654 %    o server_name: the X server name.
   2655 %
   2656 */
   2657 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
   2658   const char *server_name)
   2659 {
   2660   MagickBooleanType
   2661     status;
   2662 
   2663   assert(wand != (MagickWand *) NULL);
   2664   assert(wand->signature == MagickWandSignature);
   2665   if (wand->debug != MagickFalse)
   2666     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2667   (void) CloneString(&wand->image_info->server_name,server_name);
   2668   status=DisplayImages(wand->image_info,wand->images,wand->exception);
   2669   return(status);
   2670 }
   2671 
   2672 /*
   2674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2675 %                                                                             %
   2676 %                                                                             %
   2677 %                                                                             %
   2678 %   M a g i c k D i s t o r t I m a g e                                       %
   2679 %                                                                             %
   2680 %                                                                             %
   2681 %                                                                             %
   2682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2683 %
   2684 %  MagickDistortImage() distorts an image using various distortion methods, by
   2685 %  mapping color lookups of the source image to a new destination image
   2686 %  usally of the same size as the source image, unless 'bestfit' is set to
   2687 %  true.
   2688 %
   2689 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
   2690 %  adjusted to ensure the whole source 'image' will just fit within the final
   2691 %  destination image, which will be sized and offset accordingly.  Also in
   2692 %  many cases the virtual offset of the source image will be taken into
   2693 %  account in the mapping.
   2694 %
   2695 %  The format of the MagickDistortImage method is:
   2696 %
   2697 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
   2698 %        const DistortMethod method,const size_t number_arguments,
   2699 %        const double *arguments,const MagickBooleanType bestfit)
   2700 %
   2701 %  A description of each parameter follows:
   2702 %
   2703 %    o image: the image to be distorted.
   2704 %
   2705 %    o method: the method of image distortion.
   2706 %
   2707 %        ArcDistortion always ignores the source image offset, and always
   2708 %        'bestfit' the destination image with the top left corner offset
   2709 %        relative to the polar mapping center.
   2710 %
   2711 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
   2712 %        style of image distortion.
   2713 %
   2714 %        Affine, Perspective, and Bilinear, do least squares fitting of the
   2715 %        distortion when more than the minimum number of control point pairs
   2716 %        are provided.
   2717 %
   2718 %        Perspective, and Bilinear, falls back to a Affine distortion when less
   2719 %        that 4 control point pairs are provided. While Affine distortions let
   2720 %        you use any number of control point pairs, that is Zero pairs is a
   2721 %        no-Op (viewport only) distrotion, one pair is a translation and two
   2722 %        pairs of control points do a scale-rotate-translate, without any
   2723 %        shearing.
   2724 %
   2725 %    o number_arguments: the number of arguments given for this distortion
   2726 %      method.
   2727 %
   2728 %    o arguments: the arguments for this distortion method.
   2729 %
   2730 %    o bestfit: Attempt to resize destination to fit distorted source.
   2731 %
   2732 */
   2733 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
   2734   const DistortMethod method,const size_t number_arguments,
   2735   const double *arguments,const MagickBooleanType bestfit)
   2736 {
   2737   Image
   2738     *distort_image;
   2739 
   2740   assert(wand != (MagickWand *) NULL);
   2741   assert(wand->signature == MagickWandSignature);
   2742   if (wand->debug != MagickFalse)
   2743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2744   if (wand->images == (Image *) NULL)
   2745     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2746   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
   2747     bestfit,wand->exception);
   2748   if (distort_image == (Image *) NULL)
   2749     return(MagickFalse);
   2750   ReplaceImageInList(&wand->images,distort_image);
   2751   return(MagickTrue);
   2752 }
   2753 
   2754 /*
   2756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2757 %                                                                             %
   2758 %                                                                             %
   2759 %                                                                             %
   2760 %   M a g i c k D r a w I m a g e                                             %
   2761 %                                                                             %
   2762 %                                                                             %
   2763 %                                                                             %
   2764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2765 %
   2766 %  MagickDrawImage() renders the drawing wand on the current image.
   2767 %
   2768 %  The format of the MagickDrawImage method is:
   2769 %
   2770 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
   2771 %        const DrawingWand *drawing_wand)
   2772 %
   2773 %  A description of each parameter follows:
   2774 %
   2775 %    o wand: the magick wand.
   2776 %
   2777 %    o drawing_wand: the draw wand.
   2778 %
   2779 */
   2780 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
   2781   const DrawingWand *drawing_wand)
   2782 {
   2783   char
   2784     *primitive;
   2785 
   2786   DrawInfo
   2787     *draw_info;
   2788 
   2789   MagickBooleanType
   2790     status;
   2791 
   2792   assert(wand != (MagickWand *) NULL);
   2793   assert(wand->signature == MagickWandSignature);
   2794   if (wand->debug != MagickFalse)
   2795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2796   if (wand->images == (Image *) NULL)
   2797     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2798   draw_info=PeekDrawingWand(drawing_wand);
   2799   if ((draw_info == (DrawInfo *) NULL) ||
   2800       (draw_info->primitive == (char *) NULL))
   2801     return(MagickFalse);
   2802   primitive=AcquireString(draw_info->primitive);
   2803   draw_info=DestroyDrawInfo(draw_info);
   2804   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
   2805   draw_info->primitive=primitive;
   2806   status=DrawImage(wand->images,draw_info,wand->exception);
   2807   draw_info=DestroyDrawInfo(draw_info);
   2808   return(status);
   2809 }
   2810 
   2811 /*
   2813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2814 %                                                                             %
   2815 %                                                                             %
   2816 %                                                                             %
   2817 %   M a g i c k E d g e I m a g e                                             %
   2818 %                                                                             %
   2819 %                                                                             %
   2820 %                                                                             %
   2821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2822 %
   2823 %  MagickEdgeImage() enhance edges within the image with a convolution filter
   2824 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
   2825 %  radius for you.
   2826 %
   2827 %  The format of the MagickEdgeImage method is:
   2828 %
   2829 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
   2830 %
   2831 %  A description of each parameter follows:
   2832 %
   2833 %    o wand: the magick wand.
   2834 %
   2835 %    o radius: the radius of the pixel neighborhood.
   2836 %
   2837 */
   2838 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
   2839   const double radius)
   2840 {
   2841   Image
   2842     *edge_image;
   2843 
   2844   assert(wand != (MagickWand *) NULL);
   2845   assert(wand->signature == MagickWandSignature);
   2846   if (wand->debug != MagickFalse)
   2847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2848   if (wand->images == (Image *) NULL)
   2849     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2850   edge_image=EdgeImage(wand->images,radius,wand->exception);
   2851   if (edge_image == (Image *) NULL)
   2852     return(MagickFalse);
   2853   ReplaceImageInList(&wand->images,edge_image);
   2854   return(MagickTrue);
   2855 }
   2856 
   2857 /*
   2859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2860 %                                                                             %
   2861 %                                                                             %
   2862 %                                                                             %
   2863 %   M a g i c k E m b o s s I m a g e                                         %
   2864 %                                                                             %
   2865 %                                                                             %
   2866 %                                                                             %
   2867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2868 %
   2869 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
   2870 %  effect.  We convolve the image with a Gaussian operator of the given radius
   2871 %  and standard deviation (sigma).  For reasonable results, radius should be
   2872 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
   2873 %  radius for you.
   2874 %
   2875 %  The format of the MagickEmbossImage method is:
   2876 %
   2877 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
   2878 %        const double sigma)
   2879 %
   2880 %  A description of each parameter follows:
   2881 %
   2882 %    o wand: the magick wand.
   2883 %
   2884 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   2885 %      pixel.
   2886 %
   2887 %    o sigma: the standard deviation of the Gaussian, in pixels.
   2888 %
   2889 */
   2890 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
   2891   const double radius,const double sigma)
   2892 {
   2893   Image
   2894     *emboss_image;
   2895 
   2896   assert(wand != (MagickWand *) NULL);
   2897   assert(wand->signature == MagickWandSignature);
   2898   if (wand->debug != MagickFalse)
   2899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2900   if (wand->images == (Image *) NULL)
   2901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2902   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
   2903   if (emboss_image == (Image *) NULL)
   2904     return(MagickFalse);
   2905   ReplaceImageInList(&wand->images,emboss_image);
   2906   return(MagickTrue);
   2907 }
   2908 
   2909 /*
   2911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2912 %                                                                             %
   2913 %                                                                             %
   2914 %                                                                             %
   2915 %   M a g i c k E n c i p h e r I m a g e                                     %
   2916 %                                                                             %
   2917 %                                                                             %
   2918 %                                                                             %
   2919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2920 %
   2921 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
   2922 %
   2923 %  The format of the MagickEncipherImage method is:
   2924 %
   2925 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
   2926 %        const char *passphrase)
   2927 %
   2928 %  A description of each parameter follows:
   2929 %
   2930 %    o wand: the magick wand.
   2931 %
   2932 %    o passphrase: the passphrase.
   2933 %
   2934 */
   2935 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
   2936   const char *passphrase)
   2937 {
   2938   assert(wand != (MagickWand *) NULL);
   2939   assert(wand->signature == MagickWandSignature);
   2940   if (wand->debug != MagickFalse)
   2941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2942   if (wand->images == (Image *) NULL)
   2943     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2944   return(EncipherImage(wand->images,passphrase,wand->exception));
   2945 }
   2946 
   2947 /*
   2949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2950 %                                                                             %
   2951 %                                                                             %
   2952 %                                                                             %
   2953 %   M a g i c k E n h a n c e I m a g e                                       %
   2954 %                                                                             %
   2955 %                                                                             %
   2956 %                                                                             %
   2957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2958 %
   2959 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
   2960 %  noisy image.
   2961 %
   2962 %  The format of the MagickEnhanceImage method is:
   2963 %
   2964 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
   2965 %
   2966 %  A description of each parameter follows:
   2967 %
   2968 %    o wand: the magick wand.
   2969 %
   2970 */
   2971 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
   2972 {
   2973   Image
   2974     *enhance_image;
   2975 
   2976   assert(wand != (MagickWand *) NULL);
   2977   assert(wand->signature == MagickWandSignature);
   2978   if (wand->debug != MagickFalse)
   2979     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2980   if (wand->images == (Image *) NULL)
   2981     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2982   enhance_image=EnhanceImage(wand->images,wand->exception);
   2983   if (enhance_image == (Image *) NULL)
   2984     return(MagickFalse);
   2985   ReplaceImageInList(&wand->images,enhance_image);
   2986   return(MagickTrue);
   2987 }
   2988 
   2989 /*
   2991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2992 %                                                                             %
   2993 %                                                                             %
   2994 %                                                                             %
   2995 %   M a g i c k E q u a l i z e I m a g e                                     %
   2996 %                                                                             %
   2997 %                                                                             %
   2998 %                                                                             %
   2999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3000 %
   3001 %  MagickEqualizeImage() equalizes the image histogram.
   3002 %
   3003 %  The format of the MagickEqualizeImage method is:
   3004 %
   3005 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
   3006 %
   3007 %  A description of each parameter follows:
   3008 %
   3009 %    o wand: the magick wand.
   3010 %
   3011 %    o channel: the image channel(s).
   3012 %
   3013 */
   3014 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
   3015 {
   3016   MagickBooleanType
   3017     status;
   3018 
   3019   assert(wand != (MagickWand *) NULL);
   3020   assert(wand->signature == MagickWandSignature);
   3021   if (wand->debug != MagickFalse)
   3022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3023   if (wand->images == (Image *) NULL)
   3024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3025   status=EqualizeImage(wand->images,wand->exception);
   3026   return(status);
   3027 }
   3028 
   3029 /*
   3031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3032 %                                                                             %
   3033 %                                                                             %
   3034 %                                                                             %
   3035 %   M a g i c k E v a l u a t e I m a g e                                     %
   3036 %                                                                             %
   3037 %                                                                             %
   3038 %                                                                             %
   3039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3040 %
   3041 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
   3042 %  expression to an image.  Use these operators to lighten or darken an image,
   3043 %  to increase or decrease contrast in an image, or to produce the "negative"
   3044 %  of an image.
   3045 %
   3046 %  The format of the MagickEvaluateImage method is:
   3047 %
   3048 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
   3049 %        const MagickEvaluateOperator operator,const double value)
   3050 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
   3051 %        const MagickEvaluateOperator operator)
   3052 %
   3053 %  A description of each parameter follows:
   3054 %
   3055 %    o wand: the magick wand.
   3056 %
   3057 %    o op: A channel operator.
   3058 %
   3059 %    o value: A value value.
   3060 %
   3061 */
   3062 
   3063 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
   3064   const MagickEvaluateOperator op)
   3065 {
   3066   Image
   3067     *evaluate_image;
   3068 
   3069   assert(wand != (MagickWand *) NULL);
   3070   assert(wand->signature == MagickWandSignature);
   3071   if (wand->debug != MagickFalse)
   3072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3073   if (wand->images == (Image *) NULL)
   3074     return((MagickWand *) NULL);
   3075   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
   3076   if (evaluate_image == (Image *) NULL)
   3077     return((MagickWand *) NULL);
   3078   return(CloneMagickWandFromImages(wand,evaluate_image));
   3079 }
   3080 
   3081 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
   3082   const MagickEvaluateOperator op,const double value)
   3083 {
   3084   MagickBooleanType
   3085     status;
   3086 
   3087   assert(wand != (MagickWand *) NULL);
   3088   assert(wand->signature == MagickWandSignature);
   3089   if (wand->debug != MagickFalse)
   3090     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3091   if (wand->images == (Image *) NULL)
   3092     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3093   status=EvaluateImage(wand->images,op,value,wand->exception);
   3094   return(status);
   3095 }
   3096 
   3097 /*
   3099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3100 %                                                                             %
   3101 %                                                                             %
   3102 %                                                                             %
   3103 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
   3104 %                                                                             %
   3105 %                                                                             %
   3106 %                                                                             %
   3107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3108 %
   3109 %  MagickExportImagePixels() extracts pixel data from an image and returns it
   3110 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
   3111 %  an error is encountered.  The data is returned as char, short int, int,
   3112 %  ssize_t, float, or double in the order specified by map.
   3113 %
   3114 %  Suppose you want to extract the first scanline of a 640x480 image as
   3115 %  character data in red-green-blue order:
   3116 %
   3117 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
   3118 %
   3119 %  The format of the MagickExportImagePixels method is:
   3120 %
   3121 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
   3122 %        const ssize_t x,const ssize_t y,const size_t columns,
   3123 %        const size_t rows,const char *map,const StorageType storage,
   3124 %        void *pixels)
   3125 %
   3126 %  A description of each parameter follows:
   3127 %
   3128 %    o wand: the magick wand.
   3129 %
   3130 %    o x, y, columns, rows:  These values define the perimeter
   3131 %      of a region of pixels you want to extract.
   3132 %
   3133 %    o map:  This string reflects the expected ordering of the pixel array.
   3134 %      It can be any combination or order of R = red, G = green, B = blue,
   3135 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   3136 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   3137 %      P = pad.
   3138 %
   3139 %    o storage: Define the data type of the pixels.  Float and double types are
   3140 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   3141 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
   3142 %      LongPixel, QuantumPixel, or ShortPixel.
   3143 %
   3144 %    o pixels: This array of values contain the pixel components as defined by
   3145 %      map and type.  You must preallocate this array where the expected
   3146 %      length varies depending on the values of width, height, map, and type.
   3147 %
   3148 */
   3149 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
   3150   const ssize_t x,const ssize_t y,const size_t columns,
   3151   const size_t rows,const char *map,const StorageType storage,
   3152   void *pixels)
   3153 {
   3154   MagickBooleanType
   3155     status;
   3156 
   3157   assert(wand != (MagickWand *) NULL);
   3158   assert(wand->signature == MagickWandSignature);
   3159   if (wand->debug != MagickFalse)
   3160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3161   if (wand->images == (Image *) NULL)
   3162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3163   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
   3164     storage,pixels,wand->exception);
   3165   return(status);
   3166 }
   3167 
   3168 /*
   3170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3171 %                                                                             %
   3172 %                                                                             %
   3173 %                                                                             %
   3174 %   M a g i c k E x t e n t I m a g e                                         %
   3175 %                                                                             %
   3176 %                                                                             %
   3177 %                                                                             %
   3178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3179 %
   3180 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
   3181 %  and wand background color.  Set the (x,y) offset of the geometry to move
   3182 %  the original wand relative to the extended wand.
   3183 %
   3184 %  The format of the MagickExtentImage method is:
   3185 %
   3186 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
   3187 %        const size_t height,const ssize_t x,const ssize_t y)
   3188 %
   3189 %  A description of each parameter follows:
   3190 %
   3191 %    o wand: the magick wand.
   3192 %
   3193 %    o width: the region width.
   3194 %
   3195 %    o height: the region height.
   3196 %
   3197 %    o x: the region x offset.
   3198 %
   3199 %    o y: the region y offset.
   3200 %
   3201 */
   3202 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
   3203   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   3204 {
   3205   Image
   3206     *extent_image;
   3207 
   3208   RectangleInfo
   3209     extent;
   3210 
   3211   assert(wand != (MagickWand *) NULL);
   3212   assert(wand->signature == MagickWandSignature);
   3213   if (wand->debug != MagickFalse)
   3214     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3215   if (wand->images == (Image *) NULL)
   3216     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3217   extent.width=width;
   3218   extent.height=height;
   3219   extent.x=x;
   3220   extent.y=y;
   3221   extent_image=ExtentImage(wand->images,&extent,wand->exception);
   3222   if (extent_image == (Image *) NULL)
   3223     return(MagickFalse);
   3224   ReplaceImageInList(&wand->images,extent_image);
   3225   return(MagickTrue);
   3226 }
   3227 
   3228 /*
   3230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3231 %                                                                             %
   3232 %                                                                             %
   3233 %                                                                             %
   3234 %   M a g i c k F l i p I m a g e                                             %
   3235 %                                                                             %
   3236 %                                                                             %
   3237 %                                                                             %
   3238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3239 %
   3240 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
   3241 %  around the central x-axis.
   3242 %
   3243 %  The format of the MagickFlipImage method is:
   3244 %
   3245 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
   3246 %
   3247 %  A description of each parameter follows:
   3248 %
   3249 %    o wand: the magick wand.
   3250 %
   3251 */
   3252 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
   3253 {
   3254   Image
   3255     *flip_image;
   3256 
   3257   assert(wand != (MagickWand *) NULL);
   3258   assert(wand->signature == MagickWandSignature);
   3259   if (wand->debug != MagickFalse)
   3260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3261   if (wand->images == (Image *) NULL)
   3262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3263   flip_image=FlipImage(wand->images,wand->exception);
   3264   if (flip_image == (Image *) NULL)
   3265     return(MagickFalse);
   3266   ReplaceImageInList(&wand->images,flip_image);
   3267   return(MagickTrue);
   3268 }
   3269 
   3270 /*
   3272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3273 %                                                                             %
   3274 %                                                                             %
   3275 %                                                                             %
   3276 %   M a g i c k F l o o d f i l l P a i n t I m a g e                         %
   3277 %                                                                             %
   3278 %                                                                             %
   3279 %                                                                             %
   3280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3281 %
   3282 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
   3283 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
   3284 %  specified, the color value is changed for any neighbor pixel that does not
   3285 %  match the bordercolor member of image.
   3286 %
   3287 %  The format of the MagickFloodfillPaintImage method is:
   3288 %
   3289 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
   3290 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
   3291 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
   3292 %
   3293 %  A description of each parameter follows:
   3294 %
   3295 %    o wand: the magick wand.
   3296 %
   3297 %    o fill: the floodfill color pixel wand.
   3298 %
   3299 %    o fuzz: By default target must match a particular pixel color
   3300 %      exactly.  However, in many cases two colors may differ by a small amount.
   3301 %      The fuzz member of image defines how much tolerance is acceptable to
   3302 %      consider two colors as the same.  For example, set fuzz to 10 and the
   3303 %      color red at intensities of 100 and 102 respectively are now interpreted
   3304 %      as the same color for the purposes of the floodfill.
   3305 %
   3306 %    o bordercolor: the border color pixel wand.
   3307 %
   3308 %    o x,y: the starting location of the operation.
   3309 %
   3310 %    o invert: paint any pixel that does not match the target color.
   3311 %
   3312 */
   3313 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
   3314   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
   3315   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
   3316 {
   3317   DrawInfo
   3318     *draw_info;
   3319 
   3320   MagickBooleanType
   3321     status;
   3322 
   3323   PixelInfo
   3324     target;
   3325 
   3326   assert(wand != (MagickWand *) NULL);
   3327   assert(wand->signature == MagickWandSignature);
   3328   if (wand->debug != MagickFalse)
   3329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3330   if (wand->images == (Image *) NULL)
   3331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3332   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
   3333   PixelGetQuantumPacket(fill,&draw_info->fill);
   3334   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
   3335     wand->images->columns,y % wand->images->rows,&target,wand->exception);
   3336   if (bordercolor != (PixelWand *) NULL)
   3337     PixelGetMagickColor(bordercolor,&target);
   3338   wand->images->fuzz=fuzz;
   3339   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
   3340     wand->exception);
   3341   draw_info=DestroyDrawInfo(draw_info);
   3342   return(status);
   3343 }
   3344 
   3345 /*
   3347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3348 %                                                                             %
   3349 %                                                                             %
   3350 %                                                                             %
   3351 %   M a g i c k F l o p I m a g e                                             %
   3352 %                                                                             %
   3353 %                                                                             %
   3354 %                                                                             %
   3355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3356 %
   3357 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
   3358 %  around the central y-axis.
   3359 %
   3360 %  The format of the MagickFlopImage method is:
   3361 %
   3362 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
   3363 %
   3364 %  A description of each parameter follows:
   3365 %
   3366 %    o wand: the magick wand.
   3367 %
   3368 */
   3369 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
   3370 {
   3371   Image
   3372     *flop_image;
   3373 
   3374   assert(wand != (MagickWand *) NULL);
   3375   assert(wand->signature == MagickWandSignature);
   3376   if (wand->debug != MagickFalse)
   3377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3378   if (wand->images == (Image *) NULL)
   3379     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3380   flop_image=FlopImage(wand->images,wand->exception);
   3381   if (flop_image == (Image *) NULL)
   3382     return(MagickFalse);
   3383   ReplaceImageInList(&wand->images,flop_image);
   3384   return(MagickTrue);
   3385 }
   3386 
   3387 /*
   3389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3390 %                                                                             %
   3391 %                                                                             %
   3392 %                                                                             %
   3393 %   M a g i c k F o u r i e r T r a n s f o r m I m a g e                     %
   3394 %                                                                             %
   3395 %                                                                             %
   3396 %                                                                             %
   3397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3398 %
   3399 %  MagickForwardFourierTransformImage() implements the discrete Fourier
   3400 %  transform (DFT) of the image either as a magnitude / phase or real /
   3401 %  imaginary image pair.
   3402 %
   3403 %  The format of the MagickForwardFourierTransformImage method is:
   3404 %
   3405 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
   3406 %        const MagickBooleanType magnitude)
   3407 %
   3408 %  A description of each parameter follows:
   3409 %
   3410 %    o wand: the magick wand.
   3411 %
   3412 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
   3413 %      imaginary image pair.
   3414 %
   3415 */
   3416 WandExport MagickBooleanType MagickForwardFourierTransformImage(
   3417   MagickWand *wand,const MagickBooleanType magnitude)
   3418 {
   3419   Image
   3420     *forward_image;
   3421 
   3422   assert(wand != (MagickWand *) NULL);
   3423   assert(wand->signature == MagickWandSignature);
   3424   if (wand->debug != MagickFalse)
   3425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3426   if (wand->images == (Image *) NULL)
   3427     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3428   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
   3429     wand->exception);
   3430   if (forward_image == (Image *) NULL)
   3431     return(MagickFalse);
   3432   ReplaceImageInList(&wand->images,forward_image);
   3433   return(MagickTrue);
   3434 }
   3435 
   3436 /*
   3438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3439 %                                                                             %
   3440 %                                                                             %
   3441 %                                                                             %
   3442 %   M a g i c k F r a m e I m a g e                                           %
   3443 %                                                                             %
   3444 %                                                                             %
   3445 %                                                                             %
   3446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3447 %
   3448 %  MagickFrameImage() adds a simulated three-dimensional border around the
   3449 %  image.  The width and height specify the border width of the vertical and
   3450 %  horizontal sides of the frame.  The inner and outer bevels indicate the
   3451 %  width of the inner and outer shadows of the frame.
   3452 %
   3453 %  The format of the MagickFrameImage method is:
   3454 %
   3455 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
   3456 %        const PixelWand *alpha_color,const size_t width,
   3457 %        const size_t height,const ssize_t inner_bevel,
   3458 %        const ssize_t outer_bevel,const CompositeOperator compose)
   3459 %
   3460 %  A description of each parameter follows:
   3461 %
   3462 %    o wand: the magick wand.
   3463 %
   3464 %    o alpha_color: the frame color pixel wand.
   3465 %
   3466 %    o width: the border width.
   3467 %
   3468 %    o height: the border height.
   3469 %
   3470 %    o inner_bevel: the inner bevel width.
   3471 %
   3472 %    o outer_bevel: the outer bevel width.
   3473 %
   3474 %    o compose: the composite operator.
   3475 %
   3476 */
   3477 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
   3478   const PixelWand *alpha_color,const size_t width,const size_t height,
   3479   const ssize_t inner_bevel,const ssize_t outer_bevel,
   3480   const CompositeOperator compose)
   3481 {
   3482   Image
   3483     *frame_image;
   3484 
   3485   FrameInfo
   3486     frame_info;
   3487 
   3488   assert(wand != (MagickWand *) NULL);
   3489   assert(wand->signature == MagickWandSignature);
   3490   if (wand->debug != MagickFalse)
   3491     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3492   if (wand->images == (Image *) NULL)
   3493     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3494   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
   3495   frame_info.width=wand->images->columns+2*width;
   3496   frame_info.height=wand->images->rows+2*height;
   3497   frame_info.x=(ssize_t) width;
   3498   frame_info.y=(ssize_t) height;
   3499   frame_info.inner_bevel=inner_bevel;
   3500   frame_info.outer_bevel=outer_bevel;
   3501   PixelGetQuantumPacket(alpha_color,&wand->images->alpha_color);
   3502   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
   3503   if (frame_image == (Image *) NULL)
   3504     return(MagickFalse);
   3505   ReplaceImageInList(&wand->images,frame_image);
   3506   return(MagickTrue);
   3507 }
   3508 
   3509 /*
   3511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3512 %                                                                             %
   3513 %                                                                             %
   3514 %                                                                             %
   3515 %   M a g i c k F u n c t i o n I m a g e                                     %
   3516 %                                                                             %
   3517 %                                                                             %
   3518 %                                                                             %
   3519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3520 %
   3521 %  MagickFunctionImage() applys an arithmetic, relational, or logical
   3522 %  expression to an image.  Use these operators to lighten or darken an image,
   3523 %  to increase or decrease contrast in an image, or to produce the "negative"
   3524 %  of an image.
   3525 %
   3526 %  The format of the MagickFunctionImage method is:
   3527 %
   3528 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
   3529 %        const MagickFunction function,const size_t number_arguments,
   3530 %        const double *arguments)
   3531 %
   3532 %  A description of each parameter follows:
   3533 %
   3534 %    o wand: the magick wand.
   3535 %
   3536 %    o function: the image function.
   3537 %
   3538 %    o number_arguments: the number of function arguments.
   3539 %
   3540 %    o arguments: the function arguments.
   3541 %
   3542 */
   3543 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
   3544   const MagickFunction function,const size_t number_arguments,
   3545   const double *arguments)
   3546 {
   3547   MagickBooleanType
   3548     status;
   3549 
   3550   assert(wand != (MagickWand *) NULL);
   3551   assert(wand->signature == MagickWandSignature);
   3552   if (wand->debug != MagickFalse)
   3553     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3554   if (wand->images == (Image *) NULL)
   3555     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3556   status=FunctionImage(wand->images,function,number_arguments,arguments,
   3557     wand->exception);
   3558   return(status);
   3559 }
   3560 
   3561 /*
   3563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3564 %                                                                             %
   3565 %                                                                             %
   3566 %                                                                             %
   3567 %   M a g i c k F x I m a g e                                                 %
   3568 %                                                                             %
   3569 %                                                                             %
   3570 %                                                                             %
   3571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3572 %
   3573 %  MagickFxImage() evaluate expression for each pixel in the image.
   3574 %
   3575 %  The format of the MagickFxImage method is:
   3576 %
   3577 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
   3578 %
   3579 %  A description of each parameter follows:
   3580 %
   3581 %    o wand: the magick wand.
   3582 %
   3583 %    o expression: the expression.
   3584 %
   3585 */
   3586 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
   3587 {
   3588   Image
   3589     *fx_image;
   3590 
   3591   assert(wand != (MagickWand *) NULL);
   3592   assert(wand->signature == MagickWandSignature);
   3593   if (wand->debug != MagickFalse)
   3594     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3595   if (wand->images == (Image *) NULL)
   3596     return((MagickWand *) NULL);
   3597   fx_image=FxImage(wand->images,expression,wand->exception);
   3598   if (fx_image == (Image *) NULL)
   3599     return((MagickWand *) NULL);
   3600   return(CloneMagickWandFromImages(wand,fx_image));
   3601 }
   3602 
   3603 /*
   3605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3606 %                                                                             %
   3607 %                                                                             %
   3608 %                                                                             %
   3609 %   M a g i c k G a m m a I m a g e                                           %
   3610 %                                                                             %
   3611 %                                                                             %
   3612 %                                                                             %
   3613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3614 %
   3615 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
   3616 %  different devices will have perceptual differences in the way the image's
   3617 %  intensities are represented on the screen.  Specify individual gamma levels
   3618 %  for the red, green, and blue channels, or adjust all three with the gamma
   3619 %  parameter.  Values typically range from 0.8 to 2.3.
   3620 %
   3621 %  You can also reduce the influence of a particular channel with a gamma
   3622 %  value of 0.
   3623 %
   3624 %  The format of the MagickGammaImage method is:
   3625 %
   3626 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
   3627 %
   3628 %  A description of each parameter follows:
   3629 %
   3630 %    o wand: the magick wand.
   3631 %
   3632 %    o level: Define the level of gamma correction.
   3633 %
   3634 */
   3635 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
   3636   const double gamma)
   3637 {
   3638   MagickBooleanType
   3639     status;
   3640 
   3641   assert(wand != (MagickWand *) NULL);
   3642   assert(wand->signature == MagickWandSignature);
   3643   if (wand->debug != MagickFalse)
   3644     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3645   if (wand->images == (Image *) NULL)
   3646     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3647   status=GammaImage(wand->images,gamma,wand->exception);
   3648   return(status);
   3649 }
   3650 
   3651 /*
   3653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3654 %                                                                             %
   3655 %                                                                             %
   3656 %                                                                             %
   3657 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
   3658 %                                                                             %
   3659 %                                                                             %
   3660 %                                                                             %
   3661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3662 %
   3663 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
   3664 %  Gaussian operator of the given radius and standard deviation (sigma).
   3665 %  For reasonable results, the radius should be larger than sigma.  Use a
   3666 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
   3667 %
   3668 %  The format of the MagickGaussianBlurImage method is:
   3669 %
   3670 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
   3671 %        const double radius,const double sigma)
   3672 %
   3673 %  A description of each parameter follows:
   3674 %
   3675 %    o wand: the magick wand.
   3676 %
   3677 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   3678 %      pixel.
   3679 %
   3680 %    o sigma: the standard deviation of the Gaussian, in pixels.
   3681 %
   3682 */
   3683 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
   3684   const double radius,const double sigma)
   3685 {
   3686   Image
   3687     *blur_image;
   3688 
   3689   assert(wand != (MagickWand *) NULL);
   3690   assert(wand->signature == MagickWandSignature);
   3691   if (wand->debug != MagickFalse)
   3692     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3693   if (wand->images == (Image *) NULL)
   3694     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3695   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
   3696   if (blur_image == (Image *) NULL)
   3697     return(MagickFalse);
   3698   ReplaceImageInList(&wand->images,blur_image);
   3699   return(MagickTrue);
   3700 }
   3701 
   3702 /*
   3704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3705 %                                                                             %
   3706 %                                                                             %
   3707 %                                                                             %
   3708 %   M a g i c k G e t I m a g e                                               %
   3709 %                                                                             %
   3710 %                                                                             %
   3711 %                                                                             %
   3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3713 %
   3714 %  MagickGetImage() gets the image at the current image index.
   3715 %
   3716 %  The format of the MagickGetImage method is:
   3717 %
   3718 %      MagickWand *MagickGetImage(MagickWand *wand)
   3719 %
   3720 %  A description of each parameter follows:
   3721 %
   3722 %    o wand: the magick wand.
   3723 %
   3724 */
   3725 WandExport MagickWand *MagickGetImage(MagickWand *wand)
   3726 {
   3727   Image
   3728     *image;
   3729 
   3730   assert(wand != (MagickWand *) NULL);
   3731   assert(wand->signature == MagickWandSignature);
   3732   if (wand->debug != MagickFalse)
   3733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3734   if (wand->images == (Image *) NULL)
   3735     {
   3736       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3737         "ContainsNoImages","`%s'",wand->name);
   3738       return((MagickWand *) NULL);
   3739     }
   3740   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   3741   if (image == (Image *) NULL)
   3742     return((MagickWand *) NULL);
   3743   return(CloneMagickWandFromImages(wand,image));
   3744 }
   3745 
   3746 /*
   3748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3749 %                                                                             %
   3750 %                                                                             %
   3751 %                                                                             %
   3752 %   M a g i c k G e t I m a g e A l p h a C h a n n e l                       %
   3753 %                                                                             %
   3754 %                                                                             %
   3755 %                                                                             %
   3756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3757 %
   3758 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
   3759 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
   3760 %  than CMYKA.
   3761 %
   3762 %  The format of the MagickGetImageAlphaChannel method is:
   3763 %
   3764 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
   3765 %
   3766 %  A description of each parameter follows:
   3767 %
   3768 %    o wand: the magick wand.
   3769 %
   3770 */
   3771 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
   3772 {
   3773   assert(wand != (MagickWand *) NULL);
   3774   assert(wand->signature == MagickWandSignature);
   3775   if (wand->debug != MagickFalse)
   3776     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3777   if (wand->images == (Image *) NULL)
   3778     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3779   return(GetImageAlphaChannel(wand->images));
   3780 }
   3781 
   3782 /*
   3783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3784 %                                                                             %
   3785 %                                                                             %
   3786 %                                                                             %
   3787 %   M a g i c k G e t I m a g e A l p h a C o l o r                           %
   3788 %                                                                             %
   3789 %                                                                             %
   3790 %                                                                             %
   3791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3792 %
   3793 %  MagickGetImageAlhpaColor() returns the image alpha color.
   3794 %
   3795 %  The format of the MagickGetImageAlhpaColor method is:
   3796 %
   3797 %      MagickBooleanType MagickGetImageAlhpaColor(MagickWand *wand,
   3798 %        PixelWand *alpha_color)
   3799 %
   3800 %  A description of each parameter follows:
   3801 %
   3802 %    o wand: the magick wand.
   3803 %
   3804 %    o alpha_color: return the alpha color.
   3805 %
   3806 */
   3807 WandExport MagickBooleanType MagickGetImageAlhpaColor(MagickWand *wand,
   3808   PixelWand *alpha_color)
   3809 {
   3810   assert(wand != (MagickWand *)NULL);
   3811   assert(wand->signature == MagickWandSignature);
   3812   if (wand->debug != MagickFalse)
   3813     (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
   3814   if (wand->images == (Image *)NULL)
   3815     ThrowWandException(WandError, "ContainsNoImages", wand->name);
   3816   PixelSetPixelColor(alpha_color, &wand->images->alpha_color);
   3817   return(MagickTrue);
   3818 }
   3819 
   3820 /*
   3822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3823 %                                                                             %
   3824 %                                                                             %
   3825 %                                                                             %
   3826 %   M a g i c k G e t I m a g e C l i p M a s k                               %
   3827 %                                                                             %
   3828 %                                                                             %
   3829 %                                                                             %
   3830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3831 %
   3832 %  MagickGetImageMask() gets the image clip mask at the current image index.
   3833 %
   3834 %  The format of the MagickGetImageMask method is:
   3835 %
   3836 %      MagickWand *MagickGetImageMask(MagickWand *wand)
   3837 %
   3838 %  A description of each parameter follows:
   3839 %
   3840 %    o wand: the magick wand.
   3841 %
   3842 %    o type: type of mask, ReadPixelMask or WritePixelMask.
   3843 %
   3844 */
   3845 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
   3846   const PixelMask type)
   3847 {
   3848   Image
   3849     *image;
   3850 
   3851   assert(wand != (MagickWand *) NULL);
   3852   assert(wand->signature == MagickWandSignature);
   3853   if (wand->debug != MagickFalse)
   3854     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3855   if (wand->images == (Image *) NULL)
   3856     {
   3857       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3858         "ContainsNoImages","`%s'",wand->name);
   3859       return((MagickWand *) NULL);
   3860     }
   3861   image=GetImageMask(wand->images,type,wand->exception);
   3862   if (image == (Image *) NULL)
   3863     return((MagickWand *) NULL);
   3864   return(CloneMagickWandFromImages(wand,image));
   3865 }
   3866 
   3867 /*
   3869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3870 %                                                                             %
   3871 %                                                                             %
   3872 %                                                                             %
   3873 %   M a g i c k G e t I m a g e B a c k g r o u n d C o l o r                 %
   3874 %                                                                             %
   3875 %                                                                             %
   3876 %                                                                             %
   3877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3878 %
   3879 %  MagickGetImageBackgroundColor() returns the image background color.
   3880 %
   3881 %  The format of the MagickGetImageBackgroundColor method is:
   3882 %
   3883 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
   3884 %        PixelWand *background_color)
   3885 %
   3886 %  A description of each parameter follows:
   3887 %
   3888 %    o wand: the magick wand.
   3889 %
   3890 %    o background_color: Return the background color.
   3891 %
   3892 */
   3893 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
   3894   PixelWand *background_color)
   3895 {
   3896   assert(wand != (MagickWand *) NULL);
   3897   assert(wand->signature == MagickWandSignature);
   3898   if (wand->debug != MagickFalse)
   3899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3900   if (wand->images == (Image *) NULL)
   3901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3902   PixelSetPixelColor(background_color,&wand->images->background_color);
   3903   return(MagickTrue);
   3904 }
   3905 
   3906 /*
   3908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3909 %                                                                             %
   3910 %                                                                             %
   3911 %                                                                             %
   3912 %   M a g i c k G e t I m a g e B l o b                                       %
   3913 %                                                                             %
   3914 %                                                                             %
   3915 %                                                                             %
   3916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3917 %
   3918 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
   3919 %  the image as a blob (a formatted "file" in memory) and its length, starting
   3920 %  from the current position in the image sequence.  Use MagickSetImageFormat()
   3921 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
   3922 %
   3923 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
   3924 %  the image sequence.
   3925 %
   3926 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
   3927 %
   3928 %  The format of the MagickGetImageBlob method is:
   3929 %
   3930 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
   3931 %
   3932 %  A description of each parameter follows:
   3933 %
   3934 %    o wand: the magick wand.
   3935 %
   3936 %    o length: the length of the blob.
   3937 %
   3938 */
   3939 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
   3940 {
   3941   unsigned char
   3942     *blob;
   3943 
   3944   assert(wand != (MagickWand *) NULL);
   3945   assert(wand->signature == MagickWandSignature);
   3946   if (wand->debug != MagickFalse)
   3947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3948   if (wand->images == (Image *) NULL)
   3949     {
   3950       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3951         "ContainsNoImages","`%s'",wand->name);
   3952       return((unsigned char *) NULL);
   3953     }
   3954   blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
   3955     wand->exception);
   3956   return(blob);
   3957 }
   3958 
   3959 /*
   3961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3962 %                                                                             %
   3963 %                                                                             %
   3964 %                                                                             %
   3965 %   M a g i c k G e t I m a g e s B l o b                                     %
   3966 %                                                                             %
   3967 %                                                                             %
   3968 %                                                                             %
   3969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3970 %
   3971 %  MagickGetImageBlob() implements direct to memory image formats.  It
   3972 %  returns the image sequence as a blob and its length.  The format of the image
   3973 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
   3974 %  return a different image format, use MagickSetImageFormat().
   3975 %
   3976 %  Note, some image formats do not permit multiple images to the same image
   3977 %  stream (e.g. JPEG).  in this instance, just the first image of the
   3978 %  sequence is returned as a blob.
   3979 %
   3980 %  The format of the MagickGetImagesBlob method is:
   3981 %
   3982 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
   3983 %
   3984 %  A description of each parameter follows:
   3985 %
   3986 %    o wand: the magick wand.
   3987 %
   3988 %    o length: the length of the blob.
   3989 %
   3990 */
   3991 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
   3992 {
   3993   unsigned char
   3994     *blob;
   3995 
   3996   assert(wand != (MagickWand *) NULL);
   3997   assert(wand->signature == MagickWandSignature);
   3998   if (wand->debug != MagickFalse)
   3999     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4000   if (wand->images == (Image *) NULL)
   4001     {
   4002       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4003         "ContainsNoImages","`%s'",wand->name);
   4004       return((unsigned char *) NULL);
   4005     }
   4006   blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
   4007     wand->images),length,wand->exception);
   4008   return(blob);
   4009 }
   4010 
   4011 /*
   4013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4014 %                                                                             %
   4015 %                                                                             %
   4016 %                                                                             %
   4017 %   M a g i c k G e t I m a g e B l u e P r i m a r y                         %
   4018 %                                                                             %
   4019 %                                                                             %
   4020 %                                                                             %
   4021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4022 %
   4023 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
   4024 %  image.
   4025 %
   4026 %  The format of the MagickGetImageBluePrimary method is:
   4027 %
   4028 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
   4029 %        double *y,double *z)
   4030 %
   4031 %  A description of each parameter follows:
   4032 %
   4033 %    o wand: the magick wand.
   4034 %
   4035 %    o x: the chromaticity blue primary x-point.
   4036 %
   4037 %    o y: the chromaticity blue primary y-point.
   4038 %
   4039 %    o z: the chromaticity blue primary z-point.
   4040 %
   4041 */
   4042 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
   4043   double *x,double *y,double *z)
   4044 {
   4045   assert(wand != (MagickWand *) NULL);
   4046   assert(wand->signature == MagickWandSignature);
   4047   if (wand->debug != MagickFalse)
   4048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4049   if (wand->images == (Image *) NULL)
   4050     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4051   *x=wand->images->chromaticity.blue_primary.x;
   4052   *y=wand->images->chromaticity.blue_primary.y;
   4053   *z=wand->images->chromaticity.blue_primary.z;
   4054   return(MagickTrue);
   4055 }
   4056 
   4057 /*
   4059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4060 %                                                                             %
   4061 %                                                                             %
   4062 %                                                                             %
   4063 %   M a g i c k G e t I m a g e B o r d e r C o l o r                         %
   4064 %                                                                             %
   4065 %                                                                             %
   4066 %                                                                             %
   4067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4068 %
   4069 %  MagickGetImageBorderColor() returns the image border color.
   4070 %
   4071 %  The format of the MagickGetImageBorderColor method is:
   4072 %
   4073 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
   4074 %        PixelWand *border_color)
   4075 %
   4076 %  A description of each parameter follows:
   4077 %
   4078 %    o wand: the magick wand.
   4079 %
   4080 %    o border_color: Return the border color.
   4081 %
   4082 */
   4083 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
   4084   PixelWand *border_color)
   4085 {
   4086   assert(wand != (MagickWand *) NULL);
   4087   assert(wand->signature == MagickWandSignature);
   4088   if (wand->debug != MagickFalse)
   4089     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4090   if (wand->images == (Image *) NULL)
   4091     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4092   PixelSetPixelColor(border_color,&wand->images->border_color);
   4093   return(MagickTrue);
   4094 }
   4095 
   4096 /*
   4098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4099 %                                                                             %
   4100 %                                                                             %
   4101 %                                                                             %
   4102 %   M a g i c k G e t I m a g e F e a t u r e s                               %
   4103 %                                                                             %
   4104 %                                                                             %
   4105 %                                                                             %
   4106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4107 %
   4108 %  MagickGetImageFeatures() returns features for each channel in the
   4109 %  image in each of four directions (horizontal, vertical, left and right
   4110 %  diagonals) for the specified distance.  The features include the angular
   4111 %  second moment, contrast, correlation, sum of squares: variance, inverse
   4112 %  difference moment, sum average, sum varience, sum entropy, entropy,
   4113 %  difference variance, difference entropy, information measures of
   4114 %  correlation 1, information measures of correlation 2, and maximum
   4115 %  correlation coefficient.  You can access the red channel contrast, for
   4116 %  example, like this:
   4117 %
   4118 %      channel_features=MagickGetImageFeatures(wand,1);
   4119 %      contrast=channel_features[RedPixelChannel].contrast[0];
   4120 %
   4121 %  Use MagickRelinquishMemory() to free the statistics buffer.
   4122 %
   4123 %  The format of the MagickGetImageFeatures method is:
   4124 %
   4125 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
   4126 %        const size_t distance)
   4127 %
   4128 %  A description of each parameter follows:
   4129 %
   4130 %    o wand: the magick wand.
   4131 %
   4132 %    o distance: the distance.
   4133 %
   4134 */
   4135 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
   4136   const size_t distance)
   4137 {
   4138   assert(wand != (MagickWand *) NULL);
   4139   assert(wand->signature == MagickWandSignature);
   4140   if (wand->debug != MagickFalse)
   4141     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4142   if (wand->images == (Image *) NULL)
   4143     {
   4144       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4145         "ContainsNoImages","`%s'",wand->name);
   4146       return((ChannelFeatures *) NULL);
   4147     }
   4148   return(GetImageFeatures(wand->images,distance,wand->exception));
   4149 }
   4150 
   4151 /*
   4153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4154 %                                                                             %
   4155 %                                                                             %
   4156 %                                                                             %
   4157 %   M a g i c k G e t I m a g e K u r t o s i s                               %
   4158 %                                                                             %
   4159 %                                                                             %
   4160 %                                                                             %
   4161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4162 %
   4163 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
   4164 %  more image channels.
   4165 %
   4166 %  The format of the MagickGetImageKurtosis method is:
   4167 %
   4168 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
   4169 %        double *kurtosis,double *skewness)
   4170 %
   4171 %  A description of each parameter follows:
   4172 %
   4173 %    o wand: the magick wand.
   4174 %
   4175 %    o kurtosis:  The kurtosis for the specified channel(s).
   4176 %
   4177 %    o skewness:  The skewness for the specified channel(s).
   4178 %
   4179 */
   4180 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
   4181   double *kurtosis,double *skewness)
   4182 {
   4183   MagickBooleanType
   4184     status;
   4185 
   4186   assert(wand != (MagickWand *) NULL);
   4187   assert(wand->signature == MagickWandSignature);
   4188   if (wand->debug != MagickFalse)
   4189     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4190   if (wand->images == (Image *) NULL)
   4191     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4192   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
   4193   return(status);
   4194 }
   4195 
   4196 /*
   4198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4199 %                                                                             %
   4200 %                                                                             %
   4201 %                                                                             %
   4202 %   M a g i c k G e t I m a g e M e a n                                       %
   4203 %                                                                             %
   4204 %                                                                             %
   4205 %                                                                             %
   4206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4207 %
   4208 %  MagickGetImageMean() gets the mean and standard deviation of one or more
   4209 %  image channels.
   4210 %
   4211 %  The format of the MagickGetImageMean method is:
   4212 %
   4213 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
   4214 %        double *standard_deviation)
   4215 %
   4216 %  A description of each parameter follows:
   4217 %
   4218 %    o wand: the magick wand.
   4219 %
   4220 %    o channel: the image channel(s).
   4221 %
   4222 %    o mean:  The mean pixel value for the specified channel(s).
   4223 %
   4224 %    o standard_deviation:  The standard deviation for the specified channel(s).
   4225 %
   4226 */
   4227 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
   4228   double *standard_deviation)
   4229 {
   4230   MagickBooleanType
   4231     status;
   4232 
   4233   assert(wand != (MagickWand *) NULL);
   4234   assert(wand->signature == MagickWandSignature);
   4235   if (wand->debug != MagickFalse)
   4236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4237   if (wand->images == (Image *) NULL)
   4238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4239   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
   4240   return(status);
   4241 }
   4242 
   4243 /*
   4245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4246 %                                                                             %
   4247 %                                                                             %
   4248 %                                                                             %
   4249 %   M a g i c k G e t I m a g e R a n g e                                     %
   4250 %                                                                             %
   4251 %                                                                             %
   4252 %                                                                             %
   4253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4254 %
   4255 %  MagickGetImageRange() gets the range for one or more image channels.
   4256 %
   4257 %  The format of the MagickGetImageRange method is:
   4258 %
   4259 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
   4260 %        double *maxima)
   4261 %
   4262 %  A description of each parameter follows:
   4263 %
   4264 %    o wand: the magick wand.
   4265 %
   4266 %    o minima:  The minimum pixel value for the specified channel(s).
   4267 %
   4268 %    o maxima:  The maximum pixel value for the specified channel(s).
   4269 %
   4270 */
   4271 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
   4272   double *minima,double *maxima)
   4273 {
   4274   MagickBooleanType
   4275     status;
   4276 
   4277   assert(wand != (MagickWand *) NULL);
   4278   assert(wand->signature == MagickWandSignature);
   4279   if (wand->debug != MagickFalse)
   4280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4281   if (wand->images == (Image *) NULL)
   4282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4283   status=GetImageRange(wand->images,minima,maxima,wand->exception);
   4284   return(status);
   4285 }
   4286 
   4287 /*
   4289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4290 %                                                                             %
   4291 %                                                                             %
   4292 %                                                                             %
   4293 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
   4294 %                                                                             %
   4295 %                                                                             %
   4296 %                                                                             %
   4297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4298 %
   4299 %  MagickGetImageStatistics() returns statistics for each channel in the
   4300 %  image.  The statistics include the channel depth, its minima and
   4301 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
   4302 %  You can access the red channel mean, for example, like this:
   4303 %
   4304 %      channel_statistics=MagickGetImageStatistics(wand);
   4305 %      red_mean=channel_statistics[RedPixelChannel].mean;
   4306 %
   4307 %  Use MagickRelinquishMemory() to free the statistics buffer.
   4308 %
   4309 %  The format of the MagickGetImageStatistics method is:
   4310 %
   4311 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
   4312 %
   4313 %  A description of each parameter follows:
   4314 %
   4315 %    o wand: the magick wand.
   4316 %
   4317 */
   4318 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
   4319 {
   4320   assert(wand != (MagickWand *) NULL);
   4321   assert(wand->signature == MagickWandSignature);
   4322   if (wand->debug != MagickFalse)
   4323     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4324   if (wand->images == (Image *) NULL)
   4325     {
   4326       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4327         "ContainsNoImages","`%s'",wand->name);
   4328       return((ChannelStatistics *) NULL);
   4329     }
   4330   return(GetImageStatistics(wand->images,wand->exception));
   4331 }
   4332 
   4333 /*
   4335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4336 %                                                                             %
   4337 %                                                                             %
   4338 %                                                                             %
   4339 %   M a g i c k G e t I m a g e C o l o r m a p C o l o r                     %
   4340 %                                                                             %
   4341 %                                                                             %
   4342 %                                                                             %
   4343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4344 %
   4345 %  MagickGetImageColormapColor() returns the color of the specified colormap
   4346 %  index.
   4347 %
   4348 %  The format of the MagickGetImageColormapColor method is:
   4349 %
   4350 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
   4351 %        const size_t index,PixelWand *color)
   4352 %
   4353 %  A description of each parameter follows:
   4354 %
   4355 %    o wand: the magick wand.
   4356 %
   4357 %    o index: the offset into the image colormap.
   4358 %
   4359 %    o color: Return the colormap color in this wand.
   4360 %
   4361 */
   4362 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
   4363   const size_t index,PixelWand *color)
   4364 {
   4365   assert(wand != (MagickWand *) NULL);
   4366   assert(wand->signature == MagickWandSignature);
   4367   if (wand->debug != MagickFalse)
   4368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4369   if (wand->images == (Image *) NULL)
   4370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4371   if ((wand->images->colormap == (PixelInfo *) NULL) ||
   4372       (index >= wand->images->colors))
   4373     {
   4374       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4375         "InvalidColormapIndex","`%s'",wand->name);
   4376       return(MagickFalse);
   4377     }
   4378   PixelSetPixelColor(color,wand->images->colormap+index);
   4379   return(MagickTrue);
   4380 }
   4381 
   4382 /*
   4384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4385 %                                                                             %
   4386 %                                                                             %
   4387 %                                                                             %
   4388 %   M a g i c k G e t I m a g e C o l o r s                                   %
   4389 %                                                                             %
   4390 %                                                                             %
   4391 %                                                                             %
   4392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4393 %
   4394 %  MagickGetImageColors() gets the number of unique colors in the image.
   4395 %
   4396 %  The format of the MagickGetImageColors method is:
   4397 %
   4398 %      size_t MagickGetImageColors(MagickWand *wand)
   4399 %
   4400 %  A description of each parameter follows:
   4401 %
   4402 %    o wand: the magick wand.
   4403 %
   4404 */
   4405 WandExport size_t MagickGetImageColors(MagickWand *wand)
   4406 {
   4407   assert(wand != (MagickWand *) NULL);
   4408   assert(wand->signature == MagickWandSignature);
   4409   if (wand->debug != MagickFalse)
   4410     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4411   if (wand->images == (Image *) NULL)
   4412     {
   4413       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4414         "ContainsNoImages","`%s'",wand->name);
   4415       return(0);
   4416     }
   4417   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
   4418 }
   4419 
   4420 /*
   4422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4423 %                                                                             %
   4424 %                                                                             %
   4425 %                                                                             %
   4426 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
   4427 %                                                                             %
   4428 %                                                                             %
   4429 %                                                                             %
   4430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4431 %
   4432 %  MagickGetImageColorspace() gets the image colorspace.
   4433 %
   4434 %  The format of the MagickGetImageColorspace method is:
   4435 %
   4436 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
   4437 %
   4438 %  A description of each parameter follows:
   4439 %
   4440 %    o wand: the magick wand.
   4441 %
   4442 */
   4443 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
   4444 {
   4445   assert(wand != (MagickWand *) NULL);
   4446   assert(wand->signature == MagickWandSignature);
   4447   if (wand->debug != MagickFalse)
   4448     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4449   if (wand->images == (Image *) NULL)
   4450     {
   4451       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4452         "ContainsNoImages","`%s'",wand->name);
   4453       return(UndefinedColorspace);
   4454     }
   4455   return(wand->images->colorspace);
   4456 }
   4457 
   4458 /*
   4460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4461 %                                                                             %
   4462 %                                                                             %
   4463 %                                                                             %
   4464 %   M a g i c k G e t I m a g e C o m p o s e                                 %
   4465 %                                                                             %
   4466 %                                                                             %
   4467 %                                                                             %
   4468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4469 %
   4470 %  MagickGetImageCompose() returns the composite operator associated with the
   4471 %  image.
   4472 %
   4473 %  The format of the MagickGetImageCompose method is:
   4474 %
   4475 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
   4476 %
   4477 %  A description of each parameter follows:
   4478 %
   4479 %    o wand: the magick wand.
   4480 %
   4481 */
   4482 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
   4483 {
   4484   assert(wand != (MagickWand *) NULL);
   4485   assert(wand->signature == MagickWandSignature);
   4486   if (wand->debug != MagickFalse)
   4487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4488   if (wand->images == (Image *) NULL)
   4489     {
   4490       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4491         "ContainsNoImages","`%s'",wand->name);
   4492       return(UndefinedCompositeOp);
   4493     }
   4494   return(wand->images->compose);
   4495 }
   4496 
   4497 /*
   4499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4500 %                                                                             %
   4501 %                                                                             %
   4502 %                                                                             %
   4503 %   M a g i c k G e t I m a g e C o m p r e s s i o n                         %
   4504 %                                                                             %
   4505 %                                                                             %
   4506 %                                                                             %
   4507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4508 %
   4509 %  MagickGetImageCompression() gets the image compression.
   4510 %
   4511 %  The format of the MagickGetImageCompression method is:
   4512 %
   4513 %      CompressionType MagickGetImageCompression(MagickWand *wand)
   4514 %
   4515 %  A description of each parameter follows:
   4516 %
   4517 %    o wand: the magick wand.
   4518 %
   4519 */
   4520 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
   4521 {
   4522   assert(wand != (MagickWand *) NULL);
   4523   assert(wand->signature == MagickWandSignature);
   4524   if (wand->debug != MagickFalse)
   4525     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4526   if (wand->images == (Image *) NULL)
   4527     {
   4528       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4529         "ContainsNoImages","`%s'",wand->name);
   4530       return(UndefinedCompression);
   4531     }
   4532   return(wand->images->compression);
   4533 }
   4534 
   4535 /*
   4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4538 %                                                                             %
   4539 %                                                                             %
   4540 %                                                                             %
   4541 %   M a g i c k G e t I m a g e C o m p r e s s i o n Q u a l i t y           %
   4542 %                                                                             %
   4543 %                                                                             %
   4544 %                                                                             %
   4545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4546 %
   4547 %  MagickGetImageCompressionQuality() gets the image compression quality.
   4548 %
   4549 %  The format of the MagickGetImageCompressionQuality method is:
   4550 %
   4551 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
   4552 %
   4553 %  A description of each parameter follows:
   4554 %
   4555 %    o wand: the magick wand.
   4556 %
   4557 */
   4558 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
   4559 {
   4560   assert(wand != (MagickWand *) NULL);
   4561   assert(wand->signature == MagickWandSignature);
   4562   if (wand->debug != MagickFalse)
   4563     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4564   if (wand->images == (Image *) NULL)
   4565     {
   4566       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4567         "ContainsNoImages","`%s'",wand->name);
   4568       return(0UL);
   4569     }
   4570   return(wand->images->quality);
   4571 }
   4572 
   4573 /*
   4575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4576 %                                                                             %
   4577 %                                                                             %
   4578 %                                                                             %
   4579 %   M a g i c k G e t I m a g e D e l a y                                     %
   4580 %                                                                             %
   4581 %                                                                             %
   4582 %                                                                             %
   4583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4584 %
   4585 %  MagickGetImageDelay() gets the image delay.
   4586 %
   4587 %  The format of the MagickGetImageDelay method is:
   4588 %
   4589 %      size_t MagickGetImageDelay(MagickWand *wand)
   4590 %
   4591 %  A description of each parameter follows:
   4592 %
   4593 %    o wand: the magick wand.
   4594 %
   4595 */
   4596 WandExport size_t MagickGetImageDelay(MagickWand *wand)
   4597 {
   4598   assert(wand != (MagickWand *) NULL);
   4599   assert(wand->signature == MagickWandSignature);
   4600   if (wand->debug != MagickFalse)
   4601     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4602   if (wand->images == (Image *) NULL)
   4603     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4604   return(wand->images->delay);
   4605 }
   4606 
   4607 /*
   4609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4610 %                                                                             %
   4611 %                                                                             %
   4612 %                                                                             %
   4613 %   M a g i c k G e t I m a g e D e p t h                                     %
   4614 %                                                                             %
   4615 %                                                                             %
   4616 %                                                                             %
   4617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4618 %
   4619 %  MagickGetImageDepth() gets the image depth.
   4620 %
   4621 %  The format of the MagickGetImageDepth method is:
   4622 %
   4623 %      size_t MagickGetImageDepth(MagickWand *wand)
   4624 %
   4625 %  A description of each parameter follows:
   4626 %
   4627 %    o wand: the magick wand.
   4628 %
   4629 */
   4630 WandExport size_t MagickGetImageDepth(MagickWand *wand)
   4631 {
   4632   assert(wand != (MagickWand *) NULL);
   4633   assert(wand->signature == MagickWandSignature);
   4634   if (wand->debug != MagickFalse)
   4635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4636   if (wand->images == (Image *) NULL)
   4637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4638   return(wand->images->depth);
   4639 }
   4640 
   4641 /*
   4643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4644 %                                                                             %
   4645 %                                                                             %
   4646 %                                                                             %
   4647 %   M a g i c k G e t I m a g e D i s p o s e                                 %
   4648 %                                                                             %
   4649 %                                                                             %
   4650 %                                                                             %
   4651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4652 %
   4653 %  MagickGetImageDispose() gets the image disposal method.
   4654 %
   4655 %  The format of the MagickGetImageDispose method is:
   4656 %
   4657 %      DisposeType MagickGetImageDispose(MagickWand *wand)
   4658 %
   4659 %  A description of each parameter follows:
   4660 %
   4661 %    o wand: the magick wand.
   4662 %
   4663 */
   4664 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
   4665 {
   4666   assert(wand != (MagickWand *) NULL);
   4667   assert(wand->signature == MagickWandSignature);
   4668   if (wand->debug != MagickFalse)
   4669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4670   if (wand->images == (Image *) NULL)
   4671     {
   4672       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4673         "ContainsNoImages","`%s'",wand->name);
   4674       return(UndefinedDispose);
   4675     }
   4676   return((DisposeType) wand->images->dispose);
   4677 }
   4678 
   4679 /*
   4681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4682 %                                                                             %
   4683 %                                                                             %
   4684 %                                                                             %
   4685 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
   4686 %                                                                             %
   4687 %                                                                             %
   4688 %                                                                             %
   4689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4690 %
   4691 %  MagickGetImageDistortion() compares an image to a reconstructed image and
   4692 %  returns the specified distortion metric.
   4693 %
   4694 %  The format of the MagickGetImageDistortion method is:
   4695 %
   4696 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
   4697 %        const MagickWand *reference,const MetricType metric,
   4698 %        double *distortion)
   4699 %
   4700 %  A description of each parameter follows:
   4701 %
   4702 %    o wand: the magick wand.
   4703 %
   4704 %    o reference: the reference wand.
   4705 %
   4706 %    o metric: the metric.
   4707 %
   4708 %    o distortion: the computed distortion between the images.
   4709 %
   4710 */
   4711 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
   4712   const MagickWand *reference,const MetricType metric,double *distortion)
   4713 {
   4714   MagickBooleanType
   4715     status;
   4716 
   4717   assert(wand != (MagickWand *) NULL);
   4718   assert(wand->signature == MagickWandSignature);
   4719   if (wand->debug != MagickFalse)
   4720     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4721   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   4722     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4723   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
   4724     wand->exception);
   4725   return(status);
   4726 }
   4727 
   4728 /*
   4730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4731 %                                                                             %
   4732 %                                                                             %
   4733 %                                                                             %
   4734 %   M a g i c k G e t I m a g e D i s t o r t i o n s                         %
   4735 %                                                                             %
   4736 %                                                                             %
   4737 %                                                                             %
   4738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4739 %
   4740 %  MagickGetImageDistortions() compares one or more pixel channels of an
   4741 %  image to a reconstructed image and returns the specified distortion metrics.
   4742 %
   4743 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
   4744 %
   4745 %  The format of the MagickGetImageDistortion method is:
   4746 %
   4747 %      double *MagickGetImageDistortion(MagickWand *wand,
   4748 %        const MagickWand *reference,const MetricType metric)
   4749 %
   4750 %  A description of each parameter follows:
   4751 %
   4752 %    o wand: the magick wand.
   4753 %
   4754 %    o reference: the reference wand.
   4755 %
   4756 %    o metric: the metric.
   4757 %
   4758 */
   4759 WandExport double *MagickGetImageDistortions(MagickWand *wand,
   4760   const MagickWand *reference,const MetricType metric)
   4761 {
   4762   double
   4763     *channel_distortion;
   4764 
   4765   assert(wand != (MagickWand *) NULL);
   4766   assert(wand->signature == MagickWandSignature);
   4767   if (wand->debug != MagickFalse)
   4768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4769   assert(reference != (MagickWand *) NULL);
   4770   assert(reference->signature == MagickWandSignature);
   4771   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   4772     {
   4773       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4774         "ContainsNoImages","`%s'",wand->name);
   4775       return((double *) NULL);
   4776     }
   4777   channel_distortion=GetImageDistortions(wand->images,reference->images,
   4778     metric,wand->exception);
   4779   return(channel_distortion);
   4780 }
   4781 
   4782 /*
   4784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4785 %                                                                             %
   4786 %                                                                             %
   4787 %                                                                             %
   4788 %   M a g i c k G e t I m a g e E n d i a n                                   %
   4789 %                                                                             %
   4790 %                                                                             %
   4791 %                                                                             %
   4792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4793 %
   4794 %  MagickGetImageEndian() gets the image endian.
   4795 %
   4796 %  The format of the MagickGetImageEndian method is:
   4797 %
   4798 %      EndianType MagickGetImageEndian(MagickWand *wand)
   4799 %
   4800 %  A description of each parameter follows:
   4801 %
   4802 %    o wand: the magick wand.
   4803 %
   4804 */
   4805 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
   4806 {
   4807   assert(wand != (MagickWand *) NULL);
   4808   assert(wand->signature == MagickWandSignature);
   4809   if (wand->debug != MagickFalse)
   4810     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4811   if (wand->images == (Image *) NULL)
   4812     {
   4813       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4814         "ContainsNoImages","`%s'",wand->name);
   4815       return(UndefinedEndian);
   4816     }
   4817   return(wand->images->endian);
   4818 }
   4819 
   4820 /*
   4822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4823 %                                                                             %
   4824 %                                                                             %
   4825 %                                                                             %
   4826 %   M a g i c k G e t I m a g e F i l e n a m e                               %
   4827 %                                                                             %
   4828 %                                                                             %
   4829 %                                                                             %
   4830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4831 %
   4832 %  MagickGetImageFilename() returns the filename of a particular image in a
   4833 %  sequence.
   4834 %
   4835 %  The format of the MagickGetImageFilename method is:
   4836 %
   4837 %      char *MagickGetImageFilename(MagickWand *wand)
   4838 %
   4839 %  A description of each parameter follows:
   4840 %
   4841 %    o wand: the magick wand.
   4842 %
   4843 */
   4844 WandExport char *MagickGetImageFilename(MagickWand *wand)
   4845 {
   4846   assert(wand != (MagickWand *) NULL);
   4847   assert(wand->signature == MagickWandSignature);
   4848   if (wand->debug != MagickFalse)
   4849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4850   if (wand->images == (Image *) NULL)
   4851     {
   4852       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4853         "ContainsNoImages","`%s'",wand->name);
   4854       return((char *) NULL);
   4855     }
   4856   return(AcquireString(wand->images->filename));
   4857 }
   4858 
   4859 /*
   4861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4862 %                                                                             %
   4863 %                                                                             %
   4864 %                                                                             %
   4865 %   M a g i c k G e t I m a g e F o r m a t                                   %
   4866 %                                                                             %
   4867 %                                                                             %
   4868 %                                                                             %
   4869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4870 %
   4871 %  MagickGetImageFormat() returns the format of a particular image in a
   4872 %  sequence.
   4873 %
   4874 %  The format of the MagickGetImageFormat method is:
   4875 %
   4876 %      char *MagickGetImageFormat(MagickWand *wand)
   4877 %
   4878 %  A description of each parameter follows:
   4879 %
   4880 %    o wand: the magick wand.
   4881 %
   4882 */
   4883 WandExport char *MagickGetImageFormat(MagickWand *wand)
   4884 {
   4885   assert(wand != (MagickWand *) NULL);
   4886   assert(wand->signature == MagickWandSignature);
   4887   if (wand->debug != MagickFalse)
   4888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4889   if (wand->images == (Image *) NULL)
   4890     {
   4891       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4892         "ContainsNoImages","`%s'",wand->name);
   4893       return((char *) NULL);
   4894     }
   4895   return(AcquireString(wand->images->magick));
   4896 }
   4897 
   4898 /*
   4900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4901 %                                                                             %
   4902 %                                                                             %
   4903 %                                                                             %
   4904 %   M a g i c k G e t I m a g e F u z z                                       %
   4905 %                                                                             %
   4906 %                                                                             %
   4907 %                                                                             %
   4908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4909 %
   4910 %  MagickGetImageFuzz() gets the image fuzz.
   4911 %
   4912 %  The format of the MagickGetImageFuzz method is:
   4913 %
   4914 %      double MagickGetImageFuzz(MagickWand *wand)
   4915 %
   4916 %  A description of each parameter follows:
   4917 %
   4918 %    o wand: the magick wand.
   4919 %
   4920 */
   4921 WandExport double MagickGetImageFuzz(MagickWand *wand)
   4922 {
   4923   assert(wand != (MagickWand *) NULL);
   4924   assert(wand->signature == MagickWandSignature);
   4925   if (wand->debug != MagickFalse)
   4926     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4927   if (wand->images == (Image *) NULL)
   4928     {
   4929       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4930         "ContainsNoImages","`%s'",wand->name);
   4931       return(0.0);
   4932     }
   4933   return(wand->images->fuzz);
   4934 }
   4935 
   4936 /*
   4938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4939 %                                                                             %
   4940 %                                                                             %
   4941 %                                                                             %
   4942 %   M a g i c k G e t I m a g e G a m m a                                     %
   4943 %                                                                             %
   4944 %                                                                             %
   4945 %                                                                             %
   4946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4947 %
   4948 %  MagickGetImageGamma() gets the image gamma.
   4949 %
   4950 %  The format of the MagickGetImageGamma method is:
   4951 %
   4952 %      double MagickGetImageGamma(MagickWand *wand)
   4953 %
   4954 %  A description of each parameter follows:
   4955 %
   4956 %    o wand: the magick wand.
   4957 %
   4958 */
   4959 WandExport double MagickGetImageGamma(MagickWand *wand)
   4960 {
   4961   assert(wand != (MagickWand *) NULL);
   4962   assert(wand->signature == MagickWandSignature);
   4963   if (wand->debug != MagickFalse)
   4964     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4965   if (wand->images == (Image *) NULL)
   4966     {
   4967       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4968         "ContainsNoImages","`%s'",wand->name);
   4969       return(0.0);
   4970     }
   4971   return(wand->images->gamma);
   4972 }
   4973 
   4974 /*
   4976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4977 %                                                                             %
   4978 %                                                                             %
   4979 %                                                                             %
   4980 %   M a g i c k G e t I m a g e G r a v i t y                                 %
   4981 %                                                                             %
   4982 %                                                                             %
   4983 %                                                                             %
   4984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4985 %
   4986 %  MagickGetImageGravity() gets the image gravity.
   4987 %
   4988 %  The format of the MagickGetImageGravity method is:
   4989 %
   4990 %      GravityType MagickGetImageGravity(MagickWand *wand)
   4991 %
   4992 %  A description of each parameter follows:
   4993 %
   4994 %    o wand: the magick wand.
   4995 %
   4996 */
   4997 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
   4998 {
   4999   assert(wand != (MagickWand *) NULL);
   5000   assert(wand->signature == MagickWandSignature);
   5001   if (wand->debug != MagickFalse)
   5002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5003   if (wand->images == (Image *) NULL)
   5004     {
   5005       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5006         "ContainsNoImages","`%s'",wand->name);
   5007       return(UndefinedGravity);
   5008     }
   5009   return(wand->images->gravity);
   5010 }
   5011 
   5012 /*
   5014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5015 %                                                                             %
   5016 %                                                                             %
   5017 %                                                                             %
   5018 %   M a g i c k G e t I m a g e G r e e n P r i m a r y                       %
   5019 %                                                                             %
   5020 %                                                                             %
   5021 %                                                                             %
   5022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5023 %
   5024 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
   5025 %
   5026 %  The format of the MagickGetImageGreenPrimary method is:
   5027 %
   5028 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
   5029 %        double *y,double *z)
   5030 %
   5031 %  A description of each parameter follows:
   5032 %
   5033 %    o wand: the magick wand.
   5034 %
   5035 %    o x: the chromaticity green primary x-point.
   5036 %
   5037 %    o y: the chromaticity green primary y-point.
   5038 %
   5039 %    o z: the chromaticity green primary z-point.
   5040 %
   5041 */
   5042 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
   5043   double *x,double *y,double *z)
   5044 {
   5045   assert(wand != (MagickWand *) NULL);
   5046   assert(wand->signature == MagickWandSignature);
   5047   if (wand->debug != MagickFalse)
   5048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5049   if (wand->images == (Image *) NULL)
   5050     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5051   *x=wand->images->chromaticity.green_primary.x;
   5052   *y=wand->images->chromaticity.green_primary.y;
   5053   *z=wand->images->chromaticity.green_primary.z;
   5054   return(MagickTrue);
   5055 }
   5056 
   5057 /*
   5059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5060 %                                                                             %
   5061 %                                                                             %
   5062 %                                                                             %
   5063 %   M a g i c k G e t I m a g e H e i g h t                                   %
   5064 %                                                                             %
   5065 %                                                                             %
   5066 %                                                                             %
   5067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5068 %
   5069 %  MagickGetImageHeight() returns the image height.
   5070 %
   5071 %  The format of the MagickGetImageHeight method is:
   5072 %
   5073 %      size_t MagickGetImageHeight(MagickWand *wand)
   5074 %
   5075 %  A description of each parameter follows:
   5076 %
   5077 %    o wand: the magick wand.
   5078 %
   5079 */
   5080 WandExport size_t MagickGetImageHeight(MagickWand *wand)
   5081 {
   5082   assert(wand != (MagickWand *) NULL);
   5083   assert(wand->signature == MagickWandSignature);
   5084   if (wand->debug != MagickFalse)
   5085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5086   if (wand->images == (Image *) NULL)
   5087     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5088   return(wand->images->rows);
   5089 }
   5090 
   5091 /*
   5093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5094 %                                                                             %
   5095 %                                                                             %
   5096 %                                                                             %
   5097 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
   5098 %                                                                             %
   5099 %                                                                             %
   5100 %                                                                             %
   5101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5102 %
   5103 %  MagickGetImageHistogram() returns the image histogram as an array of
   5104 %  PixelWand wands.
   5105 %
   5106 %  The format of the MagickGetImageHistogram method is:
   5107 %
   5108 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
   5109 %        size_t *number_colors)
   5110 %
   5111 %  A description of each parameter follows:
   5112 %
   5113 %    o wand: the magick wand.
   5114 %
   5115 %    o number_colors: the number of unique colors in the image and the number
   5116 %      of pixel wands returned.
   5117 %
   5118 */
   5119 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
   5120   size_t *number_colors)
   5121 {
   5122   PixelInfo
   5123     *histogram;
   5124 
   5125   PixelWand
   5126     **pixel_wands;
   5127 
   5128   register ssize_t
   5129     i;
   5130 
   5131   assert(wand != (MagickWand *) NULL);
   5132   assert(wand->signature == MagickWandSignature);
   5133   if (wand->debug != MagickFalse)
   5134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5135   if (wand->images == (Image *) NULL)
   5136     {
   5137       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5138         "ContainsNoImages","`%s'",wand->name);
   5139       return((PixelWand **) NULL);
   5140     }
   5141   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
   5142   if (histogram == (PixelInfo *) NULL)
   5143     return((PixelWand **) NULL);
   5144   pixel_wands=NewPixelWands(*number_colors);
   5145   for (i=0; i < (ssize_t) *number_colors; i++)
   5146   {
   5147     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
   5148     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
   5149   }
   5150   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
   5151   return(pixel_wands);
   5152 }
   5153 
   5154 /*
   5156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5157 %                                                                             %
   5158 %                                                                             %
   5159 %                                                                             %
   5160 %   M a g i c k G e t I m a g e I n t e r l a c e S c h e m e                 %
   5161 %                                                                             %
   5162 %                                                                             %
   5163 %                                                                             %
   5164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5165 %
   5166 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
   5167 %
   5168 %  The format of the MagickGetImageInterlaceScheme method is:
   5169 %
   5170 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
   5171 %
   5172 %  A description of each parameter follows:
   5173 %
   5174 %    o wand: the magick wand.
   5175 %
   5176 */
   5177 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
   5178 {
   5179   assert(wand != (MagickWand *) NULL);
   5180   assert(wand->signature == MagickWandSignature);
   5181   if (wand->debug != MagickFalse)
   5182     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5183   if (wand->images == (Image *) NULL)
   5184     {
   5185       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5186         "ContainsNoImages","`%s'",wand->name);
   5187       return(UndefinedInterlace);
   5188     }
   5189   return(wand->images->interlace);
   5190 }
   5191 
   5192 /*
   5194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5195 %                                                                             %
   5196 %                                                                             %
   5197 %                                                                             %
   5198 %   M a g i c k G e t I m a g e I n t e r p o l a t e M e t h o d             %
   5199 %                                                                             %
   5200 %                                                                             %
   5201 %                                                                             %
   5202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5203 %
   5204 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
   5205 %  sepcified image.
   5206 %
   5207 %  The format of the MagickGetImageInterpolateMethod method is:
   5208 %
   5209 %      PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
   5210 %
   5211 %  A description of each parameter follows:
   5212 %
   5213 %    o wand: the magick wand.
   5214 %
   5215 */
   5216 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
   5217   MagickWand *wand)
   5218 {
   5219   assert(wand != (MagickWand *) NULL);
   5220   assert(wand->signature == MagickWandSignature);
   5221   if (wand->debug != MagickFalse)
   5222     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5223   if (wand->images == (Image *) NULL)
   5224     {
   5225       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5226         "ContainsNoImages","`%s'",wand->name);
   5227       return(UndefinedInterpolatePixel);
   5228     }
   5229   return(wand->images->interpolate);
   5230 }
   5231 
   5232 /*
   5234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5235 %                                                                             %
   5236 %                                                                             %
   5237 %                                                                             %
   5238 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
   5239 %                                                                             %
   5240 %                                                                             %
   5241 %                                                                             %
   5242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5243 %
   5244 %  MagickGetImageIterations() gets the image iterations.
   5245 %
   5246 %  The format of the MagickGetImageIterations method is:
   5247 %
   5248 %      size_t MagickGetImageIterations(MagickWand *wand)
   5249 %
   5250 %  A description of each parameter follows:
   5251 %
   5252 %    o wand: the magick wand.
   5253 %
   5254 */
   5255 WandExport size_t MagickGetImageIterations(MagickWand *wand)
   5256 {
   5257   assert(wand != (MagickWand *) NULL);
   5258   assert(wand->signature == MagickWandSignature);
   5259   if (wand->debug != MagickFalse)
   5260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5261   if (wand->images == (Image *) NULL)
   5262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5263   return(wand->images->iterations);
   5264 }
   5265 
   5266 /*
   5268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5269 %                                                                             %
   5270 %                                                                             %
   5271 %                                                                             %
   5272 %   M a g i c k G e t I m a g e L e n g t h                                   %
   5273 %                                                                             %
   5274 %                                                                             %
   5275 %                                                                             %
   5276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5277 %
   5278 %  MagickGetImageLength() returns the image length in bytes.
   5279 %
   5280 %  The format of the MagickGetImageLength method is:
   5281 %
   5282 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
   5283 %        MagickSizeType *length)
   5284 %
   5285 %  A description of each parameter follows:
   5286 %
   5287 %    o wand: the magick wand.
   5288 %
   5289 %    o length: the image length in bytes.
   5290 %
   5291 */
   5292 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
   5293   MagickSizeType *length)
   5294 {
   5295   assert(wand != (MagickWand *) NULL);
   5296   assert(wand->signature == MagickWandSignature);
   5297   if (wand->debug != MagickFalse)
   5298     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5299   if (wand->images == (Image *) NULL)
   5300     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5301   *length=GetBlobSize(wand->images);
   5302   return(MagickTrue);
   5303 }
   5304 
   5305 /*
   5307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5308 %                                                                             %
   5309 %                                                                             %
   5310 %                                                                             %
   5311 %   M a g i c k G e t I m a g e O r i e n t a t i o n                         %
   5312 %                                                                             %
   5313 %                                                                             %
   5314 %                                                                             %
   5315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5316 %
   5317 %  MagickGetImageOrientation() returns the image orientation.
   5318 %
   5319 %  The format of the MagickGetImageOrientation method is:
   5320 %
   5321 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
   5322 %
   5323 %  A description of each parameter follows:
   5324 %
   5325 %    o wand: the magick wand.
   5326 %
   5327 */
   5328 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
   5329 {
   5330   assert(wand != (MagickWand *) NULL);
   5331   assert(wand->signature == MagickWandSignature);
   5332   if (wand->debug != MagickFalse)
   5333     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5334   if (wand->images == (Image *) NULL)
   5335     {
   5336       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5337         "ContainsNoImages","`%s'",wand->name);
   5338       return(UndefinedOrientation);
   5339     }
   5340   return(wand->images->orientation);
   5341 }
   5342 
   5343 /*
   5345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5346 %                                                                             %
   5347 %                                                                             %
   5348 %                                                                             %
   5349 %   M a g i c k G e t I m a g e P a g e                                       %
   5350 %                                                                             %
   5351 %                                                                             %
   5352 %                                                                             %
   5353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5354 %
   5355 %  MagickGetImagePage() returns the page geometry associated with the image.
   5356 %
   5357 %  The format of the MagickGetImagePage method is:
   5358 %
   5359 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
   5360 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
   5361 %
   5362 %  A description of each parameter follows:
   5363 %
   5364 %    o wand: the magick wand.
   5365 %
   5366 %    o width: the page width.
   5367 %
   5368 %    o height: the page height.
   5369 %
   5370 %    o x: the page x-offset.
   5371 %
   5372 %    o y: the page y-offset.
   5373 %
   5374 */
   5375 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
   5376   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
   5377 {
   5378   assert(wand != (const MagickWand *) NULL);
   5379   assert(wand->signature == MagickWandSignature);
   5380   if (wand->debug != MagickFalse)
   5381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5382   if (wand->images == (Image *) NULL)
   5383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5384   *width=wand->images->page.width;
   5385   *height=wand->images->page.height;
   5386   *x=wand->images->page.x;
   5387   *y=wand->images->page.y;
   5388   return(MagickTrue);
   5389 }
   5390 
   5391 /*
   5393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5394 %                                                                             %
   5395 %                                                                             %
   5396 %                                                                             %
   5397 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
   5398 %                                                                             %
   5399 %                                                                             %
   5400 %                                                                             %
   5401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5402 %
   5403 %  MagickGetImagePixelColor() returns the color of the specified pixel.
   5404 %
   5405 %  The format of the MagickGetImagePixelColor method is:
   5406 %
   5407 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
   5408 %        const ssize_t x,const ssize_t y,PixelWand *color)
   5409 %
   5410 %  A description of each parameter follows:
   5411 %
   5412 %    o wand: the magick wand.
   5413 %
   5414 %    o x,y: the pixel offset into the image.
   5415 %
   5416 %    o color: Return the colormap color in this wand.
   5417 %
   5418 */
   5419 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
   5420   const ssize_t x,const ssize_t y,PixelWand *color)
   5421 {
   5422   register const Quantum
   5423     *p;
   5424 
   5425   CacheView
   5426     *image_view;
   5427 
   5428   assert(wand != (MagickWand *) NULL);
   5429   assert(wand->signature == MagickWandSignature);
   5430   if (wand->debug != MagickFalse)
   5431     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5432   if (wand->images == (Image *) NULL)
   5433     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5434   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
   5435   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
   5436   if (p == (const Quantum *) NULL)
   5437     {
   5438       image_view=DestroyCacheView(image_view);
   5439       return(MagickFalse);
   5440     }
   5441   PixelSetQuantumPixel(wand->images,p,color);
   5442   image_view=DestroyCacheView(image_view);
   5443   return(MagickTrue);
   5444 }
   5445 
   5446 /*
   5448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5449 %                                                                             %
   5450 %                                                                             %
   5451 %                                                                             %
   5452 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
   5453 %                                                                             %
   5454 %                                                                             %
   5455 %                                                                             %
   5456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5457 %
   5458 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
   5459 %
   5460 %  The format of the MagickGetImageRedPrimary method is:
   5461 %
   5462 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
   5463 %        double *y, double *z)
   5464 %
   5465 %  A description of each parameter follows:
   5466 %
   5467 %    o wand: the magick wand.
   5468 %
   5469 %    o x: the chromaticity red primary x-point.
   5470 %
   5471 %    o y: the chromaticity red primary y-point.
   5472 %
   5473 %    o z: the chromaticity red primary z-point.
   5474 %
   5475 */
   5476 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
   5477   double *x,double *y,double *z)
   5478 {
   5479   assert(wand != (MagickWand *) NULL);
   5480   assert(wand->signature == MagickWandSignature);
   5481   if (wand->debug != MagickFalse)
   5482     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5483   if (wand->images == (Image *) NULL)
   5484     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5485   *x=wand->images->chromaticity.red_primary.x;
   5486   *y=wand->images->chromaticity.red_primary.y;
   5487   *z=wand->images->chromaticity.red_primary.z;
   5488   return(MagickTrue);
   5489 }
   5490 
   5491 /*
   5493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5494 %                                                                             %
   5495 %                                                                             %
   5496 %                                                                             %
   5497 %   M a g i c k G e t I m a g e R e g i o n                                   %
   5498 %                                                                             %
   5499 %                                                                             %
   5500 %                                                                             %
   5501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5502 %
   5503 %  MagickGetImageRegion() extracts a region of the image and returns it as a
   5504 %  a new wand.
   5505 %
   5506 %  The format of the MagickGetImageRegion method is:
   5507 %
   5508 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
   5509 %        const size_t width,const size_t height,const ssize_t x,
   5510 %        const ssize_t y)
   5511 %
   5512 %  A description of each parameter follows:
   5513 %
   5514 %    o wand: the magick wand.
   5515 %
   5516 %    o width: the region width.
   5517 %
   5518 %    o height: the region height.
   5519 %
   5520 %    o x: the region x offset.
   5521 %
   5522 %    o y: the region y offset.
   5523 %
   5524 */
   5525 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
   5526   const size_t width,const size_t height,const ssize_t x,
   5527   const ssize_t y)
   5528 {
   5529   Image
   5530     *region_image;
   5531 
   5532   RectangleInfo
   5533     region;
   5534 
   5535   assert(wand != (MagickWand *) NULL);
   5536   assert(wand->signature == MagickWandSignature);
   5537   if (wand->debug != MagickFalse)
   5538     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5539   if (wand->images == (Image *) NULL)
   5540     return((MagickWand *) NULL);
   5541   region.width=width;
   5542   region.height=height;
   5543   region.x=x;
   5544   region.y=y;
   5545   region_image=CropImage(wand->images,&region,wand->exception);
   5546   if (region_image == (Image *) NULL)
   5547     return((MagickWand *) NULL);
   5548   return(CloneMagickWandFromImages(wand,region_image));
   5549 }
   5550 
   5551 /*
   5553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5554 %                                                                             %
   5555 %                                                                             %
   5556 %                                                                             %
   5557 %   M a g i c k G e t I m a g e R e n d e r i n g I n t e n t                 %
   5558 %                                                                             %
   5559 %                                                                             %
   5560 %                                                                             %
   5561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5562 %
   5563 %  MagickGetImageRenderingIntent() gets the image rendering intent.
   5564 %
   5565 %  The format of the MagickGetImageRenderingIntent method is:
   5566 %
   5567 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
   5568 %
   5569 %  A description of each parameter follows:
   5570 %
   5571 %    o wand: the magick wand.
   5572 %
   5573 */
   5574 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
   5575 {
   5576   assert(wand != (MagickWand *) NULL);
   5577   assert(wand->signature == MagickWandSignature);
   5578   if (wand->debug != MagickFalse)
   5579     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5580   if (wand->images == (Image *) NULL)
   5581     {
   5582       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5583         "ContainsNoImages","`%s'",wand->name);
   5584       return(UndefinedIntent);
   5585     }
   5586   return((RenderingIntent) wand->images->rendering_intent);
   5587 }
   5588 
   5589 /*
   5591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5592 %                                                                             %
   5593 %                                                                             %
   5594 %                                                                             %
   5595 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
   5596 %                                                                             %
   5597 %                                                                             %
   5598 %                                                                             %
   5599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5600 %
   5601 %  MagickGetImageResolution() gets the image X and Y resolution.
   5602 %
   5603 %  The format of the MagickGetImageResolution method is:
   5604 %
   5605 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
   5606 %        double *y)
   5607 %
   5608 %  A description of each parameter follows:
   5609 %
   5610 %    o wand: the magick wand.
   5611 %
   5612 %    o x: the image x-resolution.
   5613 %
   5614 %    o y: the image y-resolution.
   5615 %
   5616 */
   5617 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
   5618   double *x,double *y)
   5619 {
   5620   assert(wand != (MagickWand *) NULL);
   5621   assert(wand->signature == MagickWandSignature);
   5622   if (wand->debug != MagickFalse)
   5623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5624   if (wand->images == (Image *) NULL)
   5625     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5626   *x=wand->images->resolution.x;
   5627   *y=wand->images->resolution.y;
   5628   return(MagickTrue);
   5629 }
   5630 
   5631 /*
   5633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5634 %                                                                             %
   5635 %                                                                             %
   5636 %                                                                             %
   5637 %   M a g i c k G e t I m a g e S c e n e                                     %
   5638 %                                                                             %
   5639 %                                                                             %
   5640 %                                                                             %
   5641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5642 %
   5643 %  MagickGetImageScene() gets the image scene.
   5644 %
   5645 %  The format of the MagickGetImageScene method is:
   5646 %
   5647 %      size_t MagickGetImageScene(MagickWand *wand)
   5648 %
   5649 %  A description of each parameter follows:
   5650 %
   5651 %    o wand: the magick wand.
   5652 %
   5653 */
   5654 WandExport size_t MagickGetImageScene(MagickWand *wand)
   5655 {
   5656   assert(wand != (MagickWand *) NULL);
   5657   assert(wand->signature == MagickWandSignature);
   5658   if (wand->debug != MagickFalse)
   5659     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5660   if (wand->images == (Image *) NULL)
   5661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5662   return(wand->images->scene);
   5663 }
   5664 
   5665 /*
   5667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5668 %                                                                             %
   5669 %                                                                             %
   5670 %                                                                             %
   5671 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
   5672 %                                                                             %
   5673 %                                                                             %
   5674 %                                                                             %
   5675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5676 %
   5677 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
   5678 %  pixel stream.
   5679 %
   5680 %  The format of the MagickGetImageSignature method is:
   5681 %
   5682 %      char *MagickGetImageSignature(MagickWand *wand)
   5683 %
   5684 %  A description of each parameter follows:
   5685 %
   5686 %    o wand: the magick wand.
   5687 %
   5688 */
   5689 WandExport char *MagickGetImageSignature(MagickWand *wand)
   5690 {
   5691   const char
   5692     *value;
   5693 
   5694   MagickBooleanType
   5695     status;
   5696 
   5697   assert(wand != (MagickWand *) NULL);
   5698   assert(wand->signature == MagickWandSignature);
   5699   if (wand->debug != MagickFalse)
   5700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5701   if (wand->images == (Image *) NULL)
   5702     {
   5703       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5704         "ContainsNoImages","`%s'",wand->name);
   5705       return((char *) NULL);
   5706     }
   5707   status=SignatureImage(wand->images,wand->exception);
   5708   if (status == MagickFalse)
   5709     return((char *) NULL);
   5710   value=GetImageProperty(wand->images,"signature",wand->exception);
   5711   if (value == (const char *) NULL)
   5712     return((char *) NULL);
   5713   return(AcquireString(value));
   5714 }
   5715 
   5716 /*
   5718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5719 %                                                                             %
   5720 %                                                                             %
   5721 %                                                                             %
   5722 %   M a g i c k G e t I m a g e T i c k s P e r S e c o n d                   %
   5723 %                                                                             %
   5724 %                                                                             %
   5725 %                                                                             %
   5726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5727 %
   5728 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
   5729 %
   5730 %  The format of the MagickGetImageTicksPerSecond method is:
   5731 %
   5732 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
   5733 %
   5734 %  A description of each parameter follows:
   5735 %
   5736 %    o wand: the magick wand.
   5737 %
   5738 */
   5739 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
   5740 {
   5741   assert(wand != (MagickWand *) NULL);
   5742   assert(wand->signature == MagickWandSignature);
   5743   if (wand->debug != MagickFalse)
   5744     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5745   if (wand->images == (Image *) NULL)
   5746     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5747   return((size_t) wand->images->ticks_per_second);
   5748 }
   5749 
   5750 /*
   5752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5753 %                                                                             %
   5754 %                                                                             %
   5755 %                                                                             %
   5756 %   M a g i c k G e t I m a g e T y p e                                       %
   5757 %                                                                             %
   5758 %                                                                             %
   5759 %                                                                             %
   5760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5761 %
   5762 %  MagickGetImageType() gets the potential image type:
   5763 %
   5764 %        Bilevel        Grayscale       GrayscaleMatte
   5765 %        Palette        PaletteMatte    TrueColor
   5766 %        TrueColorMatte ColorSeparation ColorSeparationMatte
   5767 %
   5768 %  The format of the MagickGetImageType method is:
   5769 %
   5770 %      ImageType MagickGetImageType(MagickWand *wand)
   5771 %
   5772 %  A description of each parameter follows:
   5773 %
   5774 %    o wand: the magick wand.
   5775 %
   5776 */
   5777 WandExport ImageType MagickGetImageType(MagickWand *wand)
   5778 {
   5779   assert(wand != (MagickWand *) NULL);
   5780   assert(wand->signature == MagickWandSignature);
   5781   if (wand->debug != MagickFalse)
   5782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5783   if (wand->images == (Image *) NULL)
   5784     {
   5785       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5786         "ContainsNoImages","`%s'",wand->name);
   5787       return(UndefinedType);
   5788     }
   5789   return(GetImageType(wand->images));
   5790 }
   5791 
   5792 /*
   5794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5795 %                                                                             %
   5796 %                                                                             %
   5797 %                                                                             %
   5798 %   M a g i c k G e t I m a g e U n i t s                                     %
   5799 %                                                                             %
   5800 %                                                                             %
   5801 %                                                                             %
   5802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5803 %
   5804 %  MagickGetImageUnits() gets the image units of resolution.
   5805 %
   5806 %  The format of the MagickGetImageUnits method is:
   5807 %
   5808 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
   5809 %
   5810 %  A description of each parameter follows:
   5811 %
   5812 %    o wand: the magick wand.
   5813 %
   5814 */
   5815 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
   5816 {
   5817   assert(wand != (MagickWand *) NULL);
   5818   assert(wand->signature == MagickWandSignature);
   5819   if (wand->debug != MagickFalse)
   5820     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5821   if (wand->images == (Image *) NULL)
   5822     {
   5823       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5824         "ContainsNoImages","`%s'",wand->name);
   5825       return(UndefinedResolution);
   5826     }
   5827   return(wand->images->units);
   5828 }
   5829 
   5830 /*
   5832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5833 %                                                                             %
   5834 %                                                                             %
   5835 %                                                                             %
   5836 %   M a g i c k G e t I m a g e V i r t u a l P i x e l M e t h o d           %
   5837 %                                                                             %
   5838 %                                                                             %
   5839 %                                                                             %
   5840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5841 %
   5842 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
   5843 %  sepcified image.
   5844 %
   5845 %  The format of the MagickGetImageVirtualPixelMethod method is:
   5846 %
   5847 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
   5848 %
   5849 %  A description of each parameter follows:
   5850 %
   5851 %    o wand: the magick wand.
   5852 %
   5853 */
   5854 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
   5855 {
   5856   assert(wand != (MagickWand *) NULL);
   5857   assert(wand->signature == MagickWandSignature);
   5858   if (wand->debug != MagickFalse)
   5859     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5860   if (wand->images == (Image *) NULL)
   5861     {
   5862       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5863         "ContainsNoImages","`%s'",wand->name);
   5864       return(UndefinedVirtualPixelMethod);
   5865     }
   5866   return(GetImageVirtualPixelMethod(wand->images));
   5867 }
   5868 
   5869 /*
   5871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5872 %                                                                             %
   5873 %                                                                             %
   5874 %                                                                             %
   5875 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
   5876 %                                                                             %
   5877 %                                                                             %
   5878 %                                                                             %
   5879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5880 %
   5881 %  MagickGetImageWhitePoint() returns the chromaticy white point.
   5882 %
   5883 %  The format of the MagickGetImageWhitePoint method is:
   5884 %
   5885 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
   5886 %        double *y,double *z)
   5887 %
   5888 %  A description of each parameter follows:
   5889 %
   5890 %    o wand: the magick wand.
   5891 %
   5892 %    o x: the chromaticity white x-point.
   5893 %
   5894 %    o y: the chromaticity white y-point.
   5895 %
   5896 %    o z: the chromaticity white z-point.
   5897 %
   5898 */
   5899 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
   5900   double *x,double *y,double *z)
   5901 {
   5902   assert(wand != (MagickWand *) NULL);
   5903   assert(wand->signature == MagickWandSignature);
   5904   if (wand->debug != MagickFalse)
   5905     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5906   if (wand->images == (Image *) NULL)
   5907     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5908   *x=wand->images->chromaticity.white_point.x;
   5909   *y=wand->images->chromaticity.white_point.y;
   5910   *z=wand->images->chromaticity.white_point.z;
   5911   return(MagickTrue);
   5912 }
   5913 
   5914 /*
   5916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5917 %                                                                             %
   5918 %                                                                             %
   5919 %                                                                             %
   5920 %   M a g i c k G e t I m a g e W i d t h                                     %
   5921 %                                                                             %
   5922 %                                                                             %
   5923 %                                                                             %
   5924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5925 %
   5926 %  MagickGetImageWidth() returns the image width.
   5927 %
   5928 %  The format of the MagickGetImageWidth method is:
   5929 %
   5930 %      size_t MagickGetImageWidth(MagickWand *wand)
   5931 %
   5932 %  A description of each parameter follows:
   5933 %
   5934 %    o wand: the magick wand.
   5935 %
   5936 */
   5937 WandExport size_t MagickGetImageWidth(MagickWand *wand)
   5938 {
   5939   assert(wand != (MagickWand *) NULL);
   5940   assert(wand->signature == MagickWandSignature);
   5941   if (wand->debug != MagickFalse)
   5942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5943   if (wand->images == (Image *) NULL)
   5944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5945   return(wand->images->columns);
   5946 }
   5947 
   5948 /*
   5950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5951 %                                                                             %
   5952 %                                                                             %
   5953 %                                                                             %
   5954 %   M a g i c k G e t N u m b e r I m a g e s                                 %
   5955 %                                                                             %
   5956 %                                                                             %
   5957 %                                                                             %
   5958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5959 %
   5960 %  MagickGetNumberImages() returns the number of images associated with a
   5961 %  magick wand.
   5962 %
   5963 %  The format of the MagickGetNumberImages method is:
   5964 %
   5965 %      size_t MagickGetNumberImages(MagickWand *wand)
   5966 %
   5967 %  A description of each parameter follows:
   5968 %
   5969 %    o wand: the magick wand.
   5970 %
   5971 */
   5972 WandExport size_t MagickGetNumberImages(MagickWand *wand)
   5973 {
   5974   assert(wand != (MagickWand *) NULL);
   5975   assert(wand->signature == MagickWandSignature);
   5976   if (wand->debug != MagickFalse)
   5977     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5978   return(GetImageListLength(wand->images));
   5979 }
   5980 
   5981 /*
   5983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5984 %                                                                             %
   5985 %                                                                             %
   5986 %                                                                             %
   5987 %   M a g i c k I m a g e G e t T o t a l I n k D e n s i t y                 %
   5988 %                                                                             %
   5989 %                                                                             %
   5990 %                                                                             %
   5991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5992 %
   5993 %  MagickGetImageTotalInkDensity() gets the image total ink density.
   5994 %
   5995 %  The format of the MagickGetImageTotalInkDensity method is:
   5996 %
   5997 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
   5998 %
   5999 %  A description of each parameter follows:
   6000 %
   6001 %    o wand: the magick wand.
   6002 %
   6003 */
   6004 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
   6005 {
   6006   assert(wand != (MagickWand *) NULL);
   6007   assert(wand->signature == MagickWandSignature);
   6008   if (wand->debug != MagickFalse)
   6009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6010   if (wand->images == (Image *) NULL)
   6011     {
   6012       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6013         "ContainsNoImages","`%s'",wand->name);
   6014       return(0.0);
   6015     }
   6016   return(GetImageTotalInkDensity(wand->images,wand->exception));
   6017 }
   6018 
   6019 /*
   6021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6022 %                                                                             %
   6023 %                                                                             %
   6024 %                                                                             %
   6025 %   M a g i c k H a l d C l u t I m a g e                                     %
   6026 %                                                                             %
   6027 %                                                                             %
   6028 %                                                                             %
   6029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6030 %
   6031 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
   6032 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
   6033 %  dimensions.  Create it with the HALD coder.  You can apply any color
   6034 %  transformation to the Hald image and then use this method to apply the
   6035 %  transform to the image.
   6036 %
   6037 %  The format of the MagickHaldClutImage method is:
   6038 %
   6039 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
   6040 %        const MagickWand *hald_wand)
   6041 %
   6042 %  A description of each parameter follows:
   6043 %
   6044 %    o wand: the magick wand.
   6045 %
   6046 %    o hald_image: the hald CLUT image.
   6047 %
   6048 */
   6049 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
   6050   const MagickWand *hald_wand)
   6051 {
   6052   MagickBooleanType
   6053     status;
   6054 
   6055   assert(wand != (MagickWand *) NULL);
   6056   assert(wand->signature == MagickWandSignature);
   6057   if (wand->debug != MagickFalse)
   6058     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6059   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
   6060     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6061   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
   6062   return(status);
   6063 }
   6064 
   6065 /*
   6067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6068 %                                                                             %
   6069 %                                                                             %
   6070 %                                                                             %
   6071 %   M a g i c k H a s N e x t I m a g e                                       %
   6072 %                                                                             %
   6073 %                                                                             %
   6074 %                                                                             %
   6075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6076 %
   6077 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
   6078 %  traversing the list in the forward direction
   6079 %
   6080 %  The format of the MagickHasNextImage method is:
   6081 %
   6082 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
   6083 %
   6084 %  A description of each parameter follows:
   6085 %
   6086 %    o wand: the magick wand.
   6087 %
   6088 */
   6089 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
   6090 {
   6091   assert(wand != (MagickWand *) NULL);
   6092   assert(wand->signature == MagickWandSignature);
   6093   if (wand->debug != MagickFalse)
   6094     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6095   if (wand->images == (Image *) NULL)
   6096     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6097   if (GetNextImageInList(wand->images) == (Image *) NULL)
   6098     return(MagickFalse);
   6099   return(MagickTrue);
   6100 }
   6101 
   6102 /*
   6104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6105 %                                                                             %
   6106 %                                                                             %
   6107 %                                                                             %
   6108 %   M a g i c k H a s P r e v i o u s I m a g e                               %
   6109 %                                                                             %
   6110 %                                                                             %
   6111 %                                                                             %
   6112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6113 %
   6114 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
   6115 %  traversing the list in the reverse direction
   6116 %
   6117 %  The format of the MagickHasPreviousImage method is:
   6118 %
   6119 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
   6120 %
   6121 %  A description of each parameter follows:
   6122 %
   6123 %    o wand: the magick wand.
   6124 %
   6125 */
   6126 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
   6127 {
   6128   assert(wand != (MagickWand *) NULL);
   6129   assert(wand->signature == MagickWandSignature);
   6130   if (wand->debug != MagickFalse)
   6131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6132   if (wand->images == (Image *) NULL)
   6133     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6134   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
   6135     return(MagickFalse);
   6136   return(MagickTrue);
   6137 }
   6138 
   6139 /*
   6141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6142 %                                                                             %
   6143 %                                                                             %
   6144 %                                                                             %
   6145 %   M a g i c k I d e n t i f y I m a g e                                     %
   6146 %                                                                             %
   6147 %                                                                             %
   6148 %                                                                             %
   6149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6150 %
   6151 %  MagickIdentifyImage() identifies an image by printing its attributes to the
   6152 %  file.  Attributes include the image width, height, size, and others.
   6153 %
   6154 %  The format of the MagickIdentifyImage method is:
   6155 %
   6156 %      const char *MagickIdentifyImage(MagickWand *wand)
   6157 %
   6158 %  A description of each parameter follows:
   6159 %
   6160 %    o wand: the magick wand.
   6161 %
   6162 */
   6163 WandExport char *MagickIdentifyImage(MagickWand *wand)
   6164 {
   6165   char
   6166     *description,
   6167     filename[MagickPathExtent];
   6168 
   6169   FILE
   6170     *file;
   6171 
   6172   int
   6173     unique_file;
   6174 
   6175   assert(wand != (MagickWand *) NULL);
   6176   assert(wand->signature == MagickWandSignature);
   6177   if (wand->debug != MagickFalse)
   6178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6179   if (wand->images == (Image *) NULL)
   6180     {
   6181       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6182         "ContainsNoImages","`%s'",wand->name);
   6183       return((char *) NULL);
   6184     }
   6185   description=(char *) NULL;
   6186   unique_file=AcquireUniqueFileResource(filename);
   6187   file=(FILE *) NULL;
   6188   if (unique_file != -1)
   6189     file=fdopen(unique_file,"wb");
   6190   if ((unique_file == -1) || (file == (FILE *) NULL))
   6191     {
   6192       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6193         "UnableToCreateTemporaryFile","`%s'",wand->name);
   6194       return((char *) NULL);
   6195     }
   6196   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
   6197   (void) fclose(file);
   6198   description=FileToString(filename,~0UL,wand->exception);
   6199   (void) RelinquishUniqueFileResource(filename);
   6200   return(description);
   6201 }
   6202 
   6203 /*
   6204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6205 %                                                                             %
   6206 %                                                                             %
   6207 %                                                                             %
   6208 %   M a g i c k I d e n t i f y I m a g e T y p e                             %
   6209 %                                                                             %
   6210 %                                                                             %
   6211 %                                                                             %
   6212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6213 %
   6214 %  MagickIdentifyImageType() gets the potential image type:
   6215 %
   6216 %        Bilevel        Grayscale       GrayscaleMatte
   6217 %        Palette        PaletteMatte    TrueColor
   6218 %        TrueColorMatte ColorSeparation ColorSeparationMatte
   6219 %
   6220 %  To ensure the image type matches its potential, use MagickSetImageType():
   6221 %
   6222 %    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
   6223 %
   6224 %  The format of the MagickIdentifyImageType method is:
   6225 %
   6226 %      ImageType MagickIdentifyImageType(MagickWand *wand)
   6227 %
   6228 %  A description of each parameter follows:
   6229 %
   6230 %    o wand: the magick wand.
   6231 %
   6232 */
   6233 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
   6234 {
   6235   assert(wand != (MagickWand *) NULL);
   6236   assert(wand->signature == MagickWandSignature);
   6237   if (wand->debug != MagickFalse)
   6238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6239   if (wand->images == (Image *) NULL)
   6240     {
   6241       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6242         "ContainsNoImages","`%s'",wand->name);
   6243       return(UndefinedType);
   6244     }
   6245   return(IdentifyImageType(wand->images,wand->exception));
   6246 }
   6247 
   6248 /*
   6249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6250 %                                                                             %
   6251 %                                                                             %
   6252 %                                                                             %
   6253 %   M a g i c k I m p l o d e I m a g e                                       %
   6254 %                                                                             %
   6255 %                                                                             %
   6256 %                                                                             %
   6257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6258 %
   6259 %  MagickImplodeImage() creates a new image that is a copy of an existing
   6260 %  one with the image pixels "implode" by the specified percentage.  It
   6261 %  allocates the memory necessary for the new Image structure and returns a
   6262 %  pointer to the new image.
   6263 %
   6264 %  The format of the MagickImplodeImage method is:
   6265 %
   6266 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
   6267 %        const double radius,const PixelInterpolateMethod method)
   6268 %
   6269 %  A description of each parameter follows:
   6270 %
   6271 %    o wand: the magick wand.
   6272 %
   6273 %    o amount: Define the extent of the implosion.
   6274 %
   6275 %    o method: the pixel interpolation method.
   6276 %
   6277 */
   6278 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
   6279   const double amount,const PixelInterpolateMethod method)
   6280 {
   6281   Image
   6282     *implode_image;
   6283 
   6284   assert(wand != (MagickWand *) NULL);
   6285   assert(wand->signature == MagickWandSignature);
   6286   if (wand->debug != MagickFalse)
   6287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6288   if (wand->images == (Image *) NULL)
   6289     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6290   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
   6291   if (implode_image == (Image *) NULL)
   6292     return(MagickFalse);
   6293   ReplaceImageInList(&wand->images,implode_image);
   6294   return(MagickTrue);
   6295 }
   6296 
   6297 /*
   6299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6300 %                                                                             %
   6301 %                                                                             %
   6302 %                                                                             %
   6303 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
   6304 %                                                                             %
   6305 %                                                                             %
   6306 %                                                                             %
   6307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6308 %
   6309 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
   6310 %  location you specify.  The method returns MagickFalse on success otherwise
   6311 %  MagickTrue if an error is encountered.  The pixel data can be either char,
   6312 %  short int, int, ssize_t, float, or double in the order specified by map.
   6313 %
   6314 %  Suppose your want to upload the first scanline of a 640x480 image from
   6315 %  character data in red-green-blue order:
   6316 %
   6317 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
   6318 %
   6319 %  The format of the MagickImportImagePixels method is:
   6320 %
   6321 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
   6322 %        const ssize_t x,const ssize_t y,const size_t columns,
   6323 %        const size_t rows,const char *map,const StorageType storage,
   6324 %        const void *pixels)
   6325 %
   6326 %  A description of each parameter follows:
   6327 %
   6328 %    o wand: the magick wand.
   6329 %
   6330 %    o x, y, columns, rows:  These values define the perimeter of a region
   6331 %      of pixels you want to define.
   6332 %
   6333 %    o map:  This string reflects the expected ordering of the pixel array.
   6334 %      It can be any combination or order of R = red, G = green, B = blue,
   6335 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   6336 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   6337 %      P = pad.
   6338 %
   6339 %    o storage: Define the data type of the pixels.  Float and double types are
   6340 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   6341 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
   6342 %      or DoublePixel.
   6343 %
   6344 %    o pixels: This array of values contain the pixel components as defined by
   6345 %      map and type.  You must preallocate this array where the expected
   6346 %      length varies depending on the values of width, height, map, and type.
   6347 %
   6348 */
   6349 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
   6350   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
   6351   const char *map,const StorageType storage,const void *pixels)
   6352 {
   6353   MagickBooleanType
   6354     status;
   6355 
   6356   assert(wand != (MagickWand *) NULL);
   6357   assert(wand->signature == MagickWandSignature);
   6358   if (wand->debug != MagickFalse)
   6359     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6360   if (wand->images == (Image *) NULL)
   6361     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6362   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
   6363     wand->exception);
   6364   return(status);
   6365 }
   6366 
   6367 /*
   6369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6370 %                                                                             %
   6371 %                                                                             %
   6372 %                                                                             %
   6373 %   M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e               %
   6374 %                                                                             %
   6375 %                                                                             %
   6376 %                                                                             %
   6377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6378 %
   6379 %  MagickInterpolativeResizeImage() resize image using a interpolative
   6380 %  method.
   6381 %
   6382 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
   6383 %        const size_t columns,const size_t rows,
   6384 %        const PixelInterpolateMethod method)
   6385 %
   6386 %  A description of each parameter follows:
   6387 %
   6388 %    o wand: the magick wand.
   6389 %
   6390 %    o columns: the number of columns in the scaled image.
   6391 %
   6392 %    o rows: the number of rows in the scaled image.
   6393 %
   6394 %    o interpolate: the pixel interpolation method.
   6395 %
   6396 */
   6397 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
   6398   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
   6399 {
   6400   Image
   6401     *resize_image;
   6402 
   6403   assert(wand != (MagickWand *) NULL);
   6404   assert(wand->signature == MagickWandSignature);
   6405   if (wand->debug != MagickFalse)
   6406     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6407   if (wand->images == (Image *) NULL)
   6408     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6409   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
   6410     wand->exception);
   6411   if (resize_image == (Image *) NULL)
   6412     return(MagickFalse);
   6413   ReplaceImageInList(&wand->images,resize_image);
   6414   return(MagickTrue);
   6415 }
   6416 
   6417 /*
   6419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6420 %                                                                             %
   6421 %                                                                             %
   6422 %                                                                             %
   6423 %   M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e       %
   6424 %                                                                             %
   6425 %                                                                             %
   6426 %                                                                             %
   6427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6428 %
   6429 %  MagickInverseFourierTransformImage() implements the inverse discrete
   6430 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
   6431 %  imaginary image pair.
   6432 %
   6433 %  The format of the MagickInverseFourierTransformImage method is:
   6434 %
   6435 %      MagickBooleanType MagickInverseFourierTransformImage(
   6436 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
   6437 %        const MagickBooleanType magnitude)
   6438 %
   6439 %  A description of each parameter follows:
   6440 %
   6441 %    o magnitude_wand: the magnitude or real wand.
   6442 %
   6443 %    o phase_wand: the phase or imaginary wand.
   6444 %
   6445 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
   6446 %      imaginary image pair.
   6447 %
   6448 */
   6449 WandExport MagickBooleanType MagickInverseFourierTransformImage(
   6450   MagickWand *magnitude_wand,MagickWand *phase_wand,
   6451   const MagickBooleanType magnitude)
   6452 {
   6453   Image
   6454     *inverse_image;
   6455 
   6456   MagickWand
   6457     *wand;
   6458 
   6459   assert(magnitude_wand != (MagickWand *) NULL);
   6460   assert(magnitude_wand->signature == MagickWandSignature);
   6461   if (magnitude_wand->debug != MagickFalse)
   6462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
   6463       magnitude_wand->name);
   6464   wand=magnitude_wand;
   6465   if (magnitude_wand->images == (Image *) NULL)
   6466     ThrowWandException(WandError,"ContainsNoImages",
   6467       magnitude_wand->name);
   6468   assert(phase_wand != (MagickWand *) NULL);
   6469   assert(phase_wand->signature == MagickWandSignature);
   6470   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
   6471     phase_wand->images,magnitude,wand->exception);
   6472   if (inverse_image == (Image *) NULL)
   6473     return(MagickFalse);
   6474   ReplaceImageInList(&wand->images,inverse_image);
   6475   return(MagickTrue);
   6476 }
   6477 
   6478 /*
   6480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6481 %                                                                             %
   6482 %                                                                             %
   6483 %                                                                             %
   6484 %   M a g i c k L a b e l I m a g e                                           %
   6485 %                                                                             %
   6486 %                                                                             %
   6487 %                                                                             %
   6488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6489 %
   6490 %  MagickLabelImage() adds a label to your image.
   6491 %
   6492 %  The format of the MagickLabelImage method is:
   6493 %
   6494 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
   6495 %
   6496 %  A description of each parameter follows:
   6497 %
   6498 %    o wand: the magick wand.
   6499 %
   6500 %    o label: the image label.
   6501 %
   6502 */
   6503 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
   6504   const char *label)
   6505 {
   6506   MagickBooleanType
   6507     status;
   6508 
   6509   assert(wand != (MagickWand *) NULL);
   6510   assert(wand->signature == MagickWandSignature);
   6511   if (wand->debug != MagickFalse)
   6512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6513   if (wand->images == (Image *) NULL)
   6514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6515   status=SetImageProperty(wand->images,"label",label,wand->exception);
   6516   return(status);
   6517 }
   6518 
   6519 /*
   6521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6522 %                                                                             %
   6523 %                                                                             %
   6524 %                                                                             %
   6525 %   M a g i c k L e v e l I m a g e                                           %
   6526 %                                                                             %
   6527 %                                                                             %
   6528 %                                                                             %
   6529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6530 %
   6531 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
   6532 %  falling between specified white and black points to the full available
   6533 %  quantum range. The parameters provided represent the black, mid, and white
   6534 %  points. The black point specifies the darkest color in the image. Colors
   6535 %  darker than the black point are set to zero. Mid point specifies a gamma
   6536 %  correction to apply to the image.  White point specifies the lightest color
   6537 %  in the image. Colors brighter than the white point are set to the maximum
   6538 %  quantum value.
   6539 %
   6540 %  The format of the MagickLevelImage method is:
   6541 %
   6542 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
   6543 %        const double black_point,const double gamma,const double white_point)
   6544 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
   6545 %        const ChannelType channel,const double black_point,const double gamma,
   6546 %        const double white_point)
   6547 %
   6548 %  A description of each parameter follows:
   6549 %
   6550 %    o wand: the magick wand.
   6551 %
   6552 %    o channel: Identify which channel to level: RedPixelChannel,
   6553 %      GreenPixelChannel, etc.
   6554 %
   6555 %    o black_point: the black point.
   6556 %
   6557 %    o gamma: the gamma.
   6558 %
   6559 %    o white_point: the white point.
   6560 %
   6561 */
   6562 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
   6563   const double black_point,const double gamma,const double white_point)
   6564 {
   6565   MagickBooleanType
   6566     status;
   6567 
   6568   assert(wand != (MagickWand *) NULL);
   6569   assert(wand->signature == MagickWandSignature);
   6570   if (wand->debug != MagickFalse)
   6571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6572   if (wand->images == (Image *) NULL)
   6573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6574   status=LevelImage(wand->images,black_point,white_point,gamma,
   6575     wand->exception);
   6576   return(status);
   6577 }
   6578 
   6579 /*
   6581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6582 %                                                                             %
   6583 %                                                                             %
   6584 %                                                                             %
   6585 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
   6586 %                                                                             %
   6587 %                                                                             %
   6588 %                                                                             %
   6589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6590 %
   6591 %  MagickLinearStretchImage() stretches with saturation the image intensity.
   6592 %
   6593 %  You can also reduce the influence of a particular channel with a gamma
   6594 %  value of 0.
   6595 %
   6596 %  The format of the MagickLinearStretchImage method is:
   6597 %
   6598 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
   6599 %        const double black_point,const double white_point)
   6600 %
   6601 %  A description of each parameter follows:
   6602 %
   6603 %    o wand: the magick wand.
   6604 %
   6605 %    o black_point: the black point.
   6606 %
   6607 %    o white_point: the white point.
   6608 %
   6609 */
   6610 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
   6611   const double black_point,const double white_point)
   6612 {
   6613   MagickBooleanType
   6614     status;
   6615 
   6616   assert(wand != (MagickWand *) NULL);
   6617   assert(wand->signature == MagickWandSignature);
   6618   if (wand->debug != MagickFalse)
   6619     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6620   if (wand->images == (Image *) NULL)
   6621     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6622   status=LinearStretchImage(wand->images,black_point,white_point,
   6623     wand->exception);
   6624   return(status);
   6625 }
   6626 
   6627 /*
   6629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6630 %                                                                             %
   6631 %                                                                             %
   6632 %                                                                             %
   6633 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
   6634 %                                                                             %
   6635 %                                                                             %
   6636 %                                                                             %
   6637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6638 %
   6639 %  MagickLiquidRescaleImage() rescales image with seam carving.
   6640 %
   6641 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
   6642 %        const size_t columns,const size_t rows,
   6643 %        const double delta_x,const double rigidity)
   6644 %
   6645 %  A description of each parameter follows:
   6646 %
   6647 %    o wand: the magick wand.
   6648 %
   6649 %    o columns: the number of columns in the scaled image.
   6650 %
   6651 %    o rows: the number of rows in the scaled image.
   6652 %
   6653 %    o delta_x: maximum seam transversal step (0 means straight seams).
   6654 %
   6655 %    o rigidity: introduce a bias for non-straight seams (typically 0).
   6656 %
   6657 */
   6658 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
   6659   const size_t columns,const size_t rows,const double delta_x,
   6660   const double rigidity)
   6661 {
   6662   Image
   6663     *rescale_image;
   6664 
   6665   assert(wand != (MagickWand *) NULL);
   6666   assert(wand->signature == MagickWandSignature);
   6667   if (wand->debug != MagickFalse)
   6668     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6669   if (wand->images == (Image *) NULL)
   6670     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6671   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
   6672     rigidity,wand->exception);
   6673   if (rescale_image == (Image *) NULL)
   6674     return(MagickFalse);
   6675   ReplaceImageInList(&wand->images,rescale_image);
   6676   return(MagickTrue);
   6677 }
   6678 
   6679 /*
   6680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6681 %                                                                             %
   6682 %                                                                             %
   6683 %                                                                             %
   6684 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
   6685 %                                                                             %
   6686 %                                                                             %
   6687 %                                                                             %
   6688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6689 %
   6690 %  MagickLocalContrastImage() attempts to increase the appearance of
   6691 %  large-scale light-dark transitions. Local contrast enhancement works
   6692 %  similarly to sharpening with an unsharp mask, however the mask is instead
   6693 %  created using an image with a greater blur distance.
   6694 %
   6695 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
   6696 %        const double radius,const double strength)
   6697 %
   6698 %  A description of each parameter follows:
   6699 %
   6700 %    o image: the image.
   6701 %
   6702 %    o radius: the radius of the Gaussian, in pixels, not counting
   6703 %      the center pixel.
   6704 %
   6705 %    o strength: the strength of the blur mask in percentage.
   6706 %
   6707 */
   6708 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
   6709   const double radius, const double strength)
   6710 {
   6711   Image
   6712     *contrast_image;
   6713 
   6714   assert(wand != (MagickWand *)NULL);
   6715   assert(wand->signature == MagickWandSignature);
   6716   if (wand->debug != MagickFalse)
   6717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
   6718   if (wand->images == (Image *)NULL)
   6719     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6720   contrast_image=LocalContrastImage(wand->images,radius,strength,
   6721     wand->exception);
   6722   if (contrast_image == (Image *)NULL)
   6723     return(MagickFalse);
   6724   ReplaceImageInList(&wand->images,contrast_image);
   6725   return(MagickTrue);
   6726 }
   6727 
   6728 /*
   6730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6731 %                                                                             %
   6732 %                                                                             %
   6733 %                                                                             %
   6734 %   M a g i c k M a g n i f y I m a g e                                       %
   6735 %                                                                             %
   6736 %                                                                             %
   6737 %                                                                             %
   6738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6739 %
   6740 %  MagickMagnifyImage() is a convenience method that scales an image
   6741 %  proportionally to twice its original size.
   6742 %
   6743 %  The format of the MagickMagnifyImage method is:
   6744 %
   6745 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
   6746 %
   6747 %  A description of each parameter follows:
   6748 %
   6749 %    o wand: the magick wand.
   6750 %
   6751 */
   6752 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
   6753 {
   6754   Image
   6755     *magnify_image;
   6756 
   6757   assert(wand != (MagickWand *) NULL);
   6758   assert(wand->signature == MagickWandSignature);
   6759   if (wand->debug != MagickFalse)
   6760     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6761   if (wand->images == (Image *) NULL)
   6762     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6763   magnify_image=MagnifyImage(wand->images,wand->exception);
   6764   if (magnify_image == (Image *) NULL)
   6765     return(MagickFalse);
   6766   ReplaceImageInList(&wand->images,magnify_image);
   6767   return(MagickTrue);
   6768 }
   6769 
   6770 /*
   6772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6773 %                                                                             %
   6774 %                                                                             %
   6775 %                                                                             %
   6776 %   M a g i c k M e r g e I m a g e L a y e r s                               %
   6777 %                                                                             %
   6778 %                                                                             %
   6779 %                                                                             %
   6780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6781 %
   6782 %  MagickMergeImageLayers() composes all the image layers from the current
   6783 %  given image onward to produce a single image of the merged layers.
   6784 %
   6785 %  The inital canvas's size depends on the given LayerMethod, and is
   6786 %  initialized using the first images background color.  The images
   6787 %  are then compositied onto that image in sequence using the given
   6788 %  composition that has been assigned to each individual image.
   6789 %
   6790 %  The format of the MagickMergeImageLayers method is:
   6791 %
   6792 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
   6793 %        const LayerMethod method)
   6794 %
   6795 %  A description of each parameter follows:
   6796 %
   6797 %    o wand: the magick wand.
   6798 %
   6799 %    o method: the method of selecting the size of the initial canvas.
   6800 %
   6801 %        MergeLayer: Merge all layers onto a canvas just large enough
   6802 %           to hold all the actual images. The virtual canvas of the
   6803 %           first image is preserved but otherwise ignored.
   6804 %
   6805 %        FlattenLayer: Use the virtual canvas size of first image.
   6806 %           Images which fall outside this canvas is clipped.
   6807 %           This can be used to 'fill out' a given virtual canvas.
   6808 %
   6809 %        MosaicLayer: Start with the virtual canvas of the first image,
   6810 %           enlarging left and right edges to contain all images.
   6811 %           Images with negative offsets will be clipped.
   6812 %
   6813 */
   6814 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
   6815   const LayerMethod method)
   6816 {
   6817   Image
   6818     *mosaic_image;
   6819 
   6820   assert(wand != (MagickWand *) NULL);
   6821   assert(wand->signature == MagickWandSignature);
   6822   if (wand->debug != MagickFalse)
   6823     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6824   if (wand->images == (Image *) NULL)
   6825     return((MagickWand *) NULL);
   6826   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
   6827   if (mosaic_image == (Image *) NULL)
   6828     return((MagickWand *) NULL);
   6829   return(CloneMagickWandFromImages(wand,mosaic_image));
   6830 }
   6831 
   6832 /*
   6834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6835 %                                                                             %
   6836 %                                                                             %
   6837 %                                                                             %
   6838 %   M a g i c k M i n i f y I m a g e                                         %
   6839 %                                                                             %
   6840 %                                                                             %
   6841 %                                                                             %
   6842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6843 %
   6844 %  MagickMinifyImage() is a convenience method that scales an image
   6845 %  proportionally to one-half its original size
   6846 %
   6847 %  The format of the MagickMinifyImage method is:
   6848 %
   6849 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
   6850 %
   6851 %  A description of each parameter follows:
   6852 %
   6853 %    o wand: the magick wand.
   6854 %
   6855 */
   6856 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
   6857 {
   6858   Image
   6859     *minify_image;
   6860 
   6861   assert(wand != (MagickWand *) NULL);
   6862   assert(wand->signature == MagickWandSignature);
   6863   if (wand->debug != MagickFalse)
   6864     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6865   if (wand->images == (Image *) NULL)
   6866     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6867   minify_image=MinifyImage(wand->images,wand->exception);
   6868   if (minify_image == (Image *) NULL)
   6869     return(MagickFalse);
   6870   ReplaceImageInList(&wand->images,minify_image);
   6871   return(MagickTrue);
   6872 }
   6873 
   6874 /*
   6876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6877 %                                                                             %
   6878 %                                                                             %
   6879 %                                                                             %
   6880 %   M a g i c k M o d u l a t e I m a g e                                     %
   6881 %                                                                             %
   6882 %                                                                             %
   6883 %                                                                             %
   6884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6885 %
   6886 %  MagickModulateImage() lets you control the brightness, saturation, and hue
   6887 %  of an image.  Hue is the percentage of absolute rotation from the current
   6888 %  position.  For example 50 results in a counter-clockwise rotation of 90
   6889 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
   6890 %  both resulting in a rotation of 180 degrees.
   6891 %
   6892 %  To increase the color brightness by 20% and decrease the color saturation by
   6893 %  10% and leave the hue unchanged, use: 120,90,100.
   6894 %
   6895 %  The format of the MagickModulateImage method is:
   6896 %
   6897 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
   6898 %        const double brightness,const double saturation,const double hue)
   6899 %
   6900 %  A description of each parameter follows:
   6901 %
   6902 %    o wand: the magick wand.
   6903 %
   6904 %    o brightness: the percent change in brighness.
   6905 %
   6906 %    o saturation: the percent change in saturation.
   6907 %
   6908 %    o hue: the percent change in hue.
   6909 %
   6910 */
   6911 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
   6912   const double brightness,const double saturation,const double hue)
   6913 {
   6914   char
   6915     modulate[MagickPathExtent];
   6916 
   6917   MagickBooleanType
   6918     status;
   6919 
   6920   assert(wand != (MagickWand *) NULL);
   6921   assert(wand->signature == MagickWandSignature);
   6922   if (wand->debug != MagickFalse)
   6923     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6924   if (wand->images == (Image *) NULL)
   6925     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6926   (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
   6927     brightness,saturation,hue);
   6928   status=ModulateImage(wand->images,modulate,wand->exception);
   6929   return(status);
   6930 }
   6931 
   6932 /*
   6934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6935 %                                                                             %
   6936 %                                                                             %
   6937 %                                                                             %
   6938 %   M a g i c k M o n t a g e I m a g e                                       %
   6939 %                                                                             %
   6940 %                                                                             %
   6941 %                                                                             %
   6942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6943 %
   6944 %  MagickMontageImage() creates a composite image by combining several
   6945 %  separate images. The images are tiled on the composite image with the name
   6946 %  of the image optionally appearing just below the individual tile.
   6947 %
   6948 %  The format of the MagickMontageImage method is:
   6949 %
   6950 %      MagickWand *MagickMontageImage(MagickWand *wand,
   6951 %        const DrawingWand drawing_wand,const char *tile_geometry,
   6952 %        const char *thumbnail_geometry,const MontageMode mode,
   6953 %        const char *frame)
   6954 %
   6955 %  A description of each parameter follows:
   6956 %
   6957 %    o wand: the magick wand.
   6958 %
   6959 %    o drawing_wand: the drawing wand.  The font name, size, and color are
   6960 %      obtained from this wand.
   6961 %
   6962 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
   6963 %
   6964 %    o thumbnail_geometry: Preferred image size and border size of each
   6965 %      thumbnail (e.g. 120x120+4+3>).
   6966 %
   6967 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
   6968 %
   6969 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
   6970 %      The frame color is that of the thumbnail's matte color.
   6971 %
   6972 */
   6973 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
   6974   const DrawingWand *drawing_wand,const char *tile_geometry,
   6975   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
   6976 {
   6977   char
   6978     *font;
   6979 
   6980   Image
   6981     *montage_image;
   6982 
   6983   MontageInfo
   6984     *montage_info;
   6985 
   6986   PixelWand
   6987     *pixel_wand;
   6988 
   6989   assert(wand != (MagickWand *) NULL);
   6990   assert(wand->signature == MagickWandSignature);
   6991   if (wand->debug != MagickFalse)
   6992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6993   if (wand->images == (Image *) NULL)
   6994     return((MagickWand *) NULL);
   6995   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
   6996   switch (mode)
   6997   {
   6998     case FrameMode:
   6999     {
   7000       (void) CloneString(&montage_info->frame,"15x15+3+3");
   7001       montage_info->shadow=MagickTrue;
   7002       break;
   7003     }
   7004     case UnframeMode:
   7005     {
   7006       montage_info->frame=(char *) NULL;
   7007       montage_info->shadow=MagickFalse;
   7008       montage_info->border_width=0;
   7009       break;
   7010     }
   7011     case ConcatenateMode:
   7012     {
   7013       montage_info->frame=(char *) NULL;
   7014       montage_info->shadow=MagickFalse;
   7015       (void) CloneString(&montage_info->geometry,"+0+0");
   7016       montage_info->border_width=0;
   7017       break;
   7018     }
   7019     default:
   7020       break;
   7021   }
   7022   font=DrawGetFont(drawing_wand);
   7023   if (font != (char *) NULL)
   7024     (void) CloneString(&montage_info->font,font);
   7025   if (frame != (char *) NULL)
   7026     (void) CloneString(&montage_info->frame,frame);
   7027   montage_info->pointsize=DrawGetFontSize(drawing_wand);
   7028   pixel_wand=NewPixelWand();
   7029   DrawGetFillColor(drawing_wand,pixel_wand);
   7030   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
   7031   DrawGetStrokeColor(drawing_wand,pixel_wand);
   7032   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
   7033   pixel_wand=DestroyPixelWand(pixel_wand);
   7034   if (thumbnail_geometry != (char *) NULL)
   7035     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
   7036   if (tile_geometry != (char *) NULL)
   7037     (void) CloneString(&montage_info->tile,tile_geometry);
   7038   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
   7039     wand->exception);
   7040   montage_info=DestroyMontageInfo(montage_info);
   7041   if (montage_image == (Image *) NULL)
   7042     return((MagickWand *) NULL);
   7043   return(CloneMagickWandFromImages(wand,montage_image));
   7044 }
   7045 
   7046 /*
   7048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7049 %                                                                             %
   7050 %                                                                             %
   7051 %                                                                             %
   7052 %   M a g i c k M o r p h I m a g e s                                         %
   7053 %                                                                             %
   7054 %                                                                             %
   7055 %                                                                             %
   7056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7057 %
   7058 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
   7059 %  and size are linearly interpolated to give the appearance of a
   7060 %  meta-morphosis from one image to the next.
   7061 %
   7062 %  The format of the MagickMorphImages method is:
   7063 %
   7064 %      MagickWand *MagickMorphImages(MagickWand *wand,
   7065 %        const size_t number_frames)
   7066 %
   7067 %  A description of each parameter follows:
   7068 %
   7069 %    o wand: the magick wand.
   7070 %
   7071 %    o number_frames: the number of in-between images to generate.
   7072 %
   7073 */
   7074 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
   7075   const size_t number_frames)
   7076 {
   7077   Image
   7078     *morph_image;
   7079 
   7080   assert(wand != (MagickWand *) NULL);
   7081   assert(wand->signature == MagickWandSignature);
   7082   if (wand->debug != MagickFalse)
   7083     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7084   if (wand->images == (Image *) NULL)
   7085     return((MagickWand *) NULL);
   7086   morph_image=MorphImages(wand->images,number_frames,wand->exception);
   7087   if (morph_image == (Image *) NULL)
   7088     return((MagickWand *) NULL);
   7089   return(CloneMagickWandFromImages(wand,morph_image));
   7090 }
   7091 
   7092 /*
   7094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7095 %                                                                             %
   7096 %                                                                             %
   7097 %                                                                             %
   7098 %   M a g i c k M o r p h o l o g y I m a g e                                 %
   7099 %                                                                             %
   7100 %                                                                             %
   7101 %                                                                             %
   7102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7103 %
   7104 %  MagickMorphologyImage() applies a user supplied kernel to the image
   7105 %  according to the given mophology method.
   7106 %
   7107 %  The format of the MagickMorphologyImage method is:
   7108 %
   7109 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
   7110 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
   7111 %
   7112 %  A description of each parameter follows:
   7113 %
   7114 %    o wand: the magick wand.
   7115 %
   7116 %    o method: the morphology method to be applied.
   7117 %
   7118 %    o iterations: apply the operation this many times (or no change).
   7119 %      A value of -1 means loop until no change found.  How this is applied
   7120 %      may depend on the morphology method.  Typically this is a value of 1.
   7121 %
   7122 %    o kernel: An array of doubles representing the morphology kernel.
   7123 %
   7124 */
   7125 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
   7126   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
   7127 {
   7128   Image
   7129     *morphology_image;
   7130 
   7131   assert(wand != (MagickWand *) NULL);
   7132   assert(wand->signature == MagickWandSignature);
   7133   if (wand->debug != MagickFalse)
   7134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7135   if (kernel == (const KernelInfo *) NULL)
   7136     return(MagickFalse);
   7137   if (wand->images == (Image *) NULL)
   7138     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7139   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
   7140     wand->exception);
   7141   if (morphology_image == (Image *) NULL)
   7142     return(MagickFalse);
   7143   ReplaceImageInList(&wand->images,morphology_image);
   7144   return(MagickTrue);
   7145 }
   7146 
   7147 /*
   7149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7150 %                                                                             %
   7151 %                                                                             %
   7152 %                                                                             %
   7153 %   M a g i c k M o t i o n B l u r I m a g e                                 %
   7154 %                                                                             %
   7155 %                                                                             %
   7156 %                                                                             %
   7157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7158 %
   7159 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
   7160 %  Gaussian operator of the given radius and standard deviation (sigma).
   7161 %  For reasonable results, radius should be larger than sigma.  Use a
   7162 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
   7163 %  Angle gives the angle of the blurring motion.
   7164 %
   7165 %  The format of the MagickMotionBlurImage method is:
   7166 %
   7167 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
   7168 %        const double radius,const double sigma,const double angle)
   7169 %
   7170 %  A description of each parameter follows:
   7171 %
   7172 %    o wand: the magick wand.
   7173 %
   7174 %    o radius: the radius of the Gaussian, in pixels, not counting
   7175 %      the center pixel.
   7176 %
   7177 %    o sigma: the standard deviation of the Gaussian, in pixels.
   7178 %
   7179 %    o angle: Apply the effect along this angle.
   7180 %
   7181 */
   7182 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
   7183   const double radius,const double sigma,const double angle)
   7184 {
   7185   Image
   7186     *blur_image;
   7187 
   7188   assert(wand != (MagickWand *) NULL);
   7189   assert(wand->signature == MagickWandSignature);
   7190   if (wand->debug != MagickFalse)
   7191     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7192   if (wand->images == (Image *) NULL)
   7193     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7194   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
   7195   if (blur_image == (Image *) NULL)
   7196     return(MagickFalse);
   7197   ReplaceImageInList(&wand->images,blur_image);
   7198   return(MagickTrue);
   7199 }
   7200 
   7201 /*
   7203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7204 %                                                                             %
   7205 %                                                                             %
   7206 %                                                                             %
   7207 %   M a g i c k N e g a t e I m a g e                                         %
   7208 %                                                                             %
   7209 %                                                                             %
   7210 %                                                                             %
   7211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7212 %
   7213 %  MagickNegateImage() negates the colors in the reference image.  The
   7214 %  Grayscale option means that only grayscale values within the image are
   7215 %  negated.
   7216 %
   7217 %  You can also reduce the influence of a particular channel with a gamma
   7218 %  value of 0.
   7219 %
   7220 %  The format of the MagickNegateImage method is:
   7221 %
   7222 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
   7223 %        const MagickBooleanType gray)
   7224 %
   7225 %  A description of each parameter follows:
   7226 %
   7227 %    o wand: the magick wand.
   7228 %
   7229 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
   7230 %
   7231 */
   7232 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
   7233   const MagickBooleanType gray)
   7234 {
   7235   MagickBooleanType
   7236     status;
   7237 
   7238   assert(wand != (MagickWand *) NULL);
   7239   assert(wand->signature == MagickWandSignature);
   7240   if (wand->debug != MagickFalse)
   7241     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7242   if (wand->images == (Image *) NULL)
   7243     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7244   status=NegateImage(wand->images,gray,wand->exception);
   7245   return(status);
   7246 }
   7247 
   7248 /*
   7250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7251 %                                                                             %
   7252 %                                                                             %
   7253 %                                                                             %
   7254 %   M a g i c k N e w I m a g e                                               %
   7255 %                                                                             %
   7256 %                                                                             %
   7257 %                                                                             %
   7258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7259 %
   7260 %  MagickNewImage() adds a blank image canvas of the specified size and
   7261 %  background color to the wand.
   7262 %
   7263 %  The format of the MagickNewImage method is:
   7264 %
   7265 %      MagickBooleanType MagickNewImage(MagickWand *wand,
   7266 %        const size_t columns,const size_t rows,
   7267 %        const PixelWand *background)
   7268 %
   7269 %  A description of each parameter follows:
   7270 %
   7271 %    o wand: the magick wand.
   7272 %
   7273 %    o width: the image width.
   7274 %
   7275 %    o height: the image height.
   7276 %
   7277 %    o background: the image color.
   7278 %
   7279 */
   7280 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
   7281   const size_t height,const PixelWand *background)
   7282 {
   7283   Image
   7284     *images;
   7285 
   7286   PixelInfo
   7287     pixel;
   7288 
   7289   assert(wand != (MagickWand *) NULL);
   7290   assert(wand->signature == MagickWandSignature);
   7291   if (wand->debug != MagickFalse)
   7292     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7293   PixelGetMagickColor(background,&pixel);
   7294   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
   7295   if (images == (Image *) NULL)
   7296     return(MagickFalse);
   7297   return(InsertImageInWand(wand,images));
   7298 }
   7299 
   7300 /*
   7302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7303 %                                                                             %
   7304 %                                                                             %
   7305 %                                                                             %
   7306 %   M a g i c k N e x t I m a g e                                             %
   7307 %                                                                             %
   7308 %                                                                             %
   7309 %                                                                             %
   7310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7311 %
   7312 %  MagickNextImage() sets the next image in the wand as the current image.
   7313 %
   7314 %  It is typically used after MagickResetIterator(), after which its first use
   7315 %  will set the first image as the current image (unless the wand is empty).
   7316 %
   7317 %  It will return MagickFalse when no more images are left to be returned
   7318 %  which happens when the wand is empty, or the current image is the last
   7319 %  image.
   7320 %
   7321 %  When the above condition (end of image list) is reached, the iterator is
   7322 %  automaticall set so that you can start using MagickPreviousImage() to
   7323 %  again iterate over the images in the reverse direction, starting with the
   7324 %  last image (again).  You can jump to this condition immeditally using
   7325 %  MagickSetLastIterator().
   7326 %
   7327 %  The format of the MagickNextImage method is:
   7328 %
   7329 %      MagickBooleanType MagickNextImage(MagickWand *wand)
   7330 %
   7331 %  A description of each parameter follows:
   7332 %
   7333 %    o wand: the magick wand.
   7334 %
   7335 */
   7336 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
   7337 {
   7338   assert(wand != (MagickWand *) NULL);
   7339   assert(wand->signature == MagickWandSignature);
   7340   if (wand->debug != MagickFalse)
   7341     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7342   if (wand->images == (Image *) NULL)
   7343     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7344   wand->insert_before=MagickFalse; /* Inserts is now appended */
   7345   if (wand->image_pending != MagickFalse)
   7346     {
   7347       wand->image_pending=MagickFalse;
   7348       return(MagickTrue);
   7349     }
   7350   if (GetNextImageInList(wand->images) == (Image *) NULL)
   7351     {
   7352       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
   7353       return(MagickFalse);
   7354     }
   7355   wand->images=GetNextImageInList(wand->images);
   7356   return(MagickTrue);
   7357 }
   7358 
   7359 /*
   7361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7362 %                                                                             %
   7363 %                                                                             %
   7364 %                                                                             %
   7365 %   M a g i c k N o r m a l i z e I m a g e                                   %
   7366 %                                                                             %
   7367 %                                                                             %
   7368 %                                                                             %
   7369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7370 %
   7371 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
   7372 %  the pixels color to span the entire range of colors available
   7373 %
   7374 %  You can also reduce the influence of a particular channel with a gamma
   7375 %  value of 0.
   7376 %
   7377 %  The format of the MagickNormalizeImage method is:
   7378 %
   7379 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
   7380 %
   7381 %  A description of each parameter follows:
   7382 %
   7383 %    o wand: the magick wand.
   7384 %
   7385 */
   7386 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
   7387 {
   7388   MagickBooleanType
   7389     status;
   7390 
   7391   assert(wand != (MagickWand *) NULL);
   7392   assert(wand->signature == MagickWandSignature);
   7393   if (wand->debug != MagickFalse)
   7394     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7395   if (wand->images == (Image *) NULL)
   7396     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7397   status=NormalizeImage(wand->images,wand->exception);
   7398   return(status);
   7399 }
   7400 
   7401 /*
   7403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7404 %                                                                             %
   7405 %                                                                             %
   7406 %                                                                             %
   7407 %   M a g i c k O i l P a i n t I m a g e                                     %
   7408 %                                                                             %
   7409 %                                                                             %
   7410 %                                                                             %
   7411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7412 %
   7413 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
   7414 %  painting.  Each pixel is replaced by the most frequent color occurring
   7415 %  in a circular region defined by radius.
   7416 %
   7417 %  The format of the MagickOilPaintImage method is:
   7418 %
   7419 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
   7420 %        const double radius,const double sigma)
   7421 %
   7422 %  A description of each parameter follows:
   7423 %
   7424 %    o wand: the magick wand.
   7425 %
   7426 %    o radius: the radius of the circular neighborhood.
   7427 %
   7428 %    o sigma: the standard deviation of the Gaussian, in pixels.
   7429 %
   7430 */
   7431 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
   7432   const double radius,const double sigma)
   7433 {
   7434   Image
   7435     *paint_image;
   7436 
   7437   assert(wand != (MagickWand *) NULL);
   7438   assert(wand->signature == MagickWandSignature);
   7439   if (wand->debug != MagickFalse)
   7440     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7441   if (wand->images == (Image *) NULL)
   7442     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7443   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
   7444   if (paint_image == (Image *) NULL)
   7445     return(MagickFalse);
   7446   ReplaceImageInList(&wand->images,paint_image);
   7447   return(MagickTrue);
   7448 }
   7449 
   7450 /*
   7452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7453 %                                                                             %
   7454 %                                                                             %
   7455 %                                                                             %
   7456 %   M a g i c k O p a q u e P a i n t I m a g e                               %
   7457 %                                                                             %
   7458 %                                                                             %
   7459 %                                                                             %
   7460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7461 %
   7462 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
   7463 %  defined by fill.
   7464 %
   7465 %  The format of the MagickOpaquePaintImage method is:
   7466 %
   7467 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
   7468 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
   7469 %        const MagickBooleanType invert)
   7470 %
   7471 %  A description of each parameter follows:
   7472 %
   7473 %    o wand: the magick wand.
   7474 %
   7475 %    o target: Change this target color to the fill color within the image.
   7476 %
   7477 %    o fill: the fill pixel wand.
   7478 %
   7479 %    o fuzz: By default target must match a particular pixel color
   7480 %      exactly.  However, in many cases two colors may differ by a small amount.
   7481 %      The fuzz member of image defines how much tolerance is acceptable to
   7482 %      consider two colors as the same.  For example, set fuzz to 10 and the
   7483 %      color red at intensities of 100 and 102 respectively are now interpreted
   7484 %      as the same color for the purposes of the floodfill.
   7485 %
   7486 %    o invert: paint any pixel that does not match the target color.
   7487 %
   7488 */
   7489 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
   7490   const PixelWand *target,const PixelWand *fill,const double fuzz,
   7491   const MagickBooleanType invert)
   7492 {
   7493   MagickBooleanType
   7494     status;
   7495 
   7496   PixelInfo
   7497     fill_pixel,
   7498     target_pixel;
   7499 
   7500   assert(wand != (MagickWand *) NULL);
   7501   assert(wand->signature == MagickWandSignature);
   7502   if (wand->debug != MagickFalse)
   7503     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7504   if (wand->images == (Image *) NULL)
   7505     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7506   PixelGetMagickColor(target,&target_pixel);
   7507   PixelGetMagickColor(fill,&fill_pixel);
   7508   wand->images->fuzz=fuzz;
   7509   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
   7510     wand->exception);
   7511   return(status);
   7512 }
   7513 
   7514 /*
   7516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7517 %                                                                             %
   7518 %                                                                             %
   7519 %                                                                             %
   7520 %   M a g i c k O p t i m i z e I m a g e L a y e r s                         %
   7521 %                                                                             %
   7522 %                                                                             %
   7523 %                                                                             %
   7524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7525 %
   7526 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
   7527 %  previous image in the sequence.  From this it attempts to select the
   7528 %  smallest cropped image to replace each frame, while preserving the results
   7529 %  of the animation.
   7530 %
   7531 %  The format of the MagickOptimizeImageLayers method is:
   7532 %
   7533 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
   7534 %
   7535 %  A description of each parameter follows:
   7536 %
   7537 %    o wand: the magick wand.
   7538 %
   7539 */
   7540 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
   7541 {
   7542   Image
   7543     *optimize_image;
   7544 
   7545   assert(wand != (MagickWand *) NULL);
   7546   assert(wand->signature == MagickWandSignature);
   7547   if (wand->debug != MagickFalse)
   7548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7549   if (wand->images == (Image *) NULL)
   7550     return((MagickWand *) NULL);
   7551   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
   7552   if (optimize_image == (Image *) NULL)
   7553     return((MagickWand *) NULL);
   7554   return(CloneMagickWandFromImages(wand,optimize_image));
   7555 }
   7556 
   7557 /*
   7559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7560 %                                                                             %
   7561 %                                                                             %
   7562 %                                                                             %
   7563 %   M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y             %
   7564 %                                                                             %
   7565 %                                                                             %
   7566 %                                                                             %
   7567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7568 %
   7569 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
   7570 %  compares the overlayed pixels against the disposal image resulting from all
   7571 %  the previous frames in the animation.  Any pixel that does not change the
   7572 %  disposal image (and thus does not effect the outcome of an overlay) is made
   7573 %  transparent.
   7574 %
   7575 %  WARNING: This modifies the current images directly, rather than generate
   7576 %  a new image sequence.
   7577 %  The format of the MagickOptimizeImageTransparency method is:
   7578 %
   7579 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
   7580 %
   7581 %  A description of each parameter follows:
   7582 %
   7583 %    o wand: the magick wand.
   7584 %
   7585 */
   7586 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
   7587 {
   7588   assert(wand != (MagickWand *) NULL);
   7589   assert(wand->signature == MagickWandSignature);
   7590   if (wand->debug != MagickFalse)
   7591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7592   if (wand->images == (Image *) NULL)
   7593     return(MagickFalse);
   7594   OptimizeImageTransparency(wand->images,wand->exception);
   7595   return(MagickTrue);
   7596 }
   7597 
   7598 /*
   7600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7601 %                                                                             %
   7602 %                                                                             %
   7603 %                                                                             %
   7604 %     M a g i c k O r d e r e d D i t h e r I m a g e                         %
   7605 %                                                                             %
   7606 %                                                                             %
   7607 %                                                                             %
   7608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7609 %
   7610 %  MagickOrderedDitherImage() performs an ordered dither based on a number
   7611 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
   7612 %  which can be different for different channels, according to the input
   7613 %  arguments.
   7614 %
   7615 %  The format of the MagickOrderedDitherImage method is:
   7616 %
   7617 %      MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
   7618 %        const char *threshold_map)
   7619 %
   7620 %  A description of each parameter follows:
   7621 %
   7622 %    o image: the image.
   7623 %
   7624 %    o threshold_map: A string containing the name of the threshold dither
   7625 %      map to use, followed by zero or more numbers representing the number of
   7626 %      color levels tho dither between.
   7627 %
   7628 %      Any level number less than 2 is equivalent to 2, and means only binary
   7629 %      dithering will be applied to each color channel.
   7630 %
   7631 %      No numbers also means a 2 level (bitmap) dither will be applied to all
   7632 %      channels, while a single number is the number of levels applied to each
   7633 %      channel in sequence.  More numbers will be applied in turn to each of
   7634 %      the color channels.
   7635 %
   7636 %      For example: "o3x3,6" generates a 6 level posterization of the image
   7637 %      with a ordered 3x3 diffused pixel dither being applied between each
   7638 %      level. While checker,8,8,4 will produce a 332 colormaped image with
   7639 %      only a single checkerboard hash pattern (50% grey) between each color
   7640 %      level, to basically double the number of color levels with a bare
   7641 %      minimim of dithering.
   7642 %
   7643 */
   7644 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
   7645   const char *threshold_map)
   7646 {
   7647   MagickBooleanType
   7648     status;
   7649 
   7650   assert(wand != (MagickWand *) NULL);
   7651   assert(wand->signature == MagickWandSignature);
   7652   if (wand->debug != MagickFalse)
   7653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7654   if (wand->images == (Image *) NULL)
   7655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7656   status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
   7657   return(status);
   7658 }
   7659 
   7660 /*
   7662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7663 %                                                                             %
   7664 %                                                                             %
   7665 %                                                                             %
   7666 %   M a g i c k P i n g I m a g e                                             %
   7667 %                                                                             %
   7668 %                                                                             %
   7669 %                                                                             %
   7670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7671 %
   7672 %  MagickPingImage() is the same as MagickReadImage() except the only valid
   7673 %  information returned is the image width, height, size, and format.  It
   7674 %  is designed to efficiently obtain this information from a file without
   7675 %  reading the entire image sequence into memory.
   7676 %
   7677 %  The format of the MagickPingImage method is:
   7678 %
   7679 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
   7680 %
   7681 %  A description of each parameter follows:
   7682 %
   7683 %    o wand: the magick wand.
   7684 %
   7685 %    o filename: the image filename.
   7686 %
   7687 */
   7688 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
   7689   const char *filename)
   7690 {
   7691   Image
   7692     *images;
   7693 
   7694   ImageInfo
   7695     *ping_info;
   7696 
   7697   assert(wand != (MagickWand *) NULL);
   7698   assert(wand->signature == MagickWandSignature);
   7699   if (wand->debug != MagickFalse)
   7700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7701   ping_info=CloneImageInfo(wand->image_info);
   7702   if (filename != (const char *) NULL)
   7703     (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
   7704   images=PingImage(ping_info,wand->exception);
   7705   ping_info=DestroyImageInfo(ping_info);
   7706   if (images == (Image *) NULL)
   7707     return(MagickFalse);
   7708   return(InsertImageInWand(wand,images));
   7709 }
   7710 
   7711 /*
   7713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7714 %                                                                             %
   7715 %                                                                             %
   7716 %                                                                             %
   7717 %   M a g i c k P i n g I m a g e B l o b                                     %
   7718 %                                                                             %
   7719 %                                                                             %
   7720 %                                                                             %
   7721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7722 %
   7723 %  MagickPingImageBlob() pings an image or image sequence from a blob.
   7724 %
   7725 %  The format of the MagickPingImageBlob method is:
   7726 %
   7727 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
   7728 %        const void *blob,const size_t length)
   7729 %
   7730 %  A description of each parameter follows:
   7731 %
   7732 %    o wand: the magick wand.
   7733 %
   7734 %    o blob: the blob.
   7735 %
   7736 %    o length: the blob length.
   7737 %
   7738 */
   7739 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
   7740   const void *blob,const size_t length)
   7741 {
   7742   Image
   7743     *images;
   7744 
   7745   ImageInfo
   7746     *read_info;
   7747 
   7748   assert(wand != (MagickWand *) NULL);
   7749   assert(wand->signature == MagickWandSignature);
   7750   if (wand->debug != MagickFalse)
   7751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7752   read_info=CloneImageInfo(wand->image_info);
   7753   SetImageInfoBlob(read_info,blob,length);
   7754   images=PingImage(read_info,wand->exception);
   7755   read_info=DestroyImageInfo(read_info);
   7756   if (images == (Image *) NULL)
   7757     return(MagickFalse);
   7758   return(InsertImageInWand(wand,images));
   7759 }
   7760 
   7761 /*
   7763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7764 %                                                                             %
   7765 %                                                                             %
   7766 %                                                                             %
   7767 %   M a g i c k P i n g I m a g e F i l e                                     %
   7768 %                                                                             %
   7769 %                                                                             %
   7770 %                                                                             %
   7771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7772 %
   7773 %  MagickPingImageFile() pings an image or image sequence from an open file
   7774 %  descriptor.
   7775 %
   7776 %  The format of the MagickPingImageFile method is:
   7777 %
   7778 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
   7779 %
   7780 %  A description of each parameter follows:
   7781 %
   7782 %    o wand: the magick wand.
   7783 %
   7784 %    o file: the file descriptor.
   7785 %
   7786 */
   7787 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
   7788 {
   7789   Image
   7790     *images;
   7791 
   7792   ImageInfo
   7793     *read_info;
   7794 
   7795   assert(wand != (MagickWand *) NULL);
   7796   assert(wand->signature == MagickWandSignature);
   7797   assert(file != (FILE *) NULL);
   7798   if (wand->debug != MagickFalse)
   7799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7800   read_info=CloneImageInfo(wand->image_info);
   7801   SetImageInfoFile(read_info,file);
   7802   images=PingImage(read_info,wand->exception);
   7803   read_info=DestroyImageInfo(read_info);
   7804   if (images == (Image *) NULL)
   7805     return(MagickFalse);
   7806   return(InsertImageInWand(wand,images));
   7807 }
   7808 
   7809 /*
   7811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7812 %                                                                             %
   7813 %                                                                             %
   7814 %                                                                             %
   7815 %   M a g i c k P o l a r o i d I m a g e                                     %
   7816 %                                                                             %
   7817 %                                                                             %
   7818 %                                                                             %
   7819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7820 %
   7821 %  MagickPolaroidImage() simulates a Polaroid picture.
   7822 %
   7823 %  The format of the MagickPolaroidImage method is:
   7824 %
   7825 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
   7826 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
   7827 %        const PixelInterpolateMethod method)
   7828 %
   7829 %  A description of each parameter follows:
   7830 %
   7831 %    o wand: the magick wand.
   7832 %
   7833 %    o drawing_wand: the draw wand.
   7834 %
   7835 %    o caption: the Polaroid caption.
   7836 %
   7837 %    o angle: Apply the effect along this angle.
   7838 %
   7839 %    o method: the pixel interpolation method.
   7840 %
   7841 */
   7842 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
   7843   const DrawingWand *drawing_wand,const char *caption,const double angle,
   7844   const PixelInterpolateMethod method)
   7845 {
   7846   DrawInfo
   7847     *draw_info;
   7848 
   7849   Image
   7850     *polaroid_image;
   7851 
   7852   assert(wand != (MagickWand *) NULL);
   7853   assert(wand->signature == MagickWandSignature);
   7854   if (wand->debug != MagickFalse)
   7855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7856   if (wand->images == (Image *) NULL)
   7857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7858   draw_info=PeekDrawingWand(drawing_wand);
   7859   if (draw_info == (DrawInfo *) NULL)
   7860     return(MagickFalse);
   7861   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
   7862     wand->exception);
   7863   if (polaroid_image == (Image *) NULL)
   7864     return(MagickFalse);
   7865   ReplaceImageInList(&wand->images,polaroid_image);
   7866   return(MagickTrue);
   7867 }
   7868 
   7869 /*
   7871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7872 %                                                                             %
   7873 %                                                                             %
   7874 %                                                                             %
   7875 %   M a g i c k P o s t e r i z e I m a g e                                   %
   7876 %                                                                             %
   7877 %                                                                             %
   7878 %                                                                             %
   7879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7880 %
   7881 %  MagickPosterizeImage() reduces the image to a limited number of color level.
   7882 %
   7883 %  The format of the MagickPosterizeImage method is:
   7884 %
   7885 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
   7886 %        const size_t levels,const DitherMethod method)
   7887 %
   7888 %  A description of each parameter follows:
   7889 %
   7890 %    o wand: the magick wand.
   7891 %
   7892 %    o levels: Number of color levels allowed in each channel.  Very low values
   7893 %      (2, 3, or 4) have the most visible effect.
   7894 %
   7895 %    o method: choose the dither method: UndefinedDitherMethod,
   7896 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   7897 %
   7898 */
   7899 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
   7900   const size_t levels,const DitherMethod dither)
   7901 {
   7902   MagickBooleanType
   7903     status;
   7904 
   7905   assert(wand != (MagickWand *) NULL);
   7906   assert(wand->signature == MagickWandSignature);
   7907   if (wand->debug != MagickFalse)
   7908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7909   if (wand->images == (Image *) NULL)
   7910     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7911   status=PosterizeImage(wand->images,levels,dither,wand->exception);
   7912   return(status);
   7913 }
   7914 
   7915 /*
   7917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7918 %                                                                             %
   7919 %                                                                             %
   7920 %                                                                             %
   7921 %   M a g i c k P r e v i e w I m a g e s                                     %
   7922 %                                                                             %
   7923 %                                                                             %
   7924 %                                                                             %
   7925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7926 %
   7927 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
   7928 %  image processing operation applied at varying strengths.  This helpful
   7929 %  to quickly pin-point an appropriate parameter for an image processing
   7930 %  operation.
   7931 %
   7932 %  The format of the MagickPreviewImages method is:
   7933 %
   7934 %      MagickWand *MagickPreviewImages(MagickWand *wand,
   7935 %        const PreviewType preview)
   7936 %
   7937 %  A description of each parameter follows:
   7938 %
   7939 %    o wand: the magick wand.
   7940 %
   7941 %    o preview: the preview type.
   7942 %
   7943 */
   7944 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
   7945   const PreviewType preview)
   7946 {
   7947   Image
   7948     *preview_image;
   7949 
   7950   assert(wand != (MagickWand *) NULL);
   7951   assert(wand->signature == MagickWandSignature);
   7952   if (wand->debug != MagickFalse)
   7953     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7954   if (wand->images == (Image *) NULL)
   7955     return((MagickWand *) NULL);
   7956   preview_image=PreviewImage(wand->images,preview,wand->exception);
   7957   if (preview_image == (Image *) NULL)
   7958     return((MagickWand *) NULL);
   7959   return(CloneMagickWandFromImages(wand,preview_image));
   7960 }
   7961 
   7962 /*
   7964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7965 %                                                                             %
   7966 %                                                                             %
   7967 %                                                                             %
   7968 %   M a g i c k P r e v i o u s I m a g e                                     %
   7969 %                                                                             %
   7970 %                                                                             %
   7971 %                                                                             %
   7972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7973 %
   7974 %  MagickPreviousImage() sets the previous image in the wand as the current
   7975 %  image.
   7976 %
   7977 %  It is typically used after MagickSetLastIterator(), after which its first
   7978 %  use will set the last image as the current image (unless the wand is empty).
   7979 %
   7980 %  It will return MagickFalse when no more images are left to be returned
   7981 %  which happens when the wand is empty, or the current image is the first
   7982 %  image.  At that point the iterator is than reset to again process images in
   7983 %  the forward direction, again starting with the first image in list. Images
   7984 %  added at this point are prepended.
   7985 %
   7986 %  Also at that point any images added to the wand using MagickAddImages() or
   7987 %  MagickReadImages() will be prepended before the first image. In this sense
   7988 %  the condition is not quite exactly the same as MagickResetIterator().
   7989 %
   7990 %  The format of the MagickPreviousImage method is:
   7991 %
   7992 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
   7993 %
   7994 %  A description of each parameter follows:
   7995 %
   7996 %    o wand: the magick wand.
   7997 %
   7998 */
   7999 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
   8000 {
   8001   assert(wand != (MagickWand *) NULL);
   8002   assert(wand->signature == MagickWandSignature);
   8003   if (wand->debug != MagickFalse)
   8004     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8005   if (wand->images == (Image *) NULL)
   8006     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8007   if (wand->image_pending != MagickFalse)
   8008     {
   8009       wand->image_pending=MagickFalse;  /* image returned no longer pending */
   8010       return(MagickTrue);
   8011     }
   8012   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
   8013     {
   8014       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
   8015       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
   8016       return(MagickFalse);
   8017     }
   8018   wand->images=GetPreviousImageInList(wand->images);
   8019   return(MagickTrue);
   8020 }
   8021 
   8022 /*
   8024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8025 %                                                                             %
   8026 %                                                                             %
   8027 %                                                                             %
   8028 %   M a g i c k Q u a n t i z e I m a g e                                     %
   8029 %                                                                             %
   8030 %                                                                             %
   8031 %                                                                             %
   8032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8033 %
   8034 %  MagickQuantizeImage() analyzes the colors within a reference image and
   8035 %  chooses a fixed number of colors to represent the image.  The goal of the
   8036 %  algorithm is to minimize the color difference between the input and output
   8037 %  image while minimizing the processing time.
   8038 %
   8039 %  The format of the MagickQuantizeImage method is:
   8040 %
   8041 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
   8042 %        const size_t number_colors,const ColorspaceType colorspace,
   8043 %        const size_t treedepth,const DitherMethod dither_method,
   8044 %        const MagickBooleanType measure_error)
   8045 %
   8046 %  A description of each parameter follows:
   8047 %
   8048 %    o wand: the magick wand.
   8049 %
   8050 %    o number_colors: the number of colors.
   8051 %
   8052 %    o colorspace: Perform color reduction in this colorspace, typically
   8053 %      RGBColorspace.
   8054 %
   8055 %    o treedepth: Normally, this integer value is zero or one.  A zero or
   8056 %      one tells Quantize to choose a optimal tree depth of Log4(number_colors).%      A tree of this depth generally allows the best representation of the
   8057 %      reference image with the least amount of memory and the fastest
   8058 %      computational speed.  In some cases, such as an image with low color
   8059 %      dispersion (a few number of colors), a value other than
   8060 %      Log4(number_colors) is required.  To expand the color tree completely,
   8061 %      use a value of 8.
   8062 %
   8063 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
   8064 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
   8065 %
   8066 %    o measure_error: A value other than zero measures the difference between
   8067 %      the original and quantized images.  This difference is the total
   8068 %      quantization error.  The error is computed by summing over all pixels
   8069 %      in an image the distance squared in RGB space between each reference
   8070 %      pixel value and its quantized value.
   8071 %
   8072 */
   8073 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
   8074   const size_t number_colors,const ColorspaceType colorspace,
   8075   const size_t treedepth,const DitherMethod dither_method,
   8076   const MagickBooleanType measure_error)
   8077 {
   8078   MagickBooleanType
   8079     status;
   8080 
   8081   QuantizeInfo
   8082     *quantize_info;
   8083 
   8084   assert(wand != (MagickWand *) NULL);
   8085   assert(wand->signature == MagickWandSignature);
   8086   if (wand->debug != MagickFalse)
   8087     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8088   if (wand->images == (Image *) NULL)
   8089     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8090   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
   8091   quantize_info->number_colors=number_colors;
   8092   quantize_info->dither_method=dither_method;
   8093   quantize_info->tree_depth=treedepth;
   8094   quantize_info->colorspace=colorspace;
   8095   quantize_info->measure_error=measure_error;
   8096   status=QuantizeImage(quantize_info,wand->images,wand->exception);
   8097   quantize_info=DestroyQuantizeInfo(quantize_info);
   8098   return(status);
   8099 }
   8100 
   8101 /*
   8103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8104 %                                                                             %
   8105 %                                                                             %
   8106 %                                                                             %
   8107 %   M a g i c k Q u a n t i z e I m a g e s                                   %
   8108 %                                                                             %
   8109 %                                                                             %
   8110 %                                                                             %
   8111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8112 %
   8113 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
   8114 %  chooses a fixed number of colors to represent the image.  The goal of the
   8115 %  algorithm is to minimize the color difference between the input and output
   8116 %  image while minimizing the processing time.
   8117 %
   8118 %  The format of the MagickQuantizeImages method is:
   8119 %
   8120 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
   8121 %        const size_t number_colors,const ColorspaceType colorspace,
   8122 %        const size_t treedepth,const DitherMethod dither_method,
   8123 %        const MagickBooleanType measure_error)
   8124 %
   8125 %  A description of each parameter follows:
   8126 %
   8127 %    o wand: the magick wand.
   8128 %
   8129 %    o number_colors: the number of colors.
   8130 %
   8131 %    o colorspace: Perform color reduction in this colorspace, typically
   8132 %      RGBColorspace.
   8133 %
   8134 %    o treedepth: Normally, this integer value is zero or one.  A zero or
   8135 %      one tells Quantize to choose a optimal tree depth of Log4(number_colors).%      A tree of this depth generally allows the best representation of the
   8136 %      reference image with the least amount of memory and the fastest
   8137 %      computational speed.  In some cases, such as an image with low color
   8138 %      dispersion (a few number of colors), a value other than
   8139 %      Log4(number_colors) is required.  To expand the color tree completely,
   8140 %      use a value of 8.
   8141 %
   8142 %    o dither_method: choose from these dither methods: NoDitherMethod,
   8143 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   8144 %
   8145 %    o measure_error: A value other than zero measures the difference between
   8146 %      the original and quantized images.  This difference is the total
   8147 %      quantization error.  The error is computed by summing over all pixels
   8148 %      in an image the distance squared in RGB space between each reference
   8149 %      pixel value and its quantized value.
   8150 %
   8151 */
   8152 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
   8153   const size_t number_colors,const ColorspaceType colorspace,
   8154   const size_t treedepth,const DitherMethod dither_method,
   8155   const MagickBooleanType measure_error)
   8156 {
   8157   MagickBooleanType
   8158     status;
   8159 
   8160   QuantizeInfo
   8161     *quantize_info;
   8162 
   8163   assert(wand != (MagickWand *) NULL);
   8164   assert(wand->signature == MagickWandSignature);
   8165   if (wand->debug != MagickFalse)
   8166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8167   if (wand->images == (Image *) NULL)
   8168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8169   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
   8170   quantize_info->number_colors=number_colors;
   8171   quantize_info->dither_method=dither_method;
   8172   quantize_info->tree_depth=treedepth;
   8173   quantize_info->colorspace=colorspace;
   8174   quantize_info->measure_error=measure_error;
   8175   status=QuantizeImages(quantize_info,wand->images,wand->exception);
   8176   quantize_info=DestroyQuantizeInfo(quantize_info);
   8177   return(status);
   8178 }
   8179 
   8180 /*
   8182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8183 %                                                                             %
   8184 %                                                                             %
   8185 %                                                                             %
   8186 %   M a g i c k R o t a t i o n a l B l u r I m a g e                         %
   8187 %                                                                             %
   8188 %                                                                             %
   8189 %                                                                             %
   8190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8191 %
   8192 %  MagickRotationalBlurImage() rotational blurs an image.
   8193 %
   8194 %  The format of the MagickRotationalBlurImage method is:
   8195 %
   8196 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
   8197 %        const double angle)
   8198 %
   8199 %  A description of each parameter follows:
   8200 %
   8201 %    o wand: the magick wand.
   8202 %
   8203 %    o angle: the angle of the blur in degrees.
   8204 %
   8205 */
   8206 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
   8207   const double angle)
   8208 {
   8209   Image
   8210     *blur_image;
   8211 
   8212   assert(wand != (MagickWand *) NULL);
   8213   assert(wand->signature == MagickWandSignature);
   8214   if (wand->debug != MagickFalse)
   8215     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8216   if (wand->images == (Image *) NULL)
   8217     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8218   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
   8219   if (blur_image == (Image *) NULL)
   8220     return(MagickFalse);
   8221   ReplaceImageInList(&wand->images,blur_image);
   8222   return(MagickTrue);
   8223 }
   8224 
   8225 /*
   8227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8228 %                                                                             %
   8229 %                                                                             %
   8230 %                                                                             %
   8231 %   M a g i c k R a i s e I m a g e                                           %
   8232 %                                                                             %
   8233 %                                                                             %
   8234 %                                                                             %
   8235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8236 %
   8237 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
   8238 %  by lightening and darkening the edges of the image.  Members width and
   8239 %  height of raise_info define the width of the vertical and horizontal
   8240 %  edge of the effect.
   8241 %
   8242 %  The format of the MagickRaiseImage method is:
   8243 %
   8244 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
   8245 %        const size_t width,const size_t height,const ssize_t x,
   8246 %        const ssize_t y,const MagickBooleanType raise)
   8247 %
   8248 %  A description of each parameter follows:
   8249 %
   8250 %    o wand: the magick wand.
   8251 %
   8252 %    o width,height,x,y:  Define the dimensions of the area to raise.
   8253 %
   8254 %    o raise: A value other than zero creates a 3-D raise effect,
   8255 %      otherwise it has a lowered effect.
   8256 %
   8257 */
   8258 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
   8259   const size_t width,const size_t height,const ssize_t x,
   8260   const ssize_t y,const MagickBooleanType raise)
   8261 {
   8262   MagickBooleanType
   8263     status;
   8264 
   8265   RectangleInfo
   8266     raise_info;
   8267 
   8268   assert(wand != (MagickWand *) NULL);
   8269   assert(wand->signature == MagickWandSignature);
   8270   if (wand->debug != MagickFalse)
   8271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8272   if (wand->images == (Image *) NULL)
   8273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8274   raise_info.width=width;
   8275   raise_info.height=height;
   8276   raise_info.x=x;
   8277   raise_info.y=y;
   8278   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
   8279   return(status);
   8280 }
   8281 
   8282 /*
   8284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8285 %                                                                             %
   8286 %                                                                             %
   8287 %                                                                             %
   8288 %   M a g i c k R a n d o m T h r e s h o l d I m a g e                       %
   8289 %                                                                             %
   8290 %                                                                             %
   8291 %                                                                             %
   8292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8293 %
   8294 %  MagickRandomThresholdImage() changes the value of individual pixels based on
   8295 %  the intensity of each pixel compared to threshold.  The result is a
   8296 %  high-contrast, two color image.
   8297 %
   8298 %  The format of the MagickRandomThresholdImage method is:
   8299 %
   8300 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
   8301 %        const double low,const double high)
   8302 %
   8303 %  A description of each parameter follows:
   8304 %
   8305 %    o wand: the magick wand.
   8306 %
   8307 %    o low,high: Specify the high and low thresholds. These values range from
   8308 %      0 to QuantumRange.
   8309 %
   8310 */
   8311 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
   8312   const double low,const double high)
   8313 {
   8314   assert(wand != (MagickWand *) NULL);
   8315   assert(wand->signature == MagickWandSignature);
   8316   if (wand->debug != MagickFalse)
   8317     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8318   if (wand->images == (Image *) NULL)
   8319     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8320   return(RandomThresholdImage(wand->images,low,high,wand->exception));
   8321 }
   8322 
   8323 /*
   8325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8326 %                                                                             %
   8327 %                                                                             %
   8328 %                                                                             %
   8329 %   M a g i c k R e a d I m a g e                                             %
   8330 %                                                                             %
   8331 %                                                                             %
   8332 %                                                                             %
   8333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8334 %
   8335 %  MagickReadImage() reads an image or image sequence.  The images are inserted
   8336 %  jjust before the current image pointer position.
   8337 %
   8338 %  Use MagickSetFirstIterator(), to insert new images before all the current
   8339 %  images in the wand, MagickSetLastIterator() to append add to the end,
   8340 %  MagickSetIteratorIndex() to place images just after the given index.
   8341 %
   8342 %  The format of the MagickReadImage method is:
   8343 %
   8344 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
   8345 %
   8346 %  A description of each parameter follows:
   8347 %
   8348 %    o wand: the magick wand.
   8349 %
   8350 %    o filename: the image filename.
   8351 %
   8352 */
   8353 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
   8354   const char *filename)
   8355 {
   8356   Image
   8357     *images;
   8358 
   8359   ImageInfo
   8360     *read_info;
   8361 
   8362   assert(wand != (MagickWand *) NULL);
   8363   assert(wand->signature == MagickWandSignature);
   8364   if (wand->debug != MagickFalse)
   8365     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8366   read_info=CloneImageInfo(wand->image_info);
   8367   if (filename != (const char *) NULL)
   8368     (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
   8369   images=ReadImage(read_info,wand->exception);
   8370   read_info=DestroyImageInfo(read_info);
   8371   if (images == (Image *) NULL)
   8372     return(MagickFalse);
   8373   return(InsertImageInWand(wand,images));
   8374 }
   8375 
   8376 /*
   8378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8379 %                                                                             %
   8380 %                                                                             %
   8381 %                                                                             %
   8382 %   M a g i c k R e a d I m a g e B l o b                                     %
   8383 %                                                                             %
   8384 %                                                                             %
   8385 %                                                                             %
   8386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8387 %
   8388 %  MagickReadImageBlob() reads an image or image sequence from a blob.
   8389 %  In all other respects it is like MagickReadImage().
   8390 %
   8391 %  The format of the MagickReadImageBlob method is:
   8392 %
   8393 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
   8394 %        const void *blob,const size_t length)
   8395 %
   8396 %  A description of each parameter follows:
   8397 %
   8398 %    o wand: the magick wand.
   8399 %
   8400 %    o blob: the blob.
   8401 %
   8402 %    o length: the blob length.
   8403 %
   8404 */
   8405 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
   8406   const void *blob,const size_t length)
   8407 {
   8408   Image
   8409     *images;
   8410 
   8411   assert(wand != (MagickWand *) NULL);
   8412   assert(wand->signature == MagickWandSignature);
   8413   if (wand->debug != MagickFalse)
   8414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8415   images=BlobToImage(wand->image_info,blob,length,wand->exception);
   8416   if (images == (Image *) NULL)
   8417     return(MagickFalse);
   8418   return(InsertImageInWand(wand,images));
   8419 }
   8420 
   8421 /*
   8423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8424 %                                                                             %
   8425 %                                                                             %
   8426 %                                                                             %
   8427 %   M a g i c k R e a d I m a g e F i l e                                     %
   8428 %                                                                             %
   8429 %                                                                             %
   8430 %                                                                             %
   8431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8432 %
   8433 %  MagickReadImageFile() reads an image or image sequence from an already
   8434 %  opened file descriptor.  Otherwise it is like MagickReadImage().
   8435 %
   8436 %  The format of the MagickReadImageFile method is:
   8437 %
   8438 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
   8439 %
   8440 %  A description of each parameter follows:
   8441 %
   8442 %    o wand: the magick wand.
   8443 %
   8444 %    o file: the file descriptor.
   8445 %
   8446 */
   8447 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
   8448 {
   8449   Image
   8450     *images;
   8451 
   8452   ImageInfo
   8453     *read_info;
   8454 
   8455   assert(wand != (MagickWand *) NULL);
   8456   assert(wand->signature == MagickWandSignature);
   8457   assert(file != (FILE *) NULL);
   8458   if (wand->debug != MagickFalse)
   8459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8460   read_info=CloneImageInfo(wand->image_info);
   8461   SetImageInfoFile(read_info,file);
   8462   images=ReadImage(read_info,wand->exception);
   8463   read_info=DestroyImageInfo(read_info);
   8464   if (images == (Image *) NULL)
   8465     return(MagickFalse);
   8466   return(InsertImageInWand(wand,images));
   8467 }
   8468 
   8469 /*
   8471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8472 %                                                                             %
   8473 %                                                                             %
   8474 %                                                                             %
   8475 %   M a g i c k R e m a p I m a g e                                           %
   8476 %                                                                             %
   8477 %                                                                             %
   8478 %                                                                             %
   8479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8480 %
   8481 %  MagickRemapImage() replaces the colors of an image with the closest color
   8482 %  from a reference image.
   8483 %
   8484 %  The format of the MagickRemapImage method is:
   8485 %
   8486 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
   8487 %        const MagickWand *remap_wand,const DitherMethod method)
   8488 %
   8489 %  A description of each parameter follows:
   8490 %
   8491 %    o wand: the magick wand.
   8492 %
   8493 %    o affinity: the affinity wand.
   8494 %
   8495 %    o method: choose from these dither methods: NoDitherMethod,
   8496 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   8497 %
   8498 */
   8499 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
   8500   const MagickWand *remap_wand,const DitherMethod dither_method)
   8501 {
   8502   MagickBooleanType
   8503     status;
   8504 
   8505   QuantizeInfo
   8506     *quantize_info;
   8507 
   8508   assert(wand != (MagickWand *) NULL);
   8509   assert(wand->signature == MagickWandSignature);
   8510   if (wand->debug != MagickFalse)
   8511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8512   if ((wand->images == (Image *) NULL) ||
   8513       (remap_wand->images == (Image *) NULL))
   8514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8515   quantize_info=AcquireQuantizeInfo(wand->image_info);
   8516   quantize_info->dither_method=dither_method;
   8517   status=RemapImage(quantize_info,wand->images,remap_wand->images,
   8518     wand->exception);
   8519   quantize_info=DestroyQuantizeInfo(quantize_info);
   8520   return(status);
   8521 }
   8522 
   8523 /*
   8525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8526 %                                                                             %
   8527 %                                                                             %
   8528 %                                                                             %
   8529 %   M a g i c k R e m o v e I m a g e                                         %
   8530 %                                                                             %
   8531 %                                                                             %
   8532 %                                                                             %
   8533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8534 %
   8535 %  MagickRemoveImage() removes an image from the image list.
   8536 %
   8537 %  The format of the MagickRemoveImage method is:
   8538 %
   8539 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
   8540 %
   8541 %  A description of each parameter follows:
   8542 %
   8543 %    o wand: the magick wand.
   8544 %
   8545 %    o insert: the splice wand.
   8546 %
   8547 */
   8548 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
   8549 {
   8550   assert(wand != (MagickWand *) NULL);
   8551   assert(wand->signature == MagickWandSignature);
   8552   if (wand->debug != MagickFalse)
   8553     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8554   if (wand->images == (Image *) NULL)
   8555     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8556   DeleteImageFromList(&wand->images);
   8557   return(MagickTrue);
   8558 }
   8559 
   8560 /*
   8562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8563 %                                                                             %
   8564 %                                                                             %
   8565 %                                                                             %
   8566 %   M a g i c k R e s a m p l e I m a g e                                     %
   8567 %                                                                             %
   8568 %                                                                             %
   8569 %                                                                             %
   8570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8571 %
   8572 %  MagickResampleImage() resample image to desired resolution.
   8573 %
   8574 %    Bessel   Blackman   Box
   8575 %    Catrom   Cubic      Gaussian
   8576 %    Hanning  Hermite    Lanczos
   8577 %    Mitchell Point      Quandratic
   8578 %    Sinc     Triangle
   8579 %
   8580 %  Most of the filters are FIR (finite impulse response), however, Bessel,
   8581 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
   8582 %  are windowed (brought down to zero) with the Blackman filter.
   8583 %
   8584 %  The format of the MagickResampleImage method is:
   8585 %
   8586 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
   8587 %        const double x_resolution,const double y_resolution,
   8588 %        const FilterType filter)
   8589 %
   8590 %  A description of each parameter follows:
   8591 %
   8592 %    o wand: the magick wand.
   8593 %
   8594 %    o x_resolution: the new image x resolution.
   8595 %
   8596 %    o y_resolution: the new image y resolution.
   8597 %
   8598 %    o filter: Image filter to use.
   8599 %
   8600 */
   8601 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
   8602   const double x_resolution,const double y_resolution,const FilterType filter)
   8603 {
   8604   Image
   8605     *resample_image;
   8606 
   8607   assert(wand != (MagickWand *) NULL);
   8608   assert(wand->signature == MagickWandSignature);
   8609   if (wand->debug != MagickFalse)
   8610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8611   if (wand->images == (Image *) NULL)
   8612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8613   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
   8614     wand->exception);
   8615   if (resample_image == (Image *) NULL)
   8616     return(MagickFalse);
   8617   ReplaceImageInList(&wand->images,resample_image);
   8618   return(MagickTrue);
   8619 }
   8620 
   8621 /*
   8623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8624 %                                                                             %
   8625 %                                                                             %
   8626 %                                                                             %
   8627 %   M a g i c k R e s e t I m a g e P a g e                                   %
   8628 %                                                                             %
   8629 %                                                                             %
   8630 %                                                                             %
   8631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8632 %
   8633 %  MagickResetImagePage() resets the Wand page canvas and position.
   8634 %
   8635 %  The format of the MagickResetImagePage method is:
   8636 %
   8637 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
   8638 %        const char *page)
   8639 %
   8640 %  A description of each parameter follows:
   8641 %
   8642 %    o wand: the magick wand.
   8643 %
   8644 %    o page: the relative page specification.
   8645 %
   8646 */
   8647 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
   8648   const char *page)
   8649 {
   8650   assert(wand != (MagickWand *) NULL);
   8651   assert(wand->signature == MagickWandSignature);
   8652   if (wand->debug != MagickFalse)
   8653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8654   if (wand->images == (Image *) NULL)
   8655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8656   if ((page == (char *) NULL) || (*page == '\0'))
   8657     {
   8658       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
   8659       return(MagickTrue);
   8660     }
   8661   return(ResetImagePage(wand->images,page));
   8662 }
   8663 
   8664 /*
   8666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8667 %                                                                             %
   8668 %                                                                             %
   8669 %                                                                             %
   8670 %   M a g i c k R e s i z e I m a g e                                         %
   8671 %                                                                             %
   8672 %                                                                             %
   8673 %                                                                             %
   8674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8675 %
   8676 %  MagickResizeImage() scales an image to the desired dimensions with one of
   8677 %  these filters:
   8678 %
   8679 %    Bessel   Blackman   Box
   8680 %    Catrom   Cubic      Gaussian
   8681 %    Hanning  Hermite    Lanczos
   8682 %    Mitchell Point      Quandratic
   8683 %    Sinc     Triangle
   8684 %
   8685 %  Most of the filters are FIR (finite impulse response), however, Bessel,
   8686 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
   8687 %  are windowed (brought down to zero) with the Blackman filter.
   8688 %
   8689 %  The format of the MagickResizeImage method is:
   8690 %
   8691 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
   8692 %        const size_t columns,const size_t rows,const FilterType filter)
   8693 %
   8694 %  A description of each parameter follows:
   8695 %
   8696 %    o wand: the magick wand.
   8697 %
   8698 %    o columns: the number of columns in the scaled image.
   8699 %
   8700 %    o rows: the number of rows in the scaled image.
   8701 %
   8702 %    o filter: Image filter to use.
   8703 %
   8704 */
   8705 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
   8706   const size_t columns,const size_t rows,const FilterType filter)
   8707 {
   8708   Image
   8709     *resize_image;
   8710 
   8711   assert(wand != (MagickWand *) NULL);
   8712   assert(wand->signature == MagickWandSignature);
   8713   if (wand->debug != MagickFalse)
   8714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8715   if (wand->images == (Image *) NULL)
   8716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8717   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
   8718   if (resize_image == (Image *) NULL)
   8719     return(MagickFalse);
   8720   ReplaceImageInList(&wand->images,resize_image);
   8721   return(MagickTrue);
   8722 }
   8723 
   8724 /*
   8726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8727 %                                                                             %
   8728 %                                                                             %
   8729 %                                                                             %
   8730 %   M a g i c k R o l l I m a g e                                             %
   8731 %                                                                             %
   8732 %                                                                             %
   8733 %                                                                             %
   8734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8735 %
   8736 %  MagickRollImage() offsets an image as defined by x and y.
   8737 %
   8738 %  The format of the MagickRollImage method is:
   8739 %
   8740 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
   8741 %        const size_t y)
   8742 %
   8743 %  A description of each parameter follows:
   8744 %
   8745 %    o wand: the magick wand.
   8746 %
   8747 %    o x: the x offset.
   8748 %
   8749 %    o y: the y offset.
   8750 %
   8751 %
   8752 */
   8753 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
   8754   const ssize_t x,const ssize_t y)
   8755 {
   8756   Image
   8757     *roll_image;
   8758 
   8759   assert(wand != (MagickWand *) NULL);
   8760   assert(wand->signature == MagickWandSignature);
   8761   if (wand->debug != MagickFalse)
   8762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8763   if (wand->images == (Image *) NULL)
   8764     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8765   roll_image=RollImage(wand->images,x,y,wand->exception);
   8766   if (roll_image == (Image *) NULL)
   8767     return(MagickFalse);
   8768   ReplaceImageInList(&wand->images,roll_image);
   8769   return(MagickTrue);
   8770 }
   8771 
   8772 /*
   8774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8775 %                                                                             %
   8776 %                                                                             %
   8777 %                                                                             %
   8778 %   M a g i c k R o t a t e I m a g e                                         %
   8779 %                                                                             %
   8780 %                                                                             %
   8781 %                                                                             %
   8782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8783 %
   8784 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
   8785 %  triangles left over from rotating the image are filled with the
   8786 %  background color.
   8787 %
   8788 %  The format of the MagickRotateImage method is:
   8789 %
   8790 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
   8791 %        const PixelWand *background,const double degrees)
   8792 %
   8793 %  A description of each parameter follows:
   8794 %
   8795 %    o wand: the magick wand.
   8796 %
   8797 %    o background: the background pixel wand.
   8798 %
   8799 %    o degrees: the number of degrees to rotate the image.
   8800 %
   8801 %
   8802 */
   8803 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
   8804   const PixelWand *background,const double degrees)
   8805 {
   8806   Image
   8807     *rotate_image;
   8808 
   8809   assert(wand != (MagickWand *) NULL);
   8810   assert(wand->signature == MagickWandSignature);
   8811   if (wand->debug != MagickFalse)
   8812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8813   if (wand->images == (Image *) NULL)
   8814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8815   PixelGetQuantumPacket(background,&wand->images->background_color);
   8816   rotate_image=RotateImage(wand->images,degrees,wand->exception);
   8817   if (rotate_image == (Image *) NULL)
   8818     return(MagickFalse);
   8819   ReplaceImageInList(&wand->images,rotate_image);
   8820   return(MagickTrue);
   8821 }
   8822 
   8823 /*
   8825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8826 %                                                                             %
   8827 %                                                                             %
   8828 %                                                                             %
   8829 %   M a g i c k S a m p l e I m a g e                                         %
   8830 %                                                                             %
   8831 %                                                                             %
   8832 %                                                                             %
   8833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8834 %
   8835 %  MagickSampleImage() scales an image to the desired dimensions with pixel
   8836 %  sampling.  Unlike other scaling methods, this method does not introduce
   8837 %  any additional color into the scaled image.
   8838 %
   8839 %  The format of the MagickSampleImage method is:
   8840 %
   8841 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
   8842 %        const size_t columns,const size_t rows)
   8843 %
   8844 %  A description of each parameter follows:
   8845 %
   8846 %    o wand: the magick wand.
   8847 %
   8848 %    o columns: the number of columns in the scaled image.
   8849 %
   8850 %    o rows: the number of rows in the scaled image.
   8851 %
   8852 %
   8853 */
   8854 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
   8855   const size_t columns,const size_t rows)
   8856 {
   8857   Image
   8858     *sample_image;
   8859 
   8860   assert(wand != (MagickWand *) NULL);
   8861   assert(wand->signature == MagickWandSignature);
   8862   if (wand->debug != MagickFalse)
   8863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8864   if (wand->images == (Image *) NULL)
   8865     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8866   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
   8867   if (sample_image == (Image *) NULL)
   8868     return(MagickFalse);
   8869   ReplaceImageInList(&wand->images,sample_image);
   8870   return(MagickTrue);
   8871 }
   8872 
   8873 /*
   8875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8876 %                                                                             %
   8877 %                                                                             %
   8878 %                                                                             %
   8879 %   M a g i c k S c a l e I m a g e                                           %
   8880 %                                                                             %
   8881 %                                                                             %
   8882 %                                                                             %
   8883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8884 %
   8885 %  MagickScaleImage() scales the size of an image to the given dimensions.
   8886 %
   8887 %  The format of the MagickScaleImage method is:
   8888 %
   8889 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
   8890 %        const size_t columns,const size_t rows)
   8891 %
   8892 %  A description of each parameter follows:
   8893 %
   8894 %    o wand: the magick wand.
   8895 %
   8896 %    o columns: the number of columns in the scaled image.
   8897 %
   8898 %    o rows: the number of rows in the scaled image.
   8899 %
   8900 %
   8901 */
   8902 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
   8903   const size_t columns,const size_t rows)
   8904 {
   8905   Image
   8906     *scale_image;
   8907 
   8908   assert(wand != (MagickWand *) NULL);
   8909   assert(wand->signature == MagickWandSignature);
   8910   if (wand->debug != MagickFalse)
   8911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8912   if (wand->images == (Image *) NULL)
   8913     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8914   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
   8915   if (scale_image == (Image *) NULL)
   8916     return(MagickFalse);
   8917   ReplaceImageInList(&wand->images,scale_image);
   8918   return(MagickTrue);
   8919 }
   8920 
   8921 /*
   8923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8924 %                                                                             %
   8925 %                                                                             %
   8926 %                                                                             %
   8927 %   M a g i c k S e g m e n t I m a g e                                       %
   8928 %                                                                             %
   8929 %                                                                             %
   8930 %                                                                             %
   8931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8932 %
   8933 %  MagickSegmentImage() segments an image by analyzing the histograms of the
   8934 %  color components and identifying units that are homogeneous with the fuzzy
   8935 %  C-means technique.
   8936 %
   8937 %  The format of the SegmentImage method is:
   8938 %
   8939 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
   8940 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
   8941 %        const double cluster_threshold,const double smooth_threshold)
   8942 %
   8943 %  A description of each parameter follows.
   8944 %
   8945 %    o wand: the wand.
   8946 %
   8947 %    o colorspace: the image colorspace.
   8948 %
   8949 %    o verbose:  Set to MagickTrue to print detailed information about the
   8950 %      identified classes.
   8951 %
   8952 %    o cluster_threshold:  This represents the minimum number of pixels
   8953 %      contained in a hexahedra before it can be considered valid (expressed as
   8954 %      a percentage).
   8955 %
   8956 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
   8957 %      derivative of the histogram.  As the value is increased, you can expect a
   8958 %      smoother second derivative.
   8959 %
   8960 */
   8961 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
   8962   const ColorspaceType colorspace,const MagickBooleanType verbose,
   8963   const double cluster_threshold,const double smooth_threshold)
   8964 {
   8965   MagickBooleanType
   8966     status;
   8967 
   8968   assert(wand != (MagickWand *) NULL);
   8969   assert(wand->signature == MagickWandSignature);
   8970   if (wand->debug != MagickFalse)
   8971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8972   if (wand->images == (Image *) NULL)
   8973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8974   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
   8975     smooth_threshold,wand->exception);
   8976   return(status);
   8977 }
   8978 
   8979 /*
   8981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8982 %                                                                             %
   8983 %                                                                             %
   8984 %                                                                             %
   8985 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
   8986 %                                                                             %
   8987 %                                                                             %
   8988 %                                                                             %
   8989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8990 %
   8991 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
   8992 %  threshold. It is similar to the unsharpen mask that sharpens everything with
   8993 %  contrast above a certain threshold.
   8994 %
   8995 %  The format of the MagickSelectiveBlurImage method is:
   8996 %
   8997 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
   8998 %        const double radius,const double sigma,const double threshold)
   8999 %
   9000 %  A description of each parameter follows:
   9001 %
   9002 %    o wand: the magick wand.
   9003 %
   9004 %    o radius: the radius of the gaussian, in pixels, not counting the center
   9005 %      pixel.
   9006 %
   9007 %    o sigma: the standard deviation of the gaussian, in pixels.
   9008 %
   9009 %    o threshold: only pixels within this contrast threshold are included
   9010 %      in the blur operation.
   9011 %
   9012 */
   9013 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
   9014   const double radius,const double sigma,const double threshold)
   9015 {
   9016   Image
   9017     *blur_image;
   9018 
   9019   assert(wand != (MagickWand *) NULL);
   9020   assert(wand->signature == MagickWandSignature);
   9021   if (wand->debug != MagickFalse)
   9022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9023   if (wand->images == (Image *) NULL)
   9024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9025   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
   9026     wand->exception);
   9027   if (blur_image == (Image *) NULL)
   9028     return(MagickFalse);
   9029   ReplaceImageInList(&wand->images,blur_image);
   9030   return(MagickTrue);
   9031 }
   9032 
   9033 /*
   9035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9036 %                                                                             %
   9037 %                                                                             %
   9038 %                                                                             %
   9039 %   M a g i c k S e p a r a t e I m a g e C h a n n e l                       %
   9040 %                                                                             %
   9041 %                                                                             %
   9042 %                                                                             %
   9043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9044 %
   9045 %  MagickSeparateImage() separates a channel from the image and returns a
   9046 %  grayscale image.  A channel is a particular color component of each pixel
   9047 %  in the image.
   9048 %
   9049 %  The format of the MagickSeparateImage method is:
   9050 %
   9051 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
   9052 %        const ChannelType channel)
   9053 %
   9054 %  A description of each parameter follows:
   9055 %
   9056 %    o wand: the magick wand.
   9057 %
   9058 %    o channel: the channel.
   9059 %
   9060 */
   9061 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
   9062   const ChannelType channel)
   9063 {
   9064   Image
   9065     *separate_image;
   9066 
   9067   assert(wand != (MagickWand *) NULL);
   9068   assert(wand->signature == MagickWandSignature);
   9069   if (wand->debug != MagickFalse)
   9070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9071   if (wand->images == (Image *) NULL)
   9072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9073   separate_image=SeparateImage(wand->images,channel,wand->exception);
   9074   if (separate_image == (Image *) NULL)
   9075     return(MagickFalse);
   9076   ReplaceImageInList(&wand->images,separate_image);
   9077   return(MagickTrue);
   9078 }
   9079 
   9080 /*
   9082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9083 %                                                                             %
   9084 %                                                                             %
   9085 %                                                                             %
   9086 %     M a g i c k S e p i a T o n e I m a g e                                 %
   9087 %                                                                             %
   9088 %                                                                             %
   9089 %                                                                             %
   9090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9091 %
   9092 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
   9093 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
   9094 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
   9095 %  threshold of 80% is a good starting point for a reasonable tone.
   9096 %
   9097 %  The format of the MagickSepiaToneImage method is:
   9098 %
   9099 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
   9100 %        const double threshold)
   9101 %
   9102 %  A description of each parameter follows:
   9103 %
   9104 %    o wand: the magick wand.
   9105 %
   9106 %    o threshold:  Define the extent of the sepia toning.
   9107 %
   9108 */
   9109 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
   9110   const double threshold)
   9111 {
   9112   Image
   9113     *sepia_image;
   9114 
   9115   assert(wand != (MagickWand *) NULL);
   9116   assert(wand->signature == MagickWandSignature);
   9117   if (wand->debug != MagickFalse)
   9118     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9119   if (wand->images == (Image *) NULL)
   9120     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9121   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
   9122   if (sepia_image == (Image *) NULL)
   9123     return(MagickFalse);
   9124   ReplaceImageInList(&wand->images,sepia_image);
   9125   return(MagickTrue);
   9126 }
   9127 
   9128 /*
   9130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9131 %                                                                             %
   9132 %                                                                             %
   9133 %                                                                             %
   9134 %   M a g i c k S e t I m a g e                                               %
   9135 %                                                                             %
   9136 %                                                                             %
   9137 %                                                                             %
   9138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9139 %
   9140 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
   9141 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
   9142 %  wand.
   9143 %
   9144 %  The format of the MagickSetImage method is:
   9145 %
   9146 %      MagickBooleanType MagickSetImage(MagickWand *wand,
   9147 %        const MagickWand *set_wand)
   9148 %
   9149 %  A description of each parameter follows:
   9150 %
   9151 %    o wand: the magick wand.
   9152 %
   9153 %    o set_wand: the set_wand wand.
   9154 %
   9155 */
   9156 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
   9157   const MagickWand *set_wand)
   9158 {
   9159   Image
   9160     *images;
   9161 
   9162   assert(wand != (MagickWand *) NULL);
   9163   assert(wand->signature == MagickWandSignature);
   9164   if (wand->debug != MagickFalse)
   9165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9166   assert(set_wand != (MagickWand *) NULL);
   9167   assert(set_wand->signature == MagickWandSignature);
   9168   if (wand->debug != MagickFalse)
   9169     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
   9170   if (set_wand->images == (Image *) NULL)
   9171     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9172   images=CloneImageList(set_wand->images,wand->exception);
   9173   if (images == (Image *) NULL)
   9174     return(MagickFalse);
   9175   ReplaceImageInList(&wand->images,images);
   9176   return(MagickTrue);
   9177 }
   9178 
   9179 /*
   9181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9182 %                                                                             %
   9183 %                                                                             %
   9184 %                                                                             %
   9185 %   M a g i c k S e t I m a g e A l p h a C h a n n e l                       %
   9186 %                                                                             %
   9187 %                                                                             %
   9188 %                                                                             %
   9189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9190 %
   9191 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
   9192 %  alpha channel.
   9193 %
   9194 %  The format of the MagickSetImageAlphaChannel method is:
   9195 %
   9196 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
   9197 %        const AlphaChannelOption alpha_type)
   9198 %
   9199 %  A description of each parameter follows:
   9200 %
   9201 %    o wand: the magick wand.
   9202 %
   9203 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
   9204 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
   9205 %
   9206 */
   9207 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
   9208   const AlphaChannelOption alpha_type)
   9209 {
   9210   assert(wand != (MagickWand *) NULL);
   9211   assert(wand->signature == MagickWandSignature);
   9212   if (wand->debug != MagickFalse)
   9213     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9214   if (wand->images == (Image *) NULL)
   9215     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9216   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
   9217 }
   9218 
   9219 /*
   9220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9221 %                                                                             %
   9222 %                                                                             %
   9223 %                                                                             %
   9224 %   M a g i c k S e t I m a g e A l p h a C o l o r                           %
   9225 %                                                                             %
   9226 %                                                                             %
   9227 %                                                                             %
   9228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9229 %
   9230 %  MagickSetImageAlphaColor() sets the image alpha color.
   9231 %
   9232 %  The format of the MagickSetImageAlphaColor method is:
   9233 %
   9234 %      MagickBooleanType MagickSetImageAlphaColor(MagickWand *wand,
   9235 %        const PixelWand *matte)
   9236 %
   9237 %  A description of each parameter follows:
   9238 %
   9239 %    o wand: the magick wand.
   9240 %
   9241 %    o matte: the alpha pixel wand.
   9242 %
   9243 */
   9244 WandExport MagickBooleanType MagickSetImageAlphaColor(MagickWand *wand,
   9245   const PixelWand *alpha)
   9246 {
   9247   assert(wand != (MagickWand *)NULL);
   9248   assert(wand->signature == MagickWandSignature);
   9249   if (wand->debug != MagickFalse)
   9250     (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
   9251   if (wand->images == (Image *)NULL)
   9252     ThrowWandException(WandError, "ContainsNoImages", wand->name);
   9253   PixelGetQuantumPacket(alpha, &wand->images->alpha_color);
   9254   return(MagickTrue);
   9255 }
   9256 
   9257 /*
   9259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9260 %                                                                             %
   9261 %                                                                             %
   9262 %                                                                             %
   9263 %   M a g i c k S e t I m a g e B a c k g r o u n d C o l o r                 %
   9264 %                                                                             %
   9265 %                                                                             %
   9266 %                                                                             %
   9267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9268 %
   9269 %  MagickSetImageBackgroundColor() sets the image background color.
   9270 %
   9271 %  The format of the MagickSetImageBackgroundColor method is:
   9272 %
   9273 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
   9274 %        const PixelWand *background)
   9275 %
   9276 %  A description of each parameter follows:
   9277 %
   9278 %    o wand: the magick wand.
   9279 %
   9280 %    o background: the background pixel wand.
   9281 %
   9282 */
   9283 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
   9284   const PixelWand *background)
   9285 {
   9286   assert(wand != (MagickWand *) NULL);
   9287   assert(wand->signature == MagickWandSignature);
   9288   if (wand->debug != MagickFalse)
   9289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9290   if (wand->images == (Image *) NULL)
   9291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9292   PixelGetQuantumPacket(background,&wand->images->background_color);
   9293   return(MagickTrue);
   9294 }
   9295 
   9296 /*
   9298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9299 %                                                                             %
   9300 %                                                                             %
   9301 %                                                                             %
   9302 %   M a g i c k S e t I m a g e B l u e P r i m a r y                         %
   9303 %                                                                             %
   9304 %                                                                             %
   9305 %                                                                             %
   9306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9307 %
   9308 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
   9309 %
   9310 %  The format of the MagickSetImageBluePrimary method is:
   9311 %
   9312 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
   9313 %        const double x,const double y,const double z)
   9314 %
   9315 %  A description of each parameter follows:
   9316 %
   9317 %    o wand: the magick wand.
   9318 %
   9319 %    o x: the blue primary x-point.
   9320 %
   9321 %    o y: the blue primary y-point.
   9322 %
   9323 %    o z: the blue primary z-point.
   9324 %
   9325 */
   9326 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
   9327   const double x,const double y,const double z)
   9328 {
   9329   assert(wand != (MagickWand *) NULL);
   9330   assert(wand->signature == MagickWandSignature);
   9331   if (wand->debug != MagickFalse)
   9332     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9333   if (wand->images == (Image *) NULL)
   9334     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9335   wand->images->chromaticity.blue_primary.x=x;
   9336   wand->images->chromaticity.blue_primary.y=y;
   9337   wand->images->chromaticity.blue_primary.z=z;
   9338   return(MagickTrue);
   9339 }
   9340 
   9341 /*
   9343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9344 %                                                                             %
   9345 %                                                                             %
   9346 %                                                                             %
   9347 %   M a g i c k S e t I m a g e B o r d e r C o l o r                         %
   9348 %                                                                             %
   9349 %                                                                             %
   9350 %                                                                             %
   9351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9352 %
   9353 %  MagickSetImageBorderColor() sets the image border color.
   9354 %
   9355 %  The format of the MagickSetImageBorderColor method is:
   9356 %
   9357 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
   9358 %        const PixelWand *border)
   9359 %
   9360 %  A description of each parameter follows:
   9361 %
   9362 %    o wand: the magick wand.
   9363 %
   9364 %    o border: the border pixel wand.
   9365 %
   9366 */
   9367 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
   9368   const PixelWand *border)
   9369 {
   9370   assert(wand != (MagickWand *) NULL);
   9371   assert(wand->signature == MagickWandSignature);
   9372   if (wand->debug != MagickFalse)
   9373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9374   if (wand->images == (Image *) NULL)
   9375     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9376   PixelGetQuantumPacket(border,&wand->images->border_color);
   9377   return(MagickTrue);
   9378 }
   9379 
   9380 /*
   9382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9383 %                                                                             %
   9384 %                                                                             %
   9385 %                                                                             %
   9386 %   M a g i c k S e t I m a g e C h a n n e l M a s k                         %
   9387 %                                                                             %
   9388 %                                                                             %
   9389 %                                                                             %
   9390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9391 %
   9392 %  MagickSetImageChannelMask() sets image channel mask.
   9393 %
   9394 %  The format of the MagickSetImageChannelMask method is:
   9395 %
   9396 %      ChannelType MagickSetImageChannelMask(MagickWand *wand,
   9397 %        const ChannelType channel_mask)
   9398 %
   9399 %  A description of each parameter follows:
   9400 %
   9401 %    o wand: the magick wand.
   9402 %
   9403 %    o channel_mask: the channel_mask wand.
   9404 %
   9405 */
   9406 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
   9407   const ChannelType channel_mask)
   9408 {
   9409   assert(wand != (MagickWand *) NULL);
   9410   assert(wand->signature == MagickWandSignature);
   9411   if (wand->debug != MagickFalse)
   9412     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9413   return(SetImageChannelMask(wand->images,channel_mask));
   9414 }
   9415 
   9416 /*
   9418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9419 %                                                                             %
   9420 %                                                                             %
   9421 %                                                                             %
   9422 %   M a g i c k S e t I m a g e M a s k                                       %
   9423 %                                                                             %
   9424 %                                                                             %
   9425 %                                                                             %
   9426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9427 %
   9428 %  MagickSetImageMask() sets image clip mask.
   9429 %
   9430 %  The format of the MagickSetImageMask method is:
   9431 %
   9432 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
   9433 %        const PixelMask type,const MagickWand *clip_mask)
   9434 %
   9435 %  A description of each parameter follows:
   9436 %
   9437 %    o wand: the magick wand.
   9438 %
   9439 %    o type: type of mask, ReadPixelMask or WritePixelMask.
   9440 %
   9441 %    o clip_mask: the clip_mask wand.
   9442 %
   9443 */
   9444 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
   9445   const PixelMask type,const MagickWand *clip_mask)
   9446 {
   9447   assert(wand != (MagickWand *) NULL);
   9448   assert(wand->signature == MagickWandSignature);
   9449   if (wand->debug != MagickFalse)
   9450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9451   assert(clip_mask != (MagickWand *) NULL);
   9452   assert(clip_mask->signature == MagickWandSignature);
   9453   if (clip_mask->debug != MagickFalse)
   9454     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
   9455   if (clip_mask->images == (Image *) NULL)
   9456     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
   9457   return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
   9458 }
   9459 
   9460 /*
   9462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9463 %                                                                             %
   9464 %                                                                             %
   9465 %                                                                             %
   9466 %   M a g i c k S e t I m a g e C o l o r                                     %
   9467 %                                                                             %
   9468 %                                                                             %
   9469 %                                                                             %
   9470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9471 %
   9472 %  MagickSetImageColor() set the entire wand canvas to the specified color.
   9473 %
   9474 %  The format of the MagickSetImageColor method is:
   9475 %
   9476 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
   9477 %        const PixelWand *color)
   9478 %
   9479 %  A description of each parameter follows:
   9480 %
   9481 %    o wand: the magick wand.
   9482 %
   9483 %    o background: the image color.
   9484 %
   9485 */
   9486 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
   9487   const PixelWand *color)
   9488 {
   9489   PixelInfo
   9490     pixel;
   9491 
   9492   assert(wand != (MagickWand *) NULL);
   9493   assert(wand->signature == MagickWandSignature);
   9494   if (wand->debug != MagickFalse)
   9495     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9496   PixelGetMagickColor(color,&pixel);
   9497   return(SetImageColor(wand->images,&pixel,wand->exception));
   9498 }
   9499 
   9500 /*
   9502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9503 %                                                                             %
   9504 %                                                                             %
   9505 %                                                                             %
   9506 %   M a g i c k S e t I m a g e C o l o r m a p C o l o r                     %
   9507 %                                                                             %
   9508 %                                                                             %
   9509 %                                                                             %
   9510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9511 %
   9512 %  MagickSetImageColormapColor() sets the color of the specified colormap
   9513 %  index.
   9514 %
   9515 %  The format of the MagickSetImageColormapColor method is:
   9516 %
   9517 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
   9518 %        const size_t index,const PixelWand *color)
   9519 %
   9520 %  A description of each parameter follows:
   9521 %
   9522 %    o wand: the magick wand.
   9523 %
   9524 %    o index: the offset into the image colormap.
   9525 %
   9526 %    o color: Return the colormap color in this wand.
   9527 %
   9528 */
   9529 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
   9530   const size_t index,const PixelWand *color)
   9531 {
   9532   assert(wand != (MagickWand *) NULL);
   9533   assert(wand->signature == MagickWandSignature);
   9534   if (wand->debug != MagickFalse)
   9535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9536   if (wand->images == (Image *) NULL)
   9537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9538   if ((wand->images->colormap == (PixelInfo *) NULL) ||
   9539       (index >= wand->images->colors))
   9540     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
   9541   PixelGetQuantumPacket(color,wand->images->colormap+index);
   9542   return(SyncImage(wand->images,wand->exception));
   9543 }
   9544 
   9545 /*
   9547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9548 %                                                                             %
   9549 %                                                                             %
   9550 %                                                                             %
   9551 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
   9552 %                                                                             %
   9553 %                                                                             %
   9554 %                                                                             %
   9555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9556 %
   9557 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
   9558 %  the image data.
   9559 %
   9560 %  The format of the MagickSetImageColorspace method is:
   9561 %
   9562 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
   9563 %        const ColorspaceType colorspace)
   9564 %
   9565 %  A description of each parameter follows:
   9566 %
   9567 %    o wand: the magick wand.
   9568 %
   9569 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
   9570 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
   9571 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
   9572 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
   9573 %      HSLColorspace, or HWBColorspace.
   9574 %
   9575 */
   9576 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
   9577   const ColorspaceType colorspace)
   9578 {
   9579   assert(wand != (MagickWand *) NULL);
   9580   assert(wand->signature == MagickWandSignature);
   9581   if (wand->debug != MagickFalse)
   9582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9583   if (wand->images == (Image *) NULL)
   9584     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9585   return(SetImageColorspace(wand->images,colorspace,wand->exception));
   9586 }
   9587 
   9588 /*
   9590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9591 %                                                                             %
   9592 %                                                                             %
   9593 %                                                                             %
   9594 %   M a g i c k S e t I m a g e C o m p o s e                                 %
   9595 %                                                                             %
   9596 %                                                                             %
   9597 %                                                                             %
   9598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9599 %
   9600 %  MagickSetImageCompose() sets the image composite operator, useful for
   9601 %  specifying how to composite the image thumbnail when using the
   9602 %  MagickMontageImage() method.
   9603 %
   9604 %  The format of the MagickSetImageCompose method is:
   9605 %
   9606 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
   9607 %        const CompositeOperator compose)
   9608 %
   9609 %  A description of each parameter follows:
   9610 %
   9611 %    o wand: the magick wand.
   9612 %
   9613 %    o compose: the image composite operator.
   9614 %
   9615 */
   9616 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
   9617   const CompositeOperator compose)
   9618 {
   9619   assert(wand != (MagickWand *) NULL);
   9620   assert(wand->signature == MagickWandSignature);
   9621   if (wand->debug != MagickFalse)
   9622     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9623   if (wand->images == (Image *) NULL)
   9624     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9625   wand->images->compose=compose;
   9626   return(MagickTrue);
   9627 }
   9628 
   9629 /*
   9631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9632 %                                                                             %
   9633 %                                                                             %
   9634 %                                                                             %
   9635 %   M a g i c k S e t I m a g e C o m p r e s s i o n                         %
   9636 %                                                                             %
   9637 %                                                                             %
   9638 %                                                                             %
   9639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9640 %
   9641 %  MagickSetImageCompression() sets the image compression.
   9642 %
   9643 %  The format of the MagickSetImageCompression method is:
   9644 %
   9645 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
   9646 %        const CompressionType compression)
   9647 %
   9648 %  A description of each parameter follows:
   9649 %
   9650 %    o wand: the magick wand.
   9651 %
   9652 %    o compression: the image compression type.
   9653 %
   9654 */
   9655 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
   9656   const CompressionType compression)
   9657 {
   9658   assert(wand != (MagickWand *) NULL);
   9659   assert(wand->signature == MagickWandSignature);
   9660   if (wand->debug != MagickFalse)
   9661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9662   if (wand->images == (Image *) NULL)
   9663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9664   wand->images->compression=compression;
   9665   return(MagickTrue);
   9666 }
   9667 
   9668 /*
   9670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9671 %                                                                             %
   9672 %                                                                             %
   9673 %                                                                             %
   9674 %   M a g i c k S e t I m a g e C o m p r e s s i o n Q u a l i t y           %
   9675 %                                                                             %
   9676 %                                                                             %
   9677 %                                                                             %
   9678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9679 %
   9680 %  MagickSetImageCompressionQuality() sets the image compression quality.
   9681 %
   9682 %  The format of the MagickSetImageCompressionQuality method is:
   9683 %
   9684 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
   9685 %        const size_t quality)
   9686 %
   9687 %  A description of each parameter follows:
   9688 %
   9689 %    o wand: the magick wand.
   9690 %
   9691 %    o quality: the image compression tlityype.
   9692 %
   9693 */
   9694 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
   9695   const size_t quality)
   9696 {
   9697   assert(wand != (MagickWand *) NULL);
   9698   assert(wand->signature == MagickWandSignature);
   9699   if (wand->debug != MagickFalse)
   9700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9701   if (wand->images == (Image *) NULL)
   9702     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9703   wand->images->quality=quality;
   9704   return(MagickTrue);
   9705 }
   9706 
   9707 /*
   9709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9710 %                                                                             %
   9711 %                                                                             %
   9712 %                                                                             %
   9713 %   M a g i c k S e t I m a g e D e l a y                                     %
   9714 %                                                                             %
   9715 %                                                                             %
   9716 %                                                                             %
   9717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9718 %
   9719 %  MagickSetImageDelay() sets the image delay.
   9720 %
   9721 %  The format of the MagickSetImageDelay method is:
   9722 %
   9723 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
   9724 %        const size_t delay)
   9725 %
   9726 %  A description of each parameter follows:
   9727 %
   9728 %    o wand: the magick wand.
   9729 %
   9730 %    o delay: the image delay in ticks-per-second units.
   9731 %
   9732 */
   9733 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
   9734   const size_t delay)
   9735 {
   9736   assert(wand != (MagickWand *) NULL);
   9737   assert(wand->signature == MagickWandSignature);
   9738   if (wand->debug != MagickFalse)
   9739     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9740   if (wand->images == (Image *) NULL)
   9741     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9742   wand->images->delay=delay;
   9743   return(MagickTrue);
   9744 }
   9745 
   9746 /*
   9748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9749 %                                                                             %
   9750 %                                                                             %
   9751 %                                                                             %
   9752 %   M a g i c k S e t I m a g e D e p t h                                     %
   9753 %                                                                             %
   9754 %                                                                             %
   9755 %                                                                             %
   9756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9757 %
   9758 %  MagickSetImageDepth() sets the image depth.
   9759 %
   9760 %  The format of the MagickSetImageDepth method is:
   9761 %
   9762 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
   9763 %        const size_t depth)
   9764 %
   9765 %  A description of each parameter follows:
   9766 %
   9767 %    o wand: the magick wand.
   9768 %
   9769 %    o depth: the image depth in bits: 8, 16, or 32.
   9770 %
   9771 */
   9772 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
   9773   const size_t depth)
   9774 {
   9775   assert(wand != (MagickWand *) NULL);
   9776   assert(wand->signature == MagickWandSignature);
   9777   if (wand->debug != MagickFalse)
   9778     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9779   if (wand->images == (Image *) NULL)
   9780     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9781   return(SetImageDepth(wand->images,depth,wand->exception));
   9782 }
   9783 
   9784 /*
   9786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9787 %                                                                             %
   9788 %                                                                             %
   9789 %                                                                             %
   9790 %   M a g i c k S e t I m a g e D i s p o s e                                 %
   9791 %                                                                             %
   9792 %                                                                             %
   9793 %                                                                             %
   9794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9795 %
   9796 %  MagickSetImageDispose() sets the image disposal method.
   9797 %
   9798 %  The format of the MagickSetImageDispose method is:
   9799 %
   9800 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
   9801 %        const DisposeType dispose)
   9802 %
   9803 %  A description of each parameter follows:
   9804 %
   9805 %    o wand: the magick wand.
   9806 %
   9807 %    o dispose: the image disposeal type.
   9808 %
   9809 */
   9810 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
   9811   const DisposeType dispose)
   9812 {
   9813   assert(wand != (MagickWand *) NULL);
   9814   assert(wand->signature == MagickWandSignature);
   9815   if (wand->debug != MagickFalse)
   9816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9817   if (wand->images == (Image *) NULL)
   9818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9819   wand->images->dispose=dispose;
   9820   return(MagickTrue);
   9821 }
   9822 
   9823 /*
   9825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9826 %                                                                             %
   9827 %                                                                             %
   9828 %                                                                             %
   9829 %   M a g i c k S e t I m a g e E n d i a n                                   %
   9830 %                                                                             %
   9831 %                                                                             %
   9832 %                                                                             %
   9833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9834 %
   9835 %  MagickSetImageEndian() sets the image endian method.
   9836 %
   9837 %  The format of the MagickSetImageEndian method is:
   9838 %
   9839 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
   9840 %        const EndianType endian)
   9841 %
   9842 %  A description of each parameter follows:
   9843 %
   9844 %    o wand: the magick wand.
   9845 %
   9846 %    o endian: the image endian type.
   9847 %
   9848 */
   9849 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
   9850   const EndianType endian)
   9851 {
   9852   assert(wand != (MagickWand *) NULL);
   9853   assert(wand->signature == MagickWandSignature);
   9854   if (wand->debug != MagickFalse)
   9855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9856   if (wand->images == (Image *) NULL)
   9857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9858   wand->images->endian=endian;
   9859   return(MagickTrue);
   9860 }
   9861 
   9862 /*
   9864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9865 %                                                                             %
   9866 %                                                                             %
   9867 %                                                                             %
   9868 %   M a g i c k S e t I m a g e E x t e n t                                   %
   9869 %                                                                             %
   9870 %                                                                             %
   9871 %                                                                             %
   9872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9873 %
   9874 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
   9875 %
   9876 %  The format of the MagickSetImageExtent method is:
   9877 %
   9878 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
   9879 %        const size_t columns,const unsigned rows)
   9880 %
   9881 %  A description of each parameter follows:
   9882 %
   9883 %    o wand: the magick wand.
   9884 %
   9885 %    o columns:  The image width in pixels.
   9886 %
   9887 %    o rows:  The image height in pixels.
   9888 %
   9889 */
   9890 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
   9891   const size_t columns,const size_t rows)
   9892 {
   9893   assert(wand != (MagickWand *) NULL);
   9894   assert(wand->signature == MagickWandSignature);
   9895   if (wand->debug != MagickFalse)
   9896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9897   if (wand->images == (Image *) NULL)
   9898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9899   return(SetImageExtent(wand->images,columns,rows,wand->exception));
   9900 }
   9901 
   9902 /*
   9904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9905 %                                                                             %
   9906 %                                                                             %
   9907 %                                                                             %
   9908 %   M a g i c k S e t I m a g e F i l e n a m e                               %
   9909 %                                                                             %
   9910 %                                                                             %
   9911 %                                                                             %
   9912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9913 %
   9914 %  MagickSetImageFilename() sets the filename of a particular image in a
   9915 %  sequence.
   9916 %
   9917 %  The format of the MagickSetImageFilename method is:
   9918 %
   9919 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
   9920 %        const char *filename)
   9921 %
   9922 %  A description of each parameter follows:
   9923 %
   9924 %    o wand: the magick wand.
   9925 %
   9926 %    o filename: the image filename.
   9927 %
   9928 */
   9929 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
   9930   const char *filename)
   9931 {
   9932   assert(wand != (MagickWand *) NULL);
   9933   assert(wand->signature == MagickWandSignature);
   9934   if (wand->debug != MagickFalse)
   9935     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9936   if (wand->images == (Image *) NULL)
   9937     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9938   if (filename != (const char *) NULL)
   9939     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
   9940   return(MagickTrue);
   9941 }
   9942 
   9943 /*
   9945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9946 %                                                                             %
   9947 %                                                                             %
   9948 %                                                                             %
   9949 %   M a g i c k S e t I m a g e F o r m a t                                   %
   9950 %                                                                             %
   9951 %                                                                             %
   9952 %                                                                             %
   9953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9954 %
   9955 %  MagickSetImageFormat() sets the format of a particular image in a
   9956 %  sequence.
   9957 %
   9958 %  The format of the MagickSetImageFormat method is:
   9959 %
   9960 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
   9961 %        const char *format)
   9962 %
   9963 %  A description of each parameter follows:
   9964 %
   9965 %    o wand: the magick wand.
   9966 %
   9967 %    o format: the image format.
   9968 %
   9969 */
   9970 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
   9971   const char *format)
   9972 {
   9973   const MagickInfo
   9974     *magick_info;
   9975 
   9976   assert(wand != (MagickWand *) NULL);
   9977   assert(wand->signature == MagickWandSignature);
   9978   if (wand->debug != MagickFalse)
   9979     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9980   if (wand->images == (Image *) NULL)
   9981     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9982   if ((format == (char *) NULL) || (*format == '\0'))
   9983     {
   9984       *wand->images->magick='\0';
   9985       return(MagickTrue);
   9986     }
   9987   magick_info=GetMagickInfo(format,wand->exception);
   9988   if (magick_info == (const MagickInfo *) NULL)
   9989     return(MagickFalse);
   9990   ClearMagickException(wand->exception);
   9991   (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
   9992   return(MagickTrue);
   9993 }
   9994 
   9995 /*
   9997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9998 %                                                                             %
   9999 %                                                                             %
   10000 %                                                                             %
   10001 %   M a g i c k S e t I m a g e F u z z                                       %
   10002 %                                                                             %
   10003 %                                                                             %
   10004 %                                                                             %
   10005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10006 %
   10007 %  MagickSetImageFuzz() sets the image fuzz.
   10008 %
   10009 %  The format of the MagickSetImageFuzz method is:
   10010 %
   10011 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
   10012 %        const double fuzz)
   10013 %
   10014 %  A description of each parameter follows:
   10015 %
   10016 %    o wand: the magick wand.
   10017 %
   10018 %    o fuzz: the image fuzz.
   10019 %
   10020 */
   10021 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
   10022   const double fuzz)
   10023 {
   10024   assert(wand != (MagickWand *) NULL);
   10025   assert(wand->signature == MagickWandSignature);
   10026   if (wand->debug != MagickFalse)
   10027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10028   if (wand->images == (Image *) NULL)
   10029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10030   wand->images->fuzz=fuzz;
   10031   return(MagickTrue);
   10032 }
   10033 
   10034 /*
   10036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10037 %                                                                             %
   10038 %                                                                             %
   10039 %                                                                             %
   10040 %   M a g i c k S e t I m a g e G a m m a                                     %
   10041 %                                                                             %
   10042 %                                                                             %
   10043 %                                                                             %
   10044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10045 %
   10046 %  MagickSetImageGamma() sets the image gamma.
   10047 %
   10048 %  The format of the MagickSetImageGamma method is:
   10049 %
   10050 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
   10051 %        const double gamma)
   10052 %
   10053 %  A description of each parameter follows:
   10054 %
   10055 %    o wand: the magick wand.
   10056 %
   10057 %    o gamma: the image gamma.
   10058 %
   10059 */
   10060 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
   10061   const double gamma)
   10062 {
   10063   assert(wand != (MagickWand *) NULL);
   10064   assert(wand->signature == MagickWandSignature);
   10065   if (wand->debug != MagickFalse)
   10066     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10067   if (wand->images == (Image *) NULL)
   10068     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10069   wand->images->gamma=gamma;
   10070   return(MagickTrue);
   10071 }
   10072 
   10073 /*
   10075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10076 %                                                                             %
   10077 %                                                                             %
   10078 %                                                                             %
   10079 %   M a g i c k S e t I m a g e G r a v i t y                                 %
   10080 %                                                                             %
   10081 %                                                                             %
   10082 %                                                                             %
   10083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10084 %
   10085 %  MagickSetImageGravity() sets the image gravity type.
   10086 %
   10087 %  The format of the MagickSetImageGravity method is:
   10088 %
   10089 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
   10090 %        const GravityType gravity)
   10091 %
   10092 %  A description of each parameter follows:
   10093 %
   10094 %    o wand: the magick wand.
   10095 %
   10096 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
   10097 %               NorthEastGravity, WestGravity, CenterGravity,
   10098 %               EastGravity, SouthWestGravity, SouthGravity,
   10099 %               SouthEastGravity)
   10100 %
   10101 */
   10102 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
   10103   const GravityType gravity)
   10104 {
   10105   assert(wand != (MagickWand *) NULL);
   10106   assert(wand->signature == MagickWandSignature);
   10107   if (wand->debug != MagickFalse)
   10108     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10109   if (wand->images == (Image *) NULL)
   10110     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10111   wand->images->gravity=gravity;
   10112   return(MagickTrue);
   10113 }
   10114 
   10115 /*
   10117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10118 %                                                                             %
   10119 %                                                                             %
   10120 %                                                                             %
   10121 %   M a g i c k S e t I m a g e G r e e n P r i m a r y                       %
   10122 %                                                                             %
   10123 %                                                                             %
   10124 %                                                                             %
   10125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10126 %
   10127 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
   10128 %  point.
   10129 %
   10130 %  The format of the MagickSetImageGreenPrimary method is:
   10131 %
   10132 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
   10133 %        const double x,const double y,const double z)
   10134 %
   10135 %  A description of each parameter follows:
   10136 %
   10137 %    o wand: the magick wand.
   10138 %
   10139 %    o x: the green primary x-point.
   10140 %
   10141 %    o y: the green primary y-point.
   10142 %
   10143 %    o z: the green primary z-point.
   10144 %
   10145 */
   10146 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
   10147   const double x,const double y,const double z)
   10148 {
   10149   assert(wand != (MagickWand *) NULL);
   10150   assert(wand->signature == MagickWandSignature);
   10151   if (wand->debug != MagickFalse)
   10152     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10153   if (wand->images == (Image *) NULL)
   10154     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10155   wand->images->chromaticity.green_primary.x=x;
   10156   wand->images->chromaticity.green_primary.y=y;
   10157   wand->images->chromaticity.green_primary.z=z;
   10158   return(MagickTrue);
   10159 }
   10160 
   10161 /*
   10163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10164 %                                                                             %
   10165 %                                                                             %
   10166 %                                                                             %
   10167 %   M a g i c k S e t I m a g e I n t e r l a c e S c h e m e                 %
   10168 %                                                                             %
   10169 %                                                                             %
   10170 %                                                                             %
   10171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10172 %
   10173 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
   10174 %
   10175 %  The format of the MagickSetImageInterlaceScheme method is:
   10176 %
   10177 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
   10178 %        const InterlaceType interlace)
   10179 %
   10180 %  A description of each parameter follows:
   10181 %
   10182 %    o wand: the magick wand.
   10183 %
   10184 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
   10185 %      PlaneInterlace, PartitionInterlace.
   10186 %
   10187 */
   10188 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
   10189   const InterlaceType interlace)
   10190 {
   10191   assert(wand != (MagickWand *) NULL);
   10192   assert(wand->signature == MagickWandSignature);
   10193   if (wand->debug != MagickFalse)
   10194     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10195   if (wand->images == (Image *) NULL)
   10196     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10197   wand->images->interlace=interlace;
   10198   return(MagickTrue);
   10199 }
   10200 
   10201 /*
   10203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10204 %                                                                             %
   10205 %                                                                             %
   10206 %                                                                             %
   10207 %   M a g i c k S e t I m a g e I n t e r p o l a t e M e t h o d             %
   10208 %                                                                             %
   10209 %                                                                             %
   10210 %                                                                             %
   10211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10212 %
   10213 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
   10214 %
   10215 %  The format of the MagickSetImageInterpolateMethod method is:
   10216 %
   10217 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
   10218 %        const PixelInterpolateMethod method)
   10219 %
   10220 %  A description of each parameter follows:
   10221 %
   10222 %    o wand: the magick wand.
   10223 %
   10224 %    o method: the image interpole pixel methods: choose from Undefined,
   10225 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
   10226 %
   10227 */
   10228 
   10229 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
   10230   MagickWand *wand,const PixelInterpolateMethod method)
   10231 {
   10232   return(MagickSetImageInterpolateMethod(wand,method));
   10233 }
   10234 
   10235 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
   10236   MagickWand *wand,const PixelInterpolateMethod method)
   10237 {
   10238   assert(wand != (MagickWand *) NULL);
   10239   assert(wand->signature == MagickWandSignature);
   10240   if (wand->debug != MagickFalse)
   10241     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10242   if (wand->images == (Image *) NULL)
   10243     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10244   wand->images->interpolate=method;
   10245   return(MagickTrue);
   10246 }
   10247 
   10248 /*
   10250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10251 %                                                                             %
   10252 %                                                                             %
   10253 %                                                                             %
   10254 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
   10255 %                                                                             %
   10256 %                                                                             %
   10257 %                                                                             %
   10258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10259 %
   10260 %  MagickSetImageIterations() sets the image iterations.
   10261 %
   10262 %  The format of the MagickSetImageIterations method is:
   10263 %
   10264 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
   10265 %        const size_t iterations)
   10266 %
   10267 %  A description of each parameter follows:
   10268 %
   10269 %    o wand: the magick wand.
   10270 %
   10271 %    o delay: the image delay in 1/100th of a second.
   10272 %
   10273 */
   10274 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
   10275   const size_t iterations)
   10276 {
   10277   assert(wand != (MagickWand *) NULL);
   10278   assert(wand->signature == MagickWandSignature);
   10279   if (wand->debug != MagickFalse)
   10280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10281   if (wand->images == (Image *) NULL)
   10282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10283   wand->images->iterations=iterations;
   10284   return(MagickTrue);
   10285 }
   10286 
   10287 /*
   10289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10290 %                                                                             %
   10291 %                                                                             %
   10292 %                                                                             %
   10293 %   M a g i c k S e t I m a g e M a t t e                                     %
   10294 %                                                                             %
   10295 %                                                                             %
   10296 %                                                                             %
   10297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10298 %
   10299 %  MagickSetImageMatte() sets the image matte channel.
   10300 %
   10301 %  The format of the MagickSetImageMatte method is:
   10302 %
   10303 %      MagickBooleanType MagickSetImageMatte(MagickWand *wand,
   10304 %        const MagickBooleanType *matte)
   10305 %
   10306 %  A description of each parameter follows:
   10307 %
   10308 %    o wand: the magick wand.
   10309 %
   10310 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
   10311 %      MagickFalse.
   10312 %
   10313 */
   10314 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
   10315   const MagickBooleanType matte)
   10316 {
   10317   assert(wand != (MagickWand *) NULL);
   10318   assert(wand->signature == MagickWandSignature);
   10319   if (wand->debug != MagickFalse)
   10320     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10321   if (wand->images == (Image *) NULL)
   10322     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10323   if (matte == MagickFalse)
   10324     wand->images->alpha_trait=UndefinedPixelTrait;
   10325   else
   10326     {
   10327       if (wand->images->alpha_trait == UndefinedPixelTrait)
   10328         (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
   10329       wand->images->alpha_trait=BlendPixelTrait;
   10330     }
   10331   return(MagickTrue);
   10332 }
   10333 
   10334 /*
   10336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10337 %                                                                             %
   10338 %                                                                             %
   10339 %                                                                             %
   10340 %   M a g i c k S e t I m a g e O p a c i t y                                 %
   10341 %                                                                             %
   10342 %                                                                             %
   10343 %                                                                             %
   10344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10345 %
   10346 %  MagickSetImageAlpha() sets the image to the specified alpha level.
   10347 %
   10348 %  The format of the MagickSetImageAlpha method is:
   10349 %
   10350 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
   10351 %        const double alpha)
   10352 %
   10353 %  A description of each parameter follows:
   10354 %
   10355 %    o wand: the magick wand.
   10356 %
   10357 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
   10358 %      transparent.
   10359 %
   10360 */
   10361 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
   10362   const double alpha)
   10363 {
   10364   MagickBooleanType
   10365     status;
   10366 
   10367   assert(wand != (MagickWand *) NULL);
   10368   assert(wand->signature == MagickWandSignature);
   10369   if (wand->debug != MagickFalse)
   10370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10371   if (wand->images == (Image *) NULL)
   10372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10373   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
   10374     wand->exception);
   10375   return(status);
   10376 }
   10377 
   10378 /*
   10380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10381 %                                                                             %
   10382 %                                                                             %
   10383 %                                                                             %
   10384 %   M a g i c k S e t I m a g e O r i e n t a t i o n                         %
   10385 %                                                                             %
   10386 %                                                                             %
   10387 %                                                                             %
   10388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10389 %
   10390 %  MagickSetImageOrientation() sets the image orientation.
   10391 %
   10392 %  The format of the MagickSetImageOrientation method is:
   10393 %
   10394 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
   10395 %        const OrientationType orientation)
   10396 %
   10397 %  A description of each parameter follows:
   10398 %
   10399 %    o wand: the magick wand.
   10400 %
   10401 %    o orientation: the image orientation type.
   10402 %
   10403 */
   10404 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
   10405   const OrientationType orientation)
   10406 {
   10407   assert(wand != (MagickWand *) NULL);
   10408   assert(wand->signature == MagickWandSignature);
   10409   if (wand->debug != MagickFalse)
   10410     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10411   if (wand->images == (Image *) NULL)
   10412     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10413   wand->images->orientation=orientation;
   10414   return(MagickTrue);
   10415 }
   10416 
   10417 /*
   10419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10420 %                                                                             %
   10421 %                                                                             %
   10422 %                                                                             %
   10423 %   M a g i c k S e t I m a g e P a g e                                       %
   10424 %                                                                             %
   10425 %                                                                             %
   10426 %                                                                             %
   10427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10428 %
   10429 %  MagickSetImagePage() sets the page geometry of the image.
   10430 %
   10431 %  The format of the MagickSetImagePage method is:
   10432 %
   10433 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
   10434 %
   10435 %  A description of each parameter follows:
   10436 %
   10437 %    o wand: the magick wand.
   10438 %
   10439 %    o width: the page width.
   10440 %
   10441 %    o height: the page height.
   10442 %
   10443 %    o x: the page x-offset.
   10444 %
   10445 %    o y: the page y-offset.
   10446 %
   10447 */
   10448 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
   10449   const size_t width,const size_t height,const ssize_t x,
   10450   const ssize_t y)
   10451 {
   10452   assert(wand != (MagickWand *) NULL);
   10453   assert(wand->signature == MagickWandSignature);
   10454   if (wand->debug != MagickFalse)
   10455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10456   if (wand->images == (Image *) NULL)
   10457     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10458   wand->images->page.width=width;
   10459   wand->images->page.height=height;
   10460   wand->images->page.x=x;
   10461   wand->images->page.y=y;
   10462   return(MagickTrue);
   10463 }
   10464 
   10465 /*
   10467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10468 %                                                                             %
   10469 %                                                                             %
   10470 %                                                                             %
   10471 %   M a g i c k S e t I m a g e P r o g r e s s M o n i t o r                 %
   10472 %                                                                             %
   10473 %                                                                             %
   10474 %                                                                             %
   10475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10476 %
   10477 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
   10478 %  specified method and returns the previous progress monitor if any.  The
   10479 %  progress monitor method looks like this:
   10480 %
   10481 %    MagickBooleanType MagickProgressMonitor(const char *text,
   10482 %      const MagickOffsetType offset,const MagickSizeType span,
   10483 %      void *client_data)
   10484 %
   10485 %  If the progress monitor returns MagickFalse, the current operation is
   10486 %  interrupted.
   10487 %
   10488 %  The format of the MagickSetImageProgressMonitor method is:
   10489 %
   10490 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
   10491 %        const MagickProgressMonitor progress_monitor,void *client_data)
   10492 %
   10493 %  A description of each parameter follows:
   10494 %
   10495 %    o wand: the magick wand.
   10496 %
   10497 %    o progress_monitor: Specifies a pointer to a method to monitor progress
   10498 %      of an image operation.
   10499 %
   10500 %    o client_data: Specifies a pointer to any client data.
   10501 %
   10502 */
   10503 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
   10504   const MagickProgressMonitor progress_monitor,void *client_data)
   10505 {
   10506   MagickProgressMonitor
   10507     previous_monitor;
   10508 
   10509   assert(wand != (MagickWand *) NULL);
   10510   assert(wand->signature == MagickWandSignature);
   10511   if (wand->debug != MagickFalse)
   10512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10513   if (wand->images == (Image *) NULL)
   10514     {
   10515       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   10516         "ContainsNoImages","`%s'",wand->name);
   10517       return((MagickProgressMonitor) NULL);
   10518     }
   10519   previous_monitor=SetImageProgressMonitor(wand->images,
   10520     progress_monitor,client_data);
   10521   return(previous_monitor);
   10522 }
   10523 
   10524 /*
   10526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10527 %                                                                             %
   10528 %                                                                             %
   10529 %                                                                             %
   10530 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
   10531 %                                                                             %
   10532 %                                                                             %
   10533 %                                                                             %
   10534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10535 %
   10536 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
   10537 %
   10538 %  The format of the MagickSetImageRedPrimary method is:
   10539 %
   10540 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
   10541 %        const double x,const double y,const double z)
   10542 %
   10543 %  A description of each parameter follows:
   10544 %
   10545 %    o wand: the magick wand.
   10546 %
   10547 %    o x: the red primary x-point.
   10548 %
   10549 %    o y: the red primary y-point.
   10550 %
   10551 %    o z: the red primary z-point.
   10552 %
   10553 */
   10554 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
   10555   const double x,const double y,const double z)
   10556 {
   10557   assert(wand != (MagickWand *) NULL);
   10558   assert(wand->signature == MagickWandSignature);
   10559   if (wand->debug != MagickFalse)
   10560     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10561   if (wand->images == (Image *) NULL)
   10562     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10563   wand->images->chromaticity.red_primary.x=x;
   10564   wand->images->chromaticity.red_primary.y=y;
   10565   wand->images->chromaticity.red_primary.z=z;
   10566   return(MagickTrue);
   10567 }
   10568 
   10569 /*
   10571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10572 %                                                                             %
   10573 %                                                                             %
   10574 %                                                                             %
   10575 %   M a g i c k S e t I m a g e R e n d e r i n g I n t e n t                 %
   10576 %                                                                             %
   10577 %                                                                             %
   10578 %                                                                             %
   10579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10580 %
   10581 %  MagickSetImageRenderingIntent() sets the image rendering intent.
   10582 %
   10583 %  The format of the MagickSetImageRenderingIntent method is:
   10584 %
   10585 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
   10586 %        const RenderingIntent rendering_intent)
   10587 %
   10588 %  A description of each parameter follows:
   10589 %
   10590 %    o wand: the magick wand.
   10591 %
   10592 %    o rendering_intent: the image rendering intent: UndefinedIntent,
   10593 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
   10594 %
   10595 */
   10596 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
   10597   const RenderingIntent rendering_intent)
   10598 {
   10599   assert(wand != (MagickWand *) NULL);
   10600   assert(wand->signature == MagickWandSignature);
   10601   if (wand->debug != MagickFalse)
   10602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10603   if (wand->images == (Image *) NULL)
   10604     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10605   wand->images->rendering_intent=rendering_intent;
   10606   return(MagickTrue);
   10607 }
   10608 
   10609 /*
   10611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10612 %                                                                             %
   10613 %                                                                             %
   10614 %                                                                             %
   10615 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
   10616 %                                                                             %
   10617 %                                                                             %
   10618 %                                                                             %
   10619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10620 %
   10621 %  MagickSetImageResolution() sets the image resolution.
   10622 %
   10623 %  The format of the MagickSetImageResolution method is:
   10624 %
   10625 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
   10626 %        const double x_resolution,const double y_resolution)
   10627 %
   10628 %  A description of each parameter follows:
   10629 %
   10630 %    o wand: the magick wand.
   10631 %
   10632 %    o x_resolution: the image x resolution.
   10633 %
   10634 %    o y_resolution: the image y resolution.
   10635 %
   10636 */
   10637 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
   10638   const double x_resolution,const double y_resolution)
   10639 {
   10640   assert(wand != (MagickWand *) NULL);
   10641   assert(wand->signature == MagickWandSignature);
   10642   if (wand->debug != MagickFalse)
   10643     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10644   if (wand->images == (Image *) NULL)
   10645     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10646   wand->images->resolution.x=x_resolution;
   10647   wand->images->resolution.y=y_resolution;
   10648   return(MagickTrue);
   10649 }
   10650 
   10651 /*
   10653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10654 %                                                                             %
   10655 %                                                                             %
   10656 %                                                                             %
   10657 %   M a g i c k S e t I m a g e S c e n e                                     %
   10658 %                                                                             %
   10659 %                                                                             %
   10660 %                                                                             %
   10661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10662 %
   10663 %  MagickSetImageScene() sets the image scene.
   10664 %
   10665 %  The format of the MagickSetImageScene method is:
   10666 %
   10667 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
   10668 %        const size_t scene)
   10669 %
   10670 %  A description of each parameter follows:
   10671 %
   10672 %    o wand: the magick wand.
   10673 %
   10674 %    o delay: the image scene number.
   10675 %
   10676 */
   10677 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
   10678   const size_t scene)
   10679 {
   10680   assert(wand != (MagickWand *) NULL);
   10681   assert(wand->signature == MagickWandSignature);
   10682   if (wand->debug != MagickFalse)
   10683     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10684   if (wand->images == (Image *) NULL)
   10685     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10686   wand->images->scene=scene;
   10687   return(MagickTrue);
   10688 }
   10689 
   10690 /*
   10692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10693 %                                                                             %
   10694 %                                                                             %
   10695 %                                                                             %
   10696 %   M a g i c k S e t I m a g e T i c k s P e r S e c o n d                   %
   10697 %                                                                             %
   10698 %                                                                             %
   10699 %                                                                             %
   10700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10701 %
   10702 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
   10703 %
   10704 %  The format of the MagickSetImageTicksPerSecond method is:
   10705 %
   10706 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
   10707 %        const ssize_t ticks_per-second)
   10708 %
   10709 %  A description of each parameter follows:
   10710 %
   10711 %    o wand: the magick wand.
   10712 %
   10713 %    o ticks_per_second: the units to use for the image delay.
   10714 %
   10715 */
   10716 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
   10717   const ssize_t ticks_per_second)
   10718 {
   10719   assert(wand != (MagickWand *) NULL);
   10720   assert(wand->signature == MagickWandSignature);
   10721   if (wand->debug != MagickFalse)
   10722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10723   if (wand->images == (Image *) NULL)
   10724     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10725   wand->images->ticks_per_second=ticks_per_second;
   10726   return(MagickTrue);
   10727 }
   10728 
   10729 /*
   10731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10732 %                                                                             %
   10733 %                                                                             %
   10734 %                                                                             %
   10735 %   M a g i c k S e t I m a g e T y p e                                       %
   10736 %                                                                             %
   10737 %                                                                             %
   10738 %                                                                             %
   10739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10740 %
   10741 %  MagickSetImageType() sets the image type.
   10742 %
   10743 %  The format of the MagickSetImageType method is:
   10744 %
   10745 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
   10746 %        const ImageType image_type)
   10747 %
   10748 %  A description of each parameter follows:
   10749 %
   10750 %    o wand: the magick wand.
   10751 %
   10752 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
   10753 %      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
   10754 %      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
   10755 %      or OptimizeType.
   10756 %
   10757 */
   10758 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
   10759   const ImageType image_type)
   10760 {
   10761   assert(wand != (MagickWand *) NULL);
   10762   assert(wand->signature == MagickWandSignature);
   10763   if (wand->debug != MagickFalse)
   10764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10765   if (wand->images == (Image *) NULL)
   10766     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10767   return(SetImageType(wand->images,image_type,wand->exception));
   10768 }
   10769 
   10770 /*
   10772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10773 %                                                                             %
   10774 %                                                                             %
   10775 %                                                                             %
   10776 %   M a g i c k S e t I m a g e U n i t s                                     %
   10777 %                                                                             %
   10778 %                                                                             %
   10779 %                                                                             %
   10780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10781 %
   10782 %  MagickSetImageUnits() sets the image units of resolution.
   10783 %
   10784 %  The format of the MagickSetImageUnits method is:
   10785 %
   10786 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
   10787 %        const ResolutionType units)
   10788 %
   10789 %  A description of each parameter follows:
   10790 %
   10791 %    o wand: the magick wand.
   10792 %
   10793 %    o units: the image units of resolution : UndefinedResolution,
   10794 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
   10795 %
   10796 */
   10797 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
   10798   const ResolutionType units)
   10799 {
   10800   assert(wand != (MagickWand *) NULL);
   10801   assert(wand->signature == MagickWandSignature);
   10802   if (wand->debug != MagickFalse)
   10803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10804   if (wand->images == (Image *) NULL)
   10805     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10806   wand->images->units=units;
   10807   return(MagickTrue);
   10808 }
   10809 
   10810 /*
   10812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10813 %                                                                             %
   10814 %                                                                             %
   10815 %                                                                             %
   10816 %   M a g i c k S e t I m a g e V i r t u a l P i x e l M e t h o d           %
   10817 %                                                                             %
   10818 %                                                                             %
   10819 %                                                                             %
   10820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10821 %
   10822 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
   10823 %
   10824 %  The format of the MagickSetImageVirtualPixelMethod method is:
   10825 %
   10826 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
   10827 %        const VirtualPixelMethod method)
   10828 %
   10829 %  A description of each parameter follows:
   10830 %
   10831 %    o wand: the magick wand.
   10832 %
   10833 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
   10834 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
   10835 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
   10836 %
   10837 */
   10838 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
   10839   const VirtualPixelMethod method)
   10840 {
   10841   assert(wand != (MagickWand *) NULL);
   10842   assert(wand->signature == MagickWandSignature);
   10843   if (wand->debug != MagickFalse)
   10844     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10845   if (wand->images == (Image *) NULL)
   10846     return(UndefinedVirtualPixelMethod);
   10847   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
   10848 }
   10849 
   10850 /*
   10852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10853 %                                                                             %
   10854 %                                                                             %
   10855 %                                                                             %
   10856 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
   10857 %                                                                             %
   10858 %                                                                             %
   10859 %                                                                             %
   10860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10861 %
   10862 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
   10863 %
   10864 %  The format of the MagickSetImageWhitePoint method is:
   10865 %
   10866 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
   10867 %        const double x,const double y,const double z)
   10868 %
   10869 %  A description of each parameter follows:
   10870 %
   10871 %    o wand: the magick wand.
   10872 %
   10873 %    o x: the white x-point.
   10874 %
   10875 %    o y: the white y-point.
   10876 %
   10877 %    o z: the white z-point.
   10878 %
   10879 */
   10880 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
   10881   const double x,const double y,const double z)
   10882 {
   10883   assert(wand != (MagickWand *) NULL);
   10884   assert(wand->signature == MagickWandSignature);
   10885   if (wand->debug != MagickFalse)
   10886     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10887   if (wand->images == (Image *) NULL)
   10888     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10889   wand->images->chromaticity.white_point.x=x;
   10890   wand->images->chromaticity.white_point.y=y;
   10891   wand->images->chromaticity.white_point.z=z;
   10892   return(MagickTrue);
   10893 }
   10894 
   10895 /*
   10897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10898 %                                                                             %
   10899 %                                                                             %
   10900 %                                                                             %
   10901 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
   10902 %                                                                             %
   10903 %                                                                             %
   10904 %                                                                             %
   10905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10906 %
   10907 %  MagickShadeImage() shines a distant light on an image to create a
   10908 %  three-dimensional effect. You control the positioning of the light with
   10909 %  azimuth and elevation; azimuth is measured in degrees off the x axis
   10910 %  and elevation is measured in pixels above the Z axis.
   10911 %
   10912 %  The format of the MagickShadeImage method is:
   10913 %
   10914 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
   10915 %        const MagickBooleanType gray,const double azimuth,
   10916 %        const double elevation)
   10917 %
   10918 %  A description of each parameter follows:
   10919 %
   10920 %    o wand: the magick wand.
   10921 %
   10922 %    o gray: A value other than zero shades the intensity of each pixel.
   10923 %
   10924 %    o azimuth, elevation:  Define the light source direction.
   10925 %
   10926 */
   10927 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
   10928   const MagickBooleanType gray,const double asimuth,const double elevation)
   10929 {
   10930   Image
   10931     *shade_image;
   10932 
   10933   assert(wand != (MagickWand *) NULL);
   10934   assert(wand->signature == MagickWandSignature);
   10935   if (wand->debug != MagickFalse)
   10936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10937   if (wand->images == (Image *) NULL)
   10938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10939   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
   10940   if (shade_image == (Image *) NULL)
   10941     return(MagickFalse);
   10942   ReplaceImageInList(&wand->images,shade_image);
   10943   return(MagickTrue);
   10944 }
   10945 
   10946 /*
   10948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10949 %                                                                             %
   10950 %                                                                             %
   10951 %                                                                             %
   10952 %   M a g i c k S h a d o w I m a g e                                         %
   10953 %                                                                             %
   10954 %                                                                             %
   10955 %                                                                             %
   10956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10957 %
   10958 %  MagickShadowImage() simulates an image shadow.
   10959 %
   10960 %  The format of the MagickShadowImage method is:
   10961 %
   10962 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
   10963 %        const double sigma,const ssize_t x,const ssize_t y)
   10964 %
   10965 %  A description of each parameter follows:
   10966 %
   10967 %    o wand: the magick wand.
   10968 %
   10969 %    o alpha: percentage transparency.
   10970 %
   10971 %    o sigma: the standard deviation of the Gaussian, in pixels.
   10972 %
   10973 %    o x: the shadow x-offset.
   10974 %
   10975 %    o y: the shadow y-offset.
   10976 %
   10977 */
   10978 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
   10979   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
   10980 {
   10981   Image
   10982     *shadow_image;
   10983 
   10984   assert(wand != (MagickWand *) NULL);
   10985   assert(wand->signature == MagickWandSignature);
   10986   if (wand->debug != MagickFalse)
   10987     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10988   if (wand->images == (Image *) NULL)
   10989     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10990   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
   10991   if (shadow_image == (Image *) NULL)
   10992     return(MagickFalse);
   10993   ReplaceImageInList(&wand->images,shadow_image);
   10994   return(MagickTrue);
   10995 }
   10996 
   10997 /*
   10999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11000 %                                                                             %
   11001 %                                                                             %
   11002 %                                                                             %
   11003 %   M a g i c k S h a r p e n I m a g e                                       %
   11004 %                                                                             %
   11005 %                                                                             %
   11006 %                                                                             %
   11007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11008 %
   11009 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
   11010 %  Gaussian operator of the given radius and standard deviation (sigma).
   11011 %  For reasonable results, the radius should be larger than sigma.  Use a
   11012 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
   11013 %
   11014 %  The format of the MagickSharpenImage method is:
   11015 %
   11016 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
   11017 %        const double radius,const double sigma)
   11018 %
   11019 %  A description of each parameter follows:
   11020 %
   11021 %    o wand: the magick wand.
   11022 %
   11023 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   11024 %      pixel.
   11025 %
   11026 %    o sigma: the standard deviation of the Gaussian, in pixels.
   11027 %
   11028 */
   11029 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
   11030   const double radius,const double sigma)
   11031 {
   11032   Image
   11033     *sharp_image;
   11034 
   11035   assert(wand != (MagickWand *) NULL);
   11036   assert(wand->signature == MagickWandSignature);
   11037   if (wand->debug != MagickFalse)
   11038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11039   if (wand->images == (Image *) NULL)
   11040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11041   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
   11042   if (sharp_image == (Image *) NULL)
   11043     return(MagickFalse);
   11044   ReplaceImageInList(&wand->images,sharp_image);
   11045   return(MagickTrue);
   11046 }
   11047 
   11048 /*
   11050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11051 %                                                                             %
   11052 %                                                                             %
   11053 %                                                                             %
   11054 %   M a g i c k S h a v e I m a g e                                           %
   11055 %                                                                             %
   11056 %                                                                             %
   11057 %                                                                             %
   11058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11059 %
   11060 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
   11061 %  memory necessary for the new Image structure and returns a pointer to the
   11062 %  new image.
   11063 %
   11064 %  The format of the MagickShaveImage method is:
   11065 %
   11066 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
   11067 %        const size_t columns,const size_t rows)
   11068 %
   11069 %  A description of each parameter follows:
   11070 %
   11071 %    o wand: the magick wand.
   11072 %
   11073 %    o columns: the number of columns in the scaled image.
   11074 %
   11075 %    o rows: the number of rows in the scaled image.
   11076 %
   11077 %
   11078 */
   11079 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
   11080   const size_t columns,const size_t rows)
   11081 {
   11082   Image
   11083     *shave_image;
   11084 
   11085   RectangleInfo
   11086     shave_info;
   11087 
   11088   assert(wand != (MagickWand *) NULL);
   11089   assert(wand->signature == MagickWandSignature);
   11090   if (wand->debug != MagickFalse)
   11091     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11092   if (wand->images == (Image *) NULL)
   11093     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11094   shave_info.width=columns;
   11095   shave_info.height=rows;
   11096   shave_info.x=0;
   11097   shave_info.y=0;
   11098   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
   11099   if (shave_image == (Image *) NULL)
   11100     return(MagickFalse);
   11101   ReplaceImageInList(&wand->images,shave_image);
   11102   return(MagickTrue);
   11103 }
   11104 
   11105 /*
   11107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11108 %                                                                             %
   11109 %                                                                             %
   11110 %                                                                             %
   11111 %   M a g i c k S h e a r I m a g e                                           %
   11112 %                                                                             %
   11113 %                                                                             %
   11114 %                                                                             %
   11115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11116 %
   11117 %  MagickShearImage() slides one edge of an image along the X or Y axis,
   11118 %  creating a parallelogram.  An X direction shear slides an edge along the X
   11119 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
   11120 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
   11121 %  is measured relative to the Y axis, and similarly, for Y direction shears
   11122 %  y_shear is measured relative to the X axis.  Empty triangles left over from
   11123 %  shearing the image are filled with the background color.
   11124 %
   11125 %  The format of the MagickShearImage method is:
   11126 %
   11127 %      MagickBooleanType MagickShearImage(MagickWand *wand,
   11128 %        const PixelWand *background,const double x_shear,const double y_shear)
   11129 %
   11130 %  A description of each parameter follows:
   11131 %
   11132 %    o wand: the magick wand.
   11133 %
   11134 %    o background: the background pixel wand.
   11135 %
   11136 %    o x_shear: the number of degrees to shear the image.
   11137 %
   11138 %    o y_shear: the number of degrees to shear the image.
   11139 %
   11140 */
   11141 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
   11142   const PixelWand *background,const double x_shear,const double y_shear)
   11143 {
   11144   Image
   11145     *shear_image;
   11146 
   11147   assert(wand != (MagickWand *) NULL);
   11148   assert(wand->signature == MagickWandSignature);
   11149   if (wand->debug != MagickFalse)
   11150     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11151   if (wand->images == (Image *) NULL)
   11152     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11153   PixelGetQuantumPacket(background,&wand->images->background_color);
   11154   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
   11155   if (shear_image == (Image *) NULL)
   11156     return(MagickFalse);
   11157   ReplaceImageInList(&wand->images,shear_image);
   11158   return(MagickTrue);
   11159 }
   11160 
   11161 /*
   11163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11164 %                                                                             %
   11165 %                                                                             %
   11166 %                                                                             %
   11167 %   M a g i c k S i g m o i d a l C o n t r a s t I m a g e                   %
   11168 %                                                                             %
   11169 %                                                                             %
   11170 %                                                                             %
   11171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11172 %
   11173 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
   11174 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
   11175 %  image using a sigmoidal transfer function without saturating highlights or
   11176 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
   11177 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
   11178 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
   11179 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
   11180 %  is reduced.
   11181 %
   11182 %  The format of the MagickSigmoidalContrastImage method is:
   11183 %
   11184 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
   11185 %        const MagickBooleanType sharpen,const double alpha,const double beta)
   11186 %
   11187 %  A description of each parameter follows:
   11188 %
   11189 %    o wand: the magick wand.
   11190 %
   11191 %    o sharpen: Increase or decrease image contrast.
   11192 %
   11193 %    o alpha: strength of the contrast, the larger the number the more
   11194 %      'threshold-like' it becomes.
   11195 %
   11196 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
   11197 %
   11198 */
   11199 WandExport MagickBooleanType MagickSigmoidalContrastImage(
   11200   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
   11201   const double beta)
   11202 {
   11203   MagickBooleanType
   11204     status;
   11205 
   11206   assert(wand != (MagickWand *) NULL);
   11207   assert(wand->signature == MagickWandSignature);
   11208   if (wand->debug != MagickFalse)
   11209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11210   if (wand->images == (Image *) NULL)
   11211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11212   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
   11213     wand->exception);
   11214   return(status);
   11215 }
   11216 
   11217 /*
   11219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11220 %                                                                             %
   11221 %                                                                             %
   11222 %                                                                             %
   11223 %   M a g i c k S i m i l a r i t y I m a g e                                 %
   11224 %                                                                             %
   11225 %                                                                             %
   11226 %                                                                             %
   11227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11228 %
   11229 %  MagickSimilarityImage() compares the reference image of the image and
   11230 %  returns the best match offset.  In addition, it returns a similarity image
   11231 %  such that an exact match location is completely white and if none of the
   11232 %  pixels match, black, otherwise some gray level in-between.
   11233 %
   11234 %  The format of the MagickSimilarityImage method is:
   11235 %
   11236 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
   11237 %        const MagickWand *reference,const MetricType metric,
   11238 %        const double similarity_threshold,RectangeInfo *offset,
   11239 %        double *similarity)
   11240 %
   11241 %  A description of each parameter follows:
   11242 %
   11243 %    o wand: the magick wand.
   11244 %
   11245 %    o reference: the reference wand.
   11246 %
   11247 %    o metric: the metric.
   11248 %
   11249 %    o similarity_threshold: minimum distortion for (sub)image match.
   11250 %
   11251 %    o offset: the best match offset of the reference image within the image.
   11252 %
   11253 %    o similarity: the computed similarity between the images.
   11254 %
   11255 */
   11256 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
   11257   const MagickWand *reference,const MetricType metric,
   11258   const double similarity_threshold,RectangleInfo *offset,double *similarity)
   11259 {
   11260   Image
   11261     *similarity_image;
   11262 
   11263   assert(wand != (MagickWand *) NULL);
   11264   assert(wand->signature == MagickWandSignature);
   11265   if (wand->debug != MagickFalse)
   11266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11267   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   11268     {
   11269       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11270         "ContainsNoImages","`%s'",wand->name);
   11271       return((MagickWand *) NULL);
   11272     }
   11273   similarity_image=SimilarityImage(wand->images,reference->images,metric,
   11274     similarity_threshold,offset,similarity,wand->exception);
   11275   if (similarity_image == (Image *) NULL)
   11276     return((MagickWand *) NULL);
   11277   return(CloneMagickWandFromImages(wand,similarity_image));
   11278 }
   11279 
   11280 /*
   11282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11283 %                                                                             %
   11284 %                                                                             %
   11285 %                                                                             %
   11286 %   M a g i c k S k e t c h I m a g e                                         %
   11287 %                                                                             %
   11288 %                                                                             %
   11289 %                                                                             %
   11290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11291 %
   11292 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
   11293 %  a Gaussian operator of the given radius and standard deviation (sigma).
   11294 %  For reasonable results, radius should be larger than sigma.  Use a
   11295 %  radius of 0 and SketchImage() selects a suitable radius for you.
   11296 %  Angle gives the angle of the blurring motion.
   11297 %
   11298 %  The format of the MagickSketchImage method is:
   11299 %
   11300 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
   11301 %        const double radius,const double sigma,const double angle)
   11302 %
   11303 %  A description of each parameter follows:
   11304 %
   11305 %    o wand: the magick wand.
   11306 %
   11307 %    o radius: the radius of the Gaussian, in pixels, not counting
   11308 %      the center pixel.
   11309 %
   11310 %    o sigma: the standard deviation of the Gaussian, in pixels.
   11311 %
   11312 %    o angle: apply the effect along this angle.
   11313 %
   11314 */
   11315 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
   11316   const double radius,const double sigma,const double angle)
   11317 {
   11318   Image
   11319     *sketch_image;
   11320 
   11321   assert(wand != (MagickWand *) NULL);
   11322   assert(wand->signature == MagickWandSignature);
   11323   if (wand->debug != MagickFalse)
   11324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11325   if (wand->images == (Image *) NULL)
   11326     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11327   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
   11328   if (sketch_image == (Image *) NULL)
   11329     return(MagickFalse);
   11330   ReplaceImageInList(&wand->images,sketch_image);
   11331   return(MagickTrue);
   11332 }
   11333 
   11334 /*
   11336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11337 %                                                                             %
   11338 %                                                                             %
   11339 %                                                                             %
   11340 %   M a g i c k S m u s h I m a g e s                                         %
   11341 %                                                                             %
   11342 %                                                                             %
   11343 %                                                                             %
   11344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11345 %
   11346 %  MagickSmushImages() takes all images from the current image pointer to the
   11347 %  end of the image list and smushs them to each other top-to-bottom if the
   11348 %  stack parameter is true, otherwise left-to-right.
   11349 %
   11350 %  The format of the MagickSmushImages method is:
   11351 %
   11352 %      MagickWand *MagickSmushImages(MagickWand *wand,
   11353 %        const MagickBooleanType stack,const ssize_t offset)
   11354 %
   11355 %  A description of each parameter follows:
   11356 %
   11357 %    o wand: the magick wand.
   11358 %
   11359 %    o stack: By default, images are stacked left-to-right. Set stack to
   11360 %      MagickTrue to stack them top-to-bottom.
   11361 %
   11362 %    o offset: minimum distance in pixels between images.
   11363 %
   11364 */
   11365 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
   11366   const MagickBooleanType stack,const ssize_t offset)
   11367 {
   11368   Image
   11369     *smush_image;
   11370 
   11371   assert(wand != (MagickWand *) NULL);
   11372   assert(wand->signature == MagickWandSignature);
   11373   if (wand->debug != MagickFalse)
   11374     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11375   if (wand->images == (Image *) NULL)
   11376     return((MagickWand *) NULL);
   11377   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
   11378   if (smush_image == (Image *) NULL)
   11379     return((MagickWand *) NULL);
   11380   return(CloneMagickWandFromImages(wand,smush_image));
   11381 }
   11382 
   11383 /*
   11385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11386 %                                                                             %
   11387 %                                                                             %
   11388 %                                                                             %
   11389 %     M a g i c k S o l a r i z e I m a g e                                   %
   11390 %                                                                             %
   11391 %                                                                             %
   11392 %                                                                             %
   11393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11394 %
   11395 %  MagickSolarizeImage() applies a special effect to the image, similar to the
   11396 %  effect achieved in a photo darkroom by selectively exposing areas of photo
   11397 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
   11398 %  measure of the extent of the solarization.
   11399 %
   11400 %  The format of the MagickSolarizeImage method is:
   11401 %
   11402 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
   11403 %        const double threshold)
   11404 %
   11405 %  A description of each parameter follows:
   11406 %
   11407 %    o wand: the magick wand.
   11408 %
   11409 %    o threshold:  Define the extent of the solarization.
   11410 %
   11411 */
   11412 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
   11413   const double threshold)
   11414 {
   11415   MagickBooleanType
   11416     status;
   11417 
   11418   assert(wand != (MagickWand *) NULL);
   11419   assert(wand->signature == MagickWandSignature);
   11420   if (wand->debug != MagickFalse)
   11421     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11422   if (wand->images == (Image *) NULL)
   11423     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11424   status=SolarizeImage(wand->images,threshold,wand->exception);
   11425   return(status);
   11426 }
   11427 
   11428 /*
   11430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11431 %                                                                             %
   11432 %                                                                             %
   11433 %                                                                             %
   11434 %   M a g i c k S p a r s e C o l o r I m a g e                               %
   11435 %                                                                             %
   11436 %                                                                             %
   11437 %                                                                             %
   11438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11439 %
   11440 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
   11441 %  colors found at those coordinates, across the whole image, using various
   11442 %  methods.
   11443 %
   11444 %  The format of the MagickSparseColorImage method is:
   11445 %
   11446 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
   11447 %        const SparseColorMethod method,const size_t number_arguments,
   11448 %        const double *arguments)
   11449 %
   11450 %  A description of each parameter follows:
   11451 %
   11452 %    o image: the image to be sparseed.
   11453 %
   11454 %    o method: the method of image sparseion.
   11455 %
   11456 %        ArcSparseColorion will always ignore source image offset, and always
   11457 %        'bestfit' the destination image with the top left corner offset
   11458 %        relative to the polar mapping center.
   11459 %
   11460 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
   11461 %        style of image sparseion.
   11462 %
   11463 %        Affine, Perspective, and Bilinear, will do least squares fitting of
   11464 %        the distrotion when more than the minimum number of control point
   11465 %        pairs are provided.
   11466 %
   11467 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
   11468 %        less than 4 control point pairs are provided. While Affine sparseions
   11469 %        will let you use any number of control point pairs, that is Zero pairs
   11470 %        is a No-Op (viewport only) distrotion, one pair is a translation and
   11471 %        two pairs of control points will do a scale-rotate-translate, without
   11472 %        any shearing.
   11473 %
   11474 %    o number_arguments: the number of arguments given for this sparseion
   11475 %      method.
   11476 %
   11477 %    o arguments: the arguments for this sparseion method.
   11478 %
   11479 */
   11480 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
   11481   const SparseColorMethod method,const size_t number_arguments,
   11482   const double *arguments)
   11483 {
   11484   Image
   11485     *sparse_image;
   11486 
   11487   assert(wand != (MagickWand *) NULL);
   11488   assert(wand->signature == MagickWandSignature);
   11489   if (wand->debug != MagickFalse)
   11490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11491   if (wand->images == (Image *) NULL)
   11492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11493   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
   11494     wand->exception);
   11495   if (sparse_image == (Image *) NULL)
   11496     return(MagickFalse);
   11497   ReplaceImageInList(&wand->images,sparse_image);
   11498   return(MagickTrue);
   11499 }
   11500 
   11501 /*
   11503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11504 %                                                                             %
   11505 %                                                                             %
   11506 %                                                                             %
   11507 %   M a g i c k S p l i c e I m a g e                                         %
   11508 %                                                                             %
   11509 %                                                                             %
   11510 %                                                                             %
   11511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11512 %
   11513 %  MagickSpliceImage() splices a solid color into the image.
   11514 %
   11515 %  The format of the MagickSpliceImage method is:
   11516 %
   11517 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
   11518 %        const size_t width,const size_t height,const ssize_t x,
   11519 %        const ssize_t y)
   11520 %
   11521 %  A description of each parameter follows:
   11522 %
   11523 %    o wand: the magick wand.
   11524 %
   11525 %    o width: the region width.
   11526 %
   11527 %    o height: the region height.
   11528 %
   11529 %    o x: the region x offset.
   11530 %
   11531 %    o y: the region y offset.
   11532 %
   11533 */
   11534 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
   11535   const size_t width,const size_t height,const ssize_t x,
   11536   const ssize_t y)
   11537 {
   11538   Image
   11539     *splice_image;
   11540 
   11541   RectangleInfo
   11542     splice;
   11543 
   11544   assert(wand != (MagickWand *) NULL);
   11545   assert(wand->signature == MagickWandSignature);
   11546   if (wand->debug != MagickFalse)
   11547     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11548   if (wand->images == (Image *) NULL)
   11549     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11550   splice.width=width;
   11551   splice.height=height;
   11552   splice.x=x;
   11553   splice.y=y;
   11554   splice_image=SpliceImage(wand->images,&splice,wand->exception);
   11555   if (splice_image == (Image *) NULL)
   11556     return(MagickFalse);
   11557   ReplaceImageInList(&wand->images,splice_image);
   11558   return(MagickTrue);
   11559 }
   11560 
   11561 /*
   11563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11564 %                                                                             %
   11565 %                                                                             %
   11566 %                                                                             %
   11567 %   M a g i c k S p r e a d I m a g e                                         %
   11568 %                                                                             %
   11569 %                                                                             %
   11570 %                                                                             %
   11571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11572 %
   11573 %  MagickSpreadImage() is a special effects method that randomly displaces each
   11574 %  pixel in a block defined by the radius parameter.
   11575 %
   11576 %  The format of the MagickSpreadImage method is:
   11577 %
   11578 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,
   11579 %        const PixelInterpolateMethod method,const double radius)
   11580 %
   11581 %  A description of each parameter follows:
   11582 %
   11583 %    o wand: the magick wand.
   11584 %
   11585 %    o method:  intepolation method.
   11586 %
   11587 %    o radius:  Choose a random pixel in a neighborhood of this extent.
   11588 %
   11589 */
   11590 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
   11591   const PixelInterpolateMethod method,const double radius)
   11592 {
   11593   Image
   11594     *spread_image;
   11595 
   11596   assert(wand != (MagickWand *) NULL);
   11597   assert(wand->signature == MagickWandSignature);
   11598   if (wand->debug != MagickFalse)
   11599     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11600   if (wand->images == (Image *) NULL)
   11601     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11602   spread_image=SpreadImage(wand->images,method,radius,wand->exception);
   11603   if (spread_image == (Image *) NULL)
   11604     return(MagickFalse);
   11605   ReplaceImageInList(&wand->images,spread_image);
   11606   return(MagickTrue);
   11607 }
   11608 
   11609 /*
   11611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11612 %                                                                             %
   11613 %                                                                             %
   11614 %                                                                             %
   11615 %   M a g i c k S t a t i s t i c I m a g e                                   %
   11616 %                                                                             %
   11617 %                                                                             %
   11618 %                                                                             %
   11619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11620 %
   11621 %  MagickStatisticImage() replace each pixel with corresponding statistic from
   11622 %  the neighborhood of the specified width and height.
   11623 %
   11624 %  The format of the MagickStatisticImage method is:
   11625 %
   11626 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
   11627 %        const StatisticType type,const double width,const size_t height)
   11628 %
   11629 %  A description of each parameter follows:
   11630 %
   11631 %    o wand: the magick wand.
   11632 %
   11633 %    o type: the statistic type (e.g. median, mode, etc.).
   11634 %
   11635 %    o width: the width of the pixel neighborhood.
   11636 %
   11637 %    o height: the height of the pixel neighborhood.
   11638 %
   11639 */
   11640 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
   11641   const StatisticType type,const size_t width,const size_t height)
   11642 {
   11643   Image
   11644     *statistic_image;
   11645 
   11646   assert(wand != (MagickWand *) NULL);
   11647   assert(wand->signature == MagickWandSignature);
   11648   if (wand->debug != MagickFalse)
   11649     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11650   if (wand->images == (Image *) NULL)
   11651     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11652   statistic_image=StatisticImage(wand->images,type,width,height,
   11653     wand->exception);
   11654   if (statistic_image == (Image *) NULL)
   11655     return(MagickFalse);
   11656   ReplaceImageInList(&wand->images,statistic_image);
   11657   return(MagickTrue);
   11658 }
   11659 
   11660 /*
   11662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11663 %                                                                             %
   11664 %                                                                             %
   11665 %                                                                             %
   11666 %   M a g i c k S t e g a n o I m a g e                                       %
   11667 %                                                                             %
   11668 %                                                                             %
   11669 %                                                                             %
   11670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11671 %
   11672 %  MagickSteganoImage() hides a digital watermark within the image.
   11673 %  Recover the hidden watermark later to prove that the authenticity of
   11674 %  an image.  Offset defines the start position within the image to hide
   11675 %  the watermark.
   11676 %
   11677 %  The format of the MagickSteganoImage method is:
   11678 %
   11679 %      MagickWand *MagickSteganoImage(MagickWand *wand,
   11680 %        const MagickWand *watermark_wand,const ssize_t offset)
   11681 %
   11682 %  A description of each parameter follows:
   11683 %
   11684 %    o wand: the magick wand.
   11685 %
   11686 %    o watermark_wand: the watermark wand.
   11687 %
   11688 %    o offset: Start hiding at this offset into the image.
   11689 %
   11690 */
   11691 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
   11692   const MagickWand *watermark_wand,const ssize_t offset)
   11693 {
   11694   Image
   11695     *stegano_image;
   11696 
   11697   assert(wand != (MagickWand *) NULL);
   11698   assert(wand->signature == MagickWandSignature);
   11699   if (wand->debug != MagickFalse)
   11700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11701   if ((wand->images == (Image *) NULL) ||
   11702       (watermark_wand->images == (Image *) NULL))
   11703     {
   11704       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11705         "ContainsNoImages","`%s'",wand->name);
   11706       return((MagickWand *) NULL);
   11707     }
   11708   wand->images->offset=offset;
   11709   stegano_image=SteganoImage(wand->images,watermark_wand->images,
   11710     wand->exception);
   11711   if (stegano_image == (Image *) NULL)
   11712     return((MagickWand *) NULL);
   11713   return(CloneMagickWandFromImages(wand,stegano_image));
   11714 }
   11715 
   11716 /*
   11718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11719 %                                                                             %
   11720 %                                                                             %
   11721 %                                                                             %
   11722 %   M a g i c k S t e r e o I m a g e                                         %
   11723 %                                                                             %
   11724 %                                                                             %
   11725 %                                                                             %
   11726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11727 %
   11728 %  MagickStereoImage() composites two images and produces a single image that
   11729 %  is the composite of a left and right image of a stereo pair
   11730 %
   11731 %  The format of the MagickStereoImage method is:
   11732 %
   11733 %      MagickWand *MagickStereoImage(MagickWand *wand,
   11734 %        const MagickWand *offset_wand)
   11735 %
   11736 %  A description of each parameter follows:
   11737 %
   11738 %    o wand: the magick wand.
   11739 %
   11740 %    o offset_wand: Another image wand.
   11741 %
   11742 */
   11743 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
   11744   const MagickWand *offset_wand)
   11745 {
   11746   Image
   11747     *stereo_image;
   11748 
   11749   assert(wand != (MagickWand *) NULL);
   11750   assert(wand->signature == MagickWandSignature);
   11751   if (wand->debug != MagickFalse)
   11752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11753   if ((wand->images == (Image *) NULL) ||
   11754       (offset_wand->images == (Image *) NULL))
   11755     {
   11756       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11757         "ContainsNoImages","`%s'",wand->name);
   11758       return((MagickWand *) NULL);
   11759     }
   11760   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
   11761   if (stereo_image == (Image *) NULL)
   11762     return((MagickWand *) NULL);
   11763   return(CloneMagickWandFromImages(wand,stereo_image));
   11764 }
   11765 
   11766 /*
   11768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11769 %                                                                             %
   11770 %                                                                             %
   11771 %                                                                             %
   11772 %   M a g i c k S t r i p I m a g e                                           %
   11773 %                                                                             %
   11774 %                                                                             %
   11775 %                                                                             %
   11776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11777 %
   11778 %  MagickStripImage() strips an image of all profiles and comments.
   11779 %
   11780 %  The format of the MagickStripImage method is:
   11781 %
   11782 %      MagickBooleanType MagickStripImage(MagickWand *wand)
   11783 %
   11784 %  A description of each parameter follows:
   11785 %
   11786 %    o wand: the magick wand.
   11787 %
   11788 */
   11789 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
   11790 {
   11791   assert(wand != (MagickWand *) NULL);
   11792   assert(wand->signature == MagickWandSignature);
   11793   if (wand->debug != MagickFalse)
   11794     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11795   if (wand->images == (Image *) NULL)
   11796     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11797   return(StripImage(wand->images,wand->exception));
   11798 }
   11799 
   11800 /*
   11802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11803 %                                                                             %
   11804 %                                                                             %
   11805 %                                                                             %
   11806 %   M a g i c k S w i r l I m a g e                                           %
   11807 %                                                                             %
   11808 %                                                                             %
   11809 %                                                                             %
   11810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11811 %
   11812 %  MagickSwirlImage() swirls the pixels about the center of the image, where
   11813 %  degrees indicates the sweep of the arc through which each pixel is moved.
   11814 %  You get a more dramatic effect as the degrees move from 1 to 360.
   11815 %
   11816 %  The format of the MagickSwirlImage method is:
   11817 %
   11818 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
   11819 %        const PixelInterpolateMethod method)
   11820 %
   11821 %  A description of each parameter follows:
   11822 %
   11823 %    o wand: the magick wand.
   11824 %
   11825 %    o degrees: Define the tightness of the swirling effect.
   11826 %
   11827 %    o method: the pixel interpolation method.
   11828 %
   11829 */
   11830 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
   11831   const double degrees,const PixelInterpolateMethod method)
   11832 {
   11833   Image
   11834     *swirl_image;
   11835 
   11836   assert(wand != (MagickWand *) NULL);
   11837   assert(wand->signature == MagickWandSignature);
   11838   if (wand->debug != MagickFalse)
   11839     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11840   if (wand->images == (Image *) NULL)
   11841     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11842   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
   11843   if (swirl_image == (Image *) NULL)
   11844     return(MagickFalse);
   11845   ReplaceImageInList(&wand->images,swirl_image);
   11846   return(MagickTrue);
   11847 }
   11848 
   11849 /*
   11851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11852 %                                                                             %
   11853 %                                                                             %
   11854 %                                                                             %
   11855 %   M a g i c k T e x t u r e I m a g e                                       %
   11856 %                                                                             %
   11857 %                                                                             %
   11858 %                                                                             %
   11859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11860 %
   11861 %  MagickTextureImage() repeatedly tiles the texture image across and down the
   11862 %  image canvas.
   11863 %
   11864 %  The format of the MagickTextureImage method is:
   11865 %
   11866 %      MagickWand *MagickTextureImage(MagickWand *wand,
   11867 %        const MagickWand *texture_wand)
   11868 %
   11869 %  A description of each parameter follows:
   11870 %
   11871 %    o wand: the magick wand.
   11872 %
   11873 %    o texture_wand: the texture wand
   11874 %
   11875 */
   11876 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
   11877   const MagickWand *texture_wand)
   11878 {
   11879   Image
   11880     *texture_image;
   11881 
   11882   MagickBooleanType
   11883     status;
   11884 
   11885   assert(wand != (MagickWand *) NULL);
   11886   assert(wand->signature == MagickWandSignature);
   11887   if (wand->debug != MagickFalse)
   11888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11889   if ((wand->images == (Image *) NULL) ||
   11890       (texture_wand->images == (Image *) NULL))
   11891     {
   11892       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11893         "ContainsNoImages","`%s'",wand->name);
   11894       return((MagickWand *) NULL);
   11895     }
   11896   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   11897   if (texture_image == (Image *) NULL)
   11898     return((MagickWand *) NULL);
   11899   status=TextureImage(texture_image,texture_wand->images,wand->exception);
   11900   if (status == MagickFalse)
   11901     {
   11902       texture_image=DestroyImage(texture_image);
   11903       return((MagickWand *) NULL);
   11904     }
   11905   return(CloneMagickWandFromImages(wand,texture_image));
   11906 }
   11907 
   11908 /*
   11910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11911 %                                                                             %
   11912 %                                                                             %
   11913 %                                                                             %
   11914 %   M a g i c k T h r e s h o l d I m a g e                                   %
   11915 %                                                                             %
   11916 %                                                                             %
   11917 %                                                                             %
   11918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11919 %
   11920 %  MagickThresholdImage() changes the value of individual pixels based on
   11921 %  the intensity of each pixel compared to threshold.  The result is a
   11922 %  high-contrast, two color image.
   11923 %
   11924 %  The format of the MagickThresholdImage method is:
   11925 %
   11926 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
   11927 %        const double threshold)
   11928 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
   11929 %        const ChannelType channel,const double threshold)
   11930 %
   11931 %  A description of each parameter follows:
   11932 %
   11933 %    o wand: the magick wand.
   11934 %
   11935 %    o channel: the image channel(s).
   11936 %
   11937 %    o threshold: Define the threshold value.
   11938 %
   11939 */
   11940 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
   11941   const double threshold)
   11942 {
   11943   MagickBooleanType
   11944     status;
   11945 
   11946   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
   11947   return(status);
   11948 }
   11949 
   11950 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
   11951   const ChannelType channel,const double threshold)
   11952 {
   11953   MagickBooleanType
   11954     status;
   11955 
   11956   assert(wand != (MagickWand *) NULL);
   11957   assert(wand->signature == MagickWandSignature);
   11958   if (wand->debug != MagickFalse)
   11959     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11960   if (wand->images == (Image *) NULL)
   11961     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11962   status=BilevelImage(wand->images,threshold,wand->exception);
   11963   return(status);
   11964 }
   11965 
   11966 /*
   11968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11969 %                                                                             %
   11970 %                                                                             %
   11971 %                                                                             %
   11972 %   M a g i c k T h u m b n a i l I m a g e                                   %
   11973 %                                                                             %
   11974 %                                                                             %
   11975 %                                                                             %
   11976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11977 %
   11978 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
   11979 %  and removes any associated profiles.  The goal is to produce small low cost
   11980 %  thumbnail images suited for display on the Web.
   11981 %
   11982 %  The format of the MagickThumbnailImage method is:
   11983 %
   11984 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
   11985 %        const size_t columns,const size_t rows)
   11986 %
   11987 %  A description of each parameter follows:
   11988 %
   11989 %    o wand: the magick wand.
   11990 %
   11991 %    o columns: the number of columns in the scaled image.
   11992 %
   11993 %    o rows: the number of rows in the scaled image.
   11994 %
   11995 */
   11996 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
   11997   const size_t columns,const size_t rows)
   11998 {
   11999   Image
   12000     *thumbnail_image;
   12001 
   12002   assert(wand != (MagickWand *) NULL);
   12003   assert(wand->signature == MagickWandSignature);
   12004   if (wand->debug != MagickFalse)
   12005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12006   if (wand->images == (Image *) NULL)
   12007     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12008   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
   12009   if (thumbnail_image == (Image *) NULL)
   12010     return(MagickFalse);
   12011   ReplaceImageInList(&wand->images,thumbnail_image);
   12012   return(MagickTrue);
   12013 }
   12014 
   12015 /*
   12017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12018 %                                                                             %
   12019 %                                                                             %
   12020 %                                                                             %
   12021 %   M a g i c k T i n t I m a g e                                             %
   12022 %                                                                             %
   12023 %                                                                             %
   12024 %                                                                             %
   12025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12026 %
   12027 %  MagickTintImage() applies a color vector to each pixel in the image.  The
   12028 %  length of the vector is 0 for black and white and at its maximum for the
   12029 %  midtones.  The vector weighting function is
   12030 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
   12031 %
   12032 %  The format of the MagickTintImage method is:
   12033 %
   12034 %      MagickBooleanType MagickTintImage(MagickWand *wand,
   12035 %        const PixelWand *tint,const PixelWand *blend)
   12036 %
   12037 %  A description of each parameter follows:
   12038 %
   12039 %    o wand: the magick wand.
   12040 %
   12041 %    o tint: the tint pixel wand.
   12042 %
   12043 %    o alpha: the alpha pixel wand.
   12044 %
   12045 */
   12046 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
   12047   const PixelWand *tint,const PixelWand *blend)
   12048 {
   12049   char
   12050     percent_blend[MagickPathExtent];
   12051 
   12052   Image
   12053     *tint_image;
   12054 
   12055   PixelInfo
   12056     target;
   12057 
   12058   assert(wand != (MagickWand *) NULL);
   12059   assert(wand->signature == MagickWandSignature);
   12060   if (wand->debug != MagickFalse)
   12061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12062   if (wand->images == (Image *) NULL)
   12063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12064   if (wand->images->colorspace != CMYKColorspace)
   12065     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   12066       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
   12067       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   12068       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   12069       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   12070       PixelGetAlphaQuantum(blend)));
   12071   else
   12072     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   12073       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
   12074       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
   12075       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
   12076       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
   12077       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
   12078       PixelGetAlphaQuantum(blend)));
   12079   target=PixelGetPixel(tint);
   12080   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
   12081   if (tint_image == (Image *) NULL)
   12082     return(MagickFalse);
   12083   ReplaceImageInList(&wand->images,tint_image);
   12084   return(MagickTrue);
   12085 }
   12086 
   12087 /*
   12089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12090 %                                                                             %
   12091 %                                                                             %
   12092 %                                                                             %
   12093 %   M a g i c k T r a n s f o r m I m a g e C o l o r s p a c e               %
   12094 %                                                                             %
   12095 %                                                                             %
   12096 %                                                                             %
   12097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12098 %
   12099 %  MagickTransformImageColorspace() transform the image colorspace, setting
   12100 %  the images colorspace while transforming the images data to that
   12101 %  colorspace.
   12102 %
   12103 %  The format of the MagickTransformImageColorspace method is:
   12104 %
   12105 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
   12106 %        const ColorspaceType colorspace)
   12107 %
   12108 %  A description of each parameter follows:
   12109 %
   12110 %    o wand: the magick wand.
   12111 %
   12112 %    o colorspace: the image colorspace:   UndefinedColorspace,
   12113 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
   12114 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
   12115 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
   12116 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
   12117 %      HSLColorspace, HWBColorspace.
   12118 %
   12119 */
   12120 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
   12121   const ColorspaceType colorspace)
   12122 {
   12123   assert(wand != (MagickWand *) NULL);
   12124   assert(wand->signature == MagickWandSignature);
   12125   if (wand->debug != MagickFalse)
   12126     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12127   if (wand->images == (Image *) NULL)
   12128     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12129   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
   12130 }
   12131 
   12132 /*
   12134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12135 %                                                                             %
   12136 %                                                                             %
   12137 %                                                                             %
   12138 %   M a g i c k T r a n s p a r e n t P a i n t I m a g e                     %
   12139 %                                                                             %
   12140 %                                                                             %
   12141 %                                                                             %
   12142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12143 %
   12144 %  MagickTransparentPaintImage() changes any pixel that matches color with the
   12145 %  color defined by fill.
   12146 %
   12147 %  The format of the MagickTransparentPaintImage method is:
   12148 %
   12149 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
   12150 %        const PixelWand *target,const double alpha,const double fuzz,
   12151 %        const MagickBooleanType invert)
   12152 %
   12153 %  A description of each parameter follows:
   12154 %
   12155 %    o wand: the magick wand.
   12156 %
   12157 %    o target: Change this target color to specified alpha value within
   12158 %      the image.
   12159 %
   12160 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
   12161 %      transparent.
   12162 %
   12163 %    o fuzz: By default target must match a particular pixel color
   12164 %      exactly.  However, in many cases two colors may differ by a small amount.
   12165 %      The fuzz member of image defines how much tolerance is acceptable to
   12166 %      consider two colors as the same.  For example, set fuzz to 10 and the
   12167 %      color red at intensities of 100 and 102 respectively are now interpreted
   12168 %      as the same color for the purposes of the floodfill.
   12169 %
   12170 %    o invert: paint any pixel that does not match the target color.
   12171 %
   12172 */
   12173 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
   12174   const PixelWand *target,const double alpha,const double fuzz,
   12175   const MagickBooleanType invert)
   12176 {
   12177   MagickBooleanType
   12178     status;
   12179 
   12180   PixelInfo
   12181     target_pixel;
   12182 
   12183   assert(wand != (MagickWand *) NULL);
   12184   assert(wand->signature == MagickWandSignature);
   12185   if (wand->debug != MagickFalse)
   12186     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12187   if (wand->images == (Image *) NULL)
   12188     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12189   PixelGetMagickColor(target,&target_pixel);
   12190   wand->images->fuzz=fuzz;
   12191   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
   12192     QuantumRange*alpha),invert,wand->exception);
   12193   return(status);
   12194 }
   12195 
   12196 /*
   12198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12199 %                                                                             %
   12200 %                                                                             %
   12201 %                                                                             %
   12202 %   M a g i c k T r a n s p o s e I m a g e                                   %
   12203 %                                                                             %
   12204 %                                                                             %
   12205 %                                                                             %
   12206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12207 %
   12208 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
   12209 %  pixels around the central x-axis while rotating them 90-degrees.
   12210 %
   12211 %  The format of the MagickTransposeImage method is:
   12212 %
   12213 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
   12214 %
   12215 %  A description of each parameter follows:
   12216 %
   12217 %    o wand: the magick wand.
   12218 %
   12219 */
   12220 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
   12221 {
   12222   Image
   12223     *transpose_image;
   12224 
   12225   assert(wand != (MagickWand *) NULL);
   12226   assert(wand->signature == MagickWandSignature);
   12227   if (wand->debug != MagickFalse)
   12228     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12229   if (wand->images == (Image *) NULL)
   12230     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12231   transpose_image=TransposeImage(wand->images,wand->exception);
   12232   if (transpose_image == (Image *) NULL)
   12233     return(MagickFalse);
   12234   ReplaceImageInList(&wand->images,transpose_image);
   12235   return(MagickTrue);
   12236 }
   12237 
   12238 /*
   12240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12241 %                                                                             %
   12242 %                                                                             %
   12243 %                                                                             %
   12244 %   M a g i c k T r a n s v e r s e I m a g e                                 %
   12245 %                                                                             %
   12246 %                                                                             %
   12247 %                                                                             %
   12248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12249 %
   12250 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
   12251 %  pixels around the central y-axis while rotating them 270-degrees.
   12252 %
   12253 %  The format of the MagickTransverseImage method is:
   12254 %
   12255 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
   12256 %
   12257 %  A description of each parameter follows:
   12258 %
   12259 %    o wand: the magick wand.
   12260 %
   12261 */
   12262 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
   12263 {
   12264   Image
   12265     *transverse_image;
   12266 
   12267   assert(wand != (MagickWand *) NULL);
   12268   assert(wand->signature == MagickWandSignature);
   12269   if (wand->debug != MagickFalse)
   12270     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12271   if (wand->images == (Image *) NULL)
   12272     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12273   transverse_image=TransverseImage(wand->images,wand->exception);
   12274   if (transverse_image == (Image *) NULL)
   12275     return(MagickFalse);
   12276   ReplaceImageInList(&wand->images,transverse_image);
   12277   return(MagickTrue);
   12278 }
   12279 
   12280 /*
   12282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12283 %                                                                             %
   12284 %                                                                             %
   12285 %                                                                             %
   12286 %   M a g i c k T r i m I m a g e                                             %
   12287 %                                                                             %
   12288 %                                                                             %
   12289 %                                                                             %
   12290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12291 %
   12292 %  MagickTrimImage() remove edges that are the background color from the image.
   12293 %
   12294 %  The format of the MagickTrimImage method is:
   12295 %
   12296 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
   12297 %
   12298 %  A description of each parameter follows:
   12299 %
   12300 %    o wand: the magick wand.
   12301 %
   12302 %    o fuzz: By default target must match a particular pixel color
   12303 %      exactly.  However, in many cases two colors may differ by a small amount.
   12304 %      The fuzz member of image defines how much tolerance is acceptable to
   12305 %      consider two colors as the same.  For example, set fuzz to 10 and the
   12306 %      color red at intensities of 100 and 102 respectively are now interpreted
   12307 %      as the same color for the purposes of the floodfill.
   12308 %
   12309 */
   12310 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
   12311 {
   12312   Image
   12313     *trim_image;
   12314 
   12315   assert(wand != (MagickWand *) NULL);
   12316   assert(wand->signature == MagickWandSignature);
   12317   if (wand->debug != MagickFalse)
   12318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12319   if (wand->images == (Image *) NULL)
   12320     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12321   wand->images->fuzz=fuzz;
   12322   trim_image=TrimImage(wand->images,wand->exception);
   12323   if (trim_image == (Image *) NULL)
   12324     return(MagickFalse);
   12325   ReplaceImageInList(&wand->images,trim_image);
   12326   return(MagickTrue);
   12327 }
   12328 
   12329 /*
   12331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12332 %                                                                             %
   12333 %                                                                             %
   12334 %                                                                             %
   12335 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
   12336 %                                                                             %
   12337 %                                                                             %
   12338 %                                                                             %
   12339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12340 %
   12341 %  MagickUniqueImageColors() discards all but one of any pixel color.
   12342 %
   12343 %  The format of the MagickUniqueImageColors method is:
   12344 %
   12345 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
   12346 %
   12347 %  A description of each parameter follows:
   12348 %
   12349 %    o wand: the magick wand.
   12350 %
   12351 */
   12352 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
   12353 {
   12354   Image
   12355     *unique_image;
   12356 
   12357   assert(wand != (MagickWand *) NULL);
   12358   assert(wand->signature == MagickWandSignature);
   12359   if (wand->debug != MagickFalse)
   12360     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12361   if (wand->images == (Image *) NULL)
   12362     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12363   unique_image=UniqueImageColors(wand->images,wand->exception);
   12364   if (unique_image == (Image *) NULL)
   12365     return(MagickFalse);
   12366   ReplaceImageInList(&wand->images,unique_image);
   12367   return(MagickTrue);
   12368 }
   12369 
   12370 /*
   12372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12373 %                                                                             %
   12374 %                                                                             %
   12375 %                                                                             %
   12376 %   M a g i c k U n s h a r p M a s k I m a g e                               %
   12377 %                                                                             %
   12378 %                                                                             %
   12379 %                                                                             %
   12380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12381 %
   12382 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
   12383 %  Gaussian operator of the given radius and standard deviation (sigma).
   12384 %  For reasonable results, radius should be larger than sigma.  Use a radius
   12385 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
   12386 %
   12387 %  The format of the MagickUnsharpMaskImage method is:
   12388 %
   12389 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
   12390 %        const double radius,const double sigma,const double gain,
   12391 %        const double threshold)
   12392 %
   12393 %  A description of each parameter follows:
   12394 %
   12395 %    o wand: the magick wand.
   12396 %
   12397 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   12398 %      pixel.
   12399 %
   12400 %    o sigma: the standard deviation of the Gaussian, in pixels.
   12401 %
   12402 %    o gain: the percentage of the difference between the original and the
   12403 %      blur image that is added back into the original.
   12404 %
   12405 %    o threshold: the threshold in pixels needed to apply the diffence gain.
   12406 %
   12407 */
   12408 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
   12409   const double radius,const double sigma,const double gain,
   12410   const double threshold)
   12411 {
   12412   Image
   12413     *unsharp_image;
   12414 
   12415   assert(wand != (MagickWand *) NULL);
   12416   assert(wand->signature == MagickWandSignature);
   12417   if (wand->debug != MagickFalse)
   12418     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12419   if (wand->images == (Image *) NULL)
   12420     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12421   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
   12422     wand->exception);
   12423   if (unsharp_image == (Image *) NULL)
   12424     return(MagickFalse);
   12425   ReplaceImageInList(&wand->images,unsharp_image);
   12426   return(MagickTrue);
   12427 }
   12428 
   12429 /*
   12431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12432 %                                                                             %
   12433 %                                                                             %
   12434 %                                                                             %
   12435 %   M a g i c k V i g n e t t e I m a g e                                     %
   12436 %                                                                             %
   12437 %                                                                             %
   12438 %                                                                             %
   12439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12440 %
   12441 %  MagickVignetteImage() softens the edges of the image in vignette style.
   12442 %
   12443 %  The format of the MagickVignetteImage method is:
   12444 %
   12445 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
   12446 %        const double radius,const double sigma,const ssize_t x,
   12447 %        const ssize_t y)
   12448 %
   12449 %  A description of each parameter follows:
   12450 %
   12451 %    o wand: the magick wand.
   12452 %
   12453 %    o radius: the radius.
   12454 %
   12455 %    o sigma: the sigma.
   12456 %
   12457 %    o x, y:  Define the x and y ellipse offset.
   12458 %
   12459 */
   12460 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
   12461   const double radius,const double sigma,const ssize_t x,const ssize_t y)
   12462 {
   12463   Image
   12464     *vignette_image;
   12465 
   12466   assert(wand != (MagickWand *) NULL);
   12467   assert(wand->signature == MagickWandSignature);
   12468   if (wand->debug != MagickFalse)
   12469     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12470   if (wand->images == (Image *) NULL)
   12471     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12472   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
   12473   if (vignette_image == (Image *) NULL)
   12474     return(MagickFalse);
   12475   ReplaceImageInList(&wand->images,vignette_image);
   12476   return(MagickTrue);
   12477 }
   12478 
   12479 /*
   12481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12482 %                                                                             %
   12483 %                                                                             %
   12484 %                                                                             %
   12485 %   M a g i c k W a v e I m a g e                                             %
   12486 %                                                                             %
   12487 %                                                                             %
   12488 %                                                                             %
   12489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12490 %
   12491 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
   12492 %  the pixels vertically along a sine wave whose amplitude and wavelength
   12493 %  is specified by the given parameters.
   12494 %
   12495 %  The format of the MagickWaveImage method is:
   12496 %
   12497 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
   12498 %        const double amplitude,const double wave_length,
   12499 %        const PixelInterpolateMethod method)
   12500 %
   12501 %  A description of each parameter follows:
   12502 %
   12503 %    o wand: the magick wand.
   12504 %
   12505 %    o amplitude, wave_length:  Define the amplitude and wave length of the
   12506 %      sine wave.
   12507 %
   12508 %    o method: the pixel interpolation method.
   12509 %
   12510 */
   12511 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
   12512   const double amplitude,const double wave_length,
   12513   const PixelInterpolateMethod method)
   12514 {
   12515   Image
   12516     *wave_image;
   12517 
   12518   assert(wand != (MagickWand *) NULL);
   12519   assert(wand->signature == MagickWandSignature);
   12520   if (wand->debug != MagickFalse)
   12521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12522   if (wand->images == (Image *) NULL)
   12523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12524   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
   12525     wand->exception);
   12526   if (wave_image == (Image *) NULL)
   12527     return(MagickFalse);
   12528   ReplaceImageInList(&wand->images,wave_image);
   12529   return(MagickTrue);
   12530 }
   12531 
   12532 /*
   12534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12535 %                                                                             %
   12536 %                                                                             %
   12537 %                                                                             %
   12538 %   M a g i c k W h i t e T h r e s h o l d I m a g e                         %
   12539 %                                                                             %
   12540 %                                                                             %
   12541 %                                                                             %
   12542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12543 %
   12544 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
   12545 %  above the threshold into white while leaving all pixels below the threshold
   12546 %  unchanged.
   12547 %
   12548 %  The format of the MagickWhiteThresholdImage method is:
   12549 %
   12550 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
   12551 %        const PixelWand *threshold)
   12552 %
   12553 %  A description of each parameter follows:
   12554 %
   12555 %    o wand: the magick wand.
   12556 %
   12557 %    o threshold: the pixel wand.
   12558 %
   12559 */
   12560 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
   12561   const PixelWand *threshold)
   12562 {
   12563   char
   12564     thresholds[MagickPathExtent];
   12565 
   12566   assert(wand != (MagickWand *) NULL);
   12567   assert(wand->signature == MagickWandSignature);
   12568   if (wand->debug != MagickFalse)
   12569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12570   if (wand->images == (Image *) NULL)
   12571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12572   (void) FormatLocaleString(thresholds,MagickPathExtent,
   12573     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
   12574     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
   12575     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
   12576   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
   12577 }
   12578 
   12579 /*
   12581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12582 %                                                                             %
   12583 %                                                                             %
   12584 %                                                                             %
   12585 %   M a g i c k W r i t e I m a g e                                           %
   12586 %                                                                             %
   12587 %                                                                             %
   12588 %                                                                             %
   12589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12590 %
   12591 %  MagickWriteImage() writes an image to the specified filename.  If the
   12592 %  filename parameter is NULL, the image is written to the filename set
   12593 %  by MagickReadImage() or MagickSetImageFilename().
   12594 %
   12595 %  The format of the MagickWriteImage method is:
   12596 %
   12597 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
   12598 %        const char *filename)
   12599 %
   12600 %  A description of each parameter follows:
   12601 %
   12602 %    o wand: the magick wand.
   12603 %
   12604 %    o filename: the image filename.
   12605 %
   12606 %
   12607 */
   12608 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
   12609   const char *filename)
   12610 {
   12611   Image
   12612     *image;
   12613 
   12614   ImageInfo
   12615     *write_info;
   12616 
   12617   MagickBooleanType
   12618     status;
   12619 
   12620   assert(wand != (MagickWand *) NULL);
   12621   assert(wand->signature == MagickWandSignature);
   12622   if (wand->debug != MagickFalse)
   12623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12624   if (wand->images == (Image *) NULL)
   12625     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12626   if (filename != (const char *) NULL)
   12627     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
   12628   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   12629   if (image == (Image *) NULL)
   12630     return(MagickFalse);
   12631   write_info=CloneImageInfo(wand->image_info);
   12632   write_info->adjoin=MagickTrue;
   12633   status=WriteImage(write_info,image,wand->exception);
   12634   image=DestroyImage(image);
   12635   write_info=DestroyImageInfo(write_info);
   12636   return(status);
   12637 }
   12638 
   12639 /*
   12641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12642 %                                                                             %
   12643 %                                                                             %
   12644 %                                                                             %
   12645 %   M a g i c k W r i t e I m a g e F i l e                                   %
   12646 %                                                                             %
   12647 %                                                                             %
   12648 %                                                                             %
   12649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12650 %
   12651 %  MagickWriteImageFile() writes an image to an open file descriptor.
   12652 %
   12653 %  The format of the MagickWriteImageFile method is:
   12654 %
   12655 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
   12656 %
   12657 %  A description of each parameter follows:
   12658 %
   12659 %    o wand: the magick wand.
   12660 %
   12661 %    o file: the file descriptor.
   12662 %
   12663 */
   12664 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
   12665 {
   12666   Image
   12667     *image;
   12668 
   12669   ImageInfo
   12670     *write_info;
   12671 
   12672   MagickBooleanType
   12673     status;
   12674 
   12675   assert(wand != (MagickWand *) NULL);
   12676   assert(wand->signature == MagickWandSignature);
   12677   assert(file != (FILE *) NULL);
   12678   if (wand->debug != MagickFalse)
   12679     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12680   if (wand->images == (Image *) NULL)
   12681     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12682   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   12683   if (image == (Image *) NULL)
   12684     return(MagickFalse);
   12685   write_info=CloneImageInfo(wand->image_info);
   12686   SetImageInfoFile(write_info,file);
   12687   write_info->adjoin=MagickTrue;
   12688   status=WriteImage(write_info,image,wand->exception);
   12689   write_info=DestroyImageInfo(write_info);
   12690   image=DestroyImage(image);
   12691   return(status);
   12692 }
   12693 
   12694 /*
   12696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12697 %                                                                             %
   12698 %                                                                             %
   12699 %                                                                             %
   12700 %   M a g i c k W r i t e I m a g e s                                         %
   12701 %                                                                             %
   12702 %                                                                             %
   12703 %                                                                             %
   12704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12705 %
   12706 %  MagickWriteImages() writes an image or image sequence.
   12707 %
   12708 %  The format of the MagickWriteImages method is:
   12709 %
   12710 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
   12711 %        const char *filename,const MagickBooleanType adjoin)
   12712 %
   12713 %  A description of each parameter follows:
   12714 %
   12715 %    o wand: the magick wand.
   12716 %
   12717 %    o filename: the image filename.
   12718 %
   12719 %    o adjoin: join images into a single multi-image file.
   12720 %
   12721 */
   12722 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
   12723   const char *filename,const MagickBooleanType adjoin)
   12724 {
   12725   ImageInfo
   12726     *write_info;
   12727 
   12728   MagickBooleanType
   12729     status;
   12730 
   12731   assert(wand != (MagickWand *) NULL);
   12732   assert(wand->signature == MagickWandSignature);
   12733   if (wand->debug != MagickFalse)
   12734     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12735   if (wand->images == (Image *) NULL)
   12736     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12737   write_info=CloneImageInfo(wand->image_info);
   12738   write_info->adjoin=adjoin;
   12739   status=WriteImages(write_info,wand->images,filename,wand->exception);
   12740   write_info=DestroyImageInfo(write_info);
   12741   return(status);
   12742 }
   12743 
   12744 /*
   12746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12747 %                                                                             %
   12748 %                                                                             %
   12749 %                                                                             %
   12750 %   M a g i c k W r i t e I m a g e s F i l e                                 %
   12751 %                                                                             %
   12752 %                                                                             %
   12753 %                                                                             %
   12754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12755 %
   12756 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
   12757 %
   12758 %  The format of the MagickWriteImagesFile method is:
   12759 %
   12760 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
   12761 %
   12762 %  A description of each parameter follows:
   12763 %
   12764 %    o wand: the magick wand.
   12765 %
   12766 %    o file: the file descriptor.
   12767 %
   12768 */
   12769 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
   12770 {
   12771   ImageInfo
   12772     *write_info;
   12773 
   12774   MagickBooleanType
   12775     status;
   12776 
   12777   assert(wand != (MagickWand *) NULL);
   12778   assert(wand->signature == MagickWandSignature);
   12779   if (wand->debug != MagickFalse)
   12780     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12781   if (wand->images == (Image *) NULL)
   12782     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12783   write_info=CloneImageInfo(wand->image_info);
   12784   SetImageInfoFile(write_info,file);
   12785   write_info->adjoin=MagickTrue;
   12786   status=WriteImages(write_info,wand->images,(const char *) NULL,
   12787     wand->exception);
   12788   write_info=DestroyImageInfo(write_info);
   12789   return(status);
   12790 }
   12791