magick-image.c revision d0792939dc18eff319129903f2627bd882a574aa
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7%                 MM MM  A   A  G        I    C      K  K                     %
8%                 M M M  AAAAA  G GGG    I    C      KKK                      %
9%                 M   M  A   A  G   G    I    C      K  K                     %
10%                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11%                                                                             %
12%                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13%                       I    MM MM  A   A  G      E                           %
14%                       I    M M M  AAAAA  G  GG  EEE                         %
15%                       I    M   M  A   A  G   G  E                           %
16%                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17%                                                                             %
18%                                                                             %
19%                          MagickWand Image Methods                           %
20%                                                                             %
21%                               Software Design                               %
22%                                    Cristy                                   %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
27%  dedicated to making software imaging solutions freely available.           %
28%                                                                             %
29%  You may not use this file except in compliance with the License.  You may  %
30%  obtain a copy of the License at                                            %
31%                                                                             %
32%    http://www.imagemagick.org/script/license.php                            %
33%                                                                             %
34%  Unless required by applicable law or agreed to in writing, software        %
35%  distributed under the License is distributed on an "AS IS" BASIS,          %
36%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37%  See the License for the specific language governing permissions and        %
38%  limitations under the License.                                             %
39%                                                                             %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47  Include declarations.
48*/
49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
54#include "MagickCore/image-private.h"
55
56/*
57  Define declarations.
58*/
59#define MagickWandId  "MagickWand"
60
61/*
62%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63%                                                                             %
64%                                                                             %
65%                                                                             %
66+   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                         %
67%                                                                             %
68%                                                                             %
69%                                                                             %
70%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71%
72%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
73%  list.
74%
75%  The format of the CloneMagickWandFromImages method is:
76%
77%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78%        Image *images)
79%
80%  A description of each parameter follows:
81%
82%    o wand: the magick wand.
83%
84%    o images: replace the image list with these image(s).
85%
86*/
87static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88  Image *images)
89{
90  MagickWand
91    *clone_wand;
92
93  assert(wand != (MagickWand *) NULL);
94  assert(wand->signature == MagickWandSignature);
95  if (wand->debug != MagickFalse)
96    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98  if (clone_wand == (MagickWand *) NULL)
99    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100      images->filename);
101  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
102  clone_wand->id=AcquireWandId();
103  (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
104    MagickWandId,(double) clone_wand->id);
105  clone_wand->exception=AcquireExceptionInfo();
106  InheritException(clone_wand->exception,wand->exception);
107  clone_wand->image_info=CloneImageInfo(wand->image_info);
108  clone_wand->images=images;
109  clone_wand->debug=IsEventLogging();
110  clone_wand->signature=MagickWandSignature;
111  if (clone_wand->debug != MagickFalse)
112    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113  return(clone_wand);
114}
115
116/*
117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118%                                                                             %
119%                                                                             %
120%                                                                             %
121%   G e t I m a g e F r o m M a g i c k W a n d                               %
122%                                                                             %
123%                                                                             %
124%                                                                             %
125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126%
127%  GetImageFromMagickWand() returns the current image from the magick wand.
128%
129%  The format of the GetImageFromMagickWand method is:
130%
131%      Image *GetImageFromMagickWand(const MagickWand *wand)
132%
133%  A description of each parameter follows:
134%
135%    o wand: the magick wand.
136%
137*/
138WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139{
140  assert(wand != (MagickWand *) NULL);
141  assert(wand->signature == MagickWandSignature);
142  if (wand->debug != MagickFalse)
143    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144  if (wand->images == (Image *) NULL)
145    {
146      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147        "ContainsNoImages","`%s'",wand->name);
148      return((Image *) NULL);
149    }
150  return(wand->images);
151}
152
153/*
154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155%                                                                             %
156%                                                                             %
157%                                                                             %
158%   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                       %
159%                                                                             %
160%                                                                             %
161%                                                                             %
162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163%
164%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165%  less intensely near image edges and more intensely far from edges. We
166%  blur the image with a Gaussian operator of the given radius and standard
167%  deviation (sigma).  For reasonable results, radius should be larger than
168%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169%  suitable radius for you.
170%
171%  The format of the MagickAdaptiveBlurImage method is:
172%
173%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
174%        const double radius,const double sigma)
175%
176%  A description of each parameter follows:
177%
178%    o wand: the magick wand.
179%
180%    o radius: the radius of the Gaussian, in pixels, not counting the center
181%      pixel.
182%
183%    o sigma: the standard deviation of the Gaussian, in pixels.
184%
185*/
186WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
187  const double radius,const double sigma)
188{
189  Image
190    *sharp_image;
191
192  assert(wand != (MagickWand *) NULL);
193  assert(wand->signature == MagickWandSignature);
194  if (wand->debug != MagickFalse)
195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196  if (wand->images == (Image *) NULL)
197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
198  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199  if (sharp_image == (Image *) NULL)
200    return(MagickFalse);
201  ReplaceImageInList(&wand->images,sharp_image);
202  return(MagickTrue);
203}
204
205/*
206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207%                                                                             %
208%                                                                             %
209%                                                                             %
210%   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                         %
211%                                                                             %
212%                                                                             %
213%                                                                             %
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%
216%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
217%  triangulation.
218%
219%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
220%        const size_t columns,const size_t rows)
221%
222%  A description of each parameter follows:
223%
224%    o wand: the magick wand.
225%
226%    o columns: the number of columns in the scaled image.
227%
228%    o rows: the number of rows in the scaled image.
229%
230*/
231WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
232  const size_t columns,const size_t rows)
233{
234  Image
235    *resize_image;
236
237  assert(wand != (MagickWand *) NULL);
238  assert(wand->signature == MagickWandSignature);
239  if (wand->debug != MagickFalse)
240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241  if (wand->images == (Image *) NULL)
242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
243  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244  if (resize_image == (Image *) NULL)
245    return(MagickFalse);
246  ReplaceImageInList(&wand->images,resize_image);
247  return(MagickTrue);
248}
249
250/*
251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252%                                                                             %
253%                                                                             %
254%                                                                             %
255%   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                       %
256%                                                                             %
257%                                                                             %
258%                                                                             %
259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260%
261%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262%  more intensely near image edges and less intensely far from edges. We
263%  sharpen the image with a Gaussian operator of the given radius and standard
264%  deviation (sigma).  For reasonable results, radius should be larger than
265%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266%  suitable radius for you.
267%
268%  The format of the MagickAdaptiveSharpenImage method is:
269%
270%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
271%        const double radius,const double sigma)
272%
273%  A description of each parameter follows:
274%
275%    o wand: the magick wand.
276%
277%    o radius: the radius of the Gaussian, in pixels, not counting the center
278%      pixel.
279%
280%    o sigma: the standard deviation of the Gaussian, in pixels.
281%
282*/
283WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
284  const double radius,const double sigma)
285{
286  Image
287    *sharp_image;
288
289  assert(wand != (MagickWand *) NULL);
290  assert(wand->signature == MagickWandSignature);
291  if (wand->debug != MagickFalse)
292    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293  if (wand->images == (Image *) NULL)
294    ThrowWandException(WandError,"ContainsNoImages",wand->name);
295  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296  if (sharp_image == (Image *) NULL)
297    return(MagickFalse);
298  ReplaceImageInList(&wand->images,sharp_image);
299  return(MagickTrue);
300}
301
302/*
303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304%                                                                             %
305%                                                                             %
306%                                                                             %
307%   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                   %
308%                                                                             %
309%                                                                             %
310%                                                                             %
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312%
313%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314%  based on the range of intensity values in its local neighborhood.  This
315%  allows for thresholding of an image whose global intensity histogram
316%  doesn't contain distinctive peaks.
317%
318%  The format of the AdaptiveThresholdImage method is:
319%
320%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
321%        const size_t width,const size_t height,const double bias)
322%
323%  A description of each parameter follows:
324%
325%    o wand: the magick wand.
326%
327%    o width: the width of the local neighborhood.
328%
329%    o height: the height of the local neighborhood.
330%
331%    o offset: the mean bias.
332%
333*/
334WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
335  const size_t width,const size_t height,const double bias)
336{
337  Image
338    *threshold_image;
339
340  assert(wand != (MagickWand *) NULL);
341  assert(wand->signature == MagickWandSignature);
342  if (wand->debug != MagickFalse)
343    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344  if (wand->images == (Image *) NULL)
345    ThrowWandException(WandError,"ContainsNoImages",wand->name);
346  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347    wand->exception);
348  if (threshold_image == (Image *) NULL)
349    return(MagickFalse);
350  ReplaceImageInList(&wand->images,threshold_image);
351  return(MagickTrue);
352}
353
354/*
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356%                                                                             %
357%                                                                             %
358%                                                                             %
359%   M a g i c k A d d I m a g e                                               %
360%                                                                             %
361%                                                                             %
362%                                                                             %
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364%
365%  MagickAddImage() adds a clone of the images from the second wand and
366%  inserts them into the first wand.
367%
368%  Use MagickSetLastIterator(), to append new images into an existing wand,
369%  current image will be set to last image so later adds with also be
370%  appened to end of wand.
371%
372%  Use MagickSetFirstIterator() to prepend new images into wand, any more
373%  images added will also be prepended before other images in the wand.
374%  However the order of a list of new images will not change.
375%
376%  Otherwise the new images will be inserted just after the current image,
377%  and any later image will also be added after this current image but
378%  before the previously added images.  Caution is advised when multiple
379%  image adds are inserted into the middle of the wand image list.
380%
381%  The format of the MagickAddImage method is:
382%
383%      MagickBooleanType MagickAddImage(MagickWand *wand,
384%        const MagickWand *add_wand)
385%
386%  A description of each parameter follows:
387%
388%    o wand: the magick wand.
389%
390%    o add_wand: A wand that contains the image list to be added
391%
392*/
393static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394  Image *images)
395{
396  if (wand->images == (Image *) NULL)
397    {
398      /*
399        No images in wand, just add them, set current as appropriate.
400      */
401      if (wand->insert_before != MagickFalse)
402        wand->images=GetFirstImageInList(images);
403      else
404        wand->images=GetLastImageInList(images);
405      return(MagickTrue);
406    }
407  /* user jumped to first image, so prepend new images - remain active */
408  if ((wand->insert_before != MagickFalse) &&
409       (wand->images->previous == (Image *) NULL))
410    {
411      PrependImageToList(&wand->images,images);
412      wand->images=GetFirstImageInList(images);
413      return(MagickTrue);
414    }
415  /*
416    Note you should never have 'insert_before' true when current image is not
417    the first image in the wand!  That is no insert before current image, only
418    after current image
419  */
420  if (wand->images->next == (Image *) NULL)
421    {
422      /*
423        At last image, append new images.
424      */
425      InsertImageInList(&wand->images,images);
426      wand->images=GetLastImageInList(images);
427      return(MagickTrue);
428    }
429  /*
430    Insert new images, just after the current image.
431  */
432  InsertImageInList(&wand->images,images);
433  return(MagickTrue);
434}
435
436WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437  const MagickWand *add_wand)
438{
439  Image
440    *images;
441
442  assert(wand != (MagickWand *) NULL);
443  assert(wand->signature == MagickWandSignature);
444  if (wand->debug != MagickFalse)
445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446  assert(add_wand != (MagickWand *) NULL);
447  assert(add_wand->signature == MagickWandSignature);
448  if (add_wand->images == (Image *) NULL)
449    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450  /*
451    Clone images in second wand, and insert into first.
452  */
453  images=CloneImageList(add_wand->images,wand->exception);
454  if (images == (Image *) NULL)
455    return(MagickFalse);
456  return(InsertImageInWand(wand,images));
457}
458
459/*
460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461%                                                                             %
462%                                                                             %
463%                                                                             %
464%     M a g i c k A d d N o i s e I m a g e                                   %
465%                                                                             %
466%                                                                             %
467%                                                                             %
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470%  MagickAddNoiseImage() adds random noise to the image.
471%
472%  The format of the MagickAddNoiseImage method is:
473%
474%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475%        const NoiseType noise_type,const double attenuate)
476%
477%  A description of each parameter follows:
478%
479%    o wand: the magick wand.
480%
481%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
482%      Impulse, Laplacian, or Poisson.
483%
484%    o attenuate:  attenuate the random distribution.
485%
486*/
487WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488  const NoiseType noise_type,const double attenuate)
489{
490  Image
491    *noise_image;
492
493  assert(wand != (MagickWand *) NULL);
494  assert(wand->signature == MagickWandSignature);
495  if (wand->debug != MagickFalse)
496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497  if (wand->images == (Image *) NULL)
498    ThrowWandException(WandError,"ContainsNoImages",wand->name);
499  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500  if (noise_image == (Image *) NULL)
501    return(MagickFalse);
502  ReplaceImageInList(&wand->images,noise_image);
503  return(MagickTrue);
504}
505
506/*
507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508%                                                                             %
509%                                                                             %
510%                                                                             %
511%   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                       %
512%                                                                             %
513%                                                                             %
514%                                                                             %
515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516%
517%  MagickAffineTransformImage() transforms an image as dictated by the affine
518%  matrix of the drawing wand.
519%
520%  The format of the MagickAffineTransformImage method is:
521%
522%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523%        const DrawingWand *drawing_wand)
524%
525%  A description of each parameter follows:
526%
527%    o wand: the magick wand.
528%
529%    o drawing_wand: the draw wand.
530%
531*/
532WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533  const DrawingWand *drawing_wand)
534{
535  DrawInfo
536    *draw_info;
537
538  Image
539    *affine_image;
540
541  assert(wand != (MagickWand *) NULL);
542  assert(wand->signature == MagickWandSignature);
543  if (wand->debug != MagickFalse)
544    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545  if (wand->images == (Image *) NULL)
546    ThrowWandException(WandError,"ContainsNoImages",wand->name);
547  draw_info=PeekDrawingWand(drawing_wand);
548  if (draw_info == (DrawInfo *) NULL)
549    return(MagickFalse);
550  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551    wand->exception);
552  draw_info=DestroyDrawInfo(draw_info);
553  if (affine_image == (Image *) NULL)
554    return(MagickFalse);
555  ReplaceImageInList(&wand->images,affine_image);
556  return(MagickTrue);
557}
558
559/*
560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561%                                                                             %
562%                                                                             %
563%                                                                             %
564%   M a g i c k A n n o t a t e I m a g e                                     %
565%                                                                             %
566%                                                                             %
567%                                                                             %
568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569%
570%  MagickAnnotateImage() annotates an image with text.
571%
572%  The format of the MagickAnnotateImage method is:
573%
574%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575%        const DrawingWand *drawing_wand,const double x,const double y,
576%        const double angle,const char *text)
577%
578%  A description of each parameter follows:
579%
580%    o wand: the magick wand.
581%
582%    o drawing_wand: the draw wand.
583%
584%    o x: x ordinate to left of text
585%
586%    o y: y ordinate to text baseline
587%
588%    o angle: rotate text relative to this angle.
589%
590%    o text: text to draw
591%
592*/
593WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594  const DrawingWand *drawing_wand,const double x,const double y,
595  const double angle,const char *text)
596{
597  char
598    geometry[MagickPathExtent];
599
600  DrawInfo
601    *draw_info;
602
603  MagickBooleanType
604    status;
605
606  assert(wand != (MagickWand *) NULL);
607  assert(wand->signature == MagickWandSignature);
608  if (wand->debug != MagickFalse)
609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610  if (wand->images == (Image *) NULL)
611    ThrowWandException(WandError,"ContainsNoImages",wand->name);
612  draw_info=PeekDrawingWand(drawing_wand);
613  if (draw_info == (DrawInfo *) NULL)
614    return(MagickFalse);
615  (void) CloneString(&draw_info->text,text);
616  (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621  (void) CloneString(&draw_info->geometry,geometry);
622  status=AnnotateImage(wand->images,draw_info,wand->exception);
623  draw_info=DestroyDrawInfo(draw_info);
624  return(status);
625}
626
627/*
628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629%                                                                             %
630%                                                                             %
631%                                                                             %
632%   M a g i c k A n i m a t e I m a g e s                                     %
633%                                                                             %
634%                                                                             %
635%                                                                             %
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%
638%  MagickAnimateImages() animates an image or image sequence.
639%
640%  The format of the MagickAnimateImages method is:
641%
642%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
643%        const char *server_name)
644%
645%  A description of each parameter follows:
646%
647%    o wand: the magick wand.
648%
649%    o server_name: the X server name.
650%
651*/
652WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653  const char *server_name)
654{
655  MagickBooleanType
656    status;
657
658  assert(wand != (MagickWand *) NULL);
659  assert(wand->signature == MagickWandSignature);
660  if (wand->debug != MagickFalse)
661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662  (void) CloneString(&wand->image_info->server_name,server_name);
663  status=AnimateImages(wand->image_info,wand->images,wand->exception);
664  return(status);
665}
666
667/*
668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669%                                                                             %
670%                                                                             %
671%                                                                             %
672%   M a g i c k A p p e n d I m a g e s                                       %
673%                                                                             %
674%                                                                             %
675%                                                                             %
676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677%
678%  MagickAppendImages() append the images in a wand from the current image
679%  onwards, creating a new wand with the single image result.  This is
680%  affected by the gravity and background settings of the first image.
681%
682%  Typically you would call either MagickResetIterator() or
683%  MagickSetFirstImage() before calling this function to ensure that all
684%  the images in the wand's image list will be appended together.
685%
686%  The format of the MagickAppendImages method is:
687%
688%      MagickWand *MagickAppendImages(MagickWand *wand,
689%        const MagickBooleanType stack)
690%
691%  A description of each parameter follows:
692%
693%    o wand: the magick wand.
694%
695%    o stack: By default, images are stacked left-to-right. Set stack to
696%      MagickTrue to stack them top-to-bottom.
697%
698*/
699WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700  const MagickBooleanType stack)
701{
702  Image
703    *append_image;
704
705  assert(wand != (MagickWand *) NULL);
706  assert(wand->signature == MagickWandSignature);
707  if (wand->debug != MagickFalse)
708    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709  if (wand->images == (Image *) NULL)
710    return((MagickWand *) NULL);
711  append_image=AppendImages(wand->images,stack,wand->exception);
712  if (append_image == (Image *) NULL)
713    return((MagickWand *) NULL);
714  return(CloneMagickWandFromImages(wand,append_image));
715}
716
717/*
718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719%                                                                             %
720%                                                                             %
721%                                                                             %
722%   M a g i c k A u t o G a m m a I m a g e                                   %
723%                                                                             %
724%                                                                             %
725%                                                                             %
726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727%
728%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729%  image to try make set its gamma appropriatally.
730%
731%  The format of the MagickAutoGammaImage method is:
732%
733%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734%
735%  A description of each parameter follows:
736%
737%    o wand: the magick wand.
738%
739*/
740WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741{
742  MagickBooleanType
743    status;
744
745  assert(wand != (MagickWand *) NULL);
746  assert(wand->signature == MagickWandSignature);
747  if (wand->debug != MagickFalse)
748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749  if (wand->images == (Image *) NULL)
750    ThrowWandException(WandError,"ContainsNoImages",wand->name);
751  status=AutoGammaImage(wand->images,wand->exception);
752  return(status);
753}
754
755/*
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757%                                                                             %
758%                                                                             %
759%                                                                             %
760%   M a g i c k A u t o L e v e l I m a g e                                   %
761%                                                                             %
762%                                                                             %
763%                                                                             %
764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765%
766%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
767%  scaling the minimum and maximum values to the full quantum range.
768%
769%  The format of the MagickAutoLevelImage method is:
770%
771%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772%
773%  A description of each parameter follows:
774%
775%    o wand: the magick wand.
776%
777*/
778WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779{
780  MagickBooleanType
781    status;
782
783  assert(wand != (MagickWand *) NULL);
784  assert(wand->signature == MagickWandSignature);
785  if (wand->debug != MagickFalse)
786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787  if (wand->images == (Image *) NULL)
788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
789  status=AutoLevelImage(wand->images,wand->exception);
790  return(status);
791}
792
793/*
794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795%                                                                             %
796%                                                                             %
797%                                                                             %
798%   M a g i c k A u t o O r i e n t I m a g e                                 %
799%                                                                             %
800%                                                                             %
801%                                                                             %
802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803%
804%  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805$  for viewing (i.e. top-left orientation).
806%
807%  The format of the MagickAutoOrientImage method is:
808%
809%      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810%
811%  A description of each parameter follows:
812%
813%    o wand: the magick wand.
814%
815*/
816WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817{
818
819  Image
820    *orient_image;
821
822  assert(wand != (MagickWand *) NULL);
823  assert(wand->signature == MagickWandSignature);
824  if (wand->debug != MagickFalse)
825    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826  if (wand->images == (Image *) NULL)
827    ThrowWandException(WandError,"ContainsNoImages",wand->name);
828  orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829    wand->exception);
830  if (orient_image == (Image *) NULL)
831    return(MagickFalse);
832  ReplaceImageInList(&wand->images,orient_image);
833  return(MagickTrue);
834}
835
836/*
837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838%                                                                             %
839%                                                                             %
840%                                                                             %
841%   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                         %
842%                                                                             %
843%                                                                             %
844%                                                                             %
845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846%
847%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
848%  pixels below the threshold into black while leaving all pixels above the
849%  threshold unchanged.
850%
851%  The format of the MagickBlackThresholdImage method is:
852%
853%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
854%        const PixelWand *threshold)
855%
856%  A description of each parameter follows:
857%
858%    o wand: the magick wand.
859%
860%    o threshold: the pixel wand.
861%
862*/
863WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
864  const PixelWand *threshold)
865{
866  char
867    thresholds[MagickPathExtent];
868
869  MagickBooleanType
870    status;
871
872  assert(wand != (MagickWand *) NULL);
873  assert(wand->signature == MagickWandSignature);
874  if (wand->debug != MagickFalse)
875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876  if (wand->images == (Image *) NULL)
877    ThrowWandException(WandError,"ContainsNoImages",wand->name);
878  (void) FormatLocaleString(thresholds,MagickPathExtent,
879    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
881    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
882  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
883  return(status);
884}
885
886/*
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888%                                                                             %
889%                                                                             %
890%                                                                             %
891%   M a g i c k B l u e S h i f t I m a g e                                   %
892%                                                                             %
893%                                                                             %
894%                                                                             %
895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896%
897%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
898%  nighttime in the moonlight.
899%
900%  The format of the MagickBlueShiftImage method is:
901%
902%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
903%        const double factor)
904%
905%  A description of each parameter follows:
906%
907%    o wand: the magick wand.
908%
909%    o factor: the blue shift factor (default 1.5)
910%
911*/
912WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
913  const double factor)
914{
915  Image
916    *shift_image;
917
918  assert(wand != (MagickWand *) NULL);
919  assert(wand->signature == MagickWandSignature);
920  if (wand->debug != MagickFalse)
921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
922  if (wand->images == (Image *) NULL)
923    ThrowWandException(WandError,"ContainsNoImages",wand->name);
924  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
925  if (shift_image == (Image *) NULL)
926    return(MagickFalse);
927  ReplaceImageInList(&wand->images,shift_image);
928  return(MagickTrue);
929}
930
931/*
932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933%                                                                             %
934%                                                                             %
935%                                                                             %
936%   M a g i c k B l u r I m a g e                                             %
937%                                                                             %
938%                                                                             %
939%                                                                             %
940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941%
942%  MagickBlurImage() blurs an image.  We convolve the image with a
943%  gaussian operator of the given radius and standard deviation (sigma).
944%  For reasonable results, the radius should be larger than sigma.  Use a
945%  radius of 0 and BlurImage() selects a suitable radius for you.
946%
947%  The format of the MagickBlurImage method is:
948%
949%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
950%        const double sigma)
951%
952%  A description of each parameter follows:
953%
954%    o wand: the magick wand.
955%
956%    o radius: the radius of the , in pixels, not counting the center
957%      pixel.
958%
959%    o sigma: the standard deviation of the , in pixels.
960%
961*/
962WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
963  const double radius,const double sigma)
964{
965  Image
966    *blur_image;
967
968  assert(wand != (MagickWand *) NULL);
969  assert(wand->signature == MagickWandSignature);
970  if (wand->debug != MagickFalse)
971    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972  if (wand->images == (Image *) NULL)
973    ThrowWandException(WandError,"ContainsNoImages",wand->name);
974  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
975  if (blur_image == (Image *) NULL)
976    return(MagickFalse);
977  ReplaceImageInList(&wand->images,blur_image);
978  return(MagickTrue);
979}
980
981/*
982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983%                                                                             %
984%                                                                             %
985%                                                                             %
986%   M a g i c k B o r d e r I m a g e                                         %
987%                                                                             %
988%                                                                             %
989%                                                                             %
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991%
992%  MagickBorderImage() surrounds the image with a border of the color defined
993%  by the bordercolor pixel wand.
994%
995%  The format of the MagickBorderImage method is:
996%
997%      MagickBooleanType MagickBorderImage(MagickWand *wand,
998%        const PixelWand *bordercolor,const size_t width,
999%        const size_t height,const CompositeOperator compose)
1000%
1001%  A description of each parameter follows:
1002%
1003%    o wand: the magick wand.
1004%
1005%    o bordercolor: the border color pixel wand.
1006%
1007%    o width: the border width.
1008%
1009%    o height: the border height.
1010%
1011%    o compose: the composite operator.
1012%
1013*/
1014WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1015  const PixelWand *bordercolor,const size_t width,const size_t height,
1016  const CompositeOperator compose)
1017{
1018  Image
1019    *border_image;
1020
1021  RectangleInfo
1022    border_info;
1023
1024  assert(wand != (MagickWand *) NULL);
1025  assert(wand->signature == MagickWandSignature);
1026  if (wand->debug != MagickFalse)
1027    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1028  if (wand->images == (Image *) NULL)
1029    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1030  border_info.width=width;
1031  border_info.height=height;
1032  border_info.x=0;
1033  border_info.y=0;
1034  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1035  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1036  if (border_image == (Image *) NULL)
1037    return(MagickFalse);
1038  ReplaceImageInList(&wand->images,border_image);
1039  return(MagickTrue);
1040}
1041
1042/*
1043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044%                                                                             %
1045%                                                                             %
1046%                                                                             %
1047%   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   %
1048%                                                                             %
1049%                                                                             %
1050%                                                                             %
1051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052%
1053%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1054%  of an image.  It converts the brightness and contrast parameters into slope
1055%  and intercept and calls a polynomical function to apply to the image.
1056
1057%
1058%  The format of the MagickBrightnessContrastImage method is:
1059%
1060%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1061%        const double brightness,const double contrast)
1062%
1063%  A description of each parameter follows:
1064%
1065%    o wand: the magick wand.
1066%
1067%    o brightness: the brightness percent (-100 .. 100).
1068%
1069%    o contrast: the contrast percent (-100 .. 100).
1070%
1071*/
1072WandExport MagickBooleanType MagickBrightnessContrastImage(
1073  MagickWand *wand,const double brightness,const double contrast)
1074{
1075  MagickBooleanType
1076    status;
1077
1078  assert(wand != (MagickWand *) NULL);
1079  assert(wand->signature == MagickWandSignature);
1080  if (wand->debug != MagickFalse)
1081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082  if (wand->images == (Image *) NULL)
1083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1084  status=BrightnessContrastImage(wand->images,brightness,contrast,
1085    wand->exception);
1086  return(status);
1087}
1088
1089/*
1090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091%                                                                             %
1092%                                                                             %
1093%                                                                             %
1094%   M a g i c k C h a n n e l F x I m a g e                                   %
1095%                                                                             %
1096%                                                                             %
1097%                                                                             %
1098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099%
1100%  MagickChannelFxImage() applies a channel expression to the specified image.
1101%  The expression consists of one or more channels, either mnemonic or numeric
1102%  (e.g. red, 1), separated by actions as follows:
1103%
1104%    <=>     exchange two channels (e.g. red<=>blue)
1105%    =>      transfer a channel to another (e.g. red=>green)
1106%    ,       separate channel operations (e.g. red, green)
1107%    |       read channels from next input image (e.g. red | green)
1108%    ;       write channels to next output image (e.g. red; green; blue)
1109%
1110%  A channel without a operation symbol implies extract. For example, to create
1111%  3 grayscale images from the red, green, and blue channels of an image, use:
1112%
1113%    -channel-fx "red; green; blue"
1114%
1115%  The format of the MagickChannelFxImage method is:
1116%
1117%      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1118%
1119%  A description of each parameter follows:
1120%
1121%    o wand: the magick wand.
1122%
1123%    o expression: the expression.
1124%
1125*/
1126WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1127  const char *expression)
1128{
1129  Image
1130    *fx_image;
1131
1132  assert(wand != (MagickWand *) NULL);
1133  assert(wand->signature == MagickWandSignature);
1134  if (wand->debug != MagickFalse)
1135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1136  if (wand->images == (Image *) NULL)
1137    return((MagickWand *) NULL);
1138  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1139  if (fx_image == (Image *) NULL)
1140    return((MagickWand *) NULL);
1141  return(CloneMagickWandFromImages(wand,fx_image));
1142}
1143
1144/*
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%                                                                             %
1147%                                                                             %
1148%                                                                             %
1149%   M a g i c k C h a r c o a l I m a g e                                     %
1150%                                                                             %
1151%                                                                             %
1152%                                                                             %
1153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154%
1155%  MagickCharcoalImage() simulates a charcoal drawing.
1156%
1157%  The format of the MagickCharcoalImage method is:
1158%
1159%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160%        const double radius,const double sigma)
1161%
1162%  A description of each parameter follows:
1163%
1164%    o wand: the magick wand.
1165%
1166%    o radius: the radius of the Gaussian, in pixels, not counting the center
1167%      pixel.
1168%
1169%    o sigma: the standard deviation of the Gaussian, in pixels.
1170%
1171*/
1172WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173  const double radius,const double sigma)
1174{
1175  Image
1176    *charcoal_image;
1177
1178  assert(wand != (MagickWand *) NULL);
1179  assert(wand->signature == MagickWandSignature);
1180  if (wand->debug != MagickFalse)
1181    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182  if (wand->images == (Image *) NULL)
1183    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185  if (charcoal_image == (Image *) NULL)
1186    return(MagickFalse);
1187  ReplaceImageInList(&wand->images,charcoal_image);
1188  return(MagickTrue);
1189}
1190
1191/*
1192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193%                                                                             %
1194%                                                                             %
1195%                                                                             %
1196%   M a g i c k C h o p I m a g e                                             %
1197%                                                                             %
1198%                                                                             %
1199%                                                                             %
1200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201%
1202%  MagickChopImage() removes a region of an image and collapses the image to
1203%  occupy the removed portion
1204%
1205%  The format of the MagickChopImage method is:
1206%
1207%      MagickBooleanType MagickChopImage(MagickWand *wand,
1208%        const size_t width,const size_t height,const ssize_t x,
1209%        const ssize_t y)
1210%
1211%  A description of each parameter follows:
1212%
1213%    o wand: the magick wand.
1214%
1215%    o width: the region width.
1216%
1217%    o height: the region height.
1218%
1219%    o x: the region x offset.
1220%
1221%    o y: the region y offset.
1222%
1223%
1224*/
1225WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226  const size_t width,const size_t height,const ssize_t x,
1227  const ssize_t y)
1228{
1229  Image
1230    *chop_image;
1231
1232  RectangleInfo
1233    chop;
1234
1235  assert(wand != (MagickWand *) NULL);
1236  assert(wand->signature == MagickWandSignature);
1237  if (wand->debug != MagickFalse)
1238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239  if (wand->images == (Image *) NULL)
1240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241  chop.width=width;
1242  chop.height=height;
1243  chop.x=x;
1244  chop.y=y;
1245  chop_image=ChopImage(wand->images,&chop,wand->exception);
1246  if (chop_image == (Image *) NULL)
1247    return(MagickFalse);
1248  ReplaceImageInList(&wand->images,chop_image);
1249  return(MagickTrue);
1250}
1251
1252/*
1253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254%                                                                             %
1255%                                                                             %
1256%                                                                             %
1257%   M a g i c k C l a m p I m a g e                                           %
1258%                                                                             %
1259%                                                                             %
1260%                                                                             %
1261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262%
1263%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1264%
1265%  The format of the MagickClampImage method is:
1266%
1267%      MagickBooleanType MagickClampImage(MagickWand *wand)
1268%
1269%  A description of each parameter follows:
1270%
1271%    o wand: the magick wand.
1272%
1273%    o channel: the channel.
1274%
1275*/
1276WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1277{
1278  assert(wand != (MagickWand *) NULL);
1279  assert(wand->signature == MagickWandSignature);
1280  if (wand->debug != MagickFalse)
1281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1282  if (wand->images == (Image *) NULL)
1283    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1284  return(ClampImage(wand->images,wand->exception));
1285}
1286
1287/*
1288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289%                                                                             %
1290%                                                                             %
1291%                                                                             %
1292%   M a g i c k C l i p I m a g e                                             %
1293%                                                                             %
1294%                                                                             %
1295%                                                                             %
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297%
1298%  MagickClipImage() clips along the first path from the 8BIM profile, if
1299%  present.
1300%
1301%  The format of the MagickClipImage method is:
1302%
1303%      MagickBooleanType MagickClipImage(MagickWand *wand)
1304%
1305%  A description of each parameter follows:
1306%
1307%    o wand: the magick wand.
1308%
1309*/
1310WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1311{
1312  MagickBooleanType
1313    status;
1314
1315  assert(wand != (MagickWand *) NULL);
1316  assert(wand->signature == MagickWandSignature);
1317  if (wand->debug != MagickFalse)
1318    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319  if (wand->images == (Image *) NULL)
1320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1321  status=ClipImage(wand->images,wand->exception);
1322  return(status);
1323}
1324
1325/*
1326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327%                                                                             %
1328%                                                                             %
1329%                                                                             %
1330%   M a g i c k C l i p I m a g e P a t h                                     %
1331%                                                                             %
1332%                                                                             %
1333%                                                                             %
1334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335%
1336%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1337%  present. Later operations take effect inside the path.  Id may be a number
1338%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1339%  path.
1340%
1341%  The format of the MagickClipImagePath method is:
1342%
1343%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1344%        const char *pathname,const MagickBooleanType inside)
1345%
1346%  A description of each parameter follows:
1347%
1348%    o wand: the magick wand.
1349%
1350%    o pathname: name of clipping path resource. If name is preceded by #, use
1351%      clipping path numbered by name.
1352%
1353%    o inside: if non-zero, later operations take effect inside clipping path.
1354%      Otherwise later operations take effect outside clipping path.
1355%
1356*/
1357WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1358  const char *pathname,const MagickBooleanType inside)
1359{
1360  MagickBooleanType
1361    status;
1362
1363  assert(wand != (MagickWand *) NULL);
1364  assert(wand->signature == MagickWandSignature);
1365  if (wand->debug != MagickFalse)
1366    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367  if (wand->images == (Image *) NULL)
1368    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1369  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1370  return(status);
1371}
1372
1373/*
1374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375%                                                                             %
1376%                                                                             %
1377%                                                                             %
1378%   M a g i c k C l u t I m a g e                                             %
1379%                                                                             %
1380%                                                                             %
1381%                                                                             %
1382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383%
1384%  MagickClutImage() replaces colors in the image from a color lookup table.
1385%
1386%  The format of the MagickClutImage method is:
1387%
1388%      MagickBooleanType MagickClutImage(MagickWand *wand,
1389%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1390%
1391%  A description of each parameter follows:
1392%
1393%    o wand: the magick wand.
1394%
1395%    o clut_image: the clut image.
1396%
1397%    o method: the pixel interpolation method.
1398%
1399*/
1400WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1401  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1402{
1403  MagickBooleanType
1404    status;
1405
1406  assert(wand != (MagickWand *) NULL);
1407  assert(wand->signature == MagickWandSignature);
1408  if (wand->debug != MagickFalse)
1409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1412  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1413  return(status);
1414}
1415
1416/*
1417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418%                                                                             %
1419%                                                                             %
1420%                                                                             %
1421%   M a g i c k C o a l e s c e I m a g e s                                   %
1422%                                                                             %
1423%                                                                             %
1424%                                                                             %
1425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426%
1427%  MagickCoalesceImages() composites a set of images while respecting any page
1428%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1429%  typically start with an image background and each subsequent image
1430%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1431%  where each image in the sequence is the same size as the first and
1432%  composited with the next image in the sequence.
1433%
1434%  The format of the MagickCoalesceImages method is:
1435%
1436%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1437%
1438%  A description of each parameter follows:
1439%
1440%    o wand: the magick wand.
1441%
1442*/
1443WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1444{
1445  Image
1446    *coalesce_image;
1447
1448  assert(wand != (MagickWand *) NULL);
1449  assert(wand->signature == MagickWandSignature);
1450  if (wand->debug != MagickFalse)
1451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1452  if (wand->images == (Image *) NULL)
1453    return((MagickWand *) NULL);
1454  coalesce_image=CoalesceImages(wand->images,wand->exception);
1455  if (coalesce_image == (Image *) NULL)
1456    return((MagickWand *) NULL);
1457  return(CloneMagickWandFromImages(wand,coalesce_image));
1458}
1459
1460/*
1461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462%                                                                             %
1463%                                                                             %
1464%                                                                             %
1465%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1466%                                                                             %
1467%                                                                             %
1468%                                                                             %
1469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470%
1471%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1472%  Collection (CCC) file which solely contains one or more color corrections
1473%  and applies the color correction to the image.  Here is a sample CCC file:
1474%
1475%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1476%          <ColorCorrection id="cc03345">
1477%                <SOPNode>
1478%                     <Slope> 0.9 1.2 0.5 </Slope>
1479%                     <Offset> 0.4 -0.5 0.6 </Offset>
1480%                     <Power> 1.0 0.8 1.5 </Power>
1481%                </SOPNode>
1482%                <SATNode>
1483%                     <Saturation> 0.85 </Saturation>
1484%                </SATNode>
1485%          </ColorCorrection>
1486%    </ColorCorrectionCollection>
1487%
1488%  which includes the offset, slope, and power for each of the RGB channels
1489%  as well as the saturation.
1490%
1491%  The format of the MagickColorDecisionListImage method is:
1492%
1493%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1494%        const char *color_correction_collection)
1495%
1496%  A description of each parameter follows:
1497%
1498%    o wand: the magick wand.
1499%
1500%    o color_correction_collection: the color correction collection in XML.
1501%
1502*/
1503WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1504  const char *color_correction_collection)
1505{
1506  MagickBooleanType
1507    status;
1508
1509  assert(wand != (MagickWand *) NULL);
1510  assert(wand->signature == MagickWandSignature);
1511  if (wand->debug != MagickFalse)
1512    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513  if (wand->images == (Image *) NULL)
1514    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1515  status=ColorDecisionListImage(wand->images,color_correction_collection,
1516    wand->exception);
1517  return(status);
1518}
1519
1520/*
1521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522%                                                                             %
1523%                                                                             %
1524%                                                                             %
1525%   M a g i c k C o l o r i z e I m a g e                                     %
1526%                                                                             %
1527%                                                                             %
1528%                                                                             %
1529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530%
1531%  MagickColorizeImage() blends the fill color with each pixel in the image.
1532%
1533%  The format of the MagickColorizeImage method is:
1534%
1535%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1536%        const PixelWand *colorize,const PixelWand *blend)
1537%
1538%  A description of each parameter follows:
1539%
1540%    o wand: the magick wand.
1541%
1542%    o colorize: the colorize pixel wand.
1543%
1544%    o alpha: the alpha pixel wand.
1545%
1546*/
1547WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1548  const PixelWand *colorize,const PixelWand *blend)
1549{
1550  char
1551    percent_blend[MagickPathExtent];
1552
1553  Image
1554    *colorize_image;
1555
1556  PixelInfo
1557    target;
1558
1559  assert(wand != (MagickWand *) NULL);
1560  assert(wand->signature == MagickWandSignature);
1561  if (wand->debug != MagickFalse)
1562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563  if (wand->images == (Image *) NULL)
1564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1565  GetPixelInfo(wand->images,&target);
1566  if (target.colorspace != CMYKColorspace)
1567    (void) FormatLocaleString(percent_blend,MagickPathExtent,
1568      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1569      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1570      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1571      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1572      PixelGetAlphaQuantum(blend)));
1573  else
1574    (void) FormatLocaleString(percent_blend,MagickPathExtent,
1575      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1576      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1577      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1578      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1579      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1580      PixelGetAlphaQuantum(blend)));
1581  target=PixelGetPixel(colorize);
1582  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1583    wand->exception);
1584  if (colorize_image == (Image *) NULL)
1585    return(MagickFalse);
1586  ReplaceImageInList(&wand->images,colorize_image);
1587  return(MagickTrue);
1588}
1589
1590/*
1591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592%                                                                             %
1593%                                                                             %
1594%                                                                             %
1595%   M a g i c k C o l o r M a t r i x I m a g e                               %
1596%                                                                             %
1597%                                                                             %
1598%                                                                             %
1599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1600%
1601%  MagickColorMatrixImage() apply color transformation to an image. The method
1602%  permits saturation changes, hue rotation, luminance to alpha, and various
1603%  other effects.  Although variable-sized transformation matrices can be used,
1604%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1605%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1606%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1607%  and offsets are normalized (divide Flash offset by 255).
1608%
1609%  The format of the MagickColorMatrixImage method is:
1610%
1611%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1612%        const KernelInfo *color_matrix)
1613%
1614%  A description of each parameter follows:
1615%
1616%    o wand: the magick wand.
1617%
1618%    o color_matrix:  the color matrix.
1619%
1620*/
1621WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1622  const KernelInfo *color_matrix)
1623{
1624  Image
1625    *color_image;
1626
1627  assert(wand != (MagickWand *) NULL);
1628  assert(wand->signature == MagickWandSignature);
1629  if (wand->debug != MagickFalse)
1630    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1631  if (color_matrix == (const KernelInfo *) NULL)
1632    return(MagickFalse);
1633  if (wand->images == (Image *) NULL)
1634    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1635  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1636  if (color_image == (Image *) NULL)
1637    return(MagickFalse);
1638  ReplaceImageInList(&wand->images,color_image);
1639  return(MagickTrue);
1640}
1641
1642/*
1643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644%                                                                             %
1645%                                                                             %
1646%                                                                             %
1647%   M a g i c k C o m b i n e I m a g e s                                     %
1648%                                                                             %
1649%                                                                             %
1650%                                                                             %
1651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652%
1653%  MagickCombineImages() combines one or more images into a single image.  The
1654%  grayscale value of the pixels of each image in the sequence is assigned in
1655%  order to the specified  hannels of the combined image.   The typical
1656%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1657%
1658%  The format of the MagickCombineImages method is:
1659%
1660%      MagickWand *MagickCombineImages(MagickWand *wand,
1661%        const ColorspaceType colorspace)
1662%
1663%  A description of each parameter follows:
1664%
1665%    o wand: the magick wand.
1666%
1667%    o colorspace: the colorspace.
1668%
1669*/
1670WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1671  const ColorspaceType colorspace)
1672{
1673  Image
1674    *combine_image;
1675
1676  assert(wand != (MagickWand *) NULL);
1677  assert(wand->signature == MagickWandSignature);
1678  if (wand->debug != MagickFalse)
1679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680  if (wand->images == (Image *) NULL)
1681    return((MagickWand *) NULL);
1682  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1683  if (combine_image == (Image *) NULL)
1684    return((MagickWand *) NULL);
1685  return(CloneMagickWandFromImages(wand,combine_image));
1686}
1687
1688/*
1689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1690%                                                                             %
1691%                                                                             %
1692%                                                                             %
1693%   M a g i c k C o m m e n t I m a g e                                       %
1694%                                                                             %
1695%                                                                             %
1696%                                                                             %
1697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698%
1699%  MagickCommentImage() adds a comment to your image.
1700%
1701%  The format of the MagickCommentImage method is:
1702%
1703%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1704%        const char *comment)
1705%
1706%  A description of each parameter follows:
1707%
1708%    o wand: the magick wand.
1709%
1710%    o comment: the image comment.
1711%
1712*/
1713WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1714  const char *comment)
1715{
1716  MagickBooleanType
1717    status;
1718
1719  assert(wand != (MagickWand *) NULL);
1720  assert(wand->signature == MagickWandSignature);
1721  if (wand->debug != MagickFalse)
1722    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723  if (wand->images == (Image *) NULL)
1724    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1725  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1726  return(status);
1727}
1728
1729/*
1730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731%                                                                             %
1732%                                                                             %
1733%                                                                             %
1734%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1735%                                                                             %
1736%                                                                             %
1737%                                                                             %
1738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739%
1740%  MagickCompareImagesLayers() compares each image with the next in a sequence
1741%  and returns the maximum bounding region of any pixel differences it
1742%  discovers.
1743%
1744%  The format of the MagickCompareImagesLayers method is:
1745%
1746%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1747%        const LayerMethod method)
1748%
1749%  A description of each parameter follows:
1750%
1751%    o wand: the magick wand.
1752%
1753%    o method: the compare method.
1754%
1755*/
1756WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1757  const LayerMethod method)
1758{
1759  Image
1760    *layers_image;
1761
1762  assert(wand != (MagickWand *) NULL);
1763  assert(wand->signature == MagickWandSignature);
1764  if (wand->debug != MagickFalse)
1765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1766  if (wand->images == (Image *) NULL)
1767    return((MagickWand *) NULL);
1768  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1769  if (layers_image == (Image *) NULL)
1770    return((MagickWand *) NULL);
1771  return(CloneMagickWandFromImages(wand,layers_image));
1772}
1773
1774/*
1775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776%                                                                             %
1777%                                                                             %
1778%                                                                             %
1779%   M a g i c k C o m p a r e I m a g e s                                     %
1780%                                                                             %
1781%                                                                             %
1782%                                                                             %
1783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784%
1785%  MagickCompareImages() compares an image to a reconstructed image and returns
1786%  the specified difference image.
1787%
1788%  The format of the MagickCompareImages method is:
1789%
1790%      MagickWand *MagickCompareImages(MagickWand *wand,
1791%        const MagickWand *reference,const MetricType metric,
1792%        double *distortion)
1793%
1794%  A description of each parameter follows:
1795%
1796%    o wand: the magick wand.
1797%
1798%    o reference: the reference wand.
1799%
1800%    o metric: the metric.
1801%
1802%    o distortion: the computed distortion between the images.
1803%
1804*/
1805WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1806  const MagickWand *reference,const MetricType metric,double *distortion)
1807{
1808  Image
1809    *compare_image;
1810
1811
1812  assert(wand != (MagickWand *) NULL);
1813  assert(wand->signature == MagickWandSignature);
1814  if (wand->debug != MagickFalse)
1815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1817    {
1818      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1819        "ContainsNoImages","`%s'",wand->name);
1820      return((MagickWand *) NULL);
1821    }
1822  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1823    wand->exception);
1824  if (compare_image == (Image *) NULL)
1825    return((MagickWand *) NULL);
1826  return(CloneMagickWandFromImages(wand,compare_image));
1827}
1828
1829/*
1830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831%                                                                             %
1832%                                                                             %
1833%                                                                             %
1834%   M a g i c k C o m p o s i t e I m a g e                                   %
1835%                                                                             %
1836%                                                                             %
1837%                                                                             %
1838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839%
1840%  MagickCompositeImage() composite one image onto another at the specified
1841%  offset.
1842%
1843%  The format of the MagickCompositeImage method is:
1844%
1845%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1846%        const MagickWand *source_wand,const CompositeOperator compose,
1847%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1848%
1849%  A description of each parameter follows:
1850%
1851%    o wand: the magick wand holding the destination images
1852%
1853%    o source_image: the magick wand holding source image.
1854%
1855%    o compose: This operator affects how the composite is applied to the
1856%      image.  The default is Over.  These are some of the compose methods
1857%      availble.
1858%
1859%        OverCompositeOp       InCompositeOp         OutCompositeOp
1860%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1861%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1862%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1863%        DisplaceCompositeOp
1864%
1865%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1866%
1867%    o x: the column offset of the composited image.
1868%
1869%    o y: the row offset of the composited image.
1870%
1871*/
1872WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1873  const MagickWand *source_wand,const CompositeOperator compose,
1874  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1875{
1876  MagickBooleanType
1877    status;
1878
1879  assert(wand != (MagickWand *) NULL);
1880  assert(wand->signature == MagickWandSignature);
1881  if (wand->debug != MagickFalse)
1882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883  if ((wand->images == (Image *) NULL) ||
1884      (source_wand->images == (Image *) NULL))
1885    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1886  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1887    x,y,wand->exception);
1888  return(status);
1889}
1890
1891/*
1892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893%                                                                             %
1894%                                                                             %
1895%                                                                             %
1896%   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                     %
1897%                                                                             %
1898%                                                                             %
1899%                                                                             %
1900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901%
1902%  MagickCompositeImageGravity() composite one image onto another using the
1903%  specified gravity.
1904%
1905%  The format of the MagickCompositeImageGravity method is:
1906%
1907%      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1908%        const MagickWand *source_wand,const CompositeOperator compose,
1909%        const GravityType gravity)
1910%
1911%  A description of each parameter follows:
1912%
1913%    o wand: the magick wand holding the destination images
1914%
1915%    o source_image: the magick wand holding source image.
1916%
1917%    o compose: This operator affects how the composite is applied to the
1918%      image.  The default is Over.  These are some of the compose methods
1919%      availble.
1920%
1921%        OverCompositeOp       InCompositeOp         OutCompositeOp
1922%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1923%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1924%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1925%        DisplaceCompositeOp
1926%
1927%    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1928%               NorthEastGravity, WestGravity, CenterGravity,
1929%               EastGravity, SouthWestGravity, SouthGravity,
1930%               SouthEastGravity)
1931%
1932*/
1933WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1934  const MagickWand *source_wand,const CompositeOperator compose,
1935  const GravityType gravity)
1936{
1937  MagickBooleanType
1938    status;
1939
1940  RectangleInfo
1941    geometry;
1942
1943  assert(wand != (MagickWand *) NULL);
1944  assert(wand->signature == MagickWandSignature);
1945  if (wand->debug != MagickFalse)
1946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1947  if ((wand->images == (Image *) NULL) ||
1948      (source_wand->images == (Image *) NULL))
1949    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1950  SetGeometry(source_wand->images,&geometry);
1951  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
1952    &geometry);
1953  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
1954    geometry.x,geometry.y,wand->exception);
1955  return(status);
1956}
1957
1958/*
1959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1960%                                                                             %
1961%                                                                             %
1962%                                                                             %
1963%   M a g i c k C o m p o s i t e L a y e r s                                 %
1964%                                                                             %
1965%                                                                             %
1966%                                                                             %
1967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1968%
1969%  MagickCompositeLayers() composite the images in the source wand over the
1970%  images in the destination wand in sequence, starting with the current
1971%  image in both lists.
1972%
1973%  Each layer from the two image lists are composted together until the end of
1974%  one of the image lists is reached.  The offset of each composition is also
1975%  adjusted to match the virtual canvas offsets of each layer. As such the
1976%  given offset is relative to the virtual canvas, and not the actual image.
1977%
1978%  Composition uses given x and y offsets, as the 'origin' location of the
1979%  source images virtual canvas (not the real image) allowing you to compose a
1980%  list of 'layer images' into the destiantioni images.  This makes it well
1981%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1982%  Animations' onto a static or other 'Coaleased Animation' destination image
1983%  list.  GIF disposal handling is not looked at.
1984%
1985%  Special case:- If one of the image sequences is the last image (just a
1986%  single image remaining), that image is repeatally composed with all the
1987%  images in the other image list.  Either the source or destination lists may
1988%  be the single image, for this situation.
1989%
1990%  In the case of a single destination image (or last image given), that image
1991%  will ve cloned to match the number of images remaining in the source image
1992%  list.
1993%
1994%  This is equivelent to the "-layer Composite" Shell API operator.
1995%
1996%  The format of the MagickCompositeLayers method is:
1997%
1998%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1999%        const MagickWand *source_wand, const CompositeOperator compose,
2000%        const ssize_t x,const ssize_t y)
2001%
2002%  A description of each parameter follows:
2003%
2004%    o wand: the magick wand holding destaintion images
2005%
2006%    o source_wand: the wand holding the source images
2007%
2008%    o compose, x, y:  composition arguments
2009%
2010*/
2011WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2012  const MagickWand *source_wand,const CompositeOperator compose,
2013  const ssize_t x,const ssize_t y)
2014{
2015  MagickBooleanType
2016    status;
2017
2018  assert(wand != (MagickWand *) NULL);
2019  assert(wand->signature == MagickWandSignature);
2020  if (wand->debug != MagickFalse)
2021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2022  if ((wand->images == (Image *) NULL) ||
2023      (source_wand->images == (Image *) NULL))
2024    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2025  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2026  status=MagickTrue;  /* FUTURE: determine status from exceptions */
2027  return(status);
2028}
2029
2030/*
2031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032%                                                                             %
2033%                                                                             %
2034%                                                                             %
2035%   M a g i c k C o n t r a s t I m a g e                                     %
2036%                                                                             %
2037%                                                                             %
2038%                                                                             %
2039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040%
2041%  MagickContrastImage() enhances the intensity differences between the lighter
2042%  and darker elements of the image.  Set sharpen to a value other than 0 to
2043%  increase the image contrast otherwise the contrast is reduced.
2044%
2045%  The format of the MagickContrastImage method is:
2046%
2047%      MagickBooleanType MagickContrastImage(MagickWand *wand,
2048%        const MagickBooleanType sharpen)
2049%
2050%  A description of each parameter follows:
2051%
2052%    o wand: the magick wand.
2053%
2054%    o sharpen: Increase or decrease image contrast.
2055%
2056%
2057*/
2058WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2059  const MagickBooleanType sharpen)
2060{
2061  MagickBooleanType
2062    status;
2063
2064  assert(wand != (MagickWand *) NULL);
2065  assert(wand->signature == MagickWandSignature);
2066  if (wand->debug != MagickFalse)
2067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2068  if (wand->images == (Image *) NULL)
2069    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2070  status=ContrastImage(wand->images,sharpen,wand->exception);
2071  return(status);
2072}
2073
2074/*
2075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2076%                                                                             %
2077%                                                                             %
2078%                                                                             %
2079%   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                       %
2080%                                                                             %
2081%                                                                             %
2082%                                                                             %
2083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084%
2085%  MagickContrastStretchImage() enhances the contrast of a color image by
2086%  adjusting the pixels color to span the entire range of colors available.
2087%  You can also reduce the influence of a particular channel with a gamma
2088%  value of 0.
2089%
2090%  The format of the MagickContrastStretchImage method is:
2091%
2092%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2093%        const double black_point,const double white_point)
2094%
2095%  A description of each parameter follows:
2096%
2097%    o wand: the magick wand.
2098%
2099%    o black_point: the black point.
2100%
2101%    o white_point: the white point.
2102%
2103*/
2104WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2105  const double black_point,const double white_point)
2106{
2107  MagickBooleanType
2108    status;
2109
2110  assert(wand != (MagickWand *) NULL);
2111  assert(wand->signature == MagickWandSignature);
2112  if (wand->debug != MagickFalse)
2113    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2114  if (wand->images == (Image *) NULL)
2115    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2116  status=ContrastStretchImage(wand->images,black_point,white_point,
2117    wand->exception);
2118  return(status);
2119}
2120
2121/*
2122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123%                                                                             %
2124%                                                                             %
2125%                                                                             %
2126%   M a g i c k C o n v o l v e I m a g e                                     %
2127%                                                                             %
2128%                                                                             %
2129%                                                                             %
2130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131%
2132%  MagickConvolveImage() applies a custom convolution kernel to the image.
2133%
2134%  The format of the MagickConvolveImage method is:
2135%
2136%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2137%        const KernelInfo *kernel)
2138%
2139%  A description of each parameter follows:
2140%
2141%    o wand: the magick wand.
2142%
2143%    o kernel: An array of doubles representing the convolution kernel.
2144%
2145*/
2146WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2147  const KernelInfo *kernel)
2148{
2149  Image
2150    *filter_image;
2151
2152  assert(wand != (MagickWand *) NULL);
2153  assert(wand->signature == MagickWandSignature);
2154  if (wand->debug != MagickFalse)
2155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2156  if (kernel == (const KernelInfo *) NULL)
2157    return(MagickFalse);
2158  if (wand->images == (Image *) NULL)
2159    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2160  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2161  if (filter_image == (Image *) NULL)
2162    return(MagickFalse);
2163  ReplaceImageInList(&wand->images,filter_image);
2164  return(MagickTrue);
2165}
2166
2167/*
2168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169%                                                                             %
2170%                                                                             %
2171%                                                                             %
2172%   M a g i c k C r o p I m a g e                                             %
2173%                                                                             %
2174%                                                                             %
2175%                                                                             %
2176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177%
2178%  MagickCropImage() extracts a region of the image.
2179%
2180%  The format of the MagickCropImage method is:
2181%
2182%      MagickBooleanType MagickCropImage(MagickWand *wand,
2183%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2184%
2185%  A description of each parameter follows:
2186%
2187%    o wand: the magick wand.
2188%
2189%    o width: the region width.
2190%
2191%    o height: the region height.
2192%
2193%    o x: the region x-offset.
2194%
2195%    o y: the region y-offset.
2196%
2197*/
2198WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2199  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2200{
2201  Image
2202    *crop_image;
2203
2204  RectangleInfo
2205    crop;
2206
2207  assert(wand != (MagickWand *) NULL);
2208  assert(wand->signature == MagickWandSignature);
2209  if (wand->debug != MagickFalse)
2210    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2211  if (wand->images == (Image *) NULL)
2212    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2213  crop.width=width;
2214  crop.height=height;
2215  crop.x=x;
2216  crop.y=y;
2217  crop_image=CropImage(wand->images,&crop,wand->exception);
2218  if (crop_image == (Image *) NULL)
2219    return(MagickFalse);
2220  ReplaceImageInList(&wand->images,crop_image);
2221  return(MagickTrue);
2222}
2223
2224/*
2225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2226%                                                                             %
2227%                                                                             %
2228%                                                                             %
2229%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2230%                                                                             %
2231%                                                                             %
2232%                                                                             %
2233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2234%
2235%  MagickCycleColormapImage() displaces an image's colormap by a given number
2236%  of positions.  If you cycle the colormap a number of times you can produce
2237%  a psychodelic effect.
2238%
2239%  The format of the MagickCycleColormapImage method is:
2240%
2241%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2242%        const ssize_t displace)
2243%
2244%  A description of each parameter follows:
2245%
2246%    o wand: the magick wand.
2247%
2248%    o pixel_wand: the pixel wand.
2249%
2250*/
2251WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2252  const ssize_t displace)
2253{
2254  MagickBooleanType
2255    status;
2256
2257  assert(wand != (MagickWand *) NULL);
2258  assert(wand->signature == MagickWandSignature);
2259  if (wand->debug != MagickFalse)
2260    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2261  if (wand->images == (Image *) NULL)
2262    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2263  status=CycleColormapImage(wand->images,displace,wand->exception);
2264  return(status);
2265}
2266
2267/*
2268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269%                                                                             %
2270%                                                                             %
2271%                                                                             %
2272%   M a g i c k C o n s t i t u t e I m a g e                                 %
2273%                                                                             %
2274%                                                                             %
2275%                                                                             %
2276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277%
2278%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2279%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2280%  The data can be char, short int, int, float, or double.  Float and double
2281%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2282%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2283%  example, to create a 640x480 image from unsigned red-green-blue character
2284%  data, use
2285%
2286%      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2287%
2288%  The format of the MagickConstituteImage method is:
2289%
2290%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2291%        const size_t columns,const size_t rows,const char *map,
2292%        const StorageType storage,void *pixels)
2293%
2294%  A description of each parameter follows:
2295%
2296%    o wand: the magick wand.
2297%
2298%    o columns: width in pixels of the image.
2299%
2300%    o rows: height in pixels of the image.
2301%
2302%    o map:  This string reflects the expected ordering of the pixel array.
2303%      It can be any combination or order of R = red, G = green, B = blue,
2304%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2305%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2306%      P = pad.
2307%
2308%    o storage: Define the data type of the pixels.  Float and double types are
2309%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2310%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2311%      LongPixel, QuantumPixel, or ShortPixel.
2312%
2313%    o pixels: This array of values contain the pixel components as defined by
2314%      map and type.  You must preallocate this array where the expected
2315%      length varies depending on the values of width, height, map, and type.
2316%
2317%
2318*/
2319WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2320  const size_t columns,const size_t rows,const char *map,
2321  const StorageType storage,const void *pixels)
2322{
2323  Image
2324    *images;
2325
2326  assert(wand != (MagickWand *) NULL);
2327  assert(wand->signature == MagickWandSignature);
2328  if (wand->debug != MagickFalse)
2329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2330  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2331  if (images == (Image *) NULL)
2332    return(MagickFalse);
2333  return(InsertImageInWand(wand,images));
2334}
2335
2336/*
2337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338%                                                                             %
2339%                                                                             %
2340%                                                                             %
2341%   M a g i c k D e c i p h e r I m a g e                                     %
2342%                                                                             %
2343%                                                                             %
2344%                                                                             %
2345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346%
2347%  MagickDecipherImage() converts cipher pixels to plain pixels.
2348%
2349%  The format of the MagickDecipherImage method is:
2350%
2351%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2352%        const char *passphrase)
2353%
2354%  A description of each parameter follows:
2355%
2356%    o wand: the magick wand.
2357%
2358%    o passphrase: the passphrase.
2359%
2360*/
2361WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2362  const char *passphrase)
2363{
2364  assert(wand != (MagickWand *) NULL);
2365  assert(wand->signature == MagickWandSignature);
2366  if (wand->debug != MagickFalse)
2367    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368  if (wand->images == (Image *) NULL)
2369    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2370  return(DecipherImage(wand->images,passphrase,wand->exception));
2371}
2372
2373/*
2374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375%                                                                             %
2376%                                                                             %
2377%                                                                             %
2378%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2379%                                                                             %
2380%                                                                             %
2381%                                                                             %
2382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2383%
2384%  MagickDeconstructImages() compares each image with the next in a sequence
2385%  and returns the maximum bounding region of any pixel differences it
2386%  discovers.
2387%
2388%  The format of the MagickDeconstructImages method is:
2389%
2390%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2391%
2392%  A description of each parameter follows:
2393%
2394%    o wand: the magick wand.
2395%
2396*/
2397WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2398{
2399  Image
2400    *deconstruct_image;
2401
2402  assert(wand != (MagickWand *) NULL);
2403  assert(wand->signature == MagickWandSignature);
2404  if (wand->debug != MagickFalse)
2405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2406  if (wand->images == (Image *) NULL)
2407    return((MagickWand *) NULL);
2408  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2409    wand->exception);
2410  if (deconstruct_image == (Image *) NULL)
2411    return((MagickWand *) NULL);
2412  return(CloneMagickWandFromImages(wand,deconstruct_image));
2413}
2414
2415/*
2416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2417%                                                                             %
2418%                                                                             %
2419%                                                                             %
2420%     M a g i c k D e s k e w I m a g e                                       %
2421%                                                                             %
2422%                                                                             %
2423%                                                                             %
2424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425%
2426%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2427%  occurs in scanned images because of the camera being misaligned,
2428%  imperfections in the scanning or surface, or simply because the paper was
2429%  not placed completely flat when scanned.
2430%
2431%  The format of the MagickDeskewImage method is:
2432%
2433%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2434%        const double threshold)
2435%
2436%  A description of each parameter follows:
2437%
2438%    o wand: the magick wand.
2439%
2440%    o threshold: separate background from foreground.
2441%
2442*/
2443WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2444  const double threshold)
2445{
2446  Image
2447    *sepia_image;
2448
2449  assert(wand != (MagickWand *) NULL);
2450  assert(wand->signature == MagickWandSignature);
2451  if (wand->debug != MagickFalse)
2452    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2453  if (wand->images == (Image *) NULL)
2454    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2455  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2456  if (sepia_image == (Image *) NULL)
2457    return(MagickFalse);
2458  ReplaceImageInList(&wand->images,sepia_image);
2459  return(MagickTrue);
2460}
2461
2462/*
2463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464%                                                                             %
2465%                                                                             %
2466%                                                                             %
2467%     M a g i c k D e s p e c k l e I m a g e                                 %
2468%                                                                             %
2469%                                                                             %
2470%                                                                             %
2471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472%
2473%  MagickDespeckleImage() reduces the speckle noise in an image while
2474%  perserving the edges of the original image.
2475%
2476%  The format of the MagickDespeckleImage method is:
2477%
2478%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2479%
2480%  A description of each parameter follows:
2481%
2482%    o wand: the magick wand.
2483%
2484*/
2485WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2486{
2487  Image
2488    *despeckle_image;
2489
2490  assert(wand != (MagickWand *) NULL);
2491  assert(wand->signature == MagickWandSignature);
2492  if (wand->debug != MagickFalse)
2493    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2494  if (wand->images == (Image *) NULL)
2495    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2496  despeckle_image=DespeckleImage(wand->images,wand->exception);
2497  if (despeckle_image == (Image *) NULL)
2498    return(MagickFalse);
2499  ReplaceImageInList(&wand->images,despeckle_image);
2500  return(MagickTrue);
2501}
2502
2503/*
2504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2505%                                                                             %
2506%                                                                             %
2507%                                                                             %
2508%   M a g i c k D e s t r o y I m a g e                                       %
2509%                                                                             %
2510%                                                                             %
2511%                                                                             %
2512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2513%
2514%  MagickDestroyImage() dereferences an image, deallocating memory associated
2515%  with the image if the reference count becomes zero.
2516%
2517%  The format of the MagickDestroyImage method is:
2518%
2519%      Image *MagickDestroyImage(Image *image)
2520%
2521%  A description of each parameter follows:
2522%
2523%    o image: the image.
2524%
2525*/
2526WandExport Image *MagickDestroyImage(Image *image)
2527{
2528  return(DestroyImage(image));
2529}
2530
2531/*
2532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533%                                                                             %
2534%                                                                             %
2535%                                                                             %
2536%   M a g i c k D i s p l a y I m a g e                                       %
2537%                                                                             %
2538%                                                                             %
2539%                                                                             %
2540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541%
2542%  MagickDisplayImage() displays an image.
2543%
2544%  The format of the MagickDisplayImage method is:
2545%
2546%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2547%        const char *server_name)
2548%
2549%  A description of each parameter follows:
2550%
2551%    o wand: the magick wand.
2552%
2553%    o server_name: the X server name.
2554%
2555*/
2556WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2557  const char *server_name)
2558{
2559  Image
2560    *image;
2561
2562  MagickBooleanType
2563    status;
2564
2565  assert(wand != (MagickWand *) NULL);
2566  assert(wand->signature == MagickWandSignature);
2567  if (wand->debug != MagickFalse)
2568    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2569  if (wand->images == (Image *) NULL)
2570    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2571  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2572  if (image == (Image *) NULL)
2573    return(MagickFalse);
2574  (void) CloneString(&wand->image_info->server_name,server_name);
2575  status=DisplayImages(wand->image_info,image,wand->exception);
2576  image=DestroyImage(image);
2577  return(status);
2578}
2579
2580/*
2581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582%                                                                             %
2583%                                                                             %
2584%                                                                             %
2585%   M a g i c k D i s p l a y I m a g e s                                     %
2586%                                                                             %
2587%                                                                             %
2588%                                                                             %
2589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2590%
2591%  MagickDisplayImages() displays an image or image sequence.
2592%
2593%  The format of the MagickDisplayImages method is:
2594%
2595%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2596%        const char *server_name)
2597%
2598%  A description of each parameter follows:
2599%
2600%    o wand: the magick wand.
2601%
2602%    o server_name: the X server name.
2603%
2604*/
2605WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2606  const char *server_name)
2607{
2608  MagickBooleanType
2609    status;
2610
2611  assert(wand != (MagickWand *) NULL);
2612  assert(wand->signature == MagickWandSignature);
2613  if (wand->debug != MagickFalse)
2614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2615  (void) CloneString(&wand->image_info->server_name,server_name);
2616  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2617  return(status);
2618}
2619
2620/*
2621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2622%                                                                             %
2623%                                                                             %
2624%                                                                             %
2625%   M a g i c k D i s t o r t I m a g e                                       %
2626%                                                                             %
2627%                                                                             %
2628%                                                                             %
2629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630%
2631%  MagickDistortImage() distorts an image using various distortion methods, by
2632%  mapping color lookups of the source image to a new destination image
2633%  usally of the same size as the source image, unless 'bestfit' is set to
2634%  true.
2635%
2636%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2637%  adjusted to ensure the whole source 'image' will just fit within the final
2638%  destination image, which will be sized and offset accordingly.  Also in
2639%  many cases the virtual offset of the source image will be taken into
2640%  account in the mapping.
2641%
2642%  The format of the MagickDistortImage method is:
2643%
2644%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2645%        const DistortImageMethod method,const size_t number_arguments,
2646%        const double *arguments,const MagickBooleanType bestfit)
2647%
2648%  A description of each parameter follows:
2649%
2650%    o image: the image to be distorted.
2651%
2652%    o method: the method of image distortion.
2653%
2654%        ArcDistortion always ignores the source image offset, and always
2655%        'bestfit' the destination image with the top left corner offset
2656%        relative to the polar mapping center.
2657%
2658%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2659%        style of image distortion.
2660%
2661%        Affine, Perspective, and Bilinear, do least squares fitting of the
2662%        distortion when more than the minimum number of control point pairs
2663%        are provided.
2664%
2665%        Perspective, and Bilinear, falls back to a Affine distortion when less
2666%        that 4 control point pairs are provided. While Affine distortions let
2667%        you use any number of control point pairs, that is Zero pairs is a
2668%        no-Op (viewport only) distrotion, one pair is a translation and two
2669%        pairs of control points do a scale-rotate-translate, without any
2670%        shearing.
2671%
2672%    o number_arguments: the number of arguments given for this distortion
2673%      method.
2674%
2675%    o arguments: the arguments for this distortion method.
2676%
2677%    o bestfit: Attempt to resize destination to fit distorted source.
2678%
2679*/
2680WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2681  const DistortImageMethod method,const size_t number_arguments,
2682  const double *arguments,const MagickBooleanType bestfit)
2683{
2684  Image
2685    *distort_image;
2686
2687  assert(wand != (MagickWand *) NULL);
2688  assert(wand->signature == MagickWandSignature);
2689  if (wand->debug != MagickFalse)
2690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2691  if (wand->images == (Image *) NULL)
2692    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2693  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2694    bestfit,wand->exception);
2695  if (distort_image == (Image *) NULL)
2696    return(MagickFalse);
2697  ReplaceImageInList(&wand->images,distort_image);
2698  return(MagickTrue);
2699}
2700
2701/*
2702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703%                                                                             %
2704%                                                                             %
2705%                                                                             %
2706%   M a g i c k D r a w I m a g e                                             %
2707%                                                                             %
2708%                                                                             %
2709%                                                                             %
2710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711%
2712%  MagickDrawImage() renders the drawing wand on the current image.
2713%
2714%  The format of the MagickDrawImage method is:
2715%
2716%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2717%        const DrawingWand *drawing_wand)
2718%
2719%  A description of each parameter follows:
2720%
2721%    o wand: the magick wand.
2722%
2723%    o drawing_wand: the draw wand.
2724%
2725*/
2726WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2727  const DrawingWand *drawing_wand)
2728{
2729  char
2730    *primitive;
2731
2732  DrawInfo
2733    *draw_info;
2734
2735  MagickBooleanType
2736    status;
2737
2738  assert(wand != (MagickWand *) NULL);
2739  assert(wand->signature == MagickWandSignature);
2740  if (wand->debug != MagickFalse)
2741    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2742  if (wand->images == (Image *) NULL)
2743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2744  draw_info=PeekDrawingWand(drawing_wand);
2745  if ((draw_info == (DrawInfo *) NULL) ||
2746      (draw_info->primitive == (char *) NULL))
2747    return(MagickFalse);
2748  primitive=AcquireString(draw_info->primitive);
2749  draw_info=DestroyDrawInfo(draw_info);
2750  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2751  draw_info->primitive=primitive;
2752  status=DrawImage(wand->images,draw_info,wand->exception);
2753  draw_info=DestroyDrawInfo(draw_info);
2754  return(status);
2755}
2756
2757/*
2758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2759%                                                                             %
2760%                                                                             %
2761%                                                                             %
2762%   M a g i c k E d g e I m a g e                                             %
2763%                                                                             %
2764%                                                                             %
2765%                                                                             %
2766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2767%
2768%  MagickEdgeImage() enhance edges within the image with a convolution filter
2769%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2770%  radius for you.
2771%
2772%  The format of the MagickEdgeImage method is:
2773%
2774%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2775%
2776%  A description of each parameter follows:
2777%
2778%    o wand: the magick wand.
2779%
2780%    o radius: the radius of the pixel neighborhood.
2781%
2782*/
2783WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2784  const double radius)
2785{
2786  Image
2787    *edge_image;
2788
2789  assert(wand != (MagickWand *) NULL);
2790  assert(wand->signature == MagickWandSignature);
2791  if (wand->debug != MagickFalse)
2792    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2793  if (wand->images == (Image *) NULL)
2794    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2795  edge_image=EdgeImage(wand->images,radius,wand->exception);
2796  if (edge_image == (Image *) NULL)
2797    return(MagickFalse);
2798  ReplaceImageInList(&wand->images,edge_image);
2799  return(MagickTrue);
2800}
2801
2802/*
2803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2804%                                                                             %
2805%                                                                             %
2806%                                                                             %
2807%   M a g i c k E m b o s s I m a g e                                         %
2808%                                                                             %
2809%                                                                             %
2810%                                                                             %
2811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812%
2813%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2814%  effect.  We convolve the image with a Gaussian operator of the given radius
2815%  and standard deviation (sigma).  For reasonable results, radius should be
2816%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2817%  radius for you.
2818%
2819%  The format of the MagickEmbossImage method is:
2820%
2821%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2822%        const double sigma)
2823%
2824%  A description of each parameter follows:
2825%
2826%    o wand: the magick wand.
2827%
2828%    o radius: the radius of the Gaussian, in pixels, not counting the center
2829%      pixel.
2830%
2831%    o sigma: the standard deviation of the Gaussian, in pixels.
2832%
2833*/
2834WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2835  const double radius,const double sigma)
2836{
2837  Image
2838    *emboss_image;
2839
2840  assert(wand != (MagickWand *) NULL);
2841  assert(wand->signature == MagickWandSignature);
2842  if (wand->debug != MagickFalse)
2843    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2844  if (wand->images == (Image *) NULL)
2845    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2846  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2847  if (emboss_image == (Image *) NULL)
2848    return(MagickFalse);
2849  ReplaceImageInList(&wand->images,emboss_image);
2850  return(MagickTrue);
2851}
2852
2853/*
2854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2855%                                                                             %
2856%                                                                             %
2857%                                                                             %
2858%   M a g i c k E n c i p h e r I m a g e                                     %
2859%                                                                             %
2860%                                                                             %
2861%                                                                             %
2862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2863%
2864%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2865%
2866%  The format of the MagickEncipherImage method is:
2867%
2868%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2869%        const char *passphrase)
2870%
2871%  A description of each parameter follows:
2872%
2873%    o wand: the magick wand.
2874%
2875%    o passphrase: the passphrase.
2876%
2877*/
2878WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2879  const char *passphrase)
2880{
2881  assert(wand != (MagickWand *) NULL);
2882  assert(wand->signature == MagickWandSignature);
2883  if (wand->debug != MagickFalse)
2884    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2885  if (wand->images == (Image *) NULL)
2886    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2887  return(EncipherImage(wand->images,passphrase,wand->exception));
2888}
2889
2890/*
2891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2892%                                                                             %
2893%                                                                             %
2894%                                                                             %
2895%   M a g i c k E n h a n c e I m a g e                                       %
2896%                                                                             %
2897%                                                                             %
2898%                                                                             %
2899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2900%
2901%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2902%  noisy image.
2903%
2904%  The format of the MagickEnhanceImage method is:
2905%
2906%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2907%
2908%  A description of each parameter follows:
2909%
2910%    o wand: the magick wand.
2911%
2912*/
2913WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2914{
2915  Image
2916    *enhance_image;
2917
2918  assert(wand != (MagickWand *) NULL);
2919  assert(wand->signature == MagickWandSignature);
2920  if (wand->debug != MagickFalse)
2921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2922  if (wand->images == (Image *) NULL)
2923    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2924  enhance_image=EnhanceImage(wand->images,wand->exception);
2925  if (enhance_image == (Image *) NULL)
2926    return(MagickFalse);
2927  ReplaceImageInList(&wand->images,enhance_image);
2928  return(MagickTrue);
2929}
2930
2931/*
2932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2933%                                                                             %
2934%                                                                             %
2935%                                                                             %
2936%   M a g i c k E q u a l i z e I m a g e                                     %
2937%                                                                             %
2938%                                                                             %
2939%                                                                             %
2940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2941%
2942%  MagickEqualizeImage() equalizes the image histogram.
2943%
2944%  The format of the MagickEqualizeImage method is:
2945%
2946%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2947%
2948%  A description of each parameter follows:
2949%
2950%    o wand: the magick wand.
2951%
2952%    o channel: the image channel(s).
2953%
2954*/
2955WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2956{
2957  MagickBooleanType
2958    status;
2959
2960  assert(wand != (MagickWand *) NULL);
2961  assert(wand->signature == MagickWandSignature);
2962  if (wand->debug != MagickFalse)
2963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2964  if (wand->images == (Image *) NULL)
2965    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2966  status=EqualizeImage(wand->images,wand->exception);
2967  return(status);
2968}
2969
2970/*
2971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972%                                                                             %
2973%                                                                             %
2974%                                                                             %
2975%   M a g i c k E v a l u a t e I m a g e                                     %
2976%                                                                             %
2977%                                                                             %
2978%                                                                             %
2979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980%
2981%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2982%  expression to an image.  Use these operators to lighten or darken an image,
2983%  to increase or decrease contrast in an image, or to produce the "negative"
2984%  of an image.
2985%
2986%  The format of the MagickEvaluateImage method is:
2987%
2988%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2989%        const MagickEvaluateOperator operator,const double value)
2990%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2991%        const MagickEvaluateOperator operator)
2992%
2993%  A description of each parameter follows:
2994%
2995%    o wand: the magick wand.
2996%
2997%    o op: A channel operator.
2998%
2999%    o value: A value value.
3000%
3001*/
3002
3003WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3004  const MagickEvaluateOperator op)
3005{
3006  Image
3007    *evaluate_image;
3008
3009  assert(wand != (MagickWand *) NULL);
3010  assert(wand->signature == MagickWandSignature);
3011  if (wand->debug != MagickFalse)
3012    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3013  if (wand->images == (Image *) NULL)
3014    return((MagickWand *) NULL);
3015  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3016  if (evaluate_image == (Image *) NULL)
3017    return((MagickWand *) NULL);
3018  return(CloneMagickWandFromImages(wand,evaluate_image));
3019}
3020
3021WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3022  const MagickEvaluateOperator op,const double value)
3023{
3024  MagickBooleanType
3025    status;
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  status=EvaluateImage(wand->images,op,value,wand->exception);
3034  return(status);
3035}
3036
3037/*
3038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3039%                                                                             %
3040%                                                                             %
3041%                                                                             %
3042%   M a g i c k E x p o r t I m a g e P i x e l s                             %
3043%                                                                             %
3044%                                                                             %
3045%                                                                             %
3046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3047%
3048%  MagickExportImagePixels() extracts pixel data from an image and returns it
3049%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3050%  an error is encountered.  The data is returned as char, short int, int,
3051%  ssize_t, float, or double in the order specified by map.
3052%
3053%  Suppose you want to extract the first scanline of a 640x480 image as
3054%  character data in red-green-blue order:
3055%
3056%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3057%
3058%  The format of the MagickExportImagePixels method is:
3059%
3060%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3061%        const ssize_t x,const ssize_t y,const size_t columns,
3062%        const size_t rows,const char *map,const StorageType storage,
3063%        void *pixels)
3064%
3065%  A description of each parameter follows:
3066%
3067%    o wand: the magick wand.
3068%
3069%    o x, y, columns, rows:  These values define the perimeter
3070%      of a region of pixels you want to extract.
3071%
3072%    o map:  This string reflects the expected ordering of the pixel array.
3073%      It can be any combination or order of R = red, G = green, B = blue,
3074%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3075%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3076%      P = pad.
3077%
3078%    o storage: Define the data type of the pixels.  Float and double types are
3079%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3080%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3081%      LongPixel, QuantumPixel, or ShortPixel.
3082%
3083%    o pixels: This array of values contain the pixel components as defined by
3084%      map and type.  You must preallocate this array where the expected
3085%      length varies depending on the values of width, height, map, and type.
3086%
3087*/
3088WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3089  const ssize_t x,const ssize_t y,const size_t columns,
3090  const size_t rows,const char *map,const StorageType storage,
3091  void *pixels)
3092{
3093  MagickBooleanType
3094    status;
3095
3096  assert(wand != (MagickWand *) NULL);
3097  assert(wand->signature == MagickWandSignature);
3098  if (wand->debug != MagickFalse)
3099    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3100  if (wand->images == (Image *) NULL)
3101    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3103    storage,pixels,wand->exception);
3104  return(status);
3105}
3106
3107/*
3108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109%                                                                             %
3110%                                                                             %
3111%                                                                             %
3112%   M a g i c k E x t e n t I m a g e                                         %
3113%                                                                             %
3114%                                                                             %
3115%                                                                             %
3116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117%
3118%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3119%  and wand background color.  Set the (x,y) offset of the geometry to move
3120%  the original wand relative to the extended wand.
3121%
3122%  The format of the MagickExtentImage method is:
3123%
3124%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3125%        const size_t height,const ssize_t x,const ssize_t y)
3126%
3127%  A description of each parameter follows:
3128%
3129%    o wand: the magick wand.
3130%
3131%    o width: the region width.
3132%
3133%    o height: the region height.
3134%
3135%    o x: the region x offset.
3136%
3137%    o y: the region y offset.
3138%
3139*/
3140WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3141  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3142{
3143  Image
3144    *extent_image;
3145
3146  RectangleInfo
3147    extent;
3148
3149  assert(wand != (MagickWand *) NULL);
3150  assert(wand->signature == MagickWandSignature);
3151  if (wand->debug != MagickFalse)
3152    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3153  if (wand->images == (Image *) NULL)
3154    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3155  extent.width=width;
3156  extent.height=height;
3157  extent.x=x;
3158  extent.y=y;
3159  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3160  if (extent_image == (Image *) NULL)
3161    return(MagickFalse);
3162  ReplaceImageInList(&wand->images,extent_image);
3163  return(MagickTrue);
3164}
3165
3166/*
3167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3168%                                                                             %
3169%                                                                             %
3170%                                                                             %
3171%   M a g i c k F l i p I m a g e                                             %
3172%                                                                             %
3173%                                                                             %
3174%                                                                             %
3175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3176%
3177%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3178%  around the central x-axis.
3179%
3180%  The format of the MagickFlipImage method is:
3181%
3182%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3183%
3184%  A description of each parameter follows:
3185%
3186%    o wand: the magick wand.
3187%
3188*/
3189WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3190{
3191  Image
3192    *flip_image;
3193
3194  assert(wand != (MagickWand *) NULL);
3195  assert(wand->signature == MagickWandSignature);
3196  if (wand->debug != MagickFalse)
3197    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3198  if (wand->images == (Image *) NULL)
3199    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3200  flip_image=FlipImage(wand->images,wand->exception);
3201  if (flip_image == (Image *) NULL)
3202    return(MagickFalse);
3203  ReplaceImageInList(&wand->images,flip_image);
3204  return(MagickTrue);
3205}
3206
3207/*
3208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3209%                                                                             %
3210%                                                                             %
3211%                                                                             %
3212%   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                         %
3213%                                                                             %
3214%                                                                             %
3215%                                                                             %
3216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3217%
3218%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3219%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3220%  specified, the color value is changed for any neighbor pixel that does not
3221%  match the bordercolor member of image.
3222%
3223%  The format of the MagickFloodfillPaintImage method is:
3224%
3225%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3226%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3227%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3228%
3229%  A description of each parameter follows:
3230%
3231%    o wand: the magick wand.
3232%
3233%    o fill: the floodfill color pixel wand.
3234%
3235%    o fuzz: By default target must match a particular pixel color
3236%      exactly.  However, in many cases two colors may differ by a small amount.
3237%      The fuzz member of image defines how much tolerance is acceptable to
3238%      consider two colors as the same.  For example, set fuzz to 10 and the
3239%      color red at intensities of 100 and 102 respectively are now interpreted
3240%      as the same color for the purposes of the floodfill.
3241%
3242%    o bordercolor: the border color pixel wand.
3243%
3244%    o x,y: the starting location of the operation.
3245%
3246%    o invert: paint any pixel that does not match the target color.
3247%
3248*/
3249WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3250  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3251  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3252{
3253  DrawInfo
3254    *draw_info;
3255
3256  MagickBooleanType
3257    status;
3258
3259  PixelInfo
3260    target;
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  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3269  PixelGetQuantumPacket(fill,&draw_info->fill);
3270  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3271    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3272  if (bordercolor != (PixelWand *) NULL)
3273    PixelGetMagickColor(bordercolor,&target);
3274  wand->images->fuzz=fuzz;
3275  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3276    wand->exception);
3277  draw_info=DestroyDrawInfo(draw_info);
3278  return(status);
3279}
3280
3281/*
3282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3283%                                                                             %
3284%                                                                             %
3285%                                                                             %
3286%   M a g i c k F l o p I m a g e                                             %
3287%                                                                             %
3288%                                                                             %
3289%                                                                             %
3290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291%
3292%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3293%  around the central y-axis.
3294%
3295%  The format of the MagickFlopImage method is:
3296%
3297%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3298%
3299%  A description of each parameter follows:
3300%
3301%    o wand: the magick wand.
3302%
3303*/
3304WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3305{
3306  Image
3307    *flop_image;
3308
3309  assert(wand != (MagickWand *) NULL);
3310  assert(wand->signature == MagickWandSignature);
3311  if (wand->debug != MagickFalse)
3312    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3313  if (wand->images == (Image *) NULL)
3314    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3315  flop_image=FlopImage(wand->images,wand->exception);
3316  if (flop_image == (Image *) NULL)
3317    return(MagickFalse);
3318  ReplaceImageInList(&wand->images,flop_image);
3319  return(MagickTrue);
3320}
3321
3322/*
3323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324%                                                                             %
3325%                                                                             %
3326%                                                                             %
3327%   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                     %
3328%                                                                             %
3329%                                                                             %
3330%                                                                             %
3331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332%
3333%  MagickForwardFourierTransformImage() implements the discrete Fourier
3334%  transform (DFT) of the image either as a magnitude / phase or real /
3335%  imaginary image pair.
3336%
3337%  The format of the MagickForwardFourierTransformImage method is:
3338%
3339%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3340%        const MagickBooleanType magnitude)
3341%
3342%  A description of each parameter follows:
3343%
3344%    o wand: the magick wand.
3345%
3346%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3347%      imaginary image pair.
3348%
3349*/
3350WandExport MagickBooleanType MagickForwardFourierTransformImage(
3351  MagickWand *wand,const MagickBooleanType magnitude)
3352{
3353  Image
3354    *forward_image;
3355
3356  assert(wand != (MagickWand *) NULL);
3357  assert(wand->signature == MagickWandSignature);
3358  if (wand->debug != MagickFalse)
3359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3360  if (wand->images == (Image *) NULL)
3361    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3362  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3363    wand->exception);
3364  if (forward_image == (Image *) NULL)
3365    return(MagickFalse);
3366  ReplaceImageInList(&wand->images,forward_image);
3367  return(MagickTrue);
3368}
3369
3370/*
3371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3372%                                                                             %
3373%                                                                             %
3374%                                                                             %
3375%   M a g i c k F r a m e I m a g e                                           %
3376%                                                                             %
3377%                                                                             %
3378%                                                                             %
3379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3380%
3381%  MagickFrameImage() adds a simulated three-dimensional border around the
3382%  image.  The width and height specify the border width of the vertical and
3383%  horizontal sides of the frame.  The inner and outer bevels indicate the
3384%  width of the inner and outer shadows of the frame.
3385%
3386%  The format of the MagickFrameImage method is:
3387%
3388%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3389%        const PixelWand *matte_color,const size_t width,
3390%        const size_t height,const ssize_t inner_bevel,
3391%        const ssize_t outer_bevel,const CompositeOperator compose)
3392%
3393%  A description of each parameter follows:
3394%
3395%    o wand: the magick wand.
3396%
3397%    o matte_color: the frame color pixel wand.
3398%
3399%    o width: the border width.
3400%
3401%    o height: the border height.
3402%
3403%    o inner_bevel: the inner bevel width.
3404%
3405%    o outer_bevel: the outer bevel width.
3406%
3407%    o compose: the composite operator.
3408%
3409*/
3410WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3411  const PixelWand *matte_color,const size_t width,const size_t height,
3412  const ssize_t inner_bevel,const ssize_t outer_bevel,
3413  const CompositeOperator compose)
3414{
3415  Image
3416    *frame_image;
3417
3418  FrameInfo
3419    frame_info;
3420
3421  assert(wand != (MagickWand *) NULL);
3422  assert(wand->signature == MagickWandSignature);
3423  if (wand->debug != MagickFalse)
3424    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3425  if (wand->images == (Image *) NULL)
3426    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3427  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3428  frame_info.width=wand->images->columns+2*width;
3429  frame_info.height=wand->images->rows+2*height;
3430  frame_info.x=(ssize_t) width;
3431  frame_info.y=(ssize_t) height;
3432  frame_info.inner_bevel=inner_bevel;
3433  frame_info.outer_bevel=outer_bevel;
3434  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3435  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3436  if (frame_image == (Image *) NULL)
3437    return(MagickFalse);
3438  ReplaceImageInList(&wand->images,frame_image);
3439  return(MagickTrue);
3440}
3441
3442/*
3443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3444%                                                                             %
3445%                                                                             %
3446%                                                                             %
3447%   M a g i c k F u n c t i o n I m a g e                                     %
3448%                                                                             %
3449%                                                                             %
3450%                                                                             %
3451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452%
3453%  MagickFunctionImage() applys an arithmetic, relational, or logical
3454%  expression to an image.  Use these operators to lighten or darken an image,
3455%  to increase or decrease contrast in an image, or to produce the "negative"
3456%  of an image.
3457%
3458%  The format of the MagickFunctionImage method is:
3459%
3460%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3461%        const MagickFunction function,const size_t number_arguments,
3462%        const double *arguments)
3463%
3464%  A description of each parameter follows:
3465%
3466%    o wand: the magick wand.
3467%
3468%    o function: the image function.
3469%
3470%    o number_arguments: the number of function arguments.
3471%
3472%    o arguments: the function arguments.
3473%
3474*/
3475WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3476  const MagickFunction function,const size_t number_arguments,
3477  const double *arguments)
3478{
3479  MagickBooleanType
3480    status;
3481
3482  assert(wand != (MagickWand *) NULL);
3483  assert(wand->signature == MagickWandSignature);
3484  if (wand->debug != MagickFalse)
3485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3486  if (wand->images == (Image *) NULL)
3487    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3488  status=FunctionImage(wand->images,function,number_arguments,arguments,
3489    wand->exception);
3490  return(status);
3491}
3492
3493/*
3494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495%                                                                             %
3496%                                                                             %
3497%                                                                             %
3498%   M a g i c k F x I m a g e                                                 %
3499%                                                                             %
3500%                                                                             %
3501%                                                                             %
3502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503%
3504%  MagickFxImage() evaluate expression for each pixel in the image.
3505%
3506%  The format of the MagickFxImage method is:
3507%
3508%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3509%
3510%  A description of each parameter follows:
3511%
3512%    o wand: the magick wand.
3513%
3514%    o expression: the expression.
3515%
3516*/
3517WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3518{
3519  Image
3520    *fx_image;
3521
3522  assert(wand != (MagickWand *) NULL);
3523  assert(wand->signature == MagickWandSignature);
3524  if (wand->debug != MagickFalse)
3525    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3526  if (wand->images == (Image *) NULL)
3527    return((MagickWand *) NULL);
3528  fx_image=FxImage(wand->images,expression,wand->exception);
3529  if (fx_image == (Image *) NULL)
3530    return((MagickWand *) NULL);
3531  return(CloneMagickWandFromImages(wand,fx_image));
3532}
3533
3534/*
3535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536%                                                                             %
3537%                                                                             %
3538%                                                                             %
3539%   M a g i c k G a m m a I m a g e                                           %
3540%                                                                             %
3541%                                                                             %
3542%                                                                             %
3543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3544%
3545%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3546%  different devices will have perceptual differences in the way the image's
3547%  intensities are represented on the screen.  Specify individual gamma levels
3548%  for the red, green, and blue channels, or adjust all three with the gamma
3549%  parameter.  Values typically range from 0.8 to 2.3.
3550%
3551%  You can also reduce the influence of a particular channel with a gamma
3552%  value of 0.
3553%
3554%  The format of the MagickGammaImage method is:
3555%
3556%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3557%
3558%  A description of each parameter follows:
3559%
3560%    o wand: the magick wand.
3561%
3562%    o level: Define the level of gamma correction.
3563%
3564*/
3565WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3566  const double gamma)
3567{
3568  MagickBooleanType
3569    status;
3570
3571  assert(wand != (MagickWand *) NULL);
3572  assert(wand->signature == MagickWandSignature);
3573  if (wand->debug != MagickFalse)
3574    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3575  if (wand->images == (Image *) NULL)
3576    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3577  status=GammaImage(wand->images,gamma,wand->exception);
3578  return(status);
3579}
3580
3581/*
3582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3583%                                                                             %
3584%                                                                             %
3585%                                                                             %
3586%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3587%                                                                             %
3588%                                                                             %
3589%                                                                             %
3590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3591%
3592%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3593%  Gaussian operator of the given radius and standard deviation (sigma).
3594%  For reasonable results, the radius should be larger than sigma.  Use a
3595%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3596%
3597%  The format of the MagickGaussianBlurImage method is:
3598%
3599%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3600%        const double radius,const double sigma)
3601%
3602%  A description of each parameter follows:
3603%
3604%    o wand: the magick wand.
3605%
3606%    o radius: the radius of the Gaussian, in pixels, not counting the center
3607%      pixel.
3608%
3609%    o sigma: the standard deviation of the Gaussian, in pixels.
3610%
3611*/
3612WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3613  const double radius,const double sigma)
3614{
3615  Image
3616    *blur_image;
3617
3618  assert(wand != (MagickWand *) NULL);
3619  assert(wand->signature == MagickWandSignature);
3620  if (wand->debug != MagickFalse)
3621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622  if (wand->images == (Image *) NULL)
3623    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3624  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3625  if (blur_image == (Image *) NULL)
3626    return(MagickFalse);
3627  ReplaceImageInList(&wand->images,blur_image);
3628  return(MagickTrue);
3629}
3630
3631/*
3632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633%                                                                             %
3634%                                                                             %
3635%                                                                             %
3636%   M a g i c k G e t I m a g e                                               %
3637%                                                                             %
3638%                                                                             %
3639%                                                                             %
3640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641%
3642%  MagickGetImage() gets the image at the current image index.
3643%
3644%  The format of the MagickGetImage method is:
3645%
3646%      MagickWand *MagickGetImage(MagickWand *wand)
3647%
3648%  A description of each parameter follows:
3649%
3650%    o wand: the magick wand.
3651%
3652*/
3653WandExport MagickWand *MagickGetImage(MagickWand *wand)
3654{
3655  Image
3656    *image;
3657
3658  assert(wand != (MagickWand *) NULL);
3659  assert(wand->signature == MagickWandSignature);
3660  if (wand->debug != MagickFalse)
3661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3662  if (wand->images == (Image *) NULL)
3663    {
3664      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3665        "ContainsNoImages","`%s'",wand->name);
3666      return((MagickWand *) NULL);
3667    }
3668  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3669  if (image == (Image *) NULL)
3670    return((MagickWand *) NULL);
3671  return(CloneMagickWandFromImages(wand,image));
3672}
3673
3674/*
3675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3676%                                                                             %
3677%                                                                             %
3678%                                                                             %
3679%   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                       %
3680%                                                                             %
3681%                                                                             %
3682%                                                                             %
3683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684%
3685%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3686%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3687%  than CMYKA.
3688%
3689%  The format of the MagickGetImageAlphaChannel method is:
3690%
3691%      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3692%
3693%  A description of each parameter follows:
3694%
3695%    o wand: the magick wand.
3696%
3697*/
3698WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3699{
3700  assert(wand != (MagickWand *) NULL);
3701  assert(wand->signature == MagickWandSignature);
3702  if (wand->debug != MagickFalse)
3703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704  if (wand->images == (Image *) NULL)
3705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706  return(GetImageAlphaChannel(wand->images));
3707}
3708
3709/*
3710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3711%                                                                             %
3712%                                                                             %
3713%                                                                             %
3714%   M a g i c k G e t I m a g e C l i p M a s k                               %
3715%                                                                             %
3716%                                                                             %
3717%                                                                             %
3718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719%
3720%  MagickGetImageMask() gets the image clip mask at the current image index.
3721%
3722%  The format of the MagickGetImageMask method is:
3723%
3724%      MagickWand *MagickGetImageMask(MagickWand *wand)
3725%
3726%  A description of each parameter follows:
3727%
3728%    o wand: the magick wand.
3729%
3730*/
3731WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3732{
3733  Image
3734    *image;
3735
3736  assert(wand != (MagickWand *) NULL);
3737  assert(wand->signature == MagickWandSignature);
3738  if (wand->debug != MagickFalse)
3739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3740  if (wand->images == (Image *) NULL)
3741    {
3742      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3743        "ContainsNoImages","`%s'",wand->name);
3744      return((MagickWand *) NULL);
3745    }
3746  image=GetImageMask(wand->images,wand->exception);
3747  if (image == (Image *) NULL)
3748    return((MagickWand *) NULL);
3749  return(CloneMagickWandFromImages(wand,image));
3750}
3751
3752/*
3753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3754%                                                                             %
3755%                                                                             %
3756%                                                                             %
3757%   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                 %
3758%                                                                             %
3759%                                                                             %
3760%                                                                             %
3761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3762%
3763%  MagickGetImageBackgroundColor() returns the image background color.
3764%
3765%  The format of the MagickGetImageBackgroundColor method is:
3766%
3767%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3768%        PixelWand *background_color)
3769%
3770%  A description of each parameter follows:
3771%
3772%    o wand: the magick wand.
3773%
3774%    o background_color: Return the background color.
3775%
3776*/
3777WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3778  PixelWand *background_color)
3779{
3780  assert(wand != (MagickWand *) NULL);
3781  assert(wand->signature == MagickWandSignature);
3782  if (wand->debug != MagickFalse)
3783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3784  if (wand->images == (Image *) NULL)
3785    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3786  PixelSetPixelColor(background_color,&wand->images->background_color);
3787  return(MagickTrue);
3788}
3789
3790/*
3791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3792%                                                                             %
3793%                                                                             %
3794%                                                                             %
3795%   M a g i c k G e t I m a g e B l o b                                       %
3796%                                                                             %
3797%                                                                             %
3798%                                                                             %
3799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3800%
3801%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3802%  the image as a blob (a formatted "file" in memory) and its length, starting
3803%  from the current position in the image sequence.  Use MagickSetImageFormat()
3804%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3805%
3806%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3807%  the image sequence.
3808%
3809%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3810%
3811%  The format of the MagickGetImageBlob method is:
3812%
3813%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3814%
3815%  A description of each parameter follows:
3816%
3817%    o wand: the magick wand.
3818%
3819%    o length: the length of the blob.
3820%
3821*/
3822WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3823{
3824  unsigned char
3825    *blob;
3826
3827  assert(wand != (MagickWand *) NULL);
3828  assert(wand->signature == MagickWandSignature);
3829  if (wand->debug != MagickFalse)
3830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3831  if (wand->images == (Image *) NULL)
3832    {
3833      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3834        "ContainsNoImages","`%s'",wand->name);
3835      return((unsigned char *) NULL);
3836    }
3837  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3838    wand->exception);
3839  return(blob);
3840}
3841
3842/*
3843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3844%                                                                             %
3845%                                                                             %
3846%                                                                             %
3847%   M a g i c k G e t I m a g e s B l o b                                     %
3848%                                                                             %
3849%                                                                             %
3850%                                                                             %
3851%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3852%
3853%  MagickGetImageBlob() implements direct to memory image formats.  It
3854%  returns the image sequence as a blob and its length.  The format of the image
3855%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3856%  return a different image format, use MagickSetImageFormat().
3857%
3858%  Note, some image formats do not permit multiple images to the same image
3859%  stream (e.g. JPEG).  in this instance, just the first image of the
3860%  sequence is returned as a blob.
3861%
3862%  The format of the MagickGetImagesBlob method is:
3863%
3864%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3865%
3866%  A description of each parameter follows:
3867%
3868%    o wand: the magick wand.
3869%
3870%    o length: the length of the blob.
3871%
3872*/
3873WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3874{
3875  unsigned char
3876    *blob;
3877
3878  assert(wand != (MagickWand *) NULL);
3879  assert(wand->signature == MagickWandSignature);
3880  if (wand->debug != MagickFalse)
3881    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3882  if (wand->images == (Image *) NULL)
3883    {
3884      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3885        "ContainsNoImages","`%s'",wand->name);
3886      return((unsigned char *) NULL);
3887    }
3888  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3889    wand->images),length,wand->exception);
3890  return(blob);
3891}
3892
3893/*
3894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895%                                                                             %
3896%                                                                             %
3897%                                                                             %
3898%   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                         %
3899%                                                                             %
3900%                                                                             %
3901%                                                                             %
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903%
3904%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3905%  image.
3906%
3907%  The format of the MagickGetImageBluePrimary method is:
3908%
3909%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3910%        double *y)
3911%
3912%  A description of each parameter follows:
3913%
3914%    o wand: the magick wand.
3915%
3916%    o x: the chromaticity blue primary x-point.
3917%
3918%    o y: the chromaticity blue primary y-point.
3919%
3920*/
3921WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3922  double *x,double *y)
3923{
3924  assert(wand != (MagickWand *) NULL);
3925  assert(wand->signature == MagickWandSignature);
3926  if (wand->debug != MagickFalse)
3927    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3928  if (wand->images == (Image *) NULL)
3929    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3930  *x=wand->images->chromaticity.blue_primary.x;
3931  *y=wand->images->chromaticity.blue_primary.y;
3932  return(MagickTrue);
3933}
3934
3935/*
3936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3937%                                                                             %
3938%                                                                             %
3939%                                                                             %
3940%   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                         %
3941%                                                                             %
3942%                                                                             %
3943%                                                                             %
3944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3945%
3946%  MagickGetImageBorderColor() returns the image border color.
3947%
3948%  The format of the MagickGetImageBorderColor method is:
3949%
3950%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3951%        PixelWand *border_color)
3952%
3953%  A description of each parameter follows:
3954%
3955%    o wand: the magick wand.
3956%
3957%    o border_color: Return the border color.
3958%
3959*/
3960WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3961  PixelWand *border_color)
3962{
3963  assert(wand != (MagickWand *) NULL);
3964  assert(wand->signature == MagickWandSignature);
3965  if (wand->debug != MagickFalse)
3966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3967  if (wand->images == (Image *) NULL)
3968    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3969  PixelSetPixelColor(border_color,&wand->images->border_color);
3970  return(MagickTrue);
3971}
3972
3973/*
3974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3975%                                                                             %
3976%                                                                             %
3977%                                                                             %
3978%   M a g i c k G e t I m a g e F e a t u r e s                               %
3979%                                                                             %
3980%                                                                             %
3981%                                                                             %
3982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3983%
3984%  MagickGetImageFeatures() returns features for each channel in the
3985%  image in each of four directions (horizontal, vertical, left and right
3986%  diagonals) for the specified distance.  The features include the angular
3987%  second moment, contrast, correlation, sum of squares: variance, inverse
3988%  difference moment, sum average, sum varience, sum entropy, entropy,
3989%  difference variance, difference entropy, information measures of
3990%  correlation 1, information measures of correlation 2, and maximum
3991%  correlation coefficient.  You can access the red channel contrast, for
3992%  example, like this:
3993%
3994%      channel_features=MagickGetImageFeatures(wand,1);
3995%      contrast=channel_features[RedPixelChannel].contrast[0];
3996%
3997%  Use MagickRelinquishMemory() to free the statistics buffer.
3998%
3999%  The format of the MagickGetImageFeatures method is:
4000%
4001%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4002%        const size_t distance)
4003%
4004%  A description of each parameter follows:
4005%
4006%    o wand: the magick wand.
4007%
4008%    o distance: the distance.
4009%
4010*/
4011WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4012  const size_t distance)
4013{
4014  assert(wand != (MagickWand *) NULL);
4015  assert(wand->signature == MagickWandSignature);
4016  if (wand->debug != MagickFalse)
4017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4018  if (wand->images == (Image *) NULL)
4019    {
4020      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4021        "ContainsNoImages","`%s'",wand->name);
4022      return((ChannelFeatures *) NULL);
4023    }
4024  return(GetImageFeatures(wand->images,distance,wand->exception));
4025}
4026
4027/*
4028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4029%                                                                             %
4030%                                                                             %
4031%                                                                             %
4032%   M a g i c k G e t I m a g e K u r t o s i s                               %
4033%                                                                             %
4034%                                                                             %
4035%                                                                             %
4036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4037%
4038%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4039%  more image channels.
4040%
4041%  The format of the MagickGetImageKurtosis method is:
4042%
4043%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4044%        double *kurtosis,double *skewness)
4045%
4046%  A description of each parameter follows:
4047%
4048%    o wand: the magick wand.
4049%
4050%    o kurtosis:  The kurtosis for the specified channel(s).
4051%
4052%    o skewness:  The skewness for the specified channel(s).
4053%
4054*/
4055WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4056  double *kurtosis,double *skewness)
4057{
4058  MagickBooleanType
4059    status;
4060
4061  assert(wand != (MagickWand *) NULL);
4062  assert(wand->signature == MagickWandSignature);
4063  if (wand->debug != MagickFalse)
4064    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4065  if (wand->images == (Image *) NULL)
4066    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4067  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4068  return(status);
4069}
4070
4071/*
4072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4073%                                                                             %
4074%                                                                             %
4075%                                                                             %
4076%   M a g i c k G e t I m a g e M e a n                                       %
4077%                                                                             %
4078%                                                                             %
4079%                                                                             %
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%
4082%  MagickGetImageMean() gets the mean and standard deviation of one or more
4083%  image channels.
4084%
4085%  The format of the MagickGetImageMean method is:
4086%
4087%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4088%        double *standard_deviation)
4089%
4090%  A description of each parameter follows:
4091%
4092%    o wand: the magick wand.
4093%
4094%    o channel: the image channel(s).
4095%
4096%    o mean:  The mean pixel value for the specified channel(s).
4097%
4098%    o standard_deviation:  The standard deviation for the specified channel(s).
4099%
4100*/
4101WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4102  double *standard_deviation)
4103{
4104  MagickBooleanType
4105    status;
4106
4107  assert(wand != (MagickWand *) NULL);
4108  assert(wand->signature == MagickWandSignature);
4109  if (wand->debug != MagickFalse)
4110    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4111  if (wand->images == (Image *) NULL)
4112    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4113  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4114  return(status);
4115}
4116
4117/*
4118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4119%                                                                             %
4120%                                                                             %
4121%                                                                             %
4122%   M a g i c k G e t I m a g e R a n g e                                     %
4123%                                                                             %
4124%                                                                             %
4125%                                                                             %
4126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4127%
4128%  MagickGetImageRange() gets the range for one or more image channels.
4129%
4130%  The format of the MagickGetImageRange method is:
4131%
4132%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4133%        double *maxima)
4134%
4135%  A description of each parameter follows:
4136%
4137%    o wand: the magick wand.
4138%
4139%    o minima:  The minimum pixel value for the specified channel(s).
4140%
4141%    o maxima:  The maximum pixel value for the specified channel(s).
4142%
4143*/
4144WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4145  double *minima,double *maxima)
4146{
4147  MagickBooleanType
4148    status;
4149
4150  assert(wand != (MagickWand *) NULL);
4151  assert(wand->signature == MagickWandSignature);
4152  if (wand->debug != MagickFalse)
4153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4154  if (wand->images == (Image *) NULL)
4155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4156  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4157  return(status);
4158}
4159
4160/*
4161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4162%                                                                             %
4163%                                                                             %
4164%                                                                             %
4165%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4166%                                                                             %
4167%                                                                             %
4168%                                                                             %
4169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4170%
4171%  MagickGetImageStatistics() returns statistics for each channel in the
4172%  image.  The statistics include the channel depth, its minima and
4173%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4174%  You can access the red channel mean, for example, like this:
4175%
4176%      channel_statistics=MagickGetImageStatistics(wand);
4177%      red_mean=channel_statistics[RedPixelChannel].mean;
4178%
4179%  Use MagickRelinquishMemory() to free the statistics buffer.
4180%
4181%  The format of the MagickGetImageStatistics method is:
4182%
4183%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4184%
4185%  A description of each parameter follows:
4186%
4187%    o wand: the magick wand.
4188%
4189*/
4190WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4191{
4192  assert(wand != (MagickWand *) NULL);
4193  assert(wand->signature == MagickWandSignature);
4194  if (wand->debug != MagickFalse)
4195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4196  if (wand->images == (Image *) NULL)
4197    {
4198      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4199        "ContainsNoImages","`%s'",wand->name);
4200      return((ChannelStatistics *) NULL);
4201    }
4202  return(GetImageStatistics(wand->images,wand->exception));
4203}
4204
4205/*
4206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4207%                                                                             %
4208%                                                                             %
4209%                                                                             %
4210%   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                     %
4211%                                                                             %
4212%                                                                             %
4213%                                                                             %
4214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4215%
4216%  MagickGetImageColormapColor() returns the color of the specified colormap
4217%  index.
4218%
4219%  The format of the MagickGetImageColormapColor method is:
4220%
4221%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4222%        const size_t index,PixelWand *color)
4223%
4224%  A description of each parameter follows:
4225%
4226%    o wand: the magick wand.
4227%
4228%    o index: the offset into the image colormap.
4229%
4230%    o color: Return the colormap color in this wand.
4231%
4232*/
4233WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4234  const size_t index,PixelWand *color)
4235{
4236  assert(wand != (MagickWand *) NULL);
4237  assert(wand->signature == MagickWandSignature);
4238  if (wand->debug != MagickFalse)
4239    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4240  if (wand->images == (Image *) NULL)
4241    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4242  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4243      (index >= wand->images->colors))
4244    {
4245      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4246        "InvalidColormapIndex","`%s'",wand->name);
4247      return(MagickFalse);
4248    }
4249  PixelSetPixelColor(color,wand->images->colormap+index);
4250  return(MagickTrue);
4251}
4252
4253/*
4254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4255%                                                                             %
4256%                                                                             %
4257%                                                                             %
4258%   M a g i c k G e t I m a g e C o l o r s                                   %
4259%                                                                             %
4260%                                                                             %
4261%                                                                             %
4262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4263%
4264%  MagickGetImageColors() gets the number of unique colors in the image.
4265%
4266%  The format of the MagickGetImageColors method is:
4267%
4268%      size_t MagickGetImageColors(MagickWand *wand)
4269%
4270%  A description of each parameter follows:
4271%
4272%    o wand: the magick wand.
4273%
4274*/
4275WandExport size_t MagickGetImageColors(MagickWand *wand)
4276{
4277  assert(wand != (MagickWand *) NULL);
4278  assert(wand->signature == MagickWandSignature);
4279  if (wand->debug != MagickFalse)
4280    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4281  if (wand->images == (Image *) NULL)
4282    {
4283      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4284        "ContainsNoImages","`%s'",wand->name);
4285      return(0);
4286    }
4287  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4288}
4289
4290/*
4291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4292%                                                                             %
4293%                                                                             %
4294%                                                                             %
4295%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4296%                                                                             %
4297%                                                                             %
4298%                                                                             %
4299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4300%
4301%  MagickGetImageColorspace() gets the image colorspace.
4302%
4303%  The format of the MagickGetImageColorspace method is:
4304%
4305%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4306%
4307%  A description of each parameter follows:
4308%
4309%    o wand: the magick wand.
4310%
4311*/
4312WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4313{
4314  assert(wand != (MagickWand *) NULL);
4315  assert(wand->signature == MagickWandSignature);
4316  if (wand->debug != MagickFalse)
4317    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4318  if (wand->images == (Image *) NULL)
4319    {
4320      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4321        "ContainsNoImages","`%s'",wand->name);
4322      return(UndefinedColorspace);
4323    }
4324  return(wand->images->colorspace);
4325}
4326
4327/*
4328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4329%                                                                             %
4330%                                                                             %
4331%                                                                             %
4332%   M a g i c k G e t I m a g e C o m p o s e                                 %
4333%                                                                             %
4334%                                                                             %
4335%                                                                             %
4336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4337%
4338%  MagickGetImageCompose() returns the composite operator associated with the
4339%  image.
4340%
4341%  The format of the MagickGetImageCompose method is:
4342%
4343%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4344%
4345%  A description of each parameter follows:
4346%
4347%    o wand: the magick wand.
4348%
4349*/
4350WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4351{
4352  assert(wand != (MagickWand *) NULL);
4353  assert(wand->signature == MagickWandSignature);
4354  if (wand->debug != MagickFalse)
4355    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4356  if (wand->images == (Image *) NULL)
4357    {
4358      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4359        "ContainsNoImages","`%s'",wand->name);
4360      return(UndefinedCompositeOp);
4361    }
4362  return(wand->images->compose);
4363}
4364
4365/*
4366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4367%                                                                             %
4368%                                                                             %
4369%                                                                             %
4370%   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                         %
4371%                                                                             %
4372%                                                                             %
4373%                                                                             %
4374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4375%
4376%  MagickGetImageCompression() gets the image compression.
4377%
4378%  The format of the MagickGetImageCompression method is:
4379%
4380%      CompressionType MagickGetImageCompression(MagickWand *wand)
4381%
4382%  A description of each parameter follows:
4383%
4384%    o wand: the magick wand.
4385%
4386*/
4387WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4388{
4389  assert(wand != (MagickWand *) NULL);
4390  assert(wand->signature == MagickWandSignature);
4391  if (wand->debug != MagickFalse)
4392    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4393  if (wand->images == (Image *) NULL)
4394    {
4395      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4396        "ContainsNoImages","`%s'",wand->name);
4397      return(UndefinedCompression);
4398    }
4399  return(wand->images->compression);
4400}
4401
4402/*
4403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4404%                                                                             %
4405%                                                                             %
4406%                                                                             %
4407%   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           %
4408%                                                                             %
4409%                                                                             %
4410%                                                                             %
4411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4412%
4413%  MagickGetImageCompressionQuality() gets the image compression quality.
4414%
4415%  The format of the MagickGetImageCompressionQuality method is:
4416%
4417%      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4418%
4419%  A description of each parameter follows:
4420%
4421%    o wand: the magick wand.
4422%
4423*/
4424WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4425{
4426  assert(wand != (MagickWand *) NULL);
4427  assert(wand->signature == MagickWandSignature);
4428  if (wand->debug != MagickFalse)
4429    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4430  if (wand->images == (Image *) NULL)
4431    {
4432      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4433        "ContainsNoImages","`%s'",wand->name);
4434      return(0UL);
4435    }
4436  return(wand->images->quality);
4437}
4438
4439/*
4440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4441%                                                                             %
4442%                                                                             %
4443%                                                                             %
4444%   M a g i c k G e t I m a g e D e l a y                                     %
4445%                                                                             %
4446%                                                                             %
4447%                                                                             %
4448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4449%
4450%  MagickGetImageDelay() gets the image delay.
4451%
4452%  The format of the MagickGetImageDelay method is:
4453%
4454%      size_t MagickGetImageDelay(MagickWand *wand)
4455%
4456%  A description of each parameter follows:
4457%
4458%    o wand: the magick wand.
4459%
4460*/
4461WandExport size_t MagickGetImageDelay(MagickWand *wand)
4462{
4463  assert(wand != (MagickWand *) NULL);
4464  assert(wand->signature == MagickWandSignature);
4465  if (wand->debug != MagickFalse)
4466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4467  if (wand->images == (Image *) NULL)
4468    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4469  return(wand->images->delay);
4470}
4471
4472/*
4473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4474%                                                                             %
4475%                                                                             %
4476%                                                                             %
4477%   M a g i c k G e t I m a g e D e p t h                                     %
4478%                                                                             %
4479%                                                                             %
4480%                                                                             %
4481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4482%
4483%  MagickGetImageDepth() gets the image depth.
4484%
4485%  The format of the MagickGetImageDepth method is:
4486%
4487%      size_t MagickGetImageDepth(MagickWand *wand)
4488%
4489%  A description of each parameter follows:
4490%
4491%    o wand: the magick wand.
4492%
4493*/
4494WandExport size_t MagickGetImageDepth(MagickWand *wand)
4495{
4496  assert(wand != (MagickWand *) NULL);
4497  assert(wand->signature == MagickWandSignature);
4498  if (wand->debug != MagickFalse)
4499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4500  if (wand->images == (Image *) NULL)
4501    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4502  return(wand->images->depth);
4503}
4504
4505/*
4506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4507%                                                                             %
4508%                                                                             %
4509%                                                                             %
4510%   M a g i c k G e t I m a g e D i s p o s e                                 %
4511%                                                                             %
4512%                                                                             %
4513%                                                                             %
4514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4515%
4516%  MagickGetImageDispose() gets the image disposal method.
4517%
4518%  The format of the MagickGetImageDispose method is:
4519%
4520%      DisposeType MagickGetImageDispose(MagickWand *wand)
4521%
4522%  A description of each parameter follows:
4523%
4524%    o wand: the magick wand.
4525%
4526*/
4527WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4528{
4529  assert(wand != (MagickWand *) NULL);
4530  assert(wand->signature == MagickWandSignature);
4531  if (wand->debug != MagickFalse)
4532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4533  if (wand->images == (Image *) NULL)
4534    {
4535      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4536        "ContainsNoImages","`%s'",wand->name);
4537      return(UndefinedDispose);
4538    }
4539  return((DisposeType) wand->images->dispose);
4540}
4541
4542/*
4543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4544%                                                                             %
4545%                                                                             %
4546%                                                                             %
4547%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4548%                                                                             %
4549%                                                                             %
4550%                                                                             %
4551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4552%
4553%  MagickGetImageDistortion() compares an image to a reconstructed image and
4554%  returns the specified distortion metric.
4555%
4556%  The format of the MagickGetImageDistortion method is:
4557%
4558%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4559%        const MagickWand *reference,const MetricType metric,
4560%        double *distortion)
4561%
4562%  A description of each parameter follows:
4563%
4564%    o wand: the magick wand.
4565%
4566%    o reference: the reference wand.
4567%
4568%    o metric: the metric.
4569%
4570%    o distortion: the computed distortion between the images.
4571%
4572*/
4573WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4574  const MagickWand *reference,const MetricType metric,double *distortion)
4575{
4576  MagickBooleanType
4577    status;
4578
4579  assert(wand != (MagickWand *) NULL);
4580  assert(wand->signature == MagickWandSignature);
4581  if (wand->debug != MagickFalse)
4582    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4583  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4584    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4585  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4586    wand->exception);
4587  return(status);
4588}
4589
4590/*
4591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4592%                                                                             %
4593%                                                                             %
4594%                                                                             %
4595%   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                         %
4596%                                                                             %
4597%                                                                             %
4598%                                                                             %
4599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4600%
4601%  MagickGetImageDistortions() compares one or more pixel channels of an
4602%  image to a reconstructed image and returns the specified distortion metrics.
4603%
4604%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4605%
4606%  The format of the MagickGetImageDistortion method is:
4607%
4608%      double *MagickGetImageDistortion(MagickWand *wand,
4609%        const MagickWand *reference,const MetricType metric)
4610%
4611%  A description of each parameter follows:
4612%
4613%    o wand: the magick wand.
4614%
4615%    o reference: the reference wand.
4616%
4617%    o metric: the metric.
4618%
4619*/
4620WandExport double *MagickGetImageDistortions(MagickWand *wand,
4621  const MagickWand *reference,const MetricType metric)
4622{
4623  double
4624    *channel_distortion;
4625
4626  assert(wand != (MagickWand *) NULL);
4627  assert(wand->signature == MagickWandSignature);
4628  if (wand->debug != MagickFalse)
4629    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4630  assert(reference != (MagickWand *) NULL);
4631  assert(reference->signature == MagickWandSignature);
4632  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4633    {
4634      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4635        "ContainsNoImages","`%s'",wand->name);
4636      return((double *) NULL);
4637    }
4638  channel_distortion=GetImageDistortions(wand->images,reference->images,
4639    metric,wand->exception);
4640  return(channel_distortion);
4641}
4642
4643/*
4644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4645%                                                                             %
4646%                                                                             %
4647%                                                                             %
4648%   M a g i c k G e t I m a g e E n d i a n                                   %
4649%                                                                             %
4650%                                                                             %
4651%                                                                             %
4652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4653%
4654%  MagickGetImageEndian() gets the image endian.
4655%
4656%  The format of the MagickGetImageEndian method is:
4657%
4658%      EndianType MagickGetImageEndian(MagickWand *wand)
4659%
4660%  A description of each parameter follows:
4661%
4662%    o wand: the magick wand.
4663%
4664*/
4665WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4666{
4667  assert(wand != (MagickWand *) NULL);
4668  assert(wand->signature == MagickWandSignature);
4669  if (wand->debug != MagickFalse)
4670    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4671  if (wand->images == (Image *) NULL)
4672    {
4673      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4674        "ContainsNoImages","`%s'",wand->name);
4675      return(UndefinedEndian);
4676    }
4677  return(wand->images->endian);
4678}
4679
4680/*
4681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4682%                                                                             %
4683%                                                                             %
4684%                                                                             %
4685%   M a g i c k G e t I m a g e F i l e n a m e                               %
4686%                                                                             %
4687%                                                                             %
4688%                                                                             %
4689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4690%
4691%  MagickGetImageFilename() returns the filename of a particular image in a
4692%  sequence.
4693%
4694%  The format of the MagickGetImageFilename method is:
4695%
4696%      char *MagickGetImageFilename(MagickWand *wand)
4697%
4698%  A description of each parameter follows:
4699%
4700%    o wand: the magick wand.
4701%
4702*/
4703WandExport char *MagickGetImageFilename(MagickWand *wand)
4704{
4705  assert(wand != (MagickWand *) NULL);
4706  assert(wand->signature == MagickWandSignature);
4707  if (wand->debug != MagickFalse)
4708    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4709  if (wand->images == (Image *) NULL)
4710    {
4711      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4712        "ContainsNoImages","`%s'",wand->name);
4713      return((char *) NULL);
4714    }
4715  return(AcquireString(wand->images->filename));
4716}
4717
4718/*
4719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4720%                                                                             %
4721%                                                                             %
4722%                                                                             %
4723%   M a g i c k G e t I m a g e F o r m a t                                   %
4724%                                                                             %
4725%                                                                             %
4726%                                                                             %
4727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4728%
4729%  MagickGetImageFormat() returns the format of a particular image in a
4730%  sequence.
4731%
4732%  The format of the MagickGetImageFormat method is:
4733%
4734%      char *MagickGetImageFormat(MagickWand *wand)
4735%
4736%  A description of each parameter follows:
4737%
4738%    o wand: the magick wand.
4739%
4740*/
4741WandExport char *MagickGetImageFormat(MagickWand *wand)
4742{
4743  assert(wand != (MagickWand *) NULL);
4744  assert(wand->signature == MagickWandSignature);
4745  if (wand->debug != MagickFalse)
4746    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4747  if (wand->images == (Image *) NULL)
4748    {
4749      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4750        "ContainsNoImages","`%s'",wand->name);
4751      return((char *) NULL);
4752    }
4753  return(AcquireString(wand->images->magick));
4754}
4755
4756/*
4757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4758%                                                                             %
4759%                                                                             %
4760%                                                                             %
4761%   M a g i c k G e t I m a g e F u z z                                       %
4762%                                                                             %
4763%                                                                             %
4764%                                                                             %
4765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4766%
4767%  MagickGetImageFuzz() gets the image fuzz.
4768%
4769%  The format of the MagickGetImageFuzz method is:
4770%
4771%      double MagickGetImageFuzz(MagickWand *wand)
4772%
4773%  A description of each parameter follows:
4774%
4775%    o wand: the magick wand.
4776%
4777*/
4778WandExport double MagickGetImageFuzz(MagickWand *wand)
4779{
4780  assert(wand != (MagickWand *) NULL);
4781  assert(wand->signature == MagickWandSignature);
4782  if (wand->debug != MagickFalse)
4783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4784  if (wand->images == (Image *) NULL)
4785    {
4786      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4787        "ContainsNoImages","`%s'",wand->name);
4788      return(0.0);
4789    }
4790  return(wand->images->fuzz);
4791}
4792
4793/*
4794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4795%                                                                             %
4796%                                                                             %
4797%                                                                             %
4798%   M a g i c k G e t I m a g e G a m m a                                     %
4799%                                                                             %
4800%                                                                             %
4801%                                                                             %
4802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4803%
4804%  MagickGetImageGamma() gets the image gamma.
4805%
4806%  The format of the MagickGetImageGamma method is:
4807%
4808%      double MagickGetImageGamma(MagickWand *wand)
4809%
4810%  A description of each parameter follows:
4811%
4812%    o wand: the magick wand.
4813%
4814*/
4815WandExport double MagickGetImageGamma(MagickWand *wand)
4816{
4817  assert(wand != (MagickWand *) NULL);
4818  assert(wand->signature == MagickWandSignature);
4819  if (wand->debug != MagickFalse)
4820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4821  if (wand->images == (Image *) NULL)
4822    {
4823      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4824        "ContainsNoImages","`%s'",wand->name);
4825      return(0.0);
4826    }
4827  return(wand->images->gamma);
4828}
4829
4830/*
4831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4832%                                                                             %
4833%                                                                             %
4834%                                                                             %
4835%   M a g i c k G e t I m a g e G r a v i t y                                 %
4836%                                                                             %
4837%                                                                             %
4838%                                                                             %
4839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4840%
4841%  MagickGetImageGravity() gets the image gravity.
4842%
4843%  The format of the MagickGetImageGravity method is:
4844%
4845%      GravityType MagickGetImageGravity(MagickWand *wand)
4846%
4847%  A description of each parameter follows:
4848%
4849%    o wand: the magick wand.
4850%
4851*/
4852WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4853{
4854  assert(wand != (MagickWand *) NULL);
4855  assert(wand->signature == MagickWandSignature);
4856  if (wand->debug != MagickFalse)
4857    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4858  if (wand->images == (Image *) NULL)
4859    {
4860      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4861        "ContainsNoImages","`%s'",wand->name);
4862      return(UndefinedGravity);
4863    }
4864  return(wand->images->gravity);
4865}
4866
4867/*
4868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4869%                                                                             %
4870%                                                                             %
4871%                                                                             %
4872%   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                       %
4873%                                                                             %
4874%                                                                             %
4875%                                                                             %
4876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4877%
4878%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4879%
4880%  The format of the MagickGetImageGreenPrimary method is:
4881%
4882%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4883%        double *y)
4884%
4885%  A description of each parameter follows:
4886%
4887%    o wand: the magick wand.
4888%
4889%    o x: the chromaticity green primary x-point.
4890%
4891%    o y: the chromaticity green primary y-point.
4892%
4893*/
4894WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4895  double *x,double *y)
4896{
4897  assert(wand != (MagickWand *) NULL);
4898  assert(wand->signature == MagickWandSignature);
4899  if (wand->debug != MagickFalse)
4900    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4901  if (wand->images == (Image *) NULL)
4902    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4903  *x=wand->images->chromaticity.green_primary.x;
4904  *y=wand->images->chromaticity.green_primary.y;
4905  return(MagickTrue);
4906}
4907
4908/*
4909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4910%                                                                             %
4911%                                                                             %
4912%                                                                             %
4913%   M a g i c k G e t I m a g e H e i g h t                                   %
4914%                                                                             %
4915%                                                                             %
4916%                                                                             %
4917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4918%
4919%  MagickGetImageHeight() returns the image height.
4920%
4921%  The format of the MagickGetImageHeight method is:
4922%
4923%      size_t MagickGetImageHeight(MagickWand *wand)
4924%
4925%  A description of each parameter follows:
4926%
4927%    o wand: the magick wand.
4928%
4929*/
4930WandExport size_t MagickGetImageHeight(MagickWand *wand)
4931{
4932  assert(wand != (MagickWand *) NULL);
4933  assert(wand->signature == MagickWandSignature);
4934  if (wand->debug != MagickFalse)
4935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4936  if (wand->images == (Image *) NULL)
4937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4938  return(wand->images->rows);
4939}
4940
4941/*
4942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4943%                                                                             %
4944%                                                                             %
4945%                                                                             %
4946%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4947%                                                                             %
4948%                                                                             %
4949%                                                                             %
4950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951%
4952%  MagickGetImageHistogram() returns the image histogram as an array of
4953%  PixelWand wands.
4954%
4955%  The format of the MagickGetImageHistogram method is:
4956%
4957%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4958%        size_t *number_colors)
4959%
4960%  A description of each parameter follows:
4961%
4962%    o wand: the magick wand.
4963%
4964%    o number_colors: the number of unique colors in the image and the number
4965%      of pixel wands returned.
4966%
4967*/
4968WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4969  size_t *number_colors)
4970{
4971  PixelInfo
4972    *histogram;
4973
4974  PixelWand
4975    **pixel_wands;
4976
4977  register ssize_t
4978    i;
4979
4980  assert(wand != (MagickWand *) NULL);
4981  assert(wand->signature == MagickWandSignature);
4982  if (wand->debug != MagickFalse)
4983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4984  if (wand->images == (Image *) NULL)
4985    {
4986      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4987        "ContainsNoImages","`%s'",wand->name);
4988      return((PixelWand **) NULL);
4989    }
4990  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4991  if (histogram == (PixelInfo *) NULL)
4992    return((PixelWand **) NULL);
4993  pixel_wands=NewPixelWands(*number_colors);
4994  for (i=0; i < (ssize_t) *number_colors; i++)
4995  {
4996    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4997    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4998  }
4999  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5000  return(pixel_wands);
5001}
5002
5003/*
5004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005%                                                                             %
5006%                                                                             %
5007%                                                                             %
5008%   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                 %
5009%                                                                             %
5010%                                                                             %
5011%                                                                             %
5012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013%
5014%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5015%
5016%  The format of the MagickGetImageInterlaceScheme method is:
5017%
5018%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5019%
5020%  A description of each parameter follows:
5021%
5022%    o wand: the magick wand.
5023%
5024*/
5025WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5026{
5027  assert(wand != (MagickWand *) NULL);
5028  assert(wand->signature == MagickWandSignature);
5029  if (wand->debug != MagickFalse)
5030    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5031  if (wand->images == (Image *) NULL)
5032    {
5033      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5034        "ContainsNoImages","`%s'",wand->name);
5035      return(UndefinedInterlace);
5036    }
5037  return(wand->images->interlace);
5038}
5039
5040/*
5041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5042%                                                                             %
5043%                                                                             %
5044%                                                                             %
5045%   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             %
5046%                                                                             %
5047%                                                                             %
5048%                                                                             %
5049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5050%
5051%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5052%  sepcified image.
5053%
5054%  The format of the MagickGetImageInterpolateMethod method is:
5055%
5056%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5057%        MagickWand *wand)
5058%
5059%  A description of each parameter follows:
5060%
5061%    o wand: the magick wand.
5062%
5063*/
5064WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5065  MagickWand *wand)
5066{
5067  assert(wand != (MagickWand *) NULL);
5068  assert(wand->signature == MagickWandSignature);
5069  if (wand->debug != MagickFalse)
5070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5071  if (wand->images == (Image *) NULL)
5072    {
5073      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5074        "ContainsNoImages","`%s'",wand->name);
5075      return(UndefinedInterpolatePixel);
5076    }
5077  return(wand->images->interpolate);
5078}
5079
5080/*
5081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5082%                                                                             %
5083%                                                                             %
5084%                                                                             %
5085%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5086%                                                                             %
5087%                                                                             %
5088%                                                                             %
5089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5090%
5091%  MagickGetImageIterations() gets the image iterations.
5092%
5093%  The format of the MagickGetImageIterations method is:
5094%
5095%      size_t MagickGetImageIterations(MagickWand *wand)
5096%
5097%  A description of each parameter follows:
5098%
5099%    o wand: the magick wand.
5100%
5101*/
5102WandExport size_t MagickGetImageIterations(MagickWand *wand)
5103{
5104  assert(wand != (MagickWand *) NULL);
5105  assert(wand->signature == MagickWandSignature);
5106  if (wand->debug != MagickFalse)
5107    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5108  if (wand->images == (Image *) NULL)
5109    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5110  return(wand->images->iterations);
5111}
5112
5113/*
5114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5115%                                                                             %
5116%                                                                             %
5117%                                                                             %
5118%   M a g i c k G e t I m a g e L e n g t h                                   %
5119%                                                                             %
5120%                                                                             %
5121%                                                                             %
5122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5123%
5124%  MagickGetImageLength() returns the image length in bytes.
5125%
5126%  The format of the MagickGetImageLength method is:
5127%
5128%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5129%        MagickSizeType *length)
5130%
5131%  A description of each parameter follows:
5132%
5133%    o wand: the magick wand.
5134%
5135%    o length: the image length in bytes.
5136%
5137*/
5138WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5139  MagickSizeType *length)
5140{
5141  assert(wand != (MagickWand *) NULL);
5142  assert(wand->signature == MagickWandSignature);
5143  if (wand->debug != MagickFalse)
5144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5145  if (wand->images == (Image *) NULL)
5146    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5147  *length=GetBlobSize(wand->images);
5148  return(MagickTrue);
5149}
5150
5151/*
5152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5153%                                                                             %
5154%                                                                             %
5155%                                                                             %
5156%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5157%                                                                             %
5158%                                                                             %
5159%                                                                             %
5160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5161%
5162%  MagickGetImageMatteColor() returns the image matte color.
5163%
5164%  The format of the MagickGetImageMatteColor method is:
5165%
5166%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5167%        PixelWand *matte_color)
5168%
5169%  A description of each parameter follows:
5170%
5171%    o wand: the magick wand.
5172%
5173%    o matte_color: Return the matte color.
5174%
5175*/
5176WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5177  PixelWand *matte_color)
5178{
5179  assert(wand != (MagickWand *) NULL);
5180  assert(wand->signature == MagickWandSignature);
5181  if (wand->debug != MagickFalse)
5182    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5183  if (wand->images == (Image *) NULL)
5184    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5185  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5186  return(MagickTrue);
5187}
5188
5189/*
5190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5191%                                                                             %
5192%                                                                             %
5193%                                                                             %
5194%   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                         %
5195%                                                                             %
5196%                                                                             %
5197%                                                                             %
5198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5199%
5200%  MagickGetImageOrientation() returns the image orientation.
5201%
5202%  The format of the MagickGetImageOrientation method is:
5203%
5204%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5205%
5206%  A description of each parameter follows:
5207%
5208%    o wand: the magick wand.
5209%
5210*/
5211WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5212{
5213  assert(wand != (MagickWand *) NULL);
5214  assert(wand->signature == MagickWandSignature);
5215  if (wand->debug != MagickFalse)
5216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5217  if (wand->images == (Image *) NULL)
5218    {
5219      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5220        "ContainsNoImages","`%s'",wand->name);
5221      return(UndefinedOrientation);
5222    }
5223  return(wand->images->orientation);
5224}
5225
5226/*
5227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5228%                                                                             %
5229%                                                                             %
5230%                                                                             %
5231%   M a g i c k G e t I m a g e P a g e                                       %
5232%                                                                             %
5233%                                                                             %
5234%                                                                             %
5235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236%
5237%  MagickGetImagePage() returns the page geometry associated with the image.
5238%
5239%  The format of the MagickGetImagePage method is:
5240%
5241%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5242%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5243%
5244%  A description of each parameter follows:
5245%
5246%    o wand: the magick wand.
5247%
5248%    o width: the page width.
5249%
5250%    o height: the page height.
5251%
5252%    o x: the page x-offset.
5253%
5254%    o y: the page y-offset.
5255%
5256*/
5257WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5258  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5259{
5260  assert(wand != (const MagickWand *) NULL);
5261  assert(wand->signature == MagickWandSignature);
5262  if (wand->debug != MagickFalse)
5263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5264  if (wand->images == (Image *) NULL)
5265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5266  *width=wand->images->page.width;
5267  *height=wand->images->page.height;
5268  *x=wand->images->page.x;
5269  *y=wand->images->page.y;
5270  return(MagickTrue);
5271}
5272
5273/*
5274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5275%                                                                             %
5276%                                                                             %
5277%                                                                             %
5278%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5279%                                                                             %
5280%                                                                             %
5281%                                                                             %
5282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283%
5284%  MagickGetImagePixelColor() returns the color of the specified pixel.
5285%
5286%  The format of the MagickGetImagePixelColor method is:
5287%
5288%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5289%        const ssize_t x,const ssize_t y,PixelWand *color)
5290%
5291%  A description of each parameter follows:
5292%
5293%    o wand: the magick wand.
5294%
5295%    o x,y: the pixel offset into the image.
5296%
5297%    o color: Return the colormap color in this wand.
5298%
5299*/
5300WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5301  const ssize_t x,const ssize_t y,PixelWand *color)
5302{
5303  register const Quantum
5304    *p;
5305
5306  CacheView
5307    *image_view;
5308
5309  assert(wand != (MagickWand *) NULL);
5310  assert(wand->signature == MagickWandSignature);
5311  if (wand->debug != MagickFalse)
5312    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5313  if (wand->images == (Image *) NULL)
5314    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5315  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5316  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5317  if (p == (const Quantum *) NULL)
5318    {
5319      image_view=DestroyCacheView(image_view);
5320      return(MagickFalse);
5321    }
5322  PixelSetQuantumPixel(wand->images,p,color);
5323  image_view=DestroyCacheView(image_view);
5324  return(MagickTrue);
5325}
5326
5327/*
5328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5329%                                                                             %
5330%                                                                             %
5331%                                                                             %
5332%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5333%                                                                             %
5334%                                                                             %
5335%                                                                             %
5336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5337%
5338%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5339%
5340%  The format of the MagickGetImageRedPrimary method is:
5341%
5342%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5343%        double *y)
5344%
5345%  A description of each parameter follows:
5346%
5347%    o wand: the magick wand.
5348%
5349%    o x: the chromaticity red primary x-point.
5350%
5351%    o y: the chromaticity red primary y-point.
5352%
5353*/
5354WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5355  double *x,double *y)
5356{
5357  assert(wand != (MagickWand *) NULL);
5358  assert(wand->signature == MagickWandSignature);
5359  if (wand->debug != MagickFalse)
5360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5361  if (wand->images == (Image *) NULL)
5362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5363  *x=wand->images->chromaticity.red_primary.x;
5364  *y=wand->images->chromaticity.red_primary.y;
5365  return(MagickTrue);
5366}
5367
5368/*
5369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370%                                                                             %
5371%                                                                             %
5372%                                                                             %
5373%   M a g i c k G e t I m a g e R e g i o n                                   %
5374%                                                                             %
5375%                                                                             %
5376%                                                                             %
5377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5378%
5379%  MagickGetImageRegion() extracts a region of the image and returns it as a
5380%  a new wand.
5381%
5382%  The format of the MagickGetImageRegion method is:
5383%
5384%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5385%        const size_t width,const size_t height,const ssize_t x,
5386%        const ssize_t y)
5387%
5388%  A description of each parameter follows:
5389%
5390%    o wand: the magick wand.
5391%
5392%    o width: the region width.
5393%
5394%    o height: the region height.
5395%
5396%    o x: the region x offset.
5397%
5398%    o y: the region y offset.
5399%
5400*/
5401WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5402  const size_t width,const size_t height,const ssize_t x,
5403  const ssize_t y)
5404{
5405  Image
5406    *region_image;
5407
5408  RectangleInfo
5409    region;
5410
5411  assert(wand != (MagickWand *) NULL);
5412  assert(wand->signature == MagickWandSignature);
5413  if (wand->debug != MagickFalse)
5414    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5415  if (wand->images == (Image *) NULL)
5416    return((MagickWand *) NULL);
5417  region.width=width;
5418  region.height=height;
5419  region.x=x;
5420  region.y=y;
5421  region_image=CropImage(wand->images,&region,wand->exception);
5422  if (region_image == (Image *) NULL)
5423    return((MagickWand *) NULL);
5424  return(CloneMagickWandFromImages(wand,region_image));
5425}
5426
5427/*
5428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5429%                                                                             %
5430%                                                                             %
5431%                                                                             %
5432%   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                 %
5433%                                                                             %
5434%                                                                             %
5435%                                                                             %
5436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437%
5438%  MagickGetImageRenderingIntent() gets the image rendering intent.
5439%
5440%  The format of the MagickGetImageRenderingIntent method is:
5441%
5442%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5443%
5444%  A description of each parameter follows:
5445%
5446%    o wand: the magick wand.
5447%
5448*/
5449WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5450{
5451  assert(wand != (MagickWand *) NULL);
5452  assert(wand->signature == MagickWandSignature);
5453  if (wand->debug != MagickFalse)
5454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5455  if (wand->images == (Image *) NULL)
5456    {
5457      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5458        "ContainsNoImages","`%s'",wand->name);
5459      return(UndefinedIntent);
5460    }
5461  return((RenderingIntent) wand->images->rendering_intent);
5462}
5463
5464/*
5465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5466%                                                                             %
5467%                                                                             %
5468%                                                                             %
5469%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5470%                                                                             %
5471%                                                                             %
5472%                                                                             %
5473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5474%
5475%  MagickGetImageResolution() gets the image X and Y resolution.
5476%
5477%  The format of the MagickGetImageResolution method is:
5478%
5479%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5480%        double *y)
5481%
5482%  A description of each parameter follows:
5483%
5484%    o wand: the magick wand.
5485%
5486%    o x: the image x-resolution.
5487%
5488%    o y: the image y-resolution.
5489%
5490*/
5491WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5492  double *x,double *y)
5493{
5494  assert(wand != (MagickWand *) NULL);
5495  assert(wand->signature == MagickWandSignature);
5496  if (wand->debug != MagickFalse)
5497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5498  if (wand->images == (Image *) NULL)
5499    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5500  *x=wand->images->resolution.x;
5501  *y=wand->images->resolution.y;
5502  return(MagickTrue);
5503}
5504
5505/*
5506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5507%                                                                             %
5508%                                                                             %
5509%                                                                             %
5510%   M a g i c k G e t I m a g e S c e n e                                     %
5511%                                                                             %
5512%                                                                             %
5513%                                                                             %
5514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5515%
5516%  MagickGetImageScene() gets the image scene.
5517%
5518%  The format of the MagickGetImageScene method is:
5519%
5520%      size_t MagickGetImageScene(MagickWand *wand)
5521%
5522%  A description of each parameter follows:
5523%
5524%    o wand: the magick wand.
5525%
5526*/
5527WandExport size_t MagickGetImageScene(MagickWand *wand)
5528{
5529  assert(wand != (MagickWand *) NULL);
5530  assert(wand->signature == MagickWandSignature);
5531  if (wand->debug != MagickFalse)
5532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5533  if (wand->images == (Image *) NULL)
5534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5535  return(wand->images->scene);
5536}
5537
5538/*
5539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5540%                                                                             %
5541%                                                                             %
5542%                                                                             %
5543%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5544%                                                                             %
5545%                                                                             %
5546%                                                                             %
5547%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5548%
5549%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5550%  pixel stream.
5551%
5552%  The format of the MagickGetImageSignature method is:
5553%
5554%      char *MagickGetImageSignature(MagickWand *wand)
5555%
5556%  A description of each parameter follows:
5557%
5558%    o wand: the magick wand.
5559%
5560*/
5561WandExport char *MagickGetImageSignature(MagickWand *wand)
5562{
5563  const char
5564    *value;
5565
5566  MagickBooleanType
5567    status;
5568
5569  assert(wand != (MagickWand *) NULL);
5570  assert(wand->signature == MagickWandSignature);
5571  if (wand->debug != MagickFalse)
5572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5573  if (wand->images == (Image *) NULL)
5574    {
5575      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5576        "ContainsNoImages","`%s'",wand->name);
5577      return((char *) NULL);
5578    }
5579  status=SignatureImage(wand->images,wand->exception);
5580  if (IfMagickFalse(status))
5581    return((char *) NULL);
5582  value=GetImageProperty(wand->images,"signature",wand->exception);
5583  if (value == (const char *) NULL)
5584    return((char *) NULL);
5585  return(AcquireString(value));
5586}
5587
5588/*
5589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5590%                                                                             %
5591%                                                                             %
5592%                                                                             %
5593%   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                   %
5594%                                                                             %
5595%                                                                             %
5596%                                                                             %
5597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5598%
5599%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5600%
5601%  The format of the MagickGetImageTicksPerSecond method is:
5602%
5603%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5604%
5605%  A description of each parameter follows:
5606%
5607%    o wand: the magick wand.
5608%
5609*/
5610WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5611{
5612  assert(wand != (MagickWand *) NULL);
5613  assert(wand->signature == MagickWandSignature);
5614  if (wand->debug != MagickFalse)
5615    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5616  if (wand->images == (Image *) NULL)
5617    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5618  return((size_t) wand->images->ticks_per_second);
5619}
5620
5621/*
5622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5623%                                                                             %
5624%                                                                             %
5625%                                                                             %
5626%   M a g i c k G e t I m a g e T y p e                                       %
5627%                                                                             %
5628%                                                                             %
5629%                                                                             %
5630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5631%
5632%  MagickGetImageType() gets the potential image type:
5633%
5634%        Bilevel        Grayscale       GrayscaleMatte
5635%        Palette        PaletteMatte    TrueColor
5636%        TrueColorMatte ColorSeparation ColorSeparationMatte
5637%
5638%  The format of the MagickGetImageType method is:
5639%
5640%      ImageType MagickGetImageType(MagickWand *wand)
5641%
5642%  A description of each parameter follows:
5643%
5644%    o wand: the magick wand.
5645%
5646*/
5647WandExport ImageType MagickGetImageType(MagickWand *wand)
5648{
5649  assert(wand != (MagickWand *) NULL);
5650  assert(wand->signature == MagickWandSignature);
5651  if (wand->debug != MagickFalse)
5652    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5653  if (wand->images == (Image *) NULL)
5654    {
5655      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5656        "ContainsNoImages","`%s'",wand->name);
5657      return(UndefinedType);
5658    }
5659  return(GetImageType(wand->images));
5660}
5661
5662/*
5663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5664%                                                                             %
5665%                                                                             %
5666%                                                                             %
5667%   M a g i c k G e t I m a g e U n i t s                                     %
5668%                                                                             %
5669%                                                                             %
5670%                                                                             %
5671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5672%
5673%  MagickGetImageUnits() gets the image units of resolution.
5674%
5675%  The format of the MagickGetImageUnits method is:
5676%
5677%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5678%
5679%  A description of each parameter follows:
5680%
5681%    o wand: the magick wand.
5682%
5683*/
5684WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5685{
5686  assert(wand != (MagickWand *) NULL);
5687  assert(wand->signature == MagickWandSignature);
5688  if (wand->debug != MagickFalse)
5689    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5690  if (wand->images == (Image *) NULL)
5691    {
5692      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5693        "ContainsNoImages","`%s'",wand->name);
5694      return(UndefinedResolution);
5695    }
5696  return(wand->images->units);
5697}
5698
5699/*
5700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5701%                                                                             %
5702%                                                                             %
5703%                                                                             %
5704%   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           %
5705%                                                                             %
5706%                                                                             %
5707%                                                                             %
5708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5709%
5710%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5711%  sepcified image.
5712%
5713%  The format of the MagickGetImageVirtualPixelMethod method is:
5714%
5715%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5716%
5717%  A description of each parameter follows:
5718%
5719%    o wand: the magick wand.
5720%
5721*/
5722WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5723{
5724  assert(wand != (MagickWand *) NULL);
5725  assert(wand->signature == MagickWandSignature);
5726  if (wand->debug != MagickFalse)
5727    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5728  if (wand->images == (Image *) NULL)
5729    {
5730      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5731        "ContainsNoImages","`%s'",wand->name);
5732      return(UndefinedVirtualPixelMethod);
5733    }
5734  return(GetImageVirtualPixelMethod(wand->images));
5735}
5736
5737/*
5738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5739%                                                                             %
5740%                                                                             %
5741%                                                                             %
5742%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5743%                                                                             %
5744%                                                                             %
5745%                                                                             %
5746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5747%
5748%  MagickGetImageWhitePoint() returns the chromaticy white point.
5749%
5750%  The format of the MagickGetImageWhitePoint method is:
5751%
5752%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5753%        double *y)
5754%
5755%  A description of each parameter follows:
5756%
5757%    o wand: the magick wand.
5758%
5759%    o x: the chromaticity white x-point.
5760%
5761%    o y: the chromaticity white y-point.
5762%
5763*/
5764WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5765  double *x,double *y)
5766{
5767  assert(wand != (MagickWand *) NULL);
5768  assert(wand->signature == MagickWandSignature);
5769  if (wand->debug != MagickFalse)
5770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5771  if (wand->images == (Image *) NULL)
5772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5773  *x=wand->images->chromaticity.white_point.x;
5774  *y=wand->images->chromaticity.white_point.y;
5775  return(MagickTrue);
5776}
5777
5778/*
5779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5780%                                                                             %
5781%                                                                             %
5782%                                                                             %
5783%   M a g i c k G e t I m a g e W i d t h                                     %
5784%                                                                             %
5785%                                                                             %
5786%                                                                             %
5787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5788%
5789%  MagickGetImageWidth() returns the image width.
5790%
5791%  The format of the MagickGetImageWidth method is:
5792%
5793%      size_t MagickGetImageWidth(MagickWand *wand)
5794%
5795%  A description of each parameter follows:
5796%
5797%    o wand: the magick wand.
5798%
5799*/
5800WandExport size_t MagickGetImageWidth(MagickWand *wand)
5801{
5802  assert(wand != (MagickWand *) NULL);
5803  assert(wand->signature == MagickWandSignature);
5804  if (wand->debug != MagickFalse)
5805    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5806  if (wand->images == (Image *) NULL)
5807    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5808  return(wand->images->columns);
5809}
5810
5811/*
5812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5813%                                                                             %
5814%                                                                             %
5815%                                                                             %
5816%   M a g i c k G e t N u m b e r I m a g e s                                 %
5817%                                                                             %
5818%                                                                             %
5819%                                                                             %
5820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5821%
5822%  MagickGetNumberImages() returns the number of images associated with a
5823%  magick wand.
5824%
5825%  The format of the MagickGetNumberImages method is:
5826%
5827%      size_t MagickGetNumberImages(MagickWand *wand)
5828%
5829%  A description of each parameter follows:
5830%
5831%    o wand: the magick wand.
5832%
5833*/
5834WandExport size_t MagickGetNumberImages(MagickWand *wand)
5835{
5836  assert(wand != (MagickWand *) NULL);
5837  assert(wand->signature == MagickWandSignature);
5838  if (wand->debug != MagickFalse)
5839    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5840  return(GetImageListLength(wand->images));
5841}
5842
5843/*
5844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5845%                                                                             %
5846%                                                                             %
5847%                                                                             %
5848%   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                 %
5849%                                                                             %
5850%                                                                             %
5851%                                                                             %
5852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5853%
5854%  MagickGetImageTotalInkDensity() gets the image total ink density.
5855%
5856%  The format of the MagickGetImageTotalInkDensity method is:
5857%
5858%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5859%
5860%  A description of each parameter follows:
5861%
5862%    o wand: the magick wand.
5863%
5864*/
5865WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5866{
5867  assert(wand != (MagickWand *) NULL);
5868  assert(wand->signature == MagickWandSignature);
5869  if (wand->debug != MagickFalse)
5870    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5871  if (wand->images == (Image *) NULL)
5872    {
5873      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5874        "ContainsNoImages","`%s'",wand->name);
5875      return(0.0);
5876    }
5877  return(GetImageTotalInkDensity(wand->images,wand->exception));
5878}
5879
5880/*
5881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5882%                                                                             %
5883%                                                                             %
5884%                                                                             %
5885%   M a g i c k H a l d C l u t I m a g e                                     %
5886%                                                                             %
5887%                                                                             %
5888%                                                                             %
5889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5890%
5891%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5892%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5893%  dimensions.  Create it with the HALD coder.  You can apply any color
5894%  transformation to the Hald image and then use this method to apply the
5895%  transform to the image.
5896%
5897%  The format of the MagickHaldClutImage method is:
5898%
5899%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5900%        const MagickWand *hald_wand)
5901%
5902%  A description of each parameter follows:
5903%
5904%    o wand: the magick wand.
5905%
5906%    o hald_image: the hald CLUT image.
5907%
5908*/
5909WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5910  const MagickWand *hald_wand)
5911{
5912  MagickBooleanType
5913    status;
5914
5915  assert(wand != (MagickWand *) NULL);
5916  assert(wand->signature == MagickWandSignature);
5917  if (wand->debug != MagickFalse)
5918    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5919  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5920    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5921  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5922  return(status);
5923}
5924
5925/*
5926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5927%                                                                             %
5928%                                                                             %
5929%                                                                             %
5930%   M a g i c k H a s N e x t I m a g e                                       %
5931%                                                                             %
5932%                                                                             %
5933%                                                                             %
5934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5935%
5936%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5937%  traversing the list in the forward direction
5938%
5939%  The format of the MagickHasNextImage method is:
5940%
5941%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5942%
5943%  A description of each parameter follows:
5944%
5945%    o wand: the magick wand.
5946%
5947*/
5948WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5949{
5950  assert(wand != (MagickWand *) NULL);
5951  assert(wand->signature == MagickWandSignature);
5952  if (wand->debug != MagickFalse)
5953    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5954  if (wand->images == (Image *) NULL)
5955    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5956  if (GetNextImageInList(wand->images) == (Image *) NULL)
5957    return(MagickFalse);
5958  return(MagickTrue);
5959}
5960
5961/*
5962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5963%                                                                             %
5964%                                                                             %
5965%                                                                             %
5966%   M a g i c k H a s P r e v i o u s I m a g e                               %
5967%                                                                             %
5968%                                                                             %
5969%                                                                             %
5970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5971%
5972%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5973%  traversing the list in the reverse direction
5974%
5975%  The format of the MagickHasPreviousImage method is:
5976%
5977%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5978%
5979%  A description of each parameter follows:
5980%
5981%    o wand: the magick wand.
5982%
5983*/
5984WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5985{
5986  assert(wand != (MagickWand *) NULL);
5987  assert(wand->signature == MagickWandSignature);
5988  if (wand->debug != MagickFalse)
5989    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5990  if (wand->images == (Image *) NULL)
5991    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5992  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5993    return(MagickFalse);
5994  return(MagickTrue);
5995}
5996
5997/*
5998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5999%                                                                             %
6000%                                                                             %
6001%                                                                             %
6002%   M a g i c k I d e n t i f y I m a g e                                     %
6003%                                                                             %
6004%                                                                             %
6005%                                                                             %
6006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6007%
6008%  MagickIdentifyImage() identifies an image by printing its attributes to the
6009%  file.  Attributes include the image width, height, size, and others.
6010%
6011%  The format of the MagickIdentifyImage method is:
6012%
6013%      const char *MagickIdentifyImage(MagickWand *wand)
6014%
6015%  A description of each parameter follows:
6016%
6017%    o wand: the magick wand.
6018%
6019*/
6020WandExport char *MagickIdentifyImage(MagickWand *wand)
6021{
6022  char
6023    *description,
6024    filename[MagickPathExtent];
6025
6026  FILE
6027    *file;
6028
6029  int
6030    unique_file;
6031
6032  assert(wand != (MagickWand *) NULL);
6033  assert(wand->signature == MagickWandSignature);
6034  if (wand->debug != MagickFalse)
6035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6036  if (wand->images == (Image *) NULL)
6037    {
6038      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6039        "ContainsNoImages","`%s'",wand->name);
6040      return((char *) NULL);
6041    }
6042  description=(char *) NULL;
6043  unique_file=AcquireUniqueFileResource(filename);
6044  file=(FILE *) NULL;
6045  if (unique_file != -1)
6046    file=fdopen(unique_file,"wb");
6047  if ((unique_file == -1) || (file == (FILE *) NULL))
6048    {
6049      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6050        "UnableToCreateTemporaryFile","`%s'",wand->name);
6051      return((char *) NULL);
6052    }
6053  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6054  (void) fclose(file);
6055  description=FileToString(filename,~0UL,wand->exception);
6056  (void) RelinquishUniqueFileResource(filename);
6057  return(description);
6058}
6059
6060/*
6061%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6062%                                                                             %
6063%                                                                             %
6064%                                                                             %
6065%   M a g i c k I d e n t i f y I m a g e T y p e                             %
6066%                                                                             %
6067%                                                                             %
6068%                                                                             %
6069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6070%
6071%  MagickIdentifyImageType() gets the potential image type:
6072%
6073%        Bilevel        Grayscale       GrayscaleMatte
6074%        Palette        PaletteMatte    TrueColor
6075%        TrueColorMatte ColorSeparation ColorSeparationMatte
6076%
6077%  To ensure the image type matches its potential, use MagickSetImageType():
6078%
6079%    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6080%
6081%  The format of the MagickIdentifyImageType method is:
6082%
6083%      ImageType MagickIdentifyImageType(MagickWand *wand)
6084%
6085%  A description of each parameter follows:
6086%
6087%    o wand: the magick wand.
6088%
6089*/
6090WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6091{
6092  assert(wand != (MagickWand *) NULL);
6093  assert(wand->signature == MagickWandSignature);
6094  if (wand->debug != MagickFalse)
6095    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6096  if (wand->images == (Image *) NULL)
6097    {
6098      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6099        "ContainsNoImages","`%s'",wand->name);
6100      return(UndefinedType);
6101    }
6102  return(IdentifyImageType(wand->images,wand->exception));
6103}
6104
6105/*
6106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6107%                                                                             %
6108%                                                                             %
6109%                                                                             %
6110%   M a g i c k I m p l o d e I m a g e                                       %
6111%                                                                             %
6112%                                                                             %
6113%                                                                             %
6114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115%
6116%  MagickImplodeImage() creates a new image that is a copy of an existing
6117%  one with the image pixels "implode" by the specified percentage.  It
6118%  allocates the memory necessary for the new Image structure and returns a
6119%  pointer to the new image.
6120%
6121%  The format of the MagickImplodeImage method is:
6122%
6123%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6124%        const double radius,const PixelInterpolateMethod method)
6125%
6126%  A description of each parameter follows:
6127%
6128%    o wand: the magick wand.
6129%
6130%    o amount: Define the extent of the implosion.
6131%
6132%    o method: the pixel interpolation method.
6133%
6134*/
6135WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6136  const double amount,const PixelInterpolateMethod method)
6137{
6138  Image
6139    *implode_image;
6140
6141  assert(wand != (MagickWand *) NULL);
6142  assert(wand->signature == MagickWandSignature);
6143  if (wand->debug != MagickFalse)
6144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6145  if (wand->images == (Image *) NULL)
6146    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6147  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6148  if (implode_image == (Image *) NULL)
6149    return(MagickFalse);
6150  ReplaceImageInList(&wand->images,implode_image);
6151  return(MagickTrue);
6152}
6153
6154/*
6155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6156%                                                                             %
6157%                                                                             %
6158%                                                                             %
6159%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6160%                                                                             %
6161%                                                                             %
6162%                                                                             %
6163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6164%
6165%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6166%  location you specify.  The method returns MagickFalse on success otherwise
6167%  MagickTrue if an error is encountered.  The pixel data can be either char,
6168%  short int, int, ssize_t, float, or double in the order specified by map.
6169%
6170%  Suppose your want to upload the first scanline of a 640x480 image from
6171%  character data in red-green-blue order:
6172%
6173%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6174%
6175%  The format of the MagickImportImagePixels method is:
6176%
6177%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6178%        const ssize_t x,const ssize_t y,const size_t columns,
6179%        const size_t rows,const char *map,const StorageType storage,
6180%        const void *pixels)
6181%
6182%  A description of each parameter follows:
6183%
6184%    o wand: the magick wand.
6185%
6186%    o x, y, columns, rows:  These values define the perimeter of a region
6187%      of pixels you want to define.
6188%
6189%    o map:  This string reflects the expected ordering of the pixel array.
6190%      It can be any combination or order of R = red, G = green, B = blue,
6191%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6192%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6193%      P = pad.
6194%
6195%    o storage: Define the data type of the pixels.  Float and double types are
6196%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6197%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6198%      or DoublePixel.
6199%
6200%    o pixels: This array of values contain the pixel components as defined by
6201%      map and type.  You must preallocate this array where the expected
6202%      length varies depending on the values of width, height, map, and type.
6203%
6204*/
6205WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6206  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6207  const char *map,const StorageType storage,const void *pixels)
6208{
6209  MagickBooleanType
6210    status;
6211
6212  assert(wand != (MagickWand *) NULL);
6213  assert(wand->signature == MagickWandSignature);
6214  if (wand->debug != MagickFalse)
6215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6216  if (wand->images == (Image *) NULL)
6217    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6218  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6219    wand->exception);
6220  return(status);
6221}
6222
6223/*
6224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6225%                                                                             %
6226%                                                                             %
6227%                                                                             %
6228%   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               %
6229%                                                                             %
6230%                                                                             %
6231%                                                                             %
6232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6233%
6234%  MagickInterpolativeResizeImage() resize image using a interpolative
6235%  method.
6236%
6237%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6238%        const size_t columns,const size_t rows,
6239%        const PixelInterpolateMethod method)
6240%
6241%  A description of each parameter follows:
6242%
6243%    o wand: the magick wand.
6244%
6245%    o columns: the number of columns in the scaled image.
6246%
6247%    o rows: the number of rows in the scaled image.
6248%
6249%    o interpolate: the pixel interpolation method.
6250%
6251*/
6252WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6253  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6254{
6255  Image
6256    *resize_image;
6257
6258  assert(wand != (MagickWand *) NULL);
6259  assert(wand->signature == MagickWandSignature);
6260  if (wand->debug != MagickFalse)
6261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6262  if (wand->images == (Image *) NULL)
6263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6264  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6265    wand->exception);
6266  if (resize_image == (Image *) NULL)
6267    return(MagickFalse);
6268  ReplaceImageInList(&wand->images,resize_image);
6269  return(MagickTrue);
6270}
6271
6272/*
6273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6274%                                                                             %
6275%                                                                             %
6276%                                                                             %
6277%   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       %
6278%                                                                             %
6279%                                                                             %
6280%                                                                             %
6281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6282%
6283%  MagickInverseFourierTransformImage() implements the inverse discrete
6284%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6285%  imaginary image pair.
6286%
6287%  The format of the MagickInverseFourierTransformImage method is:
6288%
6289%      MagickBooleanType MagickInverseFourierTransformImage(
6290%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6291%        const MagickBooleanType magnitude)
6292%
6293%  A description of each parameter follows:
6294%
6295%    o magnitude_wand: the magnitude or real wand.
6296%
6297%    o phase_wand: the phase or imaginary wand.
6298%
6299%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6300%      imaginary image pair.
6301%
6302*/
6303WandExport MagickBooleanType MagickInverseFourierTransformImage(
6304  MagickWand *magnitude_wand,MagickWand *phase_wand,
6305  const MagickBooleanType magnitude)
6306{
6307  Image
6308    *inverse_image;
6309
6310  MagickWand
6311    *wand;
6312
6313  assert(magnitude_wand != (MagickWand *) NULL);
6314  assert(magnitude_wand->signature == MagickWandSignature);
6315  if (magnitude_wand->debug != MagickFalse)
6316    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6317      magnitude_wand->name);
6318  wand=magnitude_wand;
6319  if (magnitude_wand->images == (Image *) NULL)
6320    ThrowWandException(WandError,"ContainsNoImages",
6321      magnitude_wand->name);
6322  assert(phase_wand != (MagickWand *) NULL);
6323  assert(phase_wand->signature == MagickWandSignature);
6324  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6325    phase_wand->images,magnitude,wand->exception);
6326  if (inverse_image == (Image *) NULL)
6327    return(MagickFalse);
6328  ReplaceImageInList(&wand->images,inverse_image);
6329  return(MagickTrue);
6330}
6331
6332/*
6333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6334%                                                                             %
6335%                                                                             %
6336%                                                                             %
6337%   M a g i c k L a b e l I m a g e                                           %
6338%                                                                             %
6339%                                                                             %
6340%                                                                             %
6341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6342%
6343%  MagickLabelImage() adds a label to your image.
6344%
6345%  The format of the MagickLabelImage method is:
6346%
6347%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6348%
6349%  A description of each parameter follows:
6350%
6351%    o wand: the magick wand.
6352%
6353%    o label: the image label.
6354%
6355*/
6356WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6357  const char *label)
6358{
6359  MagickBooleanType
6360    status;
6361
6362  assert(wand != (MagickWand *) NULL);
6363  assert(wand->signature == MagickWandSignature);
6364  if (wand->debug != MagickFalse)
6365    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6366  if (wand->images == (Image *) NULL)
6367    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6368  status=SetImageProperty(wand->images,"label",label,wand->exception);
6369  return(status);
6370}
6371
6372/*
6373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6374%                                                                             %
6375%                                                                             %
6376%                                                                             %
6377%   M a g i c k L e v e l I m a g e                                           %
6378%                                                                             %
6379%                                                                             %
6380%                                                                             %
6381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6382%
6383%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6384%  falling between specified white and black points to the full available
6385%  quantum range. The parameters provided represent the black, mid, and white
6386%  points. The black point specifies the darkest color in the image. Colors
6387%  darker than the black point are set to zero. Mid point specifies a gamma
6388%  correction to apply to the image.  White point specifies the lightest color
6389%  in the image. Colors brighter than the white point are set to the maximum
6390%  quantum value.
6391%
6392%  The format of the MagickLevelImage method is:
6393%
6394%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6395%        const double black_point,const double gamma,const double white_point)
6396%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6397%        const ChannelType channel,const double black_point,const double gamma,
6398%        const double white_point)
6399%
6400%  A description of each parameter follows:
6401%
6402%    o wand: the magick wand.
6403%
6404%    o channel: Identify which channel to level: RedPixelChannel,
6405%      GreenPixelChannel, etc.
6406%
6407%    o black_point: the black point.
6408%
6409%    o gamma: the gamma.
6410%
6411%    o white_point: the white point.
6412%
6413*/
6414WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6415  const double black_point,const double gamma,const double white_point)
6416{
6417  MagickBooleanType
6418    status;
6419
6420  assert(wand != (MagickWand *) NULL);
6421  assert(wand->signature == MagickWandSignature);
6422  if (wand->debug != MagickFalse)
6423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6424  if (wand->images == (Image *) NULL)
6425    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6426  status=LevelImage(wand->images,black_point,white_point,gamma,
6427    wand->exception);
6428  return(status);
6429}
6430
6431/*
6432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6433%                                                                             %
6434%                                                                             %
6435%                                                                             %
6436%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6437%                                                                             %
6438%                                                                             %
6439%                                                                             %
6440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6441%
6442%  MagickLinearStretchImage() stretches with saturation the image intensity.
6443%
6444%  You can also reduce the influence of a particular channel with a gamma
6445%  value of 0.
6446%
6447%  The format of the MagickLinearStretchImage method is:
6448%
6449%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6450%        const double black_point,const double white_point)
6451%
6452%  A description of each parameter follows:
6453%
6454%    o wand: the magick wand.
6455%
6456%    o black_point: the black point.
6457%
6458%    o white_point: the white point.
6459%
6460*/
6461WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6462  const double black_point,const double white_point)
6463{
6464  MagickBooleanType
6465    status;
6466
6467  assert(wand != (MagickWand *) NULL);
6468  assert(wand->signature == MagickWandSignature);
6469  if (wand->debug != MagickFalse)
6470    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6471  if (wand->images == (Image *) NULL)
6472    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6473  status=LinearStretchImage(wand->images,black_point,white_point,
6474    wand->exception);
6475  return(status);
6476}
6477
6478/*
6479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6480%                                                                             %
6481%                                                                             %
6482%                                                                             %
6483%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6484%                                                                             %
6485%                                                                             %
6486%                                                                             %
6487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6488%
6489%  MagickLiquidRescaleImage() rescales image with seam carving.
6490%
6491%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6492%        const size_t columns,const size_t rows,
6493%        const double delta_x,const double rigidity)
6494%
6495%  A description of each parameter follows:
6496%
6497%    o wand: the magick wand.
6498%
6499%    o columns: the number of columns in the scaled image.
6500%
6501%    o rows: the number of rows in the scaled image.
6502%
6503%    o delta_x: maximum seam transversal step (0 means straight seams).
6504%
6505%    o rigidity: introduce a bias for non-straight seams (typically 0).
6506%
6507*/
6508WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6509  const size_t columns,const size_t rows,const double delta_x,
6510  const double rigidity)
6511{
6512  Image
6513    *rescale_image;
6514
6515  assert(wand != (MagickWand *) NULL);
6516  assert(wand->signature == MagickWandSignature);
6517  if (wand->debug != MagickFalse)
6518    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6519  if (wand->images == (Image *) NULL)
6520    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6521  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6522    rigidity,wand->exception);
6523  if (rescale_image == (Image *) NULL)
6524    return(MagickFalse);
6525  ReplaceImageInList(&wand->images,rescale_image);
6526  return(MagickTrue);
6527}
6528
6529/*
6530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6531%                                                                             %
6532%                                                                             %
6533%                                                                             %
6534%     M a g i c k L o c a l C o n t r a s t I m a g e                         %
6535%                                                                             %
6536%                                                                             %
6537%                                                                             %
6538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6539%
6540%  MagickLocalContrastImage() attempts to increase the appearance of
6541%  large-scale light-dark transitions. Local contrast enhancement works
6542%  similarly to sharpening with an unsharp mask, however the mask is instead
6543%  created using an image with a greater blur distance.
6544%
6545%      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6546%        const double radius,const double strength)
6547%
6548%  A description of each parameter follows:
6549%
6550%    o image: the image.
6551%
6552%    o radius: the radius of the Gaussian, in pixels, not counting
6553%      the center pixel.
6554%
6555%    o strength: the strength of the blur mask in percentage.
6556%
6557*/
6558WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6559  const double radius, const double strength)
6560{
6561  Image
6562    *contrast_image;
6563
6564  assert(wand != (MagickWand *)NULL);
6565  assert(wand->signature == MagickWandSignature);
6566  if (wand->debug != MagickFalse)
6567    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
6568  if (wand->images == (Image *)NULL)
6569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6570  contrast_image=LocalContrastImage(wand->images,radius,strength,
6571    wand->exception);
6572  if (contrast_image == (Image *)NULL)
6573    return(MagickFalse);
6574  ReplaceImageInList(&wand->images,contrast_image);
6575  return(MagickTrue);
6576}
6577
6578/*
6579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6580%                                                                             %
6581%                                                                             %
6582%                                                                             %
6583%   M a g i c k M a g n i f y I m a g e                                       %
6584%                                                                             %
6585%                                                                             %
6586%                                                                             %
6587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6588%
6589%  MagickMagnifyImage() is a convenience method that scales an image
6590%  proportionally to twice its original size.
6591%
6592%  The format of the MagickMagnifyImage method is:
6593%
6594%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6595%
6596%  A description of each parameter follows:
6597%
6598%    o wand: the magick wand.
6599%
6600*/
6601WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6602{
6603  Image
6604    *magnify_image;
6605
6606  assert(wand != (MagickWand *) NULL);
6607  assert(wand->signature == MagickWandSignature);
6608  if (wand->debug != MagickFalse)
6609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6610  if (wand->images == (Image *) NULL)
6611    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6612  magnify_image=MagnifyImage(wand->images,wand->exception);
6613  if (magnify_image == (Image *) NULL)
6614    return(MagickFalse);
6615  ReplaceImageInList(&wand->images,magnify_image);
6616  return(MagickTrue);
6617}
6618
6619/*
6620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6621%                                                                             %
6622%                                                                             %
6623%                                                                             %
6624%   M a g i c k M e r g e I m a g e L a y e r s                               %
6625%                                                                             %
6626%                                                                             %
6627%                                                                             %
6628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6629%
6630%  MagickMergeImageLayers() composes all the image layers from the current
6631%  given image onward to produce a single image of the merged layers.
6632%
6633%  The inital canvas's size depends on the given LayerMethod, and is
6634%  initialized using the first images background color.  The images
6635%  are then compositied onto that image in sequence using the given
6636%  composition that has been assigned to each individual image.
6637%
6638%  The format of the MagickMergeImageLayers method is:
6639%
6640%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6641%        const LayerMethod method)
6642%
6643%  A description of each parameter follows:
6644%
6645%    o wand: the magick wand.
6646%
6647%    o method: the method of selecting the size of the initial canvas.
6648%
6649%        MergeLayer: Merge all layers onto a canvas just large enough
6650%           to hold all the actual images. The virtual canvas of the
6651%           first image is preserved but otherwise ignored.
6652%
6653%        FlattenLayer: Use the virtual canvas size of first image.
6654%           Images which fall outside this canvas is clipped.
6655%           This can be used to 'fill out' a given virtual canvas.
6656%
6657%        MosaicLayer: Start with the virtual canvas of the first image,
6658%           enlarging left and right edges to contain all images.
6659%           Images with negative offsets will be clipped.
6660%
6661*/
6662WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6663  const LayerMethod method)
6664{
6665  Image
6666    *mosaic_image;
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    return((MagickWand *) NULL);
6674  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6675  if (mosaic_image == (Image *) NULL)
6676    return((MagickWand *) NULL);
6677  return(CloneMagickWandFromImages(wand,mosaic_image));
6678}
6679
6680/*
6681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6682%                                                                             %
6683%                                                                             %
6684%                                                                             %
6685%   M a g i c k M i n i f y I m a g e                                         %
6686%                                                                             %
6687%                                                                             %
6688%                                                                             %
6689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6690%
6691%  MagickMinifyImage() is a convenience method that scales an image
6692%  proportionally to one-half its original size
6693%
6694%  The format of the MagickMinifyImage method is:
6695%
6696%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6697%
6698%  A description of each parameter follows:
6699%
6700%    o wand: the magick wand.
6701%
6702*/
6703WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6704{
6705  Image
6706    *minify_image;
6707
6708  assert(wand != (MagickWand *) NULL);
6709  assert(wand->signature == MagickWandSignature);
6710  if (wand->debug != MagickFalse)
6711    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6712  if (wand->images == (Image *) NULL)
6713    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6714  minify_image=MinifyImage(wand->images,wand->exception);
6715  if (minify_image == (Image *) NULL)
6716    return(MagickFalse);
6717  ReplaceImageInList(&wand->images,minify_image);
6718  return(MagickTrue);
6719}
6720
6721/*
6722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6723%                                                                             %
6724%                                                                             %
6725%                                                                             %
6726%   M a g i c k M o d u l a t e I m a g e                                     %
6727%                                                                             %
6728%                                                                             %
6729%                                                                             %
6730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6731%
6732%  MagickModulateImage() lets you control the brightness, saturation, and hue
6733%  of an image.  Hue is the percentage of absolute rotation from the current
6734%  position.  For example 50 results in a counter-clockwise rotation of 90
6735%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6736%  both resulting in a rotation of 180 degrees.
6737%
6738%  To increase the color brightness by 20% and decrease the color saturation by
6739%  10% and leave the hue unchanged, use: 120,90,100.
6740%
6741%  The format of the MagickModulateImage method is:
6742%
6743%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6744%        const double brightness,const double saturation,const double hue)
6745%
6746%  A description of each parameter follows:
6747%
6748%    o wand: the magick wand.
6749%
6750%    o brightness: the percent change in brighness.
6751%
6752%    o saturation: the percent change in saturation.
6753%
6754%    o hue: the percent change in hue.
6755%
6756*/
6757WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6758  const double brightness,const double saturation,const double hue)
6759{
6760  char
6761    modulate[MagickPathExtent];
6762
6763  MagickBooleanType
6764    status;
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  (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
6773    brightness,saturation,hue);
6774  status=ModulateImage(wand->images,modulate,wand->exception);
6775  return(status);
6776}
6777
6778/*
6779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6780%                                                                             %
6781%                                                                             %
6782%                                                                             %
6783%   M a g i c k M o n t a g e I m a g e                                       %
6784%                                                                             %
6785%                                                                             %
6786%                                                                             %
6787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6788%
6789%  MagickMontageImage() creates a composite image by combining several
6790%  separate images. The images are tiled on the composite image with the name
6791%  of the image optionally appearing just below the individual tile.
6792%
6793%  The format of the MagickMontageImage method is:
6794%
6795%      MagickWand *MagickMontageImage(MagickWand *wand,
6796%        const DrawingWand drawing_wand,const char *tile_geometry,
6797%        const char *thumbnail_geometry,const MontageMode mode,
6798%        const char *frame)
6799%
6800%  A description of each parameter follows:
6801%
6802%    o wand: the magick wand.
6803%
6804%    o drawing_wand: the drawing wand.  The font name, size, and color are
6805%      obtained from this wand.
6806%
6807%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6808%
6809%    o thumbnail_geometry: Preferred image size and border size of each
6810%      thumbnail (e.g. 120x120+4+3>).
6811%
6812%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6813%
6814%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6815%      The frame color is that of the thumbnail's matte color.
6816%
6817*/
6818WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6819  const DrawingWand *drawing_wand,const char *tile_geometry,
6820  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6821{
6822  char
6823    *font;
6824
6825  Image
6826    *montage_image;
6827
6828  MontageInfo
6829    *montage_info;
6830
6831  PixelWand
6832    *pixel_wand;
6833
6834  assert(wand != (MagickWand *) NULL);
6835  assert(wand->signature == MagickWandSignature);
6836  if (wand->debug != MagickFalse)
6837    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6838  if (wand->images == (Image *) NULL)
6839    return((MagickWand *) NULL);
6840  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6841  switch (mode)
6842  {
6843    case FrameMode:
6844    {
6845      (void) CloneString(&montage_info->frame,"15x15+3+3");
6846      montage_info->shadow=MagickTrue;
6847      break;
6848    }
6849    case UnframeMode:
6850    {
6851      montage_info->frame=(char *) NULL;
6852      montage_info->shadow=MagickFalse;
6853      montage_info->border_width=0;
6854      break;
6855    }
6856    case ConcatenateMode:
6857    {
6858      montage_info->frame=(char *) NULL;
6859      montage_info->shadow=MagickFalse;
6860      (void) CloneString(&montage_info->geometry,"+0+0");
6861      montage_info->border_width=0;
6862      break;
6863    }
6864    default:
6865      break;
6866  }
6867  font=DrawGetFont(drawing_wand);
6868  if (font != (char *) NULL)
6869    (void) CloneString(&montage_info->font,font);
6870  if (frame != (char *) NULL)
6871    (void) CloneString(&montage_info->frame,frame);
6872  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6873  pixel_wand=NewPixelWand();
6874  DrawGetFillColor(drawing_wand,pixel_wand);
6875  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6876  DrawGetStrokeColor(drawing_wand,pixel_wand);
6877  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6878  pixel_wand=DestroyPixelWand(pixel_wand);
6879  if (thumbnail_geometry != (char *) NULL)
6880    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6881  if (tile_geometry != (char *) NULL)
6882    (void) CloneString(&montage_info->tile,tile_geometry);
6883  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6884    wand->exception);
6885  montage_info=DestroyMontageInfo(montage_info);
6886  if (montage_image == (Image *) NULL)
6887    return((MagickWand *) NULL);
6888  return(CloneMagickWandFromImages(wand,montage_image));
6889}
6890
6891/*
6892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6893%                                                                             %
6894%                                                                             %
6895%                                                                             %
6896%   M a g i c k M o r p h I m a g e s                                         %
6897%                                                                             %
6898%                                                                             %
6899%                                                                             %
6900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6901%
6902%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6903%  and size are linearly interpolated to give the appearance of a
6904%  meta-morphosis from one image to the next.
6905%
6906%  The format of the MagickMorphImages method is:
6907%
6908%      MagickWand *MagickMorphImages(MagickWand *wand,
6909%        const size_t number_frames)
6910%
6911%  A description of each parameter follows:
6912%
6913%    o wand: the magick wand.
6914%
6915%    o number_frames: the number of in-between images to generate.
6916%
6917*/
6918WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6919  const size_t number_frames)
6920{
6921  Image
6922    *morph_image;
6923
6924  assert(wand != (MagickWand *) NULL);
6925  assert(wand->signature == MagickWandSignature);
6926  if (wand->debug != MagickFalse)
6927    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6928  if (wand->images == (Image *) NULL)
6929    return((MagickWand *) NULL);
6930  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6931  if (morph_image == (Image *) NULL)
6932    return((MagickWand *) NULL);
6933  return(CloneMagickWandFromImages(wand,morph_image));
6934}
6935
6936/*
6937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6938%                                                                             %
6939%                                                                             %
6940%                                                                             %
6941%   M a g i c k M o r p h o l o g y I m a g e                                 %
6942%                                                                             %
6943%                                                                             %
6944%                                                                             %
6945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6946%
6947%  MagickMorphologyImage() applies a user supplied kernel to the image
6948%  according to the given mophology method.
6949%
6950%  The format of the MagickMorphologyImage method is:
6951%
6952%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6953%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6954%
6955%  A description of each parameter follows:
6956%
6957%    o wand: the magick wand.
6958%
6959%    o method: the morphology method to be applied.
6960%
6961%    o iterations: apply the operation this many times (or no change).
6962%      A value of -1 means loop until no change found.  How this is applied
6963%      may depend on the morphology method.  Typically this is a value of 1.
6964%
6965%    o kernel: An array of doubles representing the morphology kernel.
6966%
6967*/
6968WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6969  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6970{
6971  Image
6972    *morphology_image;
6973
6974  assert(wand != (MagickWand *) NULL);
6975  assert(wand->signature == MagickWandSignature);
6976  if (wand->debug != MagickFalse)
6977    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6978  if (kernel == (const KernelInfo *) NULL)
6979    return(MagickFalse);
6980  if (wand->images == (Image *) NULL)
6981    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6982  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6983    wand->exception);
6984  if (morphology_image == (Image *) NULL)
6985    return(MagickFalse);
6986  ReplaceImageInList(&wand->images,morphology_image);
6987  return(MagickTrue);
6988}
6989
6990/*
6991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6992%                                                                             %
6993%                                                                             %
6994%                                                                             %
6995%   M a g i c k M o t i o n B l u r I m a g e                                 %
6996%                                                                             %
6997%                                                                             %
6998%                                                                             %
6999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7000%
7001%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7002%  Gaussian operator of the given radius and standard deviation (sigma).
7003%  For reasonable results, radius should be larger than sigma.  Use a
7004%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7005%  Angle gives the angle of the blurring motion.
7006%
7007%  The format of the MagickMotionBlurImage method is:
7008%
7009%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7010%        const double radius,const double sigma,const double angle)
7011%
7012%  A description of each parameter follows:
7013%
7014%    o wand: the magick wand.
7015%
7016%    o radius: the radius of the Gaussian, in pixels, not counting
7017%      the center pixel.
7018%
7019%    o sigma: the standard deviation of the Gaussian, in pixels.
7020%
7021%    o angle: Apply the effect along this angle.
7022%
7023*/
7024WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7025  const double radius,const double sigma,const double angle)
7026{
7027  Image
7028    *blur_image;
7029
7030  assert(wand != (MagickWand *) NULL);
7031  assert(wand->signature == MagickWandSignature);
7032  if (wand->debug != MagickFalse)
7033    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7034  if (wand->images == (Image *) NULL)
7035    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7036  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7037  if (blur_image == (Image *) NULL)
7038    return(MagickFalse);
7039  ReplaceImageInList(&wand->images,blur_image);
7040  return(MagickTrue);
7041}
7042
7043/*
7044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7045%                                                                             %
7046%                                                                             %
7047%                                                                             %
7048%   M a g i c k N e g a t e I m a g e                                         %
7049%                                                                             %
7050%                                                                             %
7051%                                                                             %
7052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7053%
7054%  MagickNegateImage() negates the colors in the reference image.  The
7055%  Grayscale option means that only grayscale values within the image are
7056%  negated.
7057%
7058%  You can also reduce the influence of a particular channel with a gamma
7059%  value of 0.
7060%
7061%  The format of the MagickNegateImage method is:
7062%
7063%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7064%        const MagickBooleanType gray)
7065%
7066%  A description of each parameter follows:
7067%
7068%    o wand: the magick wand.
7069%
7070%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7071%
7072*/
7073WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7074  const MagickBooleanType gray)
7075{
7076  MagickBooleanType
7077    status;
7078
7079  assert(wand != (MagickWand *) NULL);
7080  assert(wand->signature == MagickWandSignature);
7081  if (wand->debug != MagickFalse)
7082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7083  if (wand->images == (Image *) NULL)
7084    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7085  status=NegateImage(wand->images,gray,wand->exception);
7086  return(status);
7087}
7088
7089/*
7090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7091%                                                                             %
7092%                                                                             %
7093%                                                                             %
7094%   M a g i c k N e w I m a g e                                               %
7095%                                                                             %
7096%                                                                             %
7097%                                                                             %
7098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7099%
7100%  MagickNewImage() adds a blank image canvas of the specified size and
7101%  background color to the wand.
7102%
7103%  The format of the MagickNewImage method is:
7104%
7105%      MagickBooleanType MagickNewImage(MagickWand *wand,
7106%        const size_t columns,const size_t rows,
7107%        const PixelWand *background)
7108%
7109%  A description of each parameter follows:
7110%
7111%    o wand: the magick wand.
7112%
7113%    o width: the image width.
7114%
7115%    o height: the image height.
7116%
7117%    o background: the image color.
7118%
7119*/
7120WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7121  const size_t height,const PixelWand *background)
7122{
7123  Image
7124    *images;
7125
7126  PixelInfo
7127    pixel;
7128
7129  assert(wand != (MagickWand *) NULL);
7130  assert(wand->signature == MagickWandSignature);
7131  if (wand->debug != MagickFalse)
7132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7133  PixelGetMagickColor(background,&pixel);
7134  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7135  if (images == (Image *) NULL)
7136    return(MagickFalse);
7137  return(InsertImageInWand(wand,images));
7138}
7139
7140/*
7141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7142%                                                                             %
7143%                                                                             %
7144%                                                                             %
7145%   M a g i c k N e x t I m a g e                                             %
7146%                                                                             %
7147%                                                                             %
7148%                                                                             %
7149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7150%
7151%  MagickNextImage() sets the next image in the wand as the current image.
7152%
7153%  It is typically used after MagickResetIterator(), after which its first use
7154%  will set the first image as the current image (unless the wand is empty).
7155%
7156%  It will return MagickFalse when no more images are left to be returned
7157%  which happens when the wand is empty, or the current image is the last
7158%  image.
7159%
7160%  When the above condition (end of image list) is reached, the iterator is
7161%  automaticall set so that you can start using MagickPreviousImage() to
7162%  again iterate over the images in the reverse direction, starting with the
7163%  last image (again).  You can jump to this condition immeditally using
7164%  MagickSetLastIterator().
7165%
7166%  The format of the MagickNextImage method is:
7167%
7168%      MagickBooleanType MagickNextImage(MagickWand *wand)
7169%
7170%  A description of each parameter follows:
7171%
7172%    o wand: the magick wand.
7173%
7174*/
7175WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7176{
7177  assert(wand != (MagickWand *) NULL);
7178  assert(wand->signature == MagickWandSignature);
7179  if (wand->debug != MagickFalse)
7180    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7181  if (wand->images == (Image *) NULL)
7182    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7183  wand->insert_before=MagickFalse; /* Inserts is now appended */
7184  if (wand->image_pending != MagickFalse)
7185    {
7186      wand->image_pending=MagickFalse;
7187      return(MagickTrue);
7188    }
7189  if (GetNextImageInList(wand->images) == (Image *) NULL)
7190    {
7191      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7192      return(MagickFalse);
7193    }
7194  wand->images=GetNextImageInList(wand->images);
7195  return(MagickTrue);
7196}
7197
7198/*
7199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7200%                                                                             %
7201%                                                                             %
7202%                                                                             %
7203%   M a g i c k N o r m a l i z e I m a g e                                   %
7204%                                                                             %
7205%                                                                             %
7206%                                                                             %
7207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7208%
7209%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7210%  the pixels color to span the entire range of colors available
7211%
7212%  You can also reduce the influence of a particular channel with a gamma
7213%  value of 0.
7214%
7215%  The format of the MagickNormalizeImage method is:
7216%
7217%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7218%
7219%  A description of each parameter follows:
7220%
7221%    o wand: the magick wand.
7222%
7223*/
7224WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7225{
7226  MagickBooleanType
7227    status;
7228
7229  assert(wand != (MagickWand *) NULL);
7230  assert(wand->signature == MagickWandSignature);
7231  if (wand->debug != MagickFalse)
7232    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7233  if (wand->images == (Image *) NULL)
7234    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7235  status=NormalizeImage(wand->images,wand->exception);
7236  return(status);
7237}
7238
7239/*
7240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7241%                                                                             %
7242%                                                                             %
7243%                                                                             %
7244%   M a g i c k O i l P a i n t I m a g e                                     %
7245%                                                                             %
7246%                                                                             %
7247%                                                                             %
7248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7249%
7250%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7251%  painting.  Each pixel is replaced by the most frequent color occurring
7252%  in a circular region defined by radius.
7253%
7254%  The format of the MagickOilPaintImage method is:
7255%
7256%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7257%        const double radius,const double sigma)
7258%
7259%  A description of each parameter follows:
7260%
7261%    o wand: the magick wand.
7262%
7263%    o radius: the radius of the circular neighborhood.
7264%
7265%    o sigma: the standard deviation of the Gaussian, in pixels.
7266%
7267*/
7268WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7269  const double radius,const double sigma)
7270{
7271  Image
7272    *paint_image;
7273
7274  assert(wand != (MagickWand *) NULL);
7275  assert(wand->signature == MagickWandSignature);
7276  if (wand->debug != MagickFalse)
7277    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7278  if (wand->images == (Image *) NULL)
7279    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7280  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7281  if (paint_image == (Image *) NULL)
7282    return(MagickFalse);
7283  ReplaceImageInList(&wand->images,paint_image);
7284  return(MagickTrue);
7285}
7286
7287/*
7288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7289%                                                                             %
7290%                                                                             %
7291%                                                                             %
7292%   M a g i c k O p a q u e P a i n t I m a g e                               %
7293%                                                                             %
7294%                                                                             %
7295%                                                                             %
7296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7297%
7298%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7299%  defined by fill.
7300%
7301%  The format of the MagickOpaquePaintImage method is:
7302%
7303%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7304%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7305%        const MagickBooleanType invert)
7306%
7307%  A description of each parameter follows:
7308%
7309%    o wand: the magick wand.
7310%
7311%    o target: Change this target color to the fill color within the image.
7312%
7313%    o fill: the fill pixel wand.
7314%
7315%    o fuzz: By default target must match a particular pixel color
7316%      exactly.  However, in many cases two colors may differ by a small amount.
7317%      The fuzz member of image defines how much tolerance is acceptable to
7318%      consider two colors as the same.  For example, set fuzz to 10 and the
7319%      color red at intensities of 100 and 102 respectively are now interpreted
7320%      as the same color for the purposes of the floodfill.
7321%
7322%    o invert: paint any pixel that does not match the target color.
7323%
7324*/
7325WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7326  const PixelWand *target,const PixelWand *fill,const double fuzz,
7327  const MagickBooleanType invert)
7328{
7329  MagickBooleanType
7330    status;
7331
7332  PixelInfo
7333    fill_pixel,
7334    target_pixel;
7335
7336  assert(wand != (MagickWand *) NULL);
7337  assert(wand->signature == MagickWandSignature);
7338  if (wand->debug != MagickFalse)
7339    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7340  if (wand->images == (Image *) NULL)
7341    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7342  PixelGetMagickColor(target,&target_pixel);
7343  PixelGetMagickColor(fill,&fill_pixel);
7344  wand->images->fuzz=fuzz;
7345  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7346    wand->exception);
7347  return(status);
7348}
7349
7350/*
7351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7352%                                                                             %
7353%                                                                             %
7354%                                                                             %
7355%   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                         %
7356%                                                                             %
7357%                                                                             %
7358%                                                                             %
7359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7360%
7361%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7362%  previous image in the sequence.  From this it attempts to select the
7363%  smallest cropped image to replace each frame, while preserving the results
7364%  of the animation.
7365%
7366%  The format of the MagickOptimizeImageLayers method is:
7367%
7368%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7369%
7370%  A description of each parameter follows:
7371%
7372%    o wand: the magick wand.
7373%
7374*/
7375WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7376{
7377  Image
7378    *optimize_image;
7379
7380  assert(wand != (MagickWand *) NULL);
7381  assert(wand->signature == MagickWandSignature);
7382  if (wand->debug != MagickFalse)
7383    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7384  if (wand->images == (Image *) NULL)
7385    return((MagickWand *) NULL);
7386  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7387  if (optimize_image == (Image *) NULL)
7388    return((MagickWand *) NULL);
7389  return(CloneMagickWandFromImages(wand,optimize_image));
7390}
7391
7392/*
7393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7394%                                                                             %
7395%                                                                             %
7396%                                                                             %
7397%   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             %
7398%                                                                             %
7399%                                                                             %
7400%                                                                             %
7401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7402%
7403%  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7404%  compares the overlayed pixels against the disposal image resulting from all
7405%  the previous frames in the animation.  Any pixel that does not change the
7406%  disposal image (and thus does not effect the outcome of an overlay) is made
7407%  transparent.
7408%
7409%  WARNING: This modifies the current images directly, rather than generate
7410%  a new image sequence.
7411%  The format of the MagickOptimizeImageTransparency method is:
7412%
7413%      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7414%
7415%  A description of each parameter follows:
7416%
7417%    o wand: the magick wand.
7418%
7419*/
7420WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7421{
7422  assert(wand != (MagickWand *) NULL);
7423  assert(wand->signature == MagickWandSignature);
7424  if (wand->debug != MagickFalse)
7425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7426  if (wand->images == (Image *) NULL)
7427    return(MagickFalse);
7428  OptimizeImageTransparency(wand->images,wand->exception);
7429  return(MagickTrue);
7430}
7431
7432/*
7433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7434%                                                                             %
7435%                                                                             %
7436%                                                                             %
7437%     M a g i c k O r d e r e d P o s t e r i z e I m a g e                   %
7438%                                                                             %
7439%                                                                             %
7440%                                                                             %
7441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7442%
7443%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7444%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7445%  which can be different for different channels, according to the input
7446%  arguments.
7447%
7448%  The format of the MagickOrderedPosterizeImage method is:
7449%
7450%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7451%        const char *threshold_map)
7452%
7453%  A description of each parameter follows:
7454%
7455%    o image: the image.
7456%
7457%    o threshold_map: A string containing the name of the threshold dither
7458%      map to use, followed by zero or more numbers representing the number of
7459%      color levels tho dither between.
7460%
7461%      Any level number less than 2 is equivalent to 2, and means only binary
7462%      dithering will be applied to each color channel.
7463%
7464%      No numbers also means a 2 level (bitmap) dither will be applied to all
7465%      channels, while a single number is the number of levels applied to each
7466%      channel in sequence.  More numbers will be applied in turn to each of
7467%      the color channels.
7468%
7469%      For example: "o3x3,6" generates a 6 level posterization of the image
7470%      with a ordered 3x3 diffused pixel dither being applied between each
7471%      level. While checker,8,8,4 will produce a 332 colormaped image with
7472%      only a single checkerboard hash pattern (50% grey) between each color
7473%      level, to basically double the number of color levels with a bare
7474%      minimim of dithering.
7475%
7476*/
7477WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7478  const char *threshold_map)
7479{
7480  MagickBooleanType
7481    status;
7482
7483  assert(wand != (MagickWand *) NULL);
7484  assert(wand->signature == MagickWandSignature);
7485  if (wand->debug != MagickFalse)
7486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7487  if (wand->images == (Image *) NULL)
7488    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7489  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7490  return(status);
7491}
7492
7493/*
7494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7495%                                                                             %
7496%                                                                             %
7497%                                                                             %
7498%   M a g i c k P i n g I m a g e                                             %
7499%                                                                             %
7500%                                                                             %
7501%                                                                             %
7502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7503%
7504%  MagickPingImage() is the same as MagickReadImage() except the only valid
7505%  information returned is the image width, height, size, and format.  It
7506%  is designed to efficiently obtain this information from a file without
7507%  reading the entire image sequence into memory.
7508%
7509%  The format of the MagickPingImage method is:
7510%
7511%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7512%
7513%  A description of each parameter follows:
7514%
7515%    o wand: the magick wand.
7516%
7517%    o filename: the image filename.
7518%
7519*/
7520WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7521  const char *filename)
7522{
7523  Image
7524    *images;
7525
7526  ImageInfo
7527    *ping_info;
7528
7529  assert(wand != (MagickWand *) NULL);
7530  assert(wand->signature == MagickWandSignature);
7531  if (wand->debug != MagickFalse)
7532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7533  ping_info=CloneImageInfo(wand->image_info);
7534  if (filename != (const char *) NULL)
7535    (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
7536  images=PingImage(ping_info,wand->exception);
7537  ping_info=DestroyImageInfo(ping_info);
7538  if (images == (Image *) NULL)
7539    return(MagickFalse);
7540  return(InsertImageInWand(wand,images));
7541}
7542
7543/*
7544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7545%                                                                             %
7546%                                                                             %
7547%                                                                             %
7548%   M a g i c k P i n g I m a g e B l o b                                     %
7549%                                                                             %
7550%                                                                             %
7551%                                                                             %
7552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7553%
7554%  MagickPingImageBlob() pings an image or image sequence from a blob.
7555%
7556%  The format of the MagickPingImageBlob method is:
7557%
7558%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7559%        const void *blob,const size_t length)
7560%
7561%  A description of each parameter follows:
7562%
7563%    o wand: the magick wand.
7564%
7565%    o blob: the blob.
7566%
7567%    o length: the blob length.
7568%
7569*/
7570WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7571  const void *blob,const size_t length)
7572{
7573  Image
7574    *images;
7575
7576  ImageInfo
7577    *read_info;
7578
7579  assert(wand != (MagickWand *) NULL);
7580  assert(wand->signature == MagickWandSignature);
7581  if (wand->debug != MagickFalse)
7582    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7583  read_info=CloneImageInfo(wand->image_info);
7584  SetImageInfoBlob(read_info,blob,length);
7585  images=PingImage(read_info,wand->exception);
7586  read_info=DestroyImageInfo(read_info);
7587  if (images == (Image *) NULL)
7588    return(MagickFalse);
7589  return(InsertImageInWand(wand,images));
7590}
7591
7592/*
7593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7594%                                                                             %
7595%                                                                             %
7596%                                                                             %
7597%   M a g i c k P i n g I m a g e F i l e                                     %
7598%                                                                             %
7599%                                                                             %
7600%                                                                             %
7601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7602%
7603%  MagickPingImageFile() pings an image or image sequence from an open file
7604%  descriptor.
7605%
7606%  The format of the MagickPingImageFile method is:
7607%
7608%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7609%
7610%  A description of each parameter follows:
7611%
7612%    o wand: the magick wand.
7613%
7614%    o file: the file descriptor.
7615%
7616*/
7617WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7618{
7619  Image
7620    *images;
7621
7622  ImageInfo
7623    *read_info;
7624
7625  assert(wand != (MagickWand *) NULL);
7626  assert(wand->signature == MagickWandSignature);
7627  assert(file != (FILE *) NULL);
7628  if (wand->debug != MagickFalse)
7629    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7630  read_info=CloneImageInfo(wand->image_info);
7631  SetImageInfoFile(read_info,file);
7632  images=PingImage(read_info,wand->exception);
7633  read_info=DestroyImageInfo(read_info);
7634  if (images == (Image *) NULL)
7635    return(MagickFalse);
7636  return(InsertImageInWand(wand,images));
7637}
7638
7639/*
7640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7641%                                                                             %
7642%                                                                             %
7643%                                                                             %
7644%   M a g i c k P o l a r o i d I m a g e                                     %
7645%                                                                             %
7646%                                                                             %
7647%                                                                             %
7648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7649%
7650%  MagickPolaroidImage() simulates a Polaroid picture.
7651%
7652%  The format of the MagickPolaroidImage method is:
7653%
7654%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7655%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7656%        const PixelInterpolateMethod method)
7657%
7658%  A description of each parameter follows:
7659%
7660%    o wand: the magick wand.
7661%
7662%    o drawing_wand: the draw wand.
7663%
7664%    o caption: the Polaroid caption.
7665%
7666%    o angle: Apply the effect along this angle.
7667%
7668%    o method: the pixel interpolation method.
7669%
7670*/
7671WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7672  const DrawingWand *drawing_wand,const char *caption,const double angle,
7673  const PixelInterpolateMethod method)
7674{
7675  DrawInfo
7676    *draw_info;
7677
7678  Image
7679    *polaroid_image;
7680
7681  assert(wand != (MagickWand *) NULL);
7682  assert(wand->signature == MagickWandSignature);
7683  if (wand->debug != MagickFalse)
7684    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7685  if (wand->images == (Image *) NULL)
7686    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7687  draw_info=PeekDrawingWand(drawing_wand);
7688  if (draw_info == (DrawInfo *) NULL)
7689    return(MagickFalse);
7690  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7691    wand->exception);
7692  if (polaroid_image == (Image *) NULL)
7693    return(MagickFalse);
7694  ReplaceImageInList(&wand->images,polaroid_image);
7695  return(MagickTrue);
7696}
7697
7698/*
7699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7700%                                                                             %
7701%                                                                             %
7702%                                                                             %
7703%   M a g i c k P o s t e r i z e I m a g e                                   %
7704%                                                                             %
7705%                                                                             %
7706%                                                                             %
7707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7708%
7709%  MagickPosterizeImage() reduces the image to a limited number of color level.
7710%
7711%  The format of the MagickPosterizeImage method is:
7712%
7713%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7714%        const size_t levels,const DitherMethod method)
7715%
7716%  A description of each parameter follows:
7717%
7718%    o wand: the magick wand.
7719%
7720%    o levels: Number of color levels allowed in each channel.  Very low values
7721%      (2, 3, or 4) have the most visible effect.
7722%
7723%    o method: choose the dither method: UndefinedDitherMethod,
7724%      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7725%
7726*/
7727WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7728  const size_t levels,const DitherMethod dither)
7729{
7730  MagickBooleanType
7731    status;
7732
7733  assert(wand != (MagickWand *) NULL);
7734  assert(wand->signature == MagickWandSignature);
7735  if (wand->debug != MagickFalse)
7736    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7737  if (wand->images == (Image *) NULL)
7738    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7739  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7740  return(status);
7741}
7742
7743/*
7744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7745%                                                                             %
7746%                                                                             %
7747%                                                                             %
7748%   M a g i c k P r e v i e w I m a g e s                                     %
7749%                                                                             %
7750%                                                                             %
7751%                                                                             %
7752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7753%
7754%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7755%  image processing operation applied at varying strengths.  This helpful
7756%  to quickly pin-point an appropriate parameter for an image processing
7757%  operation.
7758%
7759%  The format of the MagickPreviewImages method is:
7760%
7761%      MagickWand *MagickPreviewImages(MagickWand *wand,
7762%        const PreviewType preview)
7763%
7764%  A description of each parameter follows:
7765%
7766%    o wand: the magick wand.
7767%
7768%    o preview: the preview type.
7769%
7770*/
7771WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7772  const PreviewType preview)
7773{
7774  Image
7775    *preview_image;
7776
7777  assert(wand != (MagickWand *) NULL);
7778  assert(wand->signature == MagickWandSignature);
7779  if (wand->debug != MagickFalse)
7780    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7781  if (wand->images == (Image *) NULL)
7782    return((MagickWand *) NULL);
7783  preview_image=PreviewImage(wand->images,preview,wand->exception);
7784  if (preview_image == (Image *) NULL)
7785    return((MagickWand *) NULL);
7786  return(CloneMagickWandFromImages(wand,preview_image));
7787}
7788
7789/*
7790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7791%                                                                             %
7792%                                                                             %
7793%                                                                             %
7794%   M a g i c k P r e v i o u s I m a g e                                     %
7795%                                                                             %
7796%                                                                             %
7797%                                                                             %
7798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7799%
7800%  MagickPreviousImage() sets the previous image in the wand as the current
7801%  image.
7802%
7803%  It is typically used after MagickSetLastIterator(), after which its first
7804%  use will set the last image as the current image (unless the wand is empty).
7805%
7806%  It will return MagickFalse when no more images are left to be returned
7807%  which happens when the wand is empty, or the current image is the first
7808%  image.  At that point the iterator is than reset to again process images in
7809%  the forward direction, again starting with the first image in list. Images
7810%  added at this point are prepended.
7811%
7812%  Also at that point any images added to the wand using MagickAddImages() or
7813%  MagickReadImages() will be prepended before the first image. In this sense
7814%  the condition is not quite exactly the same as MagickResetIterator().
7815%
7816%  The format of the MagickPreviousImage method is:
7817%
7818%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7819%
7820%  A description of each parameter follows:
7821%
7822%    o wand: the magick wand.
7823%
7824*/
7825WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7826{
7827  assert(wand != (MagickWand *) NULL);
7828  assert(wand->signature == MagickWandSignature);
7829  if (wand->debug != MagickFalse)
7830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7831  if (wand->images == (Image *) NULL)
7832    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7833  if (wand->image_pending != MagickFalse)
7834    {
7835      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7836      return(MagickTrue);
7837    }
7838  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7839    {
7840      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7841      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7842      return(MagickFalse);
7843    }
7844  wand->images=GetPreviousImageInList(wand->images);
7845  return(MagickTrue);
7846}
7847
7848/*
7849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7850%                                                                             %
7851%                                                                             %
7852%                                                                             %
7853%   M a g i c k Q u a n t i z e I m a g e                                     %
7854%                                                                             %
7855%                                                                             %
7856%                                                                             %
7857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7858%
7859%  MagickQuantizeImage() analyzes the colors within a reference image and
7860%  chooses a fixed number of colors to represent the image.  The goal of the
7861%  algorithm is to minimize the color difference between the input and output
7862%  image while minimizing the processing time.
7863%
7864%  The format of the MagickQuantizeImage method is:
7865%
7866%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7867%        const size_t number_colors,const ColorspaceType colorspace,
7868%        const size_t treedepth,const DitherMethod dither_method,
7869%        const MagickBooleanType measure_error)
7870%
7871%  A description of each parameter follows:
7872%
7873%    o wand: the magick wand.
7874%
7875%    o number_colors: the number of colors.
7876%
7877%    o colorspace: Perform color reduction in this colorspace, typically
7878%      RGBColorspace.
7879%
7880%    o treedepth: Normally, this integer value is zero or one.  A zero or
7881%      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
7882%      reference image with the least amount of memory and the fastest
7883%      computational speed.  In some cases, such as an image with low color
7884%      dispersion (a few number of colors), a value other than
7885%      Log4(number_colors) is required.  To expand the color tree completely,
7886%      use a value of 8.
7887%
7888%    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7889%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7890%
7891%    o measure_error: A value other than zero measures the difference between
7892%      the original and quantized images.  This difference is the total
7893%      quantization error.  The error is computed by summing over all pixels
7894%      in an image the distance squared in RGB space between each reference
7895%      pixel value and its quantized value.
7896%
7897*/
7898WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7899  const size_t number_colors,const ColorspaceType colorspace,
7900  const size_t treedepth,const DitherMethod dither_method,
7901  const MagickBooleanType measure_error)
7902{
7903  MagickBooleanType
7904    status;
7905
7906  QuantizeInfo
7907    *quantize_info;
7908
7909  assert(wand != (MagickWand *) NULL);
7910  assert(wand->signature == MagickWandSignature);
7911  if (wand->debug != MagickFalse)
7912    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7913  if (wand->images == (Image *) NULL)
7914    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7915  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7916  quantize_info->number_colors=number_colors;
7917  quantize_info->dither_method=dither_method;
7918  quantize_info->tree_depth=treedepth;
7919  quantize_info->colorspace=colorspace;
7920  quantize_info->measure_error=measure_error;
7921  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7922  quantize_info=DestroyQuantizeInfo(quantize_info);
7923  return(status);
7924}
7925
7926/*
7927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7928%                                                                             %
7929%                                                                             %
7930%                                                                             %
7931%   M a g i c k Q u a n t i z e I m a g e s                                   %
7932%                                                                             %
7933%                                                                             %
7934%                                                                             %
7935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7936%
7937%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7938%  chooses a fixed number of colors to represent the image.  The goal of the
7939%  algorithm is to minimize the color difference between the input and output
7940%  image while minimizing the processing time.
7941%
7942%  The format of the MagickQuantizeImages method is:
7943%
7944%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7945%        const size_t number_colors,const ColorspaceType colorspace,
7946%        const size_t treedepth,const DitherMethod dither_method,
7947%        const MagickBooleanType measure_error)
7948%
7949%  A description of each parameter follows:
7950%
7951%    o wand: the magick wand.
7952%
7953%    o number_colors: the number of colors.
7954%
7955%    o colorspace: Perform color reduction in this colorspace, typically
7956%      RGBColorspace.
7957%
7958%    o treedepth: Normally, this integer value is zero or one.  A zero or
7959%      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
7960%      reference image with the least amount of memory and the fastest
7961%      computational speed.  In some cases, such as an image with low color
7962%      dispersion (a few number of colors), a value other than
7963%      Log4(number_colors) is required.  To expand the color tree completely,
7964%      use a value of 8.
7965%
7966%    o dither_method: choose from these dither methods: NoDitherMethod,
7967%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7968%
7969%    o measure_error: A value other than zero measures the difference between
7970%      the original and quantized images.  This difference is the total
7971%      quantization error.  The error is computed by summing over all pixels
7972%      in an image the distance squared in RGB space between each reference
7973%      pixel value and its quantized value.
7974%
7975*/
7976WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7977  const size_t number_colors,const ColorspaceType colorspace,
7978  const size_t treedepth,const DitherMethod dither_method,
7979  const MagickBooleanType measure_error)
7980{
7981  MagickBooleanType
7982    status;
7983
7984  QuantizeInfo
7985    *quantize_info;
7986
7987  assert(wand != (MagickWand *) NULL);
7988  assert(wand->signature == MagickWandSignature);
7989  if (wand->debug != MagickFalse)
7990    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7991  if (wand->images == (Image *) NULL)
7992    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7993  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7994  quantize_info->number_colors=number_colors;
7995  quantize_info->dither_method=dither_method;
7996  quantize_info->tree_depth=treedepth;
7997  quantize_info->colorspace=colorspace;
7998  quantize_info->measure_error=measure_error;
7999  status=QuantizeImages(quantize_info,wand->images,wand->exception);
8000  quantize_info=DestroyQuantizeInfo(quantize_info);
8001  return(status);
8002}
8003
8004/*
8005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8006%                                                                             %
8007%                                                                             %
8008%                                                                             %
8009%   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                         %
8010%                                                                             %
8011%                                                                             %
8012%                                                                             %
8013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8014%
8015%  MagickRotationalBlurImage() rotational blurs an image.
8016%
8017%  The format of the MagickRotationalBlurImage method is:
8018%
8019%      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8020%        const double angle)
8021%
8022%  A description of each parameter follows:
8023%
8024%    o wand: the magick wand.
8025%
8026%    o angle: the angle of the blur in degrees.
8027%
8028*/
8029WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8030  const double angle)
8031{
8032  Image
8033    *blur_image;
8034
8035  assert(wand != (MagickWand *) NULL);
8036  assert(wand->signature == MagickWandSignature);
8037  if (wand->debug != MagickFalse)
8038    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8039  if (wand->images == (Image *) NULL)
8040    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8041  blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8042  if (blur_image == (Image *) NULL)
8043    return(MagickFalse);
8044  ReplaceImageInList(&wand->images,blur_image);
8045  return(MagickTrue);
8046}
8047
8048/*
8049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8050%                                                                             %
8051%                                                                             %
8052%                                                                             %
8053%   M a g i c k R a i s e I m a g e                                           %
8054%                                                                             %
8055%                                                                             %
8056%                                                                             %
8057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8058%
8059%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8060%  by lightening and darkening the edges of the image.  Members width and
8061%  height of raise_info define the width of the vertical and horizontal
8062%  edge of the effect.
8063%
8064%  The format of the MagickRaiseImage method is:
8065%
8066%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8067%        const size_t width,const size_t height,const ssize_t x,
8068%        const ssize_t y,const MagickBooleanType raise)
8069%
8070%  A description of each parameter follows:
8071%
8072%    o wand: the magick wand.
8073%
8074%    o width,height,x,y:  Define the dimensions of the area to raise.
8075%
8076%    o raise: A value other than zero creates a 3-D raise effect,
8077%      otherwise it has a lowered effect.
8078%
8079*/
8080WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8081  const size_t width,const size_t height,const ssize_t x,
8082  const ssize_t y,const MagickBooleanType raise)
8083{
8084  MagickBooleanType
8085    status;
8086
8087  RectangleInfo
8088    raise_info;
8089
8090  assert(wand != (MagickWand *) NULL);
8091  assert(wand->signature == MagickWandSignature);
8092  if (wand->debug != MagickFalse)
8093    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8094  if (wand->images == (Image *) NULL)
8095    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8096  raise_info.width=width;
8097  raise_info.height=height;
8098  raise_info.x=x;
8099  raise_info.y=y;
8100  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8101  return(status);
8102}
8103
8104/*
8105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8106%                                                                             %
8107%                                                                             %
8108%                                                                             %
8109%   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                       %
8110%                                                                             %
8111%                                                                             %
8112%                                                                             %
8113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8114%
8115%  MagickRandomThresholdImage() changes the value of individual pixels based on
8116%  the intensity of each pixel compared to threshold.  The result is a
8117%  high-contrast, two color image.
8118%
8119%  The format of the MagickRandomThresholdImage method is:
8120%
8121%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8122%        const double low,const double high)
8123%
8124%  A description of each parameter follows:
8125%
8126%    o wand: the magick wand.
8127%
8128%    o low,high: Specify the high and low thresholds.  These values range from
8129%      0 to QuantumRange.
8130%
8131*/
8132WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8133  const double low,const double high)
8134{
8135  char
8136    threshold[MagickPathExtent];
8137
8138  assert(wand != (MagickWand *) NULL);
8139  assert(wand->signature == MagickWandSignature);
8140  if (wand->debug != MagickFalse)
8141    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8142  if (wand->images == (Image *) NULL)
8143    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8144  (void) FormatLocaleString(threshold,MagickPathExtent,"%gx%g",low,high);
8145  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8146}
8147
8148/*
8149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8150%                                                                             %
8151%                                                                             %
8152%                                                                             %
8153%   M a g i c k R e a d I m a g e                                             %
8154%                                                                             %
8155%                                                                             %
8156%                                                                             %
8157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8158%
8159%  MagickReadImage() reads an image or image sequence.  The images are inserted
8160%  jjust before the current image pointer position.
8161%
8162%  Use MagickSetFirstIterator(), to insert new images before all the current
8163%  images in the wand, MagickSetLastIterator() to append add to the end,
8164%  MagickSetIteratorIndex() to place images just after the given index.
8165%
8166%  The format of the MagickReadImage method is:
8167%
8168%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8169%
8170%  A description of each parameter follows:
8171%
8172%    o wand: the magick wand.
8173%
8174%    o filename: the image filename.
8175%
8176*/
8177WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8178  const char *filename)
8179{
8180  Image
8181    *images;
8182
8183  ImageInfo
8184    *read_info;
8185
8186  assert(wand != (MagickWand *) NULL);
8187  assert(wand->signature == MagickWandSignature);
8188  if (wand->debug != MagickFalse)
8189    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8190  read_info=CloneImageInfo(wand->image_info);
8191  if (filename != (const char *) NULL)
8192    (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
8193  images=ReadImage(read_info,wand->exception);
8194  read_info=DestroyImageInfo(read_info);
8195  if (images == (Image *) NULL)
8196    return(MagickFalse);
8197  return(InsertImageInWand(wand,images));
8198}
8199
8200/*
8201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8202%                                                                             %
8203%                                                                             %
8204%                                                                             %
8205%   M a g i c k R e a d I m a g e B l o b                                     %
8206%                                                                             %
8207%                                                                             %
8208%                                                                             %
8209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8210%
8211%  MagickReadImageBlob() reads an image or image sequence from a blob.
8212%  In all other respects it is like MagickReadImage().
8213%
8214%  The format of the MagickReadImageBlob method is:
8215%
8216%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8217%        const void *blob,const size_t length)
8218%
8219%  A description of each parameter follows:
8220%
8221%    o wand: the magick wand.
8222%
8223%    o blob: the blob.
8224%
8225%    o length: the blob length.
8226%
8227*/
8228WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8229  const void *blob,const size_t length)
8230{
8231  Image
8232    *images;
8233
8234  assert(wand != (MagickWand *) NULL);
8235  assert(wand->signature == MagickWandSignature);
8236  if (wand->debug != MagickFalse)
8237    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8238  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8239  if (images == (Image *) NULL)
8240    return(MagickFalse);
8241  return(InsertImageInWand(wand,images));
8242}
8243
8244/*
8245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8246%                                                                             %
8247%                                                                             %
8248%                                                                             %
8249%   M a g i c k R e a d I m a g e F i l e                                     %
8250%                                                                             %
8251%                                                                             %
8252%                                                                             %
8253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8254%
8255%  MagickReadImageFile() reads an image or image sequence from an already
8256%  opened file descriptor.  Otherwise it is like MagickReadImage().
8257%
8258%  The format of the MagickReadImageFile method is:
8259%
8260%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8261%
8262%  A description of each parameter follows:
8263%
8264%    o wand: the magick wand.
8265%
8266%    o file: the file descriptor.
8267%
8268*/
8269WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8270{
8271  Image
8272    *images;
8273
8274  ImageInfo
8275    *read_info;
8276
8277  assert(wand != (MagickWand *) NULL);
8278  assert(wand->signature == MagickWandSignature);
8279  assert(file != (FILE *) NULL);
8280  if (wand->debug != MagickFalse)
8281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8282  read_info=CloneImageInfo(wand->image_info);
8283  SetImageInfoFile(read_info,file);
8284  images=ReadImage(read_info,wand->exception);
8285  read_info=DestroyImageInfo(read_info);
8286  if (images == (Image *) NULL)
8287    return(MagickFalse);
8288  return(InsertImageInWand(wand,images));
8289}
8290
8291/*
8292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8293%                                                                             %
8294%                                                                             %
8295%                                                                             %
8296%   M a g i c k R e m a p I m a g e                                           %
8297%                                                                             %
8298%                                                                             %
8299%                                                                             %
8300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8301%
8302%  MagickRemapImage() replaces the colors of an image with the closest color
8303%  from a reference image.
8304%
8305%  The format of the MagickRemapImage method is:
8306%
8307%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8308%        const MagickWand *remap_wand,const DitherMethod method)
8309%
8310%  A description of each parameter follows:
8311%
8312%    o wand: the magick wand.
8313%
8314%    o affinity: the affinity wand.
8315%
8316%    o method: choose from these dither methods: NoDitherMethod,
8317%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8318%
8319*/
8320WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8321  const MagickWand *remap_wand,const DitherMethod dither_method)
8322{
8323  MagickBooleanType
8324    status;
8325
8326  QuantizeInfo
8327    *quantize_info;
8328
8329  assert(wand != (MagickWand *) NULL);
8330  assert(wand->signature == MagickWandSignature);
8331  if (wand->debug != MagickFalse)
8332    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8333  if ((wand->images == (Image *) NULL) ||
8334      (remap_wand->images == (Image *) NULL))
8335    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8336  quantize_info=AcquireQuantizeInfo(wand->image_info);
8337  quantize_info->dither_method=dither_method;
8338  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8339    wand->exception);
8340  quantize_info=DestroyQuantizeInfo(quantize_info);
8341  return(status);
8342}
8343
8344/*
8345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8346%                                                                             %
8347%                                                                             %
8348%                                                                             %
8349%   M a g i c k R e m o v e I m a g e                                         %
8350%                                                                             %
8351%                                                                             %
8352%                                                                             %
8353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8354%
8355%  MagickRemoveImage() removes an image from the image list.
8356%
8357%  The format of the MagickRemoveImage method is:
8358%
8359%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8360%
8361%  A description of each parameter follows:
8362%
8363%    o wand: the magick wand.
8364%
8365%    o insert: the splice wand.
8366%
8367*/
8368WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8369{
8370  assert(wand != (MagickWand *) NULL);
8371  assert(wand->signature == MagickWandSignature);
8372  if (wand->debug != MagickFalse)
8373    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8374  if (wand->images == (Image *) NULL)
8375    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8376  DeleteImageFromList(&wand->images);
8377  return(MagickTrue);
8378}
8379
8380/*
8381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8382%                                                                             %
8383%                                                                             %
8384%                                                                             %
8385%   M a g i c k R e s a m p l e I m a g e                                     %
8386%                                                                             %
8387%                                                                             %
8388%                                                                             %
8389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8390%
8391%  MagickResampleImage() resample image to desired resolution.
8392%
8393%    Bessel   Blackman   Box
8394%    Catrom   Cubic      Gaussian
8395%    Hanning  Hermite    Lanczos
8396%    Mitchell Point      Quandratic
8397%    Sinc     Triangle
8398%
8399%  Most of the filters are FIR (finite impulse response), however, Bessel,
8400%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8401%  are windowed (brought down to zero) with the Blackman filter.
8402%
8403%  The format of the MagickResampleImage method is:
8404%
8405%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8406%        const double x_resolution,const double y_resolution,
8407%        const FilterTypes filter)
8408%
8409%  A description of each parameter follows:
8410%
8411%    o wand: the magick wand.
8412%
8413%    o x_resolution: the new image x resolution.
8414%
8415%    o y_resolution: the new image y resolution.
8416%
8417%    o filter: Image filter to use.
8418%
8419*/
8420WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8421  const double x_resolution,const double y_resolution,const FilterTypes filter)
8422{
8423  Image
8424    *resample_image;
8425
8426  assert(wand != (MagickWand *) NULL);
8427  assert(wand->signature == MagickWandSignature);
8428  if (wand->debug != MagickFalse)
8429    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8430  if (wand->images == (Image *) NULL)
8431    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8432  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8433    wand->exception);
8434  if (resample_image == (Image *) NULL)
8435    return(MagickFalse);
8436  ReplaceImageInList(&wand->images,resample_image);
8437  return(MagickTrue);
8438}
8439
8440/*
8441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8442%                                                                             %
8443%                                                                             %
8444%                                                                             %
8445%   M a g i c k R e s e t I m a g e P a g e                                   %
8446%                                                                             %
8447%                                                                             %
8448%                                                                             %
8449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8450%
8451%  MagickResetImagePage() resets the Wand page canvas and position.
8452%
8453%  The format of the MagickResetImagePage method is:
8454%
8455%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8456%        const char *page)
8457%
8458%  A description of each parameter follows:
8459%
8460%    o wand: the magick wand.
8461%
8462%    o page: the relative page specification.
8463%
8464*/
8465WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8466  const char *page)
8467{
8468  assert(wand != (MagickWand *) NULL);
8469  assert(wand->signature == MagickWandSignature);
8470  if (wand->debug != MagickFalse)
8471    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8472  if (wand->images == (Image *) NULL)
8473    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8474  if ((page == (char *) NULL) || (*page == '\0'))
8475    {
8476      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8477      return(MagickTrue);
8478    }
8479  return(ResetImagePage(wand->images,page));
8480}
8481
8482/*
8483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8484%                                                                             %
8485%                                                                             %
8486%                                                                             %
8487%   M a g i c k R e s i z e I m a g e                                         %
8488%                                                                             %
8489%                                                                             %
8490%                                                                             %
8491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8492%
8493%  MagickResizeImage() scales an image to the desired dimensions with one of
8494%  these filters:
8495%
8496%    Bessel   Blackman   Box
8497%    Catrom   Cubic      Gaussian
8498%    Hanning  Hermite    Lanczos
8499%    Mitchell Point      Quandratic
8500%    Sinc     Triangle
8501%
8502%  Most of the filters are FIR (finite impulse response), however, Bessel,
8503%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8504%  are windowed (brought down to zero) with the Blackman filter.
8505%
8506%  The format of the MagickResizeImage method is:
8507%
8508%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8509%        const size_t columns,const size_t rows,const FilterTypes filter)
8510%
8511%  A description of each parameter follows:
8512%
8513%    o wand: the magick wand.
8514%
8515%    o columns: the number of columns in the scaled image.
8516%
8517%    o rows: the number of rows in the scaled image.
8518%
8519%    o filter: Image filter to use.
8520%
8521*/
8522WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8523  const size_t columns,const size_t rows,const FilterTypes filter)
8524{
8525  Image
8526    *resize_image;
8527
8528  assert(wand != (MagickWand *) NULL);
8529  assert(wand->signature == MagickWandSignature);
8530  if (wand->debug != MagickFalse)
8531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8532  if (wand->images == (Image *) NULL)
8533    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8534  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8535  if (resize_image == (Image *) NULL)
8536    return(MagickFalse);
8537  ReplaceImageInList(&wand->images,resize_image);
8538  return(MagickTrue);
8539}
8540
8541/*
8542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8543%                                                                             %
8544%                                                                             %
8545%                                                                             %
8546%   M a g i c k R o l l I m a g e                                             %
8547%                                                                             %
8548%                                                                             %
8549%                                                                             %
8550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8551%
8552%  MagickRollImage() offsets an image as defined by x and y.
8553%
8554%  The format of the MagickRollImage method is:
8555%
8556%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8557%        const size_t y)
8558%
8559%  A description of each parameter follows:
8560%
8561%    o wand: the magick wand.
8562%
8563%    o x: the x offset.
8564%
8565%    o y: the y offset.
8566%
8567%
8568*/
8569WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8570  const ssize_t x,const ssize_t y)
8571{
8572  Image
8573    *roll_image;
8574
8575  assert(wand != (MagickWand *) NULL);
8576  assert(wand->signature == MagickWandSignature);
8577  if (wand->debug != MagickFalse)
8578    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8579  if (wand->images == (Image *) NULL)
8580    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8581  roll_image=RollImage(wand->images,x,y,wand->exception);
8582  if (roll_image == (Image *) NULL)
8583    return(MagickFalse);
8584  ReplaceImageInList(&wand->images,roll_image);
8585  return(MagickTrue);
8586}
8587
8588/*
8589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8590%                                                                             %
8591%                                                                             %
8592%                                                                             %
8593%   M a g i c k R o t a t e I m a g e                                         %
8594%                                                                             %
8595%                                                                             %
8596%                                                                             %
8597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8598%
8599%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8600%  triangles left over from rotating the image are filled with the
8601%  background color.
8602%
8603%  The format of the MagickRotateImage method is:
8604%
8605%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8606%        const PixelWand *background,const double degrees)
8607%
8608%  A description of each parameter follows:
8609%
8610%    o wand: the magick wand.
8611%
8612%    o background: the background pixel wand.
8613%
8614%    o degrees: the number of degrees to rotate the image.
8615%
8616%
8617*/
8618WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8619  const PixelWand *background,const double degrees)
8620{
8621  Image
8622    *rotate_image;
8623
8624  assert(wand != (MagickWand *) NULL);
8625  assert(wand->signature == MagickWandSignature);
8626  if (wand->debug != MagickFalse)
8627    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8628  if (wand->images == (Image *) NULL)
8629    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8630  PixelGetQuantumPacket(background,&wand->images->background_color);
8631  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8632  if (rotate_image == (Image *) NULL)
8633    return(MagickFalse);
8634  ReplaceImageInList(&wand->images,rotate_image);
8635  return(MagickTrue);
8636}
8637
8638/*
8639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8640%                                                                             %
8641%                                                                             %
8642%                                                                             %
8643%   M a g i c k S a m p l e I m a g e                                         %
8644%                                                                             %
8645%                                                                             %
8646%                                                                             %
8647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8648%
8649%  MagickSampleImage() scales an image to the desired dimensions with pixel
8650%  sampling.  Unlike other scaling methods, this method does not introduce
8651%  any additional color into the scaled image.
8652%
8653%  The format of the MagickSampleImage method is:
8654%
8655%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8656%        const size_t columns,const size_t rows)
8657%
8658%  A description of each parameter follows:
8659%
8660%    o wand: the magick wand.
8661%
8662%    o columns: the number of columns in the scaled image.
8663%
8664%    o rows: the number of rows in the scaled image.
8665%
8666%
8667*/
8668WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8669  const size_t columns,const size_t rows)
8670{
8671  Image
8672    *sample_image;
8673
8674  assert(wand != (MagickWand *) NULL);
8675  assert(wand->signature == MagickWandSignature);
8676  if (wand->debug != MagickFalse)
8677    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8678  if (wand->images == (Image *) NULL)
8679    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8680  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8681  if (sample_image == (Image *) NULL)
8682    return(MagickFalse);
8683  ReplaceImageInList(&wand->images,sample_image);
8684  return(MagickTrue);
8685}
8686
8687/*
8688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%   M a g i c k S c a l e I m a g e                                           %
8693%                                                                             %
8694%                                                                             %
8695%                                                                             %
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%
8698%  MagickScaleImage() scales the size of an image to the given dimensions.
8699%
8700%  The format of the MagickScaleImage method is:
8701%
8702%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8703%        const size_t columns,const size_t rows)
8704%
8705%  A description of each parameter follows:
8706%
8707%    o wand: the magick wand.
8708%
8709%    o columns: the number of columns in the scaled image.
8710%
8711%    o rows: the number of rows in the scaled image.
8712%
8713%
8714*/
8715WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8716  const size_t columns,const size_t rows)
8717{
8718  Image
8719    *scale_image;
8720
8721  assert(wand != (MagickWand *) NULL);
8722  assert(wand->signature == MagickWandSignature);
8723  if (wand->debug != MagickFalse)
8724    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8725  if (wand->images == (Image *) NULL)
8726    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8727  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8728  if (scale_image == (Image *) NULL)
8729    return(MagickFalse);
8730  ReplaceImageInList(&wand->images,scale_image);
8731  return(MagickTrue);
8732}
8733
8734/*
8735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8736%                                                                             %
8737%                                                                             %
8738%                                                                             %
8739%   M a g i c k S e g m e n t I m a g e                                       %
8740%                                                                             %
8741%                                                                             %
8742%                                                                             %
8743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8744%
8745%  MagickSegmentImage() segments an image by analyzing the histograms of the
8746%  color components and identifying units that are homogeneous with the fuzzy
8747%  C-means technique.
8748%
8749%  The format of the SegmentImage method is:
8750%
8751%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8752%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8753%        const double cluster_threshold,const double smooth_threshold)
8754%
8755%  A description of each parameter follows.
8756%
8757%    o wand: the wand.
8758%
8759%    o colorspace: the image colorspace.
8760%
8761%    o verbose:  Set to MagickTrue to print detailed information about the
8762%      identified classes.
8763%
8764%    o cluster_threshold:  This represents the minimum number of pixels
8765%      contained in a hexahedra before it can be considered valid (expressed as
8766%      a percentage).
8767%
8768%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8769%      derivative of the histogram.  As the value is increased, you can expect a
8770%      smoother second derivative.
8771%
8772*/
8773MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8774  const ColorspaceType colorspace,const MagickBooleanType verbose,
8775  const double cluster_threshold,const double smooth_threshold)
8776{
8777  MagickBooleanType
8778    status;
8779
8780  assert(wand != (MagickWand *) NULL);
8781  assert(wand->signature == MagickWandSignature);
8782  if (wand->debug != MagickFalse)
8783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8784  if (wand->images == (Image *) NULL)
8785    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8786  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8787    smooth_threshold,wand->exception);
8788  return(status);
8789}
8790
8791/*
8792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8793%                                                                             %
8794%                                                                             %
8795%                                                                             %
8796%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8797%                                                                             %
8798%                                                                             %
8799%                                                                             %
8800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8801%
8802%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8803%  threshold. It is similar to the unsharpen mask that sharpens everything with
8804%  contrast above a certain threshold.
8805%
8806%  The format of the MagickSelectiveBlurImage method is:
8807%
8808%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8809%        const double radius,const double sigma,const double threshold)
8810%
8811%  A description of each parameter follows:
8812%
8813%    o wand: the magick wand.
8814%
8815%    o radius: the radius of the gaussian, in pixels, not counting the center
8816%      pixel.
8817%
8818%    o sigma: the standard deviation of the gaussian, in pixels.
8819%
8820%    o threshold: only pixels within this contrast threshold are included
8821%      in the blur operation.
8822%
8823*/
8824WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8825  const double radius,const double sigma,const double threshold)
8826{
8827  Image
8828    *blur_image;
8829
8830  assert(wand != (MagickWand *) NULL);
8831  assert(wand->signature == MagickWandSignature);
8832  if (wand->debug != MagickFalse)
8833    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8834  if (wand->images == (Image *) NULL)
8835    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8836  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8837    wand->exception);
8838  if (blur_image == (Image *) NULL)
8839    return(MagickFalse);
8840  ReplaceImageInList(&wand->images,blur_image);
8841  return(MagickTrue);
8842}
8843
8844/*
8845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8846%                                                                             %
8847%                                                                             %
8848%                                                                             %
8849%   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                       %
8850%                                                                             %
8851%                                                                             %
8852%                                                                             %
8853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8854%
8855%  MagickSeparateImage() separates a channel from the image and returns a
8856%  grayscale image.  A channel is a particular color component of each pixel
8857%  in the image.
8858%
8859%  The format of the MagickSeparateImage method is:
8860%
8861%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8862%        const ChannelType channel)
8863%
8864%  A description of each parameter follows:
8865%
8866%    o wand: the magick wand.
8867%
8868%    o channel: the channel.
8869%
8870*/
8871WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8872  const ChannelType channel)
8873{
8874  Image
8875    *separate_image;
8876
8877  assert(wand != (MagickWand *) NULL);
8878  assert(wand->signature == MagickWandSignature);
8879  if (wand->debug != MagickFalse)
8880    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8881  if (wand->images == (Image *) NULL)
8882    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8883  separate_image=SeparateImage(wand->images,channel,wand->exception);
8884  if (separate_image == (Image *) NULL)
8885    return(MagickFalse);
8886  ReplaceImageInList(&wand->images,separate_image);
8887  return(MagickTrue);
8888}
8889
8890/*
8891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8892%                                                                             %
8893%                                                                             %
8894%                                                                             %
8895%     M a g i c k S e p i a T o n e I m a g e                                 %
8896%                                                                             %
8897%                                                                             %
8898%                                                                             %
8899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8900%
8901%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8902%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8903%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8904%  threshold of 80% is a good starting point for a reasonable tone.
8905%
8906%  The format of the MagickSepiaToneImage method is:
8907%
8908%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8909%        const double threshold)
8910%
8911%  A description of each parameter follows:
8912%
8913%    o wand: the magick wand.
8914%
8915%    o threshold:  Define the extent of the sepia toning.
8916%
8917*/
8918WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8919  const double threshold)
8920{
8921  Image
8922    *sepia_image;
8923
8924  assert(wand != (MagickWand *) NULL);
8925  assert(wand->signature == MagickWandSignature);
8926  if (wand->debug != MagickFalse)
8927    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8928  if (wand->images == (Image *) NULL)
8929    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8930  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8931  if (sepia_image == (Image *) NULL)
8932    return(MagickFalse);
8933  ReplaceImageInList(&wand->images,sepia_image);
8934  return(MagickTrue);
8935}
8936
8937/*
8938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8939%                                                                             %
8940%                                                                             %
8941%                                                                             %
8942%   M a g i c k S e t I m a g e                                               %
8943%                                                                             %
8944%                                                                             %
8945%                                                                             %
8946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8947%
8948%  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
8949%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8950%  wand.
8951%
8952%  The format of the MagickSetImage method is:
8953%
8954%      MagickBooleanType MagickSetImage(MagickWand *wand,
8955%        const MagickWand *set_wand)
8956%
8957%  A description of each parameter follows:
8958%
8959%    o wand: the magick wand.
8960%
8961%    o set_wand: the set_wand wand.
8962%
8963*/
8964WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8965  const MagickWand *set_wand)
8966{
8967  Image
8968    *images;
8969
8970  assert(wand != (MagickWand *) NULL);
8971  assert(wand->signature == MagickWandSignature);
8972  if (wand->debug != MagickFalse)
8973    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8974  assert(set_wand != (MagickWand *) NULL);
8975  assert(set_wand->signature == MagickWandSignature);
8976  if (wand->debug != MagickFalse)
8977    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8978  if (set_wand->images == (Image *) NULL)
8979    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8980  images=CloneImageList(set_wand->images,wand->exception);
8981  if (images == (Image *) NULL)
8982    return(MagickFalse);
8983  ReplaceImageInList(&wand->images,images);
8984  return(MagickTrue);
8985}
8986
8987/*
8988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8989%                                                                             %
8990%                                                                             %
8991%                                                                             %
8992%   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                       %
8993%                                                                             %
8994%                                                                             %
8995%                                                                             %
8996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8997%
8998%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8999%  alpha channel.
9000%
9001%  The format of the MagickSetImageAlphaChannel method is:
9002%
9003%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9004%        const AlphaChannelOption alpha_type)
9005%
9006%  A description of each parameter follows:
9007%
9008%    o wand: the magick wand.
9009%
9010%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9011%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9012%
9013*/
9014WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9015  const AlphaChannelOption alpha_type)
9016{
9017  assert(wand != (MagickWand *) NULL);
9018  assert(wand->signature == MagickWandSignature);
9019  if (wand->debug != MagickFalse)
9020    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9021  if (wand->images == (Image *) NULL)
9022    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9023  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9024}
9025
9026/*
9027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9028%                                                                             %
9029%                                                                             %
9030%                                                                             %
9031%   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                 %
9032%                                                                             %
9033%                                                                             %
9034%                                                                             %
9035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9036%
9037%  MagickSetImageBackgroundColor() sets the image background color.
9038%
9039%  The format of the MagickSetImageBackgroundColor method is:
9040%
9041%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9042%        const PixelWand *background)
9043%
9044%  A description of each parameter follows:
9045%
9046%    o wand: the magick wand.
9047%
9048%    o background: the background pixel wand.
9049%
9050*/
9051WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9052  const PixelWand *background)
9053{
9054  assert(wand != (MagickWand *) NULL);
9055  assert(wand->signature == MagickWandSignature);
9056  if (wand->debug != MagickFalse)
9057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9058  if (wand->images == (Image *) NULL)
9059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9060  PixelGetQuantumPacket(background,&wand->images->background_color);
9061  return(MagickTrue);
9062}
9063
9064/*
9065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9066%                                                                             %
9067%                                                                             %
9068%                                                                             %
9069%   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                         %
9070%                                                                             %
9071%                                                                             %
9072%                                                                             %
9073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9074%
9075%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9076%
9077%  The format of the MagickSetImageBluePrimary method is:
9078%
9079%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9080%        const double x,const double y)
9081%
9082%  A description of each parameter follows:
9083%
9084%    o wand: the magick wand.
9085%
9086%    o x: the blue primary x-point.
9087%
9088%    o y: the blue primary y-point.
9089%
9090*/
9091WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9092  const double x,const double y)
9093{
9094  assert(wand != (MagickWand *) NULL);
9095  assert(wand->signature == MagickWandSignature);
9096  if (wand->debug != MagickFalse)
9097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9098  if (wand->images == (Image *) NULL)
9099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9100  wand->images->chromaticity.blue_primary.x=x;
9101  wand->images->chromaticity.blue_primary.y=y;
9102  return(MagickTrue);
9103}
9104
9105/*
9106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9107%                                                                             %
9108%                                                                             %
9109%                                                                             %
9110%   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                         %
9111%                                                                             %
9112%                                                                             %
9113%                                                                             %
9114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9115%
9116%  MagickSetImageBorderColor() sets the image border color.
9117%
9118%  The format of the MagickSetImageBorderColor method is:
9119%
9120%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9121%        const PixelWand *border)
9122%
9123%  A description of each parameter follows:
9124%
9125%    o wand: the magick wand.
9126%
9127%    o border: the border pixel wand.
9128%
9129*/
9130WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9131  const PixelWand *border)
9132{
9133  assert(wand != (MagickWand *) NULL);
9134  assert(wand->signature == MagickWandSignature);
9135  if (wand->debug != MagickFalse)
9136    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9137  if (wand->images == (Image *) NULL)
9138    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9139  PixelGetQuantumPacket(border,&wand->images->border_color);
9140  return(MagickTrue);
9141}
9142
9143/*
9144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9145%                                                                             %
9146%                                                                             %
9147%                                                                             %
9148%   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                         %
9149%                                                                             %
9150%                                                                             %
9151%                                                                             %
9152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9153%
9154%  MagickSetImageChannelMask() sets image channel mask.
9155%
9156%  The format of the MagickSetImageChannelMask method is:
9157%
9158%      ChannelType MagickSetImageChannelMask(MagickWand *wand,
9159%        const ChannelType channel_mask)
9160%
9161%  A description of each parameter follows:
9162%
9163%    o wand: the magick wand.
9164%
9165%    o channel_mask: the channel_mask wand.
9166%
9167*/
9168WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9169  const ChannelType channel_mask)
9170{
9171  assert(wand != (MagickWand *) NULL);
9172  assert(wand->signature == MagickWandSignature);
9173  if (wand->debug != MagickFalse)
9174    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9175  return(SetImageChannelMask(wand->images,channel_mask));
9176}
9177
9178/*
9179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9180%                                                                             %
9181%                                                                             %
9182%                                                                             %
9183%   M a g i c k S e t I m a g e M a s k                                       %
9184%                                                                             %
9185%                                                                             %
9186%                                                                             %
9187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9188%
9189%  MagickSetImageMask() sets image clip mask.
9190%
9191%  The format of the MagickSetImageMask method is:
9192%
9193%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9194%        const PixelMask type,const MagickWand *clip_mask)
9195%
9196%  A description of each parameter follows:
9197%
9198%    o wand: the magick wand.
9199%
9200%    o type: type of mask, ReadPixelMask or WritePixelMask.
9201%
9202%    o clip_mask: the clip_mask wand.
9203%
9204*/
9205WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9206  const PixelMask type,const MagickWand *clip_mask)
9207{
9208  assert(wand != (MagickWand *) NULL);
9209  assert(wand->signature == MagickWandSignature);
9210  if (wand->debug != MagickFalse)
9211    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9212  assert(clip_mask != (MagickWand *) NULL);
9213  assert(clip_mask->signature == MagickWandSignature);
9214  if (clip_mask->debug != MagickFalse)
9215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9216  if (clip_mask->images == (Image *) NULL)
9217    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9218  return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
9219}
9220
9221/*
9222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9223%                                                                             %
9224%                                                                             %
9225%                                                                             %
9226%   M a g i c k S e t I m a g e C o l o r                                     %
9227%                                                                             %
9228%                                                                             %
9229%                                                                             %
9230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9231%
9232%  MagickSetImageColor() set the entire wand canvas to the specified color.
9233%
9234%  The format of the MagickSetImageColor method is:
9235%
9236%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9237%        const PixelWand *color)
9238%
9239%  A description of each parameter follows:
9240%
9241%    o wand: the magick wand.
9242%
9243%    o background: the image color.
9244%
9245*/
9246WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9247  const PixelWand *color)
9248{
9249  PixelInfo
9250    pixel;
9251
9252  assert(wand != (MagickWand *) NULL);
9253  assert(wand->signature == MagickWandSignature);
9254  if (wand->debug != MagickFalse)
9255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9256  PixelGetMagickColor(color,&pixel);
9257  return(SetImageColor(wand->images,&pixel,wand->exception));
9258}
9259
9260/*
9261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9262%                                                                             %
9263%                                                                             %
9264%                                                                             %
9265%   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                     %
9266%                                                                             %
9267%                                                                             %
9268%                                                                             %
9269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9270%
9271%  MagickSetImageColormapColor() sets the color of the specified colormap
9272%  index.
9273%
9274%  The format of the MagickSetImageColormapColor method is:
9275%
9276%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9277%        const size_t index,const PixelWand *color)
9278%
9279%  A description of each parameter follows:
9280%
9281%    o wand: the magick wand.
9282%
9283%    o index: the offset into the image colormap.
9284%
9285%    o color: Return the colormap color in this wand.
9286%
9287*/
9288WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9289  const size_t index,const PixelWand *color)
9290{
9291  assert(wand != (MagickWand *) NULL);
9292  assert(wand->signature == MagickWandSignature);
9293  if (wand->debug != MagickFalse)
9294    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9295  if (wand->images == (Image *) NULL)
9296    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9297  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9298      (index >= wand->images->colors))
9299    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9300  PixelGetQuantumPacket(color,wand->images->colormap+index);
9301  return(SyncImage(wand->images,wand->exception));
9302}
9303
9304/*
9305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9306%                                                                             %
9307%                                                                             %
9308%                                                                             %
9309%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9310%                                                                             %
9311%                                                                             %
9312%                                                                             %
9313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9314%
9315%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9316%  the image data.
9317%
9318%  The format of the MagickSetImageColorspace method is:
9319%
9320%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9321%        const ColorspaceType colorspace)
9322%
9323%  A description of each parameter follows:
9324%
9325%    o wand: the magick wand.
9326%
9327%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9328%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9329%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9330%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9331%      HSLColorspace, or HWBColorspace.
9332%
9333*/
9334WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9335  const ColorspaceType colorspace)
9336{
9337  assert(wand != (MagickWand *) NULL);
9338  assert(wand->signature == MagickWandSignature);
9339  if (wand->debug != MagickFalse)
9340    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9341  if (wand->images == (Image *) NULL)
9342    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9343  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9344}
9345
9346/*
9347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9348%                                                                             %
9349%                                                                             %
9350%                                                                             %
9351%   M a g i c k S e t I m a g e C o m p o s e                                 %
9352%                                                                             %
9353%                                                                             %
9354%                                                                             %
9355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9356%
9357%  MagickSetImageCompose() sets the image composite operator, useful for
9358%  specifying how to composite the image thumbnail when using the
9359%  MagickMontageImage() method.
9360%
9361%  The format of the MagickSetImageCompose method is:
9362%
9363%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9364%        const CompositeOperator compose)
9365%
9366%  A description of each parameter follows:
9367%
9368%    o wand: the magick wand.
9369%
9370%    o compose: the image composite operator.
9371%
9372*/
9373WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9374  const CompositeOperator compose)
9375{
9376  assert(wand != (MagickWand *) NULL);
9377  assert(wand->signature == MagickWandSignature);
9378  if (wand->debug != MagickFalse)
9379    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9380  if (wand->images == (Image *) NULL)
9381    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9382  wand->images->compose=compose;
9383  return(MagickTrue);
9384}
9385
9386/*
9387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9388%                                                                             %
9389%                                                                             %
9390%                                                                             %
9391%   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                         %
9392%                                                                             %
9393%                                                                             %
9394%                                                                             %
9395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9396%
9397%  MagickSetImageCompression() sets the image compression.
9398%
9399%  The format of the MagickSetImageCompression method is:
9400%
9401%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9402%        const CompressionType compression)
9403%
9404%  A description of each parameter follows:
9405%
9406%    o wand: the magick wand.
9407%
9408%    o compression: the image compression type.
9409%
9410*/
9411WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9412  const CompressionType compression)
9413{
9414  assert(wand != (MagickWand *) NULL);
9415  assert(wand->signature == MagickWandSignature);
9416  if (wand->debug != MagickFalse)
9417    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9418  if (wand->images == (Image *) NULL)
9419    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9420  wand->images->compression=compression;
9421  return(MagickTrue);
9422}
9423
9424/*
9425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9426%                                                                             %
9427%                                                                             %
9428%                                                                             %
9429%   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           %
9430%                                                                             %
9431%                                                                             %
9432%                                                                             %
9433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9434%
9435%  MagickSetImageCompressionQuality() sets the image compression quality.
9436%
9437%  The format of the MagickSetImageCompressionQuality method is:
9438%
9439%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9440%        const size_t quality)
9441%
9442%  A description of each parameter follows:
9443%
9444%    o wand: the magick wand.
9445%
9446%    o quality: the image compression tlityype.
9447%
9448*/
9449WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9450  const size_t quality)
9451{
9452  assert(wand != (MagickWand *) NULL);
9453  assert(wand->signature == MagickWandSignature);
9454  if (wand->debug != MagickFalse)
9455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9456  if (wand->images == (Image *) NULL)
9457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9458  wand->images->quality=quality;
9459  return(MagickTrue);
9460}
9461
9462/*
9463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464%                                                                             %
9465%                                                                             %
9466%                                                                             %
9467%   M a g i c k S e t I m a g e D e l a y                                     %
9468%                                                                             %
9469%                                                                             %
9470%                                                                             %
9471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9472%
9473%  MagickSetImageDelay() sets the image delay.
9474%
9475%  The format of the MagickSetImageDelay method is:
9476%
9477%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9478%        const size_t delay)
9479%
9480%  A description of each parameter follows:
9481%
9482%    o wand: the magick wand.
9483%
9484%    o delay: the image delay in ticks-per-second units.
9485%
9486*/
9487WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9488  const size_t delay)
9489{
9490  assert(wand != (MagickWand *) NULL);
9491  assert(wand->signature == MagickWandSignature);
9492  if (wand->debug != MagickFalse)
9493    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9494  if (wand->images == (Image *) NULL)
9495    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9496  wand->images->delay=delay;
9497  return(MagickTrue);
9498}
9499
9500/*
9501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9502%                                                                             %
9503%                                                                             %
9504%                                                                             %
9505%   M a g i c k S e t I m a g e D e p t h                                     %
9506%                                                                             %
9507%                                                                             %
9508%                                                                             %
9509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9510%
9511%  MagickSetImageDepth() sets the image depth.
9512%
9513%  The format of the MagickSetImageDepth method is:
9514%
9515%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9516%        const size_t depth)
9517%
9518%  A description of each parameter follows:
9519%
9520%    o wand: the magick wand.
9521%
9522%    o depth: the image depth in bits: 8, 16, or 32.
9523%
9524*/
9525WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9526  const size_t depth)
9527{
9528  assert(wand != (MagickWand *) NULL);
9529  assert(wand->signature == MagickWandSignature);
9530  if (wand->debug != MagickFalse)
9531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9532  if (wand->images == (Image *) NULL)
9533    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9534  return(SetImageDepth(wand->images,depth,wand->exception));
9535}
9536
9537/*
9538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9539%                                                                             %
9540%                                                                             %
9541%                                                                             %
9542%   M a g i c k S e t I m a g e D i s p o s e                                 %
9543%                                                                             %
9544%                                                                             %
9545%                                                                             %
9546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9547%
9548%  MagickSetImageDispose() sets the image disposal method.
9549%
9550%  The format of the MagickSetImageDispose method is:
9551%
9552%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9553%        const DisposeType dispose)
9554%
9555%  A description of each parameter follows:
9556%
9557%    o wand: the magick wand.
9558%
9559%    o dispose: the image disposeal type.
9560%
9561*/
9562WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9563  const DisposeType dispose)
9564{
9565  assert(wand != (MagickWand *) NULL);
9566  assert(wand->signature == MagickWandSignature);
9567  if (wand->debug != MagickFalse)
9568    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9569  if (wand->images == (Image *) NULL)
9570    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9571  wand->images->dispose=dispose;
9572  return(MagickTrue);
9573}
9574
9575/*
9576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9577%                                                                             %
9578%                                                                             %
9579%                                                                             %
9580%   M a g i c k S e t I m a g e E n d i a n                                   %
9581%                                                                             %
9582%                                                                             %
9583%                                                                             %
9584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9585%
9586%  MagickSetImageEndian() sets the image endian method.
9587%
9588%  The format of the MagickSetImageEndian method is:
9589%
9590%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9591%        const EndianType endian)
9592%
9593%  A description of each parameter follows:
9594%
9595%    o wand: the magick wand.
9596%
9597%    o endian: the image endian type.
9598%
9599*/
9600WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9601  const EndianType endian)
9602{
9603  assert(wand != (MagickWand *) NULL);
9604  assert(wand->signature == MagickWandSignature);
9605  if (wand->debug != MagickFalse)
9606    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9607  if (wand->images == (Image *) NULL)
9608    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9609  wand->images->endian=endian;
9610  return(MagickTrue);
9611}
9612
9613/*
9614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9615%                                                                             %
9616%                                                                             %
9617%                                                                             %
9618%   M a g i c k S e t I m a g e E x t e n t                                   %
9619%                                                                             %
9620%                                                                             %
9621%                                                                             %
9622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9623%
9624%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9625%
9626%  The format of the MagickSetImageExtent method is:
9627%
9628%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9629%        const size_t columns,const unsigned rows)
9630%
9631%  A description of each parameter follows:
9632%
9633%    o wand: the magick wand.
9634%
9635%    o columns:  The image width in pixels.
9636%
9637%    o rows:  The image height in pixels.
9638%
9639*/
9640WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9641  const size_t columns,const size_t rows)
9642{
9643  assert(wand != (MagickWand *) NULL);
9644  assert(wand->signature == MagickWandSignature);
9645  if (wand->debug != MagickFalse)
9646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9647  if (wand->images == (Image *) NULL)
9648    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9649  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9650}
9651
9652/*
9653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9654%                                                                             %
9655%                                                                             %
9656%                                                                             %
9657%   M a g i c k S e t I m a g e F i l e n a m e                               %
9658%                                                                             %
9659%                                                                             %
9660%                                                                             %
9661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9662%
9663%  MagickSetImageFilename() sets the filename of a particular image in a
9664%  sequence.
9665%
9666%  The format of the MagickSetImageFilename method is:
9667%
9668%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9669%        const char *filename)
9670%
9671%  A description of each parameter follows:
9672%
9673%    o wand: the magick wand.
9674%
9675%    o filename: the image filename.
9676%
9677*/
9678WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9679  const char *filename)
9680{
9681  assert(wand != (MagickWand *) NULL);
9682  assert(wand->signature == MagickWandSignature);
9683  if (wand->debug != MagickFalse)
9684    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9685  if (wand->images == (Image *) NULL)
9686    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9687  if (filename != (const char *) NULL)
9688    (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
9689  return(MagickTrue);
9690}
9691
9692/*
9693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9694%                                                                             %
9695%                                                                             %
9696%                                                                             %
9697%   M a g i c k S e t I m a g e F o r m a t                                   %
9698%                                                                             %
9699%                                                                             %
9700%                                                                             %
9701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9702%
9703%  MagickSetImageFormat() sets the format of a particular image in a
9704%  sequence.
9705%
9706%  The format of the MagickSetImageFormat method is:
9707%
9708%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9709%        const char *format)
9710%
9711%  A description of each parameter follows:
9712%
9713%    o wand: the magick wand.
9714%
9715%    o format: the image format.
9716%
9717*/
9718WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9719  const char *format)
9720{
9721  const MagickInfo
9722    *magick_info;
9723
9724  assert(wand != (MagickWand *) NULL);
9725  assert(wand->signature == MagickWandSignature);
9726  if (wand->debug != MagickFalse)
9727    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9728  if (wand->images == (Image *) NULL)
9729    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9730  if ((format == (char *) NULL) || (*format == '\0'))
9731    {
9732      *wand->images->magick='\0';
9733      return(MagickTrue);
9734    }
9735  magick_info=GetMagickInfo(format,wand->exception);
9736  if (magick_info == (const MagickInfo *) NULL)
9737    return(MagickFalse);
9738  ClearMagickException(wand->exception);
9739  (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
9740  return(MagickTrue);
9741}
9742
9743/*
9744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9745%                                                                             %
9746%                                                                             %
9747%                                                                             %
9748%   M a g i c k S e t I m a g e F u z z                                       %
9749%                                                                             %
9750%                                                                             %
9751%                                                                             %
9752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9753%
9754%  MagickSetImageFuzz() sets the image fuzz.
9755%
9756%  The format of the MagickSetImageFuzz method is:
9757%
9758%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9759%        const double fuzz)
9760%
9761%  A description of each parameter follows:
9762%
9763%    o wand: the magick wand.
9764%
9765%    o fuzz: the image fuzz.
9766%
9767*/
9768WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9769  const double fuzz)
9770{
9771  assert(wand != (MagickWand *) NULL);
9772  assert(wand->signature == MagickWandSignature);
9773  if (wand->debug != MagickFalse)
9774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775  if (wand->images == (Image *) NULL)
9776    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9777  wand->images->fuzz=fuzz;
9778  return(MagickTrue);
9779}
9780
9781/*
9782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783%                                                                             %
9784%                                                                             %
9785%                                                                             %
9786%   M a g i c k S e t I m a g e G a m m a                                     %
9787%                                                                             %
9788%                                                                             %
9789%                                                                             %
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%
9792%  MagickSetImageGamma() sets the image gamma.
9793%
9794%  The format of the MagickSetImageGamma method is:
9795%
9796%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9797%        const double gamma)
9798%
9799%  A description of each parameter follows:
9800%
9801%    o wand: the magick wand.
9802%
9803%    o gamma: the image gamma.
9804%
9805*/
9806WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9807  const double gamma)
9808{
9809  assert(wand != (MagickWand *) NULL);
9810  assert(wand->signature == MagickWandSignature);
9811  if (wand->debug != MagickFalse)
9812    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9813  if (wand->images == (Image *) NULL)
9814    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9815  wand->images->gamma=gamma;
9816  return(MagickTrue);
9817}
9818
9819/*
9820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9821%                                                                             %
9822%                                                                             %
9823%                                                                             %
9824%   M a g i c k S e t I m a g e G r a v i t y                                 %
9825%                                                                             %
9826%                                                                             %
9827%                                                                             %
9828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9829%
9830%  MagickSetImageGravity() sets the image gravity type.
9831%
9832%  The format of the MagickSetImageGravity method is:
9833%
9834%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9835%        const GravityType gravity)
9836%
9837%  A description of each parameter follows:
9838%
9839%    o wand: the magick wand.
9840%
9841%    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
9842%               NorthEastGravity, WestGravity, CenterGravity,
9843%               EastGravity, SouthWestGravity, SouthGravity,
9844%               SouthEastGravity)
9845%
9846*/
9847WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9848  const GravityType gravity)
9849{
9850  assert(wand != (MagickWand *) NULL);
9851  assert(wand->signature == MagickWandSignature);
9852  if (wand->debug != MagickFalse)
9853    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9854  if (wand->images == (Image *) NULL)
9855    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9856  wand->images->gravity=gravity;
9857  return(MagickTrue);
9858}
9859
9860/*
9861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9862%                                                                             %
9863%                                                                             %
9864%                                                                             %
9865%   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                       %
9866%                                                                             %
9867%                                                                             %
9868%                                                                             %
9869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9870%
9871%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9872%  point.
9873%
9874%  The format of the MagickSetImageGreenPrimary method is:
9875%
9876%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9877%        const double x,const double y)
9878%
9879%  A description of each parameter follows:
9880%
9881%    o wand: the magick wand.
9882%
9883%    o x: the green primary x-point.
9884%
9885%    o y: the green primary y-point.
9886%
9887%
9888*/
9889WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9890  const double x,const double y)
9891{
9892  assert(wand != (MagickWand *) NULL);
9893  assert(wand->signature == MagickWandSignature);
9894  if (wand->debug != MagickFalse)
9895    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9896  if (wand->images == (Image *) NULL)
9897    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9898  wand->images->chromaticity.green_primary.x=x;
9899  wand->images->chromaticity.green_primary.y=y;
9900  return(MagickTrue);
9901}
9902
9903/*
9904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9905%                                                                             %
9906%                                                                             %
9907%                                                                             %
9908%   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                 %
9909%                                                                             %
9910%                                                                             %
9911%                                                                             %
9912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9913%
9914%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9915%
9916%  The format of the MagickSetImageInterlaceScheme method is:
9917%
9918%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9919%        const InterlaceType interlace)
9920%
9921%  A description of each parameter follows:
9922%
9923%    o wand: the magick wand.
9924%
9925%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9926%      PlaneInterlace, PartitionInterlace.
9927%
9928*/
9929WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9930  const InterlaceType interlace)
9931{
9932  assert(wand != (MagickWand *) NULL);
9933  assert(wand->signature == MagickWandSignature);
9934  if (wand->debug != MagickFalse)
9935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9936  if (wand->images == (Image *) NULL)
9937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9938  wand->images->interlace=interlace;
9939  return(MagickTrue);
9940}
9941
9942/*
9943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944%                                                                             %
9945%                                                                             %
9946%                                                                             %
9947%   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             %
9948%                                                                             %
9949%                                                                             %
9950%                                                                             %
9951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9952%
9953%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9954%  method.
9955%
9956%  The format of the MagickSetImagePixelInterpolateMethod method is:
9957%
9958%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9959%        const PixelInterpolateMethod method)
9960%
9961%  A description of each parameter follows:
9962%
9963%    o wand: the magick wand.
9964%
9965%    o method: the image interpole pixel methods: choose from Undefined,
9966%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9967%
9968*/
9969WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9970  MagickWand *wand,const PixelInterpolateMethod method)
9971{
9972  assert(wand != (MagickWand *) NULL);
9973  assert(wand->signature == MagickWandSignature);
9974  if (wand->debug != MagickFalse)
9975    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9976  if (wand->images == (Image *) NULL)
9977    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9978  wand->images->interpolate=method;
9979  return(MagickTrue);
9980}
9981
9982/*
9983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9984%                                                                             %
9985%                                                                             %
9986%                                                                             %
9987%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9988%                                                                             %
9989%                                                                             %
9990%                                                                             %
9991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9992%
9993%  MagickSetImageIterations() sets the image iterations.
9994%
9995%  The format of the MagickSetImageIterations method is:
9996%
9997%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9998%        const size_t iterations)
9999%
10000%  A description of each parameter follows:
10001%
10002%    o wand: the magick wand.
10003%
10004%    o delay: the image delay in 1/100th of a second.
10005%
10006*/
10007WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10008  const size_t iterations)
10009{
10010  assert(wand != (MagickWand *) NULL);
10011  assert(wand->signature == MagickWandSignature);
10012  if (wand->debug != MagickFalse)
10013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10014  if (wand->images == (Image *) NULL)
10015    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10016  wand->images->iterations=iterations;
10017  return(MagickTrue);
10018}
10019
10020/*
10021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10022%                                                                             %
10023%                                                                             %
10024%                                                                             %
10025%   M a g i c k S e t I m a g e M a t t e                                     %
10026%                                                                             %
10027%                                                                             %
10028%                                                                             %
10029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10030%
10031%  MagickSetImageMatte() sets the image matte channel.
10032%
10033%  The format of the MagickSetImageMatteColor method is:
10034%
10035%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10036%        const MagickBooleanType *matte)
10037%
10038%  A description of each parameter follows:
10039%
10040%    o wand: the magick wand.
10041%
10042%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10043%      MagickFalse.
10044%
10045*/
10046WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10047  const MagickBooleanType matte)
10048{
10049  assert(wand != (MagickWand *) NULL);
10050  assert(wand->signature == MagickWandSignature);
10051  if (wand->debug != MagickFalse)
10052    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10053  if (wand->images == (Image *) NULL)
10054    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10055  if (matte == MagickFalse)
10056    wand->images->alpha_trait=UndefinedPixelTrait;
10057  else
10058    {
10059      if (wand->images->alpha_trait == UndefinedPixelTrait)
10060        (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10061      wand->images->alpha_trait=BlendPixelTrait;
10062    }
10063  return(MagickTrue);
10064}
10065
10066/*
10067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10068%                                                                             %
10069%                                                                             %
10070%                                                                             %
10071%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10072%                                                                             %
10073%                                                                             %
10074%                                                                             %
10075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10076%
10077%  MagickSetImageMatteColor() sets the image matte color.
10078%
10079%  The format of the MagickSetImageMatteColor method is:
10080%
10081%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10082%        const PixelWand *matte)
10083%
10084%  A description of each parameter follows:
10085%
10086%    o wand: the magick wand.
10087%
10088%    o matte: the matte pixel wand.
10089%
10090*/
10091WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10092  const PixelWand *matte)
10093{
10094  assert(wand != (MagickWand *) NULL);
10095  assert(wand->signature == MagickWandSignature);
10096  if (wand->debug != MagickFalse)
10097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10098  if (wand->images == (Image *) NULL)
10099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10100  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10101  return(MagickTrue);
10102}
10103
10104/*
10105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10106%                                                                             %
10107%                                                                             %
10108%                                                                             %
10109%   M a g i c k S e t I m a g e O p a c i t y                                 %
10110%                                                                             %
10111%                                                                             %
10112%                                                                             %
10113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10114%
10115%  MagickSetImageAlpha() sets the image to the specified alpha level.
10116%
10117%  The format of the MagickSetImageAlpha method is:
10118%
10119%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10120%        const double alpha)
10121%
10122%  A description of each parameter follows:
10123%
10124%    o wand: the magick wand.
10125%
10126%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10127%      transparent.
10128%
10129*/
10130WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10131  const double alpha)
10132{
10133  MagickBooleanType
10134    status;
10135
10136  assert(wand != (MagickWand *) NULL);
10137  assert(wand->signature == MagickWandSignature);
10138  if (wand->debug != MagickFalse)
10139    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10140  if (wand->images == (Image *) NULL)
10141    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10142  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10143    wand->exception);
10144  return(status);
10145}
10146
10147/*
10148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10149%                                                                             %
10150%                                                                             %
10151%                                                                             %
10152%   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                         %
10153%                                                                             %
10154%                                                                             %
10155%                                                                             %
10156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10157%
10158%  MagickSetImageOrientation() sets the image orientation.
10159%
10160%  The format of the MagickSetImageOrientation method is:
10161%
10162%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10163%        const OrientationType orientation)
10164%
10165%  A description of each parameter follows:
10166%
10167%    o wand: the magick wand.
10168%
10169%    o orientation: the image orientation type.
10170%
10171*/
10172WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10173  const OrientationType orientation)
10174{
10175  assert(wand != (MagickWand *) NULL);
10176  assert(wand->signature == MagickWandSignature);
10177  if (wand->debug != MagickFalse)
10178    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10179  if (wand->images == (Image *) NULL)
10180    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10181  wand->images->orientation=orientation;
10182  return(MagickTrue);
10183}
10184
10185/*
10186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10187%                                                                             %
10188%                                                                             %
10189%                                                                             %
10190%   M a g i c k S e t I m a g e P a g e                                       %
10191%                                                                             %
10192%                                                                             %
10193%                                                                             %
10194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10195%
10196%  MagickSetImagePage() sets the page geometry of the image.
10197%
10198%  The format of the MagickSetImagePage method is:
10199%
10200%      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
10201%
10202%  A description of each parameter follows:
10203%
10204%    o wand: the magick wand.
10205%
10206%    o width: the page width.
10207%
10208%    o height: the page height.
10209%
10210%    o x: the page x-offset.
10211%
10212%    o y: the page y-offset.
10213%
10214*/
10215WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10216  const size_t width,const size_t height,const ssize_t x,
10217  const ssize_t y)
10218{
10219  assert(wand != (MagickWand *) NULL);
10220  assert(wand->signature == MagickWandSignature);
10221  if (wand->debug != MagickFalse)
10222    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10223  if (wand->images == (Image *) NULL)
10224    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10225  wand->images->page.width=width;
10226  wand->images->page.height=height;
10227  wand->images->page.x=x;
10228  wand->images->page.y=y;
10229  return(MagickTrue);
10230}
10231
10232/*
10233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10234%                                                                             %
10235%                                                                             %
10236%                                                                             %
10237%   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                 %
10238%                                                                             %
10239%                                                                             %
10240%                                                                             %
10241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10242%
10243%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10244%  specified method and returns the previous progress monitor if any.  The
10245%  progress monitor method looks like this:
10246%
10247%    MagickBooleanType MagickProgressMonitor(const char *text,
10248%      const MagickOffsetType offset,const MagickSizeType span,
10249%      void *client_data)
10250%
10251%  If the progress monitor returns MagickFalse, the current operation is
10252%  interrupted.
10253%
10254%  The format of the MagickSetImageProgressMonitor method is:
10255%
10256%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10257%        const MagickProgressMonitor progress_monitor,void *client_data)
10258%
10259%  A description of each parameter follows:
10260%
10261%    o wand: the magick wand.
10262%
10263%    o progress_monitor: Specifies a pointer to a method to monitor progress
10264%      of an image operation.
10265%
10266%    o client_data: Specifies a pointer to any client data.
10267%
10268*/
10269WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10270  const MagickProgressMonitor progress_monitor,void *client_data)
10271{
10272  MagickProgressMonitor
10273    previous_monitor;
10274
10275  assert(wand != (MagickWand *) NULL);
10276  assert(wand->signature == MagickWandSignature);
10277  if (wand->debug != MagickFalse)
10278    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10279  if (wand->images == (Image *) NULL)
10280    {
10281      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10282        "ContainsNoImages","`%s'",wand->name);
10283      return((MagickProgressMonitor) NULL);
10284    }
10285  previous_monitor=SetImageProgressMonitor(wand->images,
10286    progress_monitor,client_data);
10287  return(previous_monitor);
10288}
10289
10290/*
10291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10292%                                                                             %
10293%                                                                             %
10294%                                                                             %
10295%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10296%                                                                             %
10297%                                                                             %
10298%                                                                             %
10299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10300%
10301%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10302%
10303%  The format of the MagickSetImageRedPrimary method is:
10304%
10305%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10306%        const double x,const double y)
10307%
10308%  A description of each parameter follows:
10309%
10310%    o wand: the magick wand.
10311%
10312%    o x: the red primary x-point.
10313%
10314%    o y: the red primary y-point.
10315%
10316*/
10317WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10318  const double x,const double y)
10319{
10320  assert(wand != (MagickWand *) NULL);
10321  assert(wand->signature == MagickWandSignature);
10322  if (wand->debug != MagickFalse)
10323    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10324  if (wand->images == (Image *) NULL)
10325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10326  wand->images->chromaticity.red_primary.x=x;
10327  wand->images->chromaticity.red_primary.y=y;
10328  return(MagickTrue);
10329}
10330
10331/*
10332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10333%                                                                             %
10334%                                                                             %
10335%                                                                             %
10336%   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                 %
10337%                                                                             %
10338%                                                                             %
10339%                                                                             %
10340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10341%
10342%  MagickSetImageRenderingIntent() sets the image rendering intent.
10343%
10344%  The format of the MagickSetImageRenderingIntent method is:
10345%
10346%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10347%        const RenderingIntent rendering_intent)
10348%
10349%  A description of each parameter follows:
10350%
10351%    o wand: the magick wand.
10352%
10353%    o rendering_intent: the image rendering intent: UndefinedIntent,
10354%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10355%
10356*/
10357WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10358  const RenderingIntent rendering_intent)
10359{
10360  assert(wand != (MagickWand *) NULL);
10361  assert(wand->signature == MagickWandSignature);
10362  if (wand->debug != MagickFalse)
10363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10364  if (wand->images == (Image *) NULL)
10365    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10366  wand->images->rendering_intent=rendering_intent;
10367  return(MagickTrue);
10368}
10369
10370/*
10371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10372%                                                                             %
10373%                                                                             %
10374%                                                                             %
10375%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10376%                                                                             %
10377%                                                                             %
10378%                                                                             %
10379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10380%
10381%  MagickSetImageResolution() sets the image resolution.
10382%
10383%  The format of the MagickSetImageResolution method is:
10384%
10385%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10386%        const double x_resolution,const double y_resolution)
10387%
10388%  A description of each parameter follows:
10389%
10390%    o wand: the magick wand.
10391%
10392%    o x_resolution: the image x resolution.
10393%
10394%    o y_resolution: the image y resolution.
10395%
10396*/
10397WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10398  const double x_resolution,const double y_resolution)
10399{
10400  assert(wand != (MagickWand *) NULL);
10401  assert(wand->signature == MagickWandSignature);
10402  if (wand->debug != MagickFalse)
10403    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10404  if (wand->images == (Image *) NULL)
10405    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10406  wand->images->resolution.x=x_resolution;
10407  wand->images->resolution.y=y_resolution;
10408  return(MagickTrue);
10409}
10410
10411/*
10412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413%                                                                             %
10414%                                                                             %
10415%                                                                             %
10416%   M a g i c k S e t I m a g e S c e n e                                     %
10417%                                                                             %
10418%                                                                             %
10419%                                                                             %
10420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10421%
10422%  MagickSetImageScene() sets the image scene.
10423%
10424%  The format of the MagickSetImageScene method is:
10425%
10426%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10427%        const size_t scene)
10428%
10429%  A description of each parameter follows:
10430%
10431%    o wand: the magick wand.
10432%
10433%    o delay: the image scene number.
10434%
10435*/
10436WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10437  const size_t scene)
10438{
10439  assert(wand != (MagickWand *) NULL);
10440  assert(wand->signature == MagickWandSignature);
10441  if (wand->debug != MagickFalse)
10442    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10443  if (wand->images == (Image *) NULL)
10444    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10445  wand->images->scene=scene;
10446  return(MagickTrue);
10447}
10448
10449/*
10450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10451%                                                                             %
10452%                                                                             %
10453%                                                                             %
10454%   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                   %
10455%                                                                             %
10456%                                                                             %
10457%                                                                             %
10458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10459%
10460%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10461%
10462%  The format of the MagickSetImageTicksPerSecond method is:
10463%
10464%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10465%        const ssize_t ticks_per-second)
10466%
10467%  A description of each parameter follows:
10468%
10469%    o wand: the magick wand.
10470%
10471%    o ticks_per_second: the units to use for the image delay.
10472%
10473*/
10474WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10475  const ssize_t ticks_per_second)
10476{
10477  assert(wand != (MagickWand *) NULL);
10478  assert(wand->signature == MagickWandSignature);
10479  if (wand->debug != MagickFalse)
10480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10481  if (wand->images == (Image *) NULL)
10482    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10483  wand->images->ticks_per_second=ticks_per_second;
10484  return(MagickTrue);
10485}
10486
10487/*
10488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10489%                                                                             %
10490%                                                                             %
10491%                                                                             %
10492%   M a g i c k S e t I m a g e T y p e                                       %
10493%                                                                             %
10494%                                                                             %
10495%                                                                             %
10496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10497%
10498%  MagickSetImageType() sets the image type.
10499%
10500%  The format of the MagickSetImageType method is:
10501%
10502%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10503%        const ImageType image_type)
10504%
10505%  A description of each parameter follows:
10506%
10507%    o wand: the magick wand.
10508%
10509%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10510%      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
10511%      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
10512%      or OptimizeType.
10513%
10514*/
10515WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10516  const ImageType image_type)
10517{
10518  assert(wand != (MagickWand *) NULL);
10519  assert(wand->signature == MagickWandSignature);
10520  if (wand->debug != MagickFalse)
10521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10522  if (wand->images == (Image *) NULL)
10523    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10524  return(SetImageType(wand->images,image_type,wand->exception));
10525}
10526
10527/*
10528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10529%                                                                             %
10530%                                                                             %
10531%                                                                             %
10532%   M a g i c k S e t I m a g e U n i t s                                     %
10533%                                                                             %
10534%                                                                             %
10535%                                                                             %
10536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10537%
10538%  MagickSetImageUnits() sets the image units of resolution.
10539%
10540%  The format of the MagickSetImageUnits method is:
10541%
10542%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10543%        const ResolutionType units)
10544%
10545%  A description of each parameter follows:
10546%
10547%    o wand: the magick wand.
10548%
10549%    o units: the image units of resolution : UndefinedResolution,
10550%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10551%
10552*/
10553WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10554  const ResolutionType units)
10555{
10556  assert(wand != (MagickWand *) NULL);
10557  assert(wand->signature == MagickWandSignature);
10558  if (wand->debug != MagickFalse)
10559    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10560  if (wand->images == (Image *) NULL)
10561    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10562  wand->images->units=units;
10563  return(MagickTrue);
10564}
10565
10566/*
10567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10568%                                                                             %
10569%                                                                             %
10570%                                                                             %
10571%   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           %
10572%                                                                             %
10573%                                                                             %
10574%                                                                             %
10575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10576%
10577%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10578%
10579%  The format of the MagickSetImageVirtualPixelMethod method is:
10580%
10581%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10582%        const VirtualPixelMethod method)
10583%
10584%  A description of each parameter follows:
10585%
10586%    o wand: the magick wand.
10587%
10588%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10589%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10590%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10591%
10592*/
10593WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10594  const VirtualPixelMethod method)
10595{
10596  assert(wand != (MagickWand *) NULL);
10597  assert(wand->signature == MagickWandSignature);
10598  if (wand->debug != MagickFalse)
10599    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10600  if (wand->images == (Image *) NULL)
10601    return(UndefinedVirtualPixelMethod);
10602  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10603}
10604
10605/*
10606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10607%                                                                             %
10608%                                                                             %
10609%                                                                             %
10610%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10611%                                                                             %
10612%                                                                             %
10613%                                                                             %
10614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10615%
10616%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10617%
10618%  The format of the MagickSetImageWhitePoint method is:
10619%
10620%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10621%        const double x,const double y)
10622%
10623%  A description of each parameter follows:
10624%
10625%    o wand: the magick wand.
10626%
10627%    o x: the white x-point.
10628%
10629%    o y: the white y-point.
10630%
10631*/
10632WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10633  const double x,const double y)
10634{
10635  assert(wand != (MagickWand *) NULL);
10636  assert(wand->signature == MagickWandSignature);
10637  if (wand->debug != MagickFalse)
10638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10639  if (wand->images == (Image *) NULL)
10640    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10641  wand->images->chromaticity.white_point.x=x;
10642  wand->images->chromaticity.white_point.y=y;
10643  return(MagickTrue);
10644}
10645
10646/*
10647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10648%                                                                             %
10649%                                                                             %
10650%                                                                             %
10651%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10652%                                                                             %
10653%                                                                             %
10654%                                                                             %
10655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10656%
10657%  MagickShadeImage() shines a distant light on an image to create a
10658%  three-dimensional effect. You control the positioning of the light with
10659%  azimuth and elevation; azimuth is measured in degrees off the x axis
10660%  and elevation is measured in pixels above the Z axis.
10661%
10662%  The format of the MagickShadeImage method is:
10663%
10664%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10665%        const MagickBooleanType gray,const double azimuth,
10666%        const double elevation)
10667%
10668%  A description of each parameter follows:
10669%
10670%    o wand: the magick wand.
10671%
10672%    o gray: A value other than zero shades the intensity of each pixel.
10673%
10674%    o azimuth, elevation:  Define the light source direction.
10675%
10676*/
10677WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10678  const MagickBooleanType gray,const double asimuth,const double elevation)
10679{
10680  Image
10681    *shade_image;
10682
10683  assert(wand != (MagickWand *) NULL);
10684  assert(wand->signature == MagickWandSignature);
10685  if (wand->debug != MagickFalse)
10686    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10687  if (wand->images == (Image *) NULL)
10688    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10689  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10690  if (shade_image == (Image *) NULL)
10691    return(MagickFalse);
10692  ReplaceImageInList(&wand->images,shade_image);
10693  return(MagickTrue);
10694}
10695
10696/*
10697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10698%                                                                             %
10699%                                                                             %
10700%                                                                             %
10701%   M a g i c k S h a d o w I m a g e                                         %
10702%                                                                             %
10703%                                                                             %
10704%                                                                             %
10705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10706%
10707%  MagickShadowImage() simulates an image shadow.
10708%
10709%  The format of the MagickShadowImage method is:
10710%
10711%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10712%        const double sigma,const ssize_t x,const ssize_t y)
10713%
10714%  A description of each parameter follows:
10715%
10716%    o wand: the magick wand.
10717%
10718%    o alpha: percentage transparency.
10719%
10720%    o sigma: the standard deviation of the Gaussian, in pixels.
10721%
10722%    o x: the shadow x-offset.
10723%
10724%    o y: the shadow y-offset.
10725%
10726*/
10727WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10728  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10729{
10730  Image
10731    *shadow_image;
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  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10740  if (shadow_image == (Image *) NULL)
10741    return(MagickFalse);
10742  ReplaceImageInList(&wand->images,shadow_image);
10743  return(MagickTrue);
10744}
10745
10746/*
10747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10748%                                                                             %
10749%                                                                             %
10750%                                                                             %
10751%   M a g i c k S h a r p e n I m a g e                                       %
10752%                                                                             %
10753%                                                                             %
10754%                                                                             %
10755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10756%
10757%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10758%  Gaussian operator of the given radius and standard deviation (sigma).
10759%  For reasonable results, the radius should be larger than sigma.  Use a
10760%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10761%
10762%  The format of the MagickSharpenImage method is:
10763%
10764%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10765%        const double radius,const double sigma)
10766%
10767%  A description of each parameter follows:
10768%
10769%    o wand: the magick wand.
10770%
10771%    o radius: the radius of the Gaussian, in pixels, not counting the center
10772%      pixel.
10773%
10774%    o sigma: the standard deviation of the Gaussian, in pixels.
10775%
10776*/
10777WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10778  const double radius,const double sigma)
10779{
10780  Image
10781    *sharp_image;
10782
10783  assert(wand != (MagickWand *) NULL);
10784  assert(wand->signature == MagickWandSignature);
10785  if (wand->debug != MagickFalse)
10786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10787  if (wand->images == (Image *) NULL)
10788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10789  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10790  if (sharp_image == (Image *) NULL)
10791    return(MagickFalse);
10792  ReplaceImageInList(&wand->images,sharp_image);
10793  return(MagickTrue);
10794}
10795
10796/*
10797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10798%                                                                             %
10799%                                                                             %
10800%                                                                             %
10801%   M a g i c k S h a v e I m a g e                                           %
10802%                                                                             %
10803%                                                                             %
10804%                                                                             %
10805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10806%
10807%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10808%  memory necessary for the new Image structure and returns a pointer to the
10809%  new image.
10810%
10811%  The format of the MagickShaveImage method is:
10812%
10813%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10814%        const size_t columns,const size_t rows)
10815%
10816%  A description of each parameter follows:
10817%
10818%    o wand: the magick wand.
10819%
10820%    o columns: the number of columns in the scaled image.
10821%
10822%    o rows: the number of rows in the scaled image.
10823%
10824%
10825*/
10826WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10827  const size_t columns,const size_t rows)
10828{
10829  Image
10830    *shave_image;
10831
10832  RectangleInfo
10833    shave_info;
10834
10835  assert(wand != (MagickWand *) NULL);
10836  assert(wand->signature == MagickWandSignature);
10837  if (wand->debug != MagickFalse)
10838    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10839  if (wand->images == (Image *) NULL)
10840    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10841  shave_info.width=columns;
10842  shave_info.height=rows;
10843  shave_info.x=0;
10844  shave_info.y=0;
10845  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10846  if (shave_image == (Image *) NULL)
10847    return(MagickFalse);
10848  ReplaceImageInList(&wand->images,shave_image);
10849  return(MagickTrue);
10850}
10851
10852/*
10853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10854%                                                                             %
10855%                                                                             %
10856%                                                                             %
10857%   M a g i c k S h e a r I m a g e                                           %
10858%                                                                             %
10859%                                                                             %
10860%                                                                             %
10861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10862%
10863%  MagickShearImage() slides one edge of an image along the X or Y axis,
10864%  creating a parallelogram.  An X direction shear slides an edge along the X
10865%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10866%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10867%  is measured relative to the Y axis, and similarly, for Y direction shears
10868%  y_shear is measured relative to the X axis.  Empty triangles left over from
10869%  shearing the image are filled with the background color.
10870%
10871%  The format of the MagickShearImage method is:
10872%
10873%      MagickBooleanType MagickShearImage(MagickWand *wand,
10874%        const PixelWand *background,const double x_shear,const double y_shear)
10875%
10876%  A description of each parameter follows:
10877%
10878%    o wand: the magick wand.
10879%
10880%    o background: the background pixel wand.
10881%
10882%    o x_shear: the number of degrees to shear the image.
10883%
10884%    o y_shear: the number of degrees to shear the image.
10885%
10886*/
10887WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10888  const PixelWand *background,const double x_shear,const double y_shear)
10889{
10890  Image
10891    *shear_image;
10892
10893  assert(wand != (MagickWand *) NULL);
10894  assert(wand->signature == MagickWandSignature);
10895  if (wand->debug != MagickFalse)
10896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10897  if (wand->images == (Image *) NULL)
10898    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10899  PixelGetQuantumPacket(background,&wand->images->background_color);
10900  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10901  if (shear_image == (Image *) NULL)
10902    return(MagickFalse);
10903  ReplaceImageInList(&wand->images,shear_image);
10904  return(MagickTrue);
10905}
10906
10907/*
10908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10909%                                                                             %
10910%                                                                             %
10911%                                                                             %
10912%   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                   %
10913%                                                                             %
10914%                                                                             %
10915%                                                                             %
10916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10917%
10918%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10919%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10920%  image using a sigmoidal transfer function without saturating highlights or
10921%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10922%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10923%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10924%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10925%  is reduced.
10926%
10927%  The format of the MagickSigmoidalContrastImage method is:
10928%
10929%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10930%        const MagickBooleanType sharpen,const double alpha,const double beta)
10931%
10932%  A description of each parameter follows:
10933%
10934%    o wand: the magick wand.
10935%
10936%    o sharpen: Increase or decrease image contrast.
10937%
10938%    o alpha: strength of the contrast, the larger the number the more
10939%      'threshold-like' it becomes.
10940%
10941%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10942%
10943*/
10944WandExport MagickBooleanType MagickSigmoidalContrastImage(
10945  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10946  const double beta)
10947{
10948  MagickBooleanType
10949    status;
10950
10951  assert(wand != (MagickWand *) NULL);
10952  assert(wand->signature == MagickWandSignature);
10953  if (wand->debug != MagickFalse)
10954    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10955  if (wand->images == (Image *) NULL)
10956    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10957  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10958    wand->exception);
10959  return(status);
10960}
10961
10962/*
10963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10964%                                                                             %
10965%                                                                             %
10966%                                                                             %
10967%   M a g i c k S i m i l a r i t y I m a g e                                 %
10968%                                                                             %
10969%                                                                             %
10970%                                                                             %
10971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10972%
10973%  MagickSimilarityImage() compares the reference image of the image and
10974%  returns the best match offset.  In addition, it returns a similarity image
10975%  such that an exact match location is completely white and if none of the
10976%  pixels match, black, otherwise some gray level in-between.
10977%
10978%  The format of the MagickSimilarityImage method is:
10979%
10980%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10981%        const MagickWand *reference,const MetricType metric,
10982%        const double similarity_threshold,RectangeInfo *offset,
10983%        double *similarity)
10984%
10985%  A description of each parameter follows:
10986%
10987%    o wand: the magick wand.
10988%
10989%    o reference: the reference wand.
10990%
10991%    o metric: the metric.
10992%
10993%    o similarity_threshold: minimum distortion for (sub)image match.
10994%
10995%    o offset: the best match offset of the reference image within the image.
10996%
10997%    o similarity: the computed similarity between the images.
10998%
10999*/
11000WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11001  const MagickWand *reference,const MetricType metric,
11002  const double similarity_threshold,RectangleInfo *offset,double *similarity)
11003{
11004  Image
11005    *similarity_image;
11006
11007  assert(wand != (MagickWand *) NULL);
11008  assert(wand->signature == MagickWandSignature);
11009  if (wand->debug != MagickFalse)
11010    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11011  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11012    {
11013      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11014        "ContainsNoImages","`%s'",wand->name);
11015      return((MagickWand *) NULL);
11016    }
11017  similarity_image=SimilarityImage(wand->images,reference->images,metric,
11018    similarity_threshold,offset,similarity,wand->exception);
11019  if (similarity_image == (Image *) NULL)
11020    return((MagickWand *) NULL);
11021  return(CloneMagickWandFromImages(wand,similarity_image));
11022}
11023
11024/*
11025%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11026%                                                                             %
11027%                                                                             %
11028%                                                                             %
11029%   M a g i c k S k e t c h I m a g e                                         %
11030%                                                                             %
11031%                                                                             %
11032%                                                                             %
11033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11034%
11035%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11036%  a Gaussian operator of the given radius and standard deviation (sigma).
11037%  For reasonable results, radius should be larger than sigma.  Use a
11038%  radius of 0 and SketchImage() selects a suitable radius for you.
11039%  Angle gives the angle of the blurring motion.
11040%
11041%  The format of the MagickSketchImage method is:
11042%
11043%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11044%        const double radius,const double sigma,const double angle)
11045%
11046%  A description of each parameter follows:
11047%
11048%    o wand: the magick wand.
11049%
11050%    o radius: the radius of the Gaussian, in pixels, not counting
11051%      the center pixel.
11052%
11053%    o sigma: the standard deviation of the Gaussian, in pixels.
11054%
11055%    o angle: apply the effect along this angle.
11056%
11057*/
11058WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11059  const double radius,const double sigma,const double angle)
11060{
11061  Image
11062    *sketch_image;
11063
11064  assert(wand != (MagickWand *) NULL);
11065  assert(wand->signature == MagickWandSignature);
11066  if (wand->debug != MagickFalse)
11067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11068  if (wand->images == (Image *) NULL)
11069    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11070  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11071  if (sketch_image == (Image *) NULL)
11072    return(MagickFalse);
11073  ReplaceImageInList(&wand->images,sketch_image);
11074  return(MagickTrue);
11075}
11076
11077/*
11078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11079%                                                                             %
11080%                                                                             %
11081%                                                                             %
11082%   M a g i c k S m u s h I m a g e s                                         %
11083%                                                                             %
11084%                                                                             %
11085%                                                                             %
11086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11087%
11088%  MagickSmushImages() takes all images from the current image pointer to the
11089%  end of the image list and smushs them to each other top-to-bottom if the
11090%  stack parameter is true, otherwise left-to-right.
11091%
11092%  The format of the MagickSmushImages method is:
11093%
11094%      MagickWand *MagickSmushImages(MagickWand *wand,
11095%        const MagickBooleanType stack,const ssize_t offset)
11096%
11097%  A description of each parameter follows:
11098%
11099%    o wand: the magick wand.
11100%
11101%    o stack: By default, images are stacked left-to-right. Set stack to
11102%      MagickTrue to stack them top-to-bottom.
11103%
11104%    o offset: minimum distance in pixels between images.
11105%
11106*/
11107WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11108  const MagickBooleanType stack,const ssize_t offset)
11109{
11110  Image
11111    *smush_image;
11112
11113  assert(wand != (MagickWand *) NULL);
11114  assert(wand->signature == MagickWandSignature);
11115  if (wand->debug != MagickFalse)
11116    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11117  if (wand->images == (Image *) NULL)
11118    return((MagickWand *) NULL);
11119  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11120  if (smush_image == (Image *) NULL)
11121    return((MagickWand *) NULL);
11122  return(CloneMagickWandFromImages(wand,smush_image));
11123}
11124
11125/*
11126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11127%                                                                             %
11128%                                                                             %
11129%                                                                             %
11130%     M a g i c k S o l a r i z e I m a g e                                   %
11131%                                                                             %
11132%                                                                             %
11133%                                                                             %
11134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11135%
11136%  MagickSolarizeImage() applies a special effect to the image, similar to the
11137%  effect achieved in a photo darkroom by selectively exposing areas of photo
11138%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11139%  measure of the extent of the solarization.
11140%
11141%  The format of the MagickSolarizeImage method is:
11142%
11143%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11144%        const double threshold)
11145%
11146%  A description of each parameter follows:
11147%
11148%    o wand: the magick wand.
11149%
11150%    o threshold:  Define the extent of the solarization.
11151%
11152*/
11153WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11154  const double threshold)
11155{
11156  MagickBooleanType
11157    status;
11158
11159  assert(wand != (MagickWand *) NULL);
11160  assert(wand->signature == MagickWandSignature);
11161  if (wand->debug != MagickFalse)
11162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11163  if (wand->images == (Image *) NULL)
11164    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11165  status=SolarizeImage(wand->images,threshold,wand->exception);
11166  return(status);
11167}
11168
11169/*
11170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11171%                                                                             %
11172%                                                                             %
11173%                                                                             %
11174%   M a g i c k S p a r s e C o l o r I m a g e                               %
11175%                                                                             %
11176%                                                                             %
11177%                                                                             %
11178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11179%
11180%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11181%  colors found at those coordinates, across the whole image, using various
11182%  methods.
11183%
11184%  The format of the MagickSparseColorImage method is:
11185%
11186%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11187%        const SparseColorMethod method,const size_t number_arguments,
11188%        const double *arguments)
11189%
11190%  A description of each parameter follows:
11191%
11192%    o image: the image to be sparseed.
11193%
11194%    o method: the method of image sparseion.
11195%
11196%        ArcSparseColorion will always ignore source image offset, and always
11197%        'bestfit' the destination image with the top left corner offset
11198%        relative to the polar mapping center.
11199%
11200%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11201%        style of image sparseion.
11202%
11203%        Affine, Perspective, and Bilinear, will do least squares fitting of
11204%        the distrotion when more than the minimum number of control point
11205%        pairs are provided.
11206%
11207%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11208%        less than 4 control point pairs are provided. While Affine sparseions
11209%        will let you use any number of control point pairs, that is Zero pairs
11210%        is a No-Op (viewport only) distrotion, one pair is a translation and
11211%        two pairs of control points will do a scale-rotate-translate, without
11212%        any shearing.
11213%
11214%    o number_arguments: the number of arguments given for this sparseion
11215%      method.
11216%
11217%    o arguments: the arguments for this sparseion method.
11218%
11219*/
11220WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11221  const SparseColorMethod method,const size_t number_arguments,
11222  const double *arguments)
11223{
11224  Image
11225    *sparse_image;
11226
11227  assert(wand != (MagickWand *) NULL);
11228  assert(wand->signature == MagickWandSignature);
11229  if (wand->debug != MagickFalse)
11230    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11231  if (wand->images == (Image *) NULL)
11232    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11233  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11234    wand->exception);
11235  if (sparse_image == (Image *) NULL)
11236    return(MagickFalse);
11237  ReplaceImageInList(&wand->images,sparse_image);
11238  return(MagickTrue);
11239}
11240
11241/*
11242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11243%                                                                             %
11244%                                                                             %
11245%                                                                             %
11246%   M a g i c k S p l i c e I m a g e                                         %
11247%                                                                             %
11248%                                                                             %
11249%                                                                             %
11250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11251%
11252%  MagickSpliceImage() splices a solid color into the image.
11253%
11254%  The format of the MagickSpliceImage method is:
11255%
11256%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11257%        const size_t width,const size_t height,const ssize_t x,
11258%        const ssize_t y)
11259%
11260%  A description of each parameter follows:
11261%
11262%    o wand: the magick wand.
11263%
11264%    o width: the region width.
11265%
11266%    o height: the region height.
11267%
11268%    o x: the region x offset.
11269%
11270%    o y: the region y offset.
11271%
11272*/
11273WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11274  const size_t width,const size_t height,const ssize_t x,
11275  const ssize_t y)
11276{
11277  Image
11278    *splice_image;
11279
11280  RectangleInfo
11281    splice;
11282
11283  assert(wand != (MagickWand *) NULL);
11284  assert(wand->signature == MagickWandSignature);
11285  if (wand->debug != MagickFalse)
11286    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11287  if (wand->images == (Image *) NULL)
11288    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11289  splice.width=width;
11290  splice.height=height;
11291  splice.x=x;
11292  splice.y=y;
11293  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11294  if (splice_image == (Image *) NULL)
11295    return(MagickFalse);
11296  ReplaceImageInList(&wand->images,splice_image);
11297  return(MagickTrue);
11298}
11299
11300/*
11301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11302%                                                                             %
11303%                                                                             %
11304%                                                                             %
11305%   M a g i c k S p r e a d I m a g e                                         %
11306%                                                                             %
11307%                                                                             %
11308%                                                                             %
11309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11310%
11311%  MagickSpreadImage() is a special effects method that randomly displaces each
11312%  pixel in a block defined by the radius parameter.
11313%
11314%  The format of the MagickSpreadImage method is:
11315%
11316%      MagickBooleanType MagickSpreadImage(MagickWand *wand,
11317%        const PixelInterpolateMethod method,const double radius)
11318%
11319%  A description of each parameter follows:
11320%
11321%    o wand: the magick wand.
11322%
11323%    o method:  intepolation method.
11324%
11325%    o radius:  Choose a random pixel in a neighborhood of this extent.
11326%
11327*/
11328WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11329  const PixelInterpolateMethod method,const double radius)
11330{
11331  Image
11332    *spread_image;
11333
11334  assert(wand != (MagickWand *) NULL);
11335  assert(wand->signature == MagickWandSignature);
11336  if (wand->debug != MagickFalse)
11337    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11338  if (wand->images == (Image *) NULL)
11339    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11340  spread_image=SpreadImage(wand->images,method,radius,wand->exception);
11341  if (spread_image == (Image *) NULL)
11342    return(MagickFalse);
11343  ReplaceImageInList(&wand->images,spread_image);
11344  return(MagickTrue);
11345}
11346
11347/*
11348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11349%                                                                             %
11350%                                                                             %
11351%                                                                             %
11352%   M a g i c k S t a t i s t i c I m a g e                                   %
11353%                                                                             %
11354%                                                                             %
11355%                                                                             %
11356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11357%
11358%  MagickStatisticImage() replace each pixel with corresponding statistic from
11359%  the neighborhood of the specified width and height.
11360%
11361%  The format of the MagickStatisticImage method is:
11362%
11363%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11364%        const StatisticType type,const double width,const size_t height)
11365%
11366%  A description of each parameter follows:
11367%
11368%    o wand: the magick wand.
11369%
11370%    o type: the statistic type (e.g. median, mode, etc.).
11371%
11372%    o width: the width of the pixel neighborhood.
11373%
11374%    o height: the height of the pixel neighborhood.
11375%
11376*/
11377WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11378  const StatisticType type,const size_t width,const size_t height)
11379{
11380  Image
11381    *statistic_image;
11382
11383  assert(wand != (MagickWand *) NULL);
11384  assert(wand->signature == MagickWandSignature);
11385  if (wand->debug != MagickFalse)
11386    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11387  if (wand->images == (Image *) NULL)
11388    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11389  statistic_image=StatisticImage(wand->images,type,width,height,
11390    wand->exception);
11391  if (statistic_image == (Image *) NULL)
11392    return(MagickFalse);
11393  ReplaceImageInList(&wand->images,statistic_image);
11394  return(MagickTrue);
11395}
11396
11397/*
11398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11399%                                                                             %
11400%                                                                             %
11401%                                                                             %
11402%   M a g i c k S t e g a n o I m a g e                                       %
11403%                                                                             %
11404%                                                                             %
11405%                                                                             %
11406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11407%
11408%  MagickSteganoImage() hides a digital watermark within the image.
11409%  Recover the hidden watermark later to prove that the authenticity of
11410%  an image.  Offset defines the start position within the image to hide
11411%  the watermark.
11412%
11413%  The format of the MagickSteganoImage method is:
11414%
11415%      MagickWand *MagickSteganoImage(MagickWand *wand,
11416%        const MagickWand *watermark_wand,const ssize_t offset)
11417%
11418%  A description of each parameter follows:
11419%
11420%    o wand: the magick wand.
11421%
11422%    o watermark_wand: the watermark wand.
11423%
11424%    o offset: Start hiding at this offset into the image.
11425%
11426*/
11427WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11428  const MagickWand *watermark_wand,const ssize_t offset)
11429{
11430  Image
11431    *stegano_image;
11432
11433  assert(wand != (MagickWand *) NULL);
11434  assert(wand->signature == MagickWandSignature);
11435  if (wand->debug != MagickFalse)
11436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11437  if ((wand->images == (Image *) NULL) ||
11438      (watermark_wand->images == (Image *) NULL))
11439    {
11440      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11441        "ContainsNoImages","`%s'",wand->name);
11442      return((MagickWand *) NULL);
11443    }
11444  wand->images->offset=offset;
11445  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11446    wand->exception);
11447  if (stegano_image == (Image *) NULL)
11448    return((MagickWand *) NULL);
11449  return(CloneMagickWandFromImages(wand,stegano_image));
11450}
11451
11452/*
11453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11454%                                                                             %
11455%                                                                             %
11456%                                                                             %
11457%   M a g i c k S t e r e o I m a g e                                         %
11458%                                                                             %
11459%                                                                             %
11460%                                                                             %
11461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11462%
11463%  MagickStereoImage() composites two images and produces a single image that
11464%  is the composite of a left and right image of a stereo pair
11465%
11466%  The format of the MagickStereoImage method is:
11467%
11468%      MagickWand *MagickStereoImage(MagickWand *wand,
11469%        const MagickWand *offset_wand)
11470%
11471%  A description of each parameter follows:
11472%
11473%    o wand: the magick wand.
11474%
11475%    o offset_wand: Another image wand.
11476%
11477*/
11478WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11479  const MagickWand *offset_wand)
11480{
11481  Image
11482    *stereo_image;
11483
11484  assert(wand != (MagickWand *) NULL);
11485  assert(wand->signature == MagickWandSignature);
11486  if (wand->debug != MagickFalse)
11487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11488  if ((wand->images == (Image *) NULL) ||
11489      (offset_wand->images == (Image *) NULL))
11490    {
11491      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11492        "ContainsNoImages","`%s'",wand->name);
11493      return((MagickWand *) NULL);
11494    }
11495  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11496  if (stereo_image == (Image *) NULL)
11497    return((MagickWand *) NULL);
11498  return(CloneMagickWandFromImages(wand,stereo_image));
11499}
11500
11501/*
11502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11503%                                                                             %
11504%                                                                             %
11505%                                                                             %
11506%   M a g i c k S t r i p I m a g e                                           %
11507%                                                                             %
11508%                                                                             %
11509%                                                                             %
11510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11511%
11512%  MagickStripImage() strips an image of all profiles and comments.
11513%
11514%  The format of the MagickStripImage method is:
11515%
11516%      MagickBooleanType MagickStripImage(MagickWand *wand)
11517%
11518%  A description of each parameter follows:
11519%
11520%    o wand: the magick wand.
11521%
11522*/
11523WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11524{
11525  assert(wand != (MagickWand *) NULL);
11526  assert(wand->signature == MagickWandSignature);
11527  if (wand->debug != MagickFalse)
11528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11529  if (wand->images == (Image *) NULL)
11530    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11531  return(StripImage(wand->images,wand->exception));
11532}
11533
11534/*
11535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11536%                                                                             %
11537%                                                                             %
11538%                                                                             %
11539%   M a g i c k S w i r l I m a g e                                           %
11540%                                                                             %
11541%                                                                             %
11542%                                                                             %
11543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11544%
11545%  MagickSwirlImage() swirls the pixels about the center of the image, where
11546%  degrees indicates the sweep of the arc through which each pixel is moved.
11547%  You get a more dramatic effect as the degrees move from 1 to 360.
11548%
11549%  The format of the MagickSwirlImage method is:
11550%
11551%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11552%        const PixelInterpolateMethod method)
11553%
11554%  A description of each parameter follows:
11555%
11556%    o wand: the magick wand.
11557%
11558%    o degrees: Define the tightness of the swirling effect.
11559%
11560%    o method: the pixel interpolation method.
11561%
11562*/
11563WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11564  const double degrees,const PixelInterpolateMethod method)
11565{
11566  Image
11567    *swirl_image;
11568
11569  assert(wand != (MagickWand *) NULL);
11570  assert(wand->signature == MagickWandSignature);
11571  if (wand->debug != MagickFalse)
11572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11573  if (wand->images == (Image *) NULL)
11574    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11575  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11576  if (swirl_image == (Image *) NULL)
11577    return(MagickFalse);
11578  ReplaceImageInList(&wand->images,swirl_image);
11579  return(MagickTrue);
11580}
11581
11582/*
11583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11584%                                                                             %
11585%                                                                             %
11586%                                                                             %
11587%   M a g i c k T e x t u r e I m a g e                                       %
11588%                                                                             %
11589%                                                                             %
11590%                                                                             %
11591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11592%
11593%  MagickTextureImage() repeatedly tiles the texture image across and down the
11594%  image canvas.
11595%
11596%  The format of the MagickTextureImage method is:
11597%
11598%      MagickWand *MagickTextureImage(MagickWand *wand,
11599%        const MagickWand *texture_wand)
11600%
11601%  A description of each parameter follows:
11602%
11603%    o wand: the magick wand.
11604%
11605%    o texture_wand: the texture wand
11606%
11607*/
11608WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11609  const MagickWand *texture_wand)
11610{
11611  Image
11612    *texture_image;
11613
11614  MagickBooleanType
11615    status;
11616
11617  assert(wand != (MagickWand *) NULL);
11618  assert(wand->signature == MagickWandSignature);
11619  if (wand->debug != MagickFalse)
11620    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11621  if ((wand->images == (Image *) NULL) ||
11622      (texture_wand->images == (Image *) NULL))
11623    {
11624      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11625        "ContainsNoImages","`%s'",wand->name);
11626      return((MagickWand *) NULL);
11627    }
11628  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11629  if (texture_image == (Image *) NULL)
11630    return((MagickWand *) NULL);
11631  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11632  if (IfMagickFalse(status))
11633    {
11634      texture_image=DestroyImage(texture_image);
11635      return((MagickWand *) NULL);
11636    }
11637  return(CloneMagickWandFromImages(wand,texture_image));
11638}
11639
11640/*
11641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642%                                                                             %
11643%                                                                             %
11644%                                                                             %
11645%   M a g i c k T h r e s h o l d I m a g e                                   %
11646%                                                                             %
11647%                                                                             %
11648%                                                                             %
11649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11650%
11651%  MagickThresholdImage() changes the value of individual pixels based on
11652%  the intensity of each pixel compared to threshold.  The result is a
11653%  high-contrast, two color image.
11654%
11655%  The format of the MagickThresholdImage method is:
11656%
11657%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11658%        const double threshold)
11659%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11660%        const ChannelType channel,const double threshold)
11661%
11662%  A description of each parameter follows:
11663%
11664%    o wand: the magick wand.
11665%
11666%    o channel: the image channel(s).
11667%
11668%    o threshold: Define the threshold value.
11669%
11670*/
11671WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11672  const double threshold)
11673{
11674  MagickBooleanType
11675    status;
11676
11677  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11678  return(status);
11679}
11680
11681WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11682  const ChannelType channel,const double threshold)
11683{
11684  MagickBooleanType
11685    status;
11686
11687  assert(wand != (MagickWand *) NULL);
11688  assert(wand->signature == MagickWandSignature);
11689  if (wand->debug != MagickFalse)
11690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11691  if (wand->images == (Image *) NULL)
11692    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11693  status=BilevelImage(wand->images,threshold,wand->exception);
11694  return(status);
11695}
11696
11697/*
11698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11699%                                                                             %
11700%                                                                             %
11701%                                                                             %
11702%   M a g i c k T h u m b n a i l I m a g e                                   %
11703%                                                                             %
11704%                                                                             %
11705%                                                                             %
11706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11707%
11708%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11709%  and removes any associated profiles.  The goal is to produce small low cost
11710%  thumbnail images suited for display on the Web.
11711%
11712%  The format of the MagickThumbnailImage method is:
11713%
11714%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11715%        const size_t columns,const size_t rows)
11716%
11717%  A description of each parameter follows:
11718%
11719%    o wand: the magick wand.
11720%
11721%    o columns: the number of columns in the scaled image.
11722%
11723%    o rows: the number of rows in the scaled image.
11724%
11725*/
11726WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11727  const size_t columns,const size_t rows)
11728{
11729  Image
11730    *thumbnail_image;
11731
11732  assert(wand != (MagickWand *) NULL);
11733  assert(wand->signature == MagickWandSignature);
11734  if (wand->debug != MagickFalse)
11735    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11736  if (wand->images == (Image *) NULL)
11737    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11738  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11739  if (thumbnail_image == (Image *) NULL)
11740    return(MagickFalse);
11741  ReplaceImageInList(&wand->images,thumbnail_image);
11742  return(MagickTrue);
11743}
11744
11745/*
11746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11747%                                                                             %
11748%                                                                             %
11749%                                                                             %
11750%   M a g i c k T i n t I m a g e                                             %
11751%                                                                             %
11752%                                                                             %
11753%                                                                             %
11754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11755%
11756%  MagickTintImage() applies a color vector to each pixel in the image.  The
11757%  length of the vector is 0 for black and white and at its maximum for the
11758%  midtones.  The vector weighting function is
11759%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11760%
11761%  The format of the MagickTintImage method is:
11762%
11763%      MagickBooleanType MagickTintImage(MagickWand *wand,
11764%        const PixelWand *tint,const PixelWand *blend)
11765%
11766%  A description of each parameter follows:
11767%
11768%    o wand: the magick wand.
11769%
11770%    o tint: the tint pixel wand.
11771%
11772%    o alpha: the alpha pixel wand.
11773%
11774*/
11775WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11776  const PixelWand *tint,const PixelWand *blend)
11777{
11778  char
11779    percent_blend[MagickPathExtent];
11780
11781  Image
11782    *tint_image;
11783
11784  PixelInfo
11785    target;
11786
11787  assert(wand != (MagickWand *) NULL);
11788  assert(wand->signature == MagickWandSignature);
11789  if (wand->debug != MagickFalse)
11790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11791  if (wand->images == (Image *) NULL)
11792    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11793  if (wand->images->colorspace != CMYKColorspace)
11794    (void) FormatLocaleString(percent_blend,MagickPathExtent,
11795      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11796      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11797      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11798      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11799      PixelGetAlphaQuantum(blend)));
11800  else
11801    (void) FormatLocaleString(percent_blend,MagickPathExtent,
11802      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11803      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11804      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11805      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11806      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11807      PixelGetAlphaQuantum(blend)));
11808  target=PixelGetPixel(tint);
11809  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11810  if (tint_image == (Image *) NULL)
11811    return(MagickFalse);
11812  ReplaceImageInList(&wand->images,tint_image);
11813  return(MagickTrue);
11814}
11815
11816/*
11817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11818%                                                                             %
11819%                                                                             %
11820%                                                                             %
11821%   M a g i c k T r a n s f o r m I m a g e                                   %
11822%                                                                             %
11823%                                                                             %
11824%                                                                             %
11825%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11826%
11827%  MagickTransformImage() is a convenience method that behaves like
11828%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11829%  information as a region geometry specification.  If the operation fails,
11830%  a NULL image handle is returned.
11831%
11832%  The format of the MagickTransformImage method is:
11833%
11834%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11835%        const char *geometry)
11836%
11837%  A description of each parameter follows:
11838%
11839%    o wand: the magick wand.
11840%
11841%    o crop: A crop geometry string.  This geometry defines a subregion of the
11842%      image to crop.
11843%
11844%    o geometry: An image geometry string.  This geometry defines the final
11845%      size of the image.
11846%
11847*/
11848WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11849  const char *crop,const char *geometry)
11850{
11851  Image
11852    *transform_image;
11853
11854  MagickBooleanType
11855    status;
11856
11857  assert(wand != (MagickWand *) NULL);
11858  assert(wand->signature == MagickWandSignature);
11859  if (wand->debug != MagickFalse)
11860    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11861  if (wand->images == (Image *) NULL)
11862    return((MagickWand *) NULL);
11863  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11864  if (transform_image == (Image *) NULL)
11865    return((MagickWand *) NULL);
11866  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11867  if (IfMagickFalse(status))
11868    {
11869      transform_image=DestroyImage(transform_image);
11870      return((MagickWand *) NULL);
11871    }
11872  return(CloneMagickWandFromImages(wand,transform_image));
11873}
11874
11875/*
11876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11877%                                                                             %
11878%                                                                             %
11879%                                                                             %
11880%   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               %
11881%                                                                             %
11882%                                                                             %
11883%                                                                             %
11884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11885%
11886%  MagickTransformImageColorspace() transform the image colorspace, setting
11887%  the images colorspace while transforming the images data to that
11888%  colorspace.
11889%
11890%  The format of the MagickTransformImageColorspace method is:
11891%
11892%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11893%        const ColorspaceType colorspace)
11894%
11895%  A description of each parameter follows:
11896%
11897%    o wand: the magick wand.
11898%
11899%    o colorspace: the image colorspace:   UndefinedColorspace,
11900%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11901%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11902%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11903%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11904%      HSLColorspace, HWBColorspace.
11905%
11906*/
11907WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11908  const ColorspaceType colorspace)
11909{
11910  assert(wand != (MagickWand *) NULL);
11911  assert(wand->signature == MagickWandSignature);
11912  if (wand->debug != MagickFalse)
11913    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11914  if (wand->images == (Image *) NULL)
11915    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11916  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11917}
11918
11919/*
11920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11921%                                                                             %
11922%                                                                             %
11923%                                                                             %
11924%   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                     %
11925%                                                                             %
11926%                                                                             %
11927%                                                                             %
11928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11929%
11930%  MagickTransparentPaintImage() changes any pixel that matches color with the
11931%  color defined by fill.
11932%
11933%  The format of the MagickTransparentPaintImage method is:
11934%
11935%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11936%        const PixelWand *target,const double alpha,const double fuzz,
11937%        const MagickBooleanType invert)
11938%
11939%  A description of each parameter follows:
11940%
11941%    o wand: the magick wand.
11942%
11943%    o target: Change this target color to specified alpha value within
11944%      the image.
11945%
11946%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11947%      transparent.
11948%
11949%    o fuzz: By default target must match a particular pixel color
11950%      exactly.  However, in many cases two colors may differ by a small amount.
11951%      The fuzz member of image defines how much tolerance is acceptable to
11952%      consider two colors as the same.  For example, set fuzz to 10 and the
11953%      color red at intensities of 100 and 102 respectively are now interpreted
11954%      as the same color for the purposes of the floodfill.
11955%
11956%    o invert: paint any pixel that does not match the target color.
11957%
11958*/
11959WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11960  const PixelWand *target,const double alpha,const double fuzz,
11961  const MagickBooleanType invert)
11962{
11963  MagickBooleanType
11964    status;
11965
11966  PixelInfo
11967    target_pixel;
11968
11969  assert(wand != (MagickWand *) NULL);
11970  assert(wand->signature == MagickWandSignature);
11971  if (wand->debug != MagickFalse)
11972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11973  if (wand->images == (Image *) NULL)
11974    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11975  PixelGetMagickColor(target,&target_pixel);
11976  wand->images->fuzz=fuzz;
11977  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11978    QuantumRange*alpha),invert,wand->exception);
11979  return(status);
11980}
11981
11982/*
11983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11984%                                                                             %
11985%                                                                             %
11986%                                                                             %
11987%   M a g i c k T r a n s p o s e I m a g e                                   %
11988%                                                                             %
11989%                                                                             %
11990%                                                                             %
11991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11992%
11993%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11994%  pixels around the central x-axis while rotating them 90-degrees.
11995%
11996%  The format of the MagickTransposeImage method is:
11997%
11998%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11999%
12000%  A description of each parameter follows:
12001%
12002%    o wand: the magick wand.
12003%
12004*/
12005WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12006{
12007  Image
12008    *transpose_image;
12009
12010  assert(wand != (MagickWand *) NULL);
12011  assert(wand->signature == MagickWandSignature);
12012  if (wand->debug != MagickFalse)
12013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12014  if (wand->images == (Image *) NULL)
12015    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12016  transpose_image=TransposeImage(wand->images,wand->exception);
12017  if (transpose_image == (Image *) NULL)
12018    return(MagickFalse);
12019  ReplaceImageInList(&wand->images,transpose_image);
12020  return(MagickTrue);
12021}
12022
12023/*
12024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12025%                                                                             %
12026%                                                                             %
12027%                                                                             %
12028%   M a g i c k T r a n s v e r s e I m a g e                                 %
12029%                                                                             %
12030%                                                                             %
12031%                                                                             %
12032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12033%
12034%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12035%  pixels around the central y-axis while rotating them 270-degrees.
12036%
12037%  The format of the MagickTransverseImage method is:
12038%
12039%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12040%
12041%  A description of each parameter follows:
12042%
12043%    o wand: the magick wand.
12044%
12045*/
12046WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12047{
12048  Image
12049    *transverse_image;
12050
12051  assert(wand != (MagickWand *) NULL);
12052  assert(wand->signature == MagickWandSignature);
12053  if (wand->debug != MagickFalse)
12054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12055  if (wand->images == (Image *) NULL)
12056    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12057  transverse_image=TransverseImage(wand->images,wand->exception);
12058  if (transverse_image == (Image *) NULL)
12059    return(MagickFalse);
12060  ReplaceImageInList(&wand->images,transverse_image);
12061  return(MagickTrue);
12062}
12063
12064/*
12065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12066%                                                                             %
12067%                                                                             %
12068%                                                                             %
12069%   M a g i c k T r i m I m a g e                                             %
12070%                                                                             %
12071%                                                                             %
12072%                                                                             %
12073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12074%
12075%  MagickTrimImage() remove edges that are the background color from the image.
12076%
12077%  The format of the MagickTrimImage method is:
12078%
12079%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12080%
12081%  A description of each parameter follows:
12082%
12083%    o wand: the magick wand.
12084%
12085%    o fuzz: By default target must match a particular pixel color
12086%      exactly.  However, in many cases two colors may differ by a small amount.
12087%      The fuzz member of image defines how much tolerance is acceptable to
12088%      consider two colors as the same.  For example, set fuzz to 10 and the
12089%      color red at intensities of 100 and 102 respectively are now interpreted
12090%      as the same color for the purposes of the floodfill.
12091%
12092*/
12093WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12094{
12095  Image
12096    *trim_image;
12097
12098  assert(wand != (MagickWand *) NULL);
12099  assert(wand->signature == MagickWandSignature);
12100  if (wand->debug != MagickFalse)
12101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12102  if (wand->images == (Image *) NULL)
12103    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12104  wand->images->fuzz=fuzz;
12105  trim_image=TrimImage(wand->images,wand->exception);
12106  if (trim_image == (Image *) NULL)
12107    return(MagickFalse);
12108  ReplaceImageInList(&wand->images,trim_image);
12109  return(MagickTrue);
12110}
12111
12112/*
12113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12114%                                                                             %
12115%                                                                             %
12116%                                                                             %
12117%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12118%                                                                             %
12119%                                                                             %
12120%                                                                             %
12121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12122%
12123%  MagickUniqueImageColors() discards all but one of any pixel color.
12124%
12125%  The format of the MagickUniqueImageColors method is:
12126%
12127%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12128%
12129%  A description of each parameter follows:
12130%
12131%    o wand: the magick wand.
12132%
12133*/
12134WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12135{
12136  Image
12137    *unique_image;
12138
12139  assert(wand != (MagickWand *) NULL);
12140  assert(wand->signature == MagickWandSignature);
12141  if (wand->debug != MagickFalse)
12142    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12143  if (wand->images == (Image *) NULL)
12144    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12145  unique_image=UniqueImageColors(wand->images,wand->exception);
12146  if (unique_image == (Image *) NULL)
12147    return(MagickFalse);
12148  ReplaceImageInList(&wand->images,unique_image);
12149  return(MagickTrue);
12150}
12151
12152/*
12153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12154%                                                                             %
12155%                                                                             %
12156%                                                                             %
12157%   M a g i c k U n s h a r p M a s k I m a g e                               %
12158%                                                                             %
12159%                                                                             %
12160%                                                                             %
12161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12162%
12163%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12164%  Gaussian operator of the given radius and standard deviation (sigma).
12165%  For reasonable results, radius should be larger than sigma.  Use a radius
12166%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12167%
12168%  The format of the MagickUnsharpMaskImage method is:
12169%
12170%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12171%        const double radius,const double sigma,const double gain,
12172%        const double threshold)
12173%
12174%  A description of each parameter follows:
12175%
12176%    o wand: the magick wand.
12177%
12178%    o radius: the radius of the Gaussian, in pixels, not counting the center
12179%      pixel.
12180%
12181%    o sigma: the standard deviation of the Gaussian, in pixels.
12182%
12183%    o gain: the percentage of the difference between the original and the
12184%      blur image that is added back into the original.
12185%
12186%    o threshold: the threshold in pixels needed to apply the diffence gain.
12187%
12188*/
12189WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12190  const double radius,const double sigma,const double gain,
12191  const double threshold)
12192{
12193  Image
12194    *unsharp_image;
12195
12196  assert(wand != (MagickWand *) NULL);
12197  assert(wand->signature == MagickWandSignature);
12198  if (wand->debug != MagickFalse)
12199    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12200  if (wand->images == (Image *) NULL)
12201    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12202  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
12203    wand->exception);
12204  if (unsharp_image == (Image *) NULL)
12205    return(MagickFalse);
12206  ReplaceImageInList(&wand->images,unsharp_image);
12207  return(MagickTrue);
12208}
12209
12210/*
12211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12212%                                                                             %
12213%                                                                             %
12214%                                                                             %
12215%   M a g i c k V i g n e t t e I m a g e                                     %
12216%                                                                             %
12217%                                                                             %
12218%                                                                             %
12219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12220%
12221%  MagickVignetteImage() softens the edges of the image in vignette style.
12222%
12223%  The format of the MagickVignetteImage method is:
12224%
12225%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12226%        const double radius,const double sigma,const ssize_t x,
12227%        const ssize_t y)
12228%
12229%  A description of each parameter follows:
12230%
12231%    o wand: the magick wand.
12232%
12233%    o radius: the radius.
12234%
12235%    o sigma: the sigma.
12236%
12237%    o x, y:  Define the x and y ellipse offset.
12238%
12239*/
12240WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12241  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12242{
12243  Image
12244    *vignette_image;
12245
12246  assert(wand != (MagickWand *) NULL);
12247  assert(wand->signature == MagickWandSignature);
12248  if (wand->debug != MagickFalse)
12249    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12250  if (wand->images == (Image *) NULL)
12251    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12252  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12253  if (vignette_image == (Image *) NULL)
12254    return(MagickFalse);
12255  ReplaceImageInList(&wand->images,vignette_image);
12256  return(MagickTrue);
12257}
12258
12259/*
12260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12261%                                                                             %
12262%                                                                             %
12263%                                                                             %
12264%   M a g i c k W a v e I m a g e                                             %
12265%                                                                             %
12266%                                                                             %
12267%                                                                             %
12268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12269%
12270%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12271%  the pixels vertically along a sine wave whose amplitude and wavelength
12272%  is specified by the given parameters.
12273%
12274%  The format of the MagickWaveImage method is:
12275%
12276%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12277%        const double amplitude,const double wave_length,
12278%        const PixelInterpolateMethod method)
12279%
12280%  A description of each parameter follows:
12281%
12282%    o wand: the magick wand.
12283%
12284%    o amplitude, wave_length:  Define the amplitude and wave length of the
12285%      sine wave.
12286%
12287%    o method: the pixel interpolation method.
12288%
12289*/
12290WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12291  const double amplitude,const double wave_length,
12292  const PixelInterpolateMethod method)
12293{
12294  Image
12295    *wave_image;
12296
12297  assert(wand != (MagickWand *) NULL);
12298  assert(wand->signature == MagickWandSignature);
12299  if (wand->debug != MagickFalse)
12300    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12301  if (wand->images == (Image *) NULL)
12302    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12303  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12304    wand->exception);
12305  if (wave_image == (Image *) NULL)
12306    return(MagickFalse);
12307  ReplaceImageInList(&wand->images,wave_image);
12308  return(MagickTrue);
12309}
12310
12311/*
12312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12313%                                                                             %
12314%                                                                             %
12315%                                                                             %
12316%   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                         %
12317%                                                                             %
12318%                                                                             %
12319%                                                                             %
12320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12321%
12322%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12323%  above the threshold into white while leaving all pixels below the threshold
12324%  unchanged.
12325%
12326%  The format of the MagickWhiteThresholdImage method is:
12327%
12328%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12329%        const PixelWand *threshold)
12330%
12331%  A description of each parameter follows:
12332%
12333%    o wand: the magick wand.
12334%
12335%    o threshold: the pixel wand.
12336%
12337*/
12338WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12339  const PixelWand *threshold)
12340{
12341  char
12342    thresholds[MagickPathExtent];
12343
12344  assert(wand != (MagickWand *) NULL);
12345  assert(wand->signature == MagickWandSignature);
12346  if (wand->debug != MagickFalse)
12347    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12348  if (wand->images == (Image *) NULL)
12349    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12350  (void) FormatLocaleString(thresholds,MagickPathExtent,
12351    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12352    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12353    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12354  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12355}
12356
12357/*
12358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12359%                                                                             %
12360%                                                                             %
12361%                                                                             %
12362%   M a g i c k W r i t e I m a g e                                           %
12363%                                                                             %
12364%                                                                             %
12365%                                                                             %
12366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12367%
12368%  MagickWriteImage() writes an image to the specified filename.  If the
12369%  filename parameter is NULL, the image is written to the filename set
12370%  by MagickReadImage() or MagickSetImageFilename().
12371%
12372%  The format of the MagickWriteImage method is:
12373%
12374%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12375%        const char *filename)
12376%
12377%  A description of each parameter follows:
12378%
12379%    o wand: the magick wand.
12380%
12381%    o filename: the image filename.
12382%
12383%
12384*/
12385WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12386  const char *filename)
12387{
12388  Image
12389    *image;
12390
12391  ImageInfo
12392    *write_info;
12393
12394  MagickBooleanType
12395    status;
12396
12397  assert(wand != (MagickWand *) NULL);
12398  assert(wand->signature == MagickWandSignature);
12399  if (wand->debug != MagickFalse)
12400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12401  if (wand->images == (Image *) NULL)
12402    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12403  if (filename != (const char *) NULL)
12404    (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
12405  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12406  if (image == (Image *) NULL)
12407    return(MagickFalse);
12408  write_info=CloneImageInfo(wand->image_info);
12409  write_info->adjoin=MagickTrue;
12410  status=WriteImage(write_info,image,wand->exception);
12411  image=DestroyImage(image);
12412  write_info=DestroyImageInfo(write_info);
12413  return(status);
12414}
12415
12416/*
12417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12418%                                                                             %
12419%                                                                             %
12420%                                                                             %
12421%   M a g i c k W r i t e I m a g e F i l e                                   %
12422%                                                                             %
12423%                                                                             %
12424%                                                                             %
12425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12426%
12427%  MagickWriteImageFile() writes an image to an open file descriptor.
12428%
12429%  The format of the MagickWriteImageFile method is:
12430%
12431%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12432%
12433%  A description of each parameter follows:
12434%
12435%    o wand: the magick wand.
12436%
12437%    o file: the file descriptor.
12438%
12439*/
12440WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12441{
12442  Image
12443    *image;
12444
12445  ImageInfo
12446    *write_info;
12447
12448  MagickBooleanType
12449    status;
12450
12451  assert(wand != (MagickWand *) NULL);
12452  assert(wand->signature == MagickWandSignature);
12453  assert(file != (FILE *) NULL);
12454  if (wand->debug != MagickFalse)
12455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12456  if (wand->images == (Image *) NULL)
12457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12458  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12459  if (image == (Image *) NULL)
12460    return(MagickFalse);
12461  write_info=CloneImageInfo(wand->image_info);
12462  SetImageInfoFile(write_info,file);
12463  write_info->adjoin=MagickTrue;
12464  status=WriteImage(write_info,image,wand->exception);
12465  write_info=DestroyImageInfo(write_info);
12466  image=DestroyImage(image);
12467  return(status);
12468}
12469
12470/*
12471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12472%                                                                             %
12473%                                                                             %
12474%                                                                             %
12475%   M a g i c k W r i t e I m a g e s                                         %
12476%                                                                             %
12477%                                                                             %
12478%                                                                             %
12479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12480%
12481%  MagickWriteImages() writes an image or image sequence.
12482%
12483%  The format of the MagickWriteImages method is:
12484%
12485%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12486%        const char *filename,const MagickBooleanType adjoin)
12487%
12488%  A description of each parameter follows:
12489%
12490%    o wand: the magick wand.
12491%
12492%    o filename: the image filename.
12493%
12494%    o adjoin: join images into a single multi-image file.
12495%
12496*/
12497WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12498  const char *filename,const MagickBooleanType adjoin)
12499{
12500  ImageInfo
12501    *write_info;
12502
12503  MagickBooleanType
12504    status;
12505
12506  assert(wand != (MagickWand *) NULL);
12507  assert(wand->signature == MagickWandSignature);
12508  if (wand->debug != MagickFalse)
12509    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12510  if (wand->images == (Image *) NULL)
12511    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12512  write_info=CloneImageInfo(wand->image_info);
12513  write_info->adjoin=adjoin;
12514  status=WriteImages(write_info,wand->images,filename,wand->exception);
12515  write_info=DestroyImageInfo(write_info);
12516  return(status);
12517}
12518
12519/*
12520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12521%                                                                             %
12522%                                                                             %
12523%                                                                             %
12524%   M a g i c k W r i t e I m a g e s F i l e                                 %
12525%                                                                             %
12526%                                                                             %
12527%                                                                             %
12528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12529%
12530%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12531%
12532%  The format of the MagickWriteImagesFile method is:
12533%
12534%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12535%
12536%  A description of each parameter follows:
12537%
12538%    o wand: the magick wand.
12539%
12540%    o file: the file descriptor.
12541%
12542*/
12543WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12544{
12545  ImageInfo
12546    *write_info;
12547
12548  MagickBooleanType
12549    status;
12550
12551  assert(wand != (MagickWand *) NULL);
12552  assert(wand->signature == MagickWandSignature);
12553  if (wand->debug != MagickFalse)
12554    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12555  if (wand->images == (Image *) NULL)
12556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12557  write_info=CloneImageInfo(wand->image_info);
12558  SetImageInfoFile(write_info,file);
12559  write_info->adjoin=MagickTrue;
12560  status=WriteImages(write_info,wand->images,(const char *) NULL,
12561    wand->exception);
12562  write_info=DestroyImageInfo(write_info);
12563  return(status);
12564}
12565