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-2019 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 %    https://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) memset(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 H E I m a g e                                           %
   1283 %                                                                             %
   1284 %                                                                             %
   1285 %                                                                             %
   1286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1287 %
   1288 %  MagickCLAHEImage() selects an individual threshold for each pixel
   1289 %  based on the range of intensity values in its local neighborhood.  This
   1290 %  allows for thresholding of an image whose global intensity histogram
   1291 %  doesn't contain distinctive peaks.
   1292 %
   1293 %  The format of the CLAHEImage method is:
   1294 %
   1295 %      MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
   1296 %        const size_t height,const double bias,const double sans)
   1297 %
   1298 %  A description of each parameter follows:
   1299 %
   1300 %    o wand: the magick wand.
   1301 %
   1302 %    o width: the width of the local neighborhood.
   1303 %
   1304 %    o height: the height of the local neighborhood.
   1305 %
   1306 %    o offset: the mean bias.
   1307 %
   1308 %    o sans: not used.
   1309 %
   1310 */
   1311 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
   1312   const size_t width,const size_t height,const double bias,const double sans)
   1313 {
   1314   MagickBooleanType
   1315     status;
   1316 
   1317   assert(wand != (MagickWand *) NULL);
   1318   assert(wand->signature == MagickWandSignature);
   1319   if (wand->debug != MagickFalse)
   1320     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1321   if (wand->images == (Image *) NULL)
   1322     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1323   status=CLAHEImage(wand->images,width,height,bias,sans,wand->exception);
   1324   return(status);
   1325 }
   1326 
   1327 /*
   1329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1330 %                                                                             %
   1331 %                                                                             %
   1332 %                                                                             %
   1333 %   M a g i c k C l a m p I m a g e                                           %
   1334 %                                                                             %
   1335 %                                                                             %
   1336 %                                                                             %
   1337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1338 %
   1339 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
   1340 %
   1341 %  The format of the MagickClampImage method is:
   1342 %
   1343 %      MagickBooleanType MagickClampImage(MagickWand *wand)
   1344 %
   1345 %  A description of each parameter follows:
   1346 %
   1347 %    o wand: the magick wand.
   1348 %
   1349 %    o channel: the channel.
   1350 %
   1351 */
   1352 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
   1353 {
   1354   assert(wand != (MagickWand *) NULL);
   1355   assert(wand->signature == MagickWandSignature);
   1356   if (wand->debug != MagickFalse)
   1357     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1358   if (wand->images == (Image *) NULL)
   1359     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1360   return(ClampImage(wand->images,wand->exception));
   1361 }
   1362 
   1363 /*
   1365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1366 %                                                                             %
   1367 %                                                                             %
   1368 %                                                                             %
   1369 %   M a g i c k C l i p I m a g e                                             %
   1370 %                                                                             %
   1371 %                                                                             %
   1372 %                                                                             %
   1373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1374 %
   1375 %  MagickClipImage() clips along the first path from the 8BIM profile, if
   1376 %  present.
   1377 %
   1378 %  The format of the MagickClipImage method is:
   1379 %
   1380 %      MagickBooleanType MagickClipImage(MagickWand *wand)
   1381 %
   1382 %  A description of each parameter follows:
   1383 %
   1384 %    o wand: the magick wand.
   1385 %
   1386 */
   1387 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
   1388 {
   1389   MagickBooleanType
   1390     status;
   1391 
   1392   assert(wand != (MagickWand *) NULL);
   1393   assert(wand->signature == MagickWandSignature);
   1394   if (wand->debug != MagickFalse)
   1395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1396   if (wand->images == (Image *) NULL)
   1397     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1398   status=ClipImage(wand->images,wand->exception);
   1399   return(status);
   1400 }
   1401 
   1402 /*
   1404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1405 %                                                                             %
   1406 %                                                                             %
   1407 %                                                                             %
   1408 %   M a g i c k C l i p I m a g e P a t h                                     %
   1409 %                                                                             %
   1410 %                                                                             %
   1411 %                                                                             %
   1412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1413 %
   1414 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
   1415 %  present. Later operations take effect inside the path.  Id may be a number
   1416 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
   1417 %  path.
   1418 %
   1419 %  The format of the MagickClipImagePath method is:
   1420 %
   1421 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
   1422 %        const char *pathname,const MagickBooleanType inside)
   1423 %
   1424 %  A description of each parameter follows:
   1425 %
   1426 %    o wand: the magick wand.
   1427 %
   1428 %    o pathname: name of clipping path resource. If name is preceded by #, use
   1429 %      clipping path numbered by name.
   1430 %
   1431 %    o inside: if non-zero, later operations take effect inside clipping path.
   1432 %      Otherwise later operations take effect outside clipping path.
   1433 %
   1434 */
   1435 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
   1436   const char *pathname,const MagickBooleanType inside)
   1437 {
   1438   MagickBooleanType
   1439     status;
   1440 
   1441   assert(wand != (MagickWand *) NULL);
   1442   assert(wand->signature == MagickWandSignature);
   1443   if (wand->debug != MagickFalse)
   1444     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1445   if (wand->images == (Image *) NULL)
   1446     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1447   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
   1448   return(status);
   1449 }
   1450 
   1451 /*
   1453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1454 %                                                                             %
   1455 %                                                                             %
   1456 %                                                                             %
   1457 %   M a g i c k C l u t I m a g e                                             %
   1458 %                                                                             %
   1459 %                                                                             %
   1460 %                                                                             %
   1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1462 %
   1463 %  MagickClutImage() replaces colors in the image from a color lookup table.
   1464 %
   1465 %  The format of the MagickClutImage method is:
   1466 %
   1467 %      MagickBooleanType MagickClutImage(MagickWand *wand,
   1468 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
   1469 %
   1470 %  A description of each parameter follows:
   1471 %
   1472 %    o wand: the magick wand.
   1473 %
   1474 %    o clut_image: the clut image.
   1475 %
   1476 %    o method: the pixel interpolation method.
   1477 %
   1478 */
   1479 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
   1480   const MagickWand *clut_wand,const PixelInterpolateMethod method)
   1481 {
   1482   MagickBooleanType
   1483     status;
   1484 
   1485   assert(wand != (MagickWand *) NULL);
   1486   assert(wand->signature == MagickWandSignature);
   1487   if (wand->debug != MagickFalse)
   1488     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1489   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
   1490     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1491   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
   1492   return(status);
   1493 }
   1494 
   1495 /*
   1497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1498 %                                                                             %
   1499 %                                                                             %
   1500 %                                                                             %
   1501 %   M a g i c k C o a l e s c e I m a g e s                                   %
   1502 %                                                                             %
   1503 %                                                                             %
   1504 %                                                                             %
   1505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1506 %
   1507 %  MagickCoalesceImages() composites a set of images while respecting any page
   1508 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
   1509 %  typically start with an image background and each subsequent image
   1510 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
   1511 %  where each image in the sequence is the same size as the first and
   1512 %  composited with the next image in the sequence.
   1513 %
   1514 %  The format of the MagickCoalesceImages method is:
   1515 %
   1516 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
   1517 %
   1518 %  A description of each parameter follows:
   1519 %
   1520 %    o wand: the magick wand.
   1521 %
   1522 */
   1523 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
   1524 {
   1525   Image
   1526     *coalesce_image;
   1527 
   1528   assert(wand != (MagickWand *) NULL);
   1529   assert(wand->signature == MagickWandSignature);
   1530   if (wand->debug != MagickFalse)
   1531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1532   if (wand->images == (Image *) NULL)
   1533     return((MagickWand *) NULL);
   1534   coalesce_image=CoalesceImages(wand->images,wand->exception);
   1535   if (coalesce_image == (Image *) NULL)
   1536     return((MagickWand *) NULL);
   1537   return(CloneMagickWandFromImages(wand,coalesce_image));
   1538 }
   1539 
   1540 /*
   1542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1543 %                                                                             %
   1544 %                                                                             %
   1545 %                                                                             %
   1546 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
   1547 %                                                                             %
   1548 %                                                                             %
   1549 %                                                                             %
   1550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1551 %
   1552 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
   1553 %  Collection (CCC) file which solely contains one or more color corrections
   1554 %  and applies the color correction to the image.  Here is a sample CCC file:
   1555 %
   1556 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
   1557 %          <ColorCorrection id="cc03345">
   1558 %                <SOPNode>
   1559 %                     <Slope> 0.9 1.2 0.5 </Slope>
   1560 %                     <Offset> 0.4 -0.5 0.6 </Offset>
   1561 %                     <Power> 1.0 0.8 1.5 </Power>
   1562 %                </SOPNode>
   1563 %                <SATNode>
   1564 %                     <Saturation> 0.85 </Saturation>
   1565 %                </SATNode>
   1566 %          </ColorCorrection>
   1567 %    </ColorCorrectionCollection>
   1568 %
   1569 %  which includes the offset, slope, and power for each of the RGB channels
   1570 %  as well as the saturation.
   1571 %
   1572 %  The format of the MagickColorDecisionListImage method is:
   1573 %
   1574 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
   1575 %        const char *color_correction_collection)
   1576 %
   1577 %  A description of each parameter follows:
   1578 %
   1579 %    o wand: the magick wand.
   1580 %
   1581 %    o color_correction_collection: the color correction collection in XML.
   1582 %
   1583 */
   1584 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
   1585   const char *color_correction_collection)
   1586 {
   1587   MagickBooleanType
   1588     status;
   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   status=ColorDecisionListImage(wand->images,color_correction_collection,
   1597     wand->exception);
   1598   return(status);
   1599 }
   1600 
   1601 /*
   1603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1604 %                                                                             %
   1605 %                                                                             %
   1606 %                                                                             %
   1607 %   M a g i c k C o l o r i z e I m a g e                                     %
   1608 %                                                                             %
   1609 %                                                                             %
   1610 %                                                                             %
   1611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1612 %
   1613 %  MagickColorizeImage() blends the fill color with each pixel in the image.
   1614 %
   1615 %  The format of the MagickColorizeImage method is:
   1616 %
   1617 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
   1618 %        const PixelWand *colorize,const PixelWand *blend)
   1619 %
   1620 %  A description of each parameter follows:
   1621 %
   1622 %    o wand: the magick wand.
   1623 %
   1624 %    o colorize: the colorize pixel wand.
   1625 %
   1626 %    o alpha: the alpha pixel wand.
   1627 %
   1628 */
   1629 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
   1630   const PixelWand *colorize,const PixelWand *blend)
   1631 {
   1632   char
   1633     percent_blend[MagickPathExtent];
   1634 
   1635   Image
   1636     *colorize_image;
   1637 
   1638   PixelInfo
   1639     target;
   1640 
   1641   assert(wand != (MagickWand *) NULL);
   1642   assert(wand->signature == MagickWandSignature);
   1643   if (wand->debug != MagickFalse)
   1644     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1645   if (wand->images == (Image *) NULL)
   1646     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1647   GetPixelInfo(wand->images,&target);
   1648   if (target.colorspace != CMYKColorspace)
   1649     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   1650       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
   1651       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   1652       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   1653       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   1654       PixelGetAlphaQuantum(blend)));
   1655   else
   1656     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   1657       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
   1658       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   1659       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   1660       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   1661       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
   1662       PixelGetAlphaQuantum(blend)));
   1663   target=PixelGetPixel(colorize);
   1664   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
   1665     wand->exception);
   1666   if (colorize_image == (Image *) NULL)
   1667     return(MagickFalse);
   1668   ReplaceImageInList(&wand->images,colorize_image);
   1669   return(MagickTrue);
   1670 }
   1671 
   1672 /*
   1674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1675 %                                                                             %
   1676 %                                                                             %
   1677 %                                                                             %
   1678 %   M a g i c k C o l o r M a t r i x I m a g e                               %
   1679 %                                                                             %
   1680 %                                                                             %
   1681 %                                                                             %
   1682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1683 %
   1684 %  MagickColorMatrixImage() apply color transformation to an image. The method
   1685 %  permits saturation changes, hue rotation, luminance to alpha, and various
   1686 %  other effects.  Although variable-sized transformation matrices can be used,
   1687 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
   1688 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
   1689 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
   1690 %  and offsets are normalized (divide Flash offset by 255).
   1691 %
   1692 %  The format of the MagickColorMatrixImage method is:
   1693 %
   1694 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
   1695 %        const KernelInfo *color_matrix)
   1696 %
   1697 %  A description of each parameter follows:
   1698 %
   1699 %    o wand: the magick wand.
   1700 %
   1701 %    o color_matrix:  the color matrix.
   1702 %
   1703 */
   1704 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
   1705   const KernelInfo *color_matrix)
   1706 {
   1707   Image
   1708     *color_image;
   1709 
   1710   assert(wand != (MagickWand *) NULL);
   1711   assert(wand->signature == MagickWandSignature);
   1712   if (wand->debug != MagickFalse)
   1713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1714   if (color_matrix == (const KernelInfo *) NULL)
   1715     return(MagickFalse);
   1716   if (wand->images == (Image *) NULL)
   1717     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1718   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
   1719   if (color_image == (Image *) NULL)
   1720     return(MagickFalse);
   1721   ReplaceImageInList(&wand->images,color_image);
   1722   return(MagickTrue);
   1723 }
   1724 
   1725 /*
   1727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1728 %                                                                             %
   1729 %                                                                             %
   1730 %                                                                             %
   1731 %   M a g i c k C o m b i n e I m a g e s                                     %
   1732 %                                                                             %
   1733 %                                                                             %
   1734 %                                                                             %
   1735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1736 %
   1737 %  MagickCombineImages() combines one or more images into a single image.  The
   1738 %  grayscale value of the pixels of each image in the sequence is assigned in
   1739 %  order to the specified  hannels of the combined image.   The typical
   1740 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
   1741 %
   1742 %  The format of the MagickCombineImages method is:
   1743 %
   1744 %      MagickWand *MagickCombineImages(MagickWand *wand,
   1745 %        const ColorspaceType colorspace)
   1746 %
   1747 %  A description of each parameter follows:
   1748 %
   1749 %    o wand: the magick wand.
   1750 %
   1751 %    o colorspace: the colorspace.
   1752 %
   1753 */
   1754 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
   1755   const ColorspaceType colorspace)
   1756 {
   1757   Image
   1758     *combine_image;
   1759 
   1760   assert(wand != (MagickWand *) NULL);
   1761   assert(wand->signature == MagickWandSignature);
   1762   if (wand->debug != MagickFalse)
   1763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1764   if (wand->images == (Image *) NULL)
   1765     return((MagickWand *) NULL);
   1766   combine_image=CombineImages(wand->images,colorspace,wand->exception);
   1767   if (combine_image == (Image *) NULL)
   1768     return((MagickWand *) NULL);
   1769   return(CloneMagickWandFromImages(wand,combine_image));
   1770 }
   1771 
   1772 /*
   1774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1775 %                                                                             %
   1776 %                                                                             %
   1777 %                                                                             %
   1778 %   M a g i c k C o m m e n t I m a g e                                       %
   1779 %                                                                             %
   1780 %                                                                             %
   1781 %                                                                             %
   1782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1783 %
   1784 %  MagickCommentImage() adds a comment to your image.
   1785 %
   1786 %  The format of the MagickCommentImage method is:
   1787 %
   1788 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
   1789 %        const char *comment)
   1790 %
   1791 %  A description of each parameter follows:
   1792 %
   1793 %    o wand: the magick wand.
   1794 %
   1795 %    o comment: the image comment.
   1796 %
   1797 */
   1798 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
   1799   const char *comment)
   1800 {
   1801   MagickBooleanType
   1802     status;
   1803 
   1804   assert(wand != (MagickWand *) NULL);
   1805   assert(wand->signature == MagickWandSignature);
   1806   if (wand->debug != MagickFalse)
   1807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1808   if (wand->images == (Image *) NULL)
   1809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1810   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
   1811   return(status);
   1812 }
   1813 
   1814 /*
   1816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1817 %                                                                             %
   1818 %                                                                             %
   1819 %                                                                             %
   1820 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
   1821 %                                                                             %
   1822 %                                                                             %
   1823 %                                                                             %
   1824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1825 %
   1826 %  MagickCompareImagesLayers() compares each image with the next in a sequence
   1827 %  and returns the maximum bounding region of any pixel differences it
   1828 %  discovers.
   1829 %
   1830 %  The format of the MagickCompareImagesLayers method is:
   1831 %
   1832 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
   1833 %        const LayerMethod method)
   1834 %
   1835 %  A description of each parameter follows:
   1836 %
   1837 %    o wand: the magick wand.
   1838 %
   1839 %    o method: the compare method.
   1840 %
   1841 */
   1842 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
   1843   const LayerMethod method)
   1844 {
   1845   Image
   1846     *layers_image;
   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)
   1853     return((MagickWand *) NULL);
   1854   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
   1855   if (layers_image == (Image *) NULL)
   1856     return((MagickWand *) NULL);
   1857   return(CloneMagickWandFromImages(wand,layers_image));
   1858 }
   1859 
   1860 /*
   1862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1863 %                                                                             %
   1864 %                                                                             %
   1865 %                                                                             %
   1866 %   M a g i c k C o m p a r e I m a g e s                                     %
   1867 %                                                                             %
   1868 %                                                                             %
   1869 %                                                                             %
   1870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1871 %
   1872 %  MagickCompareImages() compares an image to a reconstructed image and returns
   1873 %  the specified difference image.
   1874 %
   1875 %  The format of the MagickCompareImages method is:
   1876 %
   1877 %      MagickWand *MagickCompareImages(MagickWand *wand,
   1878 %        const MagickWand *reference,const MetricType metric,
   1879 %        double *distortion)
   1880 %
   1881 %  A description of each parameter follows:
   1882 %
   1883 %    o wand: the magick wand.
   1884 %
   1885 %    o reference: the reference wand.
   1886 %
   1887 %    o metric: the metric.
   1888 %
   1889 %    o distortion: the computed distortion between the images.
   1890 %
   1891 */
   1892 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
   1893   const MagickWand *reference,const MetricType metric,double *distortion)
   1894 {
   1895   Image
   1896     *compare_image;
   1897 
   1898 
   1899   assert(wand != (MagickWand *) NULL);
   1900   assert(wand->signature == MagickWandSignature);
   1901   if (wand->debug != MagickFalse)
   1902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1903   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   1904     {
   1905       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   1906         "ContainsNoImages","`%s'",wand->name);
   1907       return((MagickWand *) NULL);
   1908     }
   1909   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
   1910     wand->exception);
   1911   if (compare_image == (Image *) NULL)
   1912     return((MagickWand *) NULL);
   1913   return(CloneMagickWandFromImages(wand,compare_image));
   1914 }
   1915 
   1916 /*
   1918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1919 %                                                                             %
   1920 %                                                                             %
   1921 %                                                                             %
   1922 %   M a g i c k C o m p o s i t e I m a g e                                   %
   1923 %                                                                             %
   1924 %                                                                             %
   1925 %                                                                             %
   1926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1927 %
   1928 %  MagickCompositeImage() composite one image onto another at the specified
   1929 %  offset.
   1930 %
   1931 %  The format of the MagickCompositeImage method is:
   1932 %
   1933 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
   1934 %        const MagickWand *source_wand,const CompositeOperator compose,
   1935 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
   1936 %
   1937 %  A description of each parameter follows:
   1938 %
   1939 %    o wand: the magick wand holding the destination images
   1940 %
   1941 %    o source_image: the magick wand holding source image.
   1942 %
   1943 %    o compose: This operator affects how the composite is applied to the
   1944 %      image.  The default is Over.  These are some of the compose methods
   1945 %      availble.
   1946 %
   1947 %        OverCompositeOp       InCompositeOp         OutCompositeOp
   1948 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
   1949 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
   1950 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
   1951 %        DisplaceCompositeOp
   1952 %
   1953 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
   1954 %
   1955 %    o x: the column offset of the composited image.
   1956 %
   1957 %    o y: the row offset of the composited image.
   1958 %
   1959 */
   1960 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
   1961   const MagickWand *source_wand,const CompositeOperator compose,
   1962   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
   1963 {
   1964   MagickBooleanType
   1965     status;
   1966 
   1967   assert(wand != (MagickWand *) NULL);
   1968   assert(wand->signature == MagickWandSignature);
   1969   if (wand->debug != MagickFalse)
   1970     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   1971   if ((wand->images == (Image *) NULL) ||
   1972       (source_wand->images == (Image *) NULL))
   1973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   1974   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
   1975     x,y,wand->exception);
   1976   return(status);
   1977 }
   1978 
   1979 /*
   1981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1982 %                                                                             %
   1983 %                                                                             %
   1984 %                                                                             %
   1985 %   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                     %
   1986 %                                                                             %
   1987 %                                                                             %
   1988 %                                                                             %
   1989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1990 %
   1991 %  MagickCompositeImageGravity() composite one image onto another using the
   1992 %  specified gravity.
   1993 %
   1994 %  The format of the MagickCompositeImageGravity method is:
   1995 %
   1996 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
   1997 %        const MagickWand *source_wand,const CompositeOperator compose,
   1998 %        const GravityType gravity)
   1999 %
   2000 %  A description of each parameter follows:
   2001 %
   2002 %    o wand: the magick wand holding the destination images
   2003 %
   2004 %    o source_image: the magick wand holding source image.
   2005 %
   2006 %    o compose: This operator affects how the composite is applied to the
   2007 %      image.  The default is Over.  These are some of the compose methods
   2008 %      availble.
   2009 %
   2010 %        OverCompositeOp       InCompositeOp         OutCompositeOp
   2011 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
   2012 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
   2013 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
   2014 %        DisplaceCompositeOp
   2015 %
   2016 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
   2017 %               NorthEastGravity, WestGravity, CenterGravity,
   2018 %               EastGravity, SouthWestGravity, SouthGravity,
   2019 %               SouthEastGravity)
   2020 %
   2021 */
   2022 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
   2023   const MagickWand *source_wand,const CompositeOperator compose,
   2024   const GravityType gravity)
   2025 {
   2026   MagickBooleanType
   2027     status;
   2028 
   2029   RectangleInfo
   2030     geometry;
   2031 
   2032   assert(wand != (MagickWand *) NULL);
   2033   assert(wand->signature == MagickWandSignature);
   2034   if (wand->debug != MagickFalse)
   2035     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2036   if ((wand->images == (Image *) NULL) ||
   2037       (source_wand->images == (Image *) NULL))
   2038     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2039   SetGeometry(source_wand->images,&geometry);
   2040   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
   2041     &geometry);
   2042   status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
   2043     geometry.x,geometry.y,wand->exception);
   2044   return(status);
   2045 }
   2046 
   2047 /*
   2049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2050 %                                                                             %
   2051 %                                                                             %
   2052 %                                                                             %
   2053 %   M a g i c k C o m p o s i t e L a y e r s                                 %
   2054 %                                                                             %
   2055 %                                                                             %
   2056 %                                                                             %
   2057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2058 %
   2059 %  MagickCompositeLayers() composite the images in the source wand over the
   2060 %  images in the destination wand in sequence, starting with the current
   2061 %  image in both lists.
   2062 %
   2063 %  Each layer from the two image lists are composted together until the end of
   2064 %  one of the image lists is reached.  The offset of each composition is also
   2065 %  adjusted to match the virtual canvas offsets of each layer. As such the
   2066 %  given offset is relative to the virtual canvas, and not the actual image.
   2067 %
   2068 %  Composition uses given x and y offsets, as the 'origin' location of the
   2069 %  source images virtual canvas (not the real image) allowing you to compose a
   2070 %  list of 'layer images' into the destiantioni images.  This makes it well
   2071 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
   2072 %  Animations' onto a static or other 'Coaleased Animation' destination image
   2073 %  list.  GIF disposal handling is not looked at.
   2074 %
   2075 %  Special case:- If one of the image sequences is the last image (just a
   2076 %  single image remaining), that image is repeatally composed with all the
   2077 %  images in the other image list.  Either the source or destination lists may
   2078 %  be the single image, for this situation.
   2079 %
   2080 %  In the case of a single destination image (or last image given), that image
   2081 %  will ve cloned to match the number of images remaining in the source image
   2082 %  list.
   2083 %
   2084 %  This is equivelent to the "-layer Composite" Shell API operator.
   2085 %
   2086 %  The format of the MagickCompositeLayers method is:
   2087 %
   2088 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
   2089 %        const MagickWand *source_wand, const CompositeOperator compose,
   2090 %        const ssize_t x,const ssize_t y)
   2091 %
   2092 %  A description of each parameter follows:
   2093 %
   2094 %    o wand: the magick wand holding destaintion images
   2095 %
   2096 %    o source_wand: the wand holding the source images
   2097 %
   2098 %    o compose, x, y:  composition arguments
   2099 %
   2100 */
   2101 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
   2102   const MagickWand *source_wand,const CompositeOperator compose,
   2103   const ssize_t x,const ssize_t y)
   2104 {
   2105   MagickBooleanType
   2106     status;
   2107 
   2108   assert(wand != (MagickWand *) NULL);
   2109   assert(wand->signature == MagickWandSignature);
   2110   if (wand->debug != MagickFalse)
   2111     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2112   if ((wand->images == (Image *) NULL) ||
   2113       (source_wand->images == (Image *) NULL))
   2114     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2115   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
   2116   status=MagickTrue;  /* FUTURE: determine status from exceptions */
   2117   return(status);
   2118 }
   2119 
   2120 /*
   2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2123 %                                                                             %
   2124 %                                                                             %
   2125 %                                                                             %
   2126 %   M a g i c k C o n t r a s t I m a g e                                     %
   2127 %                                                                             %
   2128 %                                                                             %
   2129 %                                                                             %
   2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2131 %
   2132 %  MagickContrastImage() enhances the intensity differences between the lighter
   2133 %  and darker elements of the image.  Set sharpen to a value other than 0 to
   2134 %  increase the image contrast otherwise the contrast is reduced.
   2135 %
   2136 %  The format of the MagickContrastImage method is:
   2137 %
   2138 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
   2139 %        const MagickBooleanType sharpen)
   2140 %
   2141 %  A description of each parameter follows:
   2142 %
   2143 %    o wand: the magick wand.
   2144 %
   2145 %    o sharpen: Increase or decrease image contrast.
   2146 %
   2147 %
   2148 */
   2149 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
   2150   const MagickBooleanType sharpen)
   2151 {
   2152   MagickBooleanType
   2153     status;
   2154 
   2155   assert(wand != (MagickWand *) NULL);
   2156   assert(wand->signature == MagickWandSignature);
   2157   if (wand->debug != MagickFalse)
   2158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2159   if (wand->images == (Image *) NULL)
   2160     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2161   status=ContrastImage(wand->images,sharpen,wand->exception);
   2162   return(status);
   2163 }
   2164 
   2165 /*
   2167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2168 %                                                                             %
   2169 %                                                                             %
   2170 %                                                                             %
   2171 %   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                       %
   2172 %                                                                             %
   2173 %                                                                             %
   2174 %                                                                             %
   2175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2176 %
   2177 %  MagickContrastStretchImage() enhances the contrast of a color image by
   2178 %  adjusting the pixels color to span the entire range of colors available.
   2179 %  You can also reduce the influence of a particular channel with a gamma
   2180 %  value of 0.
   2181 %
   2182 %  The format of the MagickContrastStretchImage method is:
   2183 %
   2184 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
   2185 %        const double black_point,const double white_point)
   2186 %
   2187 %  A description of each parameter follows:
   2188 %
   2189 %    o wand: the magick wand.
   2190 %
   2191 %    o black_point: the black point.
   2192 %
   2193 %    o white_point: the white point.
   2194 %
   2195 */
   2196 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
   2197   const double black_point,const double white_point)
   2198 {
   2199   MagickBooleanType
   2200     status;
   2201 
   2202   assert(wand != (MagickWand *) NULL);
   2203   assert(wand->signature == MagickWandSignature);
   2204   if (wand->debug != MagickFalse)
   2205     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2206   if (wand->images == (Image *) NULL)
   2207     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2208   status=ContrastStretchImage(wand->images,black_point,white_point,
   2209     wand->exception);
   2210   return(status);
   2211 }
   2212 
   2213 /*
   2215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2216 %                                                                             %
   2217 %                                                                             %
   2218 %                                                                             %
   2219 %   M a g i c k C o n v o l v e I m a g e                                     %
   2220 %                                                                             %
   2221 %                                                                             %
   2222 %                                                                             %
   2223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2224 %
   2225 %  MagickConvolveImage() applies a custom convolution kernel to the image.
   2226 %
   2227 %  The format of the MagickConvolveImage method is:
   2228 %
   2229 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
   2230 %        const KernelInfo *kernel)
   2231 %
   2232 %  A description of each parameter follows:
   2233 %
   2234 %    o wand: the magick wand.
   2235 %
   2236 %    o kernel: An array of doubles representing the convolution kernel.
   2237 %
   2238 */
   2239 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
   2240   const KernelInfo *kernel)
   2241 {
   2242   Image
   2243     *filter_image;
   2244 
   2245   assert(wand != (MagickWand *) NULL);
   2246   assert(wand->signature == MagickWandSignature);
   2247   if (wand->debug != MagickFalse)
   2248     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2249   if (kernel == (const KernelInfo *) NULL)
   2250     return(MagickFalse);
   2251   if (wand->images == (Image *) NULL)
   2252     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2253   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
   2254   if (filter_image == (Image *) NULL)
   2255     return(MagickFalse);
   2256   ReplaceImageInList(&wand->images,filter_image);
   2257   return(MagickTrue);
   2258 }
   2259 
   2260 /*
   2262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2263 %                                                                             %
   2264 %                                                                             %
   2265 %                                                                             %
   2266 %   M a g i c k C r o p I m a g e                                             %
   2267 %                                                                             %
   2268 %                                                                             %
   2269 %                                                                             %
   2270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2271 %
   2272 %  MagickCropImage() extracts a region of the image.
   2273 %
   2274 %  The format of the MagickCropImage method is:
   2275 %
   2276 %      MagickBooleanType MagickCropImage(MagickWand *wand,
   2277 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   2278 %
   2279 %  A description of each parameter follows:
   2280 %
   2281 %    o wand: the magick wand.
   2282 %
   2283 %    o width: the region width.
   2284 %
   2285 %    o height: the region height.
   2286 %
   2287 %    o x: the region x-offset.
   2288 %
   2289 %    o y: the region y-offset.
   2290 %
   2291 */
   2292 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
   2293   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   2294 {
   2295   Image
   2296     *crop_image;
   2297 
   2298   RectangleInfo
   2299     crop;
   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   crop.width=width;
   2308   crop.height=height;
   2309   crop.x=x;
   2310   crop.y=y;
   2311   crop_image=CropImage(wand->images,&crop,wand->exception);
   2312   if (crop_image == (Image *) NULL)
   2313     return(MagickFalse);
   2314   ReplaceImageInList(&wand->images,crop_image);
   2315   return(MagickTrue);
   2316 }
   2317 
   2318 /*
   2320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2321 %                                                                             %
   2322 %                                                                             %
   2323 %                                                                             %
   2324 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
   2325 %                                                                             %
   2326 %                                                                             %
   2327 %                                                                             %
   2328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2329 %
   2330 %  MagickCycleColormapImage() displaces an image's colormap by a given number
   2331 %  of positions.  If you cycle the colormap a number of times you can produce
   2332 %  a psychodelic effect.
   2333 %
   2334 %  The format of the MagickCycleColormapImage method is:
   2335 %
   2336 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
   2337 %        const ssize_t displace)
   2338 %
   2339 %  A description of each parameter follows:
   2340 %
   2341 %    o wand: the magick wand.
   2342 %
   2343 %    o pixel_wand: the pixel wand.
   2344 %
   2345 */
   2346 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
   2347   const ssize_t displace)
   2348 {
   2349   MagickBooleanType
   2350     status;
   2351 
   2352   assert(wand != (MagickWand *) NULL);
   2353   assert(wand->signature == MagickWandSignature);
   2354   if (wand->debug != MagickFalse)
   2355     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2356   if (wand->images == (Image *) NULL)
   2357     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2358   status=CycleColormapImage(wand->images,displace,wand->exception);
   2359   return(status);
   2360 }
   2361 
   2362 /*
   2364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2365 %                                                                             %
   2366 %                                                                             %
   2367 %                                                                             %
   2368 %   M a g i c k C o n s t i t u t e I m a g e                                 %
   2369 %                                                                             %
   2370 %                                                                             %
   2371 %                                                                             %
   2372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2373 %
   2374 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
   2375 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
   2376 %  The data can be char, short int, int, float, or double.  Float and double
   2377 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
   2378 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
   2379 %  example, to create a 640x480 image from unsigned red-green-blue character
   2380 %  data, use
   2381 %
   2382 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
   2383 %
   2384 %  The format of the MagickConstituteImage method is:
   2385 %
   2386 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
   2387 %        const size_t columns,const size_t rows,const char *map,
   2388 %        const StorageType storage,void *pixels)
   2389 %
   2390 %  A description of each parameter follows:
   2391 %
   2392 %    o wand: the magick wand.
   2393 %
   2394 %    o columns: width in pixels of the image.
   2395 %
   2396 %    o rows: height in pixels of the image.
   2397 %
   2398 %    o map:  This string reflects the expected ordering of the pixel array.
   2399 %      It can be any combination or order of R = red, G = green, B = blue,
   2400 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   2401 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   2402 %      P = pad.
   2403 %
   2404 %    o storage: Define the data type of the pixels.  Float and double types are
   2405 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   2406 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
   2407 %      LongPixel, QuantumPixel, or ShortPixel.
   2408 %
   2409 %    o pixels: This array of values contain the pixel components as defined by
   2410 %      map and type.  You must preallocate this array where the expected
   2411 %      length varies depending on the values of width, height, map, and type.
   2412 %
   2413 %
   2414 */
   2415 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
   2416   const size_t columns,const size_t rows,const char *map,
   2417   const StorageType storage,const void *pixels)
   2418 {
   2419   Image
   2420     *images;
   2421 
   2422   assert(wand != (MagickWand *) NULL);
   2423   assert(wand->signature == MagickWandSignature);
   2424   if (wand->debug != MagickFalse)
   2425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2426   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
   2427   if (images == (Image *) NULL)
   2428     return(MagickFalse);
   2429   return(InsertImageInWand(wand,images));
   2430 }
   2431 
   2432 /*
   2434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2435 %                                                                             %
   2436 %                                                                             %
   2437 %                                                                             %
   2438 %   M a g i c k D e c i p h e r I m a g e                                     %
   2439 %                                                                             %
   2440 %                                                                             %
   2441 %                                                                             %
   2442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2443 %
   2444 %  MagickDecipherImage() converts cipher pixels to plain pixels.
   2445 %
   2446 %  The format of the MagickDecipherImage method is:
   2447 %
   2448 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
   2449 %        const char *passphrase)
   2450 %
   2451 %  A description of each parameter follows:
   2452 %
   2453 %    o wand: the magick wand.
   2454 %
   2455 %    o passphrase: the passphrase.
   2456 %
   2457 */
   2458 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
   2459   const char *passphrase)
   2460 {
   2461   assert(wand != (MagickWand *) NULL);
   2462   assert(wand->signature == MagickWandSignature);
   2463   if (wand->debug != MagickFalse)
   2464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2465   if (wand->images == (Image *) NULL)
   2466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2467   return(DecipherImage(wand->images,passphrase,wand->exception));
   2468 }
   2469 
   2470 /*
   2472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2473 %                                                                             %
   2474 %                                                                             %
   2475 %                                                                             %
   2476 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
   2477 %                                                                             %
   2478 %                                                                             %
   2479 %                                                                             %
   2480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2481 %
   2482 %  MagickDeconstructImages() compares each image with the next in a sequence
   2483 %  and returns the maximum bounding region of any pixel differences it
   2484 %  discovers.
   2485 %
   2486 %  The format of the MagickDeconstructImages method is:
   2487 %
   2488 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
   2489 %
   2490 %  A description of each parameter follows:
   2491 %
   2492 %    o wand: the magick wand.
   2493 %
   2494 */
   2495 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
   2496 {
   2497   Image
   2498     *deconstruct_image;
   2499 
   2500   assert(wand != (MagickWand *) NULL);
   2501   assert(wand->signature == MagickWandSignature);
   2502   if (wand->debug != MagickFalse)
   2503     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2504   if (wand->images == (Image *) NULL)
   2505     return((MagickWand *) NULL);
   2506   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
   2507     wand->exception);
   2508   if (deconstruct_image == (Image *) NULL)
   2509     return((MagickWand *) NULL);
   2510   return(CloneMagickWandFromImages(wand,deconstruct_image));
   2511 }
   2512 
   2513 /*
   2515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2516 %                                                                             %
   2517 %                                                                             %
   2518 %                                                                             %
   2519 %     M a g i c k D e s k e w I m a g e                                       %
   2520 %                                                                             %
   2521 %                                                                             %
   2522 %                                                                             %
   2523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2524 %
   2525 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
   2526 %  occurs in scanned images because of the camera being misaligned,
   2527 %  imperfections in the scanning or surface, or simply because the paper was
   2528 %  not placed completely flat when scanned.
   2529 %
   2530 %  The format of the MagickDeskewImage method is:
   2531 %
   2532 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
   2533 %        const double threshold)
   2534 %
   2535 %  A description of each parameter follows:
   2536 %
   2537 %    o wand: the magick wand.
   2538 %
   2539 %    o threshold: separate background from foreground.
   2540 %
   2541 */
   2542 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
   2543   const double threshold)
   2544 {
   2545   Image
   2546     *sepia_image;
   2547 
   2548   assert(wand != (MagickWand *) NULL);
   2549   assert(wand->signature == MagickWandSignature);
   2550   if (wand->debug != MagickFalse)
   2551     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2552   if (wand->images == (Image *) NULL)
   2553     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2554   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
   2555   if (sepia_image == (Image *) NULL)
   2556     return(MagickFalse);
   2557   ReplaceImageInList(&wand->images,sepia_image);
   2558   return(MagickTrue);
   2559 }
   2560 
   2561 /*
   2563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2564 %                                                                             %
   2565 %                                                                             %
   2566 %                                                                             %
   2567 %     M a g i c k D e s p e c k l e I m a g e                                 %
   2568 %                                                                             %
   2569 %                                                                             %
   2570 %                                                                             %
   2571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2572 %
   2573 %  MagickDespeckleImage() reduces the speckle noise in an image while
   2574 %  perserving the edges of the original image.
   2575 %
   2576 %  The format of the MagickDespeckleImage method is:
   2577 %
   2578 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
   2579 %
   2580 %  A description of each parameter follows:
   2581 %
   2582 %    o wand: the magick wand.
   2583 %
   2584 */
   2585 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
   2586 {
   2587   Image
   2588     *despeckle_image;
   2589 
   2590   assert(wand != (MagickWand *) NULL);
   2591   assert(wand->signature == MagickWandSignature);
   2592   if (wand->debug != MagickFalse)
   2593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2594   if (wand->images == (Image *) NULL)
   2595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2596   despeckle_image=DespeckleImage(wand->images,wand->exception);
   2597   if (despeckle_image == (Image *) NULL)
   2598     return(MagickFalse);
   2599   ReplaceImageInList(&wand->images,despeckle_image);
   2600   return(MagickTrue);
   2601 }
   2602 
   2603 /*
   2605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2606 %                                                                             %
   2607 %                                                                             %
   2608 %                                                                             %
   2609 %   M a g i c k D e s t r o y I m a g e                                       %
   2610 %                                                                             %
   2611 %                                                                             %
   2612 %                                                                             %
   2613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2614 %
   2615 %  MagickDestroyImage() dereferences an image, deallocating memory associated
   2616 %  with the image if the reference count becomes zero.
   2617 %
   2618 %  The format of the MagickDestroyImage method is:
   2619 %
   2620 %      Image *MagickDestroyImage(Image *image)
   2621 %
   2622 %  A description of each parameter follows:
   2623 %
   2624 %    o image: the image.
   2625 %
   2626 */
   2627 WandExport Image *MagickDestroyImage(Image *image)
   2628 {
   2629   return(DestroyImage(image));
   2630 }
   2631 
   2632 /*
   2634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2635 %                                                                             %
   2636 %                                                                             %
   2637 %                                                                             %
   2638 %   M a g i c k D i s p l a y I m a g e                                       %
   2639 %                                                                             %
   2640 %                                                                             %
   2641 %                                                                             %
   2642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2643 %
   2644 %  MagickDisplayImage() displays an image.
   2645 %
   2646 %  The format of the MagickDisplayImage method is:
   2647 %
   2648 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
   2649 %        const char *server_name)
   2650 %
   2651 %  A description of each parameter follows:
   2652 %
   2653 %    o wand: the magick wand.
   2654 %
   2655 %    o server_name: the X server name.
   2656 %
   2657 */
   2658 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
   2659   const char *server_name)
   2660 {
   2661   Image
   2662     *image;
   2663 
   2664   MagickBooleanType
   2665     status;
   2666 
   2667   assert(wand != (MagickWand *) NULL);
   2668   assert(wand->signature == MagickWandSignature);
   2669   if (wand->debug != MagickFalse)
   2670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2671   if (wand->images == (Image *) NULL)
   2672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2673   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   2674   if (image == (Image *) NULL)
   2675     return(MagickFalse);
   2676   (void) CloneString(&wand->image_info->server_name,server_name);
   2677   status=DisplayImages(wand->image_info,image,wand->exception);
   2678   image=DestroyImage(image);
   2679   return(status);
   2680 }
   2681 
   2682 /*
   2684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2685 %                                                                             %
   2686 %                                                                             %
   2687 %                                                                             %
   2688 %   M a g i c k D i s p l a y I m a g e s                                     %
   2689 %                                                                             %
   2690 %                                                                             %
   2691 %                                                                             %
   2692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2693 %
   2694 %  MagickDisplayImages() displays an image or image sequence.
   2695 %
   2696 %  The format of the MagickDisplayImages method is:
   2697 %
   2698 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
   2699 %        const char *server_name)
   2700 %
   2701 %  A description of each parameter follows:
   2702 %
   2703 %    o wand: the magick wand.
   2704 %
   2705 %    o server_name: the X server name.
   2706 %
   2707 */
   2708 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
   2709   const char *server_name)
   2710 {
   2711   MagickBooleanType
   2712     status;
   2713 
   2714   assert(wand != (MagickWand *) NULL);
   2715   assert(wand->signature == MagickWandSignature);
   2716   if (wand->debug != MagickFalse)
   2717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2718   (void) CloneString(&wand->image_info->server_name,server_name);
   2719   status=DisplayImages(wand->image_info,wand->images,wand->exception);
   2720   return(status);
   2721 }
   2722 
   2723 /*
   2725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2726 %                                                                             %
   2727 %                                                                             %
   2728 %                                                                             %
   2729 %   M a g i c k D i s t o r t I m a g e                                       %
   2730 %                                                                             %
   2731 %                                                                             %
   2732 %                                                                             %
   2733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2734 %
   2735 %  MagickDistortImage() distorts an image using various distortion methods, by
   2736 %  mapping color lookups of the source image to a new destination image
   2737 %  usally of the same size as the source image, unless 'bestfit' is set to
   2738 %  true.
   2739 %
   2740 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
   2741 %  adjusted to ensure the whole source 'image' will just fit within the final
   2742 %  destination image, which will be sized and offset accordingly.  Also in
   2743 %  many cases the virtual offset of the source image will be taken into
   2744 %  account in the mapping.
   2745 %
   2746 %  The format of the MagickDistortImage method is:
   2747 %
   2748 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
   2749 %        const DistortMethod method,const size_t number_arguments,
   2750 %        const double *arguments,const MagickBooleanType bestfit)
   2751 %
   2752 %  A description of each parameter follows:
   2753 %
   2754 %    o image: the image to be distorted.
   2755 %
   2756 %    o method: the method of image distortion.
   2757 %
   2758 %        ArcDistortion always ignores the source image offset, and always
   2759 %        'bestfit' the destination image with the top left corner offset
   2760 %        relative to the polar mapping center.
   2761 %
   2762 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
   2763 %        style of image distortion.
   2764 %
   2765 %        Affine, Perspective, and Bilinear, do least squares fitting of the
   2766 %        distortion when more than the minimum number of control point pairs
   2767 %        are provided.
   2768 %
   2769 %        Perspective, and Bilinear, falls back to a Affine distortion when less
   2770 %        that 4 control point pairs are provided. While Affine distortions let
   2771 %        you use any number of control point pairs, that is Zero pairs is a
   2772 %        no-Op (viewport only) distrotion, one pair is a translation and two
   2773 %        pairs of control points do a scale-rotate-translate, without any
   2774 %        shearing.
   2775 %
   2776 %    o number_arguments: the number of arguments given for this distortion
   2777 %      method.
   2778 %
   2779 %    o arguments: the arguments for this distortion method.
   2780 %
   2781 %    o bestfit: Attempt to resize destination to fit distorted source.
   2782 %
   2783 */
   2784 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
   2785   const DistortMethod method,const size_t number_arguments,
   2786   const double *arguments,const MagickBooleanType bestfit)
   2787 {
   2788   Image
   2789     *distort_image;
   2790 
   2791   assert(wand != (MagickWand *) NULL);
   2792   assert(wand->signature == MagickWandSignature);
   2793   if (wand->debug != MagickFalse)
   2794     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2795   if (wand->images == (Image *) NULL)
   2796     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2797   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
   2798     bestfit,wand->exception);
   2799   if (distort_image == (Image *) NULL)
   2800     return(MagickFalse);
   2801   ReplaceImageInList(&wand->images,distort_image);
   2802   return(MagickTrue);
   2803 }
   2804 
   2805 /*
   2807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2808 %                                                                             %
   2809 %                                                                             %
   2810 %                                                                             %
   2811 %   M a g i c k D r a w I m a g e                                             %
   2812 %                                                                             %
   2813 %                                                                             %
   2814 %                                                                             %
   2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2816 %
   2817 %  MagickDrawImage() renders the drawing wand on the current image.
   2818 %
   2819 %  The format of the MagickDrawImage method is:
   2820 %
   2821 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
   2822 %        const DrawingWand *drawing_wand)
   2823 %
   2824 %  A description of each parameter follows:
   2825 %
   2826 %    o wand: the magick wand.
   2827 %
   2828 %    o drawing_wand: the draw wand.
   2829 %
   2830 */
   2831 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
   2832   const DrawingWand *drawing_wand)
   2833 {
   2834   char
   2835     *primitive;
   2836 
   2837   DrawInfo
   2838     *draw_info;
   2839 
   2840   MagickBooleanType
   2841     status;
   2842 
   2843   assert(wand != (MagickWand *) NULL);
   2844   assert(wand->signature == MagickWandSignature);
   2845   if (wand->debug != MagickFalse)
   2846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2847   if (wand->images == (Image *) NULL)
   2848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2849   draw_info=PeekDrawingWand(drawing_wand);
   2850   if ((draw_info == (DrawInfo *) NULL) ||
   2851       (draw_info->primitive == (char *) NULL))
   2852     return(MagickFalse);
   2853   primitive=AcquireString(draw_info->primitive);
   2854   draw_info=DestroyDrawInfo(draw_info);
   2855   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
   2856   draw_info->primitive=primitive;
   2857   status=DrawImage(wand->images,draw_info,wand->exception);
   2858   draw_info=DestroyDrawInfo(draw_info);
   2859   return(status);
   2860 }
   2861 
   2862 /*
   2864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2865 %                                                                             %
   2866 %                                                                             %
   2867 %                                                                             %
   2868 %   M a g i c k E d g e I m a g e                                             %
   2869 %                                                                             %
   2870 %                                                                             %
   2871 %                                                                             %
   2872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2873 %
   2874 %  MagickEdgeImage() enhance edges within the image with a convolution filter
   2875 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
   2876 %  radius for you.
   2877 %
   2878 %  The format of the MagickEdgeImage method is:
   2879 %
   2880 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
   2881 %
   2882 %  A description of each parameter follows:
   2883 %
   2884 %    o wand: the magick wand.
   2885 %
   2886 %    o radius: the radius of the pixel neighborhood.
   2887 %
   2888 */
   2889 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
   2890   const double radius)
   2891 {
   2892   Image
   2893     *edge_image;
   2894 
   2895   assert(wand != (MagickWand *) NULL);
   2896   assert(wand->signature == MagickWandSignature);
   2897   if (wand->debug != MagickFalse)
   2898     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2899   if (wand->images == (Image *) NULL)
   2900     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2901   edge_image=EdgeImage(wand->images,radius,wand->exception);
   2902   if (edge_image == (Image *) NULL)
   2903     return(MagickFalse);
   2904   ReplaceImageInList(&wand->images,edge_image);
   2905   return(MagickTrue);
   2906 }
   2907 
   2908 /*
   2910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2911 %                                                                             %
   2912 %                                                                             %
   2913 %                                                                             %
   2914 %   M a g i c k E m b o s s I m a g e                                         %
   2915 %                                                                             %
   2916 %                                                                             %
   2917 %                                                                             %
   2918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2919 %
   2920 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
   2921 %  effect.  We convolve the image with a Gaussian operator of the given radius
   2922 %  and standard deviation (sigma).  For reasonable results, radius should be
   2923 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
   2924 %  radius for you.
   2925 %
   2926 %  The format of the MagickEmbossImage method is:
   2927 %
   2928 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
   2929 %        const double sigma)
   2930 %
   2931 %  A description of each parameter follows:
   2932 %
   2933 %    o wand: the magick wand.
   2934 %
   2935 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   2936 %      pixel.
   2937 %
   2938 %    o sigma: the standard deviation of the Gaussian, in pixels.
   2939 %
   2940 */
   2941 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
   2942   const double radius,const double sigma)
   2943 {
   2944   Image
   2945     *emboss_image;
   2946 
   2947   assert(wand != (MagickWand *) NULL);
   2948   assert(wand->signature == MagickWandSignature);
   2949   if (wand->debug != MagickFalse)
   2950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2951   if (wand->images == (Image *) NULL)
   2952     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2953   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
   2954   if (emboss_image == (Image *) NULL)
   2955     return(MagickFalse);
   2956   ReplaceImageInList(&wand->images,emboss_image);
   2957   return(MagickTrue);
   2958 }
   2959 
   2960 /*
   2962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2963 %                                                                             %
   2964 %                                                                             %
   2965 %                                                                             %
   2966 %   M a g i c k E n c i p h e r I m a g e                                     %
   2967 %                                                                             %
   2968 %                                                                             %
   2969 %                                                                             %
   2970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   2971 %
   2972 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
   2973 %
   2974 %  The format of the MagickEncipherImage method is:
   2975 %
   2976 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
   2977 %        const char *passphrase)
   2978 %
   2979 %  A description of each parameter follows:
   2980 %
   2981 %    o wand: the magick wand.
   2982 %
   2983 %    o passphrase: the passphrase.
   2984 %
   2985 */
   2986 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
   2987   const char *passphrase)
   2988 {
   2989   assert(wand != (MagickWand *) NULL);
   2990   assert(wand->signature == MagickWandSignature);
   2991   if (wand->debug != MagickFalse)
   2992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   2993   if (wand->images == (Image *) NULL)
   2994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   2995   return(EncipherImage(wand->images,passphrase,wand->exception));
   2996 }
   2997 
   2998 /*
   3000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3001 %                                                                             %
   3002 %                                                                             %
   3003 %                                                                             %
   3004 %   M a g i c k E n h a n c e I m a g e                                       %
   3005 %                                                                             %
   3006 %                                                                             %
   3007 %                                                                             %
   3008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3009 %
   3010 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
   3011 %  noisy image.
   3012 %
   3013 %  The format of the MagickEnhanceImage method is:
   3014 %
   3015 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
   3016 %
   3017 %  A description of each parameter follows:
   3018 %
   3019 %    o wand: the magick wand.
   3020 %
   3021 */
   3022 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
   3023 {
   3024   Image
   3025     *enhance_image;
   3026 
   3027   assert(wand != (MagickWand *) NULL);
   3028   assert(wand->signature == MagickWandSignature);
   3029   if (wand->debug != MagickFalse)
   3030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3031   if (wand->images == (Image *) NULL)
   3032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3033   enhance_image=EnhanceImage(wand->images,wand->exception);
   3034   if (enhance_image == (Image *) NULL)
   3035     return(MagickFalse);
   3036   ReplaceImageInList(&wand->images,enhance_image);
   3037   return(MagickTrue);
   3038 }
   3039 
   3040 /*
   3042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3043 %                                                                             %
   3044 %                                                                             %
   3045 %                                                                             %
   3046 %   M a g i c k E q u a l i z e I m a g e                                     %
   3047 %                                                                             %
   3048 %                                                                             %
   3049 %                                                                             %
   3050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3051 %
   3052 %  MagickEqualizeImage() equalizes the image histogram.
   3053 %
   3054 %  The format of the MagickEqualizeImage method is:
   3055 %
   3056 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
   3057 %
   3058 %  A description of each parameter follows:
   3059 %
   3060 %    o wand: the magick wand.
   3061 %
   3062 %    o channel: the image channel(s).
   3063 %
   3064 */
   3065 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
   3066 {
   3067   MagickBooleanType
   3068     status;
   3069 
   3070   assert(wand != (MagickWand *) NULL);
   3071   assert(wand->signature == MagickWandSignature);
   3072   if (wand->debug != MagickFalse)
   3073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3074   if (wand->images == (Image *) NULL)
   3075     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3076   status=EqualizeImage(wand->images,wand->exception);
   3077   return(status);
   3078 }
   3079 
   3080 /*
   3082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3083 %                                                                             %
   3084 %                                                                             %
   3085 %                                                                             %
   3086 %   M a g i c k E v a l u a t e I m a g e                                     %
   3087 %                                                                             %
   3088 %                                                                             %
   3089 %                                                                             %
   3090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3091 %
   3092 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
   3093 %  expression to an image.  Use these operators to lighten or darken an image,
   3094 %  to increase or decrease contrast in an image, or to produce the "negative"
   3095 %  of an image.
   3096 %
   3097 %  The format of the MagickEvaluateImage method is:
   3098 %
   3099 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
   3100 %        const MagickEvaluateOperator operator,const double value)
   3101 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
   3102 %        const MagickEvaluateOperator operator)
   3103 %
   3104 %  A description of each parameter follows:
   3105 %
   3106 %    o wand: the magick wand.
   3107 %
   3108 %    o op: A channel operator.
   3109 %
   3110 %    o value: A value value.
   3111 %
   3112 */
   3113 
   3114 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
   3115   const MagickEvaluateOperator op)
   3116 {
   3117   Image
   3118     *evaluate_image;
   3119 
   3120   assert(wand != (MagickWand *) NULL);
   3121   assert(wand->signature == MagickWandSignature);
   3122   if (wand->debug != MagickFalse)
   3123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3124   if (wand->images == (Image *) NULL)
   3125     return((MagickWand *) NULL);
   3126   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
   3127   if (evaluate_image == (Image *) NULL)
   3128     return((MagickWand *) NULL);
   3129   return(CloneMagickWandFromImages(wand,evaluate_image));
   3130 }
   3131 
   3132 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
   3133   const MagickEvaluateOperator op,const double value)
   3134 {
   3135   MagickBooleanType
   3136     status;
   3137 
   3138   assert(wand != (MagickWand *) NULL);
   3139   assert(wand->signature == MagickWandSignature);
   3140   if (wand->debug != MagickFalse)
   3141     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3142   if (wand->images == (Image *) NULL)
   3143     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3144   status=EvaluateImage(wand->images,op,value,wand->exception);
   3145   return(status);
   3146 }
   3147 
   3148 /*
   3150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3151 %                                                                             %
   3152 %                                                                             %
   3153 %                                                                             %
   3154 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
   3155 %                                                                             %
   3156 %                                                                             %
   3157 %                                                                             %
   3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3159 %
   3160 %  MagickExportImagePixels() extracts pixel data from an image and returns it
   3161 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
   3162 %  an error is encountered.  The data is returned as char, short int, int,
   3163 %  ssize_t, float, or double in the order specified by map.
   3164 %
   3165 %  Suppose you want to extract the first scanline of a 640x480 image as
   3166 %  character data in red-green-blue order:
   3167 %
   3168 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
   3169 %
   3170 %  The format of the MagickExportImagePixels method is:
   3171 %
   3172 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
   3173 %        const ssize_t x,const ssize_t y,const size_t columns,
   3174 %        const size_t rows,const char *map,const StorageType storage,
   3175 %        void *pixels)
   3176 %
   3177 %  A description of each parameter follows:
   3178 %
   3179 %    o wand: the magick wand.
   3180 %
   3181 %    o x, y, columns, rows:  These values define the perimeter
   3182 %      of a region of pixels you want to extract.
   3183 %
   3184 %    o map:  This string reflects the expected ordering of the pixel array.
   3185 %      It can be any combination or order of R = red, G = green, B = blue,
   3186 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   3187 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   3188 %      P = pad.
   3189 %
   3190 %    o storage: Define the data type of the pixels.  Float and double types are
   3191 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   3192 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
   3193 %      LongPixel, QuantumPixel, or ShortPixel.
   3194 %
   3195 %    o pixels: This array of values contain the pixel components as defined by
   3196 %      map and type.  You must preallocate this array where the expected
   3197 %      length varies depending on the values of width, height, map, and type.
   3198 %
   3199 */
   3200 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
   3201   const ssize_t x,const ssize_t y,const size_t columns,
   3202   const size_t rows,const char *map,const StorageType storage,
   3203   void *pixels)
   3204 {
   3205   MagickBooleanType
   3206     status;
   3207 
   3208   assert(wand != (MagickWand *) NULL);
   3209   assert(wand->signature == MagickWandSignature);
   3210   if (wand->debug != MagickFalse)
   3211     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3212   if (wand->images == (Image *) NULL)
   3213     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3214   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
   3215     storage,pixels,wand->exception);
   3216   return(status);
   3217 }
   3218 
   3219 /*
   3221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3222 %                                                                             %
   3223 %                                                                             %
   3224 %                                                                             %
   3225 %   M a g i c k E x t e n t I m a g e                                         %
   3226 %                                                                             %
   3227 %                                                                             %
   3228 %                                                                             %
   3229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3230 %
   3231 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
   3232 %  and wand background color.  Set the (x,y) offset of the geometry to move
   3233 %  the original wand relative to the extended wand.
   3234 %
   3235 %  The format of the MagickExtentImage method is:
   3236 %
   3237 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
   3238 %        const size_t height,const ssize_t x,const ssize_t y)
   3239 %
   3240 %  A description of each parameter follows:
   3241 %
   3242 %    o wand: the magick wand.
   3243 %
   3244 %    o width: the region width.
   3245 %
   3246 %    o height: the region height.
   3247 %
   3248 %    o x: the region x offset.
   3249 %
   3250 %    o y: the region y offset.
   3251 %
   3252 */
   3253 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
   3254   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
   3255 {
   3256   Image
   3257     *extent_image;
   3258 
   3259   RectangleInfo
   3260     extent;
   3261 
   3262   assert(wand != (MagickWand *) NULL);
   3263   assert(wand->signature == MagickWandSignature);
   3264   if (wand->debug != MagickFalse)
   3265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3266   if (wand->images == (Image *) NULL)
   3267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3268   extent.width=width;
   3269   extent.height=height;
   3270   extent.x=x;
   3271   extent.y=y;
   3272   extent_image=ExtentImage(wand->images,&extent,wand->exception);
   3273   if (extent_image == (Image *) NULL)
   3274     return(MagickFalse);
   3275   ReplaceImageInList(&wand->images,extent_image);
   3276   return(MagickTrue);
   3277 }
   3278 
   3279 /*
   3281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3282 %                                                                             %
   3283 %                                                                             %
   3284 %                                                                             %
   3285 %   M a g i c k F l i p I m a g e                                             %
   3286 %                                                                             %
   3287 %                                                                             %
   3288 %                                                                             %
   3289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3290 %
   3291 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
   3292 %  around the central x-axis.
   3293 %
   3294 %  The format of the MagickFlipImage method is:
   3295 %
   3296 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
   3297 %
   3298 %  A description of each parameter follows:
   3299 %
   3300 %    o wand: the magick wand.
   3301 %
   3302 */
   3303 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
   3304 {
   3305   Image
   3306     *flip_image;
   3307 
   3308   assert(wand != (MagickWand *) NULL);
   3309   assert(wand->signature == MagickWandSignature);
   3310   if (wand->debug != MagickFalse)
   3311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3312   if (wand->images == (Image *) NULL)
   3313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3314   flip_image=FlipImage(wand->images,wand->exception);
   3315   if (flip_image == (Image *) NULL)
   3316     return(MagickFalse);
   3317   ReplaceImageInList(&wand->images,flip_image);
   3318   return(MagickTrue);
   3319 }
   3320 
   3321 /*
   3323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3324 %                                                                             %
   3325 %                                                                             %
   3326 %                                                                             %
   3327 %   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                         %
   3328 %                                                                             %
   3329 %                                                                             %
   3330 %                                                                             %
   3331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3332 %
   3333 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
   3334 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
   3335 %  specified, the color value is changed for any neighbor pixel that does not
   3336 %  match the bordercolor member of image.
   3337 %
   3338 %  The format of the MagickFloodfillPaintImage method is:
   3339 %
   3340 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
   3341 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
   3342 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
   3343 %
   3344 %  A description of each parameter follows:
   3345 %
   3346 %    o wand: the magick wand.
   3347 %
   3348 %    o fill: the floodfill color pixel wand.
   3349 %
   3350 %    o fuzz: By default target must match a particular pixel color
   3351 %      exactly.  However, in many cases two colors may differ by a small amount.
   3352 %      The fuzz member of image defines how much tolerance is acceptable to
   3353 %      consider two colors as the same.  For example, set fuzz to 10 and the
   3354 %      color red at intensities of 100 and 102 respectively are now interpreted
   3355 %      as the same color for the purposes of the floodfill.
   3356 %
   3357 %    o bordercolor: the border color pixel wand.
   3358 %
   3359 %    o x,y: the starting location of the operation.
   3360 %
   3361 %    o invert: paint any pixel that does not match the target color.
   3362 %
   3363 */
   3364 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
   3365   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
   3366   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
   3367 {
   3368   DrawInfo
   3369     *draw_info;
   3370 
   3371   MagickBooleanType
   3372     status;
   3373 
   3374   PixelInfo
   3375     target;
   3376 
   3377   assert(wand != (MagickWand *) NULL);
   3378   assert(wand->signature == MagickWandSignature);
   3379   if (wand->debug != MagickFalse)
   3380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3381   if (wand->images == (Image *) NULL)
   3382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3383   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
   3384   PixelGetQuantumPacket(fill,&draw_info->fill);
   3385   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
   3386     wand->images->columns,y % wand->images->rows,&target,wand->exception);
   3387   if (bordercolor != (PixelWand *) NULL)
   3388     PixelGetMagickColor(bordercolor,&target);
   3389   wand->images->fuzz=fuzz;
   3390   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
   3391     wand->exception);
   3392   draw_info=DestroyDrawInfo(draw_info);
   3393   return(status);
   3394 }
   3395 
   3396 /*
   3398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3399 %                                                                             %
   3400 %                                                                             %
   3401 %                                                                             %
   3402 %   M a g i c k F l o p I m a g e                                             %
   3403 %                                                                             %
   3404 %                                                                             %
   3405 %                                                                             %
   3406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3407 %
   3408 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
   3409 %  around the central y-axis.
   3410 %
   3411 %  The format of the MagickFlopImage method is:
   3412 %
   3413 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
   3414 %
   3415 %  A description of each parameter follows:
   3416 %
   3417 %    o wand: the magick wand.
   3418 %
   3419 */
   3420 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
   3421 {
   3422   Image
   3423     *flop_image;
   3424 
   3425   assert(wand != (MagickWand *) NULL);
   3426   assert(wand->signature == MagickWandSignature);
   3427   if (wand->debug != MagickFalse)
   3428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3429   if (wand->images == (Image *) NULL)
   3430     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3431   flop_image=FlopImage(wand->images,wand->exception);
   3432   if (flop_image == (Image *) NULL)
   3433     return(MagickFalse);
   3434   ReplaceImageInList(&wand->images,flop_image);
   3435   return(MagickTrue);
   3436 }
   3437 
   3438 /*
   3440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3441 %                                                                             %
   3442 %                                                                             %
   3443 %                                                                             %
   3444 %   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                     %
   3445 %                                                                             %
   3446 %                                                                             %
   3447 %                                                                             %
   3448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3449 %
   3450 %  MagickForwardFourierTransformImage() implements the discrete Fourier
   3451 %  transform (DFT) of the image either as a magnitude / phase or real /
   3452 %  imaginary image pair.
   3453 %
   3454 %  The format of the MagickForwardFourierTransformImage method is:
   3455 %
   3456 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
   3457 %        const MagickBooleanType magnitude)
   3458 %
   3459 %  A description of each parameter follows:
   3460 %
   3461 %    o wand: the magick wand.
   3462 %
   3463 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
   3464 %      imaginary image pair.
   3465 %
   3466 */
   3467 WandExport MagickBooleanType MagickForwardFourierTransformImage(
   3468   MagickWand *wand,const MagickBooleanType magnitude)
   3469 {
   3470   Image
   3471     *forward_image;
   3472 
   3473   assert(wand != (MagickWand *) NULL);
   3474   assert(wand->signature == MagickWandSignature);
   3475   if (wand->debug != MagickFalse)
   3476     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3477   if (wand->images == (Image *) NULL)
   3478     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3479   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
   3480     wand->exception);
   3481   if (forward_image == (Image *) NULL)
   3482     return(MagickFalse);
   3483   ReplaceImageInList(&wand->images,forward_image);
   3484   return(MagickTrue);
   3485 }
   3486 
   3487 /*
   3489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3490 %                                                                             %
   3491 %                                                                             %
   3492 %                                                                             %
   3493 %   M a g i c k F r a m e I m a g e                                           %
   3494 %                                                                             %
   3495 %                                                                             %
   3496 %                                                                             %
   3497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3498 %
   3499 %  MagickFrameImage() adds a simulated three-dimensional border around the
   3500 %  image.  The width and height specify the border width of the vertical and
   3501 %  horizontal sides of the frame.  The inner and outer bevels indicate the
   3502 %  width of the inner and outer shadows of the frame.
   3503 %
   3504 %  The format of the MagickFrameImage method is:
   3505 %
   3506 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
   3507 %        const PixelWand *matte_color,const size_t width,
   3508 %        const size_t height,const ssize_t inner_bevel,
   3509 %        const ssize_t outer_bevel,const CompositeOperator compose)
   3510 %
   3511 %  A description of each parameter follows:
   3512 %
   3513 %    o wand: the magick wand.
   3514 %
   3515 %    o matte_color: the frame color pixel wand.
   3516 %
   3517 %    o width: the border width.
   3518 %
   3519 %    o height: the border height.
   3520 %
   3521 %    o inner_bevel: the inner bevel width.
   3522 %
   3523 %    o outer_bevel: the outer bevel width.
   3524 %
   3525 %    o compose: the composite operator.
   3526 %
   3527 */
   3528 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
   3529   const PixelWand *matte_color,const size_t width,const size_t height,
   3530   const ssize_t inner_bevel,const ssize_t outer_bevel,
   3531   const CompositeOperator compose)
   3532 {
   3533   Image
   3534     *frame_image;
   3535 
   3536   FrameInfo
   3537     frame_info;
   3538 
   3539   assert(wand != (MagickWand *) NULL);
   3540   assert(wand->signature == MagickWandSignature);
   3541   if (wand->debug != MagickFalse)
   3542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3543   if (wand->images == (Image *) NULL)
   3544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3545   (void) memset(&frame_info,0,sizeof(frame_info));
   3546   frame_info.width=wand->images->columns+2*width;
   3547   frame_info.height=wand->images->rows+2*height;
   3548   frame_info.x=(ssize_t) width;
   3549   frame_info.y=(ssize_t) height;
   3550   frame_info.inner_bevel=inner_bevel;
   3551   frame_info.outer_bevel=outer_bevel;
   3552   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
   3553   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
   3554   if (frame_image == (Image *) NULL)
   3555     return(MagickFalse);
   3556   ReplaceImageInList(&wand->images,frame_image);
   3557   return(MagickTrue);
   3558 }
   3559 
   3560 /*
   3562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3563 %                                                                             %
   3564 %                                                                             %
   3565 %                                                                             %
   3566 %   M a g i c k F u n c t i o n I m a g e                                     %
   3567 %                                                                             %
   3568 %                                                                             %
   3569 %                                                                             %
   3570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3571 %
   3572 %  MagickFunctionImage() applys an arithmetic, relational, or logical
   3573 %  expression to an image.  Use these operators to lighten or darken an image,
   3574 %  to increase or decrease contrast in an image, or to produce the "negative"
   3575 %  of an image.
   3576 %
   3577 %  The format of the MagickFunctionImage method is:
   3578 %
   3579 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
   3580 %        const MagickFunction function,const size_t number_arguments,
   3581 %        const double *arguments)
   3582 %
   3583 %  A description of each parameter follows:
   3584 %
   3585 %    o wand: the magick wand.
   3586 %
   3587 %    o function: the image function.
   3588 %
   3589 %    o number_arguments: the number of function arguments.
   3590 %
   3591 %    o arguments: the function arguments.
   3592 %
   3593 */
   3594 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
   3595   const MagickFunction function,const size_t number_arguments,
   3596   const double *arguments)
   3597 {
   3598   MagickBooleanType
   3599     status;
   3600 
   3601   assert(wand != (MagickWand *) NULL);
   3602   assert(wand->signature == MagickWandSignature);
   3603   if (wand->debug != MagickFalse)
   3604     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3605   if (wand->images == (Image *) NULL)
   3606     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3607   status=FunctionImage(wand->images,function,number_arguments,arguments,
   3608     wand->exception);
   3609   return(status);
   3610 }
   3611 
   3612 /*
   3614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3615 %                                                                             %
   3616 %                                                                             %
   3617 %                                                                             %
   3618 %   M a g i c k F x I m a g e                                                 %
   3619 %                                                                             %
   3620 %                                                                             %
   3621 %                                                                             %
   3622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3623 %
   3624 %  MagickFxImage() evaluate expression for each pixel in the image.
   3625 %
   3626 %  The format of the MagickFxImage method is:
   3627 %
   3628 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
   3629 %
   3630 %  A description of each parameter follows:
   3631 %
   3632 %    o wand: the magick wand.
   3633 %
   3634 %    o expression: the expression.
   3635 %
   3636 */
   3637 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
   3638 {
   3639   Image
   3640     *fx_image;
   3641 
   3642   assert(wand != (MagickWand *) NULL);
   3643   assert(wand->signature == MagickWandSignature);
   3644   if (wand->debug != MagickFalse)
   3645     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3646   if (wand->images == (Image *) NULL)
   3647     return((MagickWand *) NULL);
   3648   fx_image=FxImage(wand->images,expression,wand->exception);
   3649   if (fx_image == (Image *) NULL)
   3650     return((MagickWand *) NULL);
   3651   return(CloneMagickWandFromImages(wand,fx_image));
   3652 }
   3653 
   3654 /*
   3656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3657 %                                                                             %
   3658 %                                                                             %
   3659 %                                                                             %
   3660 %   M a g i c k G a m m a I m a g e                                           %
   3661 %                                                                             %
   3662 %                                                                             %
   3663 %                                                                             %
   3664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3665 %
   3666 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
   3667 %  different devices will have perceptual differences in the way the image's
   3668 %  intensities are represented on the screen.  Specify individual gamma levels
   3669 %  for the red, green, and blue channels, or adjust all three with the gamma
   3670 %  parameter.  Values typically range from 0.8 to 2.3.
   3671 %
   3672 %  You can also reduce the influence of a particular channel with a gamma
   3673 %  value of 0.
   3674 %
   3675 %  The format of the MagickGammaImage method is:
   3676 %
   3677 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
   3678 %
   3679 %  A description of each parameter follows:
   3680 %
   3681 %    o wand: the magick wand.
   3682 %
   3683 %    o level: Define the level of gamma correction.
   3684 %
   3685 */
   3686 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
   3687   const double gamma)
   3688 {
   3689   MagickBooleanType
   3690     status;
   3691 
   3692   assert(wand != (MagickWand *) NULL);
   3693   assert(wand->signature == MagickWandSignature);
   3694   if (wand->debug != MagickFalse)
   3695     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3696   if (wand->images == (Image *) NULL)
   3697     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3698   status=GammaImage(wand->images,gamma,wand->exception);
   3699   return(status);
   3700 }
   3701 
   3702 /*
   3704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3705 %                                                                             %
   3706 %                                                                             %
   3707 %                                                                             %
   3708 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
   3709 %                                                                             %
   3710 %                                                                             %
   3711 %                                                                             %
   3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3713 %
   3714 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
   3715 %  Gaussian operator of the given radius and standard deviation (sigma).
   3716 %  For reasonable results, the radius should be larger than sigma.  Use a
   3717 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
   3718 %
   3719 %  The format of the MagickGaussianBlurImage method is:
   3720 %
   3721 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
   3722 %        const double radius,const double sigma)
   3723 %
   3724 %  A description of each parameter follows:
   3725 %
   3726 %    o wand: the magick wand.
   3727 %
   3728 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   3729 %      pixel.
   3730 %
   3731 %    o sigma: the standard deviation of the Gaussian, in pixels.
   3732 %
   3733 */
   3734 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
   3735   const double radius,const double sigma)
   3736 {
   3737   Image
   3738     *blur_image;
   3739 
   3740   assert(wand != (MagickWand *) NULL);
   3741   assert(wand->signature == MagickWandSignature);
   3742   if (wand->debug != MagickFalse)
   3743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3744   if (wand->images == (Image *) NULL)
   3745     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3746   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
   3747   if (blur_image == (Image *) NULL)
   3748     return(MagickFalse);
   3749   ReplaceImageInList(&wand->images,blur_image);
   3750   return(MagickTrue);
   3751 }
   3752 
   3753 /*
   3755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3756 %                                                                             %
   3757 %                                                                             %
   3758 %                                                                             %
   3759 %   M a g i c k G e t I m a g e                                               %
   3760 %                                                                             %
   3761 %                                                                             %
   3762 %                                                                             %
   3763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3764 %
   3765 %  MagickGetImage() gets the image at the current image index.
   3766 %
   3767 %  The format of the MagickGetImage method is:
   3768 %
   3769 %      MagickWand *MagickGetImage(MagickWand *wand)
   3770 %
   3771 %  A description of each parameter follows:
   3772 %
   3773 %    o wand: the magick wand.
   3774 %
   3775 */
   3776 WandExport MagickWand *MagickGetImage(MagickWand *wand)
   3777 {
   3778   Image
   3779     *image;
   3780 
   3781   assert(wand != (MagickWand *) NULL);
   3782   assert(wand->signature == MagickWandSignature);
   3783   if (wand->debug != MagickFalse)
   3784     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3785   if (wand->images == (Image *) NULL)
   3786     {
   3787       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3788         "ContainsNoImages","`%s'",wand->name);
   3789       return((MagickWand *) NULL);
   3790     }
   3791   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   3792   if (image == (Image *) NULL)
   3793     return((MagickWand *) NULL);
   3794   return(CloneMagickWandFromImages(wand,image));
   3795 }
   3796 
   3797 /*
   3799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3800 %                                                                             %
   3801 %                                                                             %
   3802 %                                                                             %
   3803 %   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                       %
   3804 %                                                                             %
   3805 %                                                                             %
   3806 %                                                                             %
   3807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3808 %
   3809 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
   3810 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
   3811 %  than CMYKA.
   3812 %
   3813 %  The format of the MagickGetImageAlphaChannel method is:
   3814 %
   3815 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
   3816 %
   3817 %  A description of each parameter follows:
   3818 %
   3819 %    o wand: the magick wand.
   3820 %
   3821 */
   3822 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
   3823 {
   3824   assert(wand != (MagickWand *) NULL);
   3825   assert(wand->signature == MagickWandSignature);
   3826   if (wand->debug != MagickFalse)
   3827     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3828   if (wand->images == (Image *) NULL)
   3829     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3830   return(GetImageAlphaChannel(wand->images));
   3831 }
   3832 
   3833 /*
   3835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3836 %                                                                             %
   3837 %                                                                             %
   3838 %                                                                             %
   3839 %   M a g i c k G e t I m a g e C l i p M a s k                               %
   3840 %                                                                             %
   3841 %                                                                             %
   3842 %                                                                             %
   3843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3844 %
   3845 %  MagickGetImageMask() gets the image clip mask at the current image index.
   3846 %
   3847 %  The format of the MagickGetImageMask method is:
   3848 %
   3849 %      MagickWand *MagickGetImageMask(MagickWand *wand)
   3850 %
   3851 %  A description of each parameter follows:
   3852 %
   3853 %    o wand: the magick wand.
   3854 %
   3855 %    o type: type of mask, ReadPixelMask or WritePixelMask.
   3856 %
   3857 */
   3858 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
   3859   const PixelMask type)
   3860 {
   3861   Image
   3862     *image;
   3863 
   3864   assert(wand != (MagickWand *) NULL);
   3865   assert(wand->signature == MagickWandSignature);
   3866   if (wand->debug != MagickFalse)
   3867     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3868   if (wand->images == (Image *) NULL)
   3869     {
   3870       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3871         "ContainsNoImages","`%s'",wand->name);
   3872       return((MagickWand *) NULL);
   3873     }
   3874   image=GetImageMask(wand->images,type,wand->exception);
   3875   if (image == (Image *) NULL)
   3876     return((MagickWand *) NULL);
   3877   return(CloneMagickWandFromImages(wand,image));
   3878 }
   3879 
   3880 /*
   3882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3883 %                                                                             %
   3884 %                                                                             %
   3885 %                                                                             %
   3886 %   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                 %
   3887 %                                                                             %
   3888 %                                                                             %
   3889 %                                                                             %
   3890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3891 %
   3892 %  MagickGetImageBackgroundColor() returns the image background color.
   3893 %
   3894 %  The format of the MagickGetImageBackgroundColor method is:
   3895 %
   3896 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
   3897 %        PixelWand *background_color)
   3898 %
   3899 %  A description of each parameter follows:
   3900 %
   3901 %    o wand: the magick wand.
   3902 %
   3903 %    o background_color: Return the background color.
   3904 %
   3905 */
   3906 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
   3907   PixelWand *background_color)
   3908 {
   3909   assert(wand != (MagickWand *) NULL);
   3910   assert(wand->signature == MagickWandSignature);
   3911   if (wand->debug != MagickFalse)
   3912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3913   if (wand->images == (Image *) NULL)
   3914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   3915   PixelSetPixelColor(background_color,&wand->images->background_color);
   3916   return(MagickTrue);
   3917 }
   3918 
   3919 /*
   3921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3922 %                                                                             %
   3923 %                                                                             %
   3924 %                                                                             %
   3925 %   M a g i c k G e t I m a g e B l o b                                       %
   3926 %                                                                             %
   3927 %                                                                             %
   3928 %                                                                             %
   3929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3930 %
   3931 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
   3932 %  the image as a blob (a formatted "file" in memory) and its length, starting
   3933 %  from the current position in the image sequence.  Use MagickSetImageFormat()
   3934 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
   3935 %
   3936 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
   3937 %  the image sequence.
   3938 %
   3939 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
   3940 %
   3941 %  The format of the MagickGetImageBlob method is:
   3942 %
   3943 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
   3944 %
   3945 %  A description of each parameter follows:
   3946 %
   3947 %    o wand: the magick wand.
   3948 %
   3949 %    o length: the length of the blob.
   3950 %
   3951 */
   3952 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
   3953 {
   3954   unsigned char
   3955     *blob;
   3956 
   3957   assert(wand != (MagickWand *) NULL);
   3958   assert(wand->signature == MagickWandSignature);
   3959   if (wand->debug != MagickFalse)
   3960     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   3961   if (wand->images == (Image *) NULL)
   3962     {
   3963       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   3964         "ContainsNoImages","`%s'",wand->name);
   3965       return((unsigned char *) NULL);
   3966     }
   3967   blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
   3968     wand->exception);
   3969   return(blob);
   3970 }
   3971 
   3972 /*
   3974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3975 %                                                                             %
   3976 %                                                                             %
   3977 %                                                                             %
   3978 %   M a g i c k G e t I m a g e s B l o b                                     %
   3979 %                                                                             %
   3980 %                                                                             %
   3981 %                                                                             %
   3982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3983 %
   3984 %  MagickGetImagesBlob() implements direct to memory image formats.  It
   3985 %  returns the image sequence as a blob and its length.  The format of the image
   3986 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
   3987 %  return a different image format, use MagickSetImageFormat().
   3988 %
   3989 %  Note, some image formats do not permit multiple images to the same image
   3990 %  stream (e.g. JPEG).  in this instance, just the first image of the
   3991 %  sequence is returned as a blob.
   3992 %
   3993 %  The format of the MagickGetImagesBlob method is:
   3994 %
   3995 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
   3996 %
   3997 %  A description of each parameter follows:
   3998 %
   3999 %    o wand: the magick wand.
   4000 %
   4001 %    o length: the length of the blob.
   4002 %
   4003 */
   4004 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
   4005 {
   4006   unsigned char
   4007     *blob;
   4008 
   4009   assert(wand != (MagickWand *) NULL);
   4010   assert(wand->signature == MagickWandSignature);
   4011   if (wand->debug != MagickFalse)
   4012     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4013   if (wand->images == (Image *) NULL)
   4014     {
   4015       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4016         "ContainsNoImages","`%s'",wand->name);
   4017       return((unsigned char *) NULL);
   4018     }
   4019   blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
   4020     wand->images),length,wand->exception);
   4021   return(blob);
   4022 }
   4023 
   4024 /*
   4026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4027 %                                                                             %
   4028 %                                                                             %
   4029 %                                                                             %
   4030 %   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                         %
   4031 %                                                                             %
   4032 %                                                                             %
   4033 %                                                                             %
   4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4035 %
   4036 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
   4037 %  image.
   4038 %
   4039 %  The format of the MagickGetImageBluePrimary method is:
   4040 %
   4041 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
   4042 %        double *y,double *z)
   4043 %
   4044 %  A description of each parameter follows:
   4045 %
   4046 %    o wand: the magick wand.
   4047 %
   4048 %    o x: the chromaticity blue primary x-point.
   4049 %
   4050 %    o y: the chromaticity blue primary y-point.
   4051 %
   4052 %    o z: the chromaticity blue primary z-point.
   4053 %
   4054 */
   4055 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
   4056   double *x,double *y,double *z)
   4057 {
   4058   assert(wand != (MagickWand *) NULL);
   4059   assert(wand->signature == MagickWandSignature);
   4060   if (wand->debug != MagickFalse)
   4061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4062   if (wand->images == (Image *) NULL)
   4063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4064   *x=wand->images->chromaticity.blue_primary.x;
   4065   *y=wand->images->chromaticity.blue_primary.y;
   4066   *z=wand->images->chromaticity.blue_primary.z;
   4067   return(MagickTrue);
   4068 }
   4069 
   4070 /*
   4072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4073 %                                                                             %
   4074 %                                                                             %
   4075 %                                                                             %
   4076 %   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                         %
   4077 %                                                                             %
   4078 %                                                                             %
   4079 %                                                                             %
   4080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4081 %
   4082 %  MagickGetImageBorderColor() returns the image border color.
   4083 %
   4084 %  The format of the MagickGetImageBorderColor method is:
   4085 %
   4086 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
   4087 %        PixelWand *border_color)
   4088 %
   4089 %  A description of each parameter follows:
   4090 %
   4091 %    o wand: the magick wand.
   4092 %
   4093 %    o border_color: Return the border color.
   4094 %
   4095 */
   4096 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
   4097   PixelWand *border_color)
   4098 {
   4099   assert(wand != (MagickWand *) NULL);
   4100   assert(wand->signature == MagickWandSignature);
   4101   if (wand->debug != MagickFalse)
   4102     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4103   if (wand->images == (Image *) NULL)
   4104     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4105   PixelSetPixelColor(border_color,&wand->images->border_color);
   4106   return(MagickTrue);
   4107 }
   4108 
   4109 /*
   4111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4112 %                                                                             %
   4113 %                                                                             %
   4114 %                                                                             %
   4115 %   M a g i c k G e t I m a g e F e a t u r e s                               %
   4116 %                                                                             %
   4117 %                                                                             %
   4118 %                                                                             %
   4119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4120 %
   4121 %  MagickGetImageFeatures() returns features for each channel in the
   4122 %  image in each of four directions (horizontal, vertical, left and right
   4123 %  diagonals) for the specified distance.  The features include the angular
   4124 %  second moment, contrast, correlation, sum of squares: variance, inverse
   4125 %  difference moment, sum average, sum varience, sum entropy, entropy,
   4126 %  difference variance, difference entropy, information measures of
   4127 %  correlation 1, information measures of correlation 2, and maximum
   4128 %  correlation coefficient.  You can access the red channel contrast, for
   4129 %  example, like this:
   4130 %
   4131 %      channel_features=MagickGetImageFeatures(wand,1);
   4132 %      contrast=channel_features[RedPixelChannel].contrast[0];
   4133 %
   4134 %  Use MagickRelinquishMemory() to free the statistics buffer.
   4135 %
   4136 %  The format of the MagickGetImageFeatures method is:
   4137 %
   4138 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
   4139 %        const size_t distance)
   4140 %
   4141 %  A description of each parameter follows:
   4142 %
   4143 %    o wand: the magick wand.
   4144 %
   4145 %    o distance: the distance.
   4146 %
   4147 */
   4148 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
   4149   const size_t distance)
   4150 {
   4151   assert(wand != (MagickWand *) NULL);
   4152   assert(wand->signature == MagickWandSignature);
   4153   if (wand->debug != MagickFalse)
   4154     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4155   if (wand->images == (Image *) NULL)
   4156     {
   4157       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4158         "ContainsNoImages","`%s'",wand->name);
   4159       return((ChannelFeatures *) NULL);
   4160     }
   4161   return(GetImageFeatures(wand->images,distance,wand->exception));
   4162 }
   4163 
   4164 /*
   4166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4167 %                                                                             %
   4168 %                                                                             %
   4169 %                                                                             %
   4170 %   M a g i c k G e t I m a g e K u r t o s i s                               %
   4171 %                                                                             %
   4172 %                                                                             %
   4173 %                                                                             %
   4174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4175 %
   4176 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
   4177 %  more image channels.
   4178 %
   4179 %  The format of the MagickGetImageKurtosis method is:
   4180 %
   4181 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
   4182 %        double *kurtosis,double *skewness)
   4183 %
   4184 %  A description of each parameter follows:
   4185 %
   4186 %    o wand: the magick wand.
   4187 %
   4188 %    o kurtosis:  The kurtosis for the specified channel(s).
   4189 %
   4190 %    o skewness:  The skewness for the specified channel(s).
   4191 %
   4192 */
   4193 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
   4194   double *kurtosis,double *skewness)
   4195 {
   4196   MagickBooleanType
   4197     status;
   4198 
   4199   assert(wand != (MagickWand *) NULL);
   4200   assert(wand->signature == MagickWandSignature);
   4201   if (wand->debug != MagickFalse)
   4202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4203   if (wand->images == (Image *) NULL)
   4204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4205   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
   4206   return(status);
   4207 }
   4208 
   4209 /*
   4211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4212 %                                                                             %
   4213 %                                                                             %
   4214 %                                                                             %
   4215 %   M a g i c k G e t I m a g e M e a n                                       %
   4216 %                                                                             %
   4217 %                                                                             %
   4218 %                                                                             %
   4219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4220 %
   4221 %  MagickGetImageMean() gets the mean and standard deviation of one or more
   4222 %  image channels.
   4223 %
   4224 %  The format of the MagickGetImageMean method is:
   4225 %
   4226 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
   4227 %        double *standard_deviation)
   4228 %
   4229 %  A description of each parameter follows:
   4230 %
   4231 %    o wand: the magick wand.
   4232 %
   4233 %    o channel: the image channel(s).
   4234 %
   4235 %    o mean:  The mean pixel value for the specified channel(s).
   4236 %
   4237 %    o standard_deviation:  The standard deviation for the specified channel(s).
   4238 %
   4239 */
   4240 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
   4241   double *standard_deviation)
   4242 {
   4243   MagickBooleanType
   4244     status;
   4245 
   4246   assert(wand != (MagickWand *) NULL);
   4247   assert(wand->signature == MagickWandSignature);
   4248   if (wand->debug != MagickFalse)
   4249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4250   if (wand->images == (Image *) NULL)
   4251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4252   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
   4253   return(status);
   4254 }
   4255 
   4256 /*
   4258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4259 %                                                                             %
   4260 %                                                                             %
   4261 %                                                                             %
   4262 %   M a g i c k G e t I m a g e R a n g e                                     %
   4263 %                                                                             %
   4264 %                                                                             %
   4265 %                                                                             %
   4266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4267 %
   4268 %  MagickGetImageRange() gets the range for one or more image channels.
   4269 %
   4270 %  The format of the MagickGetImageRange method is:
   4271 %
   4272 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
   4273 %        double *maxima)
   4274 %
   4275 %  A description of each parameter follows:
   4276 %
   4277 %    o wand: the magick wand.
   4278 %
   4279 %    o minima:  The minimum pixel value for the specified channel(s).
   4280 %
   4281 %    o maxima:  The maximum pixel value for the specified channel(s).
   4282 %
   4283 */
   4284 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
   4285   double *minima,double *maxima)
   4286 {
   4287   MagickBooleanType
   4288     status;
   4289 
   4290   assert(wand != (MagickWand *) NULL);
   4291   assert(wand->signature == MagickWandSignature);
   4292   if (wand->debug != MagickFalse)
   4293     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4294   if (wand->images == (Image *) NULL)
   4295     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4296   status=GetImageRange(wand->images,minima,maxima,wand->exception);
   4297   return(status);
   4298 }
   4299 
   4300 /*
   4302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4303 %                                                                             %
   4304 %                                                                             %
   4305 %                                                                             %
   4306 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
   4307 %                                                                             %
   4308 %                                                                             %
   4309 %                                                                             %
   4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4311 %
   4312 %  MagickGetImageStatistics() returns statistics for each channel in the
   4313 %  image.  The statistics include the channel depth, its minima and
   4314 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
   4315 %  You can access the red channel mean, for example, like this:
   4316 %
   4317 %      channel_statistics=MagickGetImageStatistics(wand);
   4318 %      red_mean=channel_statistics[RedPixelChannel].mean;
   4319 %
   4320 %  Use MagickRelinquishMemory() to free the statistics buffer.
   4321 %
   4322 %  The format of the MagickGetImageStatistics method is:
   4323 %
   4324 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
   4325 %
   4326 %  A description of each parameter follows:
   4327 %
   4328 %    o wand: the magick wand.
   4329 %
   4330 */
   4331 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
   4332 {
   4333   assert(wand != (MagickWand *) NULL);
   4334   assert(wand->signature == MagickWandSignature);
   4335   if (wand->debug != MagickFalse)
   4336     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4337   if (wand->images == (Image *) NULL)
   4338     {
   4339       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4340         "ContainsNoImages","`%s'",wand->name);
   4341       return((ChannelStatistics *) NULL);
   4342     }
   4343   return(GetImageStatistics(wand->images,wand->exception));
   4344 }
   4345 
   4346 /*
   4348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4349 %                                                                             %
   4350 %                                                                             %
   4351 %                                                                             %
   4352 %   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                     %
   4353 %                                                                             %
   4354 %                                                                             %
   4355 %                                                                             %
   4356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4357 %
   4358 %  MagickGetImageColormapColor() returns the color of the specified colormap
   4359 %  index.
   4360 %
   4361 %  The format of the MagickGetImageColormapColor method is:
   4362 %
   4363 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
   4364 %        const size_t index,PixelWand *color)
   4365 %
   4366 %  A description of each parameter follows:
   4367 %
   4368 %    o wand: the magick wand.
   4369 %
   4370 %    o index: the offset into the image colormap.
   4371 %
   4372 %    o color: Return the colormap color in this wand.
   4373 %
   4374 */
   4375 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
   4376   const size_t index,PixelWand *color)
   4377 {
   4378   assert(wand != (MagickWand *) NULL);
   4379   assert(wand->signature == MagickWandSignature);
   4380   if (wand->debug != MagickFalse)
   4381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4382   if (wand->images == (Image *) NULL)
   4383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4384   if ((wand->images->colormap == (PixelInfo *) NULL) ||
   4385       (index >= wand->images->colors))
   4386     {
   4387       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4388         "InvalidColormapIndex","`%s'",wand->name);
   4389       return(MagickFalse);
   4390     }
   4391   PixelSetPixelColor(color,wand->images->colormap+index);
   4392   return(MagickTrue);
   4393 }
   4394 
   4395 /*
   4397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4398 %                                                                             %
   4399 %                                                                             %
   4400 %                                                                             %
   4401 %   M a g i c k G e t I m a g e C o l o r s                                   %
   4402 %                                                                             %
   4403 %                                                                             %
   4404 %                                                                             %
   4405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4406 %
   4407 %  MagickGetImageColors() gets the number of unique colors in the image.
   4408 %
   4409 %  The format of the MagickGetImageColors method is:
   4410 %
   4411 %      size_t MagickGetImageColors(MagickWand *wand)
   4412 %
   4413 %  A description of each parameter follows:
   4414 %
   4415 %    o wand: the magick wand.
   4416 %
   4417 */
   4418 WandExport size_t MagickGetImageColors(MagickWand *wand)
   4419 {
   4420   assert(wand != (MagickWand *) NULL);
   4421   assert(wand->signature == MagickWandSignature);
   4422   if (wand->debug != MagickFalse)
   4423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4424   if (wand->images == (Image *) NULL)
   4425     {
   4426       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4427         "ContainsNoImages","`%s'",wand->name);
   4428       return(0);
   4429     }
   4430   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
   4431 }
   4432 
   4433 /*
   4435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4436 %                                                                             %
   4437 %                                                                             %
   4438 %                                                                             %
   4439 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
   4440 %                                                                             %
   4441 %                                                                             %
   4442 %                                                                             %
   4443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4444 %
   4445 %  MagickGetImageColorspace() gets the image colorspace.
   4446 %
   4447 %  The format of the MagickGetImageColorspace method is:
   4448 %
   4449 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
   4450 %
   4451 %  A description of each parameter follows:
   4452 %
   4453 %    o wand: the magick wand.
   4454 %
   4455 */
   4456 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
   4457 {
   4458   assert(wand != (MagickWand *) NULL);
   4459   assert(wand->signature == MagickWandSignature);
   4460   if (wand->debug != MagickFalse)
   4461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4462   if (wand->images == (Image *) NULL)
   4463     {
   4464       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4465         "ContainsNoImages","`%s'",wand->name);
   4466       return(UndefinedColorspace);
   4467     }
   4468   return(wand->images->colorspace);
   4469 }
   4470 
   4471 /*
   4473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4474 %                                                                             %
   4475 %                                                                             %
   4476 %                                                                             %
   4477 %   M a g i c k G e t I m a g e C o m p o s e                                 %
   4478 %                                                                             %
   4479 %                                                                             %
   4480 %                                                                             %
   4481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4482 %
   4483 %  MagickGetImageCompose() returns the composite operator associated with the
   4484 %  image.
   4485 %
   4486 %  The format of the MagickGetImageCompose method is:
   4487 %
   4488 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
   4489 %
   4490 %  A description of each parameter follows:
   4491 %
   4492 %    o wand: the magick wand.
   4493 %
   4494 */
   4495 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
   4496 {
   4497   assert(wand != (MagickWand *) NULL);
   4498   assert(wand->signature == MagickWandSignature);
   4499   if (wand->debug != MagickFalse)
   4500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4501   if (wand->images == (Image *) NULL)
   4502     {
   4503       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4504         "ContainsNoImages","`%s'",wand->name);
   4505       return(UndefinedCompositeOp);
   4506     }
   4507   return(wand->images->compose);
   4508 }
   4509 
   4510 /*
   4512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4513 %                                                                             %
   4514 %                                                                             %
   4515 %                                                                             %
   4516 %   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                         %
   4517 %                                                                             %
   4518 %                                                                             %
   4519 %                                                                             %
   4520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4521 %
   4522 %  MagickGetImageCompression() gets the image compression.
   4523 %
   4524 %  The format of the MagickGetImageCompression method is:
   4525 %
   4526 %      CompressionType MagickGetImageCompression(MagickWand *wand)
   4527 %
   4528 %  A description of each parameter follows:
   4529 %
   4530 %    o wand: the magick wand.
   4531 %
   4532 */
   4533 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
   4534 {
   4535   assert(wand != (MagickWand *) NULL);
   4536   assert(wand->signature == MagickWandSignature);
   4537   if (wand->debug != MagickFalse)
   4538     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4539   if (wand->images == (Image *) NULL)
   4540     {
   4541       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4542         "ContainsNoImages","`%s'",wand->name);
   4543       return(UndefinedCompression);
   4544     }
   4545   return(wand->images->compression);
   4546 }
   4547 
   4548 /*
   4550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4551 %                                                                             %
   4552 %                                                                             %
   4553 %                                                                             %
   4554 %   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           %
   4555 %                                                                             %
   4556 %                                                                             %
   4557 %                                                                             %
   4558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4559 %
   4560 %  MagickGetImageCompressionQuality() gets the image compression quality.
   4561 %
   4562 %  The format of the MagickGetImageCompressionQuality method is:
   4563 %
   4564 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
   4565 %
   4566 %  A description of each parameter follows:
   4567 %
   4568 %    o wand: the magick wand.
   4569 %
   4570 */
   4571 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
   4572 {
   4573   assert(wand != (MagickWand *) NULL);
   4574   assert(wand->signature == MagickWandSignature);
   4575   if (wand->debug != MagickFalse)
   4576     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4577   if (wand->images == (Image *) NULL)
   4578     {
   4579       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4580         "ContainsNoImages","`%s'",wand->name);
   4581       return(0UL);
   4582     }
   4583   return(wand->images->quality);
   4584 }
   4585 
   4586 /*
   4588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4589 %                                                                             %
   4590 %                                                                             %
   4591 %                                                                             %
   4592 %   M a g i c k G e t I m a g e D e l a y                                     %
   4593 %                                                                             %
   4594 %                                                                             %
   4595 %                                                                             %
   4596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4597 %
   4598 %  MagickGetImageDelay() gets the image delay.
   4599 %
   4600 %  The format of the MagickGetImageDelay method is:
   4601 %
   4602 %      size_t MagickGetImageDelay(MagickWand *wand)
   4603 %
   4604 %  A description of each parameter follows:
   4605 %
   4606 %    o wand: the magick wand.
   4607 %
   4608 */
   4609 WandExport size_t MagickGetImageDelay(MagickWand *wand)
   4610 {
   4611   assert(wand != (MagickWand *) NULL);
   4612   assert(wand->signature == MagickWandSignature);
   4613   if (wand->debug != MagickFalse)
   4614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4615   if (wand->images == (Image *) NULL)
   4616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4617   return(wand->images->delay);
   4618 }
   4619 
   4620 /*
   4622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4623 %                                                                             %
   4624 %                                                                             %
   4625 %                                                                             %
   4626 %   M a g i c k G e t I m a g e D e p t h                                     %
   4627 %                                                                             %
   4628 %                                                                             %
   4629 %                                                                             %
   4630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4631 %
   4632 %  MagickGetImageDepth() gets the image depth.
   4633 %
   4634 %  The format of the MagickGetImageDepth method is:
   4635 %
   4636 %      size_t MagickGetImageDepth(MagickWand *wand)
   4637 %
   4638 %  A description of each parameter follows:
   4639 %
   4640 %    o wand: the magick wand.
   4641 %
   4642 */
   4643 WandExport size_t MagickGetImageDepth(MagickWand *wand)
   4644 {
   4645   assert(wand != (MagickWand *) NULL);
   4646   assert(wand->signature == MagickWandSignature);
   4647   if (wand->debug != MagickFalse)
   4648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4649   if (wand->images == (Image *) NULL)
   4650     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4651   return(wand->images->depth);
   4652 }
   4653 
   4654 /*
   4656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4657 %                                                                             %
   4658 %                                                                             %
   4659 %                                                                             %
   4660 %   M a g i c k G e t I m a g e D i s p o s e                                 %
   4661 %                                                                             %
   4662 %                                                                             %
   4663 %                                                                             %
   4664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4665 %
   4666 %  MagickGetImageDispose() gets the image disposal method.
   4667 %
   4668 %  The format of the MagickGetImageDispose method is:
   4669 %
   4670 %      DisposeType MagickGetImageDispose(MagickWand *wand)
   4671 %
   4672 %  A description of each parameter follows:
   4673 %
   4674 %    o wand: the magick wand.
   4675 %
   4676 */
   4677 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
   4678 {
   4679   assert(wand != (MagickWand *) NULL);
   4680   assert(wand->signature == MagickWandSignature);
   4681   if (wand->debug != MagickFalse)
   4682     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4683   if (wand->images == (Image *) NULL)
   4684     {
   4685       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4686         "ContainsNoImages","`%s'",wand->name);
   4687       return(UndefinedDispose);
   4688     }
   4689   return((DisposeType) wand->images->dispose);
   4690 }
   4691 
   4692 /*
   4694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4695 %                                                                             %
   4696 %                                                                             %
   4697 %                                                                             %
   4698 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
   4699 %                                                                             %
   4700 %                                                                             %
   4701 %                                                                             %
   4702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4703 %
   4704 %  MagickGetImageDistortion() compares an image to a reconstructed image and
   4705 %  returns the specified distortion metric.
   4706 %
   4707 %  The format of the MagickGetImageDistortion method is:
   4708 %
   4709 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
   4710 %        const MagickWand *reference,const MetricType metric,
   4711 %        double *distortion)
   4712 %
   4713 %  A description of each parameter follows:
   4714 %
   4715 %    o wand: the magick wand.
   4716 %
   4717 %    o reference: the reference wand.
   4718 %
   4719 %    o metric: the metric.
   4720 %
   4721 %    o distortion: the computed distortion between the images.
   4722 %
   4723 */
   4724 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
   4725   const MagickWand *reference,const MetricType metric,double *distortion)
   4726 {
   4727   MagickBooleanType
   4728     status;
   4729 
   4730   assert(wand != (MagickWand *) NULL);
   4731   assert(wand->signature == MagickWandSignature);
   4732   if (wand->debug != MagickFalse)
   4733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4734   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   4735     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   4736   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
   4737     wand->exception);
   4738   return(status);
   4739 }
   4740 
   4741 /*
   4743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4744 %                                                                             %
   4745 %                                                                             %
   4746 %                                                                             %
   4747 %   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                         %
   4748 %                                                                             %
   4749 %                                                                             %
   4750 %                                                                             %
   4751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4752 %
   4753 %  MagickGetImageDistortions() compares one or more pixel channels of an
   4754 %  image to a reconstructed image and returns the specified distortion metrics.
   4755 %
   4756 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
   4757 %
   4758 %  The format of the MagickGetImageDistortion method is:
   4759 %
   4760 %      double *MagickGetImageDistortion(MagickWand *wand,
   4761 %        const MagickWand *reference,const MetricType metric)
   4762 %
   4763 %  A description of each parameter follows:
   4764 %
   4765 %    o wand: the magick wand.
   4766 %
   4767 %    o reference: the reference wand.
   4768 %
   4769 %    o metric: the metric.
   4770 %
   4771 */
   4772 WandExport double *MagickGetImageDistortions(MagickWand *wand,
   4773   const MagickWand *reference,const MetricType metric)
   4774 {
   4775   double
   4776     *channel_distortion;
   4777 
   4778   assert(wand != (MagickWand *) NULL);
   4779   assert(wand->signature == MagickWandSignature);
   4780   if (wand->debug != MagickFalse)
   4781     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4782   assert(reference != (MagickWand *) NULL);
   4783   assert(reference->signature == MagickWandSignature);
   4784   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   4785     {
   4786       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4787         "ContainsNoImages","`%s'",wand->name);
   4788       return((double *) NULL);
   4789     }
   4790   channel_distortion=GetImageDistortions(wand->images,reference->images,
   4791     metric,wand->exception);
   4792   return(channel_distortion);
   4793 }
   4794 
   4795 /*
   4797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4798 %                                                                             %
   4799 %                                                                             %
   4800 %                                                                             %
   4801 %   M a g i c k G e t I m a g e E n d i a n                                   %
   4802 %                                                                             %
   4803 %                                                                             %
   4804 %                                                                             %
   4805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4806 %
   4807 %  MagickGetImageEndian() gets the image endian.
   4808 %
   4809 %  The format of the MagickGetImageEndian method is:
   4810 %
   4811 %      EndianType MagickGetImageEndian(MagickWand *wand)
   4812 %
   4813 %  A description of each parameter follows:
   4814 %
   4815 %    o wand: the magick wand.
   4816 %
   4817 */
   4818 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
   4819 {
   4820   assert(wand != (MagickWand *) NULL);
   4821   assert(wand->signature == MagickWandSignature);
   4822   if (wand->debug != MagickFalse)
   4823     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4824   if (wand->images == (Image *) NULL)
   4825     {
   4826       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4827         "ContainsNoImages","`%s'",wand->name);
   4828       return(UndefinedEndian);
   4829     }
   4830   return(wand->images->endian);
   4831 }
   4832 
   4833 /*
   4835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4836 %                                                                             %
   4837 %                                                                             %
   4838 %                                                                             %
   4839 %   M a g i c k G e t I m a g e F i l e n a m e                               %
   4840 %                                                                             %
   4841 %                                                                             %
   4842 %                                                                             %
   4843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4844 %
   4845 %  MagickGetImageFilename() returns the filename of a particular image in a
   4846 %  sequence.
   4847 %
   4848 %  The format of the MagickGetImageFilename method is:
   4849 %
   4850 %      char *MagickGetImageFilename(MagickWand *wand)
   4851 %
   4852 %  A description of each parameter follows:
   4853 %
   4854 %    o wand: the magick wand.
   4855 %
   4856 */
   4857 WandExport char *MagickGetImageFilename(MagickWand *wand)
   4858 {
   4859   assert(wand != (MagickWand *) NULL);
   4860   assert(wand->signature == MagickWandSignature);
   4861   if (wand->debug != MagickFalse)
   4862     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4863   if (wand->images == (Image *) NULL)
   4864     {
   4865       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4866         "ContainsNoImages","`%s'",wand->name);
   4867       return((char *) NULL);
   4868     }
   4869   return(AcquireString(wand->images->filename));
   4870 }
   4871 
   4872 /*
   4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4875 %                                                                             %
   4876 %                                                                             %
   4877 %                                                                             %
   4878 %   M a g i c k G e t I m a g e F o r m a t                                   %
   4879 %                                                                             %
   4880 %                                                                             %
   4881 %                                                                             %
   4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4883 %
   4884 %  MagickGetImageFormat() returns the format of a particular image in a
   4885 %  sequence.
   4886 %
   4887 %  The format of the MagickGetImageFormat method is:
   4888 %
   4889 %      char *MagickGetImageFormat(MagickWand *wand)
   4890 %
   4891 %  A description of each parameter follows:
   4892 %
   4893 %    o wand: the magick wand.
   4894 %
   4895 */
   4896 WandExport char *MagickGetImageFormat(MagickWand *wand)
   4897 {
   4898   assert(wand != (MagickWand *) NULL);
   4899   assert(wand->signature == MagickWandSignature);
   4900   if (wand->debug != MagickFalse)
   4901     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4902   if (wand->images == (Image *) NULL)
   4903     {
   4904       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4905         "ContainsNoImages","`%s'",wand->name);
   4906       return((char *) NULL);
   4907     }
   4908   return(AcquireString(wand->images->magick));
   4909 }
   4910 
   4911 /*
   4913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4914 %                                                                             %
   4915 %                                                                             %
   4916 %                                                                             %
   4917 %   M a g i c k G e t I m a g e F u z z                                       %
   4918 %                                                                             %
   4919 %                                                                             %
   4920 %                                                                             %
   4921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4922 %
   4923 %  MagickGetImageFuzz() gets the image fuzz.
   4924 %
   4925 %  The format of the MagickGetImageFuzz method is:
   4926 %
   4927 %      double MagickGetImageFuzz(MagickWand *wand)
   4928 %
   4929 %  A description of each parameter follows:
   4930 %
   4931 %    o wand: the magick wand.
   4932 %
   4933 */
   4934 WandExport double MagickGetImageFuzz(MagickWand *wand)
   4935 {
   4936   assert(wand != (MagickWand *) NULL);
   4937   assert(wand->signature == MagickWandSignature);
   4938   if (wand->debug != MagickFalse)
   4939     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4940   if (wand->images == (Image *) NULL)
   4941     {
   4942       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4943         "ContainsNoImages","`%s'",wand->name);
   4944       return(0.0);
   4945     }
   4946   return(wand->images->fuzz);
   4947 }
   4948 
   4949 /*
   4951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4952 %                                                                             %
   4953 %                                                                             %
   4954 %                                                                             %
   4955 %   M a g i c k G e t I m a g e G a m m a                                     %
   4956 %                                                                             %
   4957 %                                                                             %
   4958 %                                                                             %
   4959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4960 %
   4961 %  MagickGetImageGamma() gets the image gamma.
   4962 %
   4963 %  The format of the MagickGetImageGamma method is:
   4964 %
   4965 %      double MagickGetImageGamma(MagickWand *wand)
   4966 %
   4967 %  A description of each parameter follows:
   4968 %
   4969 %    o wand: the magick wand.
   4970 %
   4971 */
   4972 WandExport double MagickGetImageGamma(MagickWand *wand)
   4973 {
   4974   assert(wand != (MagickWand *) NULL);
   4975   assert(wand->signature == MagickWandSignature);
   4976   if (wand->debug != MagickFalse)
   4977     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   4978   if (wand->images == (Image *) NULL)
   4979     {
   4980       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   4981         "ContainsNoImages","`%s'",wand->name);
   4982       return(0.0);
   4983     }
   4984   return(wand->images->gamma);
   4985 }
   4986 
   4987 /*
   4989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4990 %                                                                             %
   4991 %                                                                             %
   4992 %                                                                             %
   4993 %   M a g i c k G e t I m a g e G r a v i t y                                 %
   4994 %                                                                             %
   4995 %                                                                             %
   4996 %                                                                             %
   4997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   4998 %
   4999 %  MagickGetImageGravity() gets the image gravity.
   5000 %
   5001 %  The format of the MagickGetImageGravity method is:
   5002 %
   5003 %      GravityType MagickGetImageGravity(MagickWand *wand)
   5004 %
   5005 %  A description of each parameter follows:
   5006 %
   5007 %    o wand: the magick wand.
   5008 %
   5009 */
   5010 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
   5011 {
   5012   assert(wand != (MagickWand *) NULL);
   5013   assert(wand->signature == MagickWandSignature);
   5014   if (wand->debug != MagickFalse)
   5015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5016   if (wand->images == (Image *) NULL)
   5017     {
   5018       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5019         "ContainsNoImages","`%s'",wand->name);
   5020       return(UndefinedGravity);
   5021     }
   5022   return(wand->images->gravity);
   5023 }
   5024 
   5025 /*
   5027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5028 %                                                                             %
   5029 %                                                                             %
   5030 %                                                                             %
   5031 %   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                       %
   5032 %                                                                             %
   5033 %                                                                             %
   5034 %                                                                             %
   5035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5036 %
   5037 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
   5038 %
   5039 %  The format of the MagickGetImageGreenPrimary method is:
   5040 %
   5041 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
   5042 %        double *y,double *z)
   5043 %
   5044 %  A description of each parameter follows:
   5045 %
   5046 %    o wand: the magick wand.
   5047 %
   5048 %    o x: the chromaticity green primary x-point.
   5049 %
   5050 %    o y: the chromaticity green primary y-point.
   5051 %
   5052 %    o z: the chromaticity green primary z-point.
   5053 %
   5054 */
   5055 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
   5056   double *x,double *y,double *z)
   5057 {
   5058   assert(wand != (MagickWand *) NULL);
   5059   assert(wand->signature == MagickWandSignature);
   5060   if (wand->debug != MagickFalse)
   5061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5062   if (wand->images == (Image *) NULL)
   5063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5064   *x=wand->images->chromaticity.green_primary.x;
   5065   *y=wand->images->chromaticity.green_primary.y;
   5066   *z=wand->images->chromaticity.green_primary.z;
   5067   return(MagickTrue);
   5068 }
   5069 
   5070 /*
   5072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5073 %                                                                             %
   5074 %                                                                             %
   5075 %                                                                             %
   5076 %   M a g i c k G e t I m a g e H e i g h t                                   %
   5077 %                                                                             %
   5078 %                                                                             %
   5079 %                                                                             %
   5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5081 %
   5082 %  MagickGetImageHeight() returns the image height.
   5083 %
   5084 %  The format of the MagickGetImageHeight method is:
   5085 %
   5086 %      size_t MagickGetImageHeight(MagickWand *wand)
   5087 %
   5088 %  A description of each parameter follows:
   5089 %
   5090 %    o wand: the magick wand.
   5091 %
   5092 */
   5093 WandExport size_t MagickGetImageHeight(MagickWand *wand)
   5094 {
   5095   assert(wand != (MagickWand *) NULL);
   5096   assert(wand->signature == MagickWandSignature);
   5097   if (wand->debug != MagickFalse)
   5098     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5099   if (wand->images == (Image *) NULL)
   5100     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5101   return(wand->images->rows);
   5102 }
   5103 
   5104 /*
   5106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5107 %                                                                             %
   5108 %                                                                             %
   5109 %                                                                             %
   5110 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
   5111 %                                                                             %
   5112 %                                                                             %
   5113 %                                                                             %
   5114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5115 %
   5116 %  MagickGetImageHistogram() returns the image histogram as an array of
   5117 %  PixelWand wands.
   5118 %
   5119 %  The format of the MagickGetImageHistogram method is:
   5120 %
   5121 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
   5122 %        size_t *number_colors)
   5123 %
   5124 %  A description of each parameter follows:
   5125 %
   5126 %    o wand: the magick wand.
   5127 %
   5128 %    o number_colors: the number of unique colors in the image and the number
   5129 %      of pixel wands returned.
   5130 %
   5131 */
   5132 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
   5133   size_t *number_colors)
   5134 {
   5135   PixelInfo
   5136     *histogram;
   5137 
   5138   PixelWand
   5139     **pixel_wands;
   5140 
   5141   register ssize_t
   5142     i;
   5143 
   5144   assert(wand != (MagickWand *) NULL);
   5145   assert(wand->signature == MagickWandSignature);
   5146   if (wand->debug != MagickFalse)
   5147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5148   if (wand->images == (Image *) NULL)
   5149     {
   5150       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5151         "ContainsNoImages","`%s'",wand->name);
   5152       return((PixelWand **) NULL);
   5153     }
   5154   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
   5155   if (histogram == (PixelInfo *) NULL)
   5156     return((PixelWand **) NULL);
   5157   pixel_wands=NewPixelWands(*number_colors);
   5158   for (i=0; i < (ssize_t) *number_colors; i++)
   5159   {
   5160     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
   5161     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
   5162   }
   5163   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
   5164   return(pixel_wands);
   5165 }
   5166 
   5167 /*
   5169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5170 %                                                                             %
   5171 %                                                                             %
   5172 %                                                                             %
   5173 %   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                 %
   5174 %                                                                             %
   5175 %                                                                             %
   5176 %                                                                             %
   5177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5178 %
   5179 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
   5180 %
   5181 %  The format of the MagickGetImageInterlaceScheme method is:
   5182 %
   5183 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
   5184 %
   5185 %  A description of each parameter follows:
   5186 %
   5187 %    o wand: the magick wand.
   5188 %
   5189 */
   5190 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
   5191 {
   5192   assert(wand != (MagickWand *) NULL);
   5193   assert(wand->signature == MagickWandSignature);
   5194   if (wand->debug != MagickFalse)
   5195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5196   if (wand->images == (Image *) NULL)
   5197     {
   5198       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5199         "ContainsNoImages","`%s'",wand->name);
   5200       return(UndefinedInterlace);
   5201     }
   5202   return(wand->images->interlace);
   5203 }
   5204 
   5205 /*
   5207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5208 %                                                                             %
   5209 %                                                                             %
   5210 %                                                                             %
   5211 %   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             %
   5212 %                                                                             %
   5213 %                                                                             %
   5214 %                                                                             %
   5215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5216 %
   5217 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
   5218 %  sepcified image.
   5219 %
   5220 %  The format of the MagickGetImageInterpolateMethod method is:
   5221 %
   5222 %      PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
   5223 %
   5224 %  A description of each parameter follows:
   5225 %
   5226 %    o wand: the magick wand.
   5227 %
   5228 */
   5229 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
   5230   MagickWand *wand)
   5231 {
   5232   assert(wand != (MagickWand *) NULL);
   5233   assert(wand->signature == MagickWandSignature);
   5234   if (wand->debug != MagickFalse)
   5235     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5236   if (wand->images == (Image *) NULL)
   5237     {
   5238       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5239         "ContainsNoImages","`%s'",wand->name);
   5240       return(UndefinedInterpolatePixel);
   5241     }
   5242   return(wand->images->interpolate);
   5243 }
   5244 
   5245 /*
   5247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5248 %                                                                             %
   5249 %                                                                             %
   5250 %                                                                             %
   5251 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
   5252 %                                                                             %
   5253 %                                                                             %
   5254 %                                                                             %
   5255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5256 %
   5257 %  MagickGetImageIterations() gets the image iterations.
   5258 %
   5259 %  The format of the MagickGetImageIterations method is:
   5260 %
   5261 %      size_t MagickGetImageIterations(MagickWand *wand)
   5262 %
   5263 %  A description of each parameter follows:
   5264 %
   5265 %    o wand: the magick wand.
   5266 %
   5267 */
   5268 WandExport size_t MagickGetImageIterations(MagickWand *wand)
   5269 {
   5270   assert(wand != (MagickWand *) NULL);
   5271   assert(wand->signature == MagickWandSignature);
   5272   if (wand->debug != MagickFalse)
   5273     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5274   if (wand->images == (Image *) NULL)
   5275     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5276   return(wand->images->iterations);
   5277 }
   5278 
   5279 /*
   5281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5282 %                                                                             %
   5283 %                                                                             %
   5284 %                                                                             %
   5285 %   M a g i c k G e t I m a g e L e n g t h                                   %
   5286 %                                                                             %
   5287 %                                                                             %
   5288 %                                                                             %
   5289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5290 %
   5291 %  MagickGetImageLength() returns the image length in bytes.
   5292 %
   5293 %  The format of the MagickGetImageLength method is:
   5294 %
   5295 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
   5296 %        MagickSizeType *length)
   5297 %
   5298 %  A description of each parameter follows:
   5299 %
   5300 %    o wand: the magick wand.
   5301 %
   5302 %    o length: the image length in bytes.
   5303 %
   5304 */
   5305 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
   5306   MagickSizeType *length)
   5307 {
   5308   assert(wand != (MagickWand *) NULL);
   5309   assert(wand->signature == MagickWandSignature);
   5310   if (wand->debug != MagickFalse)
   5311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5312   if (wand->images == (Image *) NULL)
   5313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5314   *length=GetBlobSize(wand->images);
   5315   return(MagickTrue);
   5316 }
   5317 
   5318 /*
   5320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5321 %                                                                             %
   5322 %                                                                             %
   5323 %                                                                             %
   5324 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
   5325 %                                                                             %
   5326 %                                                                             %
   5327 %                                                                             %
   5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5329 %
   5330 %  MagickGetImageMatteColor() returns the image matte color.
   5331 %
   5332 %  The format of the MagickGetImageMatteColor method is:
   5333 %
   5334 %      MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
   5335 %        PixelWand *matte_color)
   5336 %
   5337 %  A description of each parameter follows:
   5338 %
   5339 %    o wand: the magick wand.
   5340 %
   5341 %    o matte_color: return the alpha color.
   5342 %
   5343 */
   5344 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
   5345   PixelWand *matte_color)
   5346 {
   5347   assert(wand != (MagickWand *)NULL);
   5348   assert(wand->signature == MagickWandSignature);
   5349   if (wand->debug != MagickFalse)
   5350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5351   if (wand->images == (Image *)NULL)
   5352     ThrowWandException(WandError, "ContainsNoImages", wand->name);
   5353   PixelSetPixelColor(matte_color,&wand->images->matte_color);
   5354   return(MagickTrue);
   5355 }
   5356 
   5357 /*
   5359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5360 %                                                                             %
   5361 %                                                                             %
   5362 %                                                                             %
   5363 %   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                         %
   5364 %                                                                             %
   5365 %                                                                             %
   5366 %                                                                             %
   5367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5368 %
   5369 %  MagickGetImageOrientation() returns the image orientation.
   5370 %
   5371 %  The format of the MagickGetImageOrientation method is:
   5372 %
   5373 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
   5374 %
   5375 %  A description of each parameter follows:
   5376 %
   5377 %    o wand: the magick wand.
   5378 %
   5379 */
   5380 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
   5381 {
   5382   assert(wand != (MagickWand *) NULL);
   5383   assert(wand->signature == MagickWandSignature);
   5384   if (wand->debug != MagickFalse)
   5385     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5386   if (wand->images == (Image *) NULL)
   5387     {
   5388       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5389         "ContainsNoImages","`%s'",wand->name);
   5390       return(UndefinedOrientation);
   5391     }
   5392   return(wand->images->orientation);
   5393 }
   5394 
   5395 /*
   5397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5398 %                                                                             %
   5399 %                                                                             %
   5400 %                                                                             %
   5401 %   M a g i c k G e t I m a g e P a g e                                       %
   5402 %                                                                             %
   5403 %                                                                             %
   5404 %                                                                             %
   5405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5406 %
   5407 %  MagickGetImagePage() returns the page geometry associated with the image.
   5408 %
   5409 %  The format of the MagickGetImagePage method is:
   5410 %
   5411 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
   5412 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
   5413 %
   5414 %  A description of each parameter follows:
   5415 %
   5416 %    o wand: the magick wand.
   5417 %
   5418 %    o width: the page width.
   5419 %
   5420 %    o height: the page height.
   5421 %
   5422 %    o x: the page x-offset.
   5423 %
   5424 %    o y: the page y-offset.
   5425 %
   5426 */
   5427 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
   5428   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
   5429 {
   5430   assert(wand != (const MagickWand *) NULL);
   5431   assert(wand->signature == MagickWandSignature);
   5432   if (wand->debug != MagickFalse)
   5433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5434   if (wand->images == (Image *) NULL)
   5435     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5436   *width=wand->images->page.width;
   5437   *height=wand->images->page.height;
   5438   *x=wand->images->page.x;
   5439   *y=wand->images->page.y;
   5440   return(MagickTrue);
   5441 }
   5442 
   5443 /*
   5445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5446 %                                                                             %
   5447 %                                                                             %
   5448 %                                                                             %
   5449 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
   5450 %                                                                             %
   5451 %                                                                             %
   5452 %                                                                             %
   5453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5454 %
   5455 %  MagickGetImagePixelColor() returns the color of the specified pixel.
   5456 %
   5457 %  The format of the MagickGetImagePixelColor method is:
   5458 %
   5459 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
   5460 %        const ssize_t x,const ssize_t y,PixelWand *color)
   5461 %
   5462 %  A description of each parameter follows:
   5463 %
   5464 %    o wand: the magick wand.
   5465 %
   5466 %    o x,y: the pixel offset into the image.
   5467 %
   5468 %    o color: Return the colormap color in this wand.
   5469 %
   5470 */
   5471 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
   5472   const ssize_t x,const ssize_t y,PixelWand *color)
   5473 {
   5474   register const Quantum
   5475     *p;
   5476 
   5477   CacheView
   5478     *image_view;
   5479 
   5480   assert(wand != (MagickWand *) NULL);
   5481   assert(wand->signature == MagickWandSignature);
   5482   if (wand->debug != MagickFalse)
   5483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5484   if (wand->images == (Image *) NULL)
   5485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5486   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
   5487   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
   5488   if (p == (const Quantum *) NULL)
   5489     {
   5490       image_view=DestroyCacheView(image_view);
   5491       return(MagickFalse);
   5492     }
   5493   PixelSetQuantumPixel(wand->images,p,color);
   5494   image_view=DestroyCacheView(image_view);
   5495   return(MagickTrue);
   5496 }
   5497 
   5498 /*
   5500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5501 %                                                                             %
   5502 %                                                                             %
   5503 %                                                                             %
   5504 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
   5505 %                                                                             %
   5506 %                                                                             %
   5507 %                                                                             %
   5508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5509 %
   5510 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
   5511 %
   5512 %  The format of the MagickGetImageRedPrimary method is:
   5513 %
   5514 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
   5515 %        double *y, double *z)
   5516 %
   5517 %  A description of each parameter follows:
   5518 %
   5519 %    o wand: the magick wand.
   5520 %
   5521 %    o x: the chromaticity red primary x-point.
   5522 %
   5523 %    o y: the chromaticity red primary y-point.
   5524 %
   5525 %    o z: the chromaticity red primary z-point.
   5526 %
   5527 */
   5528 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
   5529   double *x,double *y,double *z)
   5530 {
   5531   assert(wand != (MagickWand *) NULL);
   5532   assert(wand->signature == MagickWandSignature);
   5533   if (wand->debug != MagickFalse)
   5534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5535   if (wand->images == (Image *) NULL)
   5536     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5537   *x=wand->images->chromaticity.red_primary.x;
   5538   *y=wand->images->chromaticity.red_primary.y;
   5539   *z=wand->images->chromaticity.red_primary.z;
   5540   return(MagickTrue);
   5541 }
   5542 
   5543 /*
   5545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5546 %                                                                             %
   5547 %                                                                             %
   5548 %                                                                             %
   5549 %   M a g i c k G e t I m a g e R e g i o n                                   %
   5550 %                                                                             %
   5551 %                                                                             %
   5552 %                                                                             %
   5553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5554 %
   5555 %  MagickGetImageRegion() extracts a region of the image and returns it as a
   5556 %  a new wand.
   5557 %
   5558 %  The format of the MagickGetImageRegion method is:
   5559 %
   5560 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
   5561 %        const size_t width,const size_t height,const ssize_t x,
   5562 %        const ssize_t y)
   5563 %
   5564 %  A description of each parameter follows:
   5565 %
   5566 %    o wand: the magick wand.
   5567 %
   5568 %    o width: the region width.
   5569 %
   5570 %    o height: the region height.
   5571 %
   5572 %    o x: the region x offset.
   5573 %
   5574 %    o y: the region y offset.
   5575 %
   5576 */
   5577 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
   5578   const size_t width,const size_t height,const ssize_t x,
   5579   const ssize_t y)
   5580 {
   5581   Image
   5582     *region_image;
   5583 
   5584   RectangleInfo
   5585     region;
   5586 
   5587   assert(wand != (MagickWand *) NULL);
   5588   assert(wand->signature == MagickWandSignature);
   5589   if (wand->debug != MagickFalse)
   5590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5591   if (wand->images == (Image *) NULL)
   5592     return((MagickWand *) NULL);
   5593   region.width=width;
   5594   region.height=height;
   5595   region.x=x;
   5596   region.y=y;
   5597   region_image=CropImage(wand->images,&region,wand->exception);
   5598   if (region_image == (Image *) NULL)
   5599     return((MagickWand *) NULL);
   5600   return(CloneMagickWandFromImages(wand,region_image));
   5601 }
   5602 
   5603 /*
   5605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5606 %                                                                             %
   5607 %                                                                             %
   5608 %                                                                             %
   5609 %   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                 %
   5610 %                                                                             %
   5611 %                                                                             %
   5612 %                                                                             %
   5613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5614 %
   5615 %  MagickGetImageRenderingIntent() gets the image rendering intent.
   5616 %
   5617 %  The format of the MagickGetImageRenderingIntent method is:
   5618 %
   5619 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
   5620 %
   5621 %  A description of each parameter follows:
   5622 %
   5623 %    o wand: the magick wand.
   5624 %
   5625 */
   5626 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
   5627 {
   5628   assert(wand != (MagickWand *) NULL);
   5629   assert(wand->signature == MagickWandSignature);
   5630   if (wand->debug != MagickFalse)
   5631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5632   if (wand->images == (Image *) NULL)
   5633     {
   5634       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5635         "ContainsNoImages","`%s'",wand->name);
   5636       return(UndefinedIntent);
   5637     }
   5638   return((RenderingIntent) wand->images->rendering_intent);
   5639 }
   5640 
   5641 /*
   5643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5644 %                                                                             %
   5645 %                                                                             %
   5646 %                                                                             %
   5647 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
   5648 %                                                                             %
   5649 %                                                                             %
   5650 %                                                                             %
   5651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5652 %
   5653 %  MagickGetImageResolution() gets the image X and Y resolution.
   5654 %
   5655 %  The format of the MagickGetImageResolution method is:
   5656 %
   5657 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
   5658 %        double *y)
   5659 %
   5660 %  A description of each parameter follows:
   5661 %
   5662 %    o wand: the magick wand.
   5663 %
   5664 %    o x: the image x-resolution.
   5665 %
   5666 %    o y: the image y-resolution.
   5667 %
   5668 */
   5669 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
   5670   double *x,double *y)
   5671 {
   5672   assert(wand != (MagickWand *) NULL);
   5673   assert(wand->signature == MagickWandSignature);
   5674   if (wand->debug != MagickFalse)
   5675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5676   if (wand->images == (Image *) NULL)
   5677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5678   *x=wand->images->resolution.x;
   5679   *y=wand->images->resolution.y;
   5680   return(MagickTrue);
   5681 }
   5682 
   5683 /*
   5685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5686 %                                                                             %
   5687 %                                                                             %
   5688 %                                                                             %
   5689 %   M a g i c k G e t I m a g e S c e n e                                     %
   5690 %                                                                             %
   5691 %                                                                             %
   5692 %                                                                             %
   5693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5694 %
   5695 %  MagickGetImageScene() gets the image scene.
   5696 %
   5697 %  The format of the MagickGetImageScene method is:
   5698 %
   5699 %      size_t MagickGetImageScene(MagickWand *wand)
   5700 %
   5701 %  A description of each parameter follows:
   5702 %
   5703 %    o wand: the magick wand.
   5704 %
   5705 */
   5706 WandExport size_t MagickGetImageScene(MagickWand *wand)
   5707 {
   5708   assert(wand != (MagickWand *) NULL);
   5709   assert(wand->signature == MagickWandSignature);
   5710   if (wand->debug != MagickFalse)
   5711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5712   if (wand->images == (Image *) NULL)
   5713     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5714   return(wand->images->scene);
   5715 }
   5716 
   5717 /*
   5719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5720 %                                                                             %
   5721 %                                                                             %
   5722 %                                                                             %
   5723 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
   5724 %                                                                             %
   5725 %                                                                             %
   5726 %                                                                             %
   5727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5728 %
   5729 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
   5730 %  pixel stream.
   5731 %
   5732 %  The format of the MagickGetImageSignature method is:
   5733 %
   5734 %      char *MagickGetImageSignature(MagickWand *wand)
   5735 %
   5736 %  A description of each parameter follows:
   5737 %
   5738 %    o wand: the magick wand.
   5739 %
   5740 */
   5741 WandExport char *MagickGetImageSignature(MagickWand *wand)
   5742 {
   5743   const char
   5744     *value;
   5745 
   5746   MagickBooleanType
   5747     status;
   5748 
   5749   assert(wand != (MagickWand *) NULL);
   5750   assert(wand->signature == MagickWandSignature);
   5751   if (wand->debug != MagickFalse)
   5752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5753   if (wand->images == (Image *) NULL)
   5754     {
   5755       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5756         "ContainsNoImages","`%s'",wand->name);
   5757       return((char *) NULL);
   5758     }
   5759   status=SignatureImage(wand->images,wand->exception);
   5760   if (status == MagickFalse)
   5761     return((char *) NULL);
   5762   value=GetImageProperty(wand->images,"signature",wand->exception);
   5763   if (value == (const char *) NULL)
   5764     return((char *) NULL);
   5765   return(AcquireString(value));
   5766 }
   5767 
   5768 /*
   5770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5771 %                                                                             %
   5772 %                                                                             %
   5773 %                                                                             %
   5774 %   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                   %
   5775 %                                                                             %
   5776 %                                                                             %
   5777 %                                                                             %
   5778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5779 %
   5780 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
   5781 %
   5782 %  The format of the MagickGetImageTicksPerSecond method is:
   5783 %
   5784 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
   5785 %
   5786 %  A description of each parameter follows:
   5787 %
   5788 %    o wand: the magick wand.
   5789 %
   5790 */
   5791 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
   5792 {
   5793   assert(wand != (MagickWand *) NULL);
   5794   assert(wand->signature == MagickWandSignature);
   5795   if (wand->debug != MagickFalse)
   5796     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5797   if (wand->images == (Image *) NULL)
   5798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5799   return((size_t) wand->images->ticks_per_second);
   5800 }
   5801 
   5802 /*
   5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5805 %                                                                             %
   5806 %                                                                             %
   5807 %                                                                             %
   5808 %   M a g i c k G e t I m a g e T y p e                                       %
   5809 %                                                                             %
   5810 %                                                                             %
   5811 %                                                                             %
   5812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5813 %
   5814 %  MagickGetImageType() gets the potential image type:
   5815 %
   5816 %        Bilevel        Grayscale       GrayscaleMatte
   5817 %        Palette        PaletteMatte    TrueColor
   5818 %        TrueColorMatte ColorSeparation ColorSeparationMatte
   5819 %
   5820 %  The format of the MagickGetImageType method is:
   5821 %
   5822 %      ImageType MagickGetImageType(MagickWand *wand)
   5823 %
   5824 %  A description of each parameter follows:
   5825 %
   5826 %    o wand: the magick wand.
   5827 %
   5828 */
   5829 WandExport ImageType MagickGetImageType(MagickWand *wand)
   5830 {
   5831   assert(wand != (MagickWand *) NULL);
   5832   assert(wand->signature == MagickWandSignature);
   5833   if (wand->debug != MagickFalse)
   5834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5835   if (wand->images == (Image *) NULL)
   5836     {
   5837       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5838         "ContainsNoImages","`%s'",wand->name);
   5839       return(UndefinedType);
   5840     }
   5841   return(GetImageType(wand->images));
   5842 }
   5843 
   5844 /*
   5846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5847 %                                                                             %
   5848 %                                                                             %
   5849 %                                                                             %
   5850 %   M a g i c k G e t I m a g e U n i t s                                     %
   5851 %                                                                             %
   5852 %                                                                             %
   5853 %                                                                             %
   5854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5855 %
   5856 %  MagickGetImageUnits() gets the image units of resolution.
   5857 %
   5858 %  The format of the MagickGetImageUnits method is:
   5859 %
   5860 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
   5861 %
   5862 %  A description of each parameter follows:
   5863 %
   5864 %    o wand: the magick wand.
   5865 %
   5866 */
   5867 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
   5868 {
   5869   assert(wand != (MagickWand *) NULL);
   5870   assert(wand->signature == MagickWandSignature);
   5871   if (wand->debug != MagickFalse)
   5872     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5873   if (wand->images == (Image *) NULL)
   5874     {
   5875       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5876         "ContainsNoImages","`%s'",wand->name);
   5877       return(UndefinedResolution);
   5878     }
   5879   return(wand->images->units);
   5880 }
   5881 
   5882 /*
   5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5885 %                                                                             %
   5886 %                                                                             %
   5887 %                                                                             %
   5888 %   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           %
   5889 %                                                                             %
   5890 %                                                                             %
   5891 %                                                                             %
   5892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5893 %
   5894 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
   5895 %  sepcified image.
   5896 %
   5897 %  The format of the MagickGetImageVirtualPixelMethod method is:
   5898 %
   5899 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
   5900 %
   5901 %  A description of each parameter follows:
   5902 %
   5903 %    o wand: the magick wand.
   5904 %
   5905 */
   5906 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
   5907 {
   5908   assert(wand != (MagickWand *) NULL);
   5909   assert(wand->signature == MagickWandSignature);
   5910   if (wand->debug != MagickFalse)
   5911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5912   if (wand->images == (Image *) NULL)
   5913     {
   5914       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   5915         "ContainsNoImages","`%s'",wand->name);
   5916       return(UndefinedVirtualPixelMethod);
   5917     }
   5918   return(GetImageVirtualPixelMethod(wand->images));
   5919 }
   5920 
   5921 /*
   5923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5924 %                                                                             %
   5925 %                                                                             %
   5926 %                                                                             %
   5927 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
   5928 %                                                                             %
   5929 %                                                                             %
   5930 %                                                                             %
   5931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5932 %
   5933 %  MagickGetImageWhitePoint() returns the chromaticy white point.
   5934 %
   5935 %  The format of the MagickGetImageWhitePoint method is:
   5936 %
   5937 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
   5938 %        double *y,double *z)
   5939 %
   5940 %  A description of each parameter follows:
   5941 %
   5942 %    o wand: the magick wand.
   5943 %
   5944 %    o x: the chromaticity white x-point.
   5945 %
   5946 %    o y: the chromaticity white y-point.
   5947 %
   5948 %    o z: the chromaticity white z-point.
   5949 %
   5950 */
   5951 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
   5952   double *x,double *y,double *z)
   5953 {
   5954   assert(wand != (MagickWand *) NULL);
   5955   assert(wand->signature == MagickWandSignature);
   5956   if (wand->debug != MagickFalse)
   5957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5958   if (wand->images == (Image *) NULL)
   5959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5960   *x=wand->images->chromaticity.white_point.x;
   5961   *y=wand->images->chromaticity.white_point.y;
   5962   *z=wand->images->chromaticity.white_point.z;
   5963   return(MagickTrue);
   5964 }
   5965 
   5966 /*
   5968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5969 %                                                                             %
   5970 %                                                                             %
   5971 %                                                                             %
   5972 %   M a g i c k G e t I m a g e W i d t h                                     %
   5973 %                                                                             %
   5974 %                                                                             %
   5975 %                                                                             %
   5976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   5977 %
   5978 %  MagickGetImageWidth() returns the image width.
   5979 %
   5980 %  The format of the MagickGetImageWidth method is:
   5981 %
   5982 %      size_t MagickGetImageWidth(MagickWand *wand)
   5983 %
   5984 %  A description of each parameter follows:
   5985 %
   5986 %    o wand: the magick wand.
   5987 %
   5988 */
   5989 WandExport size_t MagickGetImageWidth(MagickWand *wand)
   5990 {
   5991   assert(wand != (MagickWand *) NULL);
   5992   assert(wand->signature == MagickWandSignature);
   5993   if (wand->debug != MagickFalse)
   5994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   5995   if (wand->images == (Image *) NULL)
   5996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   5997   return(wand->images->columns);
   5998 }
   5999 
   6000 /*
   6002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6003 %                                                                             %
   6004 %                                                                             %
   6005 %                                                                             %
   6006 %   M a g i c k G e t N u m b e r I m a g e s                                 %
   6007 %                                                                             %
   6008 %                                                                             %
   6009 %                                                                             %
   6010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6011 %
   6012 %  MagickGetNumberImages() returns the number of images associated with a
   6013 %  magick wand.
   6014 %
   6015 %  The format of the MagickGetNumberImages method is:
   6016 %
   6017 %      size_t MagickGetNumberImages(MagickWand *wand)
   6018 %
   6019 %  A description of each parameter follows:
   6020 %
   6021 %    o wand: the magick wand.
   6022 %
   6023 */
   6024 WandExport size_t MagickGetNumberImages(MagickWand *wand)
   6025 {
   6026   assert(wand != (MagickWand *) NULL);
   6027   assert(wand->signature == MagickWandSignature);
   6028   if (wand->debug != MagickFalse)
   6029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6030   return(GetImageListLength(wand->images));
   6031 }
   6032 
   6033 /*
   6035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6036 %                                                                             %
   6037 %                                                                             %
   6038 %                                                                             %
   6039 %   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                 %
   6040 %                                                                             %
   6041 %                                                                             %
   6042 %                                                                             %
   6043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6044 %
   6045 %  MagickGetImageTotalInkDensity() gets the image total ink density.
   6046 %
   6047 %  The format of the MagickGetImageTotalInkDensity method is:
   6048 %
   6049 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
   6050 %
   6051 %  A description of each parameter follows:
   6052 %
   6053 %    o wand: the magick wand.
   6054 %
   6055 */
   6056 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
   6057 {
   6058   assert(wand != (MagickWand *) NULL);
   6059   assert(wand->signature == MagickWandSignature);
   6060   if (wand->debug != MagickFalse)
   6061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6062   if (wand->images == (Image *) NULL)
   6063     {
   6064       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6065         "ContainsNoImages","`%s'",wand->name);
   6066       return(0.0);
   6067     }
   6068   return(GetImageTotalInkDensity(wand->images,wand->exception));
   6069 }
   6070 
   6071 /*
   6073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6074 %                                                                             %
   6075 %                                                                             %
   6076 %                                                                             %
   6077 %   M a g i c k H a l d C l u t I m a g e                                     %
   6078 %                                                                             %
   6079 %                                                                             %
   6080 %                                                                             %
   6081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6082 %
   6083 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
   6084 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
   6085 %  dimensions.  Create it with the HALD coder.  You can apply any color
   6086 %  transformation to the Hald image and then use this method to apply the
   6087 %  transform to the image.
   6088 %
   6089 %  The format of the MagickHaldClutImage method is:
   6090 %
   6091 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
   6092 %        const MagickWand *hald_wand)
   6093 %
   6094 %  A description of each parameter follows:
   6095 %
   6096 %    o wand: the magick wand.
   6097 %
   6098 %    o hald_image: the hald CLUT image.
   6099 %
   6100 */
   6101 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
   6102   const MagickWand *hald_wand)
   6103 {
   6104   MagickBooleanType
   6105     status;
   6106 
   6107   assert(wand != (MagickWand *) NULL);
   6108   assert(wand->signature == MagickWandSignature);
   6109   if (wand->debug != MagickFalse)
   6110     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6111   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
   6112     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6113   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
   6114   return(status);
   6115 }
   6116 
   6117 /*
   6119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6120 %                                                                             %
   6121 %                                                                             %
   6122 %                                                                             %
   6123 %   M a g i c k H a s N e x t I m a g e                                       %
   6124 %                                                                             %
   6125 %                                                                             %
   6126 %                                                                             %
   6127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6128 %
   6129 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
   6130 %  traversing the list in the forward direction
   6131 %
   6132 %  The format of the MagickHasNextImage method is:
   6133 %
   6134 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
   6135 %
   6136 %  A description of each parameter follows:
   6137 %
   6138 %    o wand: the magick wand.
   6139 %
   6140 */
   6141 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
   6142 {
   6143   assert(wand != (MagickWand *) NULL);
   6144   assert(wand->signature == MagickWandSignature);
   6145   if (wand->debug != MagickFalse)
   6146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6147   if (wand->images == (Image *) NULL)
   6148     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6149   if (GetNextImageInList(wand->images) == (Image *) NULL)
   6150     return(MagickFalse);
   6151   return(MagickTrue);
   6152 }
   6153 
   6154 /*
   6156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6157 %                                                                             %
   6158 %                                                                             %
   6159 %                                                                             %
   6160 %   M a g i c k H a s P r e v i o u s I m a g e                               %
   6161 %                                                                             %
   6162 %                                                                             %
   6163 %                                                                             %
   6164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6165 %
   6166 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
   6167 %  traversing the list in the reverse direction
   6168 %
   6169 %  The format of the MagickHasPreviousImage method is:
   6170 %
   6171 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
   6172 %
   6173 %  A description of each parameter follows:
   6174 %
   6175 %    o wand: the magick wand.
   6176 %
   6177 */
   6178 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
   6179 {
   6180   assert(wand != (MagickWand *) NULL);
   6181   assert(wand->signature == MagickWandSignature);
   6182   if (wand->debug != MagickFalse)
   6183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6184   if (wand->images == (Image *) NULL)
   6185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6186   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
   6187     return(MagickFalse);
   6188   return(MagickTrue);
   6189 }
   6190 
   6191 /*
   6193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6194 %                                                                             %
   6195 %                                                                             %
   6196 %                                                                             %
   6197 %   M a g i c k I d e n t i f y I m a g e                                     %
   6198 %                                                                             %
   6199 %                                                                             %
   6200 %                                                                             %
   6201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6202 %
   6203 %  MagickIdentifyImage() identifies an image by printing its attributes to the
   6204 %  file.  Attributes include the image width, height, size, and others.
   6205 %
   6206 %  The format of the MagickIdentifyImage method is:
   6207 %
   6208 %      const char *MagickIdentifyImage(MagickWand *wand)
   6209 %
   6210 %  A description of each parameter follows:
   6211 %
   6212 %    o wand: the magick wand.
   6213 %
   6214 */
   6215 WandExport char *MagickIdentifyImage(MagickWand *wand)
   6216 {
   6217   char
   6218     *description,
   6219     filename[MagickPathExtent];
   6220 
   6221   FILE
   6222     *file;
   6223 
   6224   int
   6225     unique_file;
   6226 
   6227   assert(wand != (MagickWand *) NULL);
   6228   assert(wand->signature == MagickWandSignature);
   6229   if (wand->debug != MagickFalse)
   6230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6231   if (wand->images == (Image *) NULL)
   6232     {
   6233       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6234         "ContainsNoImages","`%s'",wand->name);
   6235       return((char *) NULL);
   6236     }
   6237   description=(char *) NULL;
   6238   unique_file=AcquireUniqueFileResource(filename);
   6239   file=(FILE *) NULL;
   6240   if (unique_file != -1)
   6241     file=fdopen(unique_file,"wb");
   6242   if ((unique_file == -1) || (file == (FILE *) NULL))
   6243     {
   6244       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6245         "UnableToCreateTemporaryFile","`%s'",wand->name);
   6246       return((char *) NULL);
   6247     }
   6248   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
   6249   (void) fclose(file);
   6250   description=FileToString(filename,~0UL,wand->exception);
   6251   (void) RelinquishUniqueFileResource(filename);
   6252   return(description);
   6253 }
   6254 
   6255 /*
   6256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6257 %                                                                             %
   6258 %                                                                             %
   6259 %                                                                             %
   6260 %   M a g i c k I d e n t i f y I m a g e T y p e                             %
   6261 %                                                                             %
   6262 %                                                                             %
   6263 %                                                                             %
   6264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6265 %
   6266 %  MagickIdentifyImageType() gets the potential image type:
   6267 %
   6268 %        Bilevel        Grayscale       GrayscaleMatte
   6269 %        Palette        PaletteMatte    TrueColor
   6270 %        TrueColorMatte ColorSeparation ColorSeparationMatte
   6271 %
   6272 %  To ensure the image type matches its potential, use MagickSetImageType():
   6273 %
   6274 %    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
   6275 %
   6276 %  The format of the MagickIdentifyImageType method is:
   6277 %
   6278 %      ImageType MagickIdentifyImageType(MagickWand *wand)
   6279 %
   6280 %  A description of each parameter follows:
   6281 %
   6282 %    o wand: the magick wand.
   6283 %
   6284 */
   6285 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
   6286 {
   6287   assert(wand != (MagickWand *) NULL);
   6288   assert(wand->signature == MagickWandSignature);
   6289   if (wand->debug != MagickFalse)
   6290     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6291   if (wand->images == (Image *) NULL)
   6292     {
   6293       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   6294         "ContainsNoImages","`%s'",wand->name);
   6295       return(UndefinedType);
   6296     }
   6297   return(IdentifyImageType(wand->images,wand->exception));
   6298 }
   6299 
   6300 /*
   6301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6302 %                                                                             %
   6303 %                                                                             %
   6304 %                                                                             %
   6305 %   M a g i c k I m p l o d e I m a g e                                       %
   6306 %                                                                             %
   6307 %                                                                             %
   6308 %                                                                             %
   6309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6310 %
   6311 %  MagickImplodeImage() creates a new image that is a copy of an existing
   6312 %  one with the image pixels "implode" by the specified percentage.  It
   6313 %  allocates the memory necessary for the new Image structure and returns a
   6314 %  pointer to the new image.
   6315 %
   6316 %  The format of the MagickImplodeImage method is:
   6317 %
   6318 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
   6319 %        const double radius,const PixelInterpolateMethod method)
   6320 %
   6321 %  A description of each parameter follows:
   6322 %
   6323 %    o wand: the magick wand.
   6324 %
   6325 %    o amount: Define the extent of the implosion.
   6326 %
   6327 %    o method: the pixel interpolation method.
   6328 %
   6329 */
   6330 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
   6331   const double amount,const PixelInterpolateMethod method)
   6332 {
   6333   Image
   6334     *implode_image;
   6335 
   6336   assert(wand != (MagickWand *) NULL);
   6337   assert(wand->signature == MagickWandSignature);
   6338   if (wand->debug != MagickFalse)
   6339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6340   if (wand->images == (Image *) NULL)
   6341     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6342   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
   6343   if (implode_image == (Image *) NULL)
   6344     return(MagickFalse);
   6345   ReplaceImageInList(&wand->images,implode_image);
   6346   return(MagickTrue);
   6347 }
   6348 
   6349 /*
   6351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6352 %                                                                             %
   6353 %                                                                             %
   6354 %                                                                             %
   6355 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
   6356 %                                                                             %
   6357 %                                                                             %
   6358 %                                                                             %
   6359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6360 %
   6361 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
   6362 %  location you specify.  The method returns MagickFalse on success otherwise
   6363 %  MagickTrue if an error is encountered.  The pixel data can be either char,
   6364 %  short int, int, ssize_t, float, or double in the order specified by map.
   6365 %
   6366 %  Suppose your want to upload the first scanline of a 640x480 image from
   6367 %  character data in red-green-blue order:
   6368 %
   6369 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
   6370 %
   6371 %  The format of the MagickImportImagePixels method is:
   6372 %
   6373 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
   6374 %        const ssize_t x,const ssize_t y,const size_t columns,
   6375 %        const size_t rows,const char *map,const StorageType storage,
   6376 %        const void *pixels)
   6377 %
   6378 %  A description of each parameter follows:
   6379 %
   6380 %    o wand: the magick wand.
   6381 %
   6382 %    o x, y, columns, rows:  These values define the perimeter of a region
   6383 %      of pixels you want to define.
   6384 %
   6385 %    o map:  This string reflects the expected ordering of the pixel array.
   6386 %      It can be any combination or order of R = red, G = green, B = blue,
   6387 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
   6388 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
   6389 %      P = pad.
   6390 %
   6391 %    o storage: Define the data type of the pixels.  Float and double types are
   6392 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
   6393 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
   6394 %      or DoublePixel.
   6395 %
   6396 %    o pixels: This array of values contain the pixel components as defined by
   6397 %      map and type.  You must preallocate this array where the expected
   6398 %      length varies depending on the values of width, height, map, and type.
   6399 %
   6400 */
   6401 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
   6402   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
   6403   const char *map,const StorageType storage,const void *pixels)
   6404 {
   6405   MagickBooleanType
   6406     status;
   6407 
   6408   assert(wand != (MagickWand *) NULL);
   6409   assert(wand->signature == MagickWandSignature);
   6410   if (wand->debug != MagickFalse)
   6411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6412   if (wand->images == (Image *) NULL)
   6413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6414   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
   6415     wand->exception);
   6416   return(status);
   6417 }
   6418 
   6419 /*
   6421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6422 %                                                                             %
   6423 %                                                                             %
   6424 %                                                                             %
   6425 %   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               %
   6426 %                                                                             %
   6427 %                                                                             %
   6428 %                                                                             %
   6429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6430 %
   6431 %  MagickInterpolativeResizeImage() resize image using a interpolative
   6432 %  method.
   6433 %
   6434 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
   6435 %        const size_t columns,const size_t rows,
   6436 %        const PixelInterpolateMethod method)
   6437 %
   6438 %  A description of each parameter follows:
   6439 %
   6440 %    o wand: the magick wand.
   6441 %
   6442 %    o columns: the number of columns in the scaled image.
   6443 %
   6444 %    o rows: the number of rows in the scaled image.
   6445 %
   6446 %    o interpolate: the pixel interpolation method.
   6447 %
   6448 */
   6449 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
   6450   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
   6451 {
   6452   Image
   6453     *resize_image;
   6454 
   6455   assert(wand != (MagickWand *) NULL);
   6456   assert(wand->signature == MagickWandSignature);
   6457   if (wand->debug != MagickFalse)
   6458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6459   if (wand->images == (Image *) NULL)
   6460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6461   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
   6462     wand->exception);
   6463   if (resize_image == (Image *) NULL)
   6464     return(MagickFalse);
   6465   ReplaceImageInList(&wand->images,resize_image);
   6466   return(MagickTrue);
   6467 }
   6468 
   6469 /*
   6471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6472 %                                                                             %
   6473 %                                                                             %
   6474 %                                                                             %
   6475 %   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       %
   6476 %                                                                             %
   6477 %                                                                             %
   6478 %                                                                             %
   6479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6480 %
   6481 %  MagickInverseFourierTransformImage() implements the inverse discrete
   6482 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
   6483 %  imaginary image pair.
   6484 %
   6485 %  The format of the MagickInverseFourierTransformImage method is:
   6486 %
   6487 %      MagickBooleanType MagickInverseFourierTransformImage(
   6488 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
   6489 %        const MagickBooleanType magnitude)
   6490 %
   6491 %  A description of each parameter follows:
   6492 %
   6493 %    o magnitude_wand: the magnitude or real wand.
   6494 %
   6495 %    o phase_wand: the phase or imaginary wand.
   6496 %
   6497 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
   6498 %      imaginary image pair.
   6499 %
   6500 */
   6501 WandExport MagickBooleanType MagickInverseFourierTransformImage(
   6502   MagickWand *magnitude_wand,MagickWand *phase_wand,
   6503   const MagickBooleanType magnitude)
   6504 {
   6505   Image
   6506     *inverse_image;
   6507 
   6508   MagickWand
   6509     *wand;
   6510 
   6511   assert(magnitude_wand != (MagickWand *) NULL);
   6512   assert(magnitude_wand->signature == MagickWandSignature);
   6513   if (magnitude_wand->debug != MagickFalse)
   6514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
   6515       magnitude_wand->name);
   6516   wand=magnitude_wand;
   6517   if (magnitude_wand->images == (Image *) NULL)
   6518     ThrowWandException(WandError,"ContainsNoImages",
   6519       magnitude_wand->name);
   6520   assert(phase_wand != (MagickWand *) NULL);
   6521   assert(phase_wand->signature == MagickWandSignature);
   6522   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
   6523     phase_wand->images,magnitude,wand->exception);
   6524   if (inverse_image == (Image *) NULL)
   6525     return(MagickFalse);
   6526   ReplaceImageInList(&wand->images,inverse_image);
   6527   return(MagickTrue);
   6528 }
   6529 
   6530 /*
   6532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6533 %                                                                             %
   6534 %                                                                             %
   6535 %                                                                             %
   6536 %   M a g i c k L a b e l I m a g e                                           %
   6537 %                                                                             %
   6538 %                                                                             %
   6539 %                                                                             %
   6540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6541 %
   6542 %  MagickLabelImage() adds a label to your image.
   6543 %
   6544 %  The format of the MagickLabelImage method is:
   6545 %
   6546 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
   6547 %
   6548 %  A description of each parameter follows:
   6549 %
   6550 %    o wand: the magick wand.
   6551 %
   6552 %    o label: the image label.
   6553 %
   6554 */
   6555 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
   6556   const char *label)
   6557 {
   6558   MagickBooleanType
   6559     status;
   6560 
   6561   assert(wand != (MagickWand *) NULL);
   6562   assert(wand->signature == MagickWandSignature);
   6563   if (wand->debug != MagickFalse)
   6564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6565   if (wand->images == (Image *) NULL)
   6566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6567   status=SetImageProperty(wand->images,"label",label,wand->exception);
   6568   return(status);
   6569 }
   6570 
   6571 /*
   6573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6574 %                                                                             %
   6575 %                                                                             %
   6576 %                                                                             %
   6577 %   M a g i c k L e v e l I m a g e                                           %
   6578 %                                                                             %
   6579 %                                                                             %
   6580 %                                                                             %
   6581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6582 %
   6583 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
   6584 %  falling between specified white and black points to the full available
   6585 %  quantum range. The parameters provided represent the black, mid, and white
   6586 %  points. The black point specifies the darkest color in the image. Colors
   6587 %  darker than the black point are set to zero. Mid point specifies a gamma
   6588 %  correction to apply to the image.  White point specifies the lightest color
   6589 %  in the image. Colors brighter than the white point are set to the maximum
   6590 %  quantum value.
   6591 %
   6592 %  The format of the MagickLevelImage method is:
   6593 %
   6594 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
   6595 %        const double black_point,const double gamma,const double white_point)
   6596 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
   6597 %        const ChannelType channel,const double black_point,const double gamma,
   6598 %        const double white_point)
   6599 %
   6600 %  A description of each parameter follows:
   6601 %
   6602 %    o wand: the magick wand.
   6603 %
   6604 %    o channel: Identify which channel to level: RedPixelChannel,
   6605 %      GreenPixelChannel, etc.
   6606 %
   6607 %    o black_point: the black point.
   6608 %
   6609 %    o gamma: the gamma.
   6610 %
   6611 %    o white_point: the white point.
   6612 %
   6613 */
   6614 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
   6615   const double black_point,const double gamma,const double white_point)
   6616 {
   6617   MagickBooleanType
   6618     status;
   6619 
   6620   assert(wand != (MagickWand *) NULL);
   6621   assert(wand->signature == MagickWandSignature);
   6622   if (wand->debug != MagickFalse)
   6623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6624   if (wand->images == (Image *) NULL)
   6625     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6626   status=LevelImage(wand->images,black_point,white_point,gamma,
   6627     wand->exception);
   6628   return(status);
   6629 }
   6630 
   6631 /*
   6633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6634 %                                                                             %
   6635 %                                                                             %
   6636 %                                                                             %
   6637 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
   6638 %                                                                             %
   6639 %                                                                             %
   6640 %                                                                             %
   6641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6642 %
   6643 %  MagickLinearStretchImage() stretches with saturation the image intensity.
   6644 %
   6645 %  You can also reduce the influence of a particular channel with a gamma
   6646 %  value of 0.
   6647 %
   6648 %  The format of the MagickLinearStretchImage method is:
   6649 %
   6650 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
   6651 %        const double black_point,const double white_point)
   6652 %
   6653 %  A description of each parameter follows:
   6654 %
   6655 %    o wand: the magick wand.
   6656 %
   6657 %    o black_point: the black point.
   6658 %
   6659 %    o white_point: the white point.
   6660 %
   6661 */
   6662 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
   6663   const double black_point,const double white_point)
   6664 {
   6665   MagickBooleanType
   6666     status;
   6667 
   6668   assert(wand != (MagickWand *) NULL);
   6669   assert(wand->signature == MagickWandSignature);
   6670   if (wand->debug != MagickFalse)
   6671     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6672   if (wand->images == (Image *) NULL)
   6673     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6674   status=LinearStretchImage(wand->images,black_point,white_point,
   6675     wand->exception);
   6676   return(status);
   6677 }
   6678 
   6679 /*
   6681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6682 %                                                                             %
   6683 %                                                                             %
   6684 %                                                                             %
   6685 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
   6686 %                                                                             %
   6687 %                                                                             %
   6688 %                                                                             %
   6689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6690 %
   6691 %  MagickLiquidRescaleImage() rescales image with seam carving.
   6692 %
   6693 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
   6694 %        const size_t columns,const size_t rows,
   6695 %        const double delta_x,const double rigidity)
   6696 %
   6697 %  A description of each parameter follows:
   6698 %
   6699 %    o wand: the magick wand.
   6700 %
   6701 %    o columns: the number of columns in the scaled image.
   6702 %
   6703 %    o rows: the number of rows in the scaled image.
   6704 %
   6705 %    o delta_x: maximum seam transversal step (0 means straight seams).
   6706 %
   6707 %    o rigidity: introduce a bias for non-straight seams (typically 0).
   6708 %
   6709 */
   6710 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
   6711   const size_t columns,const size_t rows,const double delta_x,
   6712   const double rigidity)
   6713 {
   6714   Image
   6715     *rescale_image;
   6716 
   6717   assert(wand != (MagickWand *) NULL);
   6718   assert(wand->signature == MagickWandSignature);
   6719   if (wand->debug != MagickFalse)
   6720     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6721   if (wand->images == (Image *) NULL)
   6722     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6723   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
   6724     rigidity,wand->exception);
   6725   if (rescale_image == (Image *) NULL)
   6726     return(MagickFalse);
   6727   ReplaceImageInList(&wand->images,rescale_image);
   6728   return(MagickTrue);
   6729 }
   6730 
   6731 /*
   6732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6733 %                                                                             %
   6734 %                                                                             %
   6735 %                                                                             %
   6736 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
   6737 %                                                                             %
   6738 %                                                                             %
   6739 %                                                                             %
   6740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6741 %
   6742 %  MagickLocalContrastImage() attempts to increase the appearance of
   6743 %  large-scale light-dark transitions. Local contrast enhancement works
   6744 %  similarly to sharpening with an unsharp mask, however the mask is instead
   6745 %  created using an image with a greater blur distance.
   6746 %
   6747 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
   6748 %        const double radius,const double strength)
   6749 %
   6750 %  A description of each parameter follows:
   6751 %
   6752 %    o image: the image.
   6753 %
   6754 %    o radius: the radius of the Gaussian, in pixels, not counting
   6755 %      the center pixel.
   6756 %
   6757 %    o strength: the strength of the blur mask in percentage.
   6758 %
   6759 */
   6760 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
   6761   const double radius, const double strength)
   6762 {
   6763   Image
   6764     *contrast_image;
   6765 
   6766   assert(wand != (MagickWand *)NULL);
   6767   assert(wand->signature == MagickWandSignature);
   6768   if (wand->debug != MagickFalse)
   6769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
   6770   if (wand->images == (Image *)NULL)
   6771     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6772   contrast_image=LocalContrastImage(wand->images,radius,strength,
   6773     wand->exception);
   6774   if (contrast_image == (Image *)NULL)
   6775     return(MagickFalse);
   6776   ReplaceImageInList(&wand->images,contrast_image);
   6777   return(MagickTrue);
   6778 }
   6779 
   6780 /*
   6782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6783 %                                                                             %
   6784 %                                                                             %
   6785 %                                                                             %
   6786 %   M a g i c k M a g n i f y I m a g e                                       %
   6787 %                                                                             %
   6788 %                                                                             %
   6789 %                                                                             %
   6790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6791 %
   6792 %  MagickMagnifyImage() is a convenience method that scales an image
   6793 %  proportionally to twice its original size.
   6794 %
   6795 %  The format of the MagickMagnifyImage method is:
   6796 %
   6797 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
   6798 %
   6799 %  A description of each parameter follows:
   6800 %
   6801 %    o wand: the magick wand.
   6802 %
   6803 */
   6804 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
   6805 {
   6806   Image
   6807     *magnify_image;
   6808 
   6809   assert(wand != (MagickWand *) NULL);
   6810   assert(wand->signature == MagickWandSignature);
   6811   if (wand->debug != MagickFalse)
   6812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6813   if (wand->images == (Image *) NULL)
   6814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6815   magnify_image=MagnifyImage(wand->images,wand->exception);
   6816   if (magnify_image == (Image *) NULL)
   6817     return(MagickFalse);
   6818   ReplaceImageInList(&wand->images,magnify_image);
   6819   return(MagickTrue);
   6820 }
   6821 
   6822 /*
   6824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6825 %                                                                             %
   6826 %                                                                             %
   6827 %                                                                             %
   6828 %   M a g i c k M e r g e I m a g e L a y e r s                               %
   6829 %                                                                             %
   6830 %                                                                             %
   6831 %                                                                             %
   6832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6833 %
   6834 %  MagickMergeImageLayers() composes all the image layers from the current
   6835 %  given image onward to produce a single image of the merged layers.
   6836 %
   6837 %  The inital canvas's size depends on the given LayerMethod, and is
   6838 %  initialized using the first images background color.  The images
   6839 %  are then compositied onto that image in sequence using the given
   6840 %  composition that has been assigned to each individual image.
   6841 %
   6842 %  The format of the MagickMergeImageLayers method is:
   6843 %
   6844 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
   6845 %        const LayerMethod method)
   6846 %
   6847 %  A description of each parameter follows:
   6848 %
   6849 %    o wand: the magick wand.
   6850 %
   6851 %    o method: the method of selecting the size of the initial canvas.
   6852 %
   6853 %        MergeLayer: Merge all layers onto a canvas just large enough
   6854 %           to hold all the actual images. The virtual canvas of the
   6855 %           first image is preserved but otherwise ignored.
   6856 %
   6857 %        FlattenLayer: Use the virtual canvas size of first image.
   6858 %           Images which fall outside this canvas is clipped.
   6859 %           This can be used to 'fill out' a given virtual canvas.
   6860 %
   6861 %        MosaicLayer: Start with the virtual canvas of the first image,
   6862 %           enlarging left and right edges to contain all images.
   6863 %           Images with negative offsets will be clipped.
   6864 %
   6865 */
   6866 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
   6867   const LayerMethod method)
   6868 {
   6869   Image
   6870     *mosaic_image;
   6871 
   6872   assert(wand != (MagickWand *) NULL);
   6873   assert(wand->signature == MagickWandSignature);
   6874   if (wand->debug != MagickFalse)
   6875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6876   if (wand->images == (Image *) NULL)
   6877     return((MagickWand *) NULL);
   6878   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
   6879   if (mosaic_image == (Image *) NULL)
   6880     return((MagickWand *) NULL);
   6881   return(CloneMagickWandFromImages(wand,mosaic_image));
   6882 }
   6883 
   6884 /*
   6886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6887 %                                                                             %
   6888 %                                                                             %
   6889 %                                                                             %
   6890 %   M a g i c k M i n i f y I m a g e                                         %
   6891 %                                                                             %
   6892 %                                                                             %
   6893 %                                                                             %
   6894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6895 %
   6896 %  MagickMinifyImage() is a convenience method that scales an image
   6897 %  proportionally to one-half its original size
   6898 %
   6899 %  The format of the MagickMinifyImage method is:
   6900 %
   6901 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
   6902 %
   6903 %  A description of each parameter follows:
   6904 %
   6905 %    o wand: the magick wand.
   6906 %
   6907 */
   6908 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
   6909 {
   6910   Image
   6911     *minify_image;
   6912 
   6913   assert(wand != (MagickWand *) NULL);
   6914   assert(wand->signature == MagickWandSignature);
   6915   if (wand->debug != MagickFalse)
   6916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6917   if (wand->images == (Image *) NULL)
   6918     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6919   minify_image=MinifyImage(wand->images,wand->exception);
   6920   if (minify_image == (Image *) NULL)
   6921     return(MagickFalse);
   6922   ReplaceImageInList(&wand->images,minify_image);
   6923   return(MagickTrue);
   6924 }
   6925 
   6926 /*
   6928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6929 %                                                                             %
   6930 %                                                                             %
   6931 %                                                                             %
   6932 %   M a g i c k M o d u l a t e I m a g e                                     %
   6933 %                                                                             %
   6934 %                                                                             %
   6935 %                                                                             %
   6936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6937 %
   6938 %  MagickModulateImage() lets you control the brightness, saturation, and hue
   6939 %  of an image.  Hue is the percentage of absolute rotation from the current
   6940 %  position.  For example 50 results in a counter-clockwise rotation of 90
   6941 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
   6942 %  both resulting in a rotation of 180 degrees.
   6943 %
   6944 %  To increase the color brightness by 20% and decrease the color saturation by
   6945 %  10% and leave the hue unchanged, use: 120,90,100.
   6946 %
   6947 %  The format of the MagickModulateImage method is:
   6948 %
   6949 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
   6950 %        const double brightness,const double saturation,const double hue)
   6951 %
   6952 %  A description of each parameter follows:
   6953 %
   6954 %    o wand: the magick wand.
   6955 %
   6956 %    o brightness: the percent change in brighness.
   6957 %
   6958 %    o saturation: the percent change in saturation.
   6959 %
   6960 %    o hue: the percent change in hue.
   6961 %
   6962 */
   6963 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
   6964   const double brightness,const double saturation,const double hue)
   6965 {
   6966   char
   6967     modulate[MagickPathExtent];
   6968 
   6969   MagickBooleanType
   6970     status;
   6971 
   6972   assert(wand != (MagickWand *) NULL);
   6973   assert(wand->signature == MagickWandSignature);
   6974   if (wand->debug != MagickFalse)
   6975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   6976   if (wand->images == (Image *) NULL)
   6977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   6978   (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
   6979     brightness,saturation,hue);
   6980   status=ModulateImage(wand->images,modulate,wand->exception);
   6981   return(status);
   6982 }
   6983 
   6984 /*
   6986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6987 %                                                                             %
   6988 %                                                                             %
   6989 %                                                                             %
   6990 %   M a g i c k M o n t a g e I m a g e                                       %
   6991 %                                                                             %
   6992 %                                                                             %
   6993 %                                                                             %
   6994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   6995 %
   6996 %  MagickMontageImage() creates a composite image by combining several
   6997 %  separate images. The images are tiled on the composite image with the name
   6998 %  of the image optionally appearing just below the individual tile.
   6999 %
   7000 %  The format of the MagickMontageImage method is:
   7001 %
   7002 %      MagickWand *MagickMontageImage(MagickWand *wand,
   7003 %        const DrawingWand drawing_wand,const char *tile_geometry,
   7004 %        const char *thumbnail_geometry,const MontageMode mode,
   7005 %        const char *frame)
   7006 %
   7007 %  A description of each parameter follows:
   7008 %
   7009 %    o wand: the magick wand.
   7010 %
   7011 %    o drawing_wand: the drawing wand.  The font name, size, and color are
   7012 %      obtained from this wand.
   7013 %
   7014 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
   7015 %
   7016 %    o thumbnail_geometry: Preferred image size and border size of each
   7017 %      thumbnail (e.g. 120x120+4+3>).
   7018 %
   7019 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
   7020 %
   7021 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
   7022 %      The frame color is that of the thumbnail's matte color.
   7023 %
   7024 */
   7025 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
   7026   const DrawingWand *drawing_wand,const char *tile_geometry,
   7027   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
   7028 {
   7029   char
   7030     *font;
   7031 
   7032   Image
   7033     *montage_image;
   7034 
   7035   MontageInfo
   7036     *montage_info;
   7037 
   7038   PixelWand
   7039     *pixel_wand;
   7040 
   7041   assert(wand != (MagickWand *) NULL);
   7042   assert(wand->signature == MagickWandSignature);
   7043   if (wand->debug != MagickFalse)
   7044     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7045   if (wand->images == (Image *) NULL)
   7046     return((MagickWand *) NULL);
   7047   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
   7048   switch (mode)
   7049   {
   7050     case FrameMode:
   7051     {
   7052       (void) CloneString(&montage_info->frame,"15x15+3+3");
   7053       montage_info->shadow=MagickTrue;
   7054       break;
   7055     }
   7056     case UnframeMode:
   7057     {
   7058       montage_info->frame=(char *) NULL;
   7059       montage_info->shadow=MagickFalse;
   7060       montage_info->border_width=0;
   7061       break;
   7062     }
   7063     case ConcatenateMode:
   7064     {
   7065       montage_info->frame=(char *) NULL;
   7066       montage_info->shadow=MagickFalse;
   7067       (void) CloneString(&montage_info->geometry,"+0+0");
   7068       montage_info->border_width=0;
   7069       break;
   7070     }
   7071     default:
   7072       break;
   7073   }
   7074   font=DrawGetFont(drawing_wand);
   7075   if (font != (char *) NULL)
   7076     (void) CloneString(&montage_info->font,font);
   7077   if (frame != (char *) NULL)
   7078     (void) CloneString(&montage_info->frame,frame);
   7079   montage_info->pointsize=DrawGetFontSize(drawing_wand);
   7080   pixel_wand=NewPixelWand();
   7081   DrawGetFillColor(drawing_wand,pixel_wand);
   7082   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
   7083   DrawGetStrokeColor(drawing_wand,pixel_wand);
   7084   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
   7085   pixel_wand=DestroyPixelWand(pixel_wand);
   7086   if (thumbnail_geometry != (char *) NULL)
   7087     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
   7088   if (tile_geometry != (char *) NULL)
   7089     (void) CloneString(&montage_info->tile,tile_geometry);
   7090   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
   7091     wand->exception);
   7092   montage_info=DestroyMontageInfo(montage_info);
   7093   if (montage_image == (Image *) NULL)
   7094     return((MagickWand *) NULL);
   7095   return(CloneMagickWandFromImages(wand,montage_image));
   7096 }
   7097 
   7098 /*
   7100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7101 %                                                                             %
   7102 %                                                                             %
   7103 %                                                                             %
   7104 %   M a g i c k M o r p h I m a g e s                                         %
   7105 %                                                                             %
   7106 %                                                                             %
   7107 %                                                                             %
   7108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7109 %
   7110 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
   7111 %  and size are linearly interpolated to give the appearance of a
   7112 %  meta-morphosis from one image to the next.
   7113 %
   7114 %  The format of the MagickMorphImages method is:
   7115 %
   7116 %      MagickWand *MagickMorphImages(MagickWand *wand,
   7117 %        const size_t number_frames)
   7118 %
   7119 %  A description of each parameter follows:
   7120 %
   7121 %    o wand: the magick wand.
   7122 %
   7123 %    o number_frames: the number of in-between images to generate.
   7124 %
   7125 */
   7126 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
   7127   const size_t number_frames)
   7128 {
   7129   Image
   7130     *morph_image;
   7131 
   7132   assert(wand != (MagickWand *) NULL);
   7133   assert(wand->signature == MagickWandSignature);
   7134   if (wand->debug != MagickFalse)
   7135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7136   if (wand->images == (Image *) NULL)
   7137     return((MagickWand *) NULL);
   7138   morph_image=MorphImages(wand->images,number_frames,wand->exception);
   7139   if (morph_image == (Image *) NULL)
   7140     return((MagickWand *) NULL);
   7141   return(CloneMagickWandFromImages(wand,morph_image));
   7142 }
   7143 
   7144 /*
   7146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7147 %                                                                             %
   7148 %                                                                             %
   7149 %                                                                             %
   7150 %   M a g i c k M o r p h o l o g y I m a g e                                 %
   7151 %                                                                             %
   7152 %                                                                             %
   7153 %                                                                             %
   7154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7155 %
   7156 %  MagickMorphologyImage() applies a user supplied kernel to the image
   7157 %  according to the given mophology method.
   7158 %
   7159 %  The format of the MagickMorphologyImage method is:
   7160 %
   7161 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
   7162 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
   7163 %
   7164 %  A description of each parameter follows:
   7165 %
   7166 %    o wand: the magick wand.
   7167 %
   7168 %    o method: the morphology method to be applied.
   7169 %
   7170 %    o iterations: apply the operation this many times (or no change).
   7171 %      A value of -1 means loop until no change found.  How this is applied
   7172 %      may depend on the morphology method.  Typically this is a value of 1.
   7173 %
   7174 %    o kernel: An array of doubles representing the morphology kernel.
   7175 %
   7176 */
   7177 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
   7178   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
   7179 {
   7180   Image
   7181     *morphology_image;
   7182 
   7183   assert(wand != (MagickWand *) NULL);
   7184   assert(wand->signature == MagickWandSignature);
   7185   if (wand->debug != MagickFalse)
   7186     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7187   if (kernel == (const KernelInfo *) NULL)
   7188     return(MagickFalse);
   7189   if (wand->images == (Image *) NULL)
   7190     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7191   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
   7192     wand->exception);
   7193   if (morphology_image == (Image *) NULL)
   7194     return(MagickFalse);
   7195   ReplaceImageInList(&wand->images,morphology_image);
   7196   return(MagickTrue);
   7197 }
   7198 
   7199 /*
   7201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7202 %                                                                             %
   7203 %                                                                             %
   7204 %                                                                             %
   7205 %   M a g i c k M o t i o n B l u r I m a g e                                 %
   7206 %                                                                             %
   7207 %                                                                             %
   7208 %                                                                             %
   7209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7210 %
   7211 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
   7212 %  Gaussian operator of the given radius and standard deviation (sigma).
   7213 %  For reasonable results, radius should be larger than sigma.  Use a
   7214 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
   7215 %  Angle gives the angle of the blurring motion.
   7216 %
   7217 %  The format of the MagickMotionBlurImage method is:
   7218 %
   7219 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
   7220 %        const double radius,const double sigma,const double angle)
   7221 %
   7222 %  A description of each parameter follows:
   7223 %
   7224 %    o wand: the magick wand.
   7225 %
   7226 %    o radius: the radius of the Gaussian, in pixels, not counting
   7227 %      the center pixel.
   7228 %
   7229 %    o sigma: the standard deviation of the Gaussian, in pixels.
   7230 %
   7231 %    o angle: Apply the effect along this angle.
   7232 %
   7233 */
   7234 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
   7235   const double radius,const double sigma,const double angle)
   7236 {
   7237   Image
   7238     *blur_image;
   7239 
   7240   assert(wand != (MagickWand *) NULL);
   7241   assert(wand->signature == MagickWandSignature);
   7242   if (wand->debug != MagickFalse)
   7243     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7244   if (wand->images == (Image *) NULL)
   7245     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7246   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
   7247   if (blur_image == (Image *) NULL)
   7248     return(MagickFalse);
   7249   ReplaceImageInList(&wand->images,blur_image);
   7250   return(MagickTrue);
   7251 }
   7252 
   7253 /*
   7255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7256 %                                                                             %
   7257 %                                                                             %
   7258 %                                                                             %
   7259 %   M a g i c k N e g a t e I m a g e                                         %
   7260 %                                                                             %
   7261 %                                                                             %
   7262 %                                                                             %
   7263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7264 %
   7265 %  MagickNegateImage() negates the colors in the reference image.  The
   7266 %  Grayscale option means that only grayscale values within the image are
   7267 %  negated.
   7268 %
   7269 %  You can also reduce the influence of a particular channel with a gamma
   7270 %  value of 0.
   7271 %
   7272 %  The format of the MagickNegateImage method is:
   7273 %
   7274 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
   7275 %        const MagickBooleanType gray)
   7276 %
   7277 %  A description of each parameter follows:
   7278 %
   7279 %    o wand: the magick wand.
   7280 %
   7281 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
   7282 %
   7283 */
   7284 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
   7285   const MagickBooleanType gray)
   7286 {
   7287   MagickBooleanType
   7288     status;
   7289 
   7290   assert(wand != (MagickWand *) NULL);
   7291   assert(wand->signature == MagickWandSignature);
   7292   if (wand->debug != MagickFalse)
   7293     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7294   if (wand->images == (Image *) NULL)
   7295     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7296   status=NegateImage(wand->images,gray,wand->exception);
   7297   return(status);
   7298 }
   7299 
   7300 /*
   7302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7303 %                                                                             %
   7304 %                                                                             %
   7305 %                                                                             %
   7306 %   M a g i c k N e w I m a g e                                               %
   7307 %                                                                             %
   7308 %                                                                             %
   7309 %                                                                             %
   7310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7311 %
   7312 %  MagickNewImage() adds a blank image canvas of the specified size and
   7313 %  background color to the wand.
   7314 %
   7315 %  The format of the MagickNewImage method is:
   7316 %
   7317 %      MagickBooleanType MagickNewImage(MagickWand *wand,
   7318 %        const size_t columns,const size_t rows,
   7319 %        const PixelWand *background)
   7320 %
   7321 %  A description of each parameter follows:
   7322 %
   7323 %    o wand: the magick wand.
   7324 %
   7325 %    o width: the image width.
   7326 %
   7327 %    o height: the image height.
   7328 %
   7329 %    o background: the image color.
   7330 %
   7331 */
   7332 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
   7333   const size_t height,const PixelWand *background)
   7334 {
   7335   Image
   7336     *images;
   7337 
   7338   PixelInfo
   7339     pixel;
   7340 
   7341   assert(wand != (MagickWand *) NULL);
   7342   assert(wand->signature == MagickWandSignature);
   7343   if (wand->debug != MagickFalse)
   7344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7345   PixelGetMagickColor(background,&pixel);
   7346   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
   7347   if (images == (Image *) NULL)
   7348     return(MagickFalse);
   7349   return(InsertImageInWand(wand,images));
   7350 }
   7351 
   7352 /*
   7354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7355 %                                                                             %
   7356 %                                                                             %
   7357 %                                                                             %
   7358 %   M a g i c k N e x t I m a g e                                             %
   7359 %                                                                             %
   7360 %                                                                             %
   7361 %                                                                             %
   7362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7363 %
   7364 %  MagickNextImage() sets the next image in the wand as the current image.
   7365 %
   7366 %  It is typically used after MagickResetIterator(), after which its first use
   7367 %  will set the first image as the current image (unless the wand is empty).
   7368 %
   7369 %  It will return MagickFalse when no more images are left to be returned
   7370 %  which happens when the wand is empty, or the current image is the last
   7371 %  image.
   7372 %
   7373 %  When the above condition (end of image list) is reached, the iterator is
   7374 %  automaticall set so that you can start using MagickPreviousImage() to
   7375 %  again iterate over the images in the reverse direction, starting with the
   7376 %  last image (again).  You can jump to this condition immeditally using
   7377 %  MagickSetLastIterator().
   7378 %
   7379 %  The format of the MagickNextImage method is:
   7380 %
   7381 %      MagickBooleanType MagickNextImage(MagickWand *wand)
   7382 %
   7383 %  A description of each parameter follows:
   7384 %
   7385 %    o wand: the magick wand.
   7386 %
   7387 */
   7388 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
   7389 {
   7390   assert(wand != (MagickWand *) NULL);
   7391   assert(wand->signature == MagickWandSignature);
   7392   if (wand->debug != MagickFalse)
   7393     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7394   if (wand->images == (Image *) NULL)
   7395     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7396   wand->insert_before=MagickFalse; /* Inserts is now appended */
   7397   if (wand->image_pending != MagickFalse)
   7398     {
   7399       wand->image_pending=MagickFalse;
   7400       return(MagickTrue);
   7401     }
   7402   if (GetNextImageInList(wand->images) == (Image *) NULL)
   7403     {
   7404       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
   7405       return(MagickFalse);
   7406     }
   7407   wand->images=GetNextImageInList(wand->images);
   7408   return(MagickTrue);
   7409 }
   7410 
   7411 /*
   7413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7414 %                                                                             %
   7415 %                                                                             %
   7416 %                                                                             %
   7417 %   M a g i c k N o r m a l i z e I m a g e                                   %
   7418 %                                                                             %
   7419 %                                                                             %
   7420 %                                                                             %
   7421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7422 %
   7423 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
   7424 %  the pixels color to span the entire range of colors available
   7425 %
   7426 %  You can also reduce the influence of a particular channel with a gamma
   7427 %  value of 0.
   7428 %
   7429 %  The format of the MagickNormalizeImage method is:
   7430 %
   7431 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
   7432 %
   7433 %  A description of each parameter follows:
   7434 %
   7435 %    o wand: the magick wand.
   7436 %
   7437 */
   7438 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
   7439 {
   7440   MagickBooleanType
   7441     status;
   7442 
   7443   assert(wand != (MagickWand *) NULL);
   7444   assert(wand->signature == MagickWandSignature);
   7445   if (wand->debug != MagickFalse)
   7446     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7447   if (wand->images == (Image *) NULL)
   7448     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7449   status=NormalizeImage(wand->images,wand->exception);
   7450   return(status);
   7451 }
   7452 
   7453 /*
   7455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7456 %                                                                             %
   7457 %                                                                             %
   7458 %                                                                             %
   7459 %   M a g i c k O i l P a i n t I m a g e                                     %
   7460 %                                                                             %
   7461 %                                                                             %
   7462 %                                                                             %
   7463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7464 %
   7465 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
   7466 %  painting.  Each pixel is replaced by the most frequent color occurring
   7467 %  in a circular region defined by radius.
   7468 %
   7469 %  The format of the MagickOilPaintImage method is:
   7470 %
   7471 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
   7472 %        const double radius,const double sigma)
   7473 %
   7474 %  A description of each parameter follows:
   7475 %
   7476 %    o wand: the magick wand.
   7477 %
   7478 %    o radius: the radius of the circular neighborhood.
   7479 %
   7480 %    o sigma: the standard deviation of the Gaussian, in pixels.
   7481 %
   7482 */
   7483 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
   7484   const double radius,const double sigma)
   7485 {
   7486   Image
   7487     *paint_image;
   7488 
   7489   assert(wand != (MagickWand *) NULL);
   7490   assert(wand->signature == MagickWandSignature);
   7491   if (wand->debug != MagickFalse)
   7492     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7493   if (wand->images == (Image *) NULL)
   7494     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7495   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
   7496   if (paint_image == (Image *) NULL)
   7497     return(MagickFalse);
   7498   ReplaceImageInList(&wand->images,paint_image);
   7499   return(MagickTrue);
   7500 }
   7501 
   7502 /*
   7504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7505 %                                                                             %
   7506 %                                                                             %
   7507 %                                                                             %
   7508 %   M a g i c k O p a q u e P a i n t I m a g e                               %
   7509 %                                                                             %
   7510 %                                                                             %
   7511 %                                                                             %
   7512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7513 %
   7514 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
   7515 %  defined by fill.
   7516 %
   7517 %  The format of the MagickOpaquePaintImage method is:
   7518 %
   7519 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
   7520 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
   7521 %        const MagickBooleanType invert)
   7522 %
   7523 %  A description of each parameter follows:
   7524 %
   7525 %    o wand: the magick wand.
   7526 %
   7527 %    o target: Change this target color to the fill color within the image.
   7528 %
   7529 %    o fill: the fill pixel wand.
   7530 %
   7531 %    o fuzz: By default target must match a particular pixel color
   7532 %      exactly.  However, in many cases two colors may differ by a small amount.
   7533 %      The fuzz member of image defines how much tolerance is acceptable to
   7534 %      consider two colors as the same.  For example, set fuzz to 10 and the
   7535 %      color red at intensities of 100 and 102 respectively are now interpreted
   7536 %      as the same color for the purposes of the floodfill.
   7537 %
   7538 %    o invert: paint any pixel that does not match the target color.
   7539 %
   7540 */
   7541 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
   7542   const PixelWand *target,const PixelWand *fill,const double fuzz,
   7543   const MagickBooleanType invert)
   7544 {
   7545   MagickBooleanType
   7546     status;
   7547 
   7548   PixelInfo
   7549     fill_pixel,
   7550     target_pixel;
   7551 
   7552   assert(wand != (MagickWand *) NULL);
   7553   assert(wand->signature == MagickWandSignature);
   7554   if (wand->debug != MagickFalse)
   7555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7556   if (wand->images == (Image *) NULL)
   7557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7558   PixelGetMagickColor(target,&target_pixel);
   7559   PixelGetMagickColor(fill,&fill_pixel);
   7560   wand->images->fuzz=fuzz;
   7561   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
   7562     wand->exception);
   7563   return(status);
   7564 }
   7565 
   7566 /*
   7568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7569 %                                                                             %
   7570 %                                                                             %
   7571 %                                                                             %
   7572 %   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                         %
   7573 %                                                                             %
   7574 %                                                                             %
   7575 %                                                                             %
   7576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7577 %
   7578 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
   7579 %  previous image in the sequence.  From this it attempts to select the
   7580 %  smallest cropped image to replace each frame, while preserving the results
   7581 %  of the animation.
   7582 %
   7583 %  The format of the MagickOptimizeImageLayers method is:
   7584 %
   7585 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
   7586 %
   7587 %  A description of each parameter follows:
   7588 %
   7589 %    o wand: the magick wand.
   7590 %
   7591 */
   7592 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
   7593 {
   7594   Image
   7595     *optimize_image;
   7596 
   7597   assert(wand != (MagickWand *) NULL);
   7598   assert(wand->signature == MagickWandSignature);
   7599   if (wand->debug != MagickFalse)
   7600     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7601   if (wand->images == (Image *) NULL)
   7602     return((MagickWand *) NULL);
   7603   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
   7604   if (optimize_image == (Image *) NULL)
   7605     return((MagickWand *) NULL);
   7606   return(CloneMagickWandFromImages(wand,optimize_image));
   7607 }
   7608 
   7609 /*
   7611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7612 %                                                                             %
   7613 %                                                                             %
   7614 %                                                                             %
   7615 %   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             %
   7616 %                                                                             %
   7617 %                                                                             %
   7618 %                                                                             %
   7619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7620 %
   7621 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
   7622 %  compares the overlayed pixels against the disposal image resulting from all
   7623 %  the previous frames in the animation.  Any pixel that does not change the
   7624 %  disposal image (and thus does not effect the outcome of an overlay) is made
   7625 %  transparent.
   7626 %
   7627 %  WARNING: This modifies the current images directly, rather than generate
   7628 %  a new image sequence.
   7629 %  The format of the MagickOptimizeImageTransparency method is:
   7630 %
   7631 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
   7632 %
   7633 %  A description of each parameter follows:
   7634 %
   7635 %    o wand: the magick wand.
   7636 %
   7637 */
   7638 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
   7639 {
   7640   assert(wand != (MagickWand *) NULL);
   7641   assert(wand->signature == MagickWandSignature);
   7642   if (wand->debug != MagickFalse)
   7643     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7644   if (wand->images == (Image *) NULL)
   7645     return(MagickFalse);
   7646   OptimizeImageTransparency(wand->images,wand->exception);
   7647   return(MagickTrue);
   7648 }
   7649 
   7650 /*
   7652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7653 %                                                                             %
   7654 %                                                                             %
   7655 %                                                                             %
   7656 %     M a g i c k O r d e r e d D i t h e r I m a g e                         %
   7657 %                                                                             %
   7658 %                                                                             %
   7659 %                                                                             %
   7660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7661 %
   7662 %  MagickOrderedDitherImage() performs an ordered dither based on a number
   7663 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
   7664 %  which can be different for different channels, according to the input
   7665 %  arguments.
   7666 %
   7667 %  The format of the MagickOrderedDitherImage method is:
   7668 %
   7669 %      MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
   7670 %        const char *threshold_map)
   7671 %
   7672 %  A description of each parameter follows:
   7673 %
   7674 %    o image: the image.
   7675 %
   7676 %    o threshold_map: A string containing the name of the threshold dither
   7677 %      map to use, followed by zero or more numbers representing the number of
   7678 %      color levels tho dither between.
   7679 %
   7680 %      Any level number less than 2 is equivalent to 2, and means only binary
   7681 %      dithering will be applied to each color channel.
   7682 %
   7683 %      No numbers also means a 2 level (bitmap) dither will be applied to all
   7684 %      channels, while a single number is the number of levels applied to each
   7685 %      channel in sequence.  More numbers will be applied in turn to each of
   7686 %      the color channels.
   7687 %
   7688 %      For example: "o3x3,6" generates a 6 level posterization of the image
   7689 %      with a ordered 3x3 diffused pixel dither being applied between each
   7690 %      level. While checker,8,8,4 will produce a 332 colormaped image with
   7691 %      only a single checkerboard hash pattern (50% grey) between each color
   7692 %      level, to basically double the number of color levels with a bare
   7693 %      minimim of dithering.
   7694 %
   7695 */
   7696 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
   7697   const char *threshold_map)
   7698 {
   7699   MagickBooleanType
   7700     status;
   7701 
   7702   assert(wand != (MagickWand *) NULL);
   7703   assert(wand->signature == MagickWandSignature);
   7704   if (wand->debug != MagickFalse)
   7705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7706   if (wand->images == (Image *) NULL)
   7707     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7708   status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
   7709   return(status);
   7710 }
   7711 
   7712 /*
   7714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7715 %                                                                             %
   7716 %                                                                             %
   7717 %                                                                             %
   7718 %   M a g i c k P i n g I m a g e                                             %
   7719 %                                                                             %
   7720 %                                                                             %
   7721 %                                                                             %
   7722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7723 %
   7724 %  MagickPingImage() is the same as MagickReadImage() except the only valid
   7725 %  information returned is the image width, height, size, and format.  It
   7726 %  is designed to efficiently obtain this information from a file without
   7727 %  reading the entire image sequence into memory.
   7728 %
   7729 %  The format of the MagickPingImage method is:
   7730 %
   7731 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
   7732 %
   7733 %  A description of each parameter follows:
   7734 %
   7735 %    o wand: the magick wand.
   7736 %
   7737 %    o filename: the image filename.
   7738 %
   7739 */
   7740 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
   7741   const char *filename)
   7742 {
   7743   Image
   7744     *images;
   7745 
   7746   ImageInfo
   7747     *ping_info;
   7748 
   7749   assert(wand != (MagickWand *) NULL);
   7750   assert(wand->signature == MagickWandSignature);
   7751   if (wand->debug != MagickFalse)
   7752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7753   ping_info=CloneImageInfo(wand->image_info);
   7754   if (filename != (const char *) NULL)
   7755     (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
   7756   images=PingImage(ping_info,wand->exception);
   7757   ping_info=DestroyImageInfo(ping_info);
   7758   if (images == (Image *) NULL)
   7759     return(MagickFalse);
   7760   return(InsertImageInWand(wand,images));
   7761 }
   7762 
   7763 /*
   7765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7766 %                                                                             %
   7767 %                                                                             %
   7768 %                                                                             %
   7769 %   M a g i c k P i n g I m a g e B l o b                                     %
   7770 %                                                                             %
   7771 %                                                                             %
   7772 %                                                                             %
   7773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7774 %
   7775 %  MagickPingImageBlob() pings an image or image sequence from a blob.
   7776 %
   7777 %  The format of the MagickPingImageBlob method is:
   7778 %
   7779 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
   7780 %        const void *blob,const size_t length)
   7781 %
   7782 %  A description of each parameter follows:
   7783 %
   7784 %    o wand: the magick wand.
   7785 %
   7786 %    o blob: the blob.
   7787 %
   7788 %    o length: the blob length.
   7789 %
   7790 */
   7791 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
   7792   const void *blob,const size_t length)
   7793 {
   7794   Image
   7795     *images;
   7796 
   7797   ImageInfo
   7798     *read_info;
   7799 
   7800   assert(wand != (MagickWand *) NULL);
   7801   assert(wand->signature == MagickWandSignature);
   7802   if (wand->debug != MagickFalse)
   7803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7804   read_info=CloneImageInfo(wand->image_info);
   7805   SetImageInfoBlob(read_info,blob,length);
   7806   images=PingImage(read_info,wand->exception);
   7807   read_info=DestroyImageInfo(read_info);
   7808   if (images == (Image *) NULL)
   7809     return(MagickFalse);
   7810   return(InsertImageInWand(wand,images));
   7811 }
   7812 
   7813 /*
   7815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7816 %                                                                             %
   7817 %                                                                             %
   7818 %                                                                             %
   7819 %   M a g i c k P i n g I m a g e F i l e                                     %
   7820 %                                                                             %
   7821 %                                                                             %
   7822 %                                                                             %
   7823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7824 %
   7825 %  MagickPingImageFile() pings an image or image sequence from an open file
   7826 %  descriptor.
   7827 %
   7828 %  The format of the MagickPingImageFile method is:
   7829 %
   7830 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
   7831 %
   7832 %  A description of each parameter follows:
   7833 %
   7834 %    o wand: the magick wand.
   7835 %
   7836 %    o file: the file descriptor.
   7837 %
   7838 */
   7839 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
   7840 {
   7841   Image
   7842     *images;
   7843 
   7844   ImageInfo
   7845     *read_info;
   7846 
   7847   assert(wand != (MagickWand *) NULL);
   7848   assert(wand->signature == MagickWandSignature);
   7849   assert(file != (FILE *) NULL);
   7850   if (wand->debug != MagickFalse)
   7851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7852   read_info=CloneImageInfo(wand->image_info);
   7853   SetImageInfoFile(read_info,file);
   7854   images=PingImage(read_info,wand->exception);
   7855   read_info=DestroyImageInfo(read_info);
   7856   if (images == (Image *) NULL)
   7857     return(MagickFalse);
   7858   return(InsertImageInWand(wand,images));
   7859 }
   7860 
   7861 /*
   7863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7864 %                                                                             %
   7865 %                                                                             %
   7866 %                                                                             %
   7867 %   M a g i c k P o l a r o i d I m a g e                                     %
   7868 %                                                                             %
   7869 %                                                                             %
   7870 %                                                                             %
   7871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7872 %
   7873 %  MagickPolaroidImage() simulates a Polaroid picture.
   7874 %
   7875 %  The format of the MagickPolaroidImage method is:
   7876 %
   7877 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
   7878 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
   7879 %        const PixelInterpolateMethod method)
   7880 %
   7881 %  A description of each parameter follows:
   7882 %
   7883 %    o wand: the magick wand.
   7884 %
   7885 %    o drawing_wand: the draw wand.
   7886 %
   7887 %    o caption: the Polaroid caption.
   7888 %
   7889 %    o angle: Apply the effect along this angle.
   7890 %
   7891 %    o method: the pixel interpolation method.
   7892 %
   7893 */
   7894 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
   7895   const DrawingWand *drawing_wand,const char *caption,const double angle,
   7896   const PixelInterpolateMethod method)
   7897 {
   7898   DrawInfo
   7899     *draw_info;
   7900 
   7901   Image
   7902     *polaroid_image;
   7903 
   7904   assert(wand != (MagickWand *) NULL);
   7905   assert(wand->signature == MagickWandSignature);
   7906   if (wand->debug != MagickFalse)
   7907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7908   if (wand->images == (Image *) NULL)
   7909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7910   draw_info=PeekDrawingWand(drawing_wand);
   7911   if (draw_info == (DrawInfo *) NULL)
   7912     return(MagickFalse);
   7913   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
   7914     wand->exception);
   7915   if (polaroid_image == (Image *) NULL)
   7916     return(MagickFalse);
   7917   ReplaceImageInList(&wand->images,polaroid_image);
   7918   return(MagickTrue);
   7919 }
   7920 
   7921 /*
   7923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7924 %                                                                             %
   7925 %                                                                             %
   7926 %                                                                             %
   7927 %   M a g i c k P o s t e r i z e I m a g e                                   %
   7928 %                                                                             %
   7929 %                                                                             %
   7930 %                                                                             %
   7931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7932 %
   7933 %  MagickPosterizeImage() reduces the image to a limited number of color level.
   7934 %
   7935 %  The format of the MagickPosterizeImage method is:
   7936 %
   7937 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
   7938 %        const size_t levels,const DitherMethod method)
   7939 %
   7940 %  A description of each parameter follows:
   7941 %
   7942 %    o wand: the magick wand.
   7943 %
   7944 %    o levels: Number of color levels allowed in each channel.  Very low values
   7945 %      (2, 3, or 4) have the most visible effect.
   7946 %
   7947 %    o method: choose the dither method: UndefinedDitherMethod,
   7948 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   7949 %
   7950 */
   7951 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
   7952   const size_t levels,const DitherMethod dither)
   7953 {
   7954   MagickBooleanType
   7955     status;
   7956 
   7957   assert(wand != (MagickWand *) NULL);
   7958   assert(wand->signature == MagickWandSignature);
   7959   if (wand->debug != MagickFalse)
   7960     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   7961   if (wand->images == (Image *) NULL)
   7962     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   7963   status=PosterizeImage(wand->images,levels,dither,wand->exception);
   7964   return(status);
   7965 }
   7966 
   7967 /*
   7969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7970 %                                                                             %
   7971 %                                                                             %
   7972 %                                                                             %
   7973 %   M a g i c k P r e v i e w I m a g e s                                     %
   7974 %                                                                             %
   7975 %                                                                             %
   7976 %                                                                             %
   7977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   7978 %
   7979 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
   7980 %  image processing operation applied at varying strengths.  This helpful
   7981 %  to quickly pin-point an appropriate parameter for an image processing
   7982 %  operation.
   7983 %
   7984 %  The format of the MagickPreviewImages method is:
   7985 %
   7986 %      MagickWand *MagickPreviewImages(MagickWand *wand,
   7987 %        const PreviewType preview)
   7988 %
   7989 %  A description of each parameter follows:
   7990 %
   7991 %    o wand: the magick wand.
   7992 %
   7993 %    o preview: the preview type.
   7994 %
   7995 */
   7996 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
   7997   const PreviewType preview)
   7998 {
   7999   Image
   8000     *preview_image;
   8001 
   8002   assert(wand != (MagickWand *) NULL);
   8003   assert(wand->signature == MagickWandSignature);
   8004   if (wand->debug != MagickFalse)
   8005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8006   if (wand->images == (Image *) NULL)
   8007     return((MagickWand *) NULL);
   8008   preview_image=PreviewImage(wand->images,preview,wand->exception);
   8009   if (preview_image == (Image *) NULL)
   8010     return((MagickWand *) NULL);
   8011   return(CloneMagickWandFromImages(wand,preview_image));
   8012 }
   8013 
   8014 /*
   8016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8017 %                                                                             %
   8018 %                                                                             %
   8019 %                                                                             %
   8020 %   M a g i c k P r e v i o u s I m a g e                                     %
   8021 %                                                                             %
   8022 %                                                                             %
   8023 %                                                                             %
   8024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8025 %
   8026 %  MagickPreviousImage() sets the previous image in the wand as the current
   8027 %  image.
   8028 %
   8029 %  It is typically used after MagickSetLastIterator(), after which its first
   8030 %  use will set the last image as the current image (unless the wand is empty).
   8031 %
   8032 %  It will return MagickFalse when no more images are left to be returned
   8033 %  which happens when the wand is empty, or the current image is the first
   8034 %  image.  At that point the iterator is than reset to again process images in
   8035 %  the forward direction, again starting with the first image in list. Images
   8036 %  added at this point are prepended.
   8037 %
   8038 %  Also at that point any images added to the wand using MagickAddImages() or
   8039 %  MagickReadImages() will be prepended before the first image. In this sense
   8040 %  the condition is not quite exactly the same as MagickResetIterator().
   8041 %
   8042 %  The format of the MagickPreviousImage method is:
   8043 %
   8044 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
   8045 %
   8046 %  A description of each parameter follows:
   8047 %
   8048 %    o wand: the magick wand.
   8049 %
   8050 */
   8051 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
   8052 {
   8053   assert(wand != (MagickWand *) NULL);
   8054   assert(wand->signature == MagickWandSignature);
   8055   if (wand->debug != MagickFalse)
   8056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8057   if (wand->images == (Image *) NULL)
   8058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8059   if (wand->image_pending != MagickFalse)
   8060     {
   8061       wand->image_pending=MagickFalse;  /* image returned no longer pending */
   8062       return(MagickTrue);
   8063     }
   8064   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
   8065     {
   8066       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
   8067       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
   8068       return(MagickFalse);
   8069     }
   8070   wand->images=GetPreviousImageInList(wand->images);
   8071   return(MagickTrue);
   8072 }
   8073 
   8074 /*
   8076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8077 %                                                                             %
   8078 %                                                                             %
   8079 %                                                                             %
   8080 %   M a g i c k Q u a n t i z e I m a g e                                     %
   8081 %                                                                             %
   8082 %                                                                             %
   8083 %                                                                             %
   8084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8085 %
   8086 %  MagickQuantizeImage() analyzes the colors within a reference image and
   8087 %  chooses a fixed number of colors to represent the image.  The goal of the
   8088 %  algorithm is to minimize the color difference between the input and output
   8089 %  image while minimizing the processing time.
   8090 %
   8091 %  The format of the MagickQuantizeImage method is:
   8092 %
   8093 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
   8094 %        const size_t number_colors,const ColorspaceType colorspace,
   8095 %        const size_t treedepth,const DitherMethod dither_method,
   8096 %        const MagickBooleanType measure_error)
   8097 %
   8098 %  A description of each parameter follows:
   8099 %
   8100 %    o wand: the magick wand.
   8101 %
   8102 %    o number_colors: the number of colors.
   8103 %
   8104 %    o colorspace: Perform color reduction in this colorspace, typically
   8105 %      RGBColorspace.
   8106 %
   8107 %    o treedepth: Normally, this integer value is zero or one.  A zero or
   8108 %      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
   8109 %      reference image with the least amount of memory and the fastest
   8110 %      computational speed.  In some cases, such as an image with low color
   8111 %      dispersion (a few number of colors), a value other than
   8112 %      Log4(number_colors) is required.  To expand the color tree completely,
   8113 %      use a value of 8.
   8114 %
   8115 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
   8116 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
   8117 %
   8118 %    o measure_error: A value other than zero measures the difference between
   8119 %      the original and quantized images.  This difference is the total
   8120 %      quantization error.  The error is computed by summing over all pixels
   8121 %      in an image the distance squared in RGB space between each reference
   8122 %      pixel value and its quantized value.
   8123 %
   8124 */
   8125 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
   8126   const size_t number_colors,const ColorspaceType colorspace,
   8127   const size_t treedepth,const DitherMethod dither_method,
   8128   const MagickBooleanType measure_error)
   8129 {
   8130   MagickBooleanType
   8131     status;
   8132 
   8133   QuantizeInfo
   8134     *quantize_info;
   8135 
   8136   assert(wand != (MagickWand *) NULL);
   8137   assert(wand->signature == MagickWandSignature);
   8138   if (wand->debug != MagickFalse)
   8139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8140   if (wand->images == (Image *) NULL)
   8141     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8142   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
   8143   quantize_info->number_colors=number_colors;
   8144   quantize_info->dither_method=dither_method;
   8145   quantize_info->tree_depth=treedepth;
   8146   quantize_info->colorspace=colorspace;
   8147   quantize_info->measure_error=measure_error;
   8148   status=QuantizeImage(quantize_info,wand->images,wand->exception);
   8149   quantize_info=DestroyQuantizeInfo(quantize_info);
   8150   return(status);
   8151 }
   8152 
   8153 /*
   8155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8156 %                                                                             %
   8157 %                                                                             %
   8158 %                                                                             %
   8159 %   M a g i c k Q u a n t i z e I m a g e s                                   %
   8160 %                                                                             %
   8161 %                                                                             %
   8162 %                                                                             %
   8163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8164 %
   8165 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
   8166 %  chooses a fixed number of colors to represent the image.  The goal of the
   8167 %  algorithm is to minimize the color difference between the input and output
   8168 %  image while minimizing the processing time.
   8169 %
   8170 %  The format of the MagickQuantizeImages method is:
   8171 %
   8172 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
   8173 %        const size_t number_colors,const ColorspaceType colorspace,
   8174 %        const size_t treedepth,const DitherMethod dither_method,
   8175 %        const MagickBooleanType measure_error)
   8176 %
   8177 %  A description of each parameter follows:
   8178 %
   8179 %    o wand: the magick wand.
   8180 %
   8181 %    o number_colors: the number of colors.
   8182 %
   8183 %    o colorspace: Perform color reduction in this colorspace, typically
   8184 %      RGBColorspace.
   8185 %
   8186 %    o treedepth: Normally, this integer value is zero or one.  A zero or
   8187 %      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
   8188 %      reference image with the least amount of memory and the fastest
   8189 %      computational speed.  In some cases, such as an image with low color
   8190 %      dispersion (a few number of colors), a value other than
   8191 %      Log4(number_colors) is required.  To expand the color tree completely,
   8192 %      use a value of 8.
   8193 %
   8194 %    o dither_method: choose from these dither methods: NoDitherMethod,
   8195 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   8196 %
   8197 %    o measure_error: A value other than zero measures the difference between
   8198 %      the original and quantized images.  This difference is the total
   8199 %      quantization error.  The error is computed by summing over all pixels
   8200 %      in an image the distance squared in RGB space between each reference
   8201 %      pixel value and its quantized value.
   8202 %
   8203 */
   8204 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
   8205   const size_t number_colors,const ColorspaceType colorspace,
   8206   const size_t treedepth,const DitherMethod dither_method,
   8207   const MagickBooleanType measure_error)
   8208 {
   8209   MagickBooleanType
   8210     status;
   8211 
   8212   QuantizeInfo
   8213     *quantize_info;
   8214 
   8215   assert(wand != (MagickWand *) NULL);
   8216   assert(wand->signature == MagickWandSignature);
   8217   if (wand->debug != MagickFalse)
   8218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8219   if (wand->images == (Image *) NULL)
   8220     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8221   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
   8222   quantize_info->number_colors=number_colors;
   8223   quantize_info->dither_method=dither_method;
   8224   quantize_info->tree_depth=treedepth;
   8225   quantize_info->colorspace=colorspace;
   8226   quantize_info->measure_error=measure_error;
   8227   status=QuantizeImages(quantize_info,wand->images,wand->exception);
   8228   quantize_info=DestroyQuantizeInfo(quantize_info);
   8229   return(status);
   8230 }
   8231 
   8232 /*
   8234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8235 %                                                                             %
   8236 %                                                                             %
   8237 %                                                                             %
   8238 %   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                         %
   8239 %                                                                             %
   8240 %                                                                             %
   8241 %                                                                             %
   8242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8243 %
   8244 %  MagickRotationalBlurImage() rotational blurs an image.
   8245 %
   8246 %  The format of the MagickRotationalBlurImage method is:
   8247 %
   8248 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
   8249 %        const double angle)
   8250 %
   8251 %  A description of each parameter follows:
   8252 %
   8253 %    o wand: the magick wand.
   8254 %
   8255 %    o angle: the angle of the blur in degrees.
   8256 %
   8257 */
   8258 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
   8259   const double angle)
   8260 {
   8261   Image
   8262     *blur_image;
   8263 
   8264   assert(wand != (MagickWand *) NULL);
   8265   assert(wand->signature == MagickWandSignature);
   8266   if (wand->debug != MagickFalse)
   8267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8268   if (wand->images == (Image *) NULL)
   8269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8270   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
   8271   if (blur_image == (Image *) NULL)
   8272     return(MagickFalse);
   8273   ReplaceImageInList(&wand->images,blur_image);
   8274   return(MagickTrue);
   8275 }
   8276 
   8277 /*
   8279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8280 %                                                                             %
   8281 %                                                                             %
   8282 %                                                                             %
   8283 %   M a g i c k R a i s e I m a g e                                           %
   8284 %                                                                             %
   8285 %                                                                             %
   8286 %                                                                             %
   8287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8288 %
   8289 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
   8290 %  by lightening and darkening the edges of the image.  Members width and
   8291 %  height of raise_info define the width of the vertical and horizontal
   8292 %  edge of the effect.
   8293 %
   8294 %  The format of the MagickRaiseImage method is:
   8295 %
   8296 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
   8297 %        const size_t width,const size_t height,const ssize_t x,
   8298 %        const ssize_t y,const MagickBooleanType raise)
   8299 %
   8300 %  A description of each parameter follows:
   8301 %
   8302 %    o wand: the magick wand.
   8303 %
   8304 %    o width,height,x,y:  Define the dimensions of the area to raise.
   8305 %
   8306 %    o raise: A value other than zero creates a 3-D raise effect,
   8307 %      otherwise it has a lowered effect.
   8308 %
   8309 */
   8310 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
   8311   const size_t width,const size_t height,const ssize_t x,
   8312   const ssize_t y,const MagickBooleanType raise)
   8313 {
   8314   MagickBooleanType
   8315     status;
   8316 
   8317   RectangleInfo
   8318     raise_info;
   8319 
   8320   assert(wand != (MagickWand *) NULL);
   8321   assert(wand->signature == MagickWandSignature);
   8322   if (wand->debug != MagickFalse)
   8323     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8324   if (wand->images == (Image *) NULL)
   8325     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8326   raise_info.width=width;
   8327   raise_info.height=height;
   8328   raise_info.x=x;
   8329   raise_info.y=y;
   8330   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
   8331   return(status);
   8332 }
   8333 
   8334 /*
   8336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8337 %                                                                             %
   8338 %                                                                             %
   8339 %                                                                             %
   8340 %   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                       %
   8341 %                                                                             %
   8342 %                                                                             %
   8343 %                                                                             %
   8344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8345 %
   8346 %  MagickRandomThresholdImage() changes the value of individual pixels based on
   8347 %  the intensity of each pixel compared to threshold.  The result is a
   8348 %  high-contrast, two color image.
   8349 %
   8350 %  The format of the MagickRandomThresholdImage method is:
   8351 %
   8352 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
   8353 %        const double low,const double high)
   8354 %
   8355 %  A description of each parameter follows:
   8356 %
   8357 %    o wand: the magick wand.
   8358 %
   8359 %    o low,high: Specify the high and low thresholds. These values range from
   8360 %      0 to QuantumRange.
   8361 %
   8362 */
   8363 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
   8364   const double low,const double high)
   8365 {
   8366   assert(wand != (MagickWand *) NULL);
   8367   assert(wand->signature == MagickWandSignature);
   8368   if (wand->debug != MagickFalse)
   8369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8370   if (wand->images == (Image *) NULL)
   8371     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8372   return(RandomThresholdImage(wand->images,low,high,wand->exception));
   8373 }
   8374 
   8375 /*
   8377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8378 %                                                                             %
   8379 %                                                                             %
   8380 %                                                                             %
   8381 %   M a g i c k R e a d I m a g e                                             %
   8382 %                                                                             %
   8383 %                                                                             %
   8384 %                                                                             %
   8385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8386 %
   8387 %  MagickReadImage() reads an image or image sequence.  The images are inserted
   8388 %  jjust before the current image pointer position.
   8389 %
   8390 %  Use MagickSetFirstIterator(), to insert new images before all the current
   8391 %  images in the wand, MagickSetLastIterator() to append add to the end,
   8392 %  MagickSetIteratorIndex() to place images just after the given index.
   8393 %
   8394 %  The format of the MagickReadImage method is:
   8395 %
   8396 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
   8397 %
   8398 %  A description of each parameter follows:
   8399 %
   8400 %    o wand: the magick wand.
   8401 %
   8402 %    o filename: the image filename.
   8403 %
   8404 */
   8405 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
   8406   const char *filename)
   8407 {
   8408   Image
   8409     *images;
   8410 
   8411   ImageInfo
   8412     *read_info;
   8413 
   8414   assert(wand != (MagickWand *) NULL);
   8415   assert(wand->signature == MagickWandSignature);
   8416   if (wand->debug != MagickFalse)
   8417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8418   read_info=CloneImageInfo(wand->image_info);
   8419   if (filename != (const char *) NULL)
   8420     (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
   8421   images=ReadImage(read_info,wand->exception);
   8422   read_info=DestroyImageInfo(read_info);
   8423   if (images == (Image *) NULL)
   8424     return(MagickFalse);
   8425   return(InsertImageInWand(wand,images));
   8426 }
   8427 
   8428 /*
   8430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8431 %                                                                             %
   8432 %                                                                             %
   8433 %                                                                             %
   8434 %   M a g i c k R e a d I m a g e B l o b                                     %
   8435 %                                                                             %
   8436 %                                                                             %
   8437 %                                                                             %
   8438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8439 %
   8440 %  MagickReadImageBlob() reads an image or image sequence from a blob.
   8441 %  In all other respects it is like MagickReadImage().
   8442 %
   8443 %  The format of the MagickReadImageBlob method is:
   8444 %
   8445 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
   8446 %        const void *blob,const size_t length)
   8447 %
   8448 %  A description of each parameter follows:
   8449 %
   8450 %    o wand: the magick wand.
   8451 %
   8452 %    o blob: the blob.
   8453 %
   8454 %    o length: the blob length.
   8455 %
   8456 */
   8457 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
   8458   const void *blob,const size_t length)
   8459 {
   8460   Image
   8461     *images;
   8462 
   8463   assert(wand != (MagickWand *) NULL);
   8464   assert(wand->signature == MagickWandSignature);
   8465   if (wand->debug != MagickFalse)
   8466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8467   images=BlobToImage(wand->image_info,blob,length,wand->exception);
   8468   if (images == (Image *) NULL)
   8469     return(MagickFalse);
   8470   return(InsertImageInWand(wand,images));
   8471 }
   8472 
   8473 /*
   8475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8476 %                                                                             %
   8477 %                                                                             %
   8478 %                                                                             %
   8479 %   M a g i c k R e a d I m a g e F i l e                                     %
   8480 %                                                                             %
   8481 %                                                                             %
   8482 %                                                                             %
   8483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8484 %
   8485 %  MagickReadImageFile() reads an image or image sequence from an already
   8486 %  opened file descriptor.  Otherwise it is like MagickReadImage().
   8487 %
   8488 %  The format of the MagickReadImageFile method is:
   8489 %
   8490 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
   8491 %
   8492 %  A description of each parameter follows:
   8493 %
   8494 %    o wand: the magick wand.
   8495 %
   8496 %    o file: the file descriptor.
   8497 %
   8498 */
   8499 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
   8500 {
   8501   Image
   8502     *images;
   8503 
   8504   ImageInfo
   8505     *read_info;
   8506 
   8507   assert(wand != (MagickWand *) NULL);
   8508   assert(wand->signature == MagickWandSignature);
   8509   assert(file != (FILE *) NULL);
   8510   if (wand->debug != MagickFalse)
   8511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8512   read_info=CloneImageInfo(wand->image_info);
   8513   SetImageInfoFile(read_info,file);
   8514   images=ReadImage(read_info,wand->exception);
   8515   read_info=DestroyImageInfo(read_info);
   8516   if (images == (Image *) NULL)
   8517     return(MagickFalse);
   8518   return(InsertImageInWand(wand,images));
   8519 }
   8520 
   8521 /*
   8523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8524 %                                                                             %
   8525 %                                                                             %
   8526 %                                                                             %
   8527 %   M a g i c k R e m a p I m a g e                                           %
   8528 %                                                                             %
   8529 %                                                                             %
   8530 %                                                                             %
   8531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8532 %
   8533 %  MagickRemapImage() replaces the colors of an image with the closest color
   8534 %  from a reference image.
   8535 %
   8536 %  The format of the MagickRemapImage method is:
   8537 %
   8538 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
   8539 %        const MagickWand *remap_wand,const DitherMethod method)
   8540 %
   8541 %  A description of each parameter follows:
   8542 %
   8543 %    o wand: the magick wand.
   8544 %
   8545 %    o affinity: the affinity wand.
   8546 %
   8547 %    o method: choose from these dither methods: NoDitherMethod,
   8548 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
   8549 %
   8550 */
   8551 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
   8552   const MagickWand *remap_wand,const DitherMethod dither_method)
   8553 {
   8554   MagickBooleanType
   8555     status;
   8556 
   8557   QuantizeInfo
   8558     *quantize_info;
   8559 
   8560   assert(wand != (MagickWand *) NULL);
   8561   assert(wand->signature == MagickWandSignature);
   8562   if (wand->debug != MagickFalse)
   8563     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8564   if ((wand->images == (Image *) NULL) ||
   8565       (remap_wand->images == (Image *) NULL))
   8566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8567   quantize_info=AcquireQuantizeInfo(wand->image_info);
   8568   quantize_info->dither_method=dither_method;
   8569   status=RemapImage(quantize_info,wand->images,remap_wand->images,
   8570     wand->exception);
   8571   quantize_info=DestroyQuantizeInfo(quantize_info);
   8572   return(status);
   8573 }
   8574 
   8575 /*
   8577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8578 %                                                                             %
   8579 %                                                                             %
   8580 %                                                                             %
   8581 %   M a g i c k R e m o v e I m a g e                                         %
   8582 %                                                                             %
   8583 %                                                                             %
   8584 %                                                                             %
   8585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8586 %
   8587 %  MagickRemoveImage() removes an image from the image list.
   8588 %
   8589 %  The format of the MagickRemoveImage method is:
   8590 %
   8591 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
   8592 %
   8593 %  A description of each parameter follows:
   8594 %
   8595 %    o wand: the magick wand.
   8596 %
   8597 %    o insert: the splice wand.
   8598 %
   8599 */
   8600 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
   8601 {
   8602   assert(wand != (MagickWand *) NULL);
   8603   assert(wand->signature == MagickWandSignature);
   8604   if (wand->debug != MagickFalse)
   8605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8606   if (wand->images == (Image *) NULL)
   8607     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8608   DeleteImageFromList(&wand->images);
   8609   return(MagickTrue);
   8610 }
   8611 
   8612 /*
   8614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8615 %                                                                             %
   8616 %                                                                             %
   8617 %                                                                             %
   8618 %   M a g i c k R e s a m p l e I m a g e                                     %
   8619 %                                                                             %
   8620 %                                                                             %
   8621 %                                                                             %
   8622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8623 %
   8624 %  MagickResampleImage() resample image to desired resolution.
   8625 %
   8626 %    Bessel   Blackman   Box
   8627 %    Catrom   Cubic      Gaussian
   8628 %    Hanning  Hermite    Lanczos
   8629 %    Mitchell Point      Quandratic
   8630 %    Sinc     Triangle
   8631 %
   8632 %  Most of the filters are FIR (finite impulse response), however, Bessel,
   8633 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
   8634 %  are windowed (brought down to zero) with the Blackman filter.
   8635 %
   8636 %  The format of the MagickResampleImage method is:
   8637 %
   8638 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
   8639 %        const double x_resolution,const double y_resolution,
   8640 %        const FilterType filter)
   8641 %
   8642 %  A description of each parameter follows:
   8643 %
   8644 %    o wand: the magick wand.
   8645 %
   8646 %    o x_resolution: the new image x resolution.
   8647 %
   8648 %    o y_resolution: the new image y resolution.
   8649 %
   8650 %    o filter: Image filter to use.
   8651 %
   8652 */
   8653 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
   8654   const double x_resolution,const double y_resolution,const FilterType filter)
   8655 {
   8656   Image
   8657     *resample_image;
   8658 
   8659   assert(wand != (MagickWand *) NULL);
   8660   assert(wand->signature == MagickWandSignature);
   8661   if (wand->debug != MagickFalse)
   8662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8663   if (wand->images == (Image *) NULL)
   8664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8665   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
   8666     wand->exception);
   8667   if (resample_image == (Image *) NULL)
   8668     return(MagickFalse);
   8669   ReplaceImageInList(&wand->images,resample_image);
   8670   return(MagickTrue);
   8671 }
   8672 
   8673 /*
   8675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8676 %                                                                             %
   8677 %                                                                             %
   8678 %                                                                             %
   8679 %   M a g i c k R e s e t I m a g e P a g e                                   %
   8680 %                                                                             %
   8681 %                                                                             %
   8682 %                                                                             %
   8683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8684 %
   8685 %  MagickResetImagePage() resets the Wand page canvas and position.
   8686 %
   8687 %  The format of the MagickResetImagePage method is:
   8688 %
   8689 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
   8690 %        const char *page)
   8691 %
   8692 %  A description of each parameter follows:
   8693 %
   8694 %    o wand: the magick wand.
   8695 %
   8696 %    o page: the relative page specification.
   8697 %
   8698 */
   8699 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
   8700   const char *page)
   8701 {
   8702   assert(wand != (MagickWand *) NULL);
   8703   assert(wand->signature == MagickWandSignature);
   8704   if (wand->debug != MagickFalse)
   8705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8706   if (wand->images == (Image *) NULL)
   8707     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8708   if ((page == (char *) NULL) || (*page == '\0'))
   8709     {
   8710       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
   8711       return(MagickTrue);
   8712     }
   8713   return(ResetImagePage(wand->images,page));
   8714 }
   8715 
   8716 /*
   8718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8719 %                                                                             %
   8720 %                                                                             %
   8721 %                                                                             %
   8722 %   M a g i c k R e s i z e I m a g e                                         %
   8723 %                                                                             %
   8724 %                                                                             %
   8725 %                                                                             %
   8726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8727 %
   8728 %  MagickResizeImage() scales an image to the desired dimensions with one of
   8729 %  these filters:
   8730 %
   8731 %    Bessel   Blackman   Box
   8732 %    Catrom   Cubic      Gaussian
   8733 %    Hanning  Hermite    Lanczos
   8734 %    Mitchell Point      Quandratic
   8735 %    Sinc     Triangle
   8736 %
   8737 %  Most of the filters are FIR (finite impulse response), however, Bessel,
   8738 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
   8739 %  are windowed (brought down to zero) with the Blackman filter.
   8740 %
   8741 %  The format of the MagickResizeImage method is:
   8742 %
   8743 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
   8744 %        const size_t columns,const size_t rows,const FilterType filter)
   8745 %
   8746 %  A description of each parameter follows:
   8747 %
   8748 %    o wand: the magick wand.
   8749 %
   8750 %    o columns: the number of columns in the scaled image.
   8751 %
   8752 %    o rows: the number of rows in the scaled image.
   8753 %
   8754 %    o filter: Image filter to use.
   8755 %
   8756 */
   8757 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
   8758   const size_t columns,const size_t rows,const FilterType filter)
   8759 {
   8760   Image
   8761     *resize_image;
   8762 
   8763   assert(wand != (MagickWand *) NULL);
   8764   assert(wand->signature == MagickWandSignature);
   8765   if (wand->debug != MagickFalse)
   8766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8767   if (wand->images == (Image *) NULL)
   8768     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8769   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
   8770   if (resize_image == (Image *) NULL)
   8771     return(MagickFalse);
   8772   ReplaceImageInList(&wand->images,resize_image);
   8773   return(MagickTrue);
   8774 }
   8775 
   8776 /*
   8778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8779 %                                                                             %
   8780 %                                                                             %
   8781 %                                                                             %
   8782 %   M a g i c k R o l l I m a g e                                             %
   8783 %                                                                             %
   8784 %                                                                             %
   8785 %                                                                             %
   8786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8787 %
   8788 %  MagickRollImage() offsets an image as defined by x and y.
   8789 %
   8790 %  The format of the MagickRollImage method is:
   8791 %
   8792 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
   8793 %        const size_t y)
   8794 %
   8795 %  A description of each parameter follows:
   8796 %
   8797 %    o wand: the magick wand.
   8798 %
   8799 %    o x: the x offset.
   8800 %
   8801 %    o y: the y offset.
   8802 %
   8803 %
   8804 */
   8805 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
   8806   const ssize_t x,const ssize_t y)
   8807 {
   8808   Image
   8809     *roll_image;
   8810 
   8811   assert(wand != (MagickWand *) NULL);
   8812   assert(wand->signature == MagickWandSignature);
   8813   if (wand->debug != MagickFalse)
   8814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8815   if (wand->images == (Image *) NULL)
   8816     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8817   roll_image=RollImage(wand->images,x,y,wand->exception);
   8818   if (roll_image == (Image *) NULL)
   8819     return(MagickFalse);
   8820   ReplaceImageInList(&wand->images,roll_image);
   8821   return(MagickTrue);
   8822 }
   8823 
   8824 /*
   8826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8827 %                                                                             %
   8828 %                                                                             %
   8829 %                                                                             %
   8830 %   M a g i c k R o t a t e I m a g e                                         %
   8831 %                                                                             %
   8832 %                                                                             %
   8833 %                                                                             %
   8834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8835 %
   8836 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
   8837 %  triangles left over from rotating the image are filled with the
   8838 %  background color.
   8839 %
   8840 %  The format of the MagickRotateImage method is:
   8841 %
   8842 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
   8843 %        const PixelWand *background,const double degrees)
   8844 %
   8845 %  A description of each parameter follows:
   8846 %
   8847 %    o wand: the magick wand.
   8848 %
   8849 %    o background: the background pixel wand.
   8850 %
   8851 %    o degrees: the number of degrees to rotate the image.
   8852 %
   8853 %
   8854 */
   8855 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
   8856   const PixelWand *background,const double degrees)
   8857 {
   8858   Image
   8859     *rotate_image;
   8860 
   8861   assert(wand != (MagickWand *) NULL);
   8862   assert(wand->signature == MagickWandSignature);
   8863   if (wand->debug != MagickFalse)
   8864     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8865   if (wand->images == (Image *) NULL)
   8866     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8867   PixelGetQuantumPacket(background,&wand->images->background_color);
   8868   rotate_image=RotateImage(wand->images,degrees,wand->exception);
   8869   if (rotate_image == (Image *) NULL)
   8870     return(MagickFalse);
   8871   ReplaceImageInList(&wand->images,rotate_image);
   8872   return(MagickTrue);
   8873 }
   8874 
   8875 /*
   8877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8878 %                                                                             %
   8879 %                                                                             %
   8880 %                                                                             %
   8881 %   M a g i c k S a m p l e I m a g e                                         %
   8882 %                                                                             %
   8883 %                                                                             %
   8884 %                                                                             %
   8885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8886 %
   8887 %  MagickSampleImage() scales an image to the desired dimensions with pixel
   8888 %  sampling.  Unlike other scaling methods, this method does not introduce
   8889 %  any additional color into the scaled image.
   8890 %
   8891 %  The format of the MagickSampleImage method is:
   8892 %
   8893 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
   8894 %        const size_t columns,const size_t rows)
   8895 %
   8896 %  A description of each parameter follows:
   8897 %
   8898 %    o wand: the magick wand.
   8899 %
   8900 %    o columns: the number of columns in the scaled image.
   8901 %
   8902 %    o rows: the number of rows in the scaled image.
   8903 %
   8904 %
   8905 */
   8906 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
   8907   const size_t columns,const size_t rows)
   8908 {
   8909   Image
   8910     *sample_image;
   8911 
   8912   assert(wand != (MagickWand *) NULL);
   8913   assert(wand->signature == MagickWandSignature);
   8914   if (wand->debug != MagickFalse)
   8915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8916   if (wand->images == (Image *) NULL)
   8917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8918   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
   8919   if (sample_image == (Image *) NULL)
   8920     return(MagickFalse);
   8921   ReplaceImageInList(&wand->images,sample_image);
   8922   return(MagickTrue);
   8923 }
   8924 
   8925 /*
   8927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8928 %                                                                             %
   8929 %                                                                             %
   8930 %                                                                             %
   8931 %   M a g i c k S c a l e I m a g e                                           %
   8932 %                                                                             %
   8933 %                                                                             %
   8934 %                                                                             %
   8935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8936 %
   8937 %  MagickScaleImage() scales the size of an image to the given dimensions.
   8938 %
   8939 %  The format of the MagickScaleImage method is:
   8940 %
   8941 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
   8942 %        const size_t columns,const size_t rows)
   8943 %
   8944 %  A description of each parameter follows:
   8945 %
   8946 %    o wand: the magick wand.
   8947 %
   8948 %    o columns: the number of columns in the scaled image.
   8949 %
   8950 %    o rows: the number of rows in the scaled image.
   8951 %
   8952 %
   8953 */
   8954 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
   8955   const size_t columns,const size_t rows)
   8956 {
   8957   Image
   8958     *scale_image;
   8959 
   8960   assert(wand != (MagickWand *) NULL);
   8961   assert(wand->signature == MagickWandSignature);
   8962   if (wand->debug != MagickFalse)
   8963     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   8964   if (wand->images == (Image *) NULL)
   8965     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   8966   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
   8967   if (scale_image == (Image *) NULL)
   8968     return(MagickFalse);
   8969   ReplaceImageInList(&wand->images,scale_image);
   8970   return(MagickTrue);
   8971 }
   8972 
   8973 /*
   8975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8976 %                                                                             %
   8977 %                                                                             %
   8978 %                                                                             %
   8979 %   M a g i c k S e g m e n t I m a g e                                       %
   8980 %                                                                             %
   8981 %                                                                             %
   8982 %                                                                             %
   8983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8984 %
   8985 %  MagickSegmentImage() segments an image by analyzing the histograms of the
   8986 %  color components and identifying units that are homogeneous with the fuzzy
   8987 %  C-means technique.
   8988 %
   8989 %  The format of the SegmentImage method is:
   8990 %
   8991 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
   8992 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
   8993 %        const double cluster_threshold,const double smooth_threshold)
   8994 %
   8995 %  A description of each parameter follows.
   8996 %
   8997 %    o wand: the wand.
   8998 %
   8999 %    o colorspace: the image colorspace.
   9000 %
   9001 %    o verbose:  Set to MagickTrue to print detailed information about the
   9002 %      identified classes.
   9003 %
   9004 %    o cluster_threshold:  This represents the minimum number of pixels
   9005 %      contained in a hexahedra before it can be considered valid (expressed as
   9006 %      a percentage).
   9007 %
   9008 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
   9009 %      derivative of the histogram.  As the value is increased, you can expect a
   9010 %      smoother second derivative.
   9011 %
   9012 */
   9013 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
   9014   const ColorspaceType colorspace,const MagickBooleanType verbose,
   9015   const double cluster_threshold,const double smooth_threshold)
   9016 {
   9017   MagickBooleanType
   9018     status;
   9019 
   9020   assert(wand != (MagickWand *) NULL);
   9021   assert(wand->signature == MagickWandSignature);
   9022   if (wand->debug != MagickFalse)
   9023     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9024   if (wand->images == (Image *) NULL)
   9025     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9026   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
   9027     smooth_threshold,wand->exception);
   9028   return(status);
   9029 }
   9030 
   9031 /*
   9033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9034 %                                                                             %
   9035 %                                                                             %
   9036 %                                                                             %
   9037 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
   9038 %                                                                             %
   9039 %                                                                             %
   9040 %                                                                             %
   9041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9042 %
   9043 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
   9044 %  threshold. It is similar to the unsharpen mask that sharpens everything with
   9045 %  contrast above a certain threshold.
   9046 %
   9047 %  The format of the MagickSelectiveBlurImage method is:
   9048 %
   9049 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
   9050 %        const double radius,const double sigma,const double threshold)
   9051 %
   9052 %  A description of each parameter follows:
   9053 %
   9054 %    o wand: the magick wand.
   9055 %
   9056 %    o radius: the radius of the gaussian, in pixels, not counting the center
   9057 %      pixel.
   9058 %
   9059 %    o sigma: the standard deviation of the gaussian, in pixels.
   9060 %
   9061 %    o threshold: only pixels within this contrast threshold are included
   9062 %      in the blur operation.
   9063 %
   9064 */
   9065 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
   9066   const double radius,const double sigma,const double threshold)
   9067 {
   9068   Image
   9069     *blur_image;
   9070 
   9071   assert(wand != (MagickWand *) NULL);
   9072   assert(wand->signature == MagickWandSignature);
   9073   if (wand->debug != MagickFalse)
   9074     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9075   if (wand->images == (Image *) NULL)
   9076     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9077   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
   9078     wand->exception);
   9079   if (blur_image == (Image *) NULL)
   9080     return(MagickFalse);
   9081   ReplaceImageInList(&wand->images,blur_image);
   9082   return(MagickTrue);
   9083 }
   9084 
   9085 /*
   9087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9088 %                                                                             %
   9089 %                                                                             %
   9090 %                                                                             %
   9091 %   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                       %
   9092 %                                                                             %
   9093 %                                                                             %
   9094 %                                                                             %
   9095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9096 %
   9097 %  MagickSeparateImage() separates a channel from the image and returns a
   9098 %  grayscale image.  A channel is a particular color component of each pixel
   9099 %  in the image.
   9100 %
   9101 %  The format of the MagickSeparateImage method is:
   9102 %
   9103 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
   9104 %        const ChannelType channel)
   9105 %
   9106 %  A description of each parameter follows:
   9107 %
   9108 %    o wand: the magick wand.
   9109 %
   9110 %    o channel: the channel.
   9111 %
   9112 */
   9113 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
   9114   const ChannelType channel)
   9115 {
   9116   Image
   9117     *separate_image;
   9118 
   9119   assert(wand != (MagickWand *) NULL);
   9120   assert(wand->signature == MagickWandSignature);
   9121   if (wand->debug != MagickFalse)
   9122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9123   if (wand->images == (Image *) NULL)
   9124     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9125   separate_image=SeparateImage(wand->images,channel,wand->exception);
   9126   if (separate_image == (Image *) NULL)
   9127     return(MagickFalse);
   9128   ReplaceImageInList(&wand->images,separate_image);
   9129   return(MagickTrue);
   9130 }
   9131 
   9132 /*
   9134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9135 %                                                                             %
   9136 %                                                                             %
   9137 %                                                                             %
   9138 %     M a g i c k S e p i a T o n e I m a g e                                 %
   9139 %                                                                             %
   9140 %                                                                             %
   9141 %                                                                             %
   9142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9143 %
   9144 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
   9145 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
   9146 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
   9147 %  threshold of 80% is a good starting point for a reasonable tone.
   9148 %
   9149 %  The format of the MagickSepiaToneImage method is:
   9150 %
   9151 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
   9152 %        const double threshold)
   9153 %
   9154 %  A description of each parameter follows:
   9155 %
   9156 %    o wand: the magick wand.
   9157 %
   9158 %    o threshold:  Define the extent of the sepia toning.
   9159 %
   9160 */
   9161 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
   9162   const double threshold)
   9163 {
   9164   Image
   9165     *sepia_image;
   9166 
   9167   assert(wand != (MagickWand *) NULL);
   9168   assert(wand->signature == MagickWandSignature);
   9169   if (wand->debug != MagickFalse)
   9170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9171   if (wand->images == (Image *) NULL)
   9172     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9173   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
   9174   if (sepia_image == (Image *) NULL)
   9175     return(MagickFalse);
   9176   ReplaceImageInList(&wand->images,sepia_image);
   9177   return(MagickTrue);
   9178 }
   9179 
   9180 /*
   9182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9183 %                                                                             %
   9184 %                                                                             %
   9185 %                                                                             %
   9186 %   M a g i c k S e t I m a g e                                               %
   9187 %                                                                             %
   9188 %                                                                             %
   9189 %                                                                             %
   9190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9191 %
   9192 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
   9193 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
   9194 %  wand.
   9195 %
   9196 %  The format of the MagickSetImage method is:
   9197 %
   9198 %      MagickBooleanType MagickSetImage(MagickWand *wand,
   9199 %        const MagickWand *set_wand)
   9200 %
   9201 %  A description of each parameter follows:
   9202 %
   9203 %    o wand: the magick wand.
   9204 %
   9205 %    o set_wand: the set_wand wand.
   9206 %
   9207 */
   9208 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
   9209   const MagickWand *set_wand)
   9210 {
   9211   Image
   9212     *images;
   9213 
   9214   assert(wand != (MagickWand *) NULL);
   9215   assert(wand->signature == MagickWandSignature);
   9216   if (wand->debug != MagickFalse)
   9217     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9218   assert(set_wand != (MagickWand *) NULL);
   9219   assert(set_wand->signature == MagickWandSignature);
   9220   if (wand->debug != MagickFalse)
   9221     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
   9222   if (set_wand->images == (Image *) NULL)
   9223     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9224   images=CloneImageList(set_wand->images,wand->exception);
   9225   if (images == (Image *) NULL)
   9226     return(MagickFalse);
   9227   ReplaceImageInList(&wand->images,images);
   9228   return(MagickTrue);
   9229 }
   9230 
   9231 /*
   9233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9234 %                                                                             %
   9235 %                                                                             %
   9236 %                                                                             %
   9237 %   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                       %
   9238 %                                                                             %
   9239 %                                                                             %
   9240 %                                                                             %
   9241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9242 %
   9243 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
   9244 %  alpha channel.
   9245 %
   9246 %  The format of the MagickSetImageAlphaChannel method is:
   9247 %
   9248 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
   9249 %        const AlphaChannelOption alpha_type)
   9250 %
   9251 %  A description of each parameter follows:
   9252 %
   9253 %    o wand: the magick wand.
   9254 %
   9255 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
   9256 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
   9257 %
   9258 */
   9259 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
   9260   const AlphaChannelOption alpha_type)
   9261 {
   9262   assert(wand != (MagickWand *) NULL);
   9263   assert(wand->signature == MagickWandSignature);
   9264   if (wand->debug != MagickFalse)
   9265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9266   if (wand->images == (Image *) NULL)
   9267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9268   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
   9269 }
   9270 
   9271 /*
   9273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9274 %                                                                             %
   9275 %                                                                             %
   9276 %                                                                             %
   9277 %   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                 %
   9278 %                                                                             %
   9279 %                                                                             %
   9280 %                                                                             %
   9281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9282 %
   9283 %  MagickSetImageBackgroundColor() sets the image background color.
   9284 %
   9285 %  The format of the MagickSetImageBackgroundColor method is:
   9286 %
   9287 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
   9288 %        const PixelWand *background)
   9289 %
   9290 %  A description of each parameter follows:
   9291 %
   9292 %    o wand: the magick wand.
   9293 %
   9294 %    o background: the background pixel wand.
   9295 %
   9296 */
   9297 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
   9298   const PixelWand *background)
   9299 {
   9300   assert(wand != (MagickWand *) NULL);
   9301   assert(wand->signature == MagickWandSignature);
   9302   if (wand->debug != MagickFalse)
   9303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9304   if (wand->images == (Image *) NULL)
   9305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9306   PixelGetQuantumPacket(background,&wand->images->background_color);
   9307   return(MagickTrue);
   9308 }
   9309 
   9310 /*
   9312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9313 %                                                                             %
   9314 %                                                                             %
   9315 %                                                                             %
   9316 %   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                         %
   9317 %                                                                             %
   9318 %                                                                             %
   9319 %                                                                             %
   9320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9321 %
   9322 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
   9323 %
   9324 %  The format of the MagickSetImageBluePrimary method is:
   9325 %
   9326 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
   9327 %        const double x,const double y,const double z)
   9328 %
   9329 %  A description of each parameter follows:
   9330 %
   9331 %    o wand: the magick wand.
   9332 %
   9333 %    o x: the blue primary x-point.
   9334 %
   9335 %    o y: the blue primary y-point.
   9336 %
   9337 %    o z: the blue primary z-point.
   9338 %
   9339 */
   9340 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
   9341   const double x,const double y,const double z)
   9342 {
   9343   assert(wand != (MagickWand *) NULL);
   9344   assert(wand->signature == MagickWandSignature);
   9345   if (wand->debug != MagickFalse)
   9346     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9347   if (wand->images == (Image *) NULL)
   9348     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9349   wand->images->chromaticity.blue_primary.x=x;
   9350   wand->images->chromaticity.blue_primary.y=y;
   9351   wand->images->chromaticity.blue_primary.z=z;
   9352   return(MagickTrue);
   9353 }
   9354 
   9355 /*
   9357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9358 %                                                                             %
   9359 %                                                                             %
   9360 %                                                                             %
   9361 %   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                         %
   9362 %                                                                             %
   9363 %                                                                             %
   9364 %                                                                             %
   9365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9366 %
   9367 %  MagickSetImageBorderColor() sets the image border color.
   9368 %
   9369 %  The format of the MagickSetImageBorderColor method is:
   9370 %
   9371 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
   9372 %        const PixelWand *border)
   9373 %
   9374 %  A description of each parameter follows:
   9375 %
   9376 %    o wand: the magick wand.
   9377 %
   9378 %    o border: the border pixel wand.
   9379 %
   9380 */
   9381 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
   9382   const PixelWand *border)
   9383 {
   9384   assert(wand != (MagickWand *) NULL);
   9385   assert(wand->signature == MagickWandSignature);
   9386   if (wand->debug != MagickFalse)
   9387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9388   if (wand->images == (Image *) NULL)
   9389     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9390   PixelGetQuantumPacket(border,&wand->images->border_color);
   9391   return(MagickTrue);
   9392 }
   9393 
   9394 /*
   9396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9397 %                                                                             %
   9398 %                                                                             %
   9399 %                                                                             %
   9400 %   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                         %
   9401 %                                                                             %
   9402 %                                                                             %
   9403 %                                                                             %
   9404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9405 %
   9406 %  MagickSetImageChannelMask() sets image channel mask.
   9407 %
   9408 %  The format of the MagickSetImageChannelMask method is:
   9409 %
   9410 %      ChannelType MagickSetImageChannelMask(MagickWand *wand,
   9411 %        const ChannelType channel_mask)
   9412 %
   9413 %  A description of each parameter follows:
   9414 %
   9415 %    o wand: the magick wand.
   9416 %
   9417 %    o channel_mask: the channel_mask wand.
   9418 %
   9419 */
   9420 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
   9421   const ChannelType channel_mask)
   9422 {
   9423   assert(wand != (MagickWand *) NULL);
   9424   assert(wand->signature == MagickWandSignature);
   9425   if (wand->debug != MagickFalse)
   9426     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9427   return(SetImageChannelMask(wand->images,channel_mask));
   9428 }
   9429 
   9430 /*
   9432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9433 %                                                                             %
   9434 %                                                                             %
   9435 %                                                                             %
   9436 %   M a g i c k S e t I m a g e M a s k                                       %
   9437 %                                                                             %
   9438 %                                                                             %
   9439 %                                                                             %
   9440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9441 %
   9442 %  MagickSetImageMask() sets image clip mask.
   9443 %
   9444 %  The format of the MagickSetImageMask method is:
   9445 %
   9446 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
   9447 %        const PixelMask type,const MagickWand *clip_mask)
   9448 %
   9449 %  A description of each parameter follows:
   9450 %
   9451 %    o wand: the magick wand.
   9452 %
   9453 %    o type: type of mask, ReadPixelMask or WritePixelMask.
   9454 %
   9455 %    o clip_mask: the clip_mask wand.
   9456 %
   9457 */
   9458 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
   9459   const PixelMask type,const MagickWand *clip_mask)
   9460 {
   9461   assert(wand != (MagickWand *) NULL);
   9462   assert(wand->signature == MagickWandSignature);
   9463   if (wand->debug != MagickFalse)
   9464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9465   assert(clip_mask != (MagickWand *) NULL);
   9466   assert(clip_mask->signature == MagickWandSignature);
   9467   if (clip_mask->debug != MagickFalse)
   9468     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
   9469   if (clip_mask->images == (Image *) NULL)
   9470     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
   9471   return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
   9472 }
   9473 
   9474 /*
   9476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9477 %                                                                             %
   9478 %                                                                             %
   9479 %                                                                             %
   9480 %   M a g i c k S e t I m a g e C o l o r                                     %
   9481 %                                                                             %
   9482 %                                                                             %
   9483 %                                                                             %
   9484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9485 %
   9486 %  MagickSetImageColor() set the entire wand canvas to the specified color.
   9487 %
   9488 %  The format of the MagickSetImageColor method is:
   9489 %
   9490 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
   9491 %        const PixelWand *color)
   9492 %
   9493 %  A description of each parameter follows:
   9494 %
   9495 %    o wand: the magick wand.
   9496 %
   9497 %    o background: the image color.
   9498 %
   9499 */
   9500 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
   9501   const PixelWand *color)
   9502 {
   9503   PixelInfo
   9504     pixel;
   9505 
   9506   assert(wand != (MagickWand *) NULL);
   9507   assert(wand->signature == MagickWandSignature);
   9508   if (wand->debug != MagickFalse)
   9509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9510   PixelGetMagickColor(color,&pixel);
   9511   return(SetImageColor(wand->images,&pixel,wand->exception));
   9512 }
   9513 
   9514 /*
   9516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9517 %                                                                             %
   9518 %                                                                             %
   9519 %                                                                             %
   9520 %   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                     %
   9521 %                                                                             %
   9522 %                                                                             %
   9523 %                                                                             %
   9524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9525 %
   9526 %  MagickSetImageColormapColor() sets the color of the specified colormap
   9527 %  index.
   9528 %
   9529 %  The format of the MagickSetImageColormapColor method is:
   9530 %
   9531 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
   9532 %        const size_t index,const PixelWand *color)
   9533 %
   9534 %  A description of each parameter follows:
   9535 %
   9536 %    o wand: the magick wand.
   9537 %
   9538 %    o index: the offset into the image colormap.
   9539 %
   9540 %    o color: Return the colormap color in this wand.
   9541 %
   9542 */
   9543 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
   9544   const size_t index,const PixelWand *color)
   9545 {
   9546   assert(wand != (MagickWand *) NULL);
   9547   assert(wand->signature == MagickWandSignature);
   9548   if (wand->debug != MagickFalse)
   9549     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9550   if (wand->images == (Image *) NULL)
   9551     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9552   if ((wand->images->colormap == (PixelInfo *) NULL) ||
   9553       (index >= wand->images->colors))
   9554     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
   9555   PixelGetQuantumPacket(color,wand->images->colormap+index);
   9556   return(SyncImage(wand->images,wand->exception));
   9557 }
   9558 
   9559 /*
   9561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9562 %                                                                             %
   9563 %                                                                             %
   9564 %                                                                             %
   9565 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
   9566 %                                                                             %
   9567 %                                                                             %
   9568 %                                                                             %
   9569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9570 %
   9571 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
   9572 %  the image data.
   9573 %
   9574 %  The format of the MagickSetImageColorspace method is:
   9575 %
   9576 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
   9577 %        const ColorspaceType colorspace)
   9578 %
   9579 %  A description of each parameter follows:
   9580 %
   9581 %    o wand: the magick wand.
   9582 %
   9583 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
   9584 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
   9585 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
   9586 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
   9587 %      HSLColorspace, or HWBColorspace.
   9588 %
   9589 */
   9590 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
   9591   const ColorspaceType colorspace)
   9592 {
   9593   assert(wand != (MagickWand *) NULL);
   9594   assert(wand->signature == MagickWandSignature);
   9595   if (wand->debug != MagickFalse)
   9596     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9597   if (wand->images == (Image *) NULL)
   9598     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9599   return(SetImageColorspace(wand->images,colorspace,wand->exception));
   9600 }
   9601 
   9602 /*
   9604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9605 %                                                                             %
   9606 %                                                                             %
   9607 %                                                                             %
   9608 %   M a g i c k S e t I m a g e C o m p o s e                                 %
   9609 %                                                                             %
   9610 %                                                                             %
   9611 %                                                                             %
   9612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9613 %
   9614 %  MagickSetImageCompose() sets the image composite operator, useful for
   9615 %  specifying how to composite the image thumbnail when using the
   9616 %  MagickMontageImage() method.
   9617 %
   9618 %  The format of the MagickSetImageCompose method is:
   9619 %
   9620 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
   9621 %        const CompositeOperator compose)
   9622 %
   9623 %  A description of each parameter follows:
   9624 %
   9625 %    o wand: the magick wand.
   9626 %
   9627 %    o compose: the image composite operator.
   9628 %
   9629 */
   9630 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
   9631   const CompositeOperator compose)
   9632 {
   9633   assert(wand != (MagickWand *) NULL);
   9634   assert(wand->signature == MagickWandSignature);
   9635   if (wand->debug != MagickFalse)
   9636     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9637   if (wand->images == (Image *) NULL)
   9638     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9639   wand->images->compose=compose;
   9640   return(MagickTrue);
   9641 }
   9642 
   9643 /*
   9645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9646 %                                                                             %
   9647 %                                                                             %
   9648 %                                                                             %
   9649 %   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                         %
   9650 %                                                                             %
   9651 %                                                                             %
   9652 %                                                                             %
   9653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9654 %
   9655 %  MagickSetImageCompression() sets the image compression.
   9656 %
   9657 %  The format of the MagickSetImageCompression method is:
   9658 %
   9659 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
   9660 %        const CompressionType compression)
   9661 %
   9662 %  A description of each parameter follows:
   9663 %
   9664 %    o wand: the magick wand.
   9665 %
   9666 %    o compression: the image compression type.
   9667 %
   9668 */
   9669 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
   9670   const CompressionType compression)
   9671 {
   9672   assert(wand != (MagickWand *) NULL);
   9673   assert(wand->signature == MagickWandSignature);
   9674   if (wand->debug != MagickFalse)
   9675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9676   if (wand->images == (Image *) NULL)
   9677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9678   wand->images->compression=compression;
   9679   return(MagickTrue);
   9680 }
   9681 
   9682 /*
   9684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9685 %                                                                             %
   9686 %                                                                             %
   9687 %                                                                             %
   9688 %   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           %
   9689 %                                                                             %
   9690 %                                                                             %
   9691 %                                                                             %
   9692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9693 %
   9694 %  MagickSetImageCompressionQuality() sets the image compression quality.
   9695 %
   9696 %  The format of the MagickSetImageCompressionQuality method is:
   9697 %
   9698 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
   9699 %        const size_t quality)
   9700 %
   9701 %  A description of each parameter follows:
   9702 %
   9703 %    o wand: the magick wand.
   9704 %
   9705 %    o quality: the image compression tlityype.
   9706 %
   9707 */
   9708 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
   9709   const size_t quality)
   9710 {
   9711   assert(wand != (MagickWand *) NULL);
   9712   assert(wand->signature == MagickWandSignature);
   9713   if (wand->debug != MagickFalse)
   9714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9715   if (wand->images == (Image *) NULL)
   9716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9717   wand->images->quality=quality;
   9718   return(MagickTrue);
   9719 }
   9720 
   9721 /*
   9723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9724 %                                                                             %
   9725 %                                                                             %
   9726 %                                                                             %
   9727 %   M a g i c k S e t I m a g e D e l a y                                     %
   9728 %                                                                             %
   9729 %                                                                             %
   9730 %                                                                             %
   9731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9732 %
   9733 %  MagickSetImageDelay() sets the image delay.
   9734 %
   9735 %  The format of the MagickSetImageDelay method is:
   9736 %
   9737 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
   9738 %        const size_t delay)
   9739 %
   9740 %  A description of each parameter follows:
   9741 %
   9742 %    o wand: the magick wand.
   9743 %
   9744 %    o delay: the image delay in ticks-per-second units.
   9745 %
   9746 */
   9747 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
   9748   const size_t delay)
   9749 {
   9750   assert(wand != (MagickWand *) NULL);
   9751   assert(wand->signature == MagickWandSignature);
   9752   if (wand->debug != MagickFalse)
   9753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9754   if (wand->images == (Image *) NULL)
   9755     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9756   wand->images->delay=delay;
   9757   return(MagickTrue);
   9758 }
   9759 
   9760 /*
   9762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9763 %                                                                             %
   9764 %                                                                             %
   9765 %                                                                             %
   9766 %   M a g i c k S e t I m a g e D e p t h                                     %
   9767 %                                                                             %
   9768 %                                                                             %
   9769 %                                                                             %
   9770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9771 %
   9772 %  MagickSetImageDepth() sets the image depth.
   9773 %
   9774 %  The format of the MagickSetImageDepth method is:
   9775 %
   9776 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
   9777 %        const size_t depth)
   9778 %
   9779 %  A description of each parameter follows:
   9780 %
   9781 %    o wand: the magick wand.
   9782 %
   9783 %    o depth: the image depth in bits: 8, 16, or 32.
   9784 %
   9785 */
   9786 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
   9787   const size_t depth)
   9788 {
   9789   assert(wand != (MagickWand *) NULL);
   9790   assert(wand->signature == MagickWandSignature);
   9791   if (wand->debug != MagickFalse)
   9792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9793   if (wand->images == (Image *) NULL)
   9794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9795   return(SetImageDepth(wand->images,depth,wand->exception));
   9796 }
   9797 
   9798 /*
   9800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9801 %                                                                             %
   9802 %                                                                             %
   9803 %                                                                             %
   9804 %   M a g i c k S e t I m a g e D i s p o s e                                 %
   9805 %                                                                             %
   9806 %                                                                             %
   9807 %                                                                             %
   9808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9809 %
   9810 %  MagickSetImageDispose() sets the image disposal method.
   9811 %
   9812 %  The format of the MagickSetImageDispose method is:
   9813 %
   9814 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
   9815 %        const DisposeType dispose)
   9816 %
   9817 %  A description of each parameter follows:
   9818 %
   9819 %    o wand: the magick wand.
   9820 %
   9821 %    o dispose: the image disposeal type.
   9822 %
   9823 */
   9824 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
   9825   const DisposeType dispose)
   9826 {
   9827   assert(wand != (MagickWand *) NULL);
   9828   assert(wand->signature == MagickWandSignature);
   9829   if (wand->debug != MagickFalse)
   9830     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9831   if (wand->images == (Image *) NULL)
   9832     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9833   wand->images->dispose=dispose;
   9834   return(MagickTrue);
   9835 }
   9836 
   9837 /*
   9839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9840 %                                                                             %
   9841 %                                                                             %
   9842 %                                                                             %
   9843 %   M a g i c k S e t I m a g e E n d i a n                                   %
   9844 %                                                                             %
   9845 %                                                                             %
   9846 %                                                                             %
   9847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9848 %
   9849 %  MagickSetImageEndian() sets the image endian method.
   9850 %
   9851 %  The format of the MagickSetImageEndian method is:
   9852 %
   9853 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
   9854 %        const EndianType endian)
   9855 %
   9856 %  A description of each parameter follows:
   9857 %
   9858 %    o wand: the magick wand.
   9859 %
   9860 %    o endian: the image endian type.
   9861 %
   9862 */
   9863 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
   9864   const EndianType endian)
   9865 {
   9866   assert(wand != (MagickWand *) NULL);
   9867   assert(wand->signature == MagickWandSignature);
   9868   if (wand->debug != MagickFalse)
   9869     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9870   if (wand->images == (Image *) NULL)
   9871     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9872   wand->images->endian=endian;
   9873   return(MagickTrue);
   9874 }
   9875 
   9876 /*
   9878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9879 %                                                                             %
   9880 %                                                                             %
   9881 %                                                                             %
   9882 %   M a g i c k S e t I m a g e E x t e n t                                   %
   9883 %                                                                             %
   9884 %                                                                             %
   9885 %                                                                             %
   9886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9887 %
   9888 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
   9889 %
   9890 %  The format of the MagickSetImageExtent method is:
   9891 %
   9892 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
   9893 %        const size_t columns,const unsigned rows)
   9894 %
   9895 %  A description of each parameter follows:
   9896 %
   9897 %    o wand: the magick wand.
   9898 %
   9899 %    o columns:  The image width in pixels.
   9900 %
   9901 %    o rows:  The image height in pixels.
   9902 %
   9903 */
   9904 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
   9905   const size_t columns,const size_t rows)
   9906 {
   9907   assert(wand != (MagickWand *) NULL);
   9908   assert(wand->signature == MagickWandSignature);
   9909   if (wand->debug != MagickFalse)
   9910     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9911   if (wand->images == (Image *) NULL)
   9912     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9913   return(SetImageExtent(wand->images,columns,rows,wand->exception));
   9914 }
   9915 
   9916 /*
   9918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9919 %                                                                             %
   9920 %                                                                             %
   9921 %                                                                             %
   9922 %   M a g i c k S e t I m a g e F i l e n a m e                               %
   9923 %                                                                             %
   9924 %                                                                             %
   9925 %                                                                             %
   9926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9927 %
   9928 %  MagickSetImageFilename() sets the filename of a particular image in a
   9929 %  sequence.
   9930 %
   9931 %  The format of the MagickSetImageFilename method is:
   9932 %
   9933 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
   9934 %        const char *filename)
   9935 %
   9936 %  A description of each parameter follows:
   9937 %
   9938 %    o wand: the magick wand.
   9939 %
   9940 %    o filename: the image filename.
   9941 %
   9942 */
   9943 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
   9944   const char *filename)
   9945 {
   9946   assert(wand != (MagickWand *) NULL);
   9947   assert(wand->signature == MagickWandSignature);
   9948   if (wand->debug != MagickFalse)
   9949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9950   if (wand->images == (Image *) NULL)
   9951     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9952   if (filename != (const char *) NULL)
   9953     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
   9954   return(MagickTrue);
   9955 }
   9956 
   9957 /*
   9959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9960 %                                                                             %
   9961 %                                                                             %
   9962 %                                                                             %
   9963 %   M a g i c k S e t I m a g e F o r m a t                                   %
   9964 %                                                                             %
   9965 %                                                                             %
   9966 %                                                                             %
   9967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   9968 %
   9969 %  MagickSetImageFormat() sets the format of a particular image in a
   9970 %  sequence.
   9971 %
   9972 %  The format of the MagickSetImageFormat method is:
   9973 %
   9974 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
   9975 %        const char *format)
   9976 %
   9977 %  A description of each parameter follows:
   9978 %
   9979 %    o wand: the magick wand.
   9980 %
   9981 %    o format: the image format.
   9982 %
   9983 */
   9984 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
   9985   const char *format)
   9986 {
   9987   const MagickInfo
   9988     *magick_info;
   9989 
   9990   assert(wand != (MagickWand *) NULL);
   9991   assert(wand->signature == MagickWandSignature);
   9992   if (wand->debug != MagickFalse)
   9993     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   9994   if (wand->images == (Image *) NULL)
   9995     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   9996   if ((format == (char *) NULL) || (*format == '\0'))
   9997     {
   9998       *wand->images->magick='\0';
   9999       return(MagickTrue);
   10000     }
   10001   magick_info=GetMagickInfo(format,wand->exception);
   10002   if (magick_info == (const MagickInfo *) NULL)
   10003     return(MagickFalse);
   10004   ClearMagickException(wand->exception);
   10005   (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
   10006   return(MagickTrue);
   10007 }
   10008 
   10009 /*
   10011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10012 %                                                                             %
   10013 %                                                                             %
   10014 %                                                                             %
   10015 %   M a g i c k S e t I m a g e F u z z                                       %
   10016 %                                                                             %
   10017 %                                                                             %
   10018 %                                                                             %
   10019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10020 %
   10021 %  MagickSetImageFuzz() sets the image fuzz.
   10022 %
   10023 %  The format of the MagickSetImageFuzz method is:
   10024 %
   10025 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
   10026 %        const double fuzz)
   10027 %
   10028 %  A description of each parameter follows:
   10029 %
   10030 %    o wand: the magick wand.
   10031 %
   10032 %    o fuzz: the image fuzz.
   10033 %
   10034 */
   10035 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
   10036   const double fuzz)
   10037 {
   10038   assert(wand != (MagickWand *) NULL);
   10039   assert(wand->signature == MagickWandSignature);
   10040   if (wand->debug != MagickFalse)
   10041     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10042   if (wand->images == (Image *) NULL)
   10043     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10044   wand->images->fuzz=fuzz;
   10045   return(MagickTrue);
   10046 }
   10047 
   10048 /*
   10050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10051 %                                                                             %
   10052 %                                                                             %
   10053 %                                                                             %
   10054 %   M a g i c k S e t I m a g e G a m m a                                     %
   10055 %                                                                             %
   10056 %                                                                             %
   10057 %                                                                             %
   10058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10059 %
   10060 %  MagickSetImageGamma() sets the image gamma.
   10061 %
   10062 %  The format of the MagickSetImageGamma method is:
   10063 %
   10064 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
   10065 %        const double gamma)
   10066 %
   10067 %  A description of each parameter follows:
   10068 %
   10069 %    o wand: the magick wand.
   10070 %
   10071 %    o gamma: the image gamma.
   10072 %
   10073 */
   10074 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
   10075   const double gamma)
   10076 {
   10077   assert(wand != (MagickWand *) NULL);
   10078   assert(wand->signature == MagickWandSignature);
   10079   if (wand->debug != MagickFalse)
   10080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10081   if (wand->images == (Image *) NULL)
   10082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10083   wand->images->gamma=gamma;
   10084   return(MagickTrue);
   10085 }
   10086 
   10087 /*
   10089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10090 %                                                                             %
   10091 %                                                                             %
   10092 %                                                                             %
   10093 %   M a g i c k S e t I m a g e G r a v i t y                                 %
   10094 %                                                                             %
   10095 %                                                                             %
   10096 %                                                                             %
   10097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10098 %
   10099 %  MagickSetImageGravity() sets the image gravity type.
   10100 %
   10101 %  The format of the MagickSetImageGravity method is:
   10102 %
   10103 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
   10104 %        const GravityType gravity)
   10105 %
   10106 %  A description of each parameter follows:
   10107 %
   10108 %    o wand: the magick wand.
   10109 %
   10110 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
   10111 %               NorthEastGravity, WestGravity, CenterGravity,
   10112 %               EastGravity, SouthWestGravity, SouthGravity,
   10113 %               SouthEastGravity)
   10114 %
   10115 */
   10116 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
   10117   const GravityType gravity)
   10118 {
   10119   assert(wand != (MagickWand *) NULL);
   10120   assert(wand->signature == MagickWandSignature);
   10121   if (wand->debug != MagickFalse)
   10122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10123   if (wand->images == (Image *) NULL)
   10124     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10125   wand->images->gravity=gravity;
   10126   return(MagickTrue);
   10127 }
   10128 
   10129 /*
   10131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10132 %                                                                             %
   10133 %                                                                             %
   10134 %                                                                             %
   10135 %   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                       %
   10136 %                                                                             %
   10137 %                                                                             %
   10138 %                                                                             %
   10139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10140 %
   10141 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
   10142 %  point.
   10143 %
   10144 %  The format of the MagickSetImageGreenPrimary method is:
   10145 %
   10146 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
   10147 %        const double x,const double y,const double z)
   10148 %
   10149 %  A description of each parameter follows:
   10150 %
   10151 %    o wand: the magick wand.
   10152 %
   10153 %    o x: the green primary x-point.
   10154 %
   10155 %    o y: the green primary y-point.
   10156 %
   10157 %    o z: the green primary z-point.
   10158 %
   10159 */
   10160 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
   10161   const double x,const double y,const double z)
   10162 {
   10163   assert(wand != (MagickWand *) NULL);
   10164   assert(wand->signature == MagickWandSignature);
   10165   if (wand->debug != MagickFalse)
   10166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10167   if (wand->images == (Image *) NULL)
   10168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10169   wand->images->chromaticity.green_primary.x=x;
   10170   wand->images->chromaticity.green_primary.y=y;
   10171   wand->images->chromaticity.green_primary.z=z;
   10172   return(MagickTrue);
   10173 }
   10174 
   10175 /*
   10177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10178 %                                                                             %
   10179 %                                                                             %
   10180 %                                                                             %
   10181 %   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                 %
   10182 %                                                                             %
   10183 %                                                                             %
   10184 %                                                                             %
   10185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10186 %
   10187 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
   10188 %
   10189 %  The format of the MagickSetImageInterlaceScheme method is:
   10190 %
   10191 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
   10192 %        const InterlaceType interlace)
   10193 %
   10194 %  A description of each parameter follows:
   10195 %
   10196 %    o wand: the magick wand.
   10197 %
   10198 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
   10199 %      PlaneInterlace, PartitionInterlace.
   10200 %
   10201 */
   10202 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
   10203   const InterlaceType interlace)
   10204 {
   10205   assert(wand != (MagickWand *) NULL);
   10206   assert(wand->signature == MagickWandSignature);
   10207   if (wand->debug != MagickFalse)
   10208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10209   if (wand->images == (Image *) NULL)
   10210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10211   wand->images->interlace=interlace;
   10212   return(MagickTrue);
   10213 }
   10214 
   10215 /*
   10217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10218 %                                                                             %
   10219 %                                                                             %
   10220 %                                                                             %
   10221 %   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             %
   10222 %                                                                             %
   10223 %                                                                             %
   10224 %                                                                             %
   10225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10226 %
   10227 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
   10228 %
   10229 %  The format of the MagickSetImageInterpolateMethod method is:
   10230 %
   10231 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
   10232 %        const PixelInterpolateMethod method)
   10233 %
   10234 %  A description of each parameter follows:
   10235 %
   10236 %    o wand: the magick wand.
   10237 %
   10238 %    o method: the image interpole pixel methods: choose from Undefined,
   10239 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
   10240 %
   10241 */
   10242 
   10243 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
   10244   MagickWand *wand,const PixelInterpolateMethod method)
   10245 {
   10246   return(MagickSetImageInterpolateMethod(wand,method));
   10247 }
   10248 
   10249 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
   10250   MagickWand *wand,const PixelInterpolateMethod method)
   10251 {
   10252   assert(wand != (MagickWand *) NULL);
   10253   assert(wand->signature == MagickWandSignature);
   10254   if (wand->debug != MagickFalse)
   10255     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10256   if (wand->images == (Image *) NULL)
   10257     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10258   wand->images->interpolate=method;
   10259   return(MagickTrue);
   10260 }
   10261 
   10262 /*
   10264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10265 %                                                                             %
   10266 %                                                                             %
   10267 %                                                                             %
   10268 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
   10269 %                                                                             %
   10270 %                                                                             %
   10271 %                                                                             %
   10272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10273 %
   10274 %  MagickSetImageIterations() sets the image iterations.
   10275 %
   10276 %  The format of the MagickSetImageIterations method is:
   10277 %
   10278 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
   10279 %        const size_t iterations)
   10280 %
   10281 %  A description of each parameter follows:
   10282 %
   10283 %    o wand: the magick wand.
   10284 %
   10285 %    o delay: the image delay in 1/100th of a second.
   10286 %
   10287 */
   10288 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
   10289   const size_t iterations)
   10290 {
   10291   assert(wand != (MagickWand *) NULL);
   10292   assert(wand->signature == MagickWandSignature);
   10293   if (wand->debug != MagickFalse)
   10294     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10295   if (wand->images == (Image *) NULL)
   10296     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10297   wand->images->iterations=iterations;
   10298   return(MagickTrue);
   10299 }
   10300 
   10301 /*
   10303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10304 %                                                                             %
   10305 %                                                                             %
   10306 %                                                                             %
   10307 %   M a g i c k S e t I m a g e M a t t e                                     %
   10308 %                                                                             %
   10309 %                                                                             %
   10310 %                                                                             %
   10311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10312 %
   10313 %  MagickSetImageMatte() sets the image matte channel.
   10314 %
   10315 %  The format of the MagickSetImageMatte method is:
   10316 %
   10317 %      MagickBooleanType MagickSetImageMatte(MagickWand *wand,
   10318 %        const MagickBooleanType *matte)
   10319 %
   10320 %  A description of each parameter follows:
   10321 %
   10322 %    o wand: the magick wand.
   10323 %
   10324 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
   10325 %      MagickFalse.
   10326 %
   10327 */
   10328 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
   10329   const MagickBooleanType matte)
   10330 {
   10331   assert(wand != (MagickWand *) NULL);
   10332   assert(wand->signature == MagickWandSignature);
   10333   if (wand->debug != MagickFalse)
   10334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10335   if (wand->images == (Image *) NULL)
   10336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10337   if (matte == MagickFalse)
   10338     wand->images->alpha_trait=UndefinedPixelTrait;
   10339   else
   10340     {
   10341       if (wand->images->alpha_trait == UndefinedPixelTrait)
   10342         (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
   10343       wand->images->alpha_trait=BlendPixelTrait;
   10344     }
   10345   return(MagickTrue);
   10346 }
   10347 
   10348 /*
   10350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10351 %                                                                             %
   10352 %                                                                             %
   10353 %                                                                             %
   10354 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
   10355 %                                                                             %
   10356 %                                                                             %
   10357 %                                                                             %
   10358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10359 %
   10360 %  MagickSetImageMatteColor() sets the image alpha color.
   10361 %
   10362 %  The format of the MagickSetImageMatteColor method is:
   10363 %
   10364 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
   10365 %        const PixelWand *matte)
   10366 %
   10367 %  A description of each parameter follows:
   10368 %
   10369 %    o wand: the magick wand.
   10370 %
   10371 %    o matte: the alpha pixel wand.
   10372 %
   10373 */
   10374 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
   10375   const PixelWand *alpha)
   10376 {
   10377   assert(wand != (MagickWand *)NULL);
   10378   assert(wand->signature == MagickWandSignature);
   10379   if (wand->debug != MagickFalse)
   10380     (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
   10381   if (wand->images == (Image *)NULL)
   10382     ThrowWandException(WandError, "ContainsNoImages", wand->name);
   10383   PixelGetQuantumPacket(alpha,&wand->images->matte_color);
   10384   return(MagickTrue);
   10385 }
   10386 
   10387 /*
   10389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10390 %                                                                             %
   10391 %                                                                             %
   10392 %                                                                             %
   10393 %   M a g i c k S e t I m a g e O p a c i t y                                 %
   10394 %                                                                             %
   10395 %                                                                             %
   10396 %                                                                             %
   10397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10398 %
   10399 %  MagickSetImageAlpha() sets the image to the specified alpha level.
   10400 %
   10401 %  The format of the MagickSetImageAlpha method is:
   10402 %
   10403 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
   10404 %        const double alpha)
   10405 %
   10406 %  A description of each parameter follows:
   10407 %
   10408 %    o wand: the magick wand.
   10409 %
   10410 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
   10411 %      transparent.
   10412 %
   10413 */
   10414 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
   10415   const double alpha)
   10416 {
   10417   MagickBooleanType
   10418     status;
   10419 
   10420   assert(wand != (MagickWand *) NULL);
   10421   assert(wand->signature == MagickWandSignature);
   10422   if (wand->debug != MagickFalse)
   10423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10424   if (wand->images == (Image *) NULL)
   10425     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10426   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
   10427     wand->exception);
   10428   return(status);
   10429 }
   10430 
   10431 /*
   10433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10434 %                                                                             %
   10435 %                                                                             %
   10436 %                                                                             %
   10437 %   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                         %
   10438 %                                                                             %
   10439 %                                                                             %
   10440 %                                                                             %
   10441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10442 %
   10443 %  MagickSetImageOrientation() sets the image orientation.
   10444 %
   10445 %  The format of the MagickSetImageOrientation method is:
   10446 %
   10447 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
   10448 %        const OrientationType orientation)
   10449 %
   10450 %  A description of each parameter follows:
   10451 %
   10452 %    o wand: the magick wand.
   10453 %
   10454 %    o orientation: the image orientation type.
   10455 %
   10456 */
   10457 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
   10458   const OrientationType orientation)
   10459 {
   10460   assert(wand != (MagickWand *) NULL);
   10461   assert(wand->signature == MagickWandSignature);
   10462   if (wand->debug != MagickFalse)
   10463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10464   if (wand->images == (Image *) NULL)
   10465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10466   wand->images->orientation=orientation;
   10467   return(MagickTrue);
   10468 }
   10469 
   10470 /*
   10472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10473 %                                                                             %
   10474 %                                                                             %
   10475 %                                                                             %
   10476 %   M a g i c k S e t I m a g e P a g e                                       %
   10477 %                                                                             %
   10478 %                                                                             %
   10479 %                                                                             %
   10480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10481 %
   10482 %  MagickSetImagePage() sets the page geometry of the image.
   10483 %
   10484 %  The format of the MagickSetImagePage method is:
   10485 %
   10486 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
   10487 %
   10488 %  A description of each parameter follows:
   10489 %
   10490 %    o wand: the magick wand.
   10491 %
   10492 %    o width: the page width.
   10493 %
   10494 %    o height: the page height.
   10495 %
   10496 %    o x: the page x-offset.
   10497 %
   10498 %    o y: the page y-offset.
   10499 %
   10500 */
   10501 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
   10502   const size_t width,const size_t height,const ssize_t x,
   10503   const ssize_t y)
   10504 {
   10505   assert(wand != (MagickWand *) NULL);
   10506   assert(wand->signature == MagickWandSignature);
   10507   if (wand->debug != MagickFalse)
   10508     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10509   if (wand->images == (Image *) NULL)
   10510     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10511   wand->images->page.width=width;
   10512   wand->images->page.height=height;
   10513   wand->images->page.x=x;
   10514   wand->images->page.y=y;
   10515   return(MagickTrue);
   10516 }
   10517 
   10518 /*
   10520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10521 %                                                                             %
   10522 %                                                                             %
   10523 %                                                                             %
   10524 %   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                 %
   10525 %                                                                             %
   10526 %                                                                             %
   10527 %                                                                             %
   10528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10529 %
   10530 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
   10531 %  specified method and returns the previous progress monitor if any.  The
   10532 %  progress monitor method looks like this:
   10533 %
   10534 %    MagickBooleanType MagickProgressMonitor(const char *text,
   10535 %      const MagickOffsetType offset,const MagickSizeType span,
   10536 %      void *client_data)
   10537 %
   10538 %  If the progress monitor returns MagickFalse, the current operation is
   10539 %  interrupted.
   10540 %
   10541 %  The format of the MagickSetImageProgressMonitor method is:
   10542 %
   10543 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
   10544 %        const MagickProgressMonitor progress_monitor,void *client_data)
   10545 %
   10546 %  A description of each parameter follows:
   10547 %
   10548 %    o wand: the magick wand.
   10549 %
   10550 %    o progress_monitor: Specifies a pointer to a method to monitor progress
   10551 %      of an image operation.
   10552 %
   10553 %    o client_data: Specifies a pointer to any client data.
   10554 %
   10555 */
   10556 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
   10557   const MagickProgressMonitor progress_monitor,void *client_data)
   10558 {
   10559   MagickProgressMonitor
   10560     previous_monitor;
   10561 
   10562   assert(wand != (MagickWand *) NULL);
   10563   assert(wand->signature == MagickWandSignature);
   10564   if (wand->debug != MagickFalse)
   10565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10566   if (wand->images == (Image *) NULL)
   10567     {
   10568       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   10569         "ContainsNoImages","`%s'",wand->name);
   10570       return((MagickProgressMonitor) NULL);
   10571     }
   10572   previous_monitor=SetImageProgressMonitor(wand->images,
   10573     progress_monitor,client_data);
   10574   return(previous_monitor);
   10575 }
   10576 
   10577 /*
   10579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10580 %                                                                             %
   10581 %                                                                             %
   10582 %                                                                             %
   10583 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
   10584 %                                                                             %
   10585 %                                                                             %
   10586 %                                                                             %
   10587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10588 %
   10589 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
   10590 %
   10591 %  The format of the MagickSetImageRedPrimary method is:
   10592 %
   10593 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
   10594 %        const double x,const double y,const double z)
   10595 %
   10596 %  A description of each parameter follows:
   10597 %
   10598 %    o wand: the magick wand.
   10599 %
   10600 %    o x: the red primary x-point.
   10601 %
   10602 %    o y: the red primary y-point.
   10603 %
   10604 %    o z: the red primary z-point.
   10605 %
   10606 */
   10607 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
   10608   const double x,const double y,const double z)
   10609 {
   10610   assert(wand != (MagickWand *) NULL);
   10611   assert(wand->signature == MagickWandSignature);
   10612   if (wand->debug != MagickFalse)
   10613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10614   if (wand->images == (Image *) NULL)
   10615     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10616   wand->images->chromaticity.red_primary.x=x;
   10617   wand->images->chromaticity.red_primary.y=y;
   10618   wand->images->chromaticity.red_primary.z=z;
   10619   return(MagickTrue);
   10620 }
   10621 
   10622 /*
   10624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10625 %                                                                             %
   10626 %                                                                             %
   10627 %                                                                             %
   10628 %   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                 %
   10629 %                                                                             %
   10630 %                                                                             %
   10631 %                                                                             %
   10632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10633 %
   10634 %  MagickSetImageRenderingIntent() sets the image rendering intent.
   10635 %
   10636 %  The format of the MagickSetImageRenderingIntent method is:
   10637 %
   10638 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
   10639 %        const RenderingIntent rendering_intent)
   10640 %
   10641 %  A description of each parameter follows:
   10642 %
   10643 %    o wand: the magick wand.
   10644 %
   10645 %    o rendering_intent: the image rendering intent: UndefinedIntent,
   10646 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
   10647 %
   10648 */
   10649 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
   10650   const RenderingIntent rendering_intent)
   10651 {
   10652   assert(wand != (MagickWand *) NULL);
   10653   assert(wand->signature == MagickWandSignature);
   10654   if (wand->debug != MagickFalse)
   10655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10656   if (wand->images == (Image *) NULL)
   10657     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10658   wand->images->rendering_intent=rendering_intent;
   10659   return(MagickTrue);
   10660 }
   10661 
   10662 /*
   10664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10665 %                                                                             %
   10666 %                                                                             %
   10667 %                                                                             %
   10668 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
   10669 %                                                                             %
   10670 %                                                                             %
   10671 %                                                                             %
   10672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10673 %
   10674 %  MagickSetImageResolution() sets the image resolution.
   10675 %
   10676 %  The format of the MagickSetImageResolution method is:
   10677 %
   10678 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
   10679 %        const double x_resolution,const double y_resolution)
   10680 %
   10681 %  A description of each parameter follows:
   10682 %
   10683 %    o wand: the magick wand.
   10684 %
   10685 %    o x_resolution: the image x resolution.
   10686 %
   10687 %    o y_resolution: the image y resolution.
   10688 %
   10689 */
   10690 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
   10691   const double x_resolution,const double y_resolution)
   10692 {
   10693   assert(wand != (MagickWand *) NULL);
   10694   assert(wand->signature == MagickWandSignature);
   10695   if (wand->debug != MagickFalse)
   10696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10697   if (wand->images == (Image *) NULL)
   10698     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10699   wand->images->resolution.x=x_resolution;
   10700   wand->images->resolution.y=y_resolution;
   10701   return(MagickTrue);
   10702 }
   10703 
   10704 /*
   10706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10707 %                                                                             %
   10708 %                                                                             %
   10709 %                                                                             %
   10710 %   M a g i c k S e t I m a g e S c e n e                                     %
   10711 %                                                                             %
   10712 %                                                                             %
   10713 %                                                                             %
   10714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10715 %
   10716 %  MagickSetImageScene() sets the image scene.
   10717 %
   10718 %  The format of the MagickSetImageScene method is:
   10719 %
   10720 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
   10721 %        const size_t scene)
   10722 %
   10723 %  A description of each parameter follows:
   10724 %
   10725 %    o wand: the magick wand.
   10726 %
   10727 %    o delay: the image scene number.
   10728 %
   10729 */
   10730 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
   10731   const size_t scene)
   10732 {
   10733   assert(wand != (MagickWand *) NULL);
   10734   assert(wand->signature == MagickWandSignature);
   10735   if (wand->debug != MagickFalse)
   10736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10737   if (wand->images == (Image *) NULL)
   10738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10739   wand->images->scene=scene;
   10740   return(MagickTrue);
   10741 }
   10742 
   10743 /*
   10745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10746 %                                                                             %
   10747 %                                                                             %
   10748 %                                                                             %
   10749 %   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                   %
   10750 %                                                                             %
   10751 %                                                                             %
   10752 %                                                                             %
   10753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10754 %
   10755 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
   10756 %
   10757 %  The format of the MagickSetImageTicksPerSecond method is:
   10758 %
   10759 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
   10760 %        const ssize_t ticks_per-second)
   10761 %
   10762 %  A description of each parameter follows:
   10763 %
   10764 %    o wand: the magick wand.
   10765 %
   10766 %    o ticks_per_second: the units to use for the image delay.
   10767 %
   10768 */
   10769 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
   10770   const ssize_t ticks_per_second)
   10771 {
   10772   assert(wand != (MagickWand *) NULL);
   10773   assert(wand->signature == MagickWandSignature);
   10774   if (wand->debug != MagickFalse)
   10775     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10776   if (wand->images == (Image *) NULL)
   10777     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10778   wand->images->ticks_per_second=ticks_per_second;
   10779   return(MagickTrue);
   10780 }
   10781 
   10782 /*
   10784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10785 %                                                                             %
   10786 %                                                                             %
   10787 %                                                                             %
   10788 %   M a g i c k S e t I m a g e T y p e                                       %
   10789 %                                                                             %
   10790 %                                                                             %
   10791 %                                                                             %
   10792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10793 %
   10794 %  MagickSetImageType() sets the image type.
   10795 %
   10796 %  The format of the MagickSetImageType method is:
   10797 %
   10798 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
   10799 %        const ImageType image_type)
   10800 %
   10801 %  A description of each parameter follows:
   10802 %
   10803 %    o wand: the magick wand.
   10804 %
   10805 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
   10806 %      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
   10807 %      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
   10808 %      or OptimizeType.
   10809 %
   10810 */
   10811 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
   10812   const ImageType image_type)
   10813 {
   10814   assert(wand != (MagickWand *) NULL);
   10815   assert(wand->signature == MagickWandSignature);
   10816   if (wand->debug != MagickFalse)
   10817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10818   if (wand->images == (Image *) NULL)
   10819     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10820   return(SetImageType(wand->images,image_type,wand->exception));
   10821 }
   10822 
   10823 /*
   10825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10826 %                                                                             %
   10827 %                                                                             %
   10828 %                                                                             %
   10829 %   M a g i c k S e t I m a g e U n i t s                                     %
   10830 %                                                                             %
   10831 %                                                                             %
   10832 %                                                                             %
   10833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10834 %
   10835 %  MagickSetImageUnits() sets the image units of resolution.
   10836 %
   10837 %  The format of the MagickSetImageUnits method is:
   10838 %
   10839 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
   10840 %        const ResolutionType units)
   10841 %
   10842 %  A description of each parameter follows:
   10843 %
   10844 %    o wand: the magick wand.
   10845 %
   10846 %    o units: the image units of resolution : UndefinedResolution,
   10847 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
   10848 %
   10849 */
   10850 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
   10851   const ResolutionType units)
   10852 {
   10853   assert(wand != (MagickWand *) NULL);
   10854   assert(wand->signature == MagickWandSignature);
   10855   if (wand->debug != MagickFalse)
   10856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10857   if (wand->images == (Image *) NULL)
   10858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10859   wand->images->units=units;
   10860   return(MagickTrue);
   10861 }
   10862 
   10863 /*
   10865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10866 %                                                                             %
   10867 %                                                                             %
   10868 %                                                                             %
   10869 %   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           %
   10870 %                                                                             %
   10871 %                                                                             %
   10872 %                                                                             %
   10873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10874 %
   10875 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
   10876 %
   10877 %  The format of the MagickSetImageVirtualPixelMethod method is:
   10878 %
   10879 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
   10880 %        const VirtualPixelMethod method)
   10881 %
   10882 %  A description of each parameter follows:
   10883 %
   10884 %    o wand: the magick wand.
   10885 %
   10886 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
   10887 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
   10888 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
   10889 %
   10890 */
   10891 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
   10892   const VirtualPixelMethod method)
   10893 {
   10894   assert(wand != (MagickWand *) NULL);
   10895   assert(wand->signature == MagickWandSignature);
   10896   if (wand->debug != MagickFalse)
   10897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10898   if (wand->images == (Image *) NULL)
   10899     return(UndefinedVirtualPixelMethod);
   10900   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
   10901 }
   10902 
   10903 /*
   10905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10906 %                                                                             %
   10907 %                                                                             %
   10908 %                                                                             %
   10909 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
   10910 %                                                                             %
   10911 %                                                                             %
   10912 %                                                                             %
   10913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10914 %
   10915 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
   10916 %
   10917 %  The format of the MagickSetImageWhitePoint method is:
   10918 %
   10919 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
   10920 %        const double x,const double y,const double z)
   10921 %
   10922 %  A description of each parameter follows:
   10923 %
   10924 %    o wand: the magick wand.
   10925 %
   10926 %    o x: the white x-point.
   10927 %
   10928 %    o y: the white y-point.
   10929 %
   10930 %    o z: the white z-point.
   10931 %
   10932 */
   10933 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
   10934   const double x,const double y,const double z)
   10935 {
   10936   assert(wand != (MagickWand *) NULL);
   10937   assert(wand->signature == MagickWandSignature);
   10938   if (wand->debug != MagickFalse)
   10939     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10940   if (wand->images == (Image *) NULL)
   10941     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10942   wand->images->chromaticity.white_point.x=x;
   10943   wand->images->chromaticity.white_point.y=y;
   10944   wand->images->chromaticity.white_point.z=z;
   10945   return(MagickTrue);
   10946 }
   10947 
   10948 /*
   10950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10951 %                                                                             %
   10952 %                                                                             %
   10953 %                                                                             %
   10954 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
   10955 %                                                                             %
   10956 %                                                                             %
   10957 %                                                                             %
   10958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10959 %
   10960 %  MagickShadeImage() shines a distant light on an image to create a
   10961 %  three-dimensional effect. You control the positioning of the light with
   10962 %  azimuth and elevation; azimuth is measured in degrees off the x axis
   10963 %  and elevation is measured in pixels above the Z axis.
   10964 %
   10965 %  The format of the MagickShadeImage method is:
   10966 %
   10967 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
   10968 %        const MagickBooleanType gray,const double azimuth,
   10969 %        const double elevation)
   10970 %
   10971 %  A description of each parameter follows:
   10972 %
   10973 %    o wand: the magick wand.
   10974 %
   10975 %    o gray: A value other than zero shades the intensity of each pixel.
   10976 %
   10977 %    o azimuth, elevation:  Define the light source direction.
   10978 %
   10979 */
   10980 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
   10981   const MagickBooleanType gray,const double asimuth,const double elevation)
   10982 {
   10983   Image
   10984     *shade_image;
   10985 
   10986   assert(wand != (MagickWand *) NULL);
   10987   assert(wand->signature == MagickWandSignature);
   10988   if (wand->debug != MagickFalse)
   10989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   10990   if (wand->images == (Image *) NULL)
   10991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   10992   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
   10993   if (shade_image == (Image *) NULL)
   10994     return(MagickFalse);
   10995   ReplaceImageInList(&wand->images,shade_image);
   10996   return(MagickTrue);
   10997 }
   10998 
   10999 /*
   11001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11002 %                                                                             %
   11003 %                                                                             %
   11004 %                                                                             %
   11005 %   M a g i c k S h a d o w I m a g e                                         %
   11006 %                                                                             %
   11007 %                                                                             %
   11008 %                                                                             %
   11009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11010 %
   11011 %  MagickShadowImage() simulates an image shadow.
   11012 %
   11013 %  The format of the MagickShadowImage method is:
   11014 %
   11015 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
   11016 %        const double sigma,const ssize_t x,const ssize_t y)
   11017 %
   11018 %  A description of each parameter follows:
   11019 %
   11020 %    o wand: the magick wand.
   11021 %
   11022 %    o alpha: percentage transparency.
   11023 %
   11024 %    o sigma: the standard deviation of the Gaussian, in pixels.
   11025 %
   11026 %    o x: the shadow x-offset.
   11027 %
   11028 %    o y: the shadow y-offset.
   11029 %
   11030 */
   11031 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
   11032   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
   11033 {
   11034   Image
   11035     *shadow_image;
   11036 
   11037   assert(wand != (MagickWand *) NULL);
   11038   assert(wand->signature == MagickWandSignature);
   11039   if (wand->debug != MagickFalse)
   11040     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11041   if (wand->images == (Image *) NULL)
   11042     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11043   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
   11044   if (shadow_image == (Image *) NULL)
   11045     return(MagickFalse);
   11046   ReplaceImageInList(&wand->images,shadow_image);
   11047   return(MagickTrue);
   11048 }
   11049 
   11050 /*
   11052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11053 %                                                                             %
   11054 %                                                                             %
   11055 %                                                                             %
   11056 %   M a g i c k S h a r p e n I m a g e                                       %
   11057 %                                                                             %
   11058 %                                                                             %
   11059 %                                                                             %
   11060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11061 %
   11062 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
   11063 %  Gaussian operator of the given radius and standard deviation (sigma).
   11064 %  For reasonable results, the radius should be larger than sigma.  Use a
   11065 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
   11066 %
   11067 %  The format of the MagickSharpenImage method is:
   11068 %
   11069 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
   11070 %        const double radius,const double sigma)
   11071 %
   11072 %  A description of each parameter follows:
   11073 %
   11074 %    o wand: the magick wand.
   11075 %
   11076 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   11077 %      pixel.
   11078 %
   11079 %    o sigma: the standard deviation of the Gaussian, in pixels.
   11080 %
   11081 */
   11082 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
   11083   const double radius,const double sigma)
   11084 {
   11085   Image
   11086     *sharp_image;
   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   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
   11095   if (sharp_image == (Image *) NULL)
   11096     return(MagickFalse);
   11097   ReplaceImageInList(&wand->images,sharp_image);
   11098   return(MagickTrue);
   11099 }
   11100 
   11101 /*
   11103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11104 %                                                                             %
   11105 %                                                                             %
   11106 %                                                                             %
   11107 %   M a g i c k S h a v e I m a g e                                           %
   11108 %                                                                             %
   11109 %                                                                             %
   11110 %                                                                             %
   11111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11112 %
   11113 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
   11114 %  memory necessary for the new Image structure and returns a pointer to the
   11115 %  new image.
   11116 %
   11117 %  The format of the MagickShaveImage method is:
   11118 %
   11119 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
   11120 %        const size_t columns,const size_t rows)
   11121 %
   11122 %  A description of each parameter follows:
   11123 %
   11124 %    o wand: the magick wand.
   11125 %
   11126 %    o columns: the number of columns in the scaled image.
   11127 %
   11128 %    o rows: the number of rows in the scaled image.
   11129 %
   11130 %
   11131 */
   11132 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
   11133   const size_t columns,const size_t rows)
   11134 {
   11135   Image
   11136     *shave_image;
   11137 
   11138   RectangleInfo
   11139     shave_info;
   11140 
   11141   assert(wand != (MagickWand *) NULL);
   11142   assert(wand->signature == MagickWandSignature);
   11143   if (wand->debug != MagickFalse)
   11144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11145   if (wand->images == (Image *) NULL)
   11146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11147   shave_info.width=columns;
   11148   shave_info.height=rows;
   11149   shave_info.x=0;
   11150   shave_info.y=0;
   11151   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
   11152   if (shave_image == (Image *) NULL)
   11153     return(MagickFalse);
   11154   ReplaceImageInList(&wand->images,shave_image);
   11155   return(MagickTrue);
   11156 }
   11157 
   11158 /*
   11160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11161 %                                                                             %
   11162 %                                                                             %
   11163 %                                                                             %
   11164 %   M a g i c k S h e a r I m a g e                                           %
   11165 %                                                                             %
   11166 %                                                                             %
   11167 %                                                                             %
   11168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11169 %
   11170 %  MagickShearImage() slides one edge of an image along the X or Y axis,
   11171 %  creating a parallelogram.  An X direction shear slides an edge along the X
   11172 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
   11173 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
   11174 %  is measured relative to the Y axis, and similarly, for Y direction shears
   11175 %  y_shear is measured relative to the X axis.  Empty triangles left over from
   11176 %  shearing the image are filled with the background color.
   11177 %
   11178 %  The format of the MagickShearImage method is:
   11179 %
   11180 %      MagickBooleanType MagickShearImage(MagickWand *wand,
   11181 %        const PixelWand *background,const double x_shear,const double y_shear)
   11182 %
   11183 %  A description of each parameter follows:
   11184 %
   11185 %    o wand: the magick wand.
   11186 %
   11187 %    o background: the background pixel wand.
   11188 %
   11189 %    o x_shear: the number of degrees to shear the image.
   11190 %
   11191 %    o y_shear: the number of degrees to shear the image.
   11192 %
   11193 */
   11194 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
   11195   const PixelWand *background,const double x_shear,const double y_shear)
   11196 {
   11197   Image
   11198     *shear_image;
   11199 
   11200   assert(wand != (MagickWand *) NULL);
   11201   assert(wand->signature == MagickWandSignature);
   11202   if (wand->debug != MagickFalse)
   11203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11204   if (wand->images == (Image *) NULL)
   11205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11206   PixelGetQuantumPacket(background,&wand->images->background_color);
   11207   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
   11208   if (shear_image == (Image *) NULL)
   11209     return(MagickFalse);
   11210   ReplaceImageInList(&wand->images,shear_image);
   11211   return(MagickTrue);
   11212 }
   11213 
   11214 /*
   11216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11217 %                                                                             %
   11218 %                                                                             %
   11219 %                                                                             %
   11220 %   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                   %
   11221 %                                                                             %
   11222 %                                                                             %
   11223 %                                                                             %
   11224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11225 %
   11226 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
   11227 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
   11228 %  image using a sigmoidal transfer function without saturating highlights or
   11229 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
   11230 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
   11231 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
   11232 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
   11233 %  is reduced.
   11234 %
   11235 %  The format of the MagickSigmoidalContrastImage method is:
   11236 %
   11237 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
   11238 %        const MagickBooleanType sharpen,const double alpha,const double beta)
   11239 %
   11240 %  A description of each parameter follows:
   11241 %
   11242 %    o wand: the magick wand.
   11243 %
   11244 %    o sharpen: Increase or decrease image contrast.
   11245 %
   11246 %    o alpha: strength of the contrast, the larger the number the more
   11247 %      'threshold-like' it becomes.
   11248 %
   11249 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
   11250 %
   11251 */
   11252 WandExport MagickBooleanType MagickSigmoidalContrastImage(
   11253   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
   11254   const double beta)
   11255 {
   11256   MagickBooleanType
   11257     status;
   11258 
   11259   assert(wand != (MagickWand *) NULL);
   11260   assert(wand->signature == MagickWandSignature);
   11261   if (wand->debug != MagickFalse)
   11262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11263   if (wand->images == (Image *) NULL)
   11264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11265   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
   11266     wand->exception);
   11267   return(status);
   11268 }
   11269 
   11270 /*
   11272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11273 %                                                                             %
   11274 %                                                                             %
   11275 %                                                                             %
   11276 %   M a g i c k S i m i l a r i t y I m a g e                                 %
   11277 %                                                                             %
   11278 %                                                                             %
   11279 %                                                                             %
   11280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11281 %
   11282 %  MagickSimilarityImage() compares the reference image of the image and
   11283 %  returns the best match offset.  In addition, it returns a similarity image
   11284 %  such that an exact match location is completely white and if none of the
   11285 %  pixels match, black, otherwise some gray level in-between.
   11286 %
   11287 %  The format of the MagickSimilarityImage method is:
   11288 %
   11289 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
   11290 %        const MagickWand *reference,const MetricType metric,
   11291 %        const double similarity_threshold,RectangeInfo *offset,
   11292 %        double *similarity)
   11293 %
   11294 %  A description of each parameter follows:
   11295 %
   11296 %    o wand: the magick wand.
   11297 %
   11298 %    o reference: the reference wand.
   11299 %
   11300 %    o metric: the metric.
   11301 %
   11302 %    o similarity_threshold: minimum distortion for (sub)image match.
   11303 %
   11304 %    o offset: the best match offset of the reference image within the image.
   11305 %
   11306 %    o similarity: the computed similarity between the images.
   11307 %
   11308 */
   11309 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
   11310   const MagickWand *reference,const MetricType metric,
   11311   const double similarity_threshold,RectangleInfo *offset,double *similarity)
   11312 {
   11313   Image
   11314     *similarity_image;
   11315 
   11316   assert(wand != (MagickWand *) NULL);
   11317   assert(wand->signature == MagickWandSignature);
   11318   if (wand->debug != MagickFalse)
   11319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11320   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
   11321     {
   11322       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11323         "ContainsNoImages","`%s'",wand->name);
   11324       return((MagickWand *) NULL);
   11325     }
   11326   similarity_image=SimilarityImage(wand->images,reference->images,metric,
   11327     similarity_threshold,offset,similarity,wand->exception);
   11328   if (similarity_image == (Image *) NULL)
   11329     return((MagickWand *) NULL);
   11330   return(CloneMagickWandFromImages(wand,similarity_image));
   11331 }
   11332 
   11333 /*
   11335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11336 %                                                                             %
   11337 %                                                                             %
   11338 %                                                                             %
   11339 %   M a g i c k S k e t c h I m a g e                                         %
   11340 %                                                                             %
   11341 %                                                                             %
   11342 %                                                                             %
   11343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11344 %
   11345 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
   11346 %  a Gaussian operator of the given radius and standard deviation (sigma).
   11347 %  For reasonable results, radius should be larger than sigma.  Use a
   11348 %  radius of 0 and SketchImage() selects a suitable radius for you.
   11349 %  Angle gives the angle of the blurring motion.
   11350 %
   11351 %  The format of the MagickSketchImage method is:
   11352 %
   11353 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
   11354 %        const double radius,const double sigma,const double angle)
   11355 %
   11356 %  A description of each parameter follows:
   11357 %
   11358 %    o wand: the magick wand.
   11359 %
   11360 %    o radius: the radius of the Gaussian, in pixels, not counting
   11361 %      the center pixel.
   11362 %
   11363 %    o sigma: the standard deviation of the Gaussian, in pixels.
   11364 %
   11365 %    o angle: apply the effect along this angle.
   11366 %
   11367 */
   11368 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
   11369   const double radius,const double sigma,const double angle)
   11370 {
   11371   Image
   11372     *sketch_image;
   11373 
   11374   assert(wand != (MagickWand *) NULL);
   11375   assert(wand->signature == MagickWandSignature);
   11376   if (wand->debug != MagickFalse)
   11377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11378   if (wand->images == (Image *) NULL)
   11379     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11380   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
   11381   if (sketch_image == (Image *) NULL)
   11382     return(MagickFalse);
   11383   ReplaceImageInList(&wand->images,sketch_image);
   11384   return(MagickTrue);
   11385 }
   11386 
   11387 /*
   11389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11390 %                                                                             %
   11391 %                                                                             %
   11392 %                                                                             %
   11393 %   M a g i c k S m u s h I m a g e s                                         %
   11394 %                                                                             %
   11395 %                                                                             %
   11396 %                                                                             %
   11397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11398 %
   11399 %  MagickSmushImages() takes all images from the current image pointer to the
   11400 %  end of the image list and smushs them to each other top-to-bottom if the
   11401 %  stack parameter is true, otherwise left-to-right.
   11402 %
   11403 %  The format of the MagickSmushImages method is:
   11404 %
   11405 %      MagickWand *MagickSmushImages(MagickWand *wand,
   11406 %        const MagickBooleanType stack,const ssize_t offset)
   11407 %
   11408 %  A description of each parameter follows:
   11409 %
   11410 %    o wand: the magick wand.
   11411 %
   11412 %    o stack: By default, images are stacked left-to-right. Set stack to
   11413 %      MagickTrue to stack them top-to-bottom.
   11414 %
   11415 %    o offset: minimum distance in pixels between images.
   11416 %
   11417 */
   11418 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
   11419   const MagickBooleanType stack,const ssize_t offset)
   11420 {
   11421   Image
   11422     *smush_image;
   11423 
   11424   assert(wand != (MagickWand *) NULL);
   11425   assert(wand->signature == MagickWandSignature);
   11426   if (wand->debug != MagickFalse)
   11427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11428   if (wand->images == (Image *) NULL)
   11429     return((MagickWand *) NULL);
   11430   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
   11431   if (smush_image == (Image *) NULL)
   11432     return((MagickWand *) NULL);
   11433   return(CloneMagickWandFromImages(wand,smush_image));
   11434 }
   11435 
   11436 /*
   11438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11439 %                                                                             %
   11440 %                                                                             %
   11441 %                                                                             %
   11442 %     M a g i c k S o l a r i z e I m a g e                                   %
   11443 %                                                                             %
   11444 %                                                                             %
   11445 %                                                                             %
   11446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11447 %
   11448 %  MagickSolarizeImage() applies a special effect to the image, similar to the
   11449 %  effect achieved in a photo darkroom by selectively exposing areas of photo
   11450 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
   11451 %  measure of the extent of the solarization.
   11452 %
   11453 %  The format of the MagickSolarizeImage method is:
   11454 %
   11455 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
   11456 %        const double threshold)
   11457 %
   11458 %  A description of each parameter follows:
   11459 %
   11460 %    o wand: the magick wand.
   11461 %
   11462 %    o threshold:  Define the extent of the solarization.
   11463 %
   11464 */
   11465 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
   11466   const double threshold)
   11467 {
   11468   MagickBooleanType
   11469     status;
   11470 
   11471   assert(wand != (MagickWand *) NULL);
   11472   assert(wand->signature == MagickWandSignature);
   11473   if (wand->debug != MagickFalse)
   11474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11475   if (wand->images == (Image *) NULL)
   11476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11477   status=SolarizeImage(wand->images,threshold,wand->exception);
   11478   return(status);
   11479 }
   11480 
   11481 /*
   11483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11484 %                                                                             %
   11485 %                                                                             %
   11486 %                                                                             %
   11487 %   M a g i c k S p a r s e C o l o r I m a g e                               %
   11488 %                                                                             %
   11489 %                                                                             %
   11490 %                                                                             %
   11491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11492 %
   11493 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
   11494 %  colors found at those coordinates, across the whole image, using various
   11495 %  methods.
   11496 %
   11497 %  The format of the MagickSparseColorImage method is:
   11498 %
   11499 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
   11500 %        const SparseColorMethod method,const size_t number_arguments,
   11501 %        const double *arguments)
   11502 %
   11503 %  A description of each parameter follows:
   11504 %
   11505 %    o image: the image to be sparseed.
   11506 %
   11507 %    o method: the method of image sparseion.
   11508 %
   11509 %        ArcSparseColorion will always ignore source image offset, and always
   11510 %        'bestfit' the destination image with the top left corner offset
   11511 %        relative to the polar mapping center.
   11512 %
   11513 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
   11514 %        style of image sparseion.
   11515 %
   11516 %        Affine, Perspective, and Bilinear, will do least squares fitting of
   11517 %        the distrotion when more than the minimum number of control point
   11518 %        pairs are provided.
   11519 %
   11520 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
   11521 %        less than 4 control point pairs are provided. While Affine sparseions
   11522 %        will let you use any number of control point pairs, that is Zero pairs
   11523 %        is a No-Op (viewport only) distrotion, one pair is a translation and
   11524 %        two pairs of control points will do a scale-rotate-translate, without
   11525 %        any shearing.
   11526 %
   11527 %    o number_arguments: the number of arguments given for this sparseion
   11528 %      method.
   11529 %
   11530 %    o arguments: the arguments for this sparseion method.
   11531 %
   11532 */
   11533 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
   11534   const SparseColorMethod method,const size_t number_arguments,
   11535   const double *arguments)
   11536 {
   11537   Image
   11538     *sparse_image;
   11539 
   11540   assert(wand != (MagickWand *) NULL);
   11541   assert(wand->signature == MagickWandSignature);
   11542   if (wand->debug != MagickFalse)
   11543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11544   if (wand->images == (Image *) NULL)
   11545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11546   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
   11547     wand->exception);
   11548   if (sparse_image == (Image *) NULL)
   11549     return(MagickFalse);
   11550   ReplaceImageInList(&wand->images,sparse_image);
   11551   return(MagickTrue);
   11552 }
   11553 
   11554 /*
   11556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11557 %                                                                             %
   11558 %                                                                             %
   11559 %                                                                             %
   11560 %   M a g i c k S p l i c e I m a g e                                         %
   11561 %                                                                             %
   11562 %                                                                             %
   11563 %                                                                             %
   11564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11565 %
   11566 %  MagickSpliceImage() splices a solid color into the image.
   11567 %
   11568 %  The format of the MagickSpliceImage method is:
   11569 %
   11570 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
   11571 %        const size_t width,const size_t height,const ssize_t x,
   11572 %        const ssize_t y)
   11573 %
   11574 %  A description of each parameter follows:
   11575 %
   11576 %    o wand: the magick wand.
   11577 %
   11578 %    o width: the region width.
   11579 %
   11580 %    o height: the region height.
   11581 %
   11582 %    o x: the region x offset.
   11583 %
   11584 %    o y: the region y offset.
   11585 %
   11586 */
   11587 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
   11588   const size_t width,const size_t height,const ssize_t x,
   11589   const ssize_t y)
   11590 {
   11591   Image
   11592     *splice_image;
   11593 
   11594   RectangleInfo
   11595     splice;
   11596 
   11597   assert(wand != (MagickWand *) NULL);
   11598   assert(wand->signature == MagickWandSignature);
   11599   if (wand->debug != MagickFalse)
   11600     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11601   if (wand->images == (Image *) NULL)
   11602     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11603   splice.width=width;
   11604   splice.height=height;
   11605   splice.x=x;
   11606   splice.y=y;
   11607   splice_image=SpliceImage(wand->images,&splice,wand->exception);
   11608   if (splice_image == (Image *) NULL)
   11609     return(MagickFalse);
   11610   ReplaceImageInList(&wand->images,splice_image);
   11611   return(MagickTrue);
   11612 }
   11613 
   11614 /*
   11616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11617 %                                                                             %
   11618 %                                                                             %
   11619 %                                                                             %
   11620 %   M a g i c k S p r e a d I m a g e                                         %
   11621 %                                                                             %
   11622 %                                                                             %
   11623 %                                                                             %
   11624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11625 %
   11626 %  MagickSpreadImage() is a special effects method that randomly displaces each
   11627 %  pixel in a block defined by the radius parameter.
   11628 %
   11629 %  The format of the MagickSpreadImage method is:
   11630 %
   11631 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,
   11632 %        const PixelInterpolateMethod method,const double radius)
   11633 %
   11634 %  A description of each parameter follows:
   11635 %
   11636 %    o wand: the magick wand.
   11637 %
   11638 %    o method:  intepolation method.
   11639 %
   11640 %    o radius:  Choose a random pixel in a neighborhood of this extent.
   11641 %
   11642 */
   11643 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
   11644   const PixelInterpolateMethod method,const double radius)
   11645 {
   11646   Image
   11647     *spread_image;
   11648 
   11649   assert(wand != (MagickWand *) NULL);
   11650   assert(wand->signature == MagickWandSignature);
   11651   if (wand->debug != MagickFalse)
   11652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11653   if (wand->images == (Image *) NULL)
   11654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11655   spread_image=SpreadImage(wand->images,method,radius,wand->exception);
   11656   if (spread_image == (Image *) NULL)
   11657     return(MagickFalse);
   11658   ReplaceImageInList(&wand->images,spread_image);
   11659   return(MagickTrue);
   11660 }
   11661 
   11662 /*
   11664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11665 %                                                                             %
   11666 %                                                                             %
   11667 %                                                                             %
   11668 %   M a g i c k S t a t i s t i c I m a g e                                   %
   11669 %                                                                             %
   11670 %                                                                             %
   11671 %                                                                             %
   11672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11673 %
   11674 %  MagickStatisticImage() replace each pixel with corresponding statistic from
   11675 %  the neighborhood of the specified width and height.
   11676 %
   11677 %  The format of the MagickStatisticImage method is:
   11678 %
   11679 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
   11680 %        const StatisticType type,const double width,const size_t height)
   11681 %
   11682 %  A description of each parameter follows:
   11683 %
   11684 %    o wand: the magick wand.
   11685 %
   11686 %    o type: the statistic type (e.g. median, mode, etc.).
   11687 %
   11688 %    o width: the width of the pixel neighborhood.
   11689 %
   11690 %    o height: the height of the pixel neighborhood.
   11691 %
   11692 */
   11693 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
   11694   const StatisticType type,const size_t width,const size_t height)
   11695 {
   11696   Image
   11697     *statistic_image;
   11698 
   11699   assert(wand != (MagickWand *) NULL);
   11700   assert(wand->signature == MagickWandSignature);
   11701   if (wand->debug != MagickFalse)
   11702     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11703   if (wand->images == (Image *) NULL)
   11704     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11705   statistic_image=StatisticImage(wand->images,type,width,height,
   11706     wand->exception);
   11707   if (statistic_image == (Image *) NULL)
   11708     return(MagickFalse);
   11709   ReplaceImageInList(&wand->images,statistic_image);
   11710   return(MagickTrue);
   11711 }
   11712 
   11713 /*
   11715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11716 %                                                                             %
   11717 %                                                                             %
   11718 %                                                                             %
   11719 %   M a g i c k S t e g a n o I m a g e                                       %
   11720 %                                                                             %
   11721 %                                                                             %
   11722 %                                                                             %
   11723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11724 %
   11725 %  MagickSteganoImage() hides a digital watermark within the image.
   11726 %  Recover the hidden watermark later to prove that the authenticity of
   11727 %  an image.  Offset defines the start position within the image to hide
   11728 %  the watermark.
   11729 %
   11730 %  The format of the MagickSteganoImage method is:
   11731 %
   11732 %      MagickWand *MagickSteganoImage(MagickWand *wand,
   11733 %        const MagickWand *watermark_wand,const ssize_t offset)
   11734 %
   11735 %  A description of each parameter follows:
   11736 %
   11737 %    o wand: the magick wand.
   11738 %
   11739 %    o watermark_wand: the watermark wand.
   11740 %
   11741 %    o offset: Start hiding at this offset into the image.
   11742 %
   11743 */
   11744 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
   11745   const MagickWand *watermark_wand,const ssize_t offset)
   11746 {
   11747   Image
   11748     *stegano_image;
   11749 
   11750   assert(wand != (MagickWand *) NULL);
   11751   assert(wand->signature == MagickWandSignature);
   11752   if (wand->debug != MagickFalse)
   11753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11754   if ((wand->images == (Image *) NULL) ||
   11755       (watermark_wand->images == (Image *) NULL))
   11756     {
   11757       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11758         "ContainsNoImages","`%s'",wand->name);
   11759       return((MagickWand *) NULL);
   11760     }
   11761   wand->images->offset=offset;
   11762   stegano_image=SteganoImage(wand->images,watermark_wand->images,
   11763     wand->exception);
   11764   if (stegano_image == (Image *) NULL)
   11765     return((MagickWand *) NULL);
   11766   return(CloneMagickWandFromImages(wand,stegano_image));
   11767 }
   11768 
   11769 /*
   11771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11772 %                                                                             %
   11773 %                                                                             %
   11774 %                                                                             %
   11775 %   M a g i c k S t e r e o I m a g e                                         %
   11776 %                                                                             %
   11777 %                                                                             %
   11778 %                                                                             %
   11779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11780 %
   11781 %  MagickStereoImage() composites two images and produces a single image that
   11782 %  is the composite of a left and right image of a stereo pair
   11783 %
   11784 %  The format of the MagickStereoImage method is:
   11785 %
   11786 %      MagickWand *MagickStereoImage(MagickWand *wand,
   11787 %        const MagickWand *offset_wand)
   11788 %
   11789 %  A description of each parameter follows:
   11790 %
   11791 %    o wand: the magick wand.
   11792 %
   11793 %    o offset_wand: Another image wand.
   11794 %
   11795 */
   11796 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
   11797   const MagickWand *offset_wand)
   11798 {
   11799   Image
   11800     *stereo_image;
   11801 
   11802   assert(wand != (MagickWand *) NULL);
   11803   assert(wand->signature == MagickWandSignature);
   11804   if (wand->debug != MagickFalse)
   11805     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11806   if ((wand->images == (Image *) NULL) ||
   11807       (offset_wand->images == (Image *) NULL))
   11808     {
   11809       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11810         "ContainsNoImages","`%s'",wand->name);
   11811       return((MagickWand *) NULL);
   11812     }
   11813   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
   11814   if (stereo_image == (Image *) NULL)
   11815     return((MagickWand *) NULL);
   11816   return(CloneMagickWandFromImages(wand,stereo_image));
   11817 }
   11818 
   11819 /*
   11821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11822 %                                                                             %
   11823 %                                                                             %
   11824 %                                                                             %
   11825 %   M a g i c k S t r i p I m a g e                                           %
   11826 %                                                                             %
   11827 %                                                                             %
   11828 %                                                                             %
   11829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11830 %
   11831 %  MagickStripImage() strips an image of all profiles and comments.
   11832 %
   11833 %  The format of the MagickStripImage method is:
   11834 %
   11835 %      MagickBooleanType MagickStripImage(MagickWand *wand)
   11836 %
   11837 %  A description of each parameter follows:
   11838 %
   11839 %    o wand: the magick wand.
   11840 %
   11841 */
   11842 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
   11843 {
   11844   assert(wand != (MagickWand *) NULL);
   11845   assert(wand->signature == MagickWandSignature);
   11846   if (wand->debug != MagickFalse)
   11847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11848   if (wand->images == (Image *) NULL)
   11849     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11850   return(StripImage(wand->images,wand->exception));
   11851 }
   11852 
   11853 /*
   11855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11856 %                                                                             %
   11857 %                                                                             %
   11858 %                                                                             %
   11859 %   M a g i c k S w i r l I m a g e                                           %
   11860 %                                                                             %
   11861 %                                                                             %
   11862 %                                                                             %
   11863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11864 %
   11865 %  MagickSwirlImage() swirls the pixels about the center of the image, where
   11866 %  degrees indicates the sweep of the arc through which each pixel is moved.
   11867 %  You get a more dramatic effect as the degrees move from 1 to 360.
   11868 %
   11869 %  The format of the MagickSwirlImage method is:
   11870 %
   11871 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
   11872 %        const PixelInterpolateMethod method)
   11873 %
   11874 %  A description of each parameter follows:
   11875 %
   11876 %    o wand: the magick wand.
   11877 %
   11878 %    o degrees: Define the tightness of the swirling effect.
   11879 %
   11880 %    o method: the pixel interpolation method.
   11881 %
   11882 */
   11883 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
   11884   const double degrees,const PixelInterpolateMethod method)
   11885 {
   11886   Image
   11887     *swirl_image;
   11888 
   11889   assert(wand != (MagickWand *) NULL);
   11890   assert(wand->signature == MagickWandSignature);
   11891   if (wand->debug != MagickFalse)
   11892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11893   if (wand->images == (Image *) NULL)
   11894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   11895   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
   11896   if (swirl_image == (Image *) NULL)
   11897     return(MagickFalse);
   11898   ReplaceImageInList(&wand->images,swirl_image);
   11899   return(MagickTrue);
   11900 }
   11901 
   11902 /*
   11904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11905 %                                                                             %
   11906 %                                                                             %
   11907 %                                                                             %
   11908 %   M a g i c k T e x t u r e I m a g e                                       %
   11909 %                                                                             %
   11910 %                                                                             %
   11911 %                                                                             %
   11912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11913 %
   11914 %  MagickTextureImage() repeatedly tiles the texture image across and down the
   11915 %  image canvas.
   11916 %
   11917 %  The format of the MagickTextureImage method is:
   11918 %
   11919 %      MagickWand *MagickTextureImage(MagickWand *wand,
   11920 %        const MagickWand *texture_wand)
   11921 %
   11922 %  A description of each parameter follows:
   11923 %
   11924 %    o wand: the magick wand.
   11925 %
   11926 %    o texture_wand: the texture wand
   11927 %
   11928 */
   11929 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
   11930   const MagickWand *texture_wand)
   11931 {
   11932   Image
   11933     *texture_image;
   11934 
   11935   MagickBooleanType
   11936     status;
   11937 
   11938   assert(wand != (MagickWand *) NULL);
   11939   assert(wand->signature == MagickWandSignature);
   11940   if (wand->debug != MagickFalse)
   11941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   11942   if ((wand->images == (Image *) NULL) ||
   11943       (texture_wand->images == (Image *) NULL))
   11944     {
   11945       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
   11946         "ContainsNoImages","`%s'",wand->name);
   11947       return((MagickWand *) NULL);
   11948     }
   11949   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   11950   if (texture_image == (Image *) NULL)
   11951     return((MagickWand *) NULL);
   11952   status=TextureImage(texture_image,texture_wand->images,wand->exception);
   11953   if (status == MagickFalse)
   11954     {
   11955       texture_image=DestroyImage(texture_image);
   11956       return((MagickWand *) NULL);
   11957     }
   11958   return(CloneMagickWandFromImages(wand,texture_image));
   11959 }
   11960 
   11961 /*
   11963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11964 %                                                                             %
   11965 %                                                                             %
   11966 %                                                                             %
   11967 %   M a g i c k T h r e s h o l d I m a g e                                   %
   11968 %                                                                             %
   11969 %                                                                             %
   11970 %                                                                             %
   11971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   11972 %
   11973 %  MagickThresholdImage() changes the value of individual pixels based on
   11974 %  the intensity of each pixel compared to threshold.  The result is a
   11975 %  high-contrast, two color image.
   11976 %
   11977 %  The format of the MagickThresholdImage method is:
   11978 %
   11979 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
   11980 %        const double threshold)
   11981 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
   11982 %        const ChannelType channel,const double threshold)
   11983 %
   11984 %  A description of each parameter follows:
   11985 %
   11986 %    o wand: the magick wand.
   11987 %
   11988 %    o channel: the image channel(s).
   11989 %
   11990 %    o threshold: Define the threshold value.
   11991 %
   11992 */
   11993 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
   11994   const double threshold)
   11995 {
   11996   MagickBooleanType
   11997     status;
   11998 
   11999   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
   12000   return(status);
   12001 }
   12002 
   12003 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
   12004   const ChannelType channel,const double threshold)
   12005 {
   12006   MagickBooleanType
   12007     status;
   12008 
   12009   ChannelType
   12010     channel_mask;
   12011 
   12012   assert(wand != (MagickWand *) NULL);
   12013   assert(wand->signature == MagickWandSignature);
   12014   if (wand->debug != MagickFalse)
   12015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12016   if (wand->images == (Image *) NULL)
   12017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12018   channel_mask=SetImageChannelMask(wand->images,channel);
   12019   status=BilevelImage(wand->images,threshold,wand->exception);
   12020   (void) SetImageChannelMask(wand->images,channel_mask);
   12021   return(status);
   12022 }
   12023 
   12024 /*
   12026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12027 %                                                                             %
   12028 %                                                                             %
   12029 %                                                                             %
   12030 %   M a g i c k T h u m b n a i l I m a g e                                   %
   12031 %                                                                             %
   12032 %                                                                             %
   12033 %                                                                             %
   12034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12035 %
   12036 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
   12037 %  and removes any associated profiles.  The goal is to produce small low cost
   12038 %  thumbnail images suited for display on the Web.
   12039 %
   12040 %  The format of the MagickThumbnailImage method is:
   12041 %
   12042 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
   12043 %        const size_t columns,const size_t rows)
   12044 %
   12045 %  A description of each parameter follows:
   12046 %
   12047 %    o wand: the magick wand.
   12048 %
   12049 %    o columns: the number of columns in the scaled image.
   12050 %
   12051 %    o rows: the number of rows in the scaled image.
   12052 %
   12053 */
   12054 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
   12055   const size_t columns,const size_t rows)
   12056 {
   12057   Image
   12058     *thumbnail_image;
   12059 
   12060   assert(wand != (MagickWand *) NULL);
   12061   assert(wand->signature == MagickWandSignature);
   12062   if (wand->debug != MagickFalse)
   12063     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12064   if (wand->images == (Image *) NULL)
   12065     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12066   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
   12067   if (thumbnail_image == (Image *) NULL)
   12068     return(MagickFalse);
   12069   ReplaceImageInList(&wand->images,thumbnail_image);
   12070   return(MagickTrue);
   12071 }
   12072 
   12073 /*
   12075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12076 %                                                                             %
   12077 %                                                                             %
   12078 %                                                                             %
   12079 %   M a g i c k T i n t I m a g e                                             %
   12080 %                                                                             %
   12081 %                                                                             %
   12082 %                                                                             %
   12083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12084 %
   12085 %  MagickTintImage() applies a color vector to each pixel in the image.  The
   12086 %  length of the vector is 0 for black and white and at its maximum for the
   12087 %  midtones.  The vector weighting function is
   12088 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
   12089 %
   12090 %  The format of the MagickTintImage method is:
   12091 %
   12092 %      MagickBooleanType MagickTintImage(MagickWand *wand,
   12093 %        const PixelWand *tint,const PixelWand *blend)
   12094 %
   12095 %  A description of each parameter follows:
   12096 %
   12097 %    o wand: the magick wand.
   12098 %
   12099 %    o tint: the tint pixel wand.
   12100 %
   12101 %    o alpha: the alpha pixel wand.
   12102 %
   12103 */
   12104 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
   12105   const PixelWand *tint,const PixelWand *blend)
   12106 {
   12107   char
   12108     percent_blend[MagickPathExtent];
   12109 
   12110   Image
   12111     *tint_image;
   12112 
   12113   PixelInfo
   12114     target;
   12115 
   12116   assert(wand != (MagickWand *) NULL);
   12117   assert(wand->signature == MagickWandSignature);
   12118   if (wand->debug != MagickFalse)
   12119     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12120   if (wand->images == (Image *) NULL)
   12121     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12122   if (wand->images->colorspace != CMYKColorspace)
   12123     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   12124       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
   12125       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
   12126       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
   12127       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
   12128       PixelGetAlphaQuantum(blend)));
   12129   else
   12130     (void) FormatLocaleString(percent_blend,MagickPathExtent,
   12131       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
   12132       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
   12133       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
   12134       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
   12135       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
   12136       PixelGetAlphaQuantum(blend)));
   12137   target=PixelGetPixel(tint);
   12138   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
   12139   if (tint_image == (Image *) NULL)
   12140     return(MagickFalse);
   12141   ReplaceImageInList(&wand->images,tint_image);
   12142   return(MagickTrue);
   12143 }
   12144 
   12145 /*
   12147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12148 %                                                                             %
   12149 %                                                                             %
   12150 %                                                                             %
   12151 %   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               %
   12152 %                                                                             %
   12153 %                                                                             %
   12154 %                                                                             %
   12155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12156 %
   12157 %  MagickTransformImageColorspace() transform the image colorspace, setting
   12158 %  the images colorspace while transforming the images data to that
   12159 %  colorspace.
   12160 %
   12161 %  The format of the MagickTransformImageColorspace method is:
   12162 %
   12163 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
   12164 %        const ColorspaceType colorspace)
   12165 %
   12166 %  A description of each parameter follows:
   12167 %
   12168 %    o wand: the magick wand.
   12169 %
   12170 %    o colorspace: the image colorspace:   UndefinedColorspace,
   12171 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
   12172 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
   12173 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
   12174 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
   12175 %      HSLColorspace, HWBColorspace.
   12176 %
   12177 */
   12178 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
   12179   const ColorspaceType colorspace)
   12180 {
   12181   assert(wand != (MagickWand *) NULL);
   12182   assert(wand->signature == MagickWandSignature);
   12183   if (wand->debug != MagickFalse)
   12184     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12185   if (wand->images == (Image *) NULL)
   12186     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12187   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
   12188 }
   12189 
   12190 /*
   12192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12193 %                                                                             %
   12194 %                                                                             %
   12195 %                                                                             %
   12196 %   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                     %
   12197 %                                                                             %
   12198 %                                                                             %
   12199 %                                                                             %
   12200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12201 %
   12202 %  MagickTransparentPaintImage() changes any pixel that matches color with the
   12203 %  color defined by fill.
   12204 %
   12205 %  The format of the MagickTransparentPaintImage method is:
   12206 %
   12207 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
   12208 %        const PixelWand *target,const double alpha,const double fuzz,
   12209 %        const MagickBooleanType invert)
   12210 %
   12211 %  A description of each parameter follows:
   12212 %
   12213 %    o wand: the magick wand.
   12214 %
   12215 %    o target: Change this target color to specified alpha value within
   12216 %      the image.
   12217 %
   12218 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
   12219 %      transparent.
   12220 %
   12221 %    o fuzz: By default target must match a particular pixel color
   12222 %      exactly.  However, in many cases two colors may differ by a small amount.
   12223 %      The fuzz member of image defines how much tolerance is acceptable to
   12224 %      consider two colors as the same.  For example, set fuzz to 10 and the
   12225 %      color red at intensities of 100 and 102 respectively are now interpreted
   12226 %      as the same color for the purposes of the floodfill.
   12227 %
   12228 %    o invert: paint any pixel that does not match the target color.
   12229 %
   12230 */
   12231 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
   12232   const PixelWand *target,const double alpha,const double fuzz,
   12233   const MagickBooleanType invert)
   12234 {
   12235   MagickBooleanType
   12236     status;
   12237 
   12238   PixelInfo
   12239     target_pixel;
   12240 
   12241   assert(wand != (MagickWand *) NULL);
   12242   assert(wand->signature == MagickWandSignature);
   12243   if (wand->debug != MagickFalse)
   12244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12245   if (wand->images == (Image *) NULL)
   12246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12247   PixelGetMagickColor(target,&target_pixel);
   12248   wand->images->fuzz=fuzz;
   12249   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
   12250     QuantumRange*alpha),invert,wand->exception);
   12251   return(status);
   12252 }
   12253 
   12254 /*
   12256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12257 %                                                                             %
   12258 %                                                                             %
   12259 %                                                                             %
   12260 %   M a g i c k T r a n s p o s e I m a g e                                   %
   12261 %                                                                             %
   12262 %                                                                             %
   12263 %                                                                             %
   12264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12265 %
   12266 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
   12267 %  pixels around the central x-axis while rotating them 90-degrees.
   12268 %
   12269 %  The format of the MagickTransposeImage method is:
   12270 %
   12271 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
   12272 %
   12273 %  A description of each parameter follows:
   12274 %
   12275 %    o wand: the magick wand.
   12276 %
   12277 */
   12278 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
   12279 {
   12280   Image
   12281     *transpose_image;
   12282 
   12283   assert(wand != (MagickWand *) NULL);
   12284   assert(wand->signature == MagickWandSignature);
   12285   if (wand->debug != MagickFalse)
   12286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12287   if (wand->images == (Image *) NULL)
   12288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12289   transpose_image=TransposeImage(wand->images,wand->exception);
   12290   if (transpose_image == (Image *) NULL)
   12291     return(MagickFalse);
   12292   ReplaceImageInList(&wand->images,transpose_image);
   12293   return(MagickTrue);
   12294 }
   12295 
   12296 /*
   12298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12299 %                                                                             %
   12300 %                                                                             %
   12301 %                                                                             %
   12302 %   M a g i c k T r a n s v e r s e I m a g e                                 %
   12303 %                                                                             %
   12304 %                                                                             %
   12305 %                                                                             %
   12306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12307 %
   12308 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
   12309 %  pixels around the central y-axis while rotating them 270-degrees.
   12310 %
   12311 %  The format of the MagickTransverseImage method is:
   12312 %
   12313 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
   12314 %
   12315 %  A description of each parameter follows:
   12316 %
   12317 %    o wand: the magick wand.
   12318 %
   12319 */
   12320 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
   12321 {
   12322   Image
   12323     *transverse_image;
   12324 
   12325   assert(wand != (MagickWand *) NULL);
   12326   assert(wand->signature == MagickWandSignature);
   12327   if (wand->debug != MagickFalse)
   12328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12329   if (wand->images == (Image *) NULL)
   12330     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12331   transverse_image=TransverseImage(wand->images,wand->exception);
   12332   if (transverse_image == (Image *) NULL)
   12333     return(MagickFalse);
   12334   ReplaceImageInList(&wand->images,transverse_image);
   12335   return(MagickTrue);
   12336 }
   12337 
   12338 /*
   12340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12341 %                                                                             %
   12342 %                                                                             %
   12343 %                                                                             %
   12344 %   M a g i c k T r i m I m a g e                                             %
   12345 %                                                                             %
   12346 %                                                                             %
   12347 %                                                                             %
   12348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12349 %
   12350 %  MagickTrimImage() remove edges that are the background color from the image.
   12351 %
   12352 %  The format of the MagickTrimImage method is:
   12353 %
   12354 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
   12355 %
   12356 %  A description of each parameter follows:
   12357 %
   12358 %    o wand: the magick wand.
   12359 %
   12360 %    o fuzz: By default target must match a particular pixel color
   12361 %      exactly.  However, in many cases two colors may differ by a small amount.
   12362 %      The fuzz member of image defines how much tolerance is acceptable to
   12363 %      consider two colors as the same.  For example, set fuzz to 10 and the
   12364 %      color red at intensities of 100 and 102 respectively are now interpreted
   12365 %      as the same color for the purposes of the floodfill.
   12366 %
   12367 */
   12368 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
   12369 {
   12370   Image
   12371     *trim_image;
   12372 
   12373   assert(wand != (MagickWand *) NULL);
   12374   assert(wand->signature == MagickWandSignature);
   12375   if (wand->debug != MagickFalse)
   12376     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12377   if (wand->images == (Image *) NULL)
   12378     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12379   wand->images->fuzz=fuzz;
   12380   trim_image=TrimImage(wand->images,wand->exception);
   12381   if (trim_image == (Image *) NULL)
   12382     return(MagickFalse);
   12383   ReplaceImageInList(&wand->images,trim_image);
   12384   return(MagickTrue);
   12385 }
   12386 
   12387 /*
   12389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12390 %                                                                             %
   12391 %                                                                             %
   12392 %                                                                             %
   12393 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
   12394 %                                                                             %
   12395 %                                                                             %
   12396 %                                                                             %
   12397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12398 %
   12399 %  MagickUniqueImageColors() discards all but one of any pixel color.
   12400 %
   12401 %  The format of the MagickUniqueImageColors method is:
   12402 %
   12403 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
   12404 %
   12405 %  A description of each parameter follows:
   12406 %
   12407 %    o wand: the magick wand.
   12408 %
   12409 */
   12410 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
   12411 {
   12412   Image
   12413     *unique_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   unique_image=UniqueImageColors(wand->images,wand->exception);
   12422   if (unique_image == (Image *) NULL)
   12423     return(MagickFalse);
   12424   ReplaceImageInList(&wand->images,unique_image);
   12425   return(MagickTrue);
   12426 }
   12427 
   12428 /*
   12430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12431 %                                                                             %
   12432 %                                                                             %
   12433 %                                                                             %
   12434 %   M a g i c k U n s h a r p M a s k I m a g e                               %
   12435 %                                                                             %
   12436 %                                                                             %
   12437 %                                                                             %
   12438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12439 %
   12440 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
   12441 %  Gaussian operator of the given radius and standard deviation (sigma).
   12442 %  For reasonable results, radius should be larger than sigma.  Use a radius
   12443 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
   12444 %
   12445 %  The format of the MagickUnsharpMaskImage method is:
   12446 %
   12447 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
   12448 %        const double radius,const double sigma,const double gain,
   12449 %        const double threshold)
   12450 %
   12451 %  A description of each parameter follows:
   12452 %
   12453 %    o wand: the magick wand.
   12454 %
   12455 %    o radius: the radius of the Gaussian, in pixels, not counting the center
   12456 %      pixel.
   12457 %
   12458 %    o sigma: the standard deviation of the Gaussian, in pixels.
   12459 %
   12460 %    o gain: the percentage of the difference between the original and the
   12461 %      blur image that is added back into the original.
   12462 %
   12463 %    o threshold: the threshold in pixels needed to apply the diffence gain.
   12464 %
   12465 */
   12466 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
   12467   const double radius,const double sigma,const double gain,
   12468   const double threshold)
   12469 {
   12470   Image
   12471     *unsharp_image;
   12472 
   12473   assert(wand != (MagickWand *) NULL);
   12474   assert(wand->signature == MagickWandSignature);
   12475   if (wand->debug != MagickFalse)
   12476     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12477   if (wand->images == (Image *) NULL)
   12478     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12479   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
   12480     wand->exception);
   12481   if (unsharp_image == (Image *) NULL)
   12482     return(MagickFalse);
   12483   ReplaceImageInList(&wand->images,unsharp_image);
   12484   return(MagickTrue);
   12485 }
   12486 
   12487 /*
   12489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12490 %                                                                             %
   12491 %                                                                             %
   12492 %                                                                             %
   12493 %   M a g i c k V i g n e t t e I m a g e                                     %
   12494 %                                                                             %
   12495 %                                                                             %
   12496 %                                                                             %
   12497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12498 %
   12499 %  MagickVignetteImage() softens the edges of the image in vignette style.
   12500 %
   12501 %  The format of the MagickVignetteImage method is:
   12502 %
   12503 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
   12504 %        const double radius,const double sigma,const ssize_t x,
   12505 %        const ssize_t y)
   12506 %
   12507 %  A description of each parameter follows:
   12508 %
   12509 %    o wand: the magick wand.
   12510 %
   12511 %    o radius: the radius.
   12512 %
   12513 %    o sigma: the sigma.
   12514 %
   12515 %    o x, y:  Define the x and y ellipse offset.
   12516 %
   12517 */
   12518 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
   12519   const double radius,const double sigma,const ssize_t x,const ssize_t y)
   12520 {
   12521   Image
   12522     *vignette_image;
   12523 
   12524   assert(wand != (MagickWand *) NULL);
   12525   assert(wand->signature == MagickWandSignature);
   12526   if (wand->debug != MagickFalse)
   12527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12528   if (wand->images == (Image *) NULL)
   12529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12530   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
   12531   if (vignette_image == (Image *) NULL)
   12532     return(MagickFalse);
   12533   ReplaceImageInList(&wand->images,vignette_image);
   12534   return(MagickTrue);
   12535 }
   12536 
   12537 /*
   12539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12540 %                                                                             %
   12541 %                                                                             %
   12542 %                                                                             %
   12543 %   M a g i c k W a v e I m a g e                                             %
   12544 %                                                                             %
   12545 %                                                                             %
   12546 %                                                                             %
   12547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12548 %
   12549 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
   12550 %  the pixels vertically along a sine wave whose amplitude and wavelength
   12551 %  is specified by the given parameters.
   12552 %
   12553 %  The format of the MagickWaveImage method is:
   12554 %
   12555 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
   12556 %        const double amplitude,const double wave_length,
   12557 %        const PixelInterpolateMethod method)
   12558 %
   12559 %  A description of each parameter follows:
   12560 %
   12561 %    o wand: the magick wand.
   12562 %
   12563 %    o amplitude, wave_length:  Define the amplitude and wave length of the
   12564 %      sine wave.
   12565 %
   12566 %    o method: the pixel interpolation method.
   12567 %
   12568 */
   12569 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
   12570   const double amplitude,const double wave_length,
   12571   const PixelInterpolateMethod method)
   12572 {
   12573   Image
   12574     *wave_image;
   12575 
   12576   assert(wand != (MagickWand *) NULL);
   12577   assert(wand->signature == MagickWandSignature);
   12578   if (wand->debug != MagickFalse)
   12579     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12580   if (wand->images == (Image *) NULL)
   12581     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12582   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
   12583     wand->exception);
   12584   if (wave_image == (Image *) NULL)
   12585     return(MagickFalse);
   12586   ReplaceImageInList(&wand->images,wave_image);
   12587   return(MagickTrue);
   12588 }
   12589 
   12590 /*
   12592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12593 %                                                                             %
   12594 %                                                                             %
   12595 %                                                                             %
   12596 %   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                         %
   12597 %                                                                             %
   12598 %                                                                             %
   12599 %                                                                             %
   12600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12601 %
   12602 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
   12603 %  above the threshold into white while leaving all pixels below the threshold
   12604 %  unchanged.
   12605 %
   12606 %  The format of the MagickWhiteThresholdImage method is:
   12607 %
   12608 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
   12609 %        const PixelWand *threshold)
   12610 %
   12611 %  A description of each parameter follows:
   12612 %
   12613 %    o wand: the magick wand.
   12614 %
   12615 %    o threshold: the pixel wand.
   12616 %
   12617 */
   12618 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
   12619   const PixelWand *threshold)
   12620 {
   12621   char
   12622     thresholds[MagickPathExtent];
   12623 
   12624   assert(wand != (MagickWand *) NULL);
   12625   assert(wand->signature == MagickWandSignature);
   12626   if (wand->debug != MagickFalse)
   12627     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12628   if (wand->images == (Image *) NULL)
   12629     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12630   (void) FormatLocaleString(thresholds,MagickPathExtent,
   12631     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
   12632     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
   12633     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
   12634   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
   12635 }
   12636 
   12637 /*
   12639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12640 %                                                                             %
   12641 %                                                                             %
   12642 %                                                                             %
   12643 %   M a g i c k W r i t e I m a g e                                           %
   12644 %                                                                             %
   12645 %                                                                             %
   12646 %                                                                             %
   12647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12648 %
   12649 %  MagickWriteImage() writes an image to the specified filename.  If the
   12650 %  filename parameter is NULL, the image is written to the filename set
   12651 %  by MagickReadImage() or MagickSetImageFilename().
   12652 %
   12653 %  The format of the MagickWriteImage method is:
   12654 %
   12655 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
   12656 %        const char *filename)
   12657 %
   12658 %  A description of each parameter follows:
   12659 %
   12660 %    o wand: the magick wand.
   12661 %
   12662 %    o filename: the image filename.
   12663 %
   12664 %
   12665 */
   12666 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
   12667   const char *filename)
   12668 {
   12669   Image
   12670     *image;
   12671 
   12672   ImageInfo
   12673     *write_info;
   12674 
   12675   MagickBooleanType
   12676     status;
   12677 
   12678   assert(wand != (MagickWand *) NULL);
   12679   assert(wand->signature == MagickWandSignature);
   12680   if (wand->debug != MagickFalse)
   12681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12682   if (wand->images == (Image *) NULL)
   12683     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12684   if (filename != (const char *) NULL)
   12685     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
   12686   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   12687   if (image == (Image *) NULL)
   12688     return(MagickFalse);
   12689   write_info=CloneImageInfo(wand->image_info);
   12690   write_info->adjoin=MagickTrue;
   12691   status=WriteImage(write_info,image,wand->exception);
   12692   image=DestroyImage(image);
   12693   write_info=DestroyImageInfo(write_info);
   12694   return(status);
   12695 }
   12696 
   12697 /*
   12699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12700 %                                                                             %
   12701 %                                                                             %
   12702 %                                                                             %
   12703 %   M a g i c k W r i t e I m a g e F i l e                                   %
   12704 %                                                                             %
   12705 %                                                                             %
   12706 %                                                                             %
   12707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12708 %
   12709 %  MagickWriteImageFile() writes an image to an open file descriptor.
   12710 %
   12711 %  The format of the MagickWriteImageFile method is:
   12712 %
   12713 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
   12714 %
   12715 %  A description of each parameter follows:
   12716 %
   12717 %    o wand: the magick wand.
   12718 %
   12719 %    o file: the file descriptor.
   12720 %
   12721 */
   12722 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
   12723 {
   12724   Image
   12725     *image;
   12726 
   12727   ImageInfo
   12728     *write_info;
   12729 
   12730   MagickBooleanType
   12731     status;
   12732 
   12733   assert(wand != (MagickWand *) NULL);
   12734   assert(wand->signature == MagickWandSignature);
   12735   assert(file != (FILE *) NULL);
   12736   if (wand->debug != MagickFalse)
   12737     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12738   if (wand->images == (Image *) NULL)
   12739     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12740   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
   12741   if (image == (Image *) NULL)
   12742     return(MagickFalse);
   12743   write_info=CloneImageInfo(wand->image_info);
   12744   SetImageInfoFile(write_info,file);
   12745   write_info->adjoin=MagickTrue;
   12746   status=WriteImage(write_info,image,wand->exception);
   12747   write_info=DestroyImageInfo(write_info);
   12748   image=DestroyImage(image);
   12749   return(status);
   12750 }
   12751 
   12752 /*
   12754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12755 %                                                                             %
   12756 %                                                                             %
   12757 %                                                                             %
   12758 %   M a g i c k W r i t e I m a g e s                                         %
   12759 %                                                                             %
   12760 %                                                                             %
   12761 %                                                                             %
   12762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12763 %
   12764 %  MagickWriteImages() writes an image or image sequence.
   12765 %
   12766 %  The format of the MagickWriteImages method is:
   12767 %
   12768 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
   12769 %        const char *filename,const MagickBooleanType adjoin)
   12770 %
   12771 %  A description of each parameter follows:
   12772 %
   12773 %    o wand: the magick wand.
   12774 %
   12775 %    o filename: the image filename.
   12776 %
   12777 %    o adjoin: join images into a single multi-image file.
   12778 %
   12779 */
   12780 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
   12781   const char *filename,const MagickBooleanType adjoin)
   12782 {
   12783   ImageInfo
   12784     *write_info;
   12785 
   12786   MagickBooleanType
   12787     status;
   12788 
   12789   assert(wand != (MagickWand *) NULL);
   12790   assert(wand->signature == MagickWandSignature);
   12791   if (wand->debug != MagickFalse)
   12792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12793   if (wand->images == (Image *) NULL)
   12794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12795   write_info=CloneImageInfo(wand->image_info);
   12796   write_info->adjoin=adjoin;
   12797   status=WriteImages(write_info,wand->images,filename,wand->exception);
   12798   write_info=DestroyImageInfo(write_info);
   12799   return(status);
   12800 }
   12801 
   12802 /*
   12804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12805 %                                                                             %
   12806 %                                                                             %
   12807 %                                                                             %
   12808 %   M a g i c k W r i t e I m a g e s F i l e                                 %
   12809 %                                                                             %
   12810 %                                                                             %
   12811 %                                                                             %
   12812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   12813 %
   12814 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
   12815 %
   12816 %  The format of the MagickWriteImagesFile method is:
   12817 %
   12818 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
   12819 %
   12820 %  A description of each parameter follows:
   12821 %
   12822 %    o wand: the magick wand.
   12823 %
   12824 %    o file: the file descriptor.
   12825 %
   12826 */
   12827 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
   12828 {
   12829   ImageInfo
   12830     *write_info;
   12831 
   12832   MagickBooleanType
   12833     status;
   12834 
   12835   assert(wand != (MagickWand *) NULL);
   12836   assert(wand->signature == MagickWandSignature);
   12837   if (wand->debug != MagickFalse)
   12838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
   12839   if (wand->images == (Image *) NULL)
   12840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
   12841   write_info=CloneImageInfo(wand->image_info);
   12842   SetImageInfoFile(write_info,file);
   12843   write_info->adjoin=MagickTrue;
   12844   status=WriteImages(write_info,wand->images,(const char *) NULL,
   12845     wand->exception);
   12846   write_info=DestroyImageInfo(write_info);
   12847   return(status);
   12848 }
   12849