magick-image.c revision 8270b722ebf3396f5428f5988484e6f8922f43ac
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%                                 John Cristy                                 %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2012 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
55/*
56  Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61    tag,"`%s'",context); \
62  return(MagickFalse); \
63}
64#define MagickWandId  "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68%                                                                             %
69%                                                                             %
70%                                                                             %
71+   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                         %
72%                                                                             %
73%                                                                             %
74%                                                                             %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78%  list.
79%
80%  The format of the CloneMagickWandFromImages method is:
81%
82%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83%        Image *images)
84%
85%  A description of each parameter follows:
86%
87%    o wand: the magick wand.
88%
89%    o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93  Image *images)
94{
95  MagickWand
96    *clone_wand;
97
98  assert(wand != (MagickWand *) NULL);
99  assert(wand->signature == WandSignature);
100  if( IfMagickTrue(wand->debug) )
101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102
103  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
104  if (clone_wand == (MagickWand *) NULL)
105    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
106      images->filename);
107  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
108  clone_wand->id=AcquireWandId();
109  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
110    MagickWandId,(double) clone_wand->id);
111  clone_wand->exception=AcquireExceptionInfo();
112  InheritException(clone_wand->exception,wand->exception);
113  clone_wand->image_info=CloneImageInfo(wand->image_info);
114  clone_wand->images=images;
115  clone_wand->debug=IsEventLogging();
116  clone_wand->signature=WandSignature;
117
118  if( IfMagickTrue(clone_wand->debug) )
119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
120  return(clone_wand);
121}
122
123/*
124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125%                                                                             %
126%                                                                             %
127%                                                                             %
128%   G e t I m a g e F r o m M a g i c k W a n d                               %
129%                                                                             %
130%                                                                             %
131%                                                                             %
132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133%
134%  GetImageFromMagickWand() returns the current image from the magick wand.
135%
136%  The format of the GetImageFromMagickWand method is:
137%
138%      Image *GetImageFromMagickWand(const MagickWand *wand)
139%
140%  A description of each parameter follows:
141%
142%    o wand: the magick wand.
143%
144*/
145WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
146{
147  assert(wand != (MagickWand *) NULL);
148  assert(wand->signature == WandSignature);
149  if( IfMagickTrue(wand->debug) )
150    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
151  if (wand->images == (Image *) NULL)
152    {
153      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
154        "ContainsNoImages","`%s'",wand->name);
155      return((Image *) NULL);
156    }
157  return(wand->images);
158}
159
160/*
161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162%                                                                             %
163%                                                                             %
164%                                                                             %
165%   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                       %
166%                                                                             %
167%                                                                             %
168%                                                                             %
169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170%
171%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
172%  less intensely near image edges and more intensely far from edges. We
173%  blur the image with a Gaussian operator of the given radius and standard
174%  deviation (sigma).  For reasonable results, radius should be larger than
175%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
176%  suitable radius for you.
177%
178%  The format of the MagickAdaptiveBlurImage method is:
179%
180%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
181%        const double radius,const double sigma)
182%
183%  A description of each parameter follows:
184%
185%    o wand: the magick wand.
186%
187%    o radius: the radius of the Gaussian, in pixels, not counting the center
188%      pixel.
189%
190%    o sigma: the standard deviation of the Gaussian, in pixels.
191%
192*/
193WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
194  const double radius,const double sigma)
195{
196  Image
197    *sharp_image;
198
199  assert(wand != (MagickWand *) NULL);
200  assert(wand->signature == WandSignature);
201  if( IfMagickTrue(wand->debug) )
202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
203
204  if (wand->images == (Image *) NULL)
205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
206  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
207  if (sharp_image == (Image *) NULL)
208    return(MagickFalse);
209  ReplaceImageInList(&wand->images,sharp_image);
210  return(MagickTrue);
211}
212
213/*
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%                                                                             %
216%                                                                             %
217%                                                                             %
218%   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                         %
219%                                                                             %
220%                                                                             %
221%                                                                             %
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223%
224%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225%  triangulation.
226%
227%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228%        const size_t columns,const size_t rows)
229%
230%  A description of each parameter follows:
231%
232%    o wand: the magick wand.
233%
234%    o columns: the number of columns in the scaled image.
235%
236%    o rows: the number of rows in the scaled image.
237%
238*/
239WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
240  const size_t columns,const size_t rows)
241{
242  Image
243    *resize_image;
244
245  assert(wand != (MagickWand *) NULL);
246  assert(wand->signature == WandSignature);
247  if( IfMagickTrue(wand->debug) )
248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
249
250  if (wand->images == (Image *) NULL)
251    ThrowWandException(WandError,"ContainsNoImages",wand->name);
252  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
253  if (resize_image == (Image *) NULL)
254    return(MagickFalse);
255  ReplaceImageInList(&wand->images,resize_image);
256  return(MagickTrue);
257}
258
259/*
260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261%                                                                             %
262%                                                                             %
263%                                                                             %
264%   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                       %
265%                                                                             %
266%                                                                             %
267%                                                                             %
268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
269%
270%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
271%  more intensely near image edges and less intensely far from edges. We
272%  sharpen the image with a Gaussian operator of the given radius and standard
273%  deviation (sigma).  For reasonable results, radius should be larger than
274%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
275%  suitable radius for you.
276%
277%  The format of the MagickAdaptiveSharpenImage method is:
278%
279%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
280%        const double radius,const double sigma)
281%
282%  A description of each parameter follows:
283%
284%    o wand: the magick wand.
285%
286%    o radius: the radius of the Gaussian, in pixels, not counting the center
287%      pixel.
288%
289%    o sigma: the standard deviation of the Gaussian, in pixels.
290%
291*/
292WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293  const double radius,const double sigma)
294{
295  Image
296    *sharp_image;
297
298  assert(wand != (MagickWand *) NULL);
299  assert(wand->signature == WandSignature);
300  if( IfMagickTrue(wand->debug) )
301    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
302
303  if (wand->images == (Image *) NULL)
304    ThrowWandException(WandError,"ContainsNoImages",wand->name);
305  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
306  if (sharp_image == (Image *) NULL)
307    return(MagickFalse);
308  ReplaceImageInList(&wand->images,sharp_image);
309  return(MagickTrue);
310}
311
312/*
313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314%                                                                             %
315%                                                                             %
316%                                                                             %
317%   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                   %
318%                                                                             %
319%                                                                             %
320%                                                                             %
321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322%
323%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
324%  based on the range of intensity values in its local neighborhood.  This
325%  allows for thresholding of an image whose global intensity histogram
326%  doesn't contain distinctive peaks.
327%
328%  The format of the AdaptiveThresholdImage method is:
329%
330%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
331%        const size_t width,const size_t height,const double bias)
332%
333%  A description of each parameter follows:
334%
335%    o wand: the magick wand.
336%
337%    o width: the width of the local neighborhood.
338%
339%    o height: the height of the local neighborhood.
340%
341%    o offset: the mean bias.
342%
343*/
344WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
345  const size_t width,const size_t height,const double bias)
346{
347  Image
348    *threshold_image;
349
350  assert(wand != (MagickWand *) NULL);
351  assert(wand->signature == WandSignature);
352  if( IfMagickTrue(wand->debug) )
353    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
354
355  if (wand->images == (Image *) NULL)
356    ThrowWandException(WandError,"ContainsNoImages",wand->name);
357  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
358    wand->exception);
359  if (threshold_image == (Image *) NULL)
360    return(MagickFalse);
361  ReplaceImageInList(&wand->images,threshold_image);
362  return(MagickTrue);
363}
364
365/*
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367%                                                                             %
368%                                                                             %
369%                                                                             %
370%   M a g i c k A d d I m a g e                                               %
371%                                                                             %
372%                                                                             %
373%                                                                             %
374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375%
376%  MagickAddImage() adds a clone of the images from the second wand and
377%  inserts them into the first wand.
378%
379%  Use MagickSetLastIterator(), to append new images into an existing wand,
380%  current image will be set to last image so later adds with also be
381%  appened to end of wand.
382%
383%  Use MagickSetFirstIterator() to prepend new images into wand, any more
384%  images added will also be prepended before other images in the wand.
385%  However the order of a list of new images will not change.
386%
387%  Otherwise the new images will be inserted just after the current image,
388%  and any later image will also be added after this current image but
389%  before the previously added images.  Caution is advised when multiple
390%  image adds are inserted into the middle of the wand image list.
391%
392%  The format of the MagickAddImage method is:
393%
394%      MagickBooleanType MagickAddImage(MagickWand *wand,
395%        const MagickWand *add_wand)
396%
397%  A description of each parameter follows:
398%
399%    o wand: the magick wand.
400%
401%    o add_wand: A wand that contains the image list to be added
402%
403*/
404static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
405  Image *images)
406{
407  /* if no images in wand, just add them, set current as appropriate */
408  if (wand->images == (Image *) NULL)
409    {
410      if( IfMagickTrue(wand->insert_before) )
411        wand->images=GetFirstImageInList(images);
412      else
413        wand->images=GetLastImageInList(images);
414      return(MagickTrue);
415    }
416
417  /* user jumped to first image, so prepend new images - remain active */
418  if( IfMagickTrue((wand->insert_before) ) &&
419       (wand->images->previous == (Image *) NULL) )
420    {
421      PrependImageToList(&wand->images,images);
422      wand->images=GetFirstImageInList(images);
423      return(MagickTrue);
424    }
425  /* Note you should never have 'insert_before' true when current image
426     is not the first image in the wand!  That is no insert before
427     current image, only after current image */
428
429  /* if at last image append new images */
430  if (wand->images->next == (Image *) NULL)
431    {
432      InsertImageInList(&wand->images,images);
433      wand->images=GetLastImageInList(images);
434      return(MagickTrue);
435    }
436  /* otherwise insert new images, just after the current image */
437  InsertImageInList(&wand->images,images);
438  return(MagickTrue);
439}
440
441WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
442  const MagickWand *add_wand)
443{
444  Image
445    *images;
446
447  assert(wand != (MagickWand *) NULL);
448  assert(wand->signature == WandSignature);
449  if( IfMagickTrue(wand->debug) )
450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
451
452  assert(add_wand != (MagickWand *) NULL);
453  assert(add_wand->signature == WandSignature);
454  if (add_wand->images == (Image *) NULL)
455    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
456
457  /* clone images in second wand, and insert into first */
458  images=CloneImageList(add_wand->images,wand->exception);
459  if (images == (Image *) NULL)
460    return(MagickFalse);
461  return(InsertImageInWand(wand,images));
462}
463
464/*
465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466%                                                                             %
467%                                                                             %
468%                                                                             %
469%     M a g i c k A d d N o i s e I m a g e                                   %
470%                                                                             %
471%                                                                             %
472%                                                                             %
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474%
475%  MagickAddNoiseImage() adds random noise to the image.
476%
477%  The format of the MagickAddNoiseImage method is:
478%
479%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
480%        const NoiseType noise_type,const double attenuate)
481%
482%  A description of each parameter follows:
483%
484%    o wand: the magick wand.
485%
486%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
487%      Impulse, Laplacian, or Poisson.
488%
489%    o attenuate:  attenuate the random distribution.
490%
491*/
492WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
493  const NoiseType noise_type,const double attenuate)
494{
495  Image
496    *noise_image;
497
498  assert(wand != (MagickWand *) NULL);
499  assert(wand->signature == WandSignature);
500  if( IfMagickTrue(wand->debug) )
501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
502
503  if (wand->images == (Image *) NULL)
504    ThrowWandException(WandError,"ContainsNoImages",wand->name);
505  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
506  if (noise_image == (Image *) NULL)
507    return(MagickFalse);
508  ReplaceImageInList(&wand->images,noise_image);
509  return(MagickTrue);
510}
511
512/*
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514%                                                                             %
515%                                                                             %
516%                                                                             %
517%   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                       %
518%                                                                             %
519%                                                                             %
520%                                                                             %
521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
522%
523%  MagickAffineTransformImage() transforms an image as dictated by the affine
524%  matrix of the drawing wand.
525%
526%  The format of the MagickAffineTransformImage method is:
527%
528%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
529%        const DrawingWand *drawing_wand)
530%
531%  A description of each parameter follows:
532%
533%    o wand: the magick wand.
534%
535%    o drawing_wand: the draw wand.
536%
537*/
538WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
539  const DrawingWand *drawing_wand)
540{
541  DrawInfo
542    *draw_info;
543
544  Image
545    *affine_image;
546
547  assert(wand != (MagickWand *) NULL);
548  assert(wand->signature == WandSignature);
549  if( IfMagickTrue(wand->debug) )
550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
551
552  if (wand->images == (Image *) NULL)
553    ThrowWandException(WandError,"ContainsNoImages",wand->name);
554  draw_info=PeekDrawingWand(drawing_wand);
555  if (draw_info == (DrawInfo *) NULL)
556    return(MagickFalse);
557  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
558    wand->exception);
559  draw_info=DestroyDrawInfo(draw_info);
560  if (affine_image == (Image *) NULL)
561    return(MagickFalse);
562  ReplaceImageInList(&wand->images,affine_image);
563  return(MagickTrue);
564}
565
566/*
567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568%                                                                             %
569%                                                                             %
570%                                                                             %
571%   M a g i c k A n n o t a t e I m a g e                                     %
572%                                                                             %
573%                                                                             %
574%                                                                             %
575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
576%
577%  MagickAnnotateImage() annotates an image with text.
578%
579%  The format of the MagickAnnotateImage method is:
580%
581%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
582%        const DrawingWand *drawing_wand,const double x,const double y,
583%        const double angle,const char *text)
584%
585%  A description of each parameter follows:
586%
587%    o wand: the magick wand.
588%
589%    o drawing_wand: the draw wand.
590%
591%    o x: x ordinate to left of text
592%
593%    o y: y ordinate to text baseline
594%
595%    o angle: rotate text relative to this angle.
596%
597%    o text: text to draw
598%
599*/
600WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
601  const DrawingWand *drawing_wand,const double x,const double y,
602  const double angle,const char *text)
603{
604  char
605    geometry[MaxTextExtent];
606
607  DrawInfo
608    *draw_info;
609
610  MagickBooleanType
611    status;
612
613  assert(wand != (MagickWand *) NULL);
614  assert(wand->signature == WandSignature);
615  if( IfMagickTrue(wand->debug) )
616    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
617
618  if (wand->images == (Image *) NULL)
619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
620  draw_info=PeekDrawingWand(drawing_wand);
621  if (draw_info == (DrawInfo *) NULL)
622    return(MagickFalse);
623  (void) CloneString(&draw_info->text,text);
624  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
625  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
626  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
627  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
628  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
629  (void) CloneString(&draw_info->geometry,geometry);
630  status=AnnotateImage(wand->images,draw_info,wand->exception);
631  draw_info=DestroyDrawInfo(draw_info);
632  return(status);
633}
634
635/*
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%                                                                             %
638%                                                                             %
639%                                                                             %
640%   M a g i c k A n i m a t e I m a g e s                                     %
641%                                                                             %
642%                                                                             %
643%                                                                             %
644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
645%
646%  MagickAnimateImages() animates an image or image sequence.
647%
648%  The format of the MagickAnimateImages method is:
649%
650%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
651%        const char *server_name)
652%
653%  A description of each parameter follows:
654%
655%    o wand: the magick wand.
656%
657%    o server_name: the X server name.
658%
659*/
660WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
661  const char *server_name)
662{
663  MagickBooleanType
664    status;
665
666  assert(wand != (MagickWand *) NULL);
667  assert(wand->signature == WandSignature);
668  if( IfMagickTrue(wand->debug) )
669    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
670
671  (void) CloneString(&wand->image_info->server_name,server_name);
672  status=AnimateImages(wand->image_info,wand->images,wand->exception);
673  return(status);
674}
675
676/*
677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678%                                                                             %
679%                                                                             %
680%                                                                             %
681%   M a g i c k A p p e n d I m a g e s                                       %
682%                                                                             %
683%                                                                             %
684%                                                                             %
685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
686%
687%  MagickAppendImages() append the images in a wand from the current image
688%  onwards, creating a new wand with the single image result.  This is
689%  affected by the gravity and background settings of the first image.
690%
691%  Typically you would call either MagickResetIterator() or
692%  MagickSetFirstImage() before calling this function to ensure that all
693%  the images in the wand's image list will be appended together.
694%
695%  The format of the MagickAppendImages method is:
696%
697%      MagickWand *MagickAppendImages(MagickWand *wand,
698%        const MagickBooleanType stack)
699%
700%  A description of each parameter follows:
701%
702%    o wand: the magick wand.
703%
704%    o stack: By default, images are stacked left-to-right. Set stack to
705%      MagickTrue to stack them top-to-bottom.
706%
707*/
708WandExport MagickWand *MagickAppendImages(MagickWand *wand,
709  const MagickBooleanType stack)
710{
711  Image
712    *append_image;
713
714  assert(wand != (MagickWand *) NULL);
715  assert(wand->signature == WandSignature);
716  if( IfMagickTrue(wand->debug) )
717    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
718
719  if (wand->images == (Image *) NULL)
720    return((MagickWand *) NULL);
721  append_image=AppendImages(wand->images,stack,wand->exception);
722  if (append_image == (Image *) NULL)
723    return((MagickWand *) NULL);
724  return(CloneMagickWandFromImages(wand,append_image));
725}
726
727/*
728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
729%                                                                             %
730%                                                                             %
731%                                                                             %
732%   M a g i c k A u t o G a m m a I m a g e                                   %
733%                                                                             %
734%                                                                             %
735%                                                                             %
736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
737%
738%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
739%  image to try make set its gamma appropriatally.
740%
741%  The format of the MagickAutoGammaImage method is:
742%
743%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
744%
745%  A description of each parameter follows:
746%
747%    o wand: the magick wand.
748%
749*/
750WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
751{
752  MagickBooleanType
753    status;
754
755  assert(wand != (MagickWand *) NULL);
756  assert(wand->signature == WandSignature);
757  if( IfMagickTrue(wand->debug) )
758    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
759
760  if (wand->images == (Image *) NULL)
761    ThrowWandException(WandError,"ContainsNoImages",wand->name);
762  status=AutoGammaImage(wand->images,wand->exception);
763  return(status);
764}
765
766/*
767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
768%                                                                             %
769%                                                                             %
770%                                                                             %
771%   M a g i c k A u t o L e v e l I m a g e                                   %
772%                                                                             %
773%                                                                             %
774%                                                                             %
775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776%
777%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
778%  scaling the minimum and maximum values to the full quantum range.
779%
780%  The format of the MagickAutoLevelImage method is:
781%
782%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
783%
784%  A description of each parameter follows:
785%
786%    o wand: the magick wand.
787%
788*/
789WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
790{
791  MagickBooleanType
792    status;
793
794  assert(wand != (MagickWand *) NULL);
795  assert(wand->signature == WandSignature);
796  if( IfMagickTrue(wand->debug) )
797    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
798
799  if (wand->images == (Image *) NULL)
800    ThrowWandException(WandError,"ContainsNoImages",wand->name);
801  status=AutoLevelImage(wand->images,wand->exception);
802  return(status);
803}
804
805/*
806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
807%                                                                             %
808%                                                                             %
809%                                                                             %
810%   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                         %
811%                                                                             %
812%                                                                             %
813%                                                                             %
814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
815%
816%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
817%  pixels below the threshold into black while leaving all pixels above the
818%  threshold unchanged.
819%
820%  The format of the MagickBlackThresholdImage method is:
821%
822%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
823%        const PixelWand *threshold)
824%
825%  A description of each parameter follows:
826%
827%    o wand: the magick wand.
828%
829%    o threshold: the pixel wand.
830%
831*/
832WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
833  const PixelWand *threshold)
834{
835  char
836    thresholds[MaxTextExtent];
837
838  MagickBooleanType
839    status;
840
841  assert(wand != (MagickWand *) NULL);
842  assert(wand->signature == WandSignature);
843  if( IfMagickTrue(wand->debug) )
844    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
845
846  if (wand->images == (Image *) NULL)
847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
848  (void) FormatLocaleString(thresholds,MaxTextExtent,
849    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
850    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
851    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
852  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
853  return(status);
854}
855
856/*
857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858%                                                                             %
859%                                                                             %
860%                                                                             %
861%   M a g i c k B l u e S h i f t I m a g e                                   %
862%                                                                             %
863%                                                                             %
864%                                                                             %
865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
866%
867%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
868%  nighttime in the moonlight.
869%
870%  The format of the MagickBlueShiftImage method is:
871%
872%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
873%        const double factor)
874%
875%  A description of each parameter follows:
876%
877%    o wand: the magick wand.
878%
879%    o factor: the blue shift factor (default 1.5)
880%
881*/
882WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
883  const double factor)
884{
885  Image
886    *shift_image;
887
888  assert(wand != (MagickWand *) NULL);
889  assert(wand->signature == WandSignature);
890  if( IfMagickTrue(wand->debug) )
891    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
892
893  if (wand->images == (Image *) NULL)
894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
895  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
896  if (shift_image == (Image *) NULL)
897    return(MagickFalse);
898  ReplaceImageInList(&wand->images,shift_image);
899  return(MagickTrue);
900}
901
902/*
903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904%                                                                             %
905%                                                                             %
906%                                                                             %
907%   M a g i c k B l u r I m a g e                                             %
908%                                                                             %
909%                                                                             %
910%                                                                             %
911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912%
913%  MagickBlurImage() blurs an image.  We convolve the image with a
914%  gaussian operator of the given radius and standard deviation (sigma).
915%  For reasonable results, the radius should be larger than sigma.  Use a
916%  radius of 0 and BlurImage() selects a suitable radius for you.
917%
918%  The format of the MagickBlurImage method is:
919%
920%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
921%        const double sigma)
922%
923%  A description of each parameter follows:
924%
925%    o wand: the magick wand.
926%
927%    o radius: the radius of the , in pixels, not counting the center
928%      pixel.
929%
930%    o sigma: the standard deviation of the , in pixels.
931%
932*/
933WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
934  const double radius,const double sigma)
935{
936  Image
937    *blur_image;
938
939  assert(wand != (MagickWand *) NULL);
940  assert(wand->signature == WandSignature);
941  if( IfMagickTrue(wand->debug) )
942    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
943
944  if (wand->images == (Image *) NULL)
945    ThrowWandException(WandError,"ContainsNoImages",wand->name);
946  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
947  if (blur_image == (Image *) NULL)
948    return(MagickFalse);
949  ReplaceImageInList(&wand->images,blur_image);
950  return(MagickTrue);
951}
952
953/*
954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
955%                                                                             %
956%                                                                             %
957%                                                                             %
958%   M a g i c k B o r d e r I m a g e                                         %
959%                                                                             %
960%                                                                             %
961%                                                                             %
962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963%
964%  MagickBorderImage() surrounds the image with a border of the color defined
965%  by the bordercolor pixel wand.
966%
967%  The format of the MagickBorderImage method is:
968%
969%      MagickBooleanType MagickBorderImage(MagickWand *wand,
970%        const PixelWand *bordercolor,const size_t width,
971%        const size_t height,const CompositeOperator compose)
972%
973%  A description of each parameter follows:
974%
975%    o wand: the magick wand.
976%
977%    o bordercolor: the border color pixel wand.
978%
979%    o width: the border width.
980%
981%    o height: the border height.
982%
983%    o compose: the composite operator.
984%
985*/
986WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
987  const PixelWand *bordercolor,const size_t width,const size_t height,
988  const CompositeOperator compose)
989{
990  Image
991    *border_image;
992
993  RectangleInfo
994    border_info;
995
996  assert(wand != (MagickWand *) NULL);
997  assert(wand->signature == WandSignature);
998  if( IfMagickTrue(wand->debug) )
999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1000
1001  if (wand->images == (Image *) NULL)
1002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1003  border_info.width=width;
1004  border_info.height=height;
1005  border_info.x=0;
1006  border_info.y=0;
1007  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1008  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1009  if (border_image == (Image *) NULL)
1010    return(MagickFalse);
1011  ReplaceImageInList(&wand->images,border_image);
1012  return(MagickTrue);
1013}
1014
1015/*
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017%                                                                             %
1018%                                                                             %
1019%                                                                             %
1020%   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   %
1021%                                                                             %
1022%                                                                             %
1023%                                                                             %
1024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025%
1026%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1027%  of an image.  It converts the brightness and contrast parameters into slope
1028%  and intercept and calls a polynomical function to apply to the image.
1029
1030%
1031%  The format of the MagickBrightnessContrastImage method is:
1032%
1033%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1034%        const double brightness,const double contrast)
1035%
1036%  A description of each parameter follows:
1037%
1038%    o wand: the magick wand.
1039%
1040%    o brightness: the brightness percent (-100 .. 100).
1041%
1042%    o contrast: the contrast percent (-100 .. 100).
1043%
1044*/
1045WandExport MagickBooleanType MagickBrightnessContrastImage(
1046  MagickWand *wand,const double brightness,const double contrast)
1047{
1048  MagickBooleanType
1049    status;
1050
1051  assert(wand != (MagickWand *) NULL);
1052  assert(wand->signature == WandSignature);
1053  if( IfMagickTrue(wand->debug) )
1054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1055
1056  if (wand->images == (Image *) NULL)
1057    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1058  status=BrightnessContrastImage(wand->images,brightness,contrast,
1059    wand->exception);
1060  return(status);
1061}
1062
1063/*
1064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1065%                                                                             %
1066%                                                                             %
1067%                                                                             %
1068%   M a g i c k C h a n n e l F x I m a g e                                   %
1069%                                                                             %
1070%                                                                             %
1071%                                                                             %
1072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073%
1074%  MagickChannelFxImage() applies a channel expression to the specified image.
1075%  The expression consists of one or more channels, either mnemonic or numeric
1076%  (e.g. red, 1), separated by actions as follows:
1077%
1078%    <=>     exchange two channels (e.g. red<=>blue)
1079%    =>      transfer a channel to another (e.g. red=>green)
1080%    ,       separate channel operations (e.g. red, green)
1081%    |       read channels from next input image (e.g. red | green)
1082%    ;       write channels to next output image (e.g. red; green; blue)
1083%
1084%  A channel without a operation symbol implies extract. For example, to create
1085%  3 grayscale images from the red, green, and blue channels of an image, use:
1086%
1087%    -channel-fx "red; green; blue"
1088%
1089%  The format of the MagickChannelFxImage method is:
1090%
1091%      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1092%
1093%  A description of each parameter follows:
1094%
1095%    o wand: the magick wand.
1096%
1097%    o expression: the expression.
1098%
1099*/
1100WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1101  const char *expression)
1102{
1103  Image
1104    *fx_image;
1105
1106  assert(wand != (MagickWand *) NULL);
1107  assert(wand->signature == WandSignature);
1108  if( IfMagickTrue(wand->debug) )
1109    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1110
1111  if (wand->images == (Image *) NULL)
1112    return((MagickWand *) NULL);
1113  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1114  if (fx_image == (Image *) NULL)
1115    return((MagickWand *) NULL);
1116  return(CloneMagickWandFromImages(wand,fx_image));
1117}
1118
1119/*
1120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121%                                                                             %
1122%                                                                             %
1123%                                                                             %
1124%   M a g i c k C h a r c o a l I m a g e                                     %
1125%                                                                             %
1126%                                                                             %
1127%                                                                             %
1128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1129%
1130%  MagickCharcoalImage() simulates a charcoal drawing.
1131%
1132%  The format of the MagickCharcoalImage method is:
1133%
1134%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1135%        const double radius,const double sigma)
1136%
1137%  A description of each parameter follows:
1138%
1139%    o wand: the magick wand.
1140%
1141%    o radius: the radius of the Gaussian, in pixels, not counting the center
1142%      pixel.
1143%
1144%    o sigma: the standard deviation of the Gaussian, in pixels.
1145%
1146*/
1147WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1148  const double radius,const double sigma)
1149{
1150  Image
1151    *charcoal_image;
1152
1153  assert(wand != (MagickWand *) NULL);
1154  assert(wand->signature == WandSignature);
1155  if( IfMagickTrue(wand->debug) )
1156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1157
1158  if (wand->images == (Image *) NULL)
1159    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1160  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1161  if (charcoal_image == (Image *) NULL)
1162    return(MagickFalse);
1163  ReplaceImageInList(&wand->images,charcoal_image);
1164  return(MagickTrue);
1165}
1166
1167/*
1168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1169%                                                                             %
1170%                                                                             %
1171%                                                                             %
1172%   M a g i c k C h o p I m a g e                                             %
1173%                                                                             %
1174%                                                                             %
1175%                                                                             %
1176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1177%
1178%  MagickChopImage() removes a region of an image and collapses the image to
1179%  occupy the removed portion
1180%
1181%  The format of the MagickChopImage method is:
1182%
1183%      MagickBooleanType MagickChopImage(MagickWand *wand,
1184%        const size_t width,const size_t height,const ssize_t x,
1185%        const ssize_t y)
1186%
1187%  A description of each parameter follows:
1188%
1189%    o wand: the magick wand.
1190%
1191%    o width: the region width.
1192%
1193%    o height: the region height.
1194%
1195%    o x: the region x offset.
1196%
1197%    o y: the region y offset.
1198%
1199%
1200*/
1201WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1202  const size_t width,const size_t height,const ssize_t x,
1203  const ssize_t y)
1204{
1205  Image
1206    *chop_image;
1207
1208  RectangleInfo
1209    chop;
1210
1211  assert(wand != (MagickWand *) NULL);
1212  assert(wand->signature == WandSignature);
1213  if( IfMagickTrue(wand->debug) )
1214    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1215
1216  if (wand->images == (Image *) NULL)
1217    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1218  chop.width=width;
1219  chop.height=height;
1220  chop.x=x;
1221  chop.y=y;
1222  chop_image=ChopImage(wand->images,&chop,wand->exception);
1223  if (chop_image == (Image *) NULL)
1224    return(MagickFalse);
1225  ReplaceImageInList(&wand->images,chop_image);
1226  return(MagickTrue);
1227}
1228
1229/*
1230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1231%                                                                             %
1232%                                                                             %
1233%                                                                             %
1234%   M a g i c k C l a m p I m a g e                                           %
1235%                                                                             %
1236%                                                                             %
1237%                                                                             %
1238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1239%
1240%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1241%
1242%  The format of the MagickClampImage method is:
1243%
1244%      MagickBooleanType MagickClampImage(MagickWand *wand)
1245%
1246%  A description of each parameter follows:
1247%
1248%    o wand: the magick wand.
1249%
1250%    o channel: the channel.
1251%
1252*/
1253WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1254{
1255  assert(wand != (MagickWand *) NULL);
1256  assert(wand->signature == WandSignature);
1257  if( IfMagickTrue(wand->debug) )
1258    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1259
1260  if (wand->images == (Image *) NULL)
1261    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1262  return(ClampImage(wand->images,wand->exception));
1263}
1264
1265/*
1266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1267%                                                                             %
1268%                                                                             %
1269%                                                                             %
1270%   M a g i c k C l i p I m a g e                                             %
1271%                                                                             %
1272%                                                                             %
1273%                                                                             %
1274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1275%
1276%  MagickClipImage() clips along the first path from the 8BIM profile, if
1277%  present.
1278%
1279%  The format of the MagickClipImage method is:
1280%
1281%      MagickBooleanType MagickClipImage(MagickWand *wand)
1282%
1283%  A description of each parameter follows:
1284%
1285%    o wand: the magick wand.
1286%
1287*/
1288WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1289{
1290  MagickBooleanType
1291    status;
1292
1293  assert(wand != (MagickWand *) NULL);
1294  assert(wand->signature == WandSignature);
1295  if( IfMagickTrue(wand->debug) )
1296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1297
1298  if (wand->images == (Image *) NULL)
1299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1300  status=ClipImage(wand->images,wand->exception);
1301  return(status);
1302}
1303
1304/*
1305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1306%                                                                             %
1307%                                                                             %
1308%                                                                             %
1309%   M a g i c k C l i p I m a g e P a t h                                     %
1310%                                                                             %
1311%                                                                             %
1312%                                                                             %
1313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1314%
1315%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1316%  present. Later operations take effect inside the path.  Id may be a number
1317%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1318%  path.
1319%
1320%  The format of the MagickClipImagePath method is:
1321%
1322%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1323%        const char *pathname,const MagickBooleanType inside)
1324%
1325%  A description of each parameter follows:
1326%
1327%    o wand: the magick wand.
1328%
1329%    o pathname: name of clipping path resource. If name is preceded by #, use
1330%      clipping path numbered by name.
1331%
1332%    o inside: if non-zero, later operations take effect inside clipping path.
1333%      Otherwise later operations take effect outside clipping path.
1334%
1335*/
1336WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1337  const char *pathname,const MagickBooleanType inside)
1338{
1339  MagickBooleanType
1340    status;
1341
1342  assert(wand != (MagickWand *) NULL);
1343  assert(wand->signature == WandSignature);
1344  if( IfMagickTrue(wand->debug) )
1345    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1346
1347  if (wand->images == (Image *) NULL)
1348    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1349  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1350  return(status);
1351}
1352
1353/*
1354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355%                                                                             %
1356%                                                                             %
1357%                                                                             %
1358%   M a g i c k C l u t I m a g e                                             %
1359%                                                                             %
1360%                                                                             %
1361%                                                                             %
1362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363%
1364%  MagickClutImage() replaces colors in the image from a color lookup table.
1365%
1366%  The format of the MagickClutImage method is:
1367%
1368%      MagickBooleanType MagickClutImage(MagickWand *wand,
1369%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1370%
1371%  A description of each parameter follows:
1372%
1373%    o wand: the magick wand.
1374%
1375%    o clut_image: the clut image.
1376%
1377%    o method: the pixel interpolation method.
1378%
1379*/
1380WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1381  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1382{
1383  MagickBooleanType
1384    status;
1385
1386  assert(wand != (MagickWand *) NULL);
1387  assert(wand->signature == WandSignature);
1388  if( IfMagickTrue(wand->debug) )
1389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1390
1391  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1392    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1393  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1394  return(status);
1395}
1396
1397/*
1398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1399%                                                                             %
1400%                                                                             %
1401%                                                                             %
1402%   M a g i c k C o a l e s c e I m a g e s                                   %
1403%                                                                             %
1404%                                                                             %
1405%                                                                             %
1406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1407%
1408%  MagickCoalesceImages() composites a set of images while respecting any page
1409%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1410%  typically start with an image background and each subsequent image
1411%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1412%  where each image in the sequence is the same size as the first and
1413%  composited with the next image in the sequence.
1414%
1415%  The format of the MagickCoalesceImages method is:
1416%
1417%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1418%
1419%  A description of each parameter follows:
1420%
1421%    o wand: the magick wand.
1422%
1423*/
1424WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1425{
1426  Image
1427    *coalesce_image;
1428
1429  assert(wand != (MagickWand *) NULL);
1430  assert(wand->signature == WandSignature);
1431  if( IfMagickTrue(wand->debug) )
1432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1433
1434  if (wand->images == (Image *) NULL)
1435    return((MagickWand *) NULL);
1436  coalesce_image=CoalesceImages(wand->images,wand->exception);
1437  if (coalesce_image == (Image *) NULL)
1438    return((MagickWand *) NULL);
1439  return(CloneMagickWandFromImages(wand,coalesce_image));
1440}
1441
1442/*
1443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1444%                                                                             %
1445%                                                                             %
1446%                                                                             %
1447%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1448%                                                                             %
1449%                                                                             %
1450%                                                                             %
1451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1452%
1453%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1454%  Collection (CCC) file which solely contains one or more color corrections
1455%  and applies the color correction to the image.  Here is a sample CCC file:
1456%
1457%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1458%          <ColorCorrection id="cc03345">
1459%                <SOPNode>
1460%                     <Slope> 0.9 1.2 0.5 </Slope>
1461%                     <Offset> 0.4 -0.5 0.6 </Offset>
1462%                     <Power> 1.0 0.8 1.5 </Power>
1463%                </SOPNode>
1464%                <SATNode>
1465%                     <Saturation> 0.85 </Saturation>
1466%                </SATNode>
1467%          </ColorCorrection>
1468%    </ColorCorrectionCollection>
1469%
1470%  which includes the offset, slope, and power for each of the RGB channels
1471%  as well as the saturation.
1472%
1473%  The format of the MagickColorDecisionListImage method is:
1474%
1475%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1476%        const double gamma)
1477%
1478%  A description of each parameter follows:
1479%
1480%    o wand: the magick wand.
1481%
1482%    o color_correction_collection: the color correction collection in XML.
1483%
1484*/
1485WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1486  const char *color_correction_collection)
1487{
1488  MagickBooleanType
1489    status;
1490
1491  assert(wand != (MagickWand *) NULL);
1492  assert(wand->signature == WandSignature);
1493  if( IfMagickTrue(wand->debug) )
1494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1495
1496  if (wand->images == (Image *) NULL)
1497    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1498  status=ColorDecisionListImage(wand->images,color_correction_collection,
1499    wand->exception);
1500  return(status);
1501}
1502
1503/*
1504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1505%                                                                             %
1506%                                                                             %
1507%                                                                             %
1508%   M a g i c k C o l o r i z e I m a g e                                     %
1509%                                                                             %
1510%                                                                             %
1511%                                                                             %
1512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1513%
1514%  MagickColorizeImage() blends the fill color with each pixel in the image.
1515%
1516%  The format of the MagickColorizeImage method is:
1517%
1518%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1519%        const PixelWand *colorize,const PixelWand *blend)
1520%
1521%  A description of each parameter follows:
1522%
1523%    o wand: the magick wand.
1524%
1525%    o colorize: the colorize pixel wand.
1526%
1527%    o alpha: the alpha pixel wand.
1528%
1529*/
1530WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1531  const PixelWand *colorize,const PixelWand *blend)
1532{
1533  char
1534    percent_blend[MaxTextExtent];
1535
1536  Image
1537    *colorize_image;
1538
1539  PixelInfo
1540    target;
1541
1542  assert(wand != (MagickWand *) NULL);
1543  assert(wand->signature == WandSignature);
1544  if( IfMagickTrue(wand->debug) )
1545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1546
1547  if (wand->images == (Image *) NULL)
1548    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1549  GetPixelInfo(wand->images,&target);
1550  if (target.colorspace != CMYKColorspace)
1551    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1552      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1553      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1554      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1555      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1556      PixelGetAlphaQuantum(blend)));
1557  else
1558    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1559      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1560      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1561      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1562      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1563      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1564      PixelGetAlphaQuantum(blend)));
1565  target=PixelGetPixel(colorize);
1566  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1567    wand->exception);
1568  if (colorize_image == (Image *) NULL)
1569    return(MagickFalse);
1570  ReplaceImageInList(&wand->images,colorize_image);
1571  return(MagickTrue);
1572}
1573
1574/*
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%                                                                             %
1577%                                                                             %
1578%                                                                             %
1579%   M a g i c k C o l o r M a t r i x I m a g e                               %
1580%                                                                             %
1581%                                                                             %
1582%                                                                             %
1583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1584%
1585%  MagickColorMatrixImage() apply color transformation to an image. The method
1586%  permits saturation changes, hue rotation, luminance to alpha, and various
1587%  other effects.  Although variable-sized transformation matrices can be used,
1588%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1589%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1590%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1591%  and offsets are normalized (divide Flash offset by 255).
1592%
1593%  The format of the MagickColorMatrixImage method is:
1594%
1595%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1596%        const KernelInfo *color_matrix)
1597%
1598%  A description of each parameter follows:
1599%
1600%    o wand: the magick wand.
1601%
1602%    o color_matrix:  the color matrix.
1603%
1604*/
1605WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1606  const KernelInfo *color_matrix)
1607{
1608  Image
1609    *color_image;
1610
1611  assert(wand != (MagickWand *) NULL);
1612  assert(wand->signature == WandSignature);
1613  if( IfMagickTrue(wand->debug) )
1614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1615
1616  if (color_matrix == (const KernelInfo *) NULL)
1617    return(MagickFalse);
1618  if (wand->images == (Image *) NULL)
1619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1620  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1621  if (color_image == (Image *) NULL)
1622    return(MagickFalse);
1623  ReplaceImageInList(&wand->images,color_image);
1624  return(MagickTrue);
1625}
1626
1627/*
1628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1629%                                                                             %
1630%                                                                             %
1631%                                                                             %
1632%   M a g i c k C o m b i n e I m a g e s                                     %
1633%                                                                             %
1634%                                                                             %
1635%                                                                             %
1636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1637%
1638%  MagickCombineImages() combines one or more images into a single image.  The
1639%  grayscale value of the pixels of each image in the sequence is assigned in
1640%  order to the specified  hannels of the combined image.   The typical
1641%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1642%
1643%  The format of the MagickCombineImages method is:
1644%
1645%      MagickWand *MagickCombineImages(MagickWand *wand)
1646%
1647%  A description of each parameter follows:
1648%
1649%    o wand: the magick wand.
1650%
1651*/
1652WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1653{
1654  Image
1655    *combine_image;
1656
1657  assert(wand != (MagickWand *) NULL);
1658  assert(wand->signature == WandSignature);
1659  if( IfMagickTrue(wand->debug) )
1660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1661
1662  if (wand->images == (Image *) NULL)
1663    return((MagickWand *) NULL);
1664  combine_image=CombineImages(wand->images,wand->exception);
1665  if (combine_image == (Image *) NULL)
1666    return((MagickWand *) NULL);
1667  return(CloneMagickWandFromImages(wand,combine_image));
1668}
1669
1670/*
1671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1672%                                                                             %
1673%                                                                             %
1674%                                                                             %
1675%   M a g i c k C o m m e n t I m a g e                                       %
1676%                                                                             %
1677%                                                                             %
1678%                                                                             %
1679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1680%
1681%  MagickCommentImage() adds a comment to your image.
1682%
1683%  The format of the MagickCommentImage method is:
1684%
1685%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1686%        const char *comment)
1687%
1688%  A description of each parameter follows:
1689%
1690%    o wand: the magick wand.
1691%
1692%    o comment: the image comment.
1693%
1694*/
1695WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1696  const char *comment)
1697{
1698  MagickBooleanType
1699    status;
1700
1701  assert(wand != (MagickWand *) NULL);
1702  assert(wand->signature == WandSignature);
1703  if( IfMagickTrue(wand->debug) )
1704    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1705
1706  if (wand->images == (Image *) NULL)
1707    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1708  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1709  return(status);
1710}
1711
1712/*
1713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1714%                                                                             %
1715%                                                                             %
1716%                                                                             %
1717%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1718%                                                                             %
1719%                                                                             %
1720%                                                                             %
1721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1722%
1723%  MagickCompareImagesLayers() compares each image with the next in a sequence
1724%  and returns the maximum bounding region of any pixel differences it
1725%  discovers.
1726%
1727%  The format of the MagickCompareImagesLayers method is:
1728%
1729%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1730%        const ImageLayerMethod method)
1731%
1732%  A description of each parameter follows:
1733%
1734%    o wand: the magick wand.
1735%
1736%    o method: the compare method.
1737%
1738*/
1739WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1740  const ImageLayerMethod method)
1741{
1742  Image
1743    *layers_image;
1744
1745  assert(wand != (MagickWand *) NULL);
1746  assert(wand->signature == WandSignature);
1747  if( IfMagickTrue(wand->debug) )
1748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1749
1750  if (wand->images == (Image *) NULL)
1751    return((MagickWand *) NULL);
1752  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1753  if (layers_image == (Image *) NULL)
1754    return((MagickWand *) NULL);
1755  return(CloneMagickWandFromImages(wand,layers_image));
1756}
1757
1758/*
1759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1760%                                                                             %
1761%                                                                             %
1762%                                                                             %
1763%   M a g i c k C o m p a r e I m a g e s                                     %
1764%                                                                             %
1765%                                                                             %
1766%                                                                             %
1767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768%
1769%  MagickCompareImages() compares an image to a reconstructed image and returns
1770%  the specified difference image.
1771%
1772%  The format of the MagickCompareImages method is:
1773%
1774%      MagickWand *MagickCompareImages(MagickWand *wand,
1775%        const MagickWand *reference,const MetricType metric,
1776%        double *distortion)
1777%
1778%  A description of each parameter follows:
1779%
1780%    o wand: the magick wand.
1781%
1782%    o reference: the reference wand.
1783%
1784%    o metric: the metric.
1785%
1786%    o distortion: the computed distortion between the images.
1787%
1788*/
1789WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1790  const MagickWand *reference,const MetricType metric,double *distortion)
1791{
1792  Image
1793    *compare_image;
1794
1795
1796  assert(wand != (MagickWand *) NULL);
1797  assert(wand->signature == WandSignature);
1798  if( IfMagickTrue(wand->debug) )
1799    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1800
1801  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1802    {
1803      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1804        "ContainsNoImages","`%s'",wand->name);
1805      return((MagickWand *) NULL);
1806    }
1807  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1808    wand->exception);
1809  if (compare_image == (Image *) NULL)
1810    return((MagickWand *) NULL);
1811  return(CloneMagickWandFromImages(wand,compare_image));
1812}
1813
1814/*
1815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1816%                                                                             %
1817%                                                                             %
1818%                                                                             %
1819%   M a g i c k C o m p o s i t e I m a g e                                   %
1820%                                                                             %
1821%                                                                             %
1822%                                                                             %
1823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1824%
1825%  MagickCompositeImage() composite one image onto another at the specified
1826%  offset.
1827%
1828%  The format of the MagickCompositeImage method is:
1829%
1830%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1831%        const MagickWand *source_wand,const CompositeOperator compose,
1832%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1833%
1834%  A description of each parameter follows:
1835%
1836%    o wand: the magick wand holding the destination images
1837%
1838%    o source_image: the magick wand holding source image.
1839%
1840%    o compose: This operator affects how the composite is applied to the
1841%      image.  The default is Over.  These are some of the compose methods
1842%      availble.
1843%
1844%        OverCompositeOp       InCompositeOp         OutCompositeOp
1845%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1846%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1847%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1848%        DisplaceCompositeOp
1849%
1850%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1851%
1852%    o x: the column offset of the composited image.
1853%
1854%    o y: the row offset of the composited image.
1855%
1856*/
1857WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1858  const MagickWand *source_wand,const CompositeOperator compose,
1859  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1860{
1861  MagickBooleanType
1862    status;
1863
1864  assert(wand != (MagickWand *) NULL);
1865  assert(wand->signature == WandSignature);
1866  if( IfMagickTrue(wand->debug) )
1867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1868
1869  if ((wand->images == (Image *) NULL) ||
1870      (source_wand->images == (Image *) NULL))
1871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1872  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1873    x,y,wand->exception);
1874  return(status);
1875}
1876
1877/*
1878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1879%                                                                             %
1880%                                                                             %
1881%                                                                             %
1882%   M a g i c k C o m p o s i t e L a y e r s                                 %
1883%                                                                             %
1884%                                                                             %
1885%                                                                             %
1886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1887%
1888%  MagickCompositeLayers() composite the images in the source wand over the
1889%  images in the destination wand in sequence, starting with the current
1890%  image in both lists.
1891%
1892%  Each layer from the two image lists are composted together until the end of
1893%  one of the image lists is reached.  The offset of each composition is also
1894%  adjusted to match the virtual canvas offsets of each layer. As such the
1895%  given offset is relative to the virtual canvas, and not the actual image.
1896%
1897%  Composition uses given x and y offsets, as the 'origin' location of the
1898%  source images virtual canvas (not the real image) allowing you to compose a
1899%  list of 'layer images' into the destiantioni images.  This makes it well
1900%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1901%  Animations' onto a static or other 'Coaleased Animation' destination image
1902%  list.  GIF disposal handling is not looked at.
1903%
1904%  Special case:- If one of the image sequences is the last image (just a
1905%  single image remaining), that image is repeatally composed with all the
1906%  images in the other image list.  Either the source or destination lists may
1907%  be the single image, for this situation.
1908%
1909%  In the case of a single destination image (or last image given), that image
1910%  will ve cloned to match the number of images remaining in the source image
1911%  list.
1912%
1913%  This is equivelent to the "-layer Composite" Shell API operator.
1914%
1915%  The format of the MagickCompositeLayers method is:
1916%
1917%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1918%        const MagickWand *source_wand, const CompositeOperator compose,
1919%        const ssize_t x,const ssize_t y)
1920%
1921%  A description of each parameter follows:
1922%
1923%    o wand: the magick wand holding destaintion images
1924%
1925%    o source_wand: the wand holding the source images
1926%
1927%    o compose, x, y:  composition arguments
1928%
1929*/
1930WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1931  const MagickWand *source_wand,const CompositeOperator compose,
1932  const ssize_t x,const ssize_t y)
1933{
1934  MagickBooleanType
1935    status;
1936
1937  assert(wand != (MagickWand *) NULL);
1938  assert(wand->signature == WandSignature);
1939  if( IfMagickTrue(wand->debug) )
1940    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1941
1942  if ((wand->images == (Image *) NULL) ||
1943      (source_wand->images == (Image *) NULL))
1944    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1945  CompositeLayers(wand->images,compose,source_wand->images,x,y,
1946        wand->exception);
1947  status=MagickTrue;  /* FUTURE: determine status from exceptions */
1948  return(status);
1949}
1950
1951/*
1952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1953%                                                                             %
1954%                                                                             %
1955%                                                                             %
1956%   M a g i c k C o n t r a s t I m a g e                                     %
1957%                                                                             %
1958%                                                                             %
1959%                                                                             %
1960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961%
1962%  MagickContrastImage() enhances the intensity differences between the lighter
1963%  and darker elements of the image.  Set sharpen to a value other than 0 to
1964%  increase the image contrast otherwise the contrast is reduced.
1965%
1966%  The format of the MagickContrastImage method is:
1967%
1968%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1969%        const MagickBooleanType sharpen)
1970%
1971%  A description of each parameter follows:
1972%
1973%    o wand: the magick wand.
1974%
1975%    o sharpen: Increase or decrease image contrast.
1976%
1977%
1978*/
1979WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1980  const MagickBooleanType sharpen)
1981{
1982  MagickBooleanType
1983    status;
1984
1985  assert(wand != (MagickWand *) NULL);
1986  assert(wand->signature == WandSignature);
1987  if( IfMagickTrue(wand->debug) )
1988    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1989
1990  if (wand->images == (Image *) NULL)
1991    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1992  status=ContrastImage(wand->images,sharpen,wand->exception);
1993  return(status);
1994}
1995
1996/*
1997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1998%                                                                             %
1999%                                                                             %
2000%                                                                             %
2001%   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                       %
2002%                                                                             %
2003%                                                                             %
2004%                                                                             %
2005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2006%
2007%  MagickContrastStretchImage() enhances the contrast of a color image by
2008%  adjusting the pixels color to span the entire range of colors available.
2009%  You can also reduce the influence of a particular channel with a gamma
2010%  value of 0.
2011%
2012%  The format of the MagickContrastStretchImage method is:
2013%
2014%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2015%        const double black_point,const double white_point)
2016%
2017%  A description of each parameter follows:
2018%
2019%    o wand: the magick wand.
2020%
2021%    o black_point: the black point.
2022%
2023%    o white_point: the white point.
2024%
2025*/
2026WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2027  const double black_point,const double white_point)
2028{
2029  MagickBooleanType
2030    status;
2031
2032  assert(wand != (MagickWand *) NULL);
2033  assert(wand->signature == WandSignature);
2034  if( IfMagickTrue(wand->debug) )
2035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2036
2037  if (wand->images == (Image *) NULL)
2038    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2039  status=ContrastStretchImage(wand->images,black_point,white_point,
2040    wand->exception);
2041  return(status);
2042}
2043
2044/*
2045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2046%                                                                             %
2047%                                                                             %
2048%                                                                             %
2049%   M a g i c k C o n v o l v e I m a g e                                     %
2050%                                                                             %
2051%                                                                             %
2052%                                                                             %
2053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054%
2055%  MagickConvolveImage() applies a custom convolution kernel to the image.
2056%
2057%  The format of the MagickConvolveImage method is:
2058%
2059%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2060%        const KernelInfo *kernel)
2061%
2062%  A description of each parameter follows:
2063%
2064%    o wand: the magick wand.
2065%
2066%    o kernel: An array of doubles representing the convolution kernel.
2067%
2068*/
2069WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2070  const KernelInfo *kernel)
2071{
2072  Image
2073    *filter_image;
2074
2075  assert(wand != (MagickWand *) NULL);
2076  assert(wand->signature == WandSignature);
2077  if( IfMagickTrue(wand->debug) )
2078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2079
2080  if (kernel == (const KernelInfo *) NULL)
2081    return(MagickFalse);
2082  if (wand->images == (Image *) NULL)
2083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2084  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2085  if (filter_image == (Image *) NULL)
2086    return(MagickFalse);
2087  ReplaceImageInList(&wand->images,filter_image);
2088  return(MagickTrue);
2089}
2090
2091/*
2092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2093%                                                                             %
2094%                                                                             %
2095%                                                                             %
2096%   M a g i c k C r o p I m a g e                                             %
2097%                                                                             %
2098%                                                                             %
2099%                                                                             %
2100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2101%
2102%  MagickCropImage() extracts a region of the image.
2103%
2104%  The format of the MagickCropImage method is:
2105%
2106%      MagickBooleanType MagickCropImage(MagickWand *wand,
2107%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2108%
2109%  A description of each parameter follows:
2110%
2111%    o wand: the magick wand.
2112%
2113%    o width: the region width.
2114%
2115%    o height: the region height.
2116%
2117%    o x: the region x-offset.
2118%
2119%    o y: the region y-offset.
2120%
2121*/
2122WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2123  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2124{
2125  Image
2126    *crop_image;
2127
2128  RectangleInfo
2129    crop;
2130
2131  assert(wand != (MagickWand *) NULL);
2132  assert(wand->signature == WandSignature);
2133  if( IfMagickTrue(wand->debug) )
2134    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2135
2136  if (wand->images == (Image *) NULL)
2137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2138  crop.width=width;
2139  crop.height=height;
2140  crop.x=x;
2141  crop.y=y;
2142  crop_image=CropImage(wand->images,&crop,wand->exception);
2143  if (crop_image == (Image *) NULL)
2144    return(MagickFalse);
2145  ReplaceImageInList(&wand->images,crop_image);
2146  return(MagickTrue);
2147}
2148
2149/*
2150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2151%                                                                             %
2152%                                                                             %
2153%                                                                             %
2154%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2155%                                                                             %
2156%                                                                             %
2157%                                                                             %
2158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2159%
2160%  MagickCycleColormapImage() displaces an image's colormap by a given number
2161%  of positions.  If you cycle the colormap a number of times you can produce
2162%  a psychodelic effect.
2163%
2164%  The format of the MagickCycleColormapImage method is:
2165%
2166%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2167%        const ssize_t displace)
2168%
2169%  A description of each parameter follows:
2170%
2171%    o wand: the magick wand.
2172%
2173%    o pixel_wand: the pixel wand.
2174%
2175*/
2176WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2177  const ssize_t displace)
2178{
2179  MagickBooleanType
2180    status;
2181
2182  assert(wand != (MagickWand *) NULL);
2183  assert(wand->signature == WandSignature);
2184  if( IfMagickTrue(wand->debug) )
2185    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2186
2187  if (wand->images == (Image *) NULL)
2188    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2189  status=CycleColormapImage(wand->images,displace,wand->exception);
2190  return(status);
2191}
2192
2193/*
2194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2195%                                                                             %
2196%                                                                             %
2197%                                                                             %
2198%   M a g i c k C o n s t i t u t e I m a g e                                 %
2199%                                                                             %
2200%                                                                             %
2201%                                                                             %
2202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2203%
2204%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2205%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2206%  The data can be char, short int, int, float, or double.  Float and double
2207%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2208%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2209%  example, to create a 640x480 image from unsigned red-green-blue character
2210%  data, use
2211%
2212%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2213%
2214%  The format of the MagickConstituteImage method is:
2215%
2216%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2217%        const size_t columns,const size_t rows,const char *map,
2218%        const StorageType storage,void *pixels)
2219%
2220%  A description of each parameter follows:
2221%
2222%    o wand: the magick wand.
2223%
2224%    o columns: width in pixels of the image.
2225%
2226%    o rows: height in pixels of the image.
2227%
2228%    o map:  This string reflects the expected ordering of the pixel array.
2229%      It can be any combination or order of R = red, G = green, B = blue,
2230%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2231%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2232%      P = pad.
2233%
2234%    o storage: Define the data type of the pixels.  Float and double types are
2235%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2236%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2237%      LongPixel, QuantumPixel, or ShortPixel.
2238%
2239%    o pixels: This array of values contain the pixel components as defined by
2240%      map and type.  You must preallocate this array where the expected
2241%      length varies depending on the values of width, height, map, and type.
2242%
2243%
2244*/
2245WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2246  const size_t columns,const size_t rows,const char *map,
2247  const StorageType storage,const void *pixels)
2248{
2249  Image
2250    *images;
2251
2252  assert(wand != (MagickWand *) NULL);
2253  assert(wand->signature == WandSignature);
2254  if( IfMagickTrue(wand->debug) )
2255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2256
2257  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2258  if (images == (Image *) NULL)
2259    return(MagickFalse);
2260  return(InsertImageInWand(wand,images));
2261}
2262
2263/*
2264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265%                                                                             %
2266%                                                                             %
2267%                                                                             %
2268%   M a g i c k D e c i p h e r I m a g e                                     %
2269%                                                                             %
2270%                                                                             %
2271%                                                                             %
2272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273%
2274%  MagickDecipherImage() converts cipher pixels to plain pixels.
2275%
2276%  The format of the MagickDecipherImage method is:
2277%
2278%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2279%        const char *passphrase)
2280%
2281%  A description of each parameter follows:
2282%
2283%    o wand: the magick wand.
2284%
2285%    o passphrase: the passphrase.
2286%
2287*/
2288WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2289  const char *passphrase)
2290{
2291  assert(wand != (MagickWand *) NULL);
2292  assert(wand->signature == WandSignature);
2293  if( IfMagickTrue(wand->debug) )
2294    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2295
2296  if (wand->images == (Image *) NULL)
2297    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2298  return(DecipherImage(wand->images,passphrase,wand->exception));
2299}
2300
2301/*
2302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2303%                                                                             %
2304%                                                                             %
2305%                                                                             %
2306%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2307%                                                                             %
2308%                                                                             %
2309%                                                                             %
2310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2311%
2312%  MagickDeconstructImages() compares each image with the next in a sequence
2313%  and returns the maximum bounding region of any pixel differences it
2314%  discovers.
2315%
2316%  The format of the MagickDeconstructImages method is:
2317%
2318%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2319%
2320%  A description of each parameter follows:
2321%
2322%    o wand: the magick wand.
2323%
2324*/
2325WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2326{
2327  Image
2328    *deconstruct_image;
2329
2330  assert(wand != (MagickWand *) NULL);
2331  assert(wand->signature == WandSignature);
2332  if( IfMagickTrue(wand->debug) )
2333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2334
2335  if (wand->images == (Image *) NULL)
2336    return((MagickWand *) NULL);
2337  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2338    wand->exception);
2339  if (deconstruct_image == (Image *) NULL)
2340    return((MagickWand *) NULL);
2341  return(CloneMagickWandFromImages(wand,deconstruct_image));
2342}
2343
2344/*
2345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346%                                                                             %
2347%                                                                             %
2348%                                                                             %
2349%     M a g i c k D e s k e w I m a g e                                       %
2350%                                                                             %
2351%                                                                             %
2352%                                                                             %
2353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2354%
2355%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2356%  occurs in scanned images because of the camera being misaligned,
2357%  imperfections in the scanning or surface, or simply because the paper was
2358%  not placed completely flat when scanned.
2359%
2360%  The format of the MagickDeskewImage method is:
2361%
2362%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2363%        const double threshold)
2364%
2365%  A description of each parameter follows:
2366%
2367%    o wand: the magick wand.
2368%
2369%    o threshold: separate background from foreground.
2370%
2371*/
2372WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2373  const double threshold)
2374{
2375  Image
2376    *sepia_image;
2377
2378  assert(wand != (MagickWand *) NULL);
2379  assert(wand->signature == WandSignature);
2380  if( IfMagickTrue(wand->debug) )
2381    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2382
2383  if (wand->images == (Image *) NULL)
2384    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2385  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2386  if (sepia_image == (Image *) NULL)
2387    return(MagickFalse);
2388  ReplaceImageInList(&wand->images,sepia_image);
2389  return(MagickTrue);
2390}
2391
2392/*
2393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2394%                                                                             %
2395%                                                                             %
2396%                                                                             %
2397%     M a g i c k D e s p e c k l e I m a g e                                 %
2398%                                                                             %
2399%                                                                             %
2400%                                                                             %
2401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2402%
2403%  MagickDespeckleImage() reduces the speckle noise in an image while
2404%  perserving the edges of the original image.
2405%
2406%  The format of the MagickDespeckleImage method is:
2407%
2408%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2409%
2410%  A description of each parameter follows:
2411%
2412%    o wand: the magick wand.
2413%
2414*/
2415WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2416{
2417  Image
2418    *despeckle_image;
2419
2420  assert(wand != (MagickWand *) NULL);
2421  assert(wand->signature == WandSignature);
2422  if( IfMagickTrue(wand->debug) )
2423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2424
2425  if (wand->images == (Image *) NULL)
2426    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2427  despeckle_image=DespeckleImage(wand->images,wand->exception);
2428  if (despeckle_image == (Image *) NULL)
2429    return(MagickFalse);
2430  ReplaceImageInList(&wand->images,despeckle_image);
2431  return(MagickTrue);
2432}
2433
2434/*
2435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2436%                                                                             %
2437%                                                                             %
2438%                                                                             %
2439%   M a g i c k D e s t r o y I m a g e                                       %
2440%                                                                             %
2441%                                                                             %
2442%                                                                             %
2443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2444%
2445%  MagickDestroyImage() dereferences an image, deallocating memory associated
2446%  with the image if the reference count becomes zero.
2447%
2448%  The format of the MagickDestroyImage method is:
2449%
2450%      Image *MagickDestroyImage(Image *image)
2451%
2452%  A description of each parameter follows:
2453%
2454%    o image: the image.
2455%
2456*/
2457WandExport Image *MagickDestroyImage(Image *image)
2458{
2459  return(DestroyImage(image));
2460}
2461
2462/*
2463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464%                                                                             %
2465%                                                                             %
2466%                                                                             %
2467%   M a g i c k D i s p l a y I m a g e                                       %
2468%                                                                             %
2469%                                                                             %
2470%                                                                             %
2471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472%
2473%  MagickDisplayImage() displays an image.
2474%
2475%  The format of the MagickDisplayImage method is:
2476%
2477%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2478%        const char *server_name)
2479%
2480%  A description of each parameter follows:
2481%
2482%    o wand: the magick wand.
2483%
2484%    o server_name: the X server name.
2485%
2486*/
2487WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2488  const char *server_name)
2489{
2490  Image
2491    *image;
2492
2493  MagickBooleanType
2494    status;
2495
2496  assert(wand != (MagickWand *) NULL);
2497  assert(wand->signature == WandSignature);
2498  if( IfMagickTrue(wand->debug) )
2499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2500
2501  if (wand->images == (Image *) NULL)
2502    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2503  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2504  if (image == (Image *) NULL)
2505    return(MagickFalse);
2506  (void) CloneString(&wand->image_info->server_name,server_name);
2507  status=DisplayImages(wand->image_info,image,wand->exception);
2508  image=DestroyImage(image);
2509  return(status);
2510}
2511
2512/*
2513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514%                                                                             %
2515%                                                                             %
2516%                                                                             %
2517%   M a g i c k D i s p l a y I m a g e s                                     %
2518%                                                                             %
2519%                                                                             %
2520%                                                                             %
2521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522%
2523%  MagickDisplayImages() displays an image or image sequence.
2524%
2525%  The format of the MagickDisplayImages method is:
2526%
2527%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2528%        const char *server_name)
2529%
2530%  A description of each parameter follows:
2531%
2532%    o wand: the magick wand.
2533%
2534%    o server_name: the X server name.
2535%
2536*/
2537WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2538  const char *server_name)
2539{
2540  MagickBooleanType
2541    status;
2542
2543  assert(wand != (MagickWand *) NULL);
2544  assert(wand->signature == WandSignature);
2545  if( IfMagickTrue(wand->debug) )
2546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2547
2548  (void) CloneString(&wand->image_info->server_name,server_name);
2549  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2550  return(status);
2551}
2552
2553/*
2554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555%                                                                             %
2556%                                                                             %
2557%                                                                             %
2558%   M a g i c k D i s t o r t I m a g e                                       %
2559%                                                                             %
2560%                                                                             %
2561%                                                                             %
2562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563%
2564%  MagickDistortImage() distorts an image using various distortion methods, by
2565%  mapping color lookups of the source image to a new destination image
2566%  usally of the same size as the source image, unless 'bestfit' is set to
2567%  true.
2568%
2569%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2570%  adjusted to ensure the whole source 'image' will just fit within the final
2571%  destination image, which will be sized and offset accordingly.  Also in
2572%  many cases the virtual offset of the source image will be taken into
2573%  account in the mapping.
2574%
2575%  The format of the MagickDistortImage method is:
2576%
2577%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2578%        const DistortImageMethod method,const size_t number_arguments,
2579%        const double *arguments,const MagickBooleanType bestfit)
2580%
2581%  A description of each parameter follows:
2582%
2583%    o image: the image to be distorted.
2584%
2585%    o method: the method of image distortion.
2586%
2587%        ArcDistortion always ignores the source image offset, and always
2588%        'bestfit' the destination image with the top left corner offset
2589%        relative to the polar mapping center.
2590%
2591%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2592%        style of image distortion.
2593%
2594%        Affine, Perspective, and Bilinear, do least squares fitting of the
2595%        distortion when more than the minimum number of control point pairs
2596%        are provided.
2597%
2598%        Perspective, and Bilinear, falls back to a Affine distortion when less
2599%        that 4 control point pairs are provided. While Affine distortions let
2600%        you use any number of control point pairs, that is Zero pairs is a
2601%        no-Op (viewport only) distrotion, one pair is a translation and two
2602%        pairs of control points do a scale-rotate-translate, without any
2603%        shearing.
2604%
2605%    o number_arguments: the number of arguments given for this distortion
2606%      method.
2607%
2608%    o arguments: the arguments for this distortion method.
2609%
2610%    o bestfit: Attempt to resize destination to fit distorted source.
2611%
2612*/
2613WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2614  const DistortImageMethod method,const size_t number_arguments,
2615  const double *arguments,const MagickBooleanType bestfit)
2616{
2617  Image
2618    *distort_image;
2619
2620  assert(wand != (MagickWand *) NULL);
2621  assert(wand->signature == WandSignature);
2622  if( IfMagickTrue(wand->debug) )
2623    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2624
2625  if (wand->images == (Image *) NULL)
2626    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2627  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2628    bestfit,wand->exception);
2629  if (distort_image == (Image *) NULL)
2630    return(MagickFalse);
2631  ReplaceImageInList(&wand->images,distort_image);
2632  return(MagickTrue);
2633}
2634
2635/*
2636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2637%                                                                             %
2638%                                                                             %
2639%                                                                             %
2640%   M a g i c k D r a w I m a g e                                             %
2641%                                                                             %
2642%                                                                             %
2643%                                                                             %
2644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2645%
2646%  MagickDrawImage() renders the drawing wand on the current image.
2647%
2648%  The format of the MagickDrawImage method is:
2649%
2650%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2651%        const DrawingWand *drawing_wand)
2652%
2653%  A description of each parameter follows:
2654%
2655%    o wand: the magick wand.
2656%
2657%    o drawing_wand: the draw wand.
2658%
2659*/
2660WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2661  const DrawingWand *drawing_wand)
2662{
2663  char
2664    *primitive;
2665
2666  DrawInfo
2667    *draw_info;
2668
2669  MagickBooleanType
2670    status;
2671
2672  assert(wand != (MagickWand *) NULL);
2673  assert(wand->signature == WandSignature);
2674  if( IfMagickTrue(wand->debug) )
2675    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2676
2677  if (wand->images == (Image *) NULL)
2678    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2679  draw_info=PeekDrawingWand(drawing_wand);
2680  if ((draw_info == (DrawInfo *) NULL) ||
2681      (draw_info->primitive == (char *) NULL))
2682    return(MagickFalse);
2683  primitive=AcquireString(draw_info->primitive);
2684  draw_info=DestroyDrawInfo(draw_info);
2685  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2686  draw_info->primitive=primitive;
2687  status=DrawImage(wand->images,draw_info,wand->exception);
2688  draw_info=DestroyDrawInfo(draw_info);
2689  return(status);
2690}
2691
2692/*
2693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2694%                                                                             %
2695%                                                                             %
2696%                                                                             %
2697%   M a g i c k E d g e I m a g e                                             %
2698%                                                                             %
2699%                                                                             %
2700%                                                                             %
2701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2702%
2703%  MagickEdgeImage() enhance edges within the image with a convolution filter
2704%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2705%  radius for you.
2706%
2707%  The format of the MagickEdgeImage method is:
2708%
2709%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2710%        const double sigma)
2711%
2712%  A description of each parameter follows:
2713%
2714%    o wand: the magick wand.
2715%
2716%    o radius: the radius of the pixel neighborhood.
2717%
2718%    o sigma: the standard deviation of the Gaussian, in pixels.
2719%
2720*/
2721WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2722  const double radius,const double sigma)
2723{
2724  Image
2725    *edge_image;
2726
2727  assert(wand != (MagickWand *) NULL);
2728  assert(wand->signature == WandSignature);
2729  if( IfMagickTrue(wand->debug) )
2730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2731
2732  if (wand->images == (Image *) NULL)
2733    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2734  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2735  if (edge_image == (Image *) NULL)
2736    return(MagickFalse);
2737  ReplaceImageInList(&wand->images,edge_image);
2738  return(MagickTrue);
2739}
2740
2741/*
2742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2743%                                                                             %
2744%                                                                             %
2745%                                                                             %
2746%   M a g i c k E m b o s s I m a g e                                         %
2747%                                                                             %
2748%                                                                             %
2749%                                                                             %
2750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2751%
2752%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2753%  effect.  We convolve the image with a Gaussian operator of the given radius
2754%  and standard deviation (sigma).  For reasonable results, radius should be
2755%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2756%  radius for you.
2757%
2758%  The format of the MagickEmbossImage method is:
2759%
2760%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2761%        const double sigma)
2762%
2763%  A description of each parameter follows:
2764%
2765%    o wand: the magick wand.
2766%
2767%    o radius: the radius of the Gaussian, in pixels, not counting the center
2768%      pixel.
2769%
2770%    o sigma: the standard deviation of the Gaussian, in pixels.
2771%
2772*/
2773WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2774  const double radius,const double sigma)
2775{
2776  Image
2777    *emboss_image;
2778
2779  assert(wand != (MagickWand *) NULL);
2780  assert(wand->signature == WandSignature);
2781  if( IfMagickTrue(wand->debug) )
2782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2783
2784  if (wand->images == (Image *) NULL)
2785    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2786  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2787  if (emboss_image == (Image *) NULL)
2788    return(MagickFalse);
2789  ReplaceImageInList(&wand->images,emboss_image);
2790  return(MagickTrue);
2791}
2792
2793/*
2794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2795%                                                                             %
2796%                                                                             %
2797%                                                                             %
2798%   M a g i c k E n c i p h e r I m a g e                                     %
2799%                                                                             %
2800%                                                                             %
2801%                                                                             %
2802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2803%
2804%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2805%
2806%  The format of the MagickEncipherImage method is:
2807%
2808%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2809%        const char *passphrase)
2810%
2811%  A description of each parameter follows:
2812%
2813%    o wand: the magick wand.
2814%
2815%    o passphrase: the passphrase.
2816%
2817*/
2818WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2819  const char *passphrase)
2820{
2821  assert(wand != (MagickWand *) NULL);
2822  assert(wand->signature == WandSignature);
2823  if( IfMagickTrue(wand->debug) )
2824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2825
2826  if (wand->images == (Image *) NULL)
2827    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2828  return(EncipherImage(wand->images,passphrase,wand->exception));
2829}
2830
2831/*
2832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833%                                                                             %
2834%                                                                             %
2835%                                                                             %
2836%   M a g i c k E n h a n c e I m a g e                                       %
2837%                                                                             %
2838%                                                                             %
2839%                                                                             %
2840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2841%
2842%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2843%  noisy image.
2844%
2845%  The format of the MagickEnhanceImage method is:
2846%
2847%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2848%
2849%  A description of each parameter follows:
2850%
2851%    o wand: the magick wand.
2852%
2853*/
2854WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2855{
2856  Image
2857    *enhance_image;
2858
2859  assert(wand != (MagickWand *) NULL);
2860  assert(wand->signature == WandSignature);
2861  if( IfMagickTrue(wand->debug) )
2862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2863
2864  if (wand->images == (Image *) NULL)
2865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2866  enhance_image=EnhanceImage(wand->images,wand->exception);
2867  if (enhance_image == (Image *) NULL)
2868    return(MagickFalse);
2869  ReplaceImageInList(&wand->images,enhance_image);
2870  return(MagickTrue);
2871}
2872
2873/*
2874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2875%                                                                             %
2876%                                                                             %
2877%                                                                             %
2878%   M a g i c k E q u a l i z e I m a g e                                     %
2879%                                                                             %
2880%                                                                             %
2881%                                                                             %
2882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2883%
2884%  MagickEqualizeImage() equalizes the image histogram.
2885%
2886%  The format of the MagickEqualizeImage method is:
2887%
2888%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2889%
2890%  A description of each parameter follows:
2891%
2892%    o wand: the magick wand.
2893%
2894%    o channel: the image channel(s).
2895%
2896*/
2897WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2898{
2899  MagickBooleanType
2900    status;
2901
2902  assert(wand != (MagickWand *) NULL);
2903  assert(wand->signature == WandSignature);
2904  if( IfMagickTrue(wand->debug) )
2905    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2906
2907  if (wand->images == (Image *) NULL)
2908    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2909  status=EqualizeImage(wand->images,wand->exception);
2910  return(status);
2911}
2912
2913/*
2914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2915%                                                                             %
2916%                                                                             %
2917%                                                                             %
2918%   M a g i c k E v a l u a t e I m a g e                                     %
2919%                                                                             %
2920%                                                                             %
2921%                                                                             %
2922%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2923%
2924%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2925%  expression to an image.  Use these operators to lighten or darken an image,
2926%  to increase or decrease contrast in an image, or to produce the "negative"
2927%  of an image.
2928%
2929%  The format of the MagickEvaluateImage method is:
2930%
2931%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2932%        const MagickEvaluateOperator operator,const double value)
2933%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2934%        const MagickEvaluateOperator operator)
2935%
2936%  A description of each parameter follows:
2937%
2938%    o wand: the magick wand.
2939%
2940%    o op: A channel operator.
2941%
2942%    o value: A value value.
2943%
2944*/
2945
2946WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2947  const MagickEvaluateOperator op)
2948{
2949  Image
2950    *evaluate_image;
2951
2952  assert(wand != (MagickWand *) NULL);
2953  assert(wand->signature == WandSignature);
2954  if( IfMagickTrue(wand->debug) )
2955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2956
2957  if (wand->images == (Image *) NULL)
2958    return((MagickWand *) NULL);
2959  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2960  if (evaluate_image == (Image *) NULL)
2961    return((MagickWand *) NULL);
2962  return(CloneMagickWandFromImages(wand,evaluate_image));
2963}
2964
2965WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2966  const MagickEvaluateOperator op,const double value)
2967{
2968  MagickBooleanType
2969    status;
2970
2971  assert(wand != (MagickWand *) NULL);
2972  assert(wand->signature == WandSignature);
2973  if( IfMagickTrue(wand->debug) )
2974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2975
2976  if (wand->images == (Image *) NULL)
2977    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2978  status=EvaluateImage(wand->images,op,value,wand->exception);
2979  return(status);
2980}
2981
2982/*
2983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2984%                                                                             %
2985%                                                                             %
2986%                                                                             %
2987%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2988%                                                                             %
2989%                                                                             %
2990%                                                                             %
2991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2992%
2993%  MagickExportImagePixels() extracts pixel data from an image and returns it
2994%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2995%  an error is encountered.  The data is returned as char, short int, int,
2996%  ssize_t, float, or double in the order specified by map.
2997%
2998%  Suppose you want to extract the first scanline of a 640x480 image as
2999%  character data in red-green-blue order:
3000%
3001%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3002%
3003%  The format of the MagickExportImagePixels method is:
3004%
3005%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3006%        const ssize_t x,const ssize_t y,const size_t columns,
3007%        const size_t rows,const char *map,const StorageType storage,
3008%        void *pixels)
3009%
3010%  A description of each parameter follows:
3011%
3012%    o wand: the magick wand.
3013%
3014%    o x, y, columns, rows:  These values define the perimeter
3015%      of a region of pixels you want to extract.
3016%
3017%    o map:  This string reflects the expected ordering of the pixel array.
3018%      It can be any combination or order of R = red, G = green, B = blue,
3019%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3020%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3021%      P = pad.
3022%
3023%    o storage: Define the data type of the pixels.  Float and double types are
3024%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3025%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3026%      LongPixel, QuantumPixel, or ShortPixel.
3027%
3028%    o pixels: This array of values contain the pixel components as defined by
3029%      map and type.  You must preallocate this array where the expected
3030%      length varies depending on the values of width, height, map, and type.
3031%
3032*/
3033WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3034  const ssize_t x,const ssize_t y,const size_t columns,
3035  const size_t rows,const char *map,const StorageType storage,
3036  void *pixels)
3037{
3038  MagickBooleanType
3039    status;
3040
3041  assert(wand != (MagickWand *) NULL);
3042  assert(wand->signature == WandSignature);
3043  if( IfMagickTrue(wand->debug) )
3044    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3045
3046  if (wand->images == (Image *) NULL)
3047    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3048  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3049    storage,pixels,wand->exception);
3050  return(status);
3051}
3052
3053/*
3054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3055%                                                                             %
3056%                                                                             %
3057%                                                                             %
3058%   M a g i c k E x t e n t I m a g e                                         %
3059%                                                                             %
3060%                                                                             %
3061%                                                                             %
3062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3063%
3064%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3065%  and wand background color.  Set the (x,y) offset of the geometry to move
3066%  the original wand relative to the extended wand.
3067%
3068%  The format of the MagickExtentImage method is:
3069%
3070%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3071%        const size_t height,const ssize_t x,const ssize_t y)
3072%
3073%  A description of each parameter follows:
3074%
3075%    o wand: the magick wand.
3076%
3077%    o width: the region width.
3078%
3079%    o height: the region height.
3080%
3081%    o x: the region x offset.
3082%
3083%    o y: the region y offset.
3084%
3085*/
3086WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3087  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3088{
3089  Image
3090    *extent_image;
3091
3092  RectangleInfo
3093    extent;
3094
3095  assert(wand != (MagickWand *) NULL);
3096  assert(wand->signature == WandSignature);
3097  if( IfMagickTrue(wand->debug) )
3098    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3099
3100  if (wand->images == (Image *) NULL)
3101    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102  extent.width=width;
3103  extent.height=height;
3104  extent.x=x;
3105  extent.y=y;
3106  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3107  if (extent_image == (Image *) NULL)
3108    return(MagickFalse);
3109  ReplaceImageInList(&wand->images,extent_image);
3110  return(MagickTrue);
3111}
3112
3113/*
3114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115%                                                                             %
3116%                                                                             %
3117%                                                                             %
3118%   M a g i c k F l i p I m a g e                                             %
3119%                                                                             %
3120%                                                                             %
3121%                                                                             %
3122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3123%
3124%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3125%  around the central x-axis.
3126%
3127%  The format of the MagickFlipImage method is:
3128%
3129%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3130%
3131%  A description of each parameter follows:
3132%
3133%    o wand: the magick wand.
3134%
3135*/
3136WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3137{
3138  Image
3139    *flip_image;
3140
3141  assert(wand != (MagickWand *) NULL);
3142  assert(wand->signature == WandSignature);
3143  if( IfMagickTrue(wand->debug) )
3144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3145
3146  if (wand->images == (Image *) NULL)
3147    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3148  flip_image=FlipImage(wand->images,wand->exception);
3149  if (flip_image == (Image *) NULL)
3150    return(MagickFalse);
3151  ReplaceImageInList(&wand->images,flip_image);
3152  return(MagickTrue);
3153}
3154
3155/*
3156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3157%                                                                             %
3158%                                                                             %
3159%                                                                             %
3160%   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                         %
3161%                                                                             %
3162%                                                                             %
3163%                                                                             %
3164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3165%
3166%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3167%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3168%  specified, the color value is changed for any neighbor pixel that does not
3169%  match the bordercolor member of image.
3170%
3171%  The format of the MagickFloodfillPaintImage method is:
3172%
3173%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3174%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3175%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3176%
3177%  A description of each parameter follows:
3178%
3179%    o wand: the magick wand.
3180%
3181%    o fill: the floodfill color pixel wand.
3182%
3183%    o fuzz: By default target must match a particular pixel color
3184%      exactly.  However, in many cases two colors may differ by a small amount.
3185%      The fuzz member of image defines how much tolerance is acceptable to
3186%      consider two colors as the same.  For example, set fuzz to 10 and the
3187%      color red at intensities of 100 and 102 respectively are now interpreted
3188%      as the same color for the purposes of the floodfill.
3189%
3190%    o bordercolor: the border color pixel wand.
3191%
3192%    o x,y: the starting location of the operation.
3193%
3194%    o invert: paint any pixel that does not match the target color.
3195%
3196*/
3197WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3198  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3199  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3200{
3201  DrawInfo
3202    *draw_info;
3203
3204  MagickBooleanType
3205    status;
3206
3207  PixelInfo
3208    target;
3209
3210  assert(wand != (MagickWand *) NULL);
3211  assert(wand->signature == WandSignature);
3212  if( IfMagickTrue(wand->debug) )
3213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3214
3215  if (wand->images == (Image *) NULL)
3216    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3217  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3218  PixelGetQuantumPacket(fill,&draw_info->fill);
3219  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3220    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3221  if (bordercolor != (PixelWand *) NULL)
3222    PixelGetMagickColor(bordercolor,&target);
3223  wand->images->fuzz=fuzz;
3224  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3225    wand->exception);
3226  draw_info=DestroyDrawInfo(draw_info);
3227  return(status);
3228}
3229
3230/*
3231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3232%                                                                             %
3233%                                                                             %
3234%                                                                             %
3235%   M a g i c k F l o p I m a g e                                             %
3236%                                                                             %
3237%                                                                             %
3238%                                                                             %
3239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3240%
3241%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3242%  around the central y-axis.
3243%
3244%  The format of the MagickFlopImage method is:
3245%
3246%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3247%
3248%  A description of each parameter follows:
3249%
3250%    o wand: the magick wand.
3251%
3252*/
3253WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3254{
3255  Image
3256    *flop_image;
3257
3258  assert(wand != (MagickWand *) NULL);
3259  assert(wand->signature == WandSignature);
3260  if( IfMagickTrue(wand->debug) )
3261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3262
3263  if (wand->images == (Image *) NULL)
3264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3265  flop_image=FlopImage(wand->images,wand->exception);
3266  if (flop_image == (Image *) NULL)
3267    return(MagickFalse);
3268  ReplaceImageInList(&wand->images,flop_image);
3269  return(MagickTrue);
3270}
3271
3272/*
3273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3274%                                                                             %
3275%                                                                             %
3276%                                                                             %
3277%   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                     %
3278%                                                                             %
3279%                                                                             %
3280%                                                                             %
3281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282%
3283%  MagickForwardFourierTransformImage() implements the discrete Fourier
3284%  transform (DFT) of the image either as a magnitude / phase or real /
3285%  imaginary image pair.
3286%
3287%  The format of the MagickForwardFourierTransformImage method is:
3288%
3289%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3290%        const MagickBooleanType magnitude)
3291%
3292%  A description of each parameter follows:
3293%
3294%    o wand: the magick wand.
3295%
3296%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3297%      imaginary image pair.
3298%
3299*/
3300WandExport MagickBooleanType MagickForwardFourierTransformImage(
3301  MagickWand *wand,const MagickBooleanType magnitude)
3302{
3303  Image
3304    *forward_image;
3305
3306  assert(wand != (MagickWand *) NULL);
3307  assert(wand->signature == WandSignature);
3308  if( IfMagickTrue(wand->debug) )
3309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3310
3311  if (wand->images == (Image *) NULL)
3312    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3313  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3314    wand->exception);
3315  if (forward_image == (Image *) NULL)
3316    return(MagickFalse);
3317  ReplaceImageInList(&wand->images,forward_image);
3318  return(MagickTrue);
3319}
3320
3321/*
3322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323%                                                                             %
3324%                                                                             %
3325%                                                                             %
3326%   M a g i c k F r a m e I m a g e                                           %
3327%                                                                             %
3328%                                                                             %
3329%                                                                             %
3330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3331%
3332%  MagickFrameImage() adds a simulated three-dimensional border around the
3333%  image.  The width and height specify the border width of the vertical and
3334%  horizontal sides of the frame.  The inner and outer bevels indicate the
3335%  width of the inner and outer shadows of the frame.
3336%
3337%  The format of the MagickFrameImage method is:
3338%
3339%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3340%        const PixelWand *matte_color,const size_t width,
3341%        const size_t height,const ssize_t inner_bevel,
3342%        const ssize_t outer_bevel,const CompositeOperator compose)
3343%
3344%  A description of each parameter follows:
3345%
3346%    o wand: the magick wand.
3347%
3348%    o matte_color: the frame color pixel wand.
3349%
3350%    o width: the border width.
3351%
3352%    o height: the border height.
3353%
3354%    o inner_bevel: the inner bevel width.
3355%
3356%    o outer_bevel: the outer bevel width.
3357%
3358%    o compose: the composite operator.
3359%
3360*/
3361WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3362  const PixelWand *matte_color,const size_t width,const size_t height,
3363  const ssize_t inner_bevel,const ssize_t outer_bevel,
3364  const CompositeOperator compose)
3365{
3366  Image
3367    *frame_image;
3368
3369  FrameInfo
3370    frame_info;
3371
3372  assert(wand != (MagickWand *) NULL);
3373  assert(wand->signature == WandSignature);
3374  if( IfMagickTrue(wand->debug) )
3375    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3376
3377  if (wand->images == (Image *) NULL)
3378    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3379  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3380  frame_info.width=wand->images->columns+2*width;
3381  frame_info.height=wand->images->rows+2*height;
3382  frame_info.x=(ssize_t) width;
3383  frame_info.y=(ssize_t) height;
3384  frame_info.inner_bevel=inner_bevel;
3385  frame_info.outer_bevel=outer_bevel;
3386  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3387  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3388  if (frame_image == (Image *) NULL)
3389    return(MagickFalse);
3390  ReplaceImageInList(&wand->images,frame_image);
3391  return(MagickTrue);
3392}
3393
3394/*
3395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3396%                                                                             %
3397%                                                                             %
3398%                                                                             %
3399%   M a g i c k F u n c t i o n I m a g e                                     %
3400%                                                                             %
3401%                                                                             %
3402%                                                                             %
3403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3404%
3405%  MagickFunctionImage() applys an arithmetic, relational, or logical
3406%  expression to an image.  Use these operators to lighten or darken an image,
3407%  to increase or decrease contrast in an image, or to produce the "negative"
3408%  of an image.
3409%
3410%  The format of the MagickFunctionImage method is:
3411%
3412%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3413%        const MagickFunction function,const size_t number_arguments,
3414%        const double *arguments)
3415%
3416%  A description of each parameter follows:
3417%
3418%    o wand: the magick wand.
3419%
3420%    o function: the image function.
3421%
3422%    o number_arguments: the number of function arguments.
3423%
3424%    o arguments: the function arguments.
3425%
3426*/
3427WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3428  const MagickFunction function,const size_t number_arguments,
3429  const double *arguments)
3430{
3431  MagickBooleanType
3432    status;
3433
3434  assert(wand != (MagickWand *) NULL);
3435  assert(wand->signature == WandSignature);
3436  if( IfMagickTrue(wand->debug) )
3437    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3438
3439  if (wand->images == (Image *) NULL)
3440    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3441  status=FunctionImage(wand->images,function,number_arguments,arguments,
3442    wand->exception);
3443  return(status);
3444}
3445
3446/*
3447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3448%                                                                             %
3449%                                                                             %
3450%                                                                             %
3451%   M a g i c k F x I m a g e                                                 %
3452%                                                                             %
3453%                                                                             %
3454%                                                                             %
3455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3456%
3457%  MagickFxImage() evaluate expression for each pixel in the image.
3458%
3459%  The format of the MagickFxImage method is:
3460%
3461%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3462%
3463%  A description of each parameter follows:
3464%
3465%    o wand: the magick wand.
3466%
3467%    o expression: the expression.
3468%
3469*/
3470WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3471{
3472  Image
3473    *fx_image;
3474
3475  assert(wand != (MagickWand *) NULL);
3476  assert(wand->signature == WandSignature);
3477  if( IfMagickTrue(wand->debug) )
3478    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3479
3480  if (wand->images == (Image *) NULL)
3481    return((MagickWand *) NULL);
3482  fx_image=FxImage(wand->images,expression,wand->exception);
3483  if (fx_image == (Image *) NULL)
3484    return((MagickWand *) NULL);
3485  return(CloneMagickWandFromImages(wand,fx_image));
3486}
3487
3488/*
3489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3490%                                                                             %
3491%                                                                             %
3492%                                                                             %
3493%   M a g i c k G a m m a I m a g e                                           %
3494%                                                                             %
3495%                                                                             %
3496%                                                                             %
3497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3498%
3499%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3500%  different devices will have perceptual differences in the way the image's
3501%  intensities are represented on the screen.  Specify individual gamma levels
3502%  for the red, green, and blue channels, or adjust all three with the gamma
3503%  parameter.  Values typically range from 0.8 to 2.3.
3504%
3505%  You can also reduce the influence of a particular channel with a gamma
3506%  value of 0.
3507%
3508%  The format of the MagickGammaImage method is:
3509%
3510%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3511%
3512%  A description of each parameter follows:
3513%
3514%    o wand: the magick wand.
3515%
3516%    o level: Define the level of gamma correction.
3517%
3518*/
3519WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3520  const double gamma)
3521{
3522  MagickBooleanType
3523    status;
3524
3525  assert(wand != (MagickWand *) NULL);
3526  assert(wand->signature == WandSignature);
3527  if( IfMagickTrue(wand->debug) )
3528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3529
3530  if (wand->images == (Image *) NULL)
3531    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3532  status=GammaImage(wand->images,gamma,wand->exception);
3533  return(status);
3534}
3535
3536/*
3537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3538%                                                                             %
3539%                                                                             %
3540%                                                                             %
3541%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3542%                                                                             %
3543%                                                                             %
3544%                                                                             %
3545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3546%
3547%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3548%  Gaussian operator of the given radius and standard deviation (sigma).
3549%  For reasonable results, the radius should be larger than sigma.  Use a
3550%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3551%
3552%  The format of the MagickGaussianBlurImage method is:
3553%
3554%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3555%        const double radius,const double sigma)
3556%
3557%  A description of each parameter follows:
3558%
3559%    o wand: the magick wand.
3560%
3561%    o radius: the radius of the Gaussian, in pixels, not counting the center
3562%      pixel.
3563%
3564%    o sigma: the standard deviation of the Gaussian, in pixels.
3565%
3566*/
3567WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3568  const double radius,const double sigma)
3569{
3570  Image
3571    *blur_image;
3572
3573  assert(wand != (MagickWand *) NULL);
3574  assert(wand->signature == WandSignature);
3575  if( IfMagickTrue(wand->debug) )
3576    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3577
3578  if (wand->images == (Image *) NULL)
3579    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3580  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3581  if (blur_image == (Image *) NULL)
3582    return(MagickFalse);
3583  ReplaceImageInList(&wand->images,blur_image);
3584  return(MagickTrue);
3585}
3586
3587/*
3588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3589%                                                                             %
3590%                                                                             %
3591%                                                                             %
3592%   M a g i c k G e t I m a g e                                               %
3593%                                                                             %
3594%                                                                             %
3595%                                                                             %
3596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3597%
3598%  MagickGetImage() gets the image at the current image index.
3599%
3600%  The format of the MagickGetImage method is:
3601%
3602%      MagickWand *MagickGetImage(MagickWand *wand)
3603%
3604%  A description of each parameter follows:
3605%
3606%    o wand: the magick wand.
3607%
3608*/
3609WandExport MagickWand *MagickGetImage(MagickWand *wand)
3610{
3611  Image
3612    *image;
3613
3614  assert(wand != (MagickWand *) NULL);
3615  assert(wand->signature == WandSignature);
3616  if( IfMagickTrue(wand->debug) )
3617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3618
3619  if (wand->images == (Image *) NULL)
3620    {
3621      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3622        "ContainsNoImages","`%s'",wand->name);
3623      return((MagickWand *) NULL);
3624    }
3625  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3626  if (image == (Image *) NULL)
3627    return((MagickWand *) NULL);
3628  return(CloneMagickWandFromImages(wand,image));
3629}
3630
3631/*
3632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633%                                                                             %
3634%                                                                             %
3635%                                                                             %
3636%   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                       %
3637%                                                                             %
3638%                                                                             %
3639%                                                                             %
3640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641%
3642%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3643%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3644%  than CMYKA.
3645%
3646%  The format of the MagickGetImageAlphaChannel method is:
3647%
3648%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3649%
3650%  A description of each parameter follows:
3651%
3652%    o wand: the magick wand.
3653%
3654*/
3655WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3656{
3657  assert(wand != (MagickWand *) NULL);
3658  assert(wand->signature == WandSignature);
3659  if( IfMagickTrue(wand->debug) )
3660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3661
3662  if (wand->images == (Image *) NULL)
3663    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3664  return(GetImageAlphaChannel(wand->images));
3665}
3666
3667/*
3668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3669%                                                                             %
3670%                                                                             %
3671%                                                                             %
3672%   M a g i c k G e t I m a g e C l i p M a s k                               %
3673%                                                                             %
3674%                                                                             %
3675%                                                                             %
3676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3677%
3678%  MagickGetImageMask() gets the image clip mask at the current image index.
3679%
3680%  The format of the MagickGetImageMask method is:
3681%
3682%      MagickWand *MagickGetImageMask(MagickWand *wand)
3683%
3684%  A description of each parameter follows:
3685%
3686%    o wand: the magick wand.
3687%
3688*/
3689WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3690{
3691  Image
3692    *image;
3693
3694  assert(wand != (MagickWand *) NULL);
3695  assert(wand->signature == WandSignature);
3696  if( IfMagickTrue(wand->debug) )
3697    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3698
3699  if (wand->images == (Image *) NULL)
3700    {
3701      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3702        "ContainsNoImages","`%s'",wand->name);
3703      return((MagickWand *) NULL);
3704    }
3705  image=GetImageMask(wand->images,wand->exception);
3706  if (image == (Image *) NULL)
3707    return((MagickWand *) NULL);
3708  return(CloneMagickWandFromImages(wand,image));
3709}
3710
3711/*
3712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3713%                                                                             %
3714%                                                                             %
3715%                                                                             %
3716%   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                 %
3717%                                                                             %
3718%                                                                             %
3719%                                                                             %
3720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3721%
3722%  MagickGetImageBackgroundColor() returns the image background color.
3723%
3724%  The format of the MagickGetImageBackgroundColor method is:
3725%
3726%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3727%        PixelWand *background_color)
3728%
3729%  A description of each parameter follows:
3730%
3731%    o wand: the magick wand.
3732%
3733%    o background_color: Return the background color.
3734%
3735*/
3736WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3737  PixelWand *background_color)
3738{
3739  assert(wand != (MagickWand *) NULL);
3740  assert(wand->signature == WandSignature);
3741  if( IfMagickTrue(wand->debug) )
3742    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743
3744  if (wand->images == (Image *) NULL)
3745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3746  PixelSetPixelColor(background_color,&wand->images->background_color);
3747  return(MagickTrue);
3748}
3749
3750/*
3751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3752%                                                                             %
3753%                                                                             %
3754%                                                                             %
3755%   M a g i c k G e t I m a g e B l o b                                       %
3756%                                                                             %
3757%                                                                             %
3758%                                                                             %
3759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3760%
3761%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3762%  the image as a blob (a formatted "file" in memory) and its length, starting
3763%  from the current position in the image sequence.  Use MagickSetImageFormat()
3764%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3765%
3766%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3767%  the image sequence.
3768%
3769%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3770%
3771%  The format of the MagickGetImageBlob method is:
3772%
3773%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3774%
3775%  A description of each parameter follows:
3776%
3777%    o wand: the magick wand.
3778%
3779%    o length: the length of the blob.
3780%
3781*/
3782WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3783{
3784  assert(wand != (MagickWand *) NULL);
3785  assert(wand->signature == WandSignature);
3786  if( IfMagickTrue(wand->debug) )
3787    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3788
3789  if (wand->images == (Image *) NULL)
3790    {
3791      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3792        "ContainsNoImages","`%s'",wand->name);
3793      return((unsigned char *) NULL);
3794    }
3795  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3796}
3797
3798/*
3799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3800%                                                                             %
3801%                                                                             %
3802%                                                                             %
3803%   M a g i c k G e t I m a g e s B l o b                                     %
3804%                                                                             %
3805%                                                                             %
3806%                                                                             %
3807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3808%
3809%  MagickGetImageBlob() implements direct to memory image formats.  It
3810%  returns the image sequence as a blob and its length.  The format of the image
3811%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3812%  return a different image format, use MagickSetImageFormat().
3813%
3814%  Note, some image formats do not permit multiple images to the same image
3815%  stream (e.g. JPEG).  in this instance, just the first image of the
3816%  sequence is returned as a blob.
3817%
3818%  The format of the MagickGetImagesBlob method is:
3819%
3820%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3821%
3822%  A description of each parameter follows:
3823%
3824%    o wand: the magick wand.
3825%
3826%    o length: the length of the blob.
3827%
3828*/
3829WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3830{
3831  unsigned char
3832    *blob;
3833
3834  assert(wand != (MagickWand *) NULL);
3835  assert(wand->signature == WandSignature);
3836  if( IfMagickTrue(wand->debug) )
3837    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3838
3839  if (wand->images == (Image *) NULL)
3840    {
3841      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3842        "ContainsNoImages","`%s'",wand->name);
3843      return((unsigned char *) NULL);
3844    }
3845  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3846    wand->exception);
3847  return(blob);
3848}
3849
3850/*
3851%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3852%                                                                             %
3853%                                                                             %
3854%                                                                             %
3855%   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                         %
3856%                                                                             %
3857%                                                                             %
3858%                                                                             %
3859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3860%
3861%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3862%  image.
3863%
3864%  The format of the MagickGetImageBluePrimary method is:
3865%
3866%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3867%        double *y)
3868%
3869%  A description of each parameter follows:
3870%
3871%    o wand: the magick wand.
3872%
3873%    o x: the chromaticity blue primary x-point.
3874%
3875%    o y: the chromaticity blue primary y-point.
3876%
3877*/
3878WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3879  double *x,double *y)
3880{
3881  assert(wand != (MagickWand *) NULL);
3882  assert(wand->signature == WandSignature);
3883  if( IfMagickTrue(wand->debug) )
3884    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3885
3886  if (wand->images == (Image *) NULL)
3887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3888  *x=wand->images->chromaticity.blue_primary.x;
3889  *y=wand->images->chromaticity.blue_primary.y;
3890  return(MagickTrue);
3891}
3892
3893/*
3894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895%                                                                             %
3896%                                                                             %
3897%                                                                             %
3898%   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                         %
3899%                                                                             %
3900%                                                                             %
3901%                                                                             %
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903%
3904%  MagickGetImageBorderColor() returns the image border color.
3905%
3906%  The format of the MagickGetImageBorderColor method is:
3907%
3908%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3909%        PixelWand *border_color)
3910%
3911%  A description of each parameter follows:
3912%
3913%    o wand: the magick wand.
3914%
3915%    o border_color: Return the border color.
3916%
3917*/
3918WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3919  PixelWand *border_color)
3920{
3921  assert(wand != (MagickWand *) NULL);
3922  assert(wand->signature == WandSignature);
3923  if( IfMagickTrue(wand->debug) )
3924    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3925
3926  if (wand->images == (Image *) NULL)
3927    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3928  PixelSetPixelColor(border_color,&wand->images->border_color);
3929  return(MagickTrue);
3930}
3931
3932/*
3933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3934%                                                                             %
3935%                                                                             %
3936%                                                                             %
3937%   M a g i c k G e t I m a g e F e a t u r e s                               %
3938%                                                                             %
3939%                                                                             %
3940%                                                                             %
3941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3942%
3943%  MagickGetImageFeatures() returns features for each channel in the
3944%  image in each of four directions (horizontal, vertical, left and right
3945%  diagonals) for the specified distance.  The features include the angular
3946%  second moment, contrast, correlation, sum of squares: variance, inverse
3947%  difference moment, sum average, sum varience, sum entropy, entropy,
3948%  difference variance, difference entropy, information measures of
3949%  correlation 1, information measures of correlation 2, and maximum
3950%  correlation coefficient.  You can access the red channel contrast, for
3951%  example, like this:
3952%
3953%      channel_features=MagickGetImageFeatures(wand,1);
3954%      contrast=channel_features[RedPixelChannel].contrast[0];
3955%
3956%  Use MagickRelinquishMemory() to free the statistics buffer.
3957%
3958%  The format of the MagickGetImageFeatures method is:
3959%
3960%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3961%        const size_t distance)
3962%
3963%  A description of each parameter follows:
3964%
3965%    o wand: the magick wand.
3966%
3967%    o distance: the distance.
3968%
3969*/
3970WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3971  const size_t distance)
3972{
3973  assert(wand != (MagickWand *) NULL);
3974  assert(wand->signature == WandSignature);
3975  if( IfMagickTrue(wand->debug) )
3976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3977
3978  if (wand->images == (Image *) NULL)
3979    {
3980      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3981        "ContainsNoImages","`%s'",wand->name);
3982      return((ChannelFeatures *) NULL);
3983    }
3984  return(GetImageFeatures(wand->images,distance,wand->exception));
3985}
3986
3987/*
3988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3989%                                                                             %
3990%                                                                             %
3991%                                                                             %
3992%   M a g i c k G e t I m a g e K u r t o s i s                               %
3993%                                                                             %
3994%                                                                             %
3995%                                                                             %
3996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3997%
3998%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3999%  more image channels.
4000%
4001%  The format of the MagickGetImageKurtosis method is:
4002%
4003%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4004%        double *kurtosis,double *skewness)
4005%
4006%  A description of each parameter follows:
4007%
4008%    o wand: the magick wand.
4009%
4010%    o kurtosis:  The kurtosis for the specified channel(s).
4011%
4012%    o skewness:  The skewness for the specified channel(s).
4013%
4014*/
4015WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4016  double *kurtosis,double *skewness)
4017{
4018  MagickBooleanType
4019    status;
4020
4021  assert(wand != (MagickWand *) NULL);
4022  assert(wand->signature == WandSignature);
4023  if( IfMagickTrue(wand->debug) )
4024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4025
4026  if (wand->images == (Image *) NULL)
4027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4028  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4029  return(status);
4030}
4031
4032/*
4033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4034%                                                                             %
4035%                                                                             %
4036%                                                                             %
4037%   M a g i c k G e t I m a g e M e a n                                       %
4038%                                                                             %
4039%                                                                             %
4040%                                                                             %
4041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4042%
4043%  MagickGetImageMean() gets the mean and standard deviation of one or more
4044%  image channels.
4045%
4046%  The format of the MagickGetImageMean method is:
4047%
4048%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4049%        double *standard_deviation)
4050%
4051%  A description of each parameter follows:
4052%
4053%    o wand: the magick wand.
4054%
4055%    o channel: the image channel(s).
4056%
4057%    o mean:  The mean pixel value for the specified channel(s).
4058%
4059%    o standard_deviation:  The standard deviation for the specified channel(s).
4060%
4061*/
4062WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4063  double *standard_deviation)
4064{
4065  MagickBooleanType
4066    status;
4067
4068  assert(wand != (MagickWand *) NULL);
4069  assert(wand->signature == WandSignature);
4070  if( IfMagickTrue(wand->debug) )
4071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4072
4073  if (wand->images == (Image *) NULL)
4074    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4075  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4076  return(status);
4077}
4078
4079/*
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%                                                                             %
4082%                                                                             %
4083%                                                                             %
4084%   M a g i c k G e t I m a g e R a n g e                                     %
4085%                                                                             %
4086%                                                                             %
4087%                                                                             %
4088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4089%
4090%  MagickGetImageRange() gets the range for one or more image channels.
4091%
4092%  The format of the MagickGetImageRange method is:
4093%
4094%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4095%        double *maxima)
4096%
4097%  A description of each parameter follows:
4098%
4099%    o wand: the magick wand.
4100%
4101%    o minima:  The minimum pixel value for the specified channel(s).
4102%
4103%    o maxima:  The maximum pixel value for the specified channel(s).
4104%
4105*/
4106WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4107  double *minima,double *maxima)
4108{
4109  MagickBooleanType
4110    status;
4111
4112  assert(wand != (MagickWand *) NULL);
4113  assert(wand->signature == WandSignature);
4114  if( IfMagickTrue(wand->debug) )
4115    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4116
4117  if (wand->images == (Image *) NULL)
4118    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4119  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4120  return(status);
4121}
4122
4123/*
4124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4125%                                                                             %
4126%                                                                             %
4127%                                                                             %
4128%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4129%                                                                             %
4130%                                                                             %
4131%                                                                             %
4132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4133%
4134%  MagickGetImageStatistics() returns statistics for each channel in the
4135%  image.  The statistics include the channel depth, its minima and
4136%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4137%  You can access the red channel mean, for example, like this:
4138%
4139%      channel_statistics=MagickGetImageStatistics(wand);
4140%      red_mean=channel_statistics[RedPixelChannel].mean;
4141%
4142%  Use MagickRelinquishMemory() to free the statistics buffer.
4143%
4144%  The format of the MagickGetImageStatistics method is:
4145%
4146%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4147%
4148%  A description of each parameter follows:
4149%
4150%    o wand: the magick wand.
4151%
4152*/
4153WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4154{
4155  assert(wand != (MagickWand *) NULL);
4156  assert(wand->signature == WandSignature);
4157  if( IfMagickTrue(wand->debug) )
4158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4159
4160  if (wand->images == (Image *) NULL)
4161    {
4162      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4163        "ContainsNoImages","`%s'",wand->name);
4164      return((ChannelStatistics *) NULL);
4165    }
4166  return(GetImageStatistics(wand->images,wand->exception));
4167}
4168
4169/*
4170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4171%                                                                             %
4172%                                                                             %
4173%                                                                             %
4174%   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                     %
4175%                                                                             %
4176%                                                                             %
4177%                                                                             %
4178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4179%
4180%  MagickGetImageColormapColor() returns the color of the specified colormap
4181%  index.
4182%
4183%  The format of the MagickGetImageColormapColor method is:
4184%
4185%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4186%        const size_t index,PixelWand *color)
4187%
4188%  A description of each parameter follows:
4189%
4190%    o wand: the magick wand.
4191%
4192%    o index: the offset into the image colormap.
4193%
4194%    o color: Return the colormap color in this wand.
4195%
4196*/
4197WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4198  const size_t index,PixelWand *color)
4199{
4200  assert(wand != (MagickWand *) NULL);
4201  assert(wand->signature == WandSignature);
4202  if( IfMagickTrue(wand->debug) )
4203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4204
4205  if (wand->images == (Image *) NULL)
4206    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4207  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4208      (index >= wand->images->colors))
4209    {
4210      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4211        "InvalidColormapIndex","`%s'",wand->name);
4212      return(MagickFalse);
4213    }
4214  PixelSetPixelColor(color,wand->images->colormap+index);
4215  return(MagickTrue);
4216}
4217
4218/*
4219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4220%                                                                             %
4221%                                                                             %
4222%                                                                             %
4223%   M a g i c k G e t I m a g e C o l o r s                                   %
4224%                                                                             %
4225%                                                                             %
4226%                                                                             %
4227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4228%
4229%  MagickGetImageColors() gets the number of unique colors in the image.
4230%
4231%  The format of the MagickGetImageColors method is:
4232%
4233%      size_t MagickGetImageColors(MagickWand *wand)
4234%
4235%  A description of each parameter follows:
4236%
4237%    o wand: the magick wand.
4238%
4239*/
4240WandExport size_t MagickGetImageColors(MagickWand *wand)
4241{
4242  assert(wand != (MagickWand *) NULL);
4243  assert(wand->signature == WandSignature);
4244  if( IfMagickTrue(wand->debug) )
4245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246
4247  if (wand->images == (Image *) NULL)
4248    {
4249      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4250        "ContainsNoImages","`%s'",wand->name);
4251      return(0);
4252    }
4253  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4254}
4255
4256/*
4257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258%                                                                             %
4259%                                                                             %
4260%                                                                             %
4261%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4262%                                                                             %
4263%                                                                             %
4264%                                                                             %
4265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4266%
4267%  MagickGetImageColorspace() gets the image colorspace.
4268%
4269%  The format of the MagickGetImageColorspace method is:
4270%
4271%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4272%
4273%  A description of each parameter follows:
4274%
4275%    o wand: the magick wand.
4276%
4277*/
4278WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4279{
4280  assert(wand != (MagickWand *) NULL);
4281  assert(wand->signature == WandSignature);
4282  if( IfMagickTrue(wand->debug) )
4283    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284
4285  if (wand->images == (Image *) NULL)
4286    {
4287      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4288        "ContainsNoImages","`%s'",wand->name);
4289      return(UndefinedColorspace);
4290    }
4291  return(wand->images->colorspace);
4292}
4293
4294/*
4295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296%                                                                             %
4297%                                                                             %
4298%                                                                             %
4299%   M a g i c k G e t I m a g e C o m p o s e                                 %
4300%                                                                             %
4301%                                                                             %
4302%                                                                             %
4303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304%
4305%  MagickGetImageCompose() returns the composite operator associated with the
4306%  image.
4307%
4308%  The format of the MagickGetImageCompose method is:
4309%
4310%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4311%
4312%  A description of each parameter follows:
4313%
4314%    o wand: the magick wand.
4315%
4316*/
4317WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4318{
4319  assert(wand != (MagickWand *) NULL);
4320  assert(wand->signature == WandSignature);
4321  if( IfMagickTrue(wand->debug) )
4322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4323
4324  if (wand->images == (Image *) NULL)
4325    {
4326      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4327        "ContainsNoImages","`%s'",wand->name);
4328      return(UndefinedCompositeOp);
4329    }
4330  return(wand->images->compose);
4331}
4332
4333/*
4334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335%                                                                             %
4336%                                                                             %
4337%                                                                             %
4338%   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                         %
4339%                                                                             %
4340%                                                                             %
4341%                                                                             %
4342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4343%
4344%  MagickGetImageCompression() gets the image compression.
4345%
4346%  The format of the MagickGetImageCompression method is:
4347%
4348%      CompressionType MagickGetImageCompression(MagickWand *wand)
4349%
4350%  A description of each parameter follows:
4351%
4352%    o wand: the magick wand.
4353%
4354*/
4355WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4356{
4357  assert(wand != (MagickWand *) NULL);
4358  assert(wand->signature == WandSignature);
4359  if( IfMagickTrue(wand->debug) )
4360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4361
4362  if (wand->images == (Image *) NULL)
4363    {
4364      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4365        "ContainsNoImages","`%s'",wand->name);
4366      return(UndefinedCompression);
4367    }
4368  return(wand->images->compression);
4369}
4370
4371/*
4372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4373%                                                                             %
4374%                                                                             %
4375%                                                                             %
4376%   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           %
4377%                                                                             %
4378%                                                                             %
4379%                                                                             %
4380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381%
4382%  MagickGetImageCompression() gets the image compression quality.
4383%
4384%  The format of the MagickGetImageCompression method is:
4385%
4386%      size_t MagickGetImageCompression(MagickWand *wand)
4387%
4388%  A description of each parameter follows:
4389%
4390%    o wand: the magick wand.
4391%
4392*/
4393WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4394{
4395  assert(wand != (MagickWand *) NULL);
4396  assert(wand->signature == WandSignature);
4397  if( IfMagickTrue(wand->debug) )
4398    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4399
4400  if (wand->images == (Image *) NULL)
4401    {
4402      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4403        "ContainsNoImages","`%s'",wand->name);
4404      return(0UL);
4405    }
4406  return(wand->images->quality);
4407}
4408
4409/*
4410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4411%                                                                             %
4412%                                                                             %
4413%                                                                             %
4414%   M a g i c k G e t I m a g e D e l a y                                     %
4415%                                                                             %
4416%                                                                             %
4417%                                                                             %
4418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4419%
4420%  MagickGetImageDelay() gets the image delay.
4421%
4422%  The format of the MagickGetImageDelay method is:
4423%
4424%      size_t MagickGetImageDelay(MagickWand *wand)
4425%
4426%  A description of each parameter follows:
4427%
4428%    o wand: the magick wand.
4429%
4430*/
4431WandExport size_t MagickGetImageDelay(MagickWand *wand)
4432{
4433  assert(wand != (MagickWand *) NULL);
4434  assert(wand->signature == WandSignature);
4435  if( IfMagickTrue(wand->debug) )
4436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4437
4438  if (wand->images == (Image *) NULL)
4439    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4440  return(wand->images->delay);
4441}
4442
4443/*
4444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4445%                                                                             %
4446%                                                                             %
4447%                                                                             %
4448%   M a g i c k G e t I m a g e D e p t h                                     %
4449%                                                                             %
4450%                                                                             %
4451%                                                                             %
4452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4453%
4454%  MagickGetImageDepth() gets the image depth.
4455%
4456%  The format of the MagickGetImageDepth method is:
4457%
4458%      size_t MagickGetImageDepth(MagickWand *wand)
4459%
4460%  A description of each parameter follows:
4461%
4462%    o wand: the magick wand.
4463%
4464*/
4465WandExport size_t MagickGetImageDepth(MagickWand *wand)
4466{
4467  assert(wand != (MagickWand *) NULL);
4468  assert(wand->signature == WandSignature);
4469  if( IfMagickTrue(wand->debug) )
4470    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4471
4472  if (wand->images == (Image *) NULL)
4473    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4474  return(wand->images->depth);
4475}
4476
4477/*
4478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4479%                                                                             %
4480%                                                                             %
4481%                                                                             %
4482%   M a g i c k G e t I m a g e D i s p o s e                                 %
4483%                                                                             %
4484%                                                                             %
4485%                                                                             %
4486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4487%
4488%  MagickGetImageDispose() gets the image disposal method.
4489%
4490%  The format of the MagickGetImageDispose method is:
4491%
4492%      DisposeType MagickGetImageDispose(MagickWand *wand)
4493%
4494%  A description of each parameter follows:
4495%
4496%    o wand: the magick wand.
4497%
4498*/
4499WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4500{
4501  assert(wand != (MagickWand *) NULL);
4502  assert(wand->signature == WandSignature);
4503  if( IfMagickTrue(wand->debug) )
4504    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4505
4506  if (wand->images == (Image *) NULL)
4507    {
4508      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4509        "ContainsNoImages","`%s'",wand->name);
4510      return(UndefinedDispose);
4511    }
4512  return((DisposeType) wand->images->dispose);
4513}
4514
4515/*
4516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4517%                                                                             %
4518%                                                                             %
4519%                                                                             %
4520%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4521%                                                                             %
4522%                                                                             %
4523%                                                                             %
4524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4525%
4526%  MagickGetImageDistortion() compares an image to a reconstructed image and
4527%  returns the specified distortion metric.
4528%
4529%  The format of the MagickGetImageDistortion method is:
4530%
4531%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4532%        const MagickWand *reference,const MetricType metric,
4533%        double *distortion)
4534%
4535%  A description of each parameter follows:
4536%
4537%    o wand: the magick wand.
4538%
4539%    o reference: the reference wand.
4540%
4541%    o metric: the metric.
4542%
4543%    o distortion: the computed distortion between the images.
4544%
4545*/
4546WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4547  const MagickWand *reference,const MetricType metric,double *distortion)
4548{
4549  MagickBooleanType
4550    status;
4551
4552  assert(wand != (MagickWand *) NULL);
4553  assert(wand->signature == WandSignature);
4554  if( IfMagickTrue(wand->debug) )
4555    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556
4557  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4558    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4559  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4560    wand->exception);
4561  return(status);
4562}
4563
4564/*
4565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4566%                                                                             %
4567%                                                                             %
4568%                                                                             %
4569%   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                         %
4570%                                                                             %
4571%                                                                             %
4572%                                                                             %
4573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4574%
4575%  MagickGetImageDistortions() compares one or more pixel channels of an
4576%  image to a reconstructed image and returns the specified distortion metrics.
4577%
4578%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4579%
4580%  The format of the MagickGetImageDistortion method is:
4581%
4582%      double *MagickGetImageDistortion(MagickWand *wand,
4583%        const MagickWand *reference,const MetricType metric)
4584%
4585%  A description of each parameter follows:
4586%
4587%    o wand: the magick wand.
4588%
4589%    o reference: the reference wand.
4590%
4591%    o metric: the metric.
4592%
4593*/
4594WandExport double *MagickGetImageDistortions(MagickWand *wand,
4595  const MagickWand *reference,const MetricType metric)
4596{
4597  double
4598    *channel_distortion;
4599
4600  assert(wand != (MagickWand *) NULL);
4601  assert(wand->signature == WandSignature);
4602  if( IfMagickTrue(wand->debug) )
4603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4604
4605  assert(reference != (MagickWand *) NULL);
4606  assert(reference->signature == WandSignature);
4607  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4608    {
4609      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4610        "ContainsNoImages","`%s'",wand->name);
4611      return((double *) NULL);
4612    }
4613  channel_distortion=GetImageDistortions(wand->images,reference->images,
4614    metric,wand->exception);
4615  return(channel_distortion);
4616}
4617
4618/*
4619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4620%                                                                             %
4621%                                                                             %
4622%                                                                             %
4623%   M a g i c k G e t I m a g e F i l e n a m e                               %
4624%                                                                             %
4625%                                                                             %
4626%                                                                             %
4627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4628%
4629%  MagickGetImageFilename() returns the filename of a particular image in a
4630%  sequence.
4631%
4632%  The format of the MagickGetImageFilename method is:
4633%
4634%      char *MagickGetImageFilename(MagickWand *wand)
4635%
4636%  A description of each parameter follows:
4637%
4638%    o wand: the magick wand.
4639%
4640*/
4641WandExport char *MagickGetImageFilename(MagickWand *wand)
4642{
4643  assert(wand != (MagickWand *) NULL);
4644  assert(wand->signature == WandSignature);
4645  if( IfMagickTrue(wand->debug) )
4646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4647
4648  if (wand->images == (Image *) NULL)
4649    {
4650      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4651        "ContainsNoImages","`%s'",wand->name);
4652      return((char *) NULL);
4653    }
4654  return(AcquireString(wand->images->filename));
4655}
4656
4657/*
4658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4659%                                                                             %
4660%                                                                             %
4661%                                                                             %
4662%   M a g i c k G e t I m a g e F o r m a t                                   %
4663%                                                                             %
4664%                                                                             %
4665%                                                                             %
4666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4667%
4668%  MagickGetImageFormat() returns the format of a particular image in a
4669%  sequence.
4670%
4671%  The format of the MagickGetImageFormat method is:
4672%
4673%      const char *MagickGetImageFormat(MagickWand *wand)
4674%
4675%  A description of each parameter follows:
4676%
4677%    o wand: the magick wand.
4678%
4679*/
4680WandExport char *MagickGetImageFormat(MagickWand *wand)
4681{
4682  assert(wand != (MagickWand *) NULL);
4683  assert(wand->signature == WandSignature);
4684  if( IfMagickTrue(wand->debug) )
4685    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4686
4687  if (wand->images == (Image *) NULL)
4688    {
4689      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4690        "ContainsNoImages","`%s'",wand->name);
4691      return((char *) NULL);
4692    }
4693  return(AcquireString(wand->images->magick));
4694}
4695
4696/*
4697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4698%                                                                             %
4699%                                                                             %
4700%                                                                             %
4701%   M a g i c k G e t I m a g e F u z z                                       %
4702%                                                                             %
4703%                                                                             %
4704%                                                                             %
4705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4706%
4707%  MagickGetImageFuzz() gets the image fuzz.
4708%
4709%  The format of the MagickGetImageFuzz method is:
4710%
4711%      double MagickGetImageFuzz(MagickWand *wand)
4712%
4713%  A description of each parameter follows:
4714%
4715%    o wand: the magick wand.
4716%
4717*/
4718WandExport double MagickGetImageFuzz(MagickWand *wand)
4719{
4720  assert(wand != (MagickWand *) NULL);
4721  assert(wand->signature == WandSignature);
4722  if( IfMagickTrue(wand->debug) )
4723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4724
4725  if (wand->images == (Image *) NULL)
4726    {
4727      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4728        "ContainsNoImages","`%s'",wand->name);
4729      return(0.0);
4730    }
4731  return(wand->images->fuzz);
4732}
4733
4734/*
4735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4736%                                                                             %
4737%                                                                             %
4738%                                                                             %
4739%   M a g i c k G e t I m a g e G a m m a                                     %
4740%                                                                             %
4741%                                                                             %
4742%                                                                             %
4743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4744%
4745%  MagickGetImageGamma() gets the image gamma.
4746%
4747%  The format of the MagickGetImageGamma method is:
4748%
4749%      double MagickGetImageGamma(MagickWand *wand)
4750%
4751%  A description of each parameter follows:
4752%
4753%    o wand: the magick wand.
4754%
4755*/
4756WandExport double MagickGetImageGamma(MagickWand *wand)
4757{
4758  assert(wand != (MagickWand *) NULL);
4759  assert(wand->signature == WandSignature);
4760  if( IfMagickTrue(wand->debug) )
4761    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4762
4763  if (wand->images == (Image *) NULL)
4764    {
4765      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4766        "ContainsNoImages","`%s'",wand->name);
4767      return(0.0);
4768    }
4769  return(wand->images->gamma);
4770}
4771
4772/*
4773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4774%                                                                             %
4775%                                                                             %
4776%                                                                             %
4777%   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                 %
4778%                                                                             %
4779%                                                                             %
4780%                                                                             %
4781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4782%
4783%  MagickGetImageGravity() gets the image gravity.
4784%
4785%  The format of the MagickGetImageGravity method is:
4786%
4787%      GravityType MagickGetImageGravity(MagickWand *wand)
4788%
4789%  A description of each parameter follows:
4790%
4791%    o wand: the magick wand.
4792%
4793*/
4794WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4795{
4796  assert(wand != (MagickWand *) NULL);
4797  assert(wand->signature == WandSignature);
4798  if( IfMagickTrue(wand->debug) )
4799    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4800
4801  if (wand->images == (Image *) NULL)
4802    {
4803      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4804        "ContainsNoImages","`%s'",wand->name);
4805      return(UndefinedGravity);
4806    }
4807  return(wand->images->gravity);
4808}
4809
4810/*
4811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4812%                                                                             %
4813%                                                                             %
4814%                                                                             %
4815%   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                       %
4816%                                                                             %
4817%                                                                             %
4818%                                                                             %
4819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820%
4821%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4822%
4823%  The format of the MagickGetImageGreenPrimary method is:
4824%
4825%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4826%        double *y)
4827%
4828%  A description of each parameter follows:
4829%
4830%    o wand: the magick wand.
4831%
4832%    o x: the chromaticity green primary x-point.
4833%
4834%    o y: the chromaticity green primary y-point.
4835%
4836*/
4837WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4838  double *x,double *y)
4839{
4840  assert(wand != (MagickWand *) NULL);
4841  assert(wand->signature == WandSignature);
4842  if( IfMagickTrue(wand->debug) )
4843    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4844
4845  if (wand->images == (Image *) NULL)
4846    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4847  *x=wand->images->chromaticity.green_primary.x;
4848  *y=wand->images->chromaticity.green_primary.y;
4849  return(MagickTrue);
4850}
4851
4852/*
4853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854%                                                                             %
4855%                                                                             %
4856%                                                                             %
4857%   M a g i c k G e t I m a g e H e i g h t                                   %
4858%                                                                             %
4859%                                                                             %
4860%                                                                             %
4861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862%
4863%  MagickGetImageHeight() returns the image height.
4864%
4865%  The format of the MagickGetImageHeight method is:
4866%
4867%      size_t MagickGetImageHeight(MagickWand *wand)
4868%
4869%  A description of each parameter follows:
4870%
4871%    o wand: the magick wand.
4872%
4873*/
4874WandExport size_t MagickGetImageHeight(MagickWand *wand)
4875{
4876  assert(wand != (MagickWand *) NULL);
4877  assert(wand->signature == WandSignature);
4878  if( IfMagickTrue(wand->debug) )
4879    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4880
4881  if (wand->images == (Image *) NULL)
4882    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4883  return(wand->images->rows);
4884}
4885
4886/*
4887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4888%                                                                             %
4889%                                                                             %
4890%                                                                             %
4891%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4892%                                                                             %
4893%                                                                             %
4894%                                                                             %
4895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896%
4897%  MagickGetImageHistogram() returns the image histogram as an array of
4898%  PixelWand wands.
4899%
4900%  The format of the MagickGetImageHistogram method is:
4901%
4902%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4903%        size_t *number_colors)
4904%
4905%  A description of each parameter follows:
4906%
4907%    o wand: the magick wand.
4908%
4909%    o number_colors: the number of unique colors in the image and the number
4910%      of pixel wands returned.
4911%
4912*/
4913WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4914  size_t *number_colors)
4915{
4916  PixelInfo
4917    *histogram;
4918
4919  PixelWand
4920    **pixel_wands;
4921
4922  register ssize_t
4923    i;
4924
4925  assert(wand != (MagickWand *) NULL);
4926  assert(wand->signature == WandSignature);
4927  if( IfMagickTrue(wand->debug) )
4928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4929
4930  if (wand->images == (Image *) NULL)
4931    {
4932      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4933        "ContainsNoImages","`%s'",wand->name);
4934      return((PixelWand **) NULL);
4935    }
4936  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4937  if (histogram == (PixelInfo *) NULL)
4938    return((PixelWand **) NULL);
4939  pixel_wands=NewPixelWands(*number_colors);
4940  for (i=0; i < (ssize_t) *number_colors; i++)
4941  {
4942    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4943    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4944  }
4945  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4946  return(pixel_wands);
4947}
4948
4949/*
4950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951%                                                                             %
4952%                                                                             %
4953%                                                                             %
4954%   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                 %
4955%                                                                             %
4956%                                                                             %
4957%                                                                             %
4958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4959%
4960%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4961%
4962%  The format of the MagickGetImageInterlaceScheme method is:
4963%
4964%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4965%
4966%  A description of each parameter follows:
4967%
4968%    o wand: the magick wand.
4969%
4970*/
4971WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4972{
4973  assert(wand != (MagickWand *) NULL);
4974  assert(wand->signature == WandSignature);
4975  if( IfMagickTrue(wand->debug) )
4976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4977
4978  if (wand->images == (Image *) NULL)
4979    {
4980      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4981        "ContainsNoImages","`%s'",wand->name);
4982      return(UndefinedInterlace);
4983    }
4984  return(wand->images->interlace);
4985}
4986
4987/*
4988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4989%                                                                             %
4990%                                                                             %
4991%                                                                             %
4992%   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             %
4993%                                                                             %
4994%                                                                             %
4995%                                                                             %
4996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4997%
4998%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4999%  sepcified image.
5000%
5001%  The format of the MagickGetImageInterpolateMethod method is:
5002%
5003%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5004%        MagickWand *wand)
5005%
5006%  A description of each parameter follows:
5007%
5008%    o wand: the magick wand.
5009%
5010*/
5011WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5012  MagickWand *wand)
5013{
5014  assert(wand != (MagickWand *) NULL);
5015  assert(wand->signature == WandSignature);
5016  if( IfMagickTrue(wand->debug) )
5017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5018
5019  if (wand->images == (Image *) NULL)
5020    {
5021      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5022        "ContainsNoImages","`%s'",wand->name);
5023      return(UndefinedInterpolatePixel);
5024    }
5025  return(wand->images->interpolate);
5026}
5027
5028/*
5029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5030%                                                                             %
5031%                                                                             %
5032%                                                                             %
5033%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5034%                                                                             %
5035%                                                                             %
5036%                                                                             %
5037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5038%
5039%  MagickGetImageIterations() gets the image iterations.
5040%
5041%  The format of the MagickGetImageIterations method is:
5042%
5043%      size_t MagickGetImageIterations(MagickWand *wand)
5044%
5045%  A description of each parameter follows:
5046%
5047%    o wand: the magick wand.
5048%
5049*/
5050WandExport size_t MagickGetImageIterations(MagickWand *wand)
5051{
5052  assert(wand != (MagickWand *) NULL);
5053  assert(wand->signature == WandSignature);
5054  if( IfMagickTrue(wand->debug) )
5055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5056
5057  if (wand->images == (Image *) NULL)
5058    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5059  return(wand->images->iterations);
5060}
5061
5062/*
5063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5064%                                                                             %
5065%                                                                             %
5066%                                                                             %
5067%   M a g i c k G e t I m a g e L e n g t h                                   %
5068%                                                                             %
5069%                                                                             %
5070%                                                                             %
5071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5072%
5073%  MagickGetImageLength() returns the image length in bytes.
5074%
5075%  The format of the MagickGetImageLength method is:
5076%
5077%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5078%        MagickSizeType *length)
5079%
5080%  A description of each parameter follows:
5081%
5082%    o wand: the magick wand.
5083%
5084%    o length: the image length in bytes.
5085%
5086*/
5087WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5088  MagickSizeType *length)
5089{
5090  assert(wand != (MagickWand *) NULL);
5091  assert(wand->signature == WandSignature);
5092  if( IfMagickTrue(wand->debug) )
5093    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5094
5095  if (wand->images == (Image *) NULL)
5096    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5097  *length=GetBlobSize(wand->images);
5098  return(MagickTrue);
5099}
5100
5101/*
5102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5103%                                                                             %
5104%                                                                             %
5105%                                                                             %
5106%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5107%                                                                             %
5108%                                                                             %
5109%                                                                             %
5110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5111%
5112%  MagickGetImageMatteColor() returns the image matte color.
5113%
5114%  The format of the MagickGetImageMatteColor method is:
5115%
5116%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5117%        PixelWand *matte_color)
5118%
5119%  A description of each parameter follows:
5120%
5121%    o wand: the magick wand.
5122%
5123%    o matte_color: Return the matte color.
5124%
5125*/
5126WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5127  PixelWand *matte_color)
5128{
5129  assert(wand != (MagickWand *) NULL);
5130  assert(wand->signature == WandSignature);
5131  if( IfMagickTrue(wand->debug) )
5132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5133
5134  if (wand->images == (Image *) NULL)
5135    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5136  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5137  return(MagickTrue);
5138}
5139
5140/*
5141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5142%                                                                             %
5143%                                                                             %
5144%                                                                             %
5145%   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                         %
5146%                                                                             %
5147%                                                                             %
5148%                                                                             %
5149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5150%
5151%  MagickGetImageOrientation() returns the image orientation.
5152%
5153%  The format of the MagickGetImageOrientation method is:
5154%
5155%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5156%
5157%  A description of each parameter follows:
5158%
5159%    o wand: the magick wand.
5160%
5161*/
5162WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5163{
5164  assert(wand != (MagickWand *) NULL);
5165  assert(wand->signature == WandSignature);
5166  if( IfMagickTrue(wand->debug) )
5167    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5168
5169  if (wand->images == (Image *) NULL)
5170    {
5171      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5172        "ContainsNoImages","`%s'",wand->name);
5173      return(UndefinedOrientation);
5174    }
5175  return(wand->images->orientation);
5176}
5177
5178/*
5179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5180%                                                                             %
5181%                                                                             %
5182%                                                                             %
5183%   M a g i c k G e t I m a g e P a g e                                       %
5184%                                                                             %
5185%                                                                             %
5186%                                                                             %
5187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5188%
5189%  MagickGetImagePage() returns the page geometry associated with the image.
5190%
5191%  The format of the MagickGetImagePage method is:
5192%
5193%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5194%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5195%
5196%  A description of each parameter follows:
5197%
5198%    o wand: the magick wand.
5199%
5200%    o width: the page width.
5201%
5202%    o height: the page height.
5203%
5204%    o x: the page x-offset.
5205%
5206%    o y: the page y-offset.
5207%
5208*/
5209WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5210  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5211{
5212  assert(wand != (const MagickWand *) NULL);
5213  assert(wand->signature == WandSignature);
5214  if( IfMagickTrue(wand->debug) )
5215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5216
5217  if (wand->images == (Image *) NULL)
5218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5219  *width=wand->images->page.width;
5220  *height=wand->images->page.height;
5221  *x=wand->images->page.x;
5222  *y=wand->images->page.y;
5223  return(MagickTrue);
5224}
5225
5226/*
5227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5228%                                                                             %
5229%                                                                             %
5230%                                                                             %
5231%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5232%                                                                             %
5233%                                                                             %
5234%                                                                             %
5235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236%
5237%  MagickGetImagePixelColor() returns the color of the specified pixel.
5238%
5239%  The format of the MagickGetImagePixelColor method is:
5240%
5241%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5242%        const ssize_t x,const ssize_t y,PixelWand *color)
5243%
5244%  A description of each parameter follows:
5245%
5246%    o wand: the magick wand.
5247%
5248%    o x,y: the pixel offset into the image.
5249%
5250%    o color: Return the colormap color in this wand.
5251%
5252*/
5253WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5254  const ssize_t x,const ssize_t y,PixelWand *color)
5255{
5256  register const Quantum
5257    *p;
5258
5259  CacheView
5260    *image_view;
5261
5262  assert(wand != (MagickWand *) NULL);
5263  assert(wand->signature == WandSignature);
5264  if( IfMagickTrue(wand->debug) )
5265    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5266
5267  if (wand->images == (Image *) NULL)
5268    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5269  image_view=AcquireCacheView(wand->images);
5270  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5271  if (p == (const Quantum *) NULL)
5272    {
5273      image_view=DestroyCacheView(image_view);
5274      return(MagickFalse);
5275    }
5276  PixelSetQuantumPixel(wand->images,p,color);
5277  image_view=DestroyCacheView(image_view);
5278  return(MagickTrue);
5279}
5280
5281/*
5282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283%                                                                             %
5284%                                                                             %
5285%                                                                             %
5286%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5287%                                                                             %
5288%                                                                             %
5289%                                                                             %
5290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5291%
5292%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5293%
5294%  The format of the MagickGetImageRedPrimary method is:
5295%
5296%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5297%        double *y)
5298%
5299%  A description of each parameter follows:
5300%
5301%    o wand: the magick wand.
5302%
5303%    o x: the chromaticity red primary x-point.
5304%
5305%    o y: the chromaticity red primary y-point.
5306%
5307*/
5308WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5309  double *x,double *y)
5310{
5311  assert(wand != (MagickWand *) NULL);
5312  assert(wand->signature == WandSignature);
5313  if( IfMagickTrue(wand->debug) )
5314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5315
5316  if (wand->images == (Image *) NULL)
5317    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5318  *x=wand->images->chromaticity.red_primary.x;
5319  *y=wand->images->chromaticity.red_primary.y;
5320  return(MagickTrue);
5321}
5322
5323/*
5324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5325%                                                                             %
5326%                                                                             %
5327%                                                                             %
5328%   M a g i c k G e t I m a g e R e g i o n                                   %
5329%                                                                             %
5330%                                                                             %
5331%                                                                             %
5332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5333%
5334%  MagickGetImageRegion() extracts a region of the image and returns it as a
5335%  a new wand.
5336%
5337%  The format of the MagickGetImageRegion method is:
5338%
5339%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5340%        const size_t width,const size_t height,const ssize_t x,
5341%        const ssize_t y)
5342%
5343%  A description of each parameter follows:
5344%
5345%    o wand: the magick wand.
5346%
5347%    o width: the region width.
5348%
5349%    o height: the region height.
5350%
5351%    o x: the region x offset.
5352%
5353%    o y: the region y offset.
5354%
5355*/
5356WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5357  const size_t width,const size_t height,const ssize_t x,
5358  const ssize_t y)
5359{
5360  Image
5361    *region_image;
5362
5363  RectangleInfo
5364    region;
5365
5366  assert(wand != (MagickWand *) NULL);
5367  assert(wand->signature == WandSignature);
5368  if( IfMagickTrue(wand->debug) )
5369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5370
5371  if (wand->images == (Image *) NULL)
5372    return((MagickWand *) NULL);
5373  region.width=width;
5374  region.height=height;
5375  region.x=x;
5376  region.y=y;
5377  region_image=CropImage(wand->images,&region,wand->exception);
5378  if (region_image == (Image *) NULL)
5379    return((MagickWand *) NULL);
5380  return(CloneMagickWandFromImages(wand,region_image));
5381}
5382
5383/*
5384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5385%                                                                             %
5386%                                                                             %
5387%                                                                             %
5388%   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                 %
5389%                                                                             %
5390%                                                                             %
5391%                                                                             %
5392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5393%
5394%  MagickGetImageRenderingIntent() gets the image rendering intent.
5395%
5396%  The format of the MagickGetImageRenderingIntent method is:
5397%
5398%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5399%
5400%  A description of each parameter follows:
5401%
5402%    o wand: the magick wand.
5403%
5404*/
5405WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5406{
5407  assert(wand != (MagickWand *) NULL);
5408  assert(wand->signature == WandSignature);
5409  if( IfMagickTrue(wand->debug) )
5410    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5411
5412  if (wand->images == (Image *) NULL)
5413    {
5414      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5415        "ContainsNoImages","`%s'",wand->name);
5416      return(UndefinedIntent);
5417    }
5418  return((RenderingIntent) wand->images->rendering_intent);
5419}
5420
5421/*
5422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5423%                                                                             %
5424%                                                                             %
5425%                                                                             %
5426%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5427%                                                                             %
5428%                                                                             %
5429%                                                                             %
5430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5431%
5432%  MagickGetImageResolution() gets the image X and Y resolution.
5433%
5434%  The format of the MagickGetImageResolution method is:
5435%
5436%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5437%        double *y)
5438%
5439%  A description of each parameter follows:
5440%
5441%    o wand: the magick wand.
5442%
5443%    o x: the image x-resolution.
5444%
5445%    o y: the image y-resolution.
5446%
5447*/
5448WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5449  double *x,double *y)
5450{
5451  assert(wand != (MagickWand *) NULL);
5452  assert(wand->signature == WandSignature);
5453  if( IfMagickTrue(wand->debug) )
5454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5455
5456  if (wand->images == (Image *) NULL)
5457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5458  *x=wand->images->resolution.x;
5459  *y=wand->images->resolution.y;
5460  return(MagickTrue);
5461}
5462
5463/*
5464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5465%                                                                             %
5466%                                                                             %
5467%                                                                             %
5468%   M a g i c k G e t I m a g e S c e n e                                     %
5469%                                                                             %
5470%                                                                             %
5471%                                                                             %
5472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5473%
5474%  MagickGetImageScene() gets the image scene.
5475%
5476%  The format of the MagickGetImageScene method is:
5477%
5478%      size_t MagickGetImageScene(MagickWand *wand)
5479%
5480%  A description of each parameter follows:
5481%
5482%    o wand: the magick wand.
5483%
5484*/
5485WandExport size_t MagickGetImageScene(MagickWand *wand)
5486{
5487  assert(wand != (MagickWand *) NULL);
5488  assert(wand->signature == WandSignature);
5489  if( IfMagickTrue(wand->debug) )
5490    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5491
5492  if (wand->images == (Image *) NULL)
5493    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5494  return(wand->images->scene);
5495}
5496
5497/*
5498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5499%                                                                             %
5500%                                                                             %
5501%                                                                             %
5502%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5503%                                                                             %
5504%                                                                             %
5505%                                                                             %
5506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5507%
5508%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5509%  pixel stream.
5510%
5511%  The format of the MagickGetImageSignature method is:
5512%
5513%      const char MagickGetImageSignature(MagickWand *wand)
5514%
5515%  A description of each parameter follows:
5516%
5517%    o wand: the magick wand.
5518%
5519*/
5520WandExport char *MagickGetImageSignature(MagickWand *wand)
5521{
5522  const char
5523    *value;
5524
5525  MagickBooleanType
5526    status;
5527
5528  assert(wand != (MagickWand *) NULL);
5529  assert(wand->signature == WandSignature);
5530  if( IfMagickTrue(wand->debug) )
5531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5532
5533  if (wand->images == (Image *) NULL)
5534    {
5535      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5536        "ContainsNoImages","`%s'",wand->name);
5537      return((char *) NULL);
5538    }
5539  status=SignatureImage(wand->images,wand->exception);
5540  if( IfMagickFalse(status) )
5541    return((char *) NULL);
5542  value=GetImageProperty(wand->images,"signature",wand->exception);
5543  if (value == (const char *) NULL)
5544    return((char *) NULL);
5545  return(AcquireString(value));
5546}
5547
5548/*
5549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5550%                                                                             %
5551%                                                                             %
5552%                                                                             %
5553%   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                   %
5554%                                                                             %
5555%                                                                             %
5556%                                                                             %
5557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5558%
5559%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5560%
5561%  The format of the MagickGetImageTicksPerSecond method is:
5562%
5563%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5564%
5565%  A description of each parameter follows:
5566%
5567%    o wand: the magick wand.
5568%
5569*/
5570WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5571{
5572  assert(wand != (MagickWand *) NULL);
5573  assert(wand->signature == WandSignature);
5574  if( IfMagickTrue(wand->debug) )
5575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5576
5577  if (wand->images == (Image *) NULL)
5578    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5579  return((size_t) wand->images->ticks_per_second);
5580}
5581
5582/*
5583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584%                                                                             %
5585%                                                                             %
5586%                                                                             %
5587%   M a g i c k G e t I m a g e T y p e                                       %
5588%                                                                             %
5589%                                                                             %
5590%                                                                             %
5591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592%
5593%  MagickGetImageType() gets the potential image type:
5594%
5595%        Bilevel        Grayscale       GrayscaleMatte
5596%        Palette        PaletteMatte    TrueColor
5597%        TrueColorMatte ColorSeparation ColorSeparationMatte
5598%
5599%  To ensure the image type matches its potential, use MagickSetImageType():
5600%
5601%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5602%
5603%  The format of the MagickGetImageType method is:
5604%
5605%      ImageType MagickGetImageType(MagickWand *wand)
5606%
5607%  A description of each parameter follows:
5608%
5609%    o wand: the magick wand.
5610%
5611*/
5612WandExport ImageType MagickGetImageType(MagickWand *wand)
5613{
5614  assert(wand != (MagickWand *) NULL);
5615  assert(wand->signature == WandSignature);
5616  if( IfMagickTrue(wand->debug) )
5617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5618
5619  if (wand->images == (Image *) NULL)
5620    {
5621      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5622        "ContainsNoImages","`%s'",wand->name);
5623      return(UndefinedType);
5624    }
5625  return(GetImageType(wand->images,wand->exception));
5626}
5627
5628/*
5629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5630%                                                                             %
5631%                                                                             %
5632%                                                                             %
5633%   M a g i c k G e t I m a g e U n i t s                                     %
5634%                                                                             %
5635%                                                                             %
5636%                                                                             %
5637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638%
5639%  MagickGetImageUnits() gets the image units of resolution.
5640%
5641%  The format of the MagickGetImageUnits method is:
5642%
5643%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5644%
5645%  A description of each parameter follows:
5646%
5647%    o wand: the magick wand.
5648%
5649*/
5650WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5651{
5652  assert(wand != (MagickWand *) NULL);
5653  assert(wand->signature == WandSignature);
5654  if( IfMagickTrue(wand->debug) )
5655    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5656
5657  if (wand->images == (Image *) NULL)
5658    {
5659      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5660        "ContainsNoImages","`%s'",wand->name);
5661      return(UndefinedResolution);
5662    }
5663  return(wand->images->units);
5664}
5665
5666/*
5667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5668%                                                                             %
5669%                                                                             %
5670%                                                                             %
5671%   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           %
5672%                                                                             %
5673%                                                                             %
5674%                                                                             %
5675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5676%
5677%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5678%  sepcified image.
5679%
5680%  The format of the MagickGetImageVirtualPixelMethod method is:
5681%
5682%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5683%
5684%  A description of each parameter follows:
5685%
5686%    o wand: the magick wand.
5687%
5688*/
5689WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5690{
5691  assert(wand != (MagickWand *) NULL);
5692  assert(wand->signature == WandSignature);
5693  if( IfMagickTrue(wand->debug) )
5694    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5695
5696  if (wand->images == (Image *) NULL)
5697    {
5698      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5699        "ContainsNoImages","`%s'",wand->name);
5700      return(UndefinedVirtualPixelMethod);
5701    }
5702  return(GetImageVirtualPixelMethod(wand->images));
5703}
5704
5705/*
5706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5707%                                                                             %
5708%                                                                             %
5709%                                                                             %
5710%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5711%                                                                             %
5712%                                                                             %
5713%                                                                             %
5714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5715%
5716%  MagickGetImageWhitePoint() returns the chromaticy white point.
5717%
5718%  The format of the MagickGetImageWhitePoint method is:
5719%
5720%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5721%        double *y)
5722%
5723%  A description of each parameter follows:
5724%
5725%    o wand: the magick wand.
5726%
5727%    o x: the chromaticity white x-point.
5728%
5729%    o y: the chromaticity white y-point.
5730%
5731*/
5732WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5733  double *x,double *y)
5734{
5735  assert(wand != (MagickWand *) NULL);
5736  assert(wand->signature == WandSignature);
5737  if( IfMagickTrue(wand->debug) )
5738    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5739
5740  if (wand->images == (Image *) NULL)
5741    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5742  *x=wand->images->chromaticity.white_point.x;
5743  *y=wand->images->chromaticity.white_point.y;
5744  return(MagickTrue);
5745}
5746
5747/*
5748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5749%                                                                             %
5750%                                                                             %
5751%                                                                             %
5752%   M a g i c k G e t I m a g e W i d t h                                     %
5753%                                                                             %
5754%                                                                             %
5755%                                                                             %
5756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5757%
5758%  MagickGetImageWidth() returns the image width.
5759%
5760%  The format of the MagickGetImageWidth method is:
5761%
5762%      size_t MagickGetImageWidth(MagickWand *wand)
5763%
5764%  A description of each parameter follows:
5765%
5766%    o wand: the magick wand.
5767%
5768*/
5769WandExport size_t MagickGetImageWidth(MagickWand *wand)
5770{
5771  assert(wand != (MagickWand *) NULL);
5772  assert(wand->signature == WandSignature);
5773  if( IfMagickTrue(wand->debug) )
5774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5775
5776  if (wand->images == (Image *) NULL)
5777    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5778  return(wand->images->columns);
5779}
5780
5781/*
5782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5783%                                                                             %
5784%                                                                             %
5785%                                                                             %
5786%   M a g i c k G e t N u m b e r I m a g e s                                 %
5787%                                                                             %
5788%                                                                             %
5789%                                                                             %
5790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5791%
5792%  MagickGetNumberImages() returns the number of images associated with a
5793%  magick wand.
5794%
5795%  The format of the MagickGetNumberImages method is:
5796%
5797%      size_t MagickGetNumberImages(MagickWand *wand)
5798%
5799%  A description of each parameter follows:
5800%
5801%    o wand: the magick wand.
5802%
5803*/
5804WandExport size_t MagickGetNumberImages(MagickWand *wand)
5805{
5806  assert(wand != (MagickWand *) NULL);
5807  assert(wand->signature == WandSignature);
5808  if( IfMagickTrue(wand->debug) )
5809    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5810
5811  return(GetImageListLength(wand->images));
5812}
5813
5814/*
5815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5816%                                                                             %
5817%                                                                             %
5818%                                                                             %
5819%   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                 %
5820%                                                                             %
5821%                                                                             %
5822%                                                                             %
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824%
5825%  MagickGetImageTotalInkDensity() gets the image total ink density.
5826%
5827%  The format of the MagickGetImageTotalInkDensity method is:
5828%
5829%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5830%
5831%  A description of each parameter follows:
5832%
5833%    o wand: the magick wand.
5834%
5835*/
5836WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5837{
5838  assert(wand != (MagickWand *) NULL);
5839  assert(wand->signature == WandSignature);
5840  if( IfMagickTrue(wand->debug) )
5841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5842
5843  if (wand->images == (Image *) NULL)
5844    {
5845      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5846        "ContainsNoImages","`%s'",wand->name);
5847      return(0.0);
5848    }
5849  return(GetImageTotalInkDensity(wand->images,wand->exception));
5850}
5851
5852/*
5853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854%                                                                             %
5855%                                                                             %
5856%                                                                             %
5857%   M a g i c k H a l d C l u t I m a g e                                     %
5858%                                                                             %
5859%                                                                             %
5860%                                                                             %
5861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5862%
5863%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5864%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5865%  dimensions.  Create it with the HALD coder.  You can apply any color
5866%  transformation to the Hald image and then use this method to apply the
5867%  transform to the image.
5868%
5869%  The format of the MagickHaldClutImage method is:
5870%
5871%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5872%        const MagickWand *hald_wand)
5873%
5874%  A description of each parameter follows:
5875%
5876%    o wand: the magick wand.
5877%
5878%    o hald_image: the hald CLUT image.
5879%
5880*/
5881WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5882  const MagickWand *hald_wand)
5883{
5884  MagickBooleanType
5885    status;
5886
5887  assert(wand != (MagickWand *) NULL);
5888  assert(wand->signature == WandSignature);
5889  if( IfMagickTrue(wand->debug) )
5890    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5891
5892  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5893    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5894  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5895  return(status);
5896}
5897
5898/*
5899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5900%                                                                             %
5901%                                                                             %
5902%                                                                             %
5903%   M a g i c k H a s N e x t I m a g e                                       %
5904%                                                                             %
5905%                                                                             %
5906%                                                                             %
5907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5908%
5909%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5910%  traversing the list in the forward direction
5911%
5912%  The format of the MagickHasNextImage method is:
5913%
5914%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5915%
5916%  A description of each parameter follows:
5917%
5918%    o wand: the magick wand.
5919%
5920*/
5921WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5922{
5923  assert(wand != (MagickWand *) NULL);
5924  assert(wand->signature == WandSignature);
5925  if( IfMagickTrue(wand->debug) )
5926    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5927
5928  if (wand->images == (Image *) NULL)
5929    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5930  if (GetNextImageInList(wand->images) == (Image *) NULL)
5931    return(MagickFalse);
5932  return(MagickTrue);
5933}
5934
5935/*
5936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5937%                                                                             %
5938%                                                                             %
5939%                                                                             %
5940%   M a g i c k H a s P r e v i o u s I m a g e                               %
5941%                                                                             %
5942%                                                                             %
5943%                                                                             %
5944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5945%
5946%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5947%  traversing the list in the reverse direction
5948%
5949%  The format of the MagickHasPreviousImage method is:
5950%
5951%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5952%
5953%  A description of each parameter follows:
5954%
5955%    o wand: the magick wand.
5956%
5957*/
5958WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5959{
5960  assert(wand != (MagickWand *) NULL);
5961  assert(wand->signature == WandSignature);
5962  if( IfMagickTrue(wand->debug) )
5963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5964
5965  if (wand->images == (Image *) NULL)
5966    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5967  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5968    return(MagickFalse);
5969  return(MagickTrue);
5970}
5971
5972/*
5973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5974%                                                                             %
5975%                                                                             %
5976%                                                                             %
5977%   M a g i c k I d e n t i f y I m a g e                                     %
5978%                                                                             %
5979%                                                                             %
5980%                                                                             %
5981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982%
5983%  MagickIdentifyImage() identifies an image by printing its attributes to the
5984%  file.  Attributes include the image width, height, size, and others.
5985%
5986%  The format of the MagickIdentifyImage method is:
5987%
5988%      const char *MagickIdentifyImage(MagickWand *wand)
5989%
5990%  A description of each parameter follows:
5991%
5992%    o wand: the magick wand.
5993%
5994*/
5995WandExport char *MagickIdentifyImage(MagickWand *wand)
5996{
5997  char
5998    *description,
5999    filename[MaxTextExtent];
6000
6001  FILE
6002    *file;
6003
6004  int
6005    unique_file;
6006
6007  assert(wand != (MagickWand *) NULL);
6008  assert(wand->signature == WandSignature);
6009  if( IfMagickTrue(wand->debug) )
6010    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6011
6012  if (wand->images == (Image *) NULL)
6013    {
6014      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6015        "ContainsNoImages","`%s'",wand->name);
6016      return((char *) NULL);
6017    }
6018  description=(char *) NULL;
6019  unique_file=AcquireUniqueFileResource(filename);
6020  file=(FILE *) NULL;
6021  if (unique_file != -1)
6022    file=fdopen(unique_file,"wb");
6023  if ((unique_file == -1) || (file == (FILE *) NULL))
6024    {
6025      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6026        "UnableToCreateTemporaryFile","`%s'",wand->name);
6027      return((char *) NULL);
6028    }
6029  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6030  (void) fclose(file);
6031  description=FileToString(filename,~0,wand->exception);
6032  (void) RelinquishUniqueFileResource(filename);
6033  return(description);
6034}
6035
6036/*
6037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6038%                                                                             %
6039%                                                                             %
6040%                                                                             %
6041%   M a g i c k I m p l o d e I m a g e                                       %
6042%                                                                             %
6043%                                                                             %
6044%                                                                             %
6045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6046%
6047%  MagickImplodeImage() creates a new image that is a copy of an existing
6048%  one with the image pixels "implode" by the specified percentage.  It
6049%  allocates the memory necessary for the new Image structure and returns a
6050%  pointer to the new image.
6051%
6052%  The format of the MagickImplodeImage method is:
6053%
6054%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6055%        const double radius,const PixelInterpolateMethod method)
6056%
6057%  A description of each parameter follows:
6058%
6059%    o wand: the magick wand.
6060%
6061%    o amount: Define the extent of the implosion.
6062%
6063%    o method: the pixel interpolation method.
6064%
6065*/
6066WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6067  const double amount,const PixelInterpolateMethod method)
6068{
6069  Image
6070    *implode_image;
6071
6072  assert(wand != (MagickWand *) NULL);
6073  assert(wand->signature == WandSignature);
6074  if( IfMagickTrue(wand->debug) )
6075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6076
6077  if (wand->images == (Image *) NULL)
6078    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6079  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6080  if (implode_image == (Image *) NULL)
6081    return(MagickFalse);
6082  ReplaceImageInList(&wand->images,implode_image);
6083  return(MagickTrue);
6084}
6085
6086/*
6087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6088%                                                                             %
6089%                                                                             %
6090%                                                                             %
6091%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6092%                                                                             %
6093%                                                                             %
6094%                                                                             %
6095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6096%
6097%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6098%  location you specify.  The method returns MagickFalse on success otherwise
6099%  MagickTrue if an error is encountered.  The pixel data can be either char,
6100%  short int, int, ssize_t, float, or double in the order specified by map.
6101%
6102%  Suppose your want to upload the first scanline of a 640x480 image from
6103%  character data in red-green-blue order:
6104%
6105%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6106%
6107%  The format of the MagickImportImagePixels method is:
6108%
6109%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6110%        const ssize_t x,const ssize_t y,const size_t columns,
6111%        const size_t rows,const char *map,const StorageType storage,
6112%        const void *pixels)
6113%
6114%  A description of each parameter follows:
6115%
6116%    o wand: the magick wand.
6117%
6118%    o x, y, columns, rows:  These values define the perimeter of a region
6119%      of pixels you want to define.
6120%
6121%    o map:  This string reflects the expected ordering of the pixel array.
6122%      It can be any combination or order of R = red, G = green, B = blue,
6123%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6124%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6125%      P = pad.
6126%
6127%    o storage: Define the data type of the pixels.  Float and double types are
6128%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6129%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6130%      or DoublePixel.
6131%
6132%    o pixels: This array of values contain the pixel components as defined by
6133%      map and type.  You must preallocate this array where the expected
6134%      length varies depending on the values of width, height, map, and type.
6135%
6136*/
6137WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6138  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6139  const char *map,const StorageType storage,const void *pixels)
6140{
6141  MagickBooleanType
6142    status;
6143
6144  assert(wand != (MagickWand *) NULL);
6145  assert(wand->signature == WandSignature);
6146  if( IfMagickTrue(wand->debug) )
6147    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6148
6149  if (wand->images == (Image *) NULL)
6150    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6151  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6152    wand->exception);
6153  return(status);
6154}
6155
6156/*
6157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6158%                                                                             %
6159%                                                                             %
6160%                                                                             %
6161%   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               %
6162%                                                                             %
6163%                                                                             %
6164%                                                                             %
6165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6166%
6167%  MagickInterpolativeResizeImage() resize image using a interpolative
6168%  method.
6169%
6170%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6171%        const size_t columns,const size_t rows,
6172%        const PixelInterpolateMethod method)
6173%
6174%  A description of each parameter follows:
6175%
6176%    o wand: the magick wand.
6177%
6178%    o columns: the number of columns in the scaled image.
6179%
6180%    o rows: the number of rows in the scaled image.
6181%
6182%    o interpolate: the pixel interpolation method.
6183%
6184*/
6185WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6186  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6187{
6188  Image
6189    *resize_image;
6190
6191  assert(wand != (MagickWand *) NULL);
6192  assert(wand->signature == WandSignature);
6193  if( IfMagickTrue(wand->debug) )
6194    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6195
6196  if (wand->images == (Image *) NULL)
6197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6198  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6199    wand->exception);
6200  if (resize_image == (Image *) NULL)
6201    return(MagickFalse);
6202  ReplaceImageInList(&wand->images,resize_image);
6203  return(MagickTrue);
6204}
6205
6206/*
6207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6208%                                                                             %
6209%                                                                             %
6210%                                                                             %
6211%   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       %
6212%                                                                             %
6213%                                                                             %
6214%                                                                             %
6215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6216%
6217%  MagickInverseFourierTransformImage() implements the inverse discrete
6218%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6219%  imaginary image pair.
6220%
6221%  The format of the MagickInverseFourierTransformImage method is:
6222%
6223%      MagickBooleanType MagickInverseFourierTransformImage(
6224%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6225%        const MagickBooleanType magnitude)
6226%
6227%  A description of each parameter follows:
6228%
6229%    o magnitude_wand: the magnitude or real wand.
6230%
6231%    o phase_wand: the phase or imaginary wand.
6232%
6233%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6234%      imaginary image pair.
6235%
6236*/
6237WandExport MagickBooleanType MagickInverseFourierTransformImage(
6238  MagickWand *magnitude_wand,MagickWand *phase_wand,
6239  const MagickBooleanType magnitude)
6240{
6241  Image
6242    *inverse_image;
6243
6244  MagickWand
6245    *wand;
6246
6247  assert(magnitude_wand != (MagickWand *) NULL);
6248  assert(magnitude_wand->signature == WandSignature);
6249  if( IfMagickTrue(magnitude_wand->debug) )
6250    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6251
6252      magnitude_wand->name);
6253  wand=magnitude_wand;
6254  if (magnitude_wand->images == (Image *) NULL)
6255    ThrowWandException(WandError,"ContainsNoImages",
6256      magnitude_wand->name);
6257  assert(phase_wand != (MagickWand *) NULL);
6258  assert(phase_wand->signature == WandSignature);
6259  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6260    phase_wand->images,magnitude,wand->exception);
6261  if (inverse_image == (Image *) NULL)
6262    return(MagickFalse);
6263  ReplaceImageInList(&wand->images,inverse_image);
6264  return(MagickTrue);
6265}
6266
6267/*
6268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6269%                                                                             %
6270%                                                                             %
6271%                                                                             %
6272%   M a g i c k L a b e l I m a g e                                           %
6273%                                                                             %
6274%                                                                             %
6275%                                                                             %
6276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6277%
6278%  MagickLabelImage() adds a label to your image.
6279%
6280%  The format of the MagickLabelImage method is:
6281%
6282%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6283%
6284%  A description of each parameter follows:
6285%
6286%    o wand: the magick wand.
6287%
6288%    o label: the image label.
6289%
6290*/
6291WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6292  const char *label)
6293{
6294  MagickBooleanType
6295    status;
6296
6297  assert(wand != (MagickWand *) NULL);
6298  assert(wand->signature == WandSignature);
6299  if( IfMagickTrue(wand->debug) )
6300    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6301
6302  if (wand->images == (Image *) NULL)
6303    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6304  status=SetImageProperty(wand->images,"label",label,wand->exception);
6305  return(status);
6306}
6307
6308/*
6309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6310%                                                                             %
6311%                                                                             %
6312%                                                                             %
6313%   M a g i c k L e v e l I m a g e                                           %
6314%                                                                             %
6315%                                                                             %
6316%                                                                             %
6317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6318%
6319%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6320%  falling between specified white and black points to the full available
6321%  quantum range. The parameters provided represent the black, mid, and white
6322%  points. The black point specifies the darkest color in the image. Colors
6323%  darker than the black point are set to zero. Mid point specifies a gamma
6324%  correction to apply to the image.  White point specifies the lightest color
6325%  in the image. Colors brighter than the white point are set to the maximum
6326%  quantum value.
6327%
6328%  The format of the MagickLevelImage method is:
6329%
6330%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6331%        const double black_point,const double gamma,const double white_point)
6332%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6333%        const ChannelType channel,const double black_point,const double gamma,
6334%        const double white_point)
6335%
6336%  A description of each parameter follows:
6337%
6338%    o wand: the magick wand.
6339%
6340%    o channel: Identify which channel to level: RedPixelChannel,
6341%      GreenPixelChannel, etc.
6342%
6343%    o black_point: the black point.
6344%
6345%    o gamma: the gamma.
6346%
6347%    o white_point: the white point.
6348%
6349*/
6350WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6351  const double black_point,const double gamma,const double white_point)
6352{
6353  MagickBooleanType
6354    status;
6355
6356  assert(wand != (MagickWand *) NULL);
6357  assert(wand->signature == WandSignature);
6358  if( IfMagickTrue(wand->debug) )
6359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6360
6361  if (wand->images == (Image *) NULL)
6362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6363  status=LevelImage(wand->images,black_point,white_point,gamma,
6364    wand->exception);
6365  return(status);
6366}
6367
6368/*
6369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6370%                                                                             %
6371%                                                                             %
6372%                                                                             %
6373%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6374%                                                                             %
6375%                                                                             %
6376%                                                                             %
6377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6378%
6379%  MagickLinearStretchImage() stretches with saturation the image intensity.
6380%
6381%  You can also reduce the influence of a particular channel with a gamma
6382%  value of 0.
6383%
6384%  The format of the MagickLinearStretchImage method is:
6385%
6386%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6387%        const double black_point,const double white_point)
6388%
6389%  A description of each parameter follows:
6390%
6391%    o wand: the magick wand.
6392%
6393%    o black_point: the black point.
6394%
6395%    o white_point: the white point.
6396%
6397*/
6398WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6399  const double black_point,const double white_point)
6400{
6401  MagickBooleanType
6402    status;
6403
6404  assert(wand != (MagickWand *) NULL);
6405  assert(wand->signature == WandSignature);
6406  if( IfMagickTrue(wand->debug) )
6407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6408
6409  if (wand->images == (Image *) NULL)
6410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6411  status=LinearStretchImage(wand->images,black_point,white_point,
6412    wand->exception);
6413  return(status);
6414}
6415
6416/*
6417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418%                                                                             %
6419%                                                                             %
6420%                                                                             %
6421%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6422%                                                                             %
6423%                                                                             %
6424%                                                                             %
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%
6427%  MagickLiquidRescaleImage() rescales image with seam carving.
6428%
6429%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6430%        const size_t columns,const size_t rows,
6431%        const double delta_x,const double rigidity)
6432%
6433%  A description of each parameter follows:
6434%
6435%    o wand: the magick wand.
6436%
6437%    o columns: the number of columns in the scaled image.
6438%
6439%    o rows: the number of rows in the scaled image.
6440%
6441%    o delta_x: maximum seam transversal step (0 means straight seams).
6442%
6443%    o rigidity: introduce a bias for non-straight seams (typically 0).
6444%
6445*/
6446WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6447  const size_t columns,const size_t rows,const double delta_x,
6448  const double rigidity)
6449{
6450  Image
6451    *rescale_image;
6452
6453  assert(wand != (MagickWand *) NULL);
6454  assert(wand->signature == WandSignature);
6455  if( IfMagickTrue(wand->debug) )
6456    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6457
6458  if (wand->images == (Image *) NULL)
6459    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6460  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6461    rigidity,wand->exception);
6462  if (rescale_image == (Image *) NULL)
6463    return(MagickFalse);
6464  ReplaceImageInList(&wand->images,rescale_image);
6465  return(MagickTrue);
6466}
6467
6468/*
6469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6470%                                                                             %
6471%                                                                             %
6472%                                                                             %
6473%   M a g i c k M a g n i f y I m a g e                                       %
6474%                                                                             %
6475%                                                                             %
6476%                                                                             %
6477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6478%
6479%  MagickMagnifyImage() is a convenience method that scales an image
6480%  proportionally to twice its original size.
6481%
6482%  The format of the MagickMagnifyImage method is:
6483%
6484%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6485%
6486%  A description of each parameter follows:
6487%
6488%    o wand: the magick wand.
6489%
6490*/
6491WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6492{
6493  Image
6494    *magnify_image;
6495
6496  assert(wand != (MagickWand *) NULL);
6497  assert(wand->signature == WandSignature);
6498  if( IfMagickTrue(wand->debug) )
6499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6500
6501  if (wand->images == (Image *) NULL)
6502    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6503  magnify_image=MagnifyImage(wand->images,wand->exception);
6504  if (magnify_image == (Image *) NULL)
6505    return(MagickFalse);
6506  ReplaceImageInList(&wand->images,magnify_image);
6507  return(MagickTrue);
6508}
6509
6510/*
6511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6512%                                                                             %
6513%                                                                             %
6514%                                                                             %
6515%   M a g i c k M e r g e I m a g e L a y e r s                               %
6516%                                                                             %
6517%                                                                             %
6518%                                                                             %
6519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520%
6521%  MagickMergeImageLayers() composes all the image layers from the current
6522%  given image onward to produce a single image of the merged layers.
6523%
6524%  The inital canvas's size depends on the given ImageLayerMethod, and is
6525%  initialized using the first images background color.  The images
6526%  are then compositied onto that image in sequence using the given
6527%  composition that has been assigned to each individual image.
6528%
6529%  The format of the MagickMergeImageLayers method is:
6530%
6531%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6532%        const ImageLayerMethod method)
6533%
6534%  A description of each parameter follows:
6535%
6536%    o wand: the magick wand.
6537%
6538%    o method: the method of selecting the size of the initial canvas.
6539%
6540%        MergeLayer: Merge all layers onto a canvas just large enough
6541%           to hold all the actual images. The virtual canvas of the
6542%           first image is preserved but otherwise ignored.
6543%
6544%        FlattenLayer: Use the virtual canvas size of first image.
6545%           Images which fall outside this canvas is clipped.
6546%           This can be used to 'fill out' a given virtual canvas.
6547%
6548%        MosaicLayer: Start with the virtual canvas of the first image,
6549%           enlarging left and right edges to contain all images.
6550%           Images with negative offsets will be clipped.
6551%
6552*/
6553WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6554  const ImageLayerMethod method)
6555{
6556  Image
6557    *mosaic_image;
6558
6559  assert(wand != (MagickWand *) NULL);
6560  assert(wand->signature == WandSignature);
6561  if( IfMagickTrue(wand->debug) )
6562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6563
6564  if (wand->images == (Image *) NULL)
6565    return((MagickWand *) NULL);
6566  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6567  if (mosaic_image == (Image *) NULL)
6568    return((MagickWand *) NULL);
6569  return(CloneMagickWandFromImages(wand,mosaic_image));
6570}
6571
6572/*
6573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6574%                                                                             %
6575%                                                                             %
6576%                                                                             %
6577%   M a g i c k M i n i f y I m a g e                                         %
6578%                                                                             %
6579%                                                                             %
6580%                                                                             %
6581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6582%
6583%  MagickMinifyImage() is a convenience method that scales an image
6584%  proportionally to one-half its original size
6585%
6586%  The format of the MagickMinifyImage method is:
6587%
6588%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6589%
6590%  A description of each parameter follows:
6591%
6592%    o wand: the magick wand.
6593%
6594*/
6595WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6596{
6597  Image
6598    *minify_image;
6599
6600  assert(wand != (MagickWand *) NULL);
6601  assert(wand->signature == WandSignature);
6602  if( IfMagickTrue(wand->debug) )
6603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6604
6605  if (wand->images == (Image *) NULL)
6606    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6607  minify_image=MinifyImage(wand->images,wand->exception);
6608  if (minify_image == (Image *) NULL)
6609    return(MagickFalse);
6610  ReplaceImageInList(&wand->images,minify_image);
6611  return(MagickTrue);
6612}
6613
6614/*
6615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6616%                                                                             %
6617%                                                                             %
6618%                                                                             %
6619%   M a g i c k M o d u l a t e I m a g e                                     %
6620%                                                                             %
6621%                                                                             %
6622%                                                                             %
6623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6624%
6625%  MagickModulateImage() lets you control the brightness, saturation, and hue
6626%  of an image.  Hue is the percentage of absolute rotation from the current
6627%  position.  For example 50 results in a counter-clockwise rotation of 90
6628%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6629%  both resulting in a rotation of 180 degrees.
6630%
6631%  To increase the color brightness by 20% and decrease the color saturation by
6632%  10% and leave the hue unchanged, use: 120,90,100.
6633%
6634%  The format of the MagickModulateImage method is:
6635%
6636%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6637%        const double brightness,const double saturation,const double hue)
6638%
6639%  A description of each parameter follows:
6640%
6641%    o wand: the magick wand.
6642%
6643%    o brightness: the percent change in brighness.
6644%
6645%    o saturation: the percent change in saturation.
6646%
6647%    o hue: the percent change in hue.
6648%
6649*/
6650WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6651  const double brightness,const double saturation,const double hue)
6652{
6653  char
6654    modulate[MaxTextExtent];
6655
6656  MagickBooleanType
6657    status;
6658
6659  assert(wand != (MagickWand *) NULL);
6660  assert(wand->signature == WandSignature);
6661  if( IfMagickTrue(wand->debug) )
6662    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6663
6664  if (wand->images == (Image *) NULL)
6665    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6666  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6667    brightness,saturation,hue);
6668  status=ModulateImage(wand->images,modulate,wand->exception);
6669  return(status);
6670}
6671
6672/*
6673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6674%                                                                             %
6675%                                                                             %
6676%                                                                             %
6677%   M a g i c k M o n t a g e I m a g e                                       %
6678%                                                                             %
6679%                                                                             %
6680%                                                                             %
6681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6682%
6683%  MagickMontageImage() creates a composite image by combining several
6684%  separate images. The images are tiled on the composite image with the name
6685%  of the image optionally appearing just below the individual tile.
6686%
6687%  The format of the MagickMontageImage method is:
6688%
6689%      MagickWand *MagickMontageImage(MagickWand *wand,
6690%        const DrawingWand drawing_wand,const char *tile_geometry,
6691%        const char *thumbnail_geometry,const MontageMode mode,
6692%        const char *frame)
6693%
6694%  A description of each parameter follows:
6695%
6696%    o wand: the magick wand.
6697%
6698%    o drawing_wand: the drawing wand.  The font name, size, and color are
6699%      obtained from this wand.
6700%
6701%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6702%
6703%    o thumbnail_geometry: Preferred image size and border size of each
6704%      thumbnail (e.g. 120x120+4+3>).
6705%
6706%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6707%
6708%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6709%      The frame color is that of the thumbnail's matte color.
6710%
6711*/
6712WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6713  const DrawingWand *drawing_wand,const char *tile_geometry,
6714  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6715{
6716  char
6717    *font;
6718
6719  Image
6720    *montage_image;
6721
6722  MontageInfo
6723    *montage_info;
6724
6725  PixelWand
6726    *pixel_wand;
6727
6728  assert(wand != (MagickWand *) NULL);
6729  assert(wand->signature == WandSignature);
6730  if( IfMagickTrue(wand->debug) )
6731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6732
6733  if (wand->images == (Image *) NULL)
6734    return((MagickWand *) NULL);
6735  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6736  switch (mode)
6737  {
6738    case FrameMode:
6739    {
6740      (void) CloneString(&montage_info->frame,"15x15+3+3");
6741      montage_info->shadow=MagickTrue;
6742      break;
6743    }
6744    case UnframeMode:
6745    {
6746      montage_info->frame=(char *) NULL;
6747      montage_info->shadow=MagickFalse;
6748      montage_info->border_width=0;
6749      break;
6750    }
6751    case ConcatenateMode:
6752    {
6753      montage_info->frame=(char *) NULL;
6754      montage_info->shadow=MagickFalse;
6755      (void) CloneString(&montage_info->geometry,"+0+0");
6756      montage_info->border_width=0;
6757      break;
6758    }
6759    default:
6760      break;
6761  }
6762  font=DrawGetFont(drawing_wand);
6763  if (font != (char *) NULL)
6764    (void) CloneString(&montage_info->font,font);
6765  if (frame != (char *) NULL)
6766    (void) CloneString(&montage_info->frame,frame);
6767  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6768  pixel_wand=NewPixelWand();
6769  DrawGetFillColor(drawing_wand,pixel_wand);
6770  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6771  DrawGetStrokeColor(drawing_wand,pixel_wand);
6772  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6773  pixel_wand=DestroyPixelWand(pixel_wand);
6774  if (thumbnail_geometry != (char *) NULL)
6775    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6776  if (tile_geometry != (char *) NULL)
6777    (void) CloneString(&montage_info->tile,tile_geometry);
6778  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6779    wand->exception);
6780  montage_info=DestroyMontageInfo(montage_info);
6781  if (montage_image == (Image *) NULL)
6782    return((MagickWand *) NULL);
6783  return(CloneMagickWandFromImages(wand,montage_image));
6784}
6785
6786/*
6787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6788%                                                                             %
6789%                                                                             %
6790%                                                                             %
6791%   M a g i c k M o r p h I m a g e s                                         %
6792%                                                                             %
6793%                                                                             %
6794%                                                                             %
6795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6796%
6797%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6798%  and size are linearly interpolated to give the appearance of a
6799%  meta-morphosis from one image to the next.
6800%
6801%  The format of the MagickMorphImages method is:
6802%
6803%      MagickWand *MagickMorphImages(MagickWand *wand,
6804%        const size_t number_frames)
6805%
6806%  A description of each parameter follows:
6807%
6808%    o wand: the magick wand.
6809%
6810%    o number_frames: the number of in-between images to generate.
6811%
6812*/
6813WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6814  const size_t number_frames)
6815{
6816  Image
6817    *morph_image;
6818
6819  assert(wand != (MagickWand *) NULL);
6820  assert(wand->signature == WandSignature);
6821  if( IfMagickTrue(wand->debug) )
6822    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6823
6824  if (wand->images == (Image *) NULL)
6825    return((MagickWand *) NULL);
6826  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6827  if (morph_image == (Image *) NULL)
6828    return((MagickWand *) NULL);
6829  return(CloneMagickWandFromImages(wand,morph_image));
6830}
6831
6832/*
6833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6834%                                                                             %
6835%                                                                             %
6836%                                                                             %
6837%   M a g i c k M o r p h o l o g y I m a g e                                 %
6838%                                                                             %
6839%                                                                             %
6840%                                                                             %
6841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6842%
6843%  MagickMorphologyImage() applies a user supplied kernel to the image
6844%  according to the given mophology method.
6845%
6846%  The format of the MagickMorphologyImage method is:
6847%
6848%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6849%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6850%
6851%  A description of each parameter follows:
6852%
6853%    o wand: the magick wand.
6854%
6855%    o method: the morphology method to be applied.
6856%
6857%    o iterations: apply the operation this many times (or no change).
6858%      A value of -1 means loop until no change found.  How this is applied
6859%      may depend on the morphology method.  Typically this is a value of 1.
6860%
6861%    o kernel: An array of doubles representing the morphology kernel.
6862%
6863*/
6864WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6865  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6866{
6867  Image
6868    *morphology_image;
6869
6870  assert(wand != (MagickWand *) NULL);
6871  assert(wand->signature == WandSignature);
6872  if( IfMagickTrue(wand->debug) )
6873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6874
6875  if (kernel == (const KernelInfo *) NULL)
6876    return(MagickFalse);
6877  if (wand->images == (Image *) NULL)
6878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6879  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6880    wand->exception);
6881  if (morphology_image == (Image *) NULL)
6882    return(MagickFalse);
6883  ReplaceImageInList(&wand->images,morphology_image);
6884  return(MagickTrue);
6885}
6886
6887/*
6888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6889%                                                                             %
6890%                                                                             %
6891%                                                                             %
6892%   M a g i c k M o t i o n B l u r I m a g e                                 %
6893%                                                                             %
6894%                                                                             %
6895%                                                                             %
6896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6897%
6898%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6899%  Gaussian operator of the given radius and standard deviation (sigma).
6900%  For reasonable results, radius should be larger than sigma.  Use a
6901%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6902%  Angle gives the angle of the blurring motion.
6903%
6904%  The format of the MagickMotionBlurImage method is:
6905%
6906%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6907%        const double radius,const double sigma,const double angle)
6908%
6909%  A description of each parameter follows:
6910%
6911%    o wand: the magick wand.
6912%
6913%    o radius: the radius of the Gaussian, in pixels, not counting
6914%      the center pixel.
6915%
6916%    o sigma: the standard deviation of the Gaussian, in pixels.
6917%
6918%    o angle: Apply the effect along this angle.
6919%
6920*/
6921WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6922  const double radius,const double sigma,const double angle)
6923{
6924  Image
6925    *blur_image;
6926
6927  assert(wand != (MagickWand *) NULL);
6928  assert(wand->signature == WandSignature);
6929  if( IfMagickTrue(wand->debug) )
6930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6931
6932  if (wand->images == (Image *) NULL)
6933    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6934  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6935  if (blur_image == (Image *) NULL)
6936    return(MagickFalse);
6937  ReplaceImageInList(&wand->images,blur_image);
6938  return(MagickTrue);
6939}
6940
6941/*
6942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6943%                                                                             %
6944%                                                                             %
6945%                                                                             %
6946%   M a g i c k N e g a t e I m a g e                                         %
6947%                                                                             %
6948%                                                                             %
6949%                                                                             %
6950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6951%
6952%  MagickNegateImage() negates the colors in the reference image.  The
6953%  Grayscale option means that only grayscale values within the image are
6954%  negated.
6955%
6956%  You can also reduce the influence of a particular channel with a gamma
6957%  value of 0.
6958%
6959%  The format of the MagickNegateImage method is:
6960%
6961%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6962%        const MagickBooleanType gray)
6963%
6964%  A description of each parameter follows:
6965%
6966%    o wand: the magick wand.
6967%
6968%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6969%
6970*/
6971WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6972  const MagickBooleanType gray)
6973{
6974  MagickBooleanType
6975    status;
6976
6977  assert(wand != (MagickWand *) NULL);
6978  assert(wand->signature == WandSignature);
6979  if( IfMagickTrue(wand->debug) )
6980    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6981
6982  if (wand->images == (Image *) NULL)
6983    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6984  status=NegateImage(wand->images,gray,wand->exception);
6985  return(status);
6986}
6987
6988/*
6989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6990%                                                                             %
6991%                                                                             %
6992%                                                                             %
6993%   M a g i c k N e w I m a g e                                               %
6994%                                                                             %
6995%                                                                             %
6996%                                                                             %
6997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6998%
6999%  MagickNewImage() adds a blank image canvas of the specified size and
7000%  background color to the wand.
7001%
7002%  The format of the MagickNewImage method is:
7003%
7004%      MagickBooleanType MagickNewImage(MagickWand *wand,
7005%        const size_t columns,const size_t rows,
7006%        const PixelWand *background)
7007%
7008%  A description of each parameter follows:
7009%
7010%    o wand: the magick wand.
7011%
7012%    o width: the image width.
7013%
7014%    o height: the image height.
7015%
7016%    o background: the image color.
7017%
7018*/
7019WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7020  const size_t height,const PixelWand *background)
7021{
7022  Image
7023    *images;
7024
7025  PixelInfo
7026    pixel;
7027
7028  assert(wand != (MagickWand *) NULL);
7029  assert(wand->signature == WandSignature);
7030  if( IfMagickTrue(wand->debug) )
7031    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7032
7033  PixelGetMagickColor(background,&pixel);
7034  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7035  if (images == (Image *) NULL)
7036    return(MagickFalse);
7037  return(InsertImageInWand(wand,images));
7038}
7039
7040/*
7041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7042%                                                                             %
7043%                                                                             %
7044%                                                                             %
7045%   M a g i c k N e x t I m a g e                                             %
7046%                                                                             %
7047%                                                                             %
7048%                                                                             %
7049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7050%
7051%  MagickNextImage() sets the next image in the wand as the current image.
7052%
7053%  It is typically used after MagickResetIterator(), after which its first use
7054%  will set the first image as the current image (unless the wand is empty).
7055%
7056%  It will return MagickFalse when no more images are left to be returned
7057%  which happens when the wand is empty, or the current image is the last
7058%  image.
7059%
7060%  When the above condition (end of image list) is reached, the iterator is
7061%  automaticall set so that you can start using MagickPreviousImage() to
7062%  again iterate over the images in the reverse direction, starting with the
7063%  last image (again).  You can jump to this condition immeditally using
7064%  MagickSetLastIterator().
7065%
7066%  The format of the MagickNextImage method is:
7067%
7068%      MagickBooleanType MagickNextImage(MagickWand *wand)
7069%
7070%  A description of each parameter follows:
7071%
7072%    o wand: the magick wand.
7073%
7074*/
7075WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7076{
7077  assert(wand != (MagickWand *) NULL);
7078  assert(wand->signature == WandSignature);
7079  if( IfMagickTrue(wand->debug) )
7080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7081
7082  if (wand->images == (Image *) NULL)
7083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7084  wand->insert_before=MagickFalse; /* Inserts is now appended */
7085  if( IfMagickTrue(wand->image_pending) )
7086    {
7087      wand->image_pending=MagickFalse;
7088      return(MagickTrue);
7089    }
7090  if (GetNextImageInList(wand->images) == (Image *) NULL)
7091    {
7092      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7093      return(MagickFalse);
7094    }
7095  wand->images=GetNextImageInList(wand->images);
7096  return(MagickTrue);
7097}
7098
7099/*
7100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7101%                                                                             %
7102%                                                                             %
7103%                                                                             %
7104%   M a g i c k N o r m a l i z e I m a g e                                   %
7105%                                                                             %
7106%                                                                             %
7107%                                                                             %
7108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7109%
7110%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7111%  the pixels color to span the entire range of colors available
7112%
7113%  You can also reduce the influence of a particular channel with a gamma
7114%  value of 0.
7115%
7116%  The format of the MagickNormalizeImage method is:
7117%
7118%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7119%
7120%  A description of each parameter follows:
7121%
7122%    o wand: the magick wand.
7123%
7124*/
7125WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7126{
7127  MagickBooleanType
7128    status;
7129
7130  assert(wand != (MagickWand *) NULL);
7131  assert(wand->signature == WandSignature);
7132  if( IfMagickTrue(wand->debug) )
7133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7134
7135  if (wand->images == (Image *) NULL)
7136    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7137  status=NormalizeImage(wand->images,wand->exception);
7138  return(status);
7139}
7140
7141/*
7142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143%                                                                             %
7144%                                                                             %
7145%                                                                             %
7146%   M a g i c k O i l P a i n t I m a g e                                     %
7147%                                                                             %
7148%                                                                             %
7149%                                                                             %
7150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151%
7152%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7153%  painting.  Each pixel is replaced by the most frequent color occurring
7154%  in a circular region defined by radius.
7155%
7156%  The format of the MagickOilPaintImage method is:
7157%
7158%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7159%        const double radius,const double sigma)
7160%
7161%  A description of each parameter follows:
7162%
7163%    o wand: the magick wand.
7164%
7165%    o radius: the radius of the circular neighborhood.
7166%
7167%    o sigma: the standard deviation of the Gaussian, in pixels.
7168%
7169*/
7170WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7171  const double radius,const double sigma)
7172{
7173  Image
7174    *paint_image;
7175
7176  assert(wand != (MagickWand *) NULL);
7177  assert(wand->signature == WandSignature);
7178  if( IfMagickTrue(wand->debug) )
7179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7180
7181  if (wand->images == (Image *) NULL)
7182    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7183  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7184  if (paint_image == (Image *) NULL)
7185    return(MagickFalse);
7186  ReplaceImageInList(&wand->images,paint_image);
7187  return(MagickTrue);
7188}
7189
7190/*
7191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7192%                                                                             %
7193%                                                                             %
7194%                                                                             %
7195%   M a g i c k O p a q u e P a i n t I m a g e                               %
7196%                                                                             %
7197%                                                                             %
7198%                                                                             %
7199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7200%
7201%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7202%  defined by fill.
7203%
7204%  The format of the MagickOpaquePaintImage method is:
7205%
7206%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7207%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7208%        const MagickBooleanType invert)
7209%
7210%  A description of each parameter follows:
7211%
7212%    o wand: the magick wand.
7213%
7214%    o target: Change this target color to the fill color within the image.
7215%
7216%    o fill: the fill pixel wand.
7217%
7218%    o fuzz: By default target must match a particular pixel color
7219%      exactly.  However, in many cases two colors may differ by a small amount.
7220%      The fuzz member of image defines how much tolerance is acceptable to
7221%      consider two colors as the same.  For example, set fuzz to 10 and the
7222%      color red at intensities of 100 and 102 respectively are now interpreted
7223%      as the same color for the purposes of the floodfill.
7224%
7225%    o invert: paint any pixel that does not match the target color.
7226%
7227*/
7228WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7229  const PixelWand *target,const PixelWand *fill,const double fuzz,
7230  const MagickBooleanType invert)
7231{
7232  MagickBooleanType
7233    status;
7234
7235  PixelInfo
7236    fill_pixel,
7237    target_pixel;
7238
7239  assert(wand != (MagickWand *) NULL);
7240  assert(wand->signature == WandSignature);
7241  if( IfMagickTrue(wand->debug) )
7242    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7243
7244  if (wand->images == (Image *) NULL)
7245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7246  PixelGetMagickColor(target,&target_pixel);
7247  PixelGetMagickColor(fill,&fill_pixel);
7248  wand->images->fuzz=fuzz;
7249  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7250    wand->exception);
7251  return(status);
7252}
7253
7254/*
7255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7256%                                                                             %
7257%                                                                             %
7258%                                                                             %
7259%   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                         %
7260%                                                                             %
7261%                                                                             %
7262%                                                                             %
7263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7264%
7265%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7266%  previous image in the sequence.  From this it attempts to select the
7267%  smallest cropped image to replace each frame, while preserving the results
7268%  of the animation.
7269%
7270%  The format of the MagickOptimizeImageLayers method is:
7271%
7272%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7273%
7274%  A description of each parameter follows:
7275%
7276%    o wand: the magick wand.
7277%
7278*/
7279WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7280{
7281  Image
7282    *optimize_image;
7283
7284  assert(wand != (MagickWand *) NULL);
7285  assert(wand->signature == WandSignature);
7286  if( IfMagickTrue(wand->debug) )
7287    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7288
7289  if (wand->images == (Image *) NULL)
7290    return((MagickWand *) NULL);
7291  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7292  if (optimize_image == (Image *) NULL)
7293    return((MagickWand *) NULL);
7294  return(CloneMagickWandFromImages(wand,optimize_image));
7295}
7296
7297/*
7298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7299%                                                                             %
7300%                                                                             %
7301%                                                                             %
7302%     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                   %
7303%                                                                             %
7304%                                                                             %
7305%                                                                             %
7306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7307%
7308%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7309%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7310%  which can be different for different channels, according to the input
7311%  arguments.
7312%
7313%  The format of the MagickOrderedPosterizeImage method is:
7314%
7315%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7316%        const char *threshold_map)
7317%
7318%  A description of each parameter follows:
7319%
7320%    o image: the image.
7321%
7322%    o threshold_map: A string containing the name of the threshold dither
7323%      map to use, followed by zero or more numbers representing the number of
7324%      color levels tho dither between.
7325%
7326%      Any level number less than 2 is equivalent to 2, and means only binary
7327%      dithering will be applied to each color channel.
7328%
7329%      No numbers also means a 2 level (bitmap) dither will be applied to all
7330%      channels, while a single number is the number of levels applied to each
7331%      channel in sequence.  More numbers will be applied in turn to each of
7332%      the color channels.
7333%
7334%      For example: "o3x3,6" generates a 6 level posterization of the image
7335%      with a ordered 3x3 diffused pixel dither being applied between each
7336%      level. While checker,8,8,4 will produce a 332 colormaped image with
7337%      only a single checkerboard hash pattern (50% grey) between each color
7338%      level, to basically double the number of color levels with a bare
7339%      minimim of dithering.
7340%
7341*/
7342WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7343  const char *threshold_map)
7344{
7345  MagickBooleanType
7346    status;
7347
7348  assert(wand != (MagickWand *) NULL);
7349  assert(wand->signature == WandSignature);
7350  if( IfMagickTrue(wand->debug) )
7351    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7352
7353  if (wand->images == (Image *) NULL)
7354    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7355  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7356  return(status);
7357}
7358
7359/*
7360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7361%                                                                             %
7362%                                                                             %
7363%                                                                             %
7364%   M a g i c k P i n g I m a g e                                             %
7365%                                                                             %
7366%                                                                             %
7367%                                                                             %
7368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7369%
7370%  MagickPingImage() is the same as MagickReadImage() except the only valid
7371%  information returned is the image width, height, size, and format.  It
7372%  is designed to efficiently obtain this information from a file without
7373%  reading the entire image sequence into memory.
7374%
7375%  The format of the MagickPingImage method is:
7376%
7377%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7378%
7379%  A description of each parameter follows:
7380%
7381%    o wand: the magick wand.
7382%
7383%    o filename: the image filename.
7384%
7385*/
7386WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7387  const char *filename)
7388{
7389  Image
7390    *images;
7391
7392  ImageInfo
7393    *ping_info;
7394
7395  assert(wand != (MagickWand *) NULL);
7396  assert(wand->signature == WandSignature);
7397  if( IfMagickTrue(wand->debug) )
7398    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7399
7400  ping_info=CloneImageInfo(wand->image_info);
7401  if (filename != (const char *) NULL)
7402    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7403  images=PingImage(ping_info,wand->exception);
7404  ping_info=DestroyImageInfo(ping_info);
7405  if (images == (Image *) NULL)
7406    return(MagickFalse);
7407  return(InsertImageInWand(wand,images));
7408}
7409
7410/*
7411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7412%                                                                             %
7413%                                                                             %
7414%                                                                             %
7415%   M a g i c k P i n g I m a g e B l o b                                     %
7416%                                                                             %
7417%                                                                             %
7418%                                                                             %
7419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7420%
7421%  MagickPingImageBlob() pings an image or image sequence from a blob.
7422%
7423%  The format of the MagickPingImageBlob method is:
7424%
7425%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7426%        const void *blob,const size_t length)
7427%
7428%  A description of each parameter follows:
7429%
7430%    o wand: the magick wand.
7431%
7432%    o blob: the blob.
7433%
7434%    o length: the blob length.
7435%
7436*/
7437WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7438  const void *blob,const size_t length)
7439{
7440  Image
7441    *images;
7442
7443  ImageInfo
7444    *read_info;
7445
7446  assert(wand != (MagickWand *) NULL);
7447  assert(wand->signature == WandSignature);
7448  if( IfMagickTrue(wand->debug) )
7449    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7450
7451  read_info=CloneImageInfo(wand->image_info);
7452  SetImageInfoBlob(read_info,blob,length);
7453  images=PingImage(read_info,wand->exception);
7454  read_info=DestroyImageInfo(read_info);
7455  if (images == (Image *) NULL)
7456    return(MagickFalse);
7457  return(InsertImageInWand(wand,images));
7458}
7459
7460/*
7461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7462%                                                                             %
7463%                                                                             %
7464%                                                                             %
7465%   M a g i c k P i n g I m a g e F i l e                                     %
7466%                                                                             %
7467%                                                                             %
7468%                                                                             %
7469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7470%
7471%  MagickPingImageFile() pings an image or image sequence from an open file
7472%  descriptor.
7473%
7474%  The format of the MagickPingImageFile method is:
7475%
7476%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7477%
7478%  A description of each parameter follows:
7479%
7480%    o wand: the magick wand.
7481%
7482%    o file: the file descriptor.
7483%
7484*/
7485WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7486{
7487  Image
7488    *images;
7489
7490  ImageInfo
7491    *read_info;
7492
7493  assert(wand != (MagickWand *) NULL);
7494  assert(wand->signature == WandSignature);
7495  assert(file != (FILE *) NULL);
7496  if( IfMagickTrue(wand->debug) )
7497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7498
7499  read_info=CloneImageInfo(wand->image_info);
7500  SetImageInfoFile(read_info,file);
7501  images=PingImage(read_info,wand->exception);
7502  read_info=DestroyImageInfo(read_info);
7503  if (images == (Image *) NULL)
7504    return(MagickFalse);
7505  return(InsertImageInWand(wand,images));
7506}
7507
7508/*
7509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7510%                                                                             %
7511%                                                                             %
7512%                                                                             %
7513%   M a g i c k P o l a r o i d I m a g e                                     %
7514%                                                                             %
7515%                                                                             %
7516%                                                                             %
7517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7518%
7519%  MagickPolaroidImage() simulates a Polaroid picture.
7520%
7521%  The format of the MagickPolaroidImage method is:
7522%
7523%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7524%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7525%        const PixelInterpolateMethod method)
7526%
7527%  A description of each parameter follows:
7528%
7529%    o wand: the magick wand.
7530%
7531%    o drawing_wand: the draw wand.
7532%
7533%    o caption: the Polaroid caption.
7534%
7535%    o angle: Apply the effect along this angle.
7536%
7537%    o method: the pixel interpolation method.
7538%
7539*/
7540WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7541  const DrawingWand *drawing_wand,const char *caption,const double angle,
7542  const PixelInterpolateMethod method)
7543{
7544  DrawInfo
7545    *draw_info;
7546
7547  Image
7548    *polaroid_image;
7549
7550  assert(wand != (MagickWand *) NULL);
7551  assert(wand->signature == WandSignature);
7552  if( IfMagickTrue(wand->debug) )
7553    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7554
7555  if (wand->images == (Image *) NULL)
7556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7557  draw_info=PeekDrawingWand(drawing_wand);
7558  if (draw_info == (DrawInfo *) NULL)
7559    return(MagickFalse);
7560  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7561    wand->exception);
7562  if (polaroid_image == (Image *) NULL)
7563    return(MagickFalse);
7564  ReplaceImageInList(&wand->images,polaroid_image);
7565  return(MagickTrue);
7566}
7567
7568/*
7569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7570%                                                                             %
7571%                                                                             %
7572%                                                                             %
7573%   M a g i c k P o s t e r i z e I m a g e                                   %
7574%                                                                             %
7575%                                                                             %
7576%                                                                             %
7577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7578%
7579%  MagickPosterizeImage() reduces the image to a limited number of color level.
7580%
7581%  The format of the MagickPosterizeImage method is:
7582%
7583%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7584%        const unsigned levels,const MagickBooleanType dither)
7585%
7586%  A description of each parameter follows:
7587%
7588%    o wand: the magick wand.
7589%
7590%    o levels: Number of color levels allowed in each channel.  Very low values
7591%      (2, 3, or 4) have the most visible effect.
7592%
7593%    o dither: Set this integer value to something other than zero to dither
7594%      the mapped image.
7595%
7596*/
7597WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7598  const size_t levels,const MagickBooleanType dither)
7599{
7600  MagickBooleanType
7601    status;
7602
7603  assert(wand != (MagickWand *) NULL);
7604  assert(wand->signature == WandSignature);
7605  if( IfMagickTrue(wand->debug) )
7606    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7607
7608  if (wand->images == (Image *) NULL)
7609    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7610  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7611  return(status);
7612}
7613
7614/*
7615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7616%                                                                             %
7617%                                                                             %
7618%                                                                             %
7619%   M a g i c k P r e v i e w I m a g e s                                     %
7620%                                                                             %
7621%                                                                             %
7622%                                                                             %
7623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7624%
7625%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7626%  image processing operation applied at varying strengths.  This helpful
7627%  to quickly pin-point an appropriate parameter for an image processing
7628%  operation.
7629%
7630%  The format of the MagickPreviewImages method is:
7631%
7632%      MagickWand *MagickPreviewImages(MagickWand *wand,
7633%        const PreviewType preview)
7634%
7635%  A description of each parameter follows:
7636%
7637%    o wand: the magick wand.
7638%
7639%    o preview: the preview type.
7640%
7641*/
7642WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7643  const PreviewType preview)
7644{
7645  Image
7646    *preview_image;
7647
7648  assert(wand != (MagickWand *) NULL);
7649  assert(wand->signature == WandSignature);
7650  if( IfMagickTrue(wand->debug) )
7651    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7652
7653  if (wand->images == (Image *) NULL)
7654    return((MagickWand *) NULL);
7655  preview_image=PreviewImage(wand->images,preview,wand->exception);
7656  if (preview_image == (Image *) NULL)
7657    return((MagickWand *) NULL);
7658  return(CloneMagickWandFromImages(wand,preview_image));
7659}
7660
7661/*
7662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7663%                                                                             %
7664%                                                                             %
7665%                                                                             %
7666%   M a g i c k P r e v i o u s I m a g e                                     %
7667%                                                                             %
7668%                                                                             %
7669%                                                                             %
7670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7671%
7672%  MagickPreviousImage() sets the previous image in the wand as the current
7673%  image.
7674%
7675%  It is typically used after MagickSetLastIterator(), after which its first
7676%  use will set the last image as the current image (unless the wand is empty).
7677%
7678%  It will return MagickFalse when no more images are left to be returned
7679%  which happens when the wand is empty, or the current image is the first
7680%  image.  At that point the iterator is than reset to again process images in
7681%  the forward direction, again starting with the first image in list. Images
7682%  added at this point are prepended.
7683%
7684%  Also at that point any images added to the wand using MagickAddImages() or
7685%  MagickReadImages() will be prepended before the first image. In this sense
7686%  the condition is not quite exactly the same as MagickResetIterator().
7687%
7688%  The format of the MagickPreviousImage method is:
7689%
7690%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7691%
7692%  A description of each parameter follows:
7693%
7694%    o wand: the magick wand.
7695%
7696*/
7697WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7698{
7699  assert(wand != (MagickWand *) NULL);
7700  assert(wand->signature == WandSignature);
7701  if( IfMagickTrue(wand->debug) )
7702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7703
7704  if (wand->images == (Image *) NULL)
7705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7706
7707  if( IfMagickTrue(wand->image_pending) )
7708    {
7709      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7710      return(MagickTrue);
7711    }
7712  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7713    {
7714      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7715      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7716      return(MagickFalse);
7717    }
7718  wand->images=GetPreviousImageInList(wand->images);
7719  return(MagickTrue);
7720}
7721
7722/*
7723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7724%                                                                             %
7725%                                                                             %
7726%                                                                             %
7727%   M a g i c k Q u a n t i z e I m a g e                                     %
7728%                                                                             %
7729%                                                                             %
7730%                                                                             %
7731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7732%
7733%  MagickQuantizeImage() analyzes the colors within a reference image and
7734%  chooses a fixed number of colors to represent the image.  The goal of the
7735%  algorithm is to minimize the color difference between the input and output
7736%  image while minimizing the processing time.
7737%
7738%  The format of the MagickQuantizeImage method is:
7739%
7740%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7741%        const size_t number_colors,const ColorspaceType colorspace,
7742%        const size_t treedepth,const MagickBooleanType dither,
7743%        const MagickBooleanType measure_error)
7744%
7745%  A description of each parameter follows:
7746%
7747%    o wand: the magick wand.
7748%
7749%    o number_colors: the number of colors.
7750%
7751%    o colorspace: Perform color reduction in this colorspace, typically
7752%      RGBColorspace.
7753%
7754%    o treedepth: Normally, this integer value is zero or one.  A zero or
7755%      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
7756%      reference image with the least amount of memory and the fastest
7757%      computational speed.  In some cases, such as an image with low color
7758%      dispersion (a few number of colors), a value other than
7759%      Log4(number_colors) is required.  To expand the color tree completely,
7760%      use a value of 8.
7761%
7762%    o dither: A value other than zero distributes the difference between an
7763%      original image and the corresponding color reduced image to
7764%      neighboring pixels along a Hilbert curve.
7765%
7766%    o measure_error: A value other than zero measures the difference between
7767%      the original and quantized images.  This difference is the total
7768%      quantization error.  The error is computed by summing over all pixels
7769%      in an image the distance squared in RGB space between each reference
7770%      pixel value and its quantized value.
7771%
7772*/
7773WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7774  const size_t number_colors,const ColorspaceType colorspace,
7775  const size_t treedepth,const MagickBooleanType dither,
7776  const MagickBooleanType measure_error)
7777{
7778  MagickBooleanType
7779    status;
7780
7781  QuantizeInfo
7782    *quantize_info;
7783
7784  assert(wand != (MagickWand *) NULL);
7785  assert(wand->signature == WandSignature);
7786  if( IfMagickTrue(wand->debug) )
7787    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7788
7789  if (wand->images == (Image *) NULL)
7790    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7791  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7792  quantize_info->number_colors=number_colors;
7793  quantize_info->dither=dither;
7794  quantize_info->tree_depth=treedepth;
7795  quantize_info->colorspace=colorspace;
7796  quantize_info->measure_error=measure_error;
7797  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7798  quantize_info=DestroyQuantizeInfo(quantize_info);
7799  return(status);
7800}
7801
7802/*
7803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7804%                                                                             %
7805%                                                                             %
7806%                                                                             %
7807%   M a g i c k Q u a n t i z e I m a g e s                                   %
7808%                                                                             %
7809%                                                                             %
7810%                                                                             %
7811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7812%
7813%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7814%  chooses a fixed number of colors to represent the image.  The goal of the
7815%  algorithm is to minimize the color difference between the input and output
7816%  image while minimizing the processing time.
7817%
7818%  The format of the MagickQuantizeImages method is:
7819%
7820%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7821%        const size_t number_colors,const ColorspaceType colorspace,
7822%        const size_t treedepth,const MagickBooleanType dither,
7823%        const MagickBooleanType measure_error)
7824%
7825%  A description of each parameter follows:
7826%
7827%    o wand: the magick wand.
7828%
7829%    o number_colors: the number of colors.
7830%
7831%    o colorspace: Perform color reduction in this colorspace, typically
7832%      RGBColorspace.
7833%
7834%    o treedepth: Normally, this integer value is zero or one.  A zero or
7835%      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
7836%      reference image with the least amount of memory and the fastest
7837%      computational speed.  In some cases, such as an image with low color
7838%      dispersion (a few number of colors), a value other than
7839%      Log4(number_colors) is required.  To expand the color tree completely,
7840%      use a value of 8.
7841%
7842%    o dither: A value other than zero distributes the difference between an
7843%      original image and the corresponding color reduced algorithm to
7844%      neighboring pixels along a Hilbert curve.
7845%
7846%    o measure_error: A value other than zero measures the difference between
7847%      the original and quantized images.  This difference is the total
7848%      quantization error.  The error is computed by summing over all pixels
7849%      in an image the distance squared in RGB space between each reference
7850%      pixel value and its quantized value.
7851%
7852*/
7853WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7854  const size_t number_colors,const ColorspaceType colorspace,
7855  const size_t treedepth,const MagickBooleanType dither,
7856  const MagickBooleanType measure_error)
7857{
7858  MagickBooleanType
7859    status;
7860
7861  QuantizeInfo
7862    *quantize_info;
7863
7864  assert(wand != (MagickWand *) NULL);
7865  assert(wand->signature == WandSignature);
7866  if( IfMagickTrue(wand->debug) )
7867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868
7869  if (wand->images == (Image *) NULL)
7870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7871  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7872  quantize_info->number_colors=number_colors;
7873  quantize_info->dither=dither;
7874  quantize_info->tree_depth=treedepth;
7875  quantize_info->colorspace=colorspace;
7876  quantize_info->measure_error=measure_error;
7877  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7878  quantize_info=DestroyQuantizeInfo(quantize_info);
7879  return(status);
7880}
7881
7882/*
7883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7884%                                                                             %
7885%                                                                             %
7886%                                                                             %
7887%   M a g i c k R a d i a l B l u r I m a g e                                 %
7888%                                                                             %
7889%                                                                             %
7890%                                                                             %
7891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7892%
7893%  MagickRadialBlurImage() radial blurs an image.
7894%
7895%  The format of the MagickRadialBlurImage method is:
7896%
7897%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7898%        const double angle)
7899%
7900%  A description of each parameter follows:
7901%
7902%    o wand: the magick wand.
7903%
7904%    o angle: the angle of the blur in degrees.
7905%
7906*/
7907WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7908  const double angle)
7909{
7910  Image
7911    *blur_image;
7912
7913  assert(wand != (MagickWand *) NULL);
7914  assert(wand->signature == WandSignature);
7915  if( IfMagickTrue(wand->debug) )
7916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7917
7918  if (wand->images == (Image *) NULL)
7919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7920  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7921  if (blur_image == (Image *) NULL)
7922    return(MagickFalse);
7923  ReplaceImageInList(&wand->images,blur_image);
7924  return(MagickTrue);
7925}
7926
7927/*
7928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7929%                                                                             %
7930%                                                                             %
7931%                                                                             %
7932%   M a g i c k R a i s e I m a g e                                           %
7933%                                                                             %
7934%                                                                             %
7935%                                                                             %
7936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7937%
7938%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7939%  by lightening and darkening the edges of the image.  Members width and
7940%  height of raise_info define the width of the vertical and horizontal
7941%  edge of the effect.
7942%
7943%  The format of the MagickRaiseImage method is:
7944%
7945%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7946%        const size_t width,const size_t height,const ssize_t x,
7947%        const ssize_t y,const MagickBooleanType raise)
7948%
7949%  A description of each parameter follows:
7950%
7951%    o wand: the magick wand.
7952%
7953%    o width,height,x,y:  Define the dimensions of the area to raise.
7954%
7955%    o raise: A value other than zero creates a 3-D raise effect,
7956%      otherwise it has a lowered effect.
7957%
7958*/
7959WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7960  const size_t width,const size_t height,const ssize_t x,
7961  const ssize_t y,const MagickBooleanType raise)
7962{
7963  MagickBooleanType
7964    status;
7965
7966  RectangleInfo
7967    raise_info;
7968
7969  assert(wand != (MagickWand *) NULL);
7970  assert(wand->signature == WandSignature);
7971  if( IfMagickTrue(wand->debug) )
7972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7973
7974  if (wand->images == (Image *) NULL)
7975    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7976  raise_info.width=width;
7977  raise_info.height=height;
7978  raise_info.x=x;
7979  raise_info.y=y;
7980  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7981  return(status);
7982}
7983
7984/*
7985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7986%                                                                             %
7987%                                                                             %
7988%                                                                             %
7989%   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                       %
7990%                                                                             %
7991%                                                                             %
7992%                                                                             %
7993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7994%
7995%  MagickRandomThresholdImage() changes the value of individual pixels based on
7996%  the intensity of each pixel compared to threshold.  The result is a
7997%  high-contrast, two color image.
7998%
7999%  The format of the MagickRandomThresholdImage method is:
8000%
8001%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8002%        const double low,const double high)
8003%
8004%  A description of each parameter follows:
8005%
8006%    o wand: the magick wand.
8007%
8008%    o low,high: Specify the high and low thresholds.  These values range from
8009%      0 to QuantumRange.
8010%
8011*/
8012WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8013  const double low,const double high)
8014{
8015  char
8016    threshold[MaxTextExtent];
8017
8018  assert(wand != (MagickWand *) NULL);
8019  assert(wand->signature == WandSignature);
8020  if( IfMagickTrue(wand->debug) )
8021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8022
8023  if (wand->images == (Image *) NULL)
8024    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8025  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8026  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8027}
8028
8029/*
8030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8031%                                                                             %
8032%                                                                             %
8033%                                                                             %
8034%   M a g i c k R e a d I m a g e                                             %
8035%                                                                             %
8036%                                                                             %
8037%                                                                             %
8038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8039%
8040%  MagickReadImage() reads an image or image sequence.  The images are inserted
8041%  jjust before the current image pointer position.
8042%
8043%  Use MagickSetFirstIterator(), to insert new images before all the current
8044%  images in the wand, MagickSetLastIterator() to append add to the end,
8045%  MagickSetImageIndex() to place images just after the given index.
8046%
8047%  The format of the MagickReadImage method is:
8048%
8049%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8050%
8051%  A description of each parameter follows:
8052%
8053%    o wand: the magick wand.
8054%
8055%    o filename: the image filename.
8056%
8057*/
8058WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8059  const char *filename)
8060{
8061  Image
8062    *images;
8063
8064  ImageInfo
8065    *read_info;
8066
8067  assert(wand != (MagickWand *) NULL);
8068  assert(wand->signature == WandSignature);
8069  if( IfMagickTrue(wand->debug) )
8070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8071
8072  read_info=CloneImageInfo(wand->image_info);
8073  if (filename != (const char *) NULL)
8074    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8075  images=ReadImage(read_info,wand->exception);
8076  read_info=DestroyImageInfo(read_info);
8077  if (images == (Image *) NULL)
8078    return(MagickFalse);
8079  return(InsertImageInWand(wand,images));
8080}
8081
8082/*
8083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8084%                                                                             %
8085%                                                                             %
8086%                                                                             %
8087%   M a g i c k R e a d I m a g e B l o b                                     %
8088%                                                                             %
8089%                                                                             %
8090%                                                                             %
8091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8092%
8093%  MagickReadImageBlob() reads an image or image sequence from a blob.
8094%  In all other respects it is like MagickReadImage().
8095%
8096%  The format of the MagickReadImageBlob method is:
8097%
8098%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8099%        const void *blob,const size_t length)
8100%
8101%  A description of each parameter follows:
8102%
8103%    o wand: the magick wand.
8104%
8105%    o blob: the blob.
8106%
8107%    o length: the blob length.
8108%
8109*/
8110WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8111  const void *blob,const size_t length)
8112{
8113  Image
8114    *images;
8115
8116  assert(wand != (MagickWand *) NULL);
8117  assert(wand->signature == WandSignature);
8118  if( IfMagickTrue(wand->debug) )
8119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8120
8121  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8122  if (images == (Image *) NULL)
8123    return(MagickFalse);
8124  return(InsertImageInWand(wand,images));
8125}
8126
8127/*
8128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8129%                                                                             %
8130%                                                                             %
8131%                                                                             %
8132%   M a g i c k R e a d I m a g e F i l e                                     %
8133%                                                                             %
8134%                                                                             %
8135%                                                                             %
8136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8137%
8138%  MagickReadImageFile() reads an image or image sequence from an already
8139%  opened file descriptor.  Otherwise it is like MagickReadImage().
8140%
8141%  The format of the MagickReadImageFile method is:
8142%
8143%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8144%
8145%  A description of each parameter follows:
8146%
8147%    o wand: the magick wand.
8148%
8149%    o file: the file descriptor.
8150%
8151*/
8152WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8153{
8154  Image
8155    *images;
8156
8157  ImageInfo
8158    *read_info;
8159
8160  assert(wand != (MagickWand *) NULL);
8161  assert(wand->signature == WandSignature);
8162  assert(file != (FILE *) NULL);
8163  if( IfMagickTrue(wand->debug) )
8164    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8165
8166  read_info=CloneImageInfo(wand->image_info);
8167  SetImageInfoFile(read_info,file);
8168  images=ReadImage(read_info,wand->exception);
8169  read_info=DestroyImageInfo(read_info);
8170  if (images == (Image *) NULL)
8171    return(MagickFalse);
8172  return(InsertImageInWand(wand,images));
8173}
8174
8175/*
8176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8177%                                                                             %
8178%                                                                             %
8179%                                                                             %
8180%   M a g i c k R e m a p I m a g e                                           %
8181%                                                                             %
8182%                                                                             %
8183%                                                                             %
8184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185%
8186%  MagickRemapImage() replaces the colors of an image with the closest color
8187%  from a reference image.
8188%
8189%  The format of the MagickRemapImage method is:
8190%
8191%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8192%        const MagickWand *remap_wand,const DitherMethod method)
8193%
8194%  A description of each parameter follows:
8195%
8196%    o wand: the magick wand.
8197%
8198%    o affinity: the affinity wand.
8199%
8200%    o method: choose from these dither methods: NoDitherMethod,
8201%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8202%
8203*/
8204WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8205  const MagickWand *remap_wand,const DitherMethod method)
8206{
8207  MagickBooleanType
8208    status;
8209
8210  QuantizeInfo
8211    *quantize_info;
8212
8213  assert(wand != (MagickWand *) NULL);
8214  assert(wand->signature == WandSignature);
8215  if( IfMagickTrue(wand->debug) )
8216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8217
8218  if ((wand->images == (Image *) NULL) ||
8219      (remap_wand->images == (Image *) NULL))
8220    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8221  quantize_info=AcquireQuantizeInfo(wand->image_info);
8222  quantize_info->dither_method=method;
8223  if (method == NoDitherMethod)
8224    quantize_info->dither=MagickFalse;
8225  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8226    wand->exception);
8227  quantize_info=DestroyQuantizeInfo(quantize_info);
8228  return(status);
8229}
8230
8231/*
8232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8233%                                                                             %
8234%                                                                             %
8235%                                                                             %
8236%   M a g i c k R e m o v e I m a g e                                         %
8237%                                                                             %
8238%                                                                             %
8239%                                                                             %
8240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8241%
8242%  MagickRemoveImage() removes an image from the image list.
8243%
8244%  The format of the MagickRemoveImage method is:
8245%
8246%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8247%
8248%  A description of each parameter follows:
8249%
8250%    o wand: the magick wand.
8251%
8252%    o insert: the splice wand.
8253%
8254*/
8255WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8256{
8257  assert(wand != (MagickWand *) NULL);
8258  assert(wand->signature == WandSignature);
8259  if( IfMagickTrue(wand->debug) )
8260    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8261
8262  if (wand->images == (Image *) NULL)
8263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8264  DeleteImageFromList(&wand->images);
8265  return(MagickTrue);
8266}
8267
8268/*
8269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8270%                                                                             %
8271%                                                                             %
8272%                                                                             %
8273%   M a g i c k R e s a m p l e I m a g e                                     %
8274%                                                                             %
8275%                                                                             %
8276%                                                                             %
8277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8278%
8279%  MagickResampleImage() resample image to desired resolution.
8280%
8281%    Bessel   Blackman   Box
8282%    Catrom   Cubic      Gaussian
8283%    Hanning  Hermite    Lanczos
8284%    Mitchell Point      Quandratic
8285%    Sinc     Triangle
8286%
8287%  Most of the filters are FIR (finite impulse response), however, Bessel,
8288%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8289%  are windowed (brought down to zero) with the Blackman filter.
8290%
8291%  The format of the MagickResampleImage method is:
8292%
8293%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8294%        const double x_resolution,const double y_resolution,
8295%        const FilterTypes filter)
8296%
8297%  A description of each parameter follows:
8298%
8299%    o wand: the magick wand.
8300%
8301%    o x_resolution: the new image x resolution.
8302%
8303%    o y_resolution: the new image y resolution.
8304%
8305%    o filter: Image filter to use.
8306%
8307*/
8308WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8309  const double x_resolution,const double y_resolution,const FilterTypes filter)
8310{
8311  Image
8312    *resample_image;
8313
8314  assert(wand != (MagickWand *) NULL);
8315  assert(wand->signature == WandSignature);
8316  if( IfMagickTrue(wand->debug) )
8317    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8318
8319  if (wand->images == (Image *) NULL)
8320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8321  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8322    wand->exception);
8323  if (resample_image == (Image *) NULL)
8324    return(MagickFalse);
8325  ReplaceImageInList(&wand->images,resample_image);
8326  return(MagickTrue);
8327}
8328
8329/*
8330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8331%                                                                             %
8332%                                                                             %
8333%                                                                             %
8334%   M a g i c k R e s e t I m a g e P a g e                                   %
8335%                                                                             %
8336%                                                                             %
8337%                                                                             %
8338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8339%
8340%  MagickResetImagePage() resets the Wand page canvas and position.
8341%
8342%  The format of the MagickResetImagePage method is:
8343%
8344%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8345%        const char *page)
8346%
8347%  A description of each parameter follows:
8348%
8349%    o wand: the magick wand.
8350%
8351%    o page: the relative page specification.
8352%
8353*/
8354WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8355  const char *page)
8356{
8357  assert(wand != (MagickWand *) NULL);
8358  assert(wand->signature == WandSignature);
8359  if( IfMagickTrue(wand->debug) )
8360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8361
8362  if (wand->images == (Image *) NULL)
8363    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8364  if ((page == (char *) NULL) || (*page == '\0'))
8365    {
8366      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8367      return(MagickTrue);
8368    }
8369  return(ResetImagePage(wand->images,page));
8370}
8371
8372/*
8373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8374%                                                                             %
8375%                                                                             %
8376%                                                                             %
8377%   M a g i c k R e s i z e I m a g e                                         %
8378%                                                                             %
8379%                                                                             %
8380%                                                                             %
8381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8382%
8383%  MagickResizeImage() scales an image to the desired dimensions with one of
8384%  these filters:
8385%
8386%    Bessel   Blackman   Box
8387%    Catrom   Cubic      Gaussian
8388%    Hanning  Hermite    Lanczos
8389%    Mitchell Point      Quandratic
8390%    Sinc     Triangle
8391%
8392%  Most of the filters are FIR (finite impulse response), however, Bessel,
8393%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8394%  are windowed (brought down to zero) with the Blackman filter.
8395%
8396%  The format of the MagickResizeImage method is:
8397%
8398%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8399%        const size_t columns,const size_t rows,const FilterTypes filter)
8400%
8401%  A description of each parameter follows:
8402%
8403%    o wand: the magick wand.
8404%
8405%    o columns: the number of columns in the scaled image.
8406%
8407%    o rows: the number of rows in the scaled image.
8408%
8409%    o filter: Image filter to use.
8410%
8411*/
8412WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8413  const size_t columns,const size_t rows,const FilterTypes filter)
8414{
8415  Image
8416    *resize_image;
8417
8418  assert(wand != (MagickWand *) NULL);
8419  assert(wand->signature == WandSignature);
8420  if( IfMagickTrue(wand->debug) )
8421    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8422
8423  if (wand->images == (Image *) NULL)
8424    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8425  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8426  if (resize_image == (Image *) NULL)
8427    return(MagickFalse);
8428  ReplaceImageInList(&wand->images,resize_image);
8429  return(MagickTrue);
8430}
8431
8432/*
8433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8434%                                                                             %
8435%                                                                             %
8436%                                                                             %
8437%   M a g i c k R o l l I m a g e                                             %
8438%                                                                             %
8439%                                                                             %
8440%                                                                             %
8441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8442%
8443%  MagickRollImage() offsets an image as defined by x and y.
8444%
8445%  The format of the MagickRollImage method is:
8446%
8447%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8448%        const size_t y)
8449%
8450%  A description of each parameter follows:
8451%
8452%    o wand: the magick wand.
8453%
8454%    o x: the x offset.
8455%
8456%    o y: the y offset.
8457%
8458%
8459*/
8460WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8461  const ssize_t x,const ssize_t y)
8462{
8463  Image
8464    *roll_image;
8465
8466  assert(wand != (MagickWand *) NULL);
8467  assert(wand->signature == WandSignature);
8468  if( IfMagickTrue(wand->debug) )
8469    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8470
8471  if (wand->images == (Image *) NULL)
8472    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8473  roll_image=RollImage(wand->images,x,y,wand->exception);
8474  if (roll_image == (Image *) NULL)
8475    return(MagickFalse);
8476  ReplaceImageInList(&wand->images,roll_image);
8477  return(MagickTrue);
8478}
8479
8480/*
8481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8482%                                                                             %
8483%                                                                             %
8484%                                                                             %
8485%   M a g i c k R o t a t e I m a g e                                         %
8486%                                                                             %
8487%                                                                             %
8488%                                                                             %
8489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8490%
8491%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8492%  triangles left over from rotating the image are filled with the
8493%  background color.
8494%
8495%  The format of the MagickRotateImage method is:
8496%
8497%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8498%        const PixelWand *background,const double degrees)
8499%
8500%  A description of each parameter follows:
8501%
8502%    o wand: the magick wand.
8503%
8504%    o background: the background pixel wand.
8505%
8506%    o degrees: the number of degrees to rotate the image.
8507%
8508%
8509*/
8510WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8511  const PixelWand *background,const double degrees)
8512{
8513  Image
8514    *rotate_image;
8515
8516  assert(wand != (MagickWand *) NULL);
8517  assert(wand->signature == WandSignature);
8518  if( IfMagickTrue(wand->debug) )
8519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8520
8521  if (wand->images == (Image *) NULL)
8522    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8523  PixelGetQuantumPacket(background,&wand->images->background_color);
8524  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8525  if (rotate_image == (Image *) NULL)
8526    return(MagickFalse);
8527  ReplaceImageInList(&wand->images,rotate_image);
8528  return(MagickTrue);
8529}
8530
8531/*
8532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8533%                                                                             %
8534%                                                                             %
8535%                                                                             %
8536%   M a g i c k S a m p l e I m a g e                                         %
8537%                                                                             %
8538%                                                                             %
8539%                                                                             %
8540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8541%
8542%  MagickSampleImage() scales an image to the desired dimensions with pixel
8543%  sampling.  Unlike other scaling methods, this method does not introduce
8544%  any additional color into the scaled image.
8545%
8546%  The format of the MagickSampleImage method is:
8547%
8548%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8549%        const size_t columns,const size_t rows)
8550%
8551%  A description of each parameter follows:
8552%
8553%    o wand: the magick wand.
8554%
8555%    o columns: the number of columns in the scaled image.
8556%
8557%    o rows: the number of rows in the scaled image.
8558%
8559%
8560*/
8561WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8562  const size_t columns,const size_t rows)
8563{
8564  Image
8565    *sample_image;
8566
8567  assert(wand != (MagickWand *) NULL);
8568  assert(wand->signature == WandSignature);
8569  if( IfMagickTrue(wand->debug) )
8570    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8571
8572  if (wand->images == (Image *) NULL)
8573    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8574  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8575  if (sample_image == (Image *) NULL)
8576    return(MagickFalse);
8577  ReplaceImageInList(&wand->images,sample_image);
8578  return(MagickTrue);
8579}
8580
8581/*
8582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8583%                                                                             %
8584%                                                                             %
8585%                                                                             %
8586%   M a g i c k S c a l e I m a g e                                           %
8587%                                                                             %
8588%                                                                             %
8589%                                                                             %
8590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8591%
8592%  MagickScaleImage() scales the size of an image to the given dimensions.
8593%
8594%  The format of the MagickScaleImage method is:
8595%
8596%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8597%        const size_t columns,const size_t rows)
8598%
8599%  A description of each parameter follows:
8600%
8601%    o wand: the magick wand.
8602%
8603%    o columns: the number of columns in the scaled image.
8604%
8605%    o rows: the number of rows in the scaled image.
8606%
8607%
8608*/
8609WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8610  const size_t columns,const size_t rows)
8611{
8612  Image
8613    *scale_image;
8614
8615  assert(wand != (MagickWand *) NULL);
8616  assert(wand->signature == WandSignature);
8617  if( IfMagickTrue(wand->debug) )
8618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8619
8620  if (wand->images == (Image *) NULL)
8621    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8622  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8623  if (scale_image == (Image *) NULL)
8624    return(MagickFalse);
8625  ReplaceImageInList(&wand->images,scale_image);
8626  return(MagickTrue);
8627}
8628
8629/*
8630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8631%                                                                             %
8632%                                                                             %
8633%                                                                             %
8634%   M a g i c k S e g m e n t I m a g e                                       %
8635%                                                                             %
8636%                                                                             %
8637%                                                                             %
8638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8639%
8640%  MagickSegmentImage() segments an image by analyzing the histograms of the
8641%  color components and identifying units that are homogeneous with the fuzzy
8642%  C-means technique.
8643%
8644%  The format of the SegmentImage method is:
8645%
8646%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8647%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8648%        const double cluster_threshold,const double smooth_threshold)
8649%
8650%  A description of each parameter follows.
8651%
8652%    o wand: the wand.
8653%
8654%    o colorspace: the image colorspace.
8655%
8656%    o verbose:  Set to MagickTrue to print detailed information about the
8657%      identified classes.
8658%
8659%    o cluster_threshold:  This represents the minimum number of pixels
8660%      contained in a hexahedra before it can be considered valid (expressed as
8661%      a percentage).
8662%
8663%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8664%      derivative of the histogram.  As the value is increased, you can expect a
8665%      smoother second derivative.
8666%
8667*/
8668MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8669  const ColorspaceType colorspace,const MagickBooleanType verbose,
8670  const double cluster_threshold,const double smooth_threshold)
8671{
8672  MagickBooleanType
8673    status;
8674
8675  assert(wand != (MagickWand *) NULL);
8676  assert(wand->signature == WandSignature);
8677  if( IfMagickTrue(wand->debug) )
8678    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8679
8680  if (wand->images == (Image *) NULL)
8681    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8682  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8683    smooth_threshold,wand->exception);
8684  return(status);
8685}
8686
8687/*
8688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8693%                                                                             %
8694%                                                                             %
8695%                                                                             %
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%
8698%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8699%  threshold. It is similar to the unsharpen mask that sharpens everything with
8700%  contrast above a certain threshold.
8701%
8702%  The format of the MagickSelectiveBlurImage method is:
8703%
8704%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8705%        const double radius,const double sigma,const double threshold)
8706%
8707%  A description of each parameter follows:
8708%
8709%    o wand: the magick wand.
8710%
8711%    o radius: the radius of the gaussian, in pixels, not counting the center
8712%      pixel.
8713%
8714%    o sigma: the standard deviation of the gaussian, in pixels.
8715%
8716%    o threshold: only pixels within this contrast threshold are included
8717%      in the blur operation.
8718%
8719*/
8720WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8721  const double radius,const double sigma,const double threshold)
8722{
8723  Image
8724    *blur_image;
8725
8726  assert(wand != (MagickWand *) NULL);
8727  assert(wand->signature == WandSignature);
8728  if( IfMagickTrue(wand->debug) )
8729    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8730
8731  if (wand->images == (Image *) NULL)
8732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8733  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8734    wand->exception);
8735  if (blur_image == (Image *) NULL)
8736    return(MagickFalse);
8737  ReplaceImageInList(&wand->images,blur_image);
8738  return(MagickTrue);
8739}
8740
8741/*
8742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8743%                                                                             %
8744%                                                                             %
8745%                                                                             %
8746%   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                       %
8747%                                                                             %
8748%                                                                             %
8749%                                                                             %
8750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8751%
8752%  MagickSeparateImage() separates a channel from the image and returns a
8753%  grayscale image.  A channel is a particular color component of each pixel
8754%  in the image.
8755%
8756%  The format of the MagickSeparateImage method is:
8757%
8758%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8759%        const ChannelType channel)
8760%
8761%  A description of each parameter follows:
8762%
8763%    o wand: the magick wand.
8764%
8765%    o channel: the channel.
8766%
8767*/
8768WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8769  const ChannelType channel)
8770{
8771  Image
8772    *separate_image;
8773
8774  assert(wand != (MagickWand *) NULL);
8775  assert(wand->signature == WandSignature);
8776  if( IfMagickTrue(wand->debug) )
8777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8778
8779  if (wand->images == (Image *) NULL)
8780    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8781  separate_image=SeparateImage(wand->images,channel,wand->exception);
8782  if (separate_image == (Image *) NULL)
8783    return(MagickFalse);
8784  ReplaceImageInList(&wand->images,separate_image);
8785  return(MagickTrue);
8786}
8787
8788/*
8789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8790%                                                                             %
8791%                                                                             %
8792%                                                                             %
8793%     M a g i c k S e p i a T o n e I m a g e                                 %
8794%                                                                             %
8795%                                                                             %
8796%                                                                             %
8797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8798%
8799%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8800%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8801%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8802%  threshold of 80% is a good starting point for a reasonable tone.
8803%
8804%  The format of the MagickSepiaToneImage method is:
8805%
8806%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8807%        const double threshold)
8808%
8809%  A description of each parameter follows:
8810%
8811%    o wand: the magick wand.
8812%
8813%    o threshold:  Define the extent of the sepia toning.
8814%
8815*/
8816WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8817  const double threshold)
8818{
8819  Image
8820    *sepia_image;
8821
8822  assert(wand != (MagickWand *) NULL);
8823  assert(wand->signature == WandSignature);
8824  if( IfMagickTrue(wand->debug) )
8825    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8826
8827  if (wand->images == (Image *) NULL)
8828    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8829  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8830  if (sepia_image == (Image *) NULL)
8831    return(MagickFalse);
8832  ReplaceImageInList(&wand->images,sepia_image);
8833  return(MagickTrue);
8834}
8835
8836/*
8837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8838%                                                                             %
8839%                                                                             %
8840%                                                                             %
8841%   M a g i c k S e t I m a g e                                               %
8842%                                                                             %
8843%                                                                             %
8844%                                                                             %
8845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8846%
8847%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8848%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8849%  wand.
8850%
8851%  The format of the MagickSetImage method is:
8852%
8853%      MagickBooleanType MagickSetImage(MagickWand *wand,
8854%        const MagickWand *set_wand)
8855%
8856%  A description of each parameter follows:
8857%
8858%    o wand: the magick wand.
8859%
8860%    o set_wand: the set_wand wand.
8861%
8862*/
8863WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8864  const MagickWand *set_wand)
8865{
8866  Image
8867    *images;
8868
8869  assert(wand != (MagickWand *) NULL);
8870  assert(wand->signature == WandSignature);
8871  if( IfMagickTrue(wand->debug) )
8872    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8873
8874  assert(set_wand != (MagickWand *) NULL);
8875  assert(set_wand->signature == WandSignature);
8876  if( IfMagickTrue(wand->debug) )
8877    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8878
8879  if (set_wand->images == (Image *) NULL)
8880    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8881  images=CloneImageList(set_wand->images,wand->exception);
8882  if (images == (Image *) NULL)
8883    return(MagickFalse);
8884  ReplaceImageInList(&wand->images,images);
8885  return(MagickTrue);
8886}
8887
8888/*
8889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8890%                                                                             %
8891%                                                                             %
8892%                                                                             %
8893%   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                       %
8894%                                                                             %
8895%                                                                             %
8896%                                                                             %
8897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8898%
8899%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8900%  alpha channel.
8901%
8902%  The format of the MagickSetImageAlphaChannel method is:
8903%
8904%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8905%        const AlphaChannelType alpha_type)
8906%
8907%  A description of each parameter follows:
8908%
8909%    o wand: the magick wand.
8910%
8911%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8912%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8913%
8914*/
8915WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8916  const AlphaChannelType alpha_type)
8917{
8918  assert(wand != (MagickWand *) NULL);
8919  assert(wand->signature == WandSignature);
8920  if( IfMagickTrue(wand->debug) )
8921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8922
8923  if (wand->images == (Image *) NULL)
8924    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8925  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8926}
8927
8928/*
8929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8930%                                                                             %
8931%                                                                             %
8932%                                                                             %
8933%   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                 %
8934%                                                                             %
8935%                                                                             %
8936%                                                                             %
8937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8938%
8939%  MagickSetImageBackgroundColor() sets the image background color.
8940%
8941%  The format of the MagickSetImageBackgroundColor method is:
8942%
8943%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8944%        const PixelWand *background)
8945%
8946%  A description of each parameter follows:
8947%
8948%    o wand: the magick wand.
8949%
8950%    o background: the background pixel wand.
8951%
8952*/
8953WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8954  const PixelWand *background)
8955{
8956  assert(wand != (MagickWand *) NULL);
8957  assert(wand->signature == WandSignature);
8958  if( IfMagickTrue(wand->debug) )
8959    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8960
8961  if (wand->images == (Image *) NULL)
8962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8963  PixelGetQuantumPacket(background,&wand->images->background_color);
8964  return(MagickTrue);
8965}
8966
8967/*
8968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8969%                                                                             %
8970%                                                                             %
8971%                                                                             %
8972%   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                         %
8973%                                                                             %
8974%                                                                             %
8975%                                                                             %
8976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8977%
8978%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8979%
8980%  The format of the MagickSetImageBluePrimary method is:
8981%
8982%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8983%        const double x,const double y)
8984%
8985%  A description of each parameter follows:
8986%
8987%    o wand: the magick wand.
8988%
8989%    o x: the blue primary x-point.
8990%
8991%    o y: the blue primary y-point.
8992%
8993*/
8994WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8995  const double x,const double y)
8996{
8997  assert(wand != (MagickWand *) NULL);
8998  assert(wand->signature == WandSignature);
8999  if( IfMagickTrue(wand->debug) )
9000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9001
9002  if (wand->images == (Image *) NULL)
9003    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9004  wand->images->chromaticity.blue_primary.x=x;
9005  wand->images->chromaticity.blue_primary.y=y;
9006  return(MagickTrue);
9007}
9008
9009/*
9010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9011%                                                                             %
9012%                                                                             %
9013%                                                                             %
9014%   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                         %
9015%                                                                             %
9016%                                                                             %
9017%                                                                             %
9018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9019%
9020%  MagickSetImageBorderColor() sets the image border color.
9021%
9022%  The format of the MagickSetImageBorderColor method is:
9023%
9024%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9025%        const PixelWand *border)
9026%
9027%  A description of each parameter follows:
9028%
9029%    o wand: the magick wand.
9030%
9031%    o border: the border pixel wand.
9032%
9033*/
9034WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9035  const PixelWand *border)
9036{
9037  assert(wand != (MagickWand *) NULL);
9038  assert(wand->signature == WandSignature);
9039  if( IfMagickTrue(wand->debug) )
9040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9041
9042  if (wand->images == (Image *) NULL)
9043    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9044  PixelGetQuantumPacket(border,&wand->images->border_color);
9045  return(MagickTrue);
9046}
9047
9048/*
9049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9050%                                                                             %
9051%                                                                             %
9052%                                                                             %
9053%   M a g i c k S e t I m a g e C l i p M a s k                               %
9054%                                                                             %
9055%                                                                             %
9056%                                                                             %
9057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9058%
9059%  MagickSetImageMask() sets image clip mask.
9060%
9061%  The format of the MagickSetImageMask method is:
9062%
9063%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9064%        const MagickWand *clip_mask)
9065%
9066%  A description of each parameter follows:
9067%
9068%    o wand: the magick wand.
9069%
9070%    o clip_mask: the clip_mask wand.
9071%
9072*/
9073WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9074  const MagickWand *clip_mask)
9075{
9076  assert(wand != (MagickWand *) NULL);
9077  assert(wand->signature == WandSignature);
9078  if( IfMagickTrue(wand->debug) )
9079    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9080
9081  assert(clip_mask != (MagickWand *) NULL);
9082  assert(clip_mask->signature == WandSignature);
9083  if( IfMagickTrue(clip_mask->debug) )
9084    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9085
9086  if (clip_mask->images == (Image *) NULL)
9087    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9088  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9089}
9090
9091/*
9092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%   M a g i c k S e t I m a g e C o l o r                                     %
9097%                                                                             %
9098%                                                                             %
9099%                                                                             %
9100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9101%
9102%  MagickSetImageColor() set the entire wand canvas to the specified color.
9103%
9104%  The format of the MagickSetImageColor method is:
9105%
9106%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9107%        const PixelWand *color)
9108%
9109%  A description of each parameter follows:
9110%
9111%    o wand: the magick wand.
9112%
9113%    o background: the image color.
9114%
9115*/
9116WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9117  const PixelWand *color)
9118{
9119  PixelInfo
9120    pixel;
9121
9122  assert(wand != (MagickWand *) NULL);
9123  assert(wand->signature == WandSignature);
9124  if( IfMagickTrue(wand->debug) )
9125    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9126
9127  PixelGetMagickColor(color,&pixel);
9128  return(SetImageColor(wand->images,&pixel,wand->exception));
9129}
9130
9131/*
9132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9133%                                                                             %
9134%                                                                             %
9135%                                                                             %
9136%   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                     %
9137%                                                                             %
9138%                                                                             %
9139%                                                                             %
9140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9141%
9142%  MagickSetImageColormapColor() sets the color of the specified colormap
9143%  index.
9144%
9145%  The format of the MagickSetImageColormapColor method is:
9146%
9147%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9148%        const size_t index,const PixelWand *color)
9149%
9150%  A description of each parameter follows:
9151%
9152%    o wand: the magick wand.
9153%
9154%    o index: the offset into the image colormap.
9155%
9156%    o color: Return the colormap color in this wand.
9157%
9158*/
9159WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9160  const size_t index,const PixelWand *color)
9161{
9162  assert(wand != (MagickWand *) NULL);
9163  assert(wand->signature == WandSignature);
9164  if( IfMagickTrue(wand->debug) )
9165    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9166
9167  if (wand->images == (Image *) NULL)
9168    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9169  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9170      (index >= wand->images->colors))
9171    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9172  PixelGetQuantumPacket(color,wand->images->colormap+index);
9173  return(SyncImage(wand->images,wand->exception));
9174}
9175
9176/*
9177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9178%                                                                             %
9179%                                                                             %
9180%                                                                             %
9181%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9182%                                                                             %
9183%                                                                             %
9184%                                                                             %
9185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9186%
9187%  MagickSetImageColorspace() sets the image colorspace.
9188%
9189%  The format of the MagickSetImageColorspace method is:
9190%
9191%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9192%        const ColorspaceType colorspace)
9193%
9194%  A description of each parameter follows:
9195%
9196%    o wand: the magick wand.
9197%
9198%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9199%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9200%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9201%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9202%      HSLColorspace, or HWBColorspace.
9203%
9204*/
9205WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9206  const ColorspaceType colorspace)
9207{
9208  assert(wand != (MagickWand *) NULL);
9209  assert(wand->signature == WandSignature);
9210  if( IfMagickTrue(wand->debug) )
9211    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9212
9213  if (wand->images == (Image *) NULL)
9214    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9215  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9216}
9217
9218/*
9219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9220%                                                                             %
9221%                                                                             %
9222%                                                                             %
9223%   M a g i c k S e t I m a g e C o m p o s e                                 %
9224%                                                                             %
9225%                                                                             %
9226%                                                                             %
9227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9228%
9229%  MagickSetImageCompose() sets the image composite operator, useful for
9230%  specifying how to composite the image thumbnail when using the
9231%  MagickMontageImage() method.
9232%
9233%  The format of the MagickSetImageCompose method is:
9234%
9235%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9236%        const CompositeOperator compose)
9237%
9238%  A description of each parameter follows:
9239%
9240%    o wand: the magick wand.
9241%
9242%    o compose: the image composite operator.
9243%
9244*/
9245WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9246  const CompositeOperator compose)
9247{
9248  assert(wand != (MagickWand *) NULL);
9249  assert(wand->signature == WandSignature);
9250  if( IfMagickTrue(wand->debug) )
9251    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9252
9253  if (wand->images == (Image *) NULL)
9254    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9255  wand->images->compose=compose;
9256  return(MagickTrue);
9257}
9258
9259/*
9260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9261%                                                                             %
9262%                                                                             %
9263%                                                                             %
9264%   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                         %
9265%                                                                             %
9266%                                                                             %
9267%                                                                             %
9268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9269%
9270%  MagickSetImageCompression() sets the image compression.
9271%
9272%  The format of the MagickSetImageCompression method is:
9273%
9274%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9275%        const CompressionType compression)
9276%
9277%  A description of each parameter follows:
9278%
9279%    o wand: the magick wand.
9280%
9281%    o compression: the image compression type.
9282%
9283*/
9284WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9285  const CompressionType compression)
9286{
9287  assert(wand != (MagickWand *) NULL);
9288  assert(wand->signature == WandSignature);
9289  if( IfMagickTrue(wand->debug) )
9290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9291
9292  if (wand->images == (Image *) NULL)
9293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9294  wand->images->compression=compression;
9295  return(MagickTrue);
9296}
9297
9298/*
9299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9300%                                                                             %
9301%                                                                             %
9302%                                                                             %
9303%   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           %
9304%                                                                             %
9305%                                                                             %
9306%                                                                             %
9307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9308%
9309%  MagickSetImageCompressionQuality() sets the image compression quality.
9310%
9311%  The format of the MagickSetImageCompressionQuality method is:
9312%
9313%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9314%        const size_t quality)
9315%
9316%  A description of each parameter follows:
9317%
9318%    o wand: the magick wand.
9319%
9320%    o quality: the image compression tlityype.
9321%
9322*/
9323WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9324  const size_t quality)
9325{
9326  assert(wand != (MagickWand *) NULL);
9327  assert(wand->signature == WandSignature);
9328  if( IfMagickTrue(wand->debug) )
9329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9330
9331  if (wand->images == (Image *) NULL)
9332    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9333  wand->images->quality=quality;
9334  return(MagickTrue);
9335}
9336
9337/*
9338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9339%                                                                             %
9340%                                                                             %
9341%                                                                             %
9342%   M a g i c k S e t I m a g e D e l a y                                     %
9343%                                                                             %
9344%                                                                             %
9345%                                                                             %
9346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9347%
9348%  MagickSetImageDelay() sets the image delay.
9349%
9350%  The format of the MagickSetImageDelay method is:
9351%
9352%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9353%        const size_t delay)
9354%
9355%  A description of each parameter follows:
9356%
9357%    o wand: the magick wand.
9358%
9359%    o delay: the image delay in ticks-per-second units.
9360%
9361*/
9362WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9363  const size_t delay)
9364{
9365  assert(wand != (MagickWand *) NULL);
9366  assert(wand->signature == WandSignature);
9367  if( IfMagickTrue(wand->debug) )
9368    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9369
9370  if (wand->images == (Image *) NULL)
9371    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9372  wand->images->delay=delay;
9373  return(MagickTrue);
9374}
9375
9376/*
9377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9378%                                                                             %
9379%                                                                             %
9380%                                                                             %
9381%   M a g i c k S e t I m a g e D e p t h                                     %
9382%                                                                             %
9383%                                                                             %
9384%                                                                             %
9385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9386%
9387%  MagickSetImageDepth() sets the image depth.
9388%
9389%  The format of the MagickSetImageDepth method is:
9390%
9391%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9392%        const size_t depth)
9393%
9394%  A description of each parameter follows:
9395%
9396%    o wand: the magick wand.
9397%
9398%    o depth: the image depth in bits: 8, 16, or 32.
9399%
9400*/
9401WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9402  const size_t depth)
9403{
9404  assert(wand != (MagickWand *) NULL);
9405  assert(wand->signature == WandSignature);
9406  if( IfMagickTrue(wand->debug) )
9407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9408
9409  if (wand->images == (Image *) NULL)
9410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9411  return(SetImageDepth(wand->images,depth,wand->exception));
9412}
9413
9414/*
9415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9416%                                                                             %
9417%                                                                             %
9418%                                                                             %
9419%   M a g i c k S e t I m a g e D i s p o s e                                 %
9420%                                                                             %
9421%                                                                             %
9422%                                                                             %
9423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9424%
9425%  MagickSetImageDispose() sets the image disposal method.
9426%
9427%  The format of the MagickSetImageDispose method is:
9428%
9429%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9430%        const DisposeType dispose)
9431%
9432%  A description of each parameter follows:
9433%
9434%    o wand: the magick wand.
9435%
9436%    o dispose: the image disposeal type.
9437%
9438*/
9439WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9440  const DisposeType dispose)
9441{
9442  assert(wand != (MagickWand *) NULL);
9443  assert(wand->signature == WandSignature);
9444  if( IfMagickTrue(wand->debug) )
9445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9446
9447  if (wand->images == (Image *) NULL)
9448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9449  wand->images->dispose=dispose;
9450  return(MagickTrue);
9451}
9452
9453/*
9454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9455%                                                                             %
9456%                                                                             %
9457%                                                                             %
9458%   M a g i c k S e t I m a g e E x t e n t                                   %
9459%                                                                             %
9460%                                                                             %
9461%                                                                             %
9462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9463%
9464%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9465%
9466%  The format of the MagickSetImageExtent method is:
9467%
9468%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9469%        const size_t columns,const unsigned rows)
9470%
9471%  A description of each parameter follows:
9472%
9473%    o wand: the magick wand.
9474%
9475%    o columns:  The image width in pixels.
9476%
9477%    o rows:  The image height in pixels.
9478%
9479*/
9480WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9481  const size_t columns,const size_t rows)
9482{
9483  assert(wand != (MagickWand *) NULL);
9484  assert(wand->signature == WandSignature);
9485  if( IfMagickTrue(wand->debug) )
9486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9487
9488  if (wand->images == (Image *) NULL)
9489    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9491}
9492
9493/*
9494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9495%                                                                             %
9496%                                                                             %
9497%                                                                             %
9498%   M a g i c k S e t I m a g e F i l e n a m e                               %
9499%                                                                             %
9500%                                                                             %
9501%                                                                             %
9502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503%
9504%  MagickSetImageFilename() sets the filename of a particular image in a
9505%  sequence.
9506%
9507%  The format of the MagickSetImageFilename method is:
9508%
9509%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9510%        const char *filename)
9511%
9512%  A description of each parameter follows:
9513%
9514%    o wand: the magick wand.
9515%
9516%    o filename: the image filename.
9517%
9518*/
9519WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9520  const char *filename)
9521{
9522  assert(wand != (MagickWand *) NULL);
9523  assert(wand->signature == WandSignature);
9524  if( IfMagickTrue(wand->debug) )
9525    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9526
9527  if (wand->images == (Image *) NULL)
9528    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9529  if (filename != (const char *) NULL)
9530    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9531  return(MagickTrue);
9532}
9533
9534/*
9535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9536%                                                                             %
9537%                                                                             %
9538%                                                                             %
9539%   M a g i c k S e t I m a g e F o r m a t                                   %
9540%                                                                             %
9541%                                                                             %
9542%                                                                             %
9543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9544%
9545%  MagickSetImageFormat() sets the format of a particular image in a
9546%  sequence.
9547%
9548%  The format of the MagickSetImageFormat method is:
9549%
9550%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9551%        const char *format)
9552%
9553%  A description of each parameter follows:
9554%
9555%    o wand: the magick wand.
9556%
9557%    o format: the image format.
9558%
9559*/
9560WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9561  const char *format)
9562{
9563  const MagickInfo
9564    *magick_info;
9565
9566  assert(wand != (MagickWand *) NULL);
9567  assert(wand->signature == WandSignature);
9568  if( IfMagickTrue(wand->debug) )
9569    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9570
9571  if (wand->images == (Image *) NULL)
9572    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9573  if ((format == (char *) NULL) || (*format == '\0'))
9574    {
9575      *wand->images->magick='\0';
9576      return(MagickTrue);
9577    }
9578  magick_info=GetMagickInfo(format,wand->exception);
9579  if (magick_info == (const MagickInfo *) NULL)
9580    return(MagickFalse);
9581  ClearMagickException(wand->exception);
9582  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9583  return(MagickTrue);
9584}
9585
9586/*
9587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9588%                                                                             %
9589%                                                                             %
9590%                                                                             %
9591%   M a g i c k S e t I m a g e F u z z                                       %
9592%                                                                             %
9593%                                                                             %
9594%                                                                             %
9595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9596%
9597%  MagickSetImageFuzz() sets the image fuzz.
9598%
9599%  The format of the MagickSetImageFuzz method is:
9600%
9601%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9602%        const double fuzz)
9603%
9604%  A description of each parameter follows:
9605%
9606%    o wand: the magick wand.
9607%
9608%    o fuzz: the image fuzz.
9609%
9610*/
9611WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9612  const double fuzz)
9613{
9614  assert(wand != (MagickWand *) NULL);
9615  assert(wand->signature == WandSignature);
9616  if( IfMagickTrue(wand->debug) )
9617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9618
9619  if (wand->images == (Image *) NULL)
9620    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9621  wand->images->fuzz=fuzz;
9622  return(MagickTrue);
9623}
9624
9625/*
9626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9627%                                                                             %
9628%                                                                             %
9629%                                                                             %
9630%   M a g i c k S e t I m a g e G a m m a                                     %
9631%                                                                             %
9632%                                                                             %
9633%                                                                             %
9634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9635%
9636%  MagickSetImageGamma() sets the image gamma.
9637%
9638%  The format of the MagickSetImageGamma method is:
9639%
9640%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9641%        const double gamma)
9642%
9643%  A description of each parameter follows:
9644%
9645%    o wand: the magick wand.
9646%
9647%    o gamma: the image gamma.
9648%
9649*/
9650WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9651  const double gamma)
9652{
9653  assert(wand != (MagickWand *) NULL);
9654  assert(wand->signature == WandSignature);
9655  if( IfMagickTrue(wand->debug) )
9656    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9657
9658  if (wand->images == (Image *) NULL)
9659    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9660  wand->images->gamma=gamma;
9661  return(MagickTrue);
9662}
9663
9664/*
9665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9666%                                                                             %
9667%                                                                             %
9668%                                                                             %
9669%   M a g i c k S e t I m a g e G r a v i t y                                 %
9670%                                                                             %
9671%                                                                             %
9672%                                                                             %
9673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9674%
9675%  MagickSetImageGravity() sets the image gravity type.
9676%
9677%  The format of the MagickSetImageGravity method is:
9678%
9679%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9680%        const GravityType gravity)
9681%
9682%  A description of each parameter follows:
9683%
9684%    o wand: the magick wand.
9685%
9686%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9687%      PlaneInterlace, PartitionInterlace.
9688%
9689*/
9690WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9691  const GravityType gravity)
9692{
9693  assert(wand != (MagickWand *) NULL);
9694  assert(wand->signature == WandSignature);
9695  if( IfMagickTrue(wand->debug) )
9696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9697
9698  if (wand->images == (Image *) NULL)
9699    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9700  wand->images->gravity=gravity;
9701  return(MagickTrue);
9702}
9703
9704/*
9705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9706%                                                                             %
9707%                                                                             %
9708%                                                                             %
9709%   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                       %
9710%                                                                             %
9711%                                                                             %
9712%                                                                             %
9713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9714%
9715%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9716%  point.
9717%
9718%  The format of the MagickSetImageGreenPrimary method is:
9719%
9720%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9721%        const double x,const double y)
9722%
9723%  A description of each parameter follows:
9724%
9725%    o wand: the magick wand.
9726%
9727%    o x: the green primary x-point.
9728%
9729%    o y: the green primary y-point.
9730%
9731%
9732*/
9733WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9734  const double x,const double y)
9735{
9736  assert(wand != (MagickWand *) NULL);
9737  assert(wand->signature == WandSignature);
9738  if( IfMagickTrue(wand->debug) )
9739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9740
9741  if (wand->images == (Image *) NULL)
9742    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9743  wand->images->chromaticity.green_primary.x=x;
9744  wand->images->chromaticity.green_primary.y=y;
9745  return(MagickTrue);
9746}
9747
9748/*
9749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9750%                                                                             %
9751%                                                                             %
9752%                                                                             %
9753%   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                 %
9754%                                                                             %
9755%                                                                             %
9756%                                                                             %
9757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9758%
9759%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9760%
9761%  The format of the MagickSetImageInterlaceScheme method is:
9762%
9763%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9764%        const InterlaceType interlace)
9765%
9766%  A description of each parameter follows:
9767%
9768%    o wand: the magick wand.
9769%
9770%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9771%      PlaneInterlace, PartitionInterlace.
9772%
9773*/
9774WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9775  const InterlaceType interlace)
9776{
9777  assert(wand != (MagickWand *) NULL);
9778  assert(wand->signature == WandSignature);
9779  if( IfMagickTrue(wand->debug) )
9780    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9781
9782  if (wand->images == (Image *) NULL)
9783    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9784  wand->images->interlace=interlace;
9785  return(MagickTrue);
9786}
9787
9788/*
9789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9790%                                                                             %
9791%                                                                             %
9792%                                                                             %
9793%   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             %
9794%                                                                             %
9795%                                                                             %
9796%                                                                             %
9797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9798%
9799%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9800%
9801%  The format of the MagickSetImagePixelInterpolateMethod method is:
9802%
9803%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9804%        const PixelInterpolateMethod method)
9805%
9806%  A description of each parameter follows:
9807%
9808%    o wand: the magick wand.
9809%
9810%    o method: the image interpole pixel methods: choose from Undefined,
9811%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9812%
9813*/
9814WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9815  const PixelInterpolateMethod method)
9816{
9817  assert(wand != (MagickWand *) NULL);
9818  assert(wand->signature == WandSignature);
9819  if( IfMagickTrue(wand->debug) )
9820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9821
9822  if (wand->images == (Image *) NULL)
9823    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9824  wand->images->interpolate=method;
9825  return(MagickTrue);
9826}
9827
9828/*
9829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9830%                                                                             %
9831%                                                                             %
9832%                                                                             %
9833%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9834%                                                                             %
9835%                                                                             %
9836%                                                                             %
9837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9838%
9839%  MagickSetImageIterations() sets the image iterations.
9840%
9841%  The format of the MagickSetImageIterations method is:
9842%
9843%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9844%        const size_t iterations)
9845%
9846%  A description of each parameter follows:
9847%
9848%    o wand: the magick wand.
9849%
9850%    o delay: the image delay in 1/100th of a second.
9851%
9852*/
9853WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9854  const size_t iterations)
9855{
9856  assert(wand != (MagickWand *) NULL);
9857  assert(wand->signature == WandSignature);
9858  if( IfMagickTrue(wand->debug) )
9859    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9860
9861  if (wand->images == (Image *) NULL)
9862    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9863  wand->images->iterations=iterations;
9864  return(MagickTrue);
9865}
9866
9867/*
9868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9869%                                                                             %
9870%                                                                             %
9871%                                                                             %
9872%   M a g i c k S e t I m a g e M a t t e                                     %
9873%                                                                             %
9874%                                                                             %
9875%                                                                             %
9876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9877%
9878%  MagickSetImageMatte() sets the image matte channel.
9879%
9880%  The format of the MagickSetImageMatteColor method is:
9881%
9882%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9883%        const MagickBooleanType *matte)
9884%
9885%  A description of each parameter follows:
9886%
9887%    o wand: the magick wand.
9888%
9889%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9890%      MagickFalse.
9891%
9892*/
9893WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9894  const MagickBooleanType matte)
9895{
9896  assert(wand != (MagickWand *) NULL);
9897  assert(wand->signature == WandSignature);
9898  if( IfMagickTrue(wand->debug) )
9899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9900
9901  if (wand->images == (Image *) NULL)
9902    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9903  if( IfMagickFalse(wand->images->matte) && IsMagickTrue(matte))
9904    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9905  wand->images->matte=matte;
9906  return(MagickTrue);
9907}
9908
9909/*
9910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9911%                                                                             %
9912%                                                                             %
9913%                                                                             %
9914%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9915%                                                                             %
9916%                                                                             %
9917%                                                                             %
9918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9919%
9920%  MagickSetImageMatteColor() sets the image matte color.
9921%
9922%  The format of the MagickSetImageMatteColor method is:
9923%
9924%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9925%        const PixelWand *matte)
9926%
9927%  A description of each parameter follows:
9928%
9929%    o wand: the magick wand.
9930%
9931%    o matte: the matte pixel wand.
9932%
9933*/
9934WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9935  const PixelWand *matte)
9936{
9937  assert(wand != (MagickWand *) NULL);
9938  assert(wand->signature == WandSignature);
9939  if( IfMagickTrue(wand->debug) )
9940    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9941
9942  if (wand->images == (Image *) NULL)
9943    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9944  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9945  return(MagickTrue);
9946}
9947
9948/*
9949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9950%                                                                             %
9951%                                                                             %
9952%                                                                             %
9953%   M a g i c k S e t I m a g e O p a c i t y                                 %
9954%                                                                             %
9955%                                                                             %
9956%                                                                             %
9957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9958%
9959%  MagickSetImageAlpha() sets the image to the specified alpha level.
9960%
9961%  The format of the MagickSetImageAlpha method is:
9962%
9963%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9964%        const double alpha)
9965%
9966%  A description of each parameter follows:
9967%
9968%    o wand: the magick wand.
9969%
9970%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9971%      transparent.
9972%
9973*/
9974WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9975  const double alpha)
9976{
9977  MagickBooleanType
9978    status;
9979
9980  assert(wand != (MagickWand *) NULL);
9981  assert(wand->signature == WandSignature);
9982  if( IfMagickTrue(wand->debug) )
9983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9984
9985  if (wand->images == (Image *) NULL)
9986    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9987  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9988    wand->exception);
9989  return(status);
9990}
9991
9992/*
9993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9994%                                                                             %
9995%                                                                             %
9996%                                                                             %
9997%   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                         %
9998%                                                                             %
9999%                                                                             %
10000%                                                                             %
10001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10002%
10003%  MagickSetImageOrientation() sets the image orientation.
10004%
10005%  The format of the MagickSetImageOrientation method is:
10006%
10007%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10008%        const OrientationType orientation)
10009%
10010%  A description of each parameter follows:
10011%
10012%    o wand: the magick wand.
10013%
10014%    o orientation: the image orientation type.
10015%
10016*/
10017WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10018  const OrientationType orientation)
10019{
10020  assert(wand != (MagickWand *) NULL);
10021  assert(wand->signature == WandSignature);
10022  if( IfMagickTrue(wand->debug) )
10023    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10024
10025  if (wand->images == (Image *) NULL)
10026    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10027  wand->images->orientation=orientation;
10028  return(MagickTrue);
10029}
10030
10031/*
10032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10033%                                                                             %
10034%                                                                             %
10035%                                                                             %
10036%   M a g i c k S e t I m a g e P a g e                                       %
10037%                                                                             %
10038%                                                                             %
10039%                                                                             %
10040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10041%
10042%  MagickSetImagePage() sets the page geometry of the image.
10043%
10044%  The format of the MagickSetImagePage method is:
10045%
10046%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10047%        const size_t width,const size_t height,const ssize_t x,
10048%        const ssize_t y)
10049%
10050%  A description of each parameter follows:
10051%
10052%    o wand: the magick wand.
10053%
10054%    o width: the page width.
10055%
10056%    o height: the page height.
10057%
10058%    o x: the page x-offset.
10059%
10060%    o y: the page y-offset.
10061%
10062*/
10063WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10064  const size_t width,const size_t height,const ssize_t x,
10065  const ssize_t y)
10066{
10067  assert(wand != (MagickWand *) NULL);
10068  assert(wand->signature == WandSignature);
10069  if( IfMagickTrue(wand->debug) )
10070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10071
10072  if (wand->images == (Image *) NULL)
10073    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10074  wand->images->page.width=width;
10075  wand->images->page.height=height;
10076  wand->images->page.x=x;
10077  wand->images->page.y=y;
10078  return(MagickTrue);
10079}
10080
10081/*
10082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10083%                                                                             %
10084%                                                                             %
10085%                                                                             %
10086%   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                 %
10087%                                                                             %
10088%                                                                             %
10089%                                                                             %
10090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10091%
10092%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10093%  specified method and returns the previous progress monitor if any.  The
10094%  progress monitor method looks like this:
10095%
10096%    MagickBooleanType MagickProgressMonitor(const char *text,
10097%      const MagickOffsetType offset,const MagickSizeType span,
10098%      void *client_data)
10099%
10100%  If the progress monitor returns MagickFalse, the current operation is
10101%  interrupted.
10102%
10103%  The format of the MagickSetImageProgressMonitor method is:
10104%
10105%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10106%        const MagickProgressMonitor progress_monitor,void *client_data)
10107%
10108%  A description of each parameter follows:
10109%
10110%    o wand: the magick wand.
10111%
10112%    o progress_monitor: Specifies a pointer to a method to monitor progress
10113%      of an image operation.
10114%
10115%    o client_data: Specifies a pointer to any client data.
10116%
10117*/
10118WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10119  const MagickProgressMonitor progress_monitor,void *client_data)
10120{
10121  MagickProgressMonitor
10122    previous_monitor;
10123
10124  assert(wand != (MagickWand *) NULL);
10125  assert(wand->signature == WandSignature);
10126  if( IfMagickTrue(wand->debug) )
10127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10128
10129  if (wand->images == (Image *) NULL)
10130    {
10131      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10132        "ContainsNoImages","`%s'",wand->name);
10133      return((MagickProgressMonitor) NULL);
10134    }
10135  previous_monitor=SetImageProgressMonitor(wand->images,
10136    progress_monitor,client_data);
10137  return(previous_monitor);
10138}
10139
10140/*
10141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142%                                                                             %
10143%                                                                             %
10144%                                                                             %
10145%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10146%                                                                             %
10147%                                                                             %
10148%                                                                             %
10149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10150%
10151%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10152%
10153%  The format of the MagickSetImageRedPrimary method is:
10154%
10155%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10156%        const double x,const double y)
10157%
10158%  A description of each parameter follows:
10159%
10160%    o wand: the magick wand.
10161%
10162%    o x: the red primary x-point.
10163%
10164%    o y: the red primary y-point.
10165%
10166*/
10167WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10168  const double x,const double y)
10169{
10170  assert(wand != (MagickWand *) NULL);
10171  assert(wand->signature == WandSignature);
10172  if( IfMagickTrue(wand->debug) )
10173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10174
10175  if (wand->images == (Image *) NULL)
10176    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10177  wand->images->chromaticity.red_primary.x=x;
10178  wand->images->chromaticity.red_primary.y=y;
10179  return(MagickTrue);
10180}
10181
10182/*
10183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10184%                                                                             %
10185%                                                                             %
10186%                                                                             %
10187%   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                 %
10188%                                                                             %
10189%                                                                             %
10190%                                                                             %
10191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10192%
10193%  MagickSetImageRenderingIntent() sets the image rendering intent.
10194%
10195%  The format of the MagickSetImageRenderingIntent method is:
10196%
10197%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10198%        const RenderingIntent rendering_intent)
10199%
10200%  A description of each parameter follows:
10201%
10202%    o wand: the magick wand.
10203%
10204%    o rendering_intent: the image rendering intent: UndefinedIntent,
10205%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10206%
10207*/
10208WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10209  const RenderingIntent rendering_intent)
10210{
10211  assert(wand != (MagickWand *) NULL);
10212  assert(wand->signature == WandSignature);
10213  if( IfMagickTrue(wand->debug) )
10214    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10215
10216  if (wand->images == (Image *) NULL)
10217    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10218  wand->images->rendering_intent=rendering_intent;
10219  return(MagickTrue);
10220}
10221
10222/*
10223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10224%                                                                             %
10225%                                                                             %
10226%                                                                             %
10227%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10228%                                                                             %
10229%                                                                             %
10230%                                                                             %
10231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10232%
10233%  MagickSetImageResolution() sets the image resolution.
10234%
10235%  The format of the MagickSetImageResolution method is:
10236%
10237%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10238%        const double x_resolution,const doubtl y_resolution)
10239%
10240%  A description of each parameter follows:
10241%
10242%    o wand: the magick wand.
10243%
10244%    o x_resolution: the image x resolution.
10245%
10246%    o y_resolution: the image y resolution.
10247%
10248*/
10249WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10250  const double x_resolution,const double y_resolution)
10251{
10252  assert(wand != (MagickWand *) NULL);
10253  assert(wand->signature == WandSignature);
10254  if( IfMagickTrue(wand->debug) )
10255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10256
10257  if (wand->images == (Image *) NULL)
10258    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10259  wand->images->resolution.x=x_resolution;
10260  wand->images->resolution.y=y_resolution;
10261  return(MagickTrue);
10262}
10263
10264/*
10265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266%                                                                             %
10267%                                                                             %
10268%                                                                             %
10269%   M a g i c k S e t I m a g e S c e n e                                     %
10270%                                                                             %
10271%                                                                             %
10272%                                                                             %
10273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10274%
10275%  MagickSetImageScene() sets the image scene.
10276%
10277%  The format of the MagickSetImageScene method is:
10278%
10279%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10280%        const size_t scene)
10281%
10282%  A description of each parameter follows:
10283%
10284%    o wand: the magick wand.
10285%
10286%    o delay: the image scene number.
10287%
10288*/
10289WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10290  const size_t scene)
10291{
10292  assert(wand != (MagickWand *) NULL);
10293  assert(wand->signature == WandSignature);
10294  if( IfMagickTrue(wand->debug) )
10295    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10296
10297  if (wand->images == (Image *) NULL)
10298    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10299  wand->images->scene=scene;
10300  return(MagickTrue);
10301}
10302
10303/*
10304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10305%                                                                             %
10306%                                                                             %
10307%                                                                             %
10308%   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                   %
10309%                                                                             %
10310%                                                                             %
10311%                                                                             %
10312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10313%
10314%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10315%
10316%  The format of the MagickSetImageTicksPerSecond method is:
10317%
10318%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10319%        const ssize_t ticks_per-second)
10320%
10321%  A description of each parameter follows:
10322%
10323%    o wand: the magick wand.
10324%
10325%    o ticks_per_second: the units to use for the image delay.
10326%
10327*/
10328WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10329  const ssize_t ticks_per_second)
10330{
10331  assert(wand != (MagickWand *) NULL);
10332  assert(wand->signature == WandSignature);
10333  if( IfMagickTrue(wand->debug) )
10334    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10335
10336  if (wand->images == (Image *) NULL)
10337    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10338  wand->images->ticks_per_second=ticks_per_second;
10339  return(MagickTrue);
10340}
10341
10342/*
10343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10344%                                                                             %
10345%                                                                             %
10346%                                                                             %
10347%   M a g i c k S e t I m a g e T y p e                                       %
10348%                                                                             %
10349%                                                                             %
10350%                                                                             %
10351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10352%
10353%  MagickSetImageType() sets the image type.
10354%
10355%  The format of the MagickSetImageType method is:
10356%
10357%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10358%        const ImageType image_type)
10359%
10360%  A description of each parameter follows:
10361%
10362%    o wand: the magick wand.
10363%
10364%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10365%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10366%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10367%      or OptimizeType.
10368%
10369*/
10370WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10371  const ImageType image_type)
10372{
10373  assert(wand != (MagickWand *) NULL);
10374  assert(wand->signature == WandSignature);
10375  if( IfMagickTrue(wand->debug) )
10376    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10377
10378  if (wand->images == (Image *) NULL)
10379    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10380  return(SetImageType(wand->images,image_type,wand->exception));
10381}
10382
10383/*
10384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10385%                                                                             %
10386%                                                                             %
10387%                                                                             %
10388%   M a g i c k S e t I m a g e U n i t s                                     %
10389%                                                                             %
10390%                                                                             %
10391%                                                                             %
10392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10393%
10394%  MagickSetImageUnits() sets the image units of resolution.
10395%
10396%  The format of the MagickSetImageUnits method is:
10397%
10398%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10399%        const ResolutionType units)
10400%
10401%  A description of each parameter follows:
10402%
10403%    o wand: the magick wand.
10404%
10405%    o units: the image units of resolution : UndefinedResolution,
10406%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10407%
10408*/
10409WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10410  const ResolutionType units)
10411{
10412  assert(wand != (MagickWand *) NULL);
10413  assert(wand->signature == WandSignature);
10414  if( IfMagickTrue(wand->debug) )
10415    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10416
10417  if (wand->images == (Image *) NULL)
10418    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10419  wand->images->units=units;
10420  return(MagickTrue);
10421}
10422
10423/*
10424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10425%                                                                             %
10426%                                                                             %
10427%                                                                             %
10428%   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           %
10429%                                                                             %
10430%                                                                             %
10431%                                                                             %
10432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10433%
10434%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10435%
10436%  The format of the MagickSetImageVirtualPixelMethod method is:
10437%
10438%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10439%        const VirtualPixelMethod method)
10440%
10441%  A description of each parameter follows:
10442%
10443%    o wand: the magick wand.
10444%
10445%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10446%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10447%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10448%
10449*/
10450WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10451  const VirtualPixelMethod method)
10452{
10453  assert(wand != (MagickWand *) NULL);
10454  assert(wand->signature == WandSignature);
10455  if( IfMagickTrue(wand->debug) )
10456    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10457
10458  if (wand->images == (Image *) NULL)
10459    return(UndefinedVirtualPixelMethod);
10460  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10461}
10462
10463/*
10464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10465%                                                                             %
10466%                                                                             %
10467%                                                                             %
10468%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10469%                                                                             %
10470%                                                                             %
10471%                                                                             %
10472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10473%
10474%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10475%
10476%  The format of the MagickSetImageWhitePoint method is:
10477%
10478%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10479%        const double x,const double y)
10480%
10481%  A description of each parameter follows:
10482%
10483%    o wand: the magick wand.
10484%
10485%    o x: the white x-point.
10486%
10487%    o y: the white y-point.
10488%
10489*/
10490WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10491  const double x,const double y)
10492{
10493  assert(wand != (MagickWand *) NULL);
10494  assert(wand->signature == WandSignature);
10495  if( IfMagickTrue(wand->debug) )
10496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10497
10498  if (wand->images == (Image *) NULL)
10499    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10500  wand->images->chromaticity.white_point.x=x;
10501  wand->images->chromaticity.white_point.y=y;
10502  return(MagickTrue);
10503}
10504
10505/*
10506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10507%                                                                             %
10508%                                                                             %
10509%                                                                             %
10510%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10511%                                                                             %
10512%                                                                             %
10513%                                                                             %
10514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10515%
10516%  MagickShadeImage() shines a distant light on an image to create a
10517%  three-dimensional effect. You control the positioning of the light with
10518%  azimuth and elevation; azimuth is measured in degrees off the x axis
10519%  and elevation is measured in pixels above the Z axis.
10520%
10521%  The format of the MagickShadeImage method is:
10522%
10523%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10524%        const MagickBooleanType gray,const double azimuth,
10525%        const double elevation)
10526%
10527%  A description of each parameter follows:
10528%
10529%    o wand: the magick wand.
10530%
10531%    o gray: A value other than zero shades the intensity of each pixel.
10532%
10533%    o azimuth, elevation:  Define the light source direction.
10534%
10535*/
10536WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10537  const MagickBooleanType gray,const double asimuth,const double elevation)
10538{
10539  Image
10540    *shade_image;
10541
10542  assert(wand != (MagickWand *) NULL);
10543  assert(wand->signature == WandSignature);
10544  if( IfMagickTrue(wand->debug) )
10545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10546
10547  if (wand->images == (Image *) NULL)
10548    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10549  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10550  if (shade_image == (Image *) NULL)
10551    return(MagickFalse);
10552  ReplaceImageInList(&wand->images,shade_image);
10553  return(MagickTrue);
10554}
10555
10556/*
10557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10558%                                                                             %
10559%                                                                             %
10560%                                                                             %
10561%   M a g i c k S h a d o w I m a g e                                         %
10562%                                                                             %
10563%                                                                             %
10564%                                                                             %
10565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10566%
10567%  MagickShadowImage() simulates an image shadow.
10568%
10569%  The format of the MagickShadowImage method is:
10570%
10571%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10572%        const double sigma,const ssize_t x,const ssize_t y)
10573%
10574%  A description of each parameter follows:
10575%
10576%    o wand: the magick wand.
10577%
10578%    o alpha: percentage transparency.
10579%
10580%    o sigma: the standard deviation of the Gaussian, in pixels.
10581%
10582%    o x: the shadow x-offset.
10583%
10584%    o y: the shadow y-offset.
10585%
10586*/
10587WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10588  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10589{
10590  Image
10591    *shadow_image;
10592
10593  assert(wand != (MagickWand *) NULL);
10594  assert(wand->signature == WandSignature);
10595  if( IfMagickTrue(wand->debug) )
10596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10597
10598  if (wand->images == (Image *) NULL)
10599    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10600  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10601  if (shadow_image == (Image *) NULL)
10602    return(MagickFalse);
10603  ReplaceImageInList(&wand->images,shadow_image);
10604  return(MagickTrue);
10605}
10606
10607/*
10608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10609%                                                                             %
10610%                                                                             %
10611%                                                                             %
10612%   M a g i c k S h a r p e n I m a g e                                       %
10613%                                                                             %
10614%                                                                             %
10615%                                                                             %
10616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10617%
10618%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10619%  Gaussian operator of the given radius and standard deviation (sigma).
10620%  For reasonable results, the radius should be larger than sigma.  Use a
10621%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10622%
10623%  The format of the MagickSharpenImage method is:
10624%
10625%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10626%        const double radius,const double sigma)
10627%
10628%  A description of each parameter follows:
10629%
10630%    o wand: the magick wand.
10631%
10632%    o radius: the radius of the Gaussian, in pixels, not counting the center
10633%      pixel.
10634%
10635%    o sigma: the standard deviation of the Gaussian, in pixels.
10636%
10637*/
10638WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10639  const double radius,const double sigma)
10640{
10641  Image
10642    *sharp_image;
10643
10644  assert(wand != (MagickWand *) NULL);
10645  assert(wand->signature == WandSignature);
10646  if( IfMagickTrue(wand->debug) )
10647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10648
10649  if (wand->images == (Image *) NULL)
10650    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10651  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10652  if (sharp_image == (Image *) NULL)
10653    return(MagickFalse);
10654  ReplaceImageInList(&wand->images,sharp_image);
10655  return(MagickTrue);
10656}
10657
10658/*
10659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10660%                                                                             %
10661%                                                                             %
10662%                                                                             %
10663%   M a g i c k S h a v e I m a g e                                           %
10664%                                                                             %
10665%                                                                             %
10666%                                                                             %
10667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10668%
10669%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10670%  memory necessary for the new Image structure and returns a pointer to the
10671%  new image.
10672%
10673%  The format of the MagickShaveImage method is:
10674%
10675%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10676%        const size_t columns,const size_t rows)
10677%
10678%  A description of each parameter follows:
10679%
10680%    o wand: the magick wand.
10681%
10682%    o columns: the number of columns in the scaled image.
10683%
10684%    o rows: the number of rows in the scaled image.
10685%
10686%
10687*/
10688WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10689  const size_t columns,const size_t rows)
10690{
10691  Image
10692    *shave_image;
10693
10694  RectangleInfo
10695    shave_info;
10696
10697  assert(wand != (MagickWand *) NULL);
10698  assert(wand->signature == WandSignature);
10699  if( IfMagickTrue(wand->debug) )
10700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10701
10702  if (wand->images == (Image *) NULL)
10703    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10704  shave_info.width=columns;
10705  shave_info.height=rows;
10706  shave_info.x=0;
10707  shave_info.y=0;
10708  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10709  if (shave_image == (Image *) NULL)
10710    return(MagickFalse);
10711  ReplaceImageInList(&wand->images,shave_image);
10712  return(MagickTrue);
10713}
10714
10715/*
10716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10717%                                                                             %
10718%                                                                             %
10719%                                                                             %
10720%   M a g i c k S h e a r I m a g e                                           %
10721%                                                                             %
10722%                                                                             %
10723%                                                                             %
10724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725%
10726%  MagickShearImage() slides one edge of an image along the X or Y axis,
10727%  creating a parallelogram.  An X direction shear slides an edge along the X
10728%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10729%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10730%  is measured relative to the Y axis, and similarly, for Y direction shears
10731%  y_shear is measured relative to the X axis.  Empty triangles left over from
10732%  shearing the image are filled with the background color.
10733%
10734%  The format of the MagickShearImage method is:
10735%
10736%      MagickBooleanType MagickShearImage(MagickWand *wand,
10737%        const PixelWand *background,const double x_shear,onst double y_shear)
10738%
10739%  A description of each parameter follows:
10740%
10741%    o wand: the magick wand.
10742%
10743%    o background: the background pixel wand.
10744%
10745%    o x_shear: the number of degrees to shear the image.
10746%
10747%    o y_shear: the number of degrees to shear the image.
10748%
10749*/
10750WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10751  const PixelWand *background,const double x_shear,const double y_shear)
10752{
10753  Image
10754    *shear_image;
10755
10756  assert(wand != (MagickWand *) NULL);
10757  assert(wand->signature == WandSignature);
10758  if( IfMagickTrue(wand->debug) )
10759    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10760
10761  if (wand->images == (Image *) NULL)
10762    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10763  PixelGetQuantumPacket(background,&wand->images->background_color);
10764  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10765  if (shear_image == (Image *) NULL)
10766    return(MagickFalse);
10767  ReplaceImageInList(&wand->images,shear_image);
10768  return(MagickTrue);
10769}
10770
10771/*
10772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10773%                                                                             %
10774%                                                                             %
10775%                                                                             %
10776%   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                   %
10777%                                                                             %
10778%                                                                             %
10779%                                                                             %
10780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10781%
10782%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10783%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10784%  image using a sigmoidal transfer function without saturating highlights or
10785%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10786%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10787%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10788%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10789%  is reduced.
10790%
10791%  The format of the MagickSigmoidalContrastImage method is:
10792%
10793%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10794%        const MagickBooleanType sharpen,const double alpha,const double beta)
10795%
10796%  A description of each parameter follows:
10797%
10798%    o wand: the magick wand.
10799%
10800%    o sharpen: Increase or decrease image contrast.
10801%
10802%    o alpha: strength of the contrast, the larger the number the more
10803%      'threshold-like' it becomes.
10804%
10805%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10806%
10807*/
10808WandExport MagickBooleanType MagickSigmoidalContrastImage(
10809  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10810  const double beta)
10811{
10812  MagickBooleanType
10813    status;
10814
10815  assert(wand != (MagickWand *) NULL);
10816  assert(wand->signature == WandSignature);
10817  if( IfMagickTrue(wand->debug) )
10818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10819
10820  if (wand->images == (Image *) NULL)
10821    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10822  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10823    wand->exception);
10824  return(status);
10825}
10826
10827/*
10828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10829%                                                                             %
10830%                                                                             %
10831%                                                                             %
10832%   M a g i c k S i m i l a r i t y I m a g e                                 %
10833%                                                                             %
10834%                                                                             %
10835%                                                                             %
10836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10837%
10838%  MagickSimilarityImage() compares the reference image of the image and
10839%  returns the best match offset.  In addition, it returns a similarity image
10840%  such that an exact match location is completely white and if none of the
10841%  pixels match, black, otherwise some gray level in-between.
10842%
10843%  The format of the MagickSimilarityImage method is:
10844%
10845%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10846%        const MagickWand *reference,const MetricType metric,
10847%        RectangeInfo *offset,double *similarity)
10848%
10849%  A description of each parameter follows:
10850%
10851%    o wand: the magick wand.
10852%
10853%    o reference: the reference wand.
10854%
10855%    o metric: the metric.
10856%
10857%    o offset: the best match offset of the reference image within the image.
10858%
10859%    o similarity: the computed similarity between the images.
10860%
10861*/
10862WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10863  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10864  double *similarity)
10865{
10866  Image
10867    *similarity_image;
10868
10869  assert(wand != (MagickWand *) NULL);
10870  assert(wand->signature == WandSignature);
10871  if( IfMagickTrue(wand->debug) )
10872    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10873
10874  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10875    {
10876      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10877        "ContainsNoImages","`%s'",wand->name);
10878      return((MagickWand *) NULL);
10879    }
10880  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10881    similarity,wand->exception);
10882  if (similarity_image == (Image *) NULL)
10883    return((MagickWand *) NULL);
10884  return(CloneMagickWandFromImages(wand,similarity_image));
10885}
10886
10887/*
10888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889%                                                                             %
10890%                                                                             %
10891%                                                                             %
10892%   M a g i c k S k e t c h I m a g e                                         %
10893%                                                                             %
10894%                                                                             %
10895%                                                                             %
10896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10897%
10898%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10899%  a Gaussian operator of the given radius and standard deviation (sigma).
10900%  For reasonable results, radius should be larger than sigma.  Use a
10901%  radius of 0 and SketchImage() selects a suitable radius for you.
10902%  Angle gives the angle of the blurring motion.
10903%
10904%  The format of the MagickSketchImage method is:
10905%
10906%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10907%        const double radius,const double sigma,const double angle)
10908%
10909%  A description of each parameter follows:
10910%
10911%    o wand: the magick wand.
10912%
10913%    o radius: the radius of the Gaussian, in pixels, not counting
10914%      the center pixel.
10915%
10916%    o sigma: the standard deviation of the Gaussian, in pixels.
10917%
10918%    o angle: apply the effect along this angle.
10919%
10920*/
10921WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10922  const double radius,const double sigma,const double angle)
10923{
10924  Image
10925    *sketch_image;
10926
10927  assert(wand != (MagickWand *) NULL);
10928  assert(wand->signature == WandSignature);
10929  if( IfMagickTrue(wand->debug) )
10930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10931
10932  if (wand->images == (Image *) NULL)
10933    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10934  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10935  if (sketch_image == (Image *) NULL)
10936    return(MagickFalse);
10937  ReplaceImageInList(&wand->images,sketch_image);
10938  return(MagickTrue);
10939}
10940
10941/*
10942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10943%                                                                             %
10944%                                                                             %
10945%                                                                             %
10946%   M a g i c k S m u s h I m a g e s                                         %
10947%                                                                             %
10948%                                                                             %
10949%                                                                             %
10950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10951%
10952%  MagickSmushImages() takes all images from the current image pointer to the
10953%  end of the image list and smushs them to each other top-to-bottom if the
10954%  stack parameter is true, otherwise left-to-right.
10955%
10956%  The format of the MagickSmushImages method is:
10957%
10958%      MagickWand *MagickSmushImages(MagickWand *wand,
10959%        const MagickBooleanType stack,const ssize_t offset)
10960%
10961%  A description of each parameter follows:
10962%
10963%    o wand: the magick wand.
10964%
10965%    o stack: By default, images are stacked left-to-right. Set stack to
10966%      MagickTrue to stack them top-to-bottom.
10967%
10968%    o offset: minimum distance in pixels between images.
10969%
10970*/
10971WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10972  const MagickBooleanType stack,const ssize_t offset)
10973{
10974  Image
10975    *smush_image;
10976
10977  assert(wand != (MagickWand *) NULL);
10978  assert(wand->signature == WandSignature);
10979  if( IfMagickTrue(wand->debug) )
10980    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10981
10982  if (wand->images == (Image *) NULL)
10983    return((MagickWand *) NULL);
10984  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10985  if (smush_image == (Image *) NULL)
10986    return((MagickWand *) NULL);
10987  return(CloneMagickWandFromImages(wand,smush_image));
10988}
10989
10990/*
10991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10992%                                                                             %
10993%                                                                             %
10994%                                                                             %
10995%     M a g i c k S o l a r i z e I m a g e                                   %
10996%                                                                             %
10997%                                                                             %
10998%                                                                             %
10999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11000%
11001%  MagickSolarizeImage() applies a special effect to the image, similar to the
11002%  effect achieved in a photo darkroom by selectively exposing areas of photo
11003%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11004%  measure of the extent of the solarization.
11005%
11006%  The format of the MagickSolarizeImage method is:
11007%
11008%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11009%        const double threshold)
11010%
11011%  A description of each parameter follows:
11012%
11013%    o wand: the magick wand.
11014%
11015%    o threshold:  Define the extent of the solarization.
11016%
11017*/
11018WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11019  const double threshold)
11020{
11021  MagickBooleanType
11022    status;
11023
11024  assert(wand != (MagickWand *) NULL);
11025  assert(wand->signature == WandSignature);
11026  if( IfMagickTrue(wand->debug) )
11027    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11028
11029  if (wand->images == (Image *) NULL)
11030    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11031  status=SolarizeImage(wand->images,threshold,wand->exception);
11032  return(status);
11033}
11034
11035/*
11036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11037%                                                                             %
11038%                                                                             %
11039%                                                                             %
11040%   M a g i c k S p a r s e C o l o r I m a g e                               %
11041%                                                                             %
11042%                                                                             %
11043%                                                                             %
11044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11045%
11046%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11047%  colors found at those coordinates, across the whole image, using various
11048%  methods.
11049%
11050%  The format of the MagickSparseColorImage method is:
11051%
11052%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11053%        const SparseColorMethod method,const size_t number_arguments,
11054%        const double *arguments)
11055%
11056%  A description of each parameter follows:
11057%
11058%    o image: the image to be sparseed.
11059%
11060%    o method: the method of image sparseion.
11061%
11062%        ArcSparseColorion will always ignore source image offset, and always
11063%        'bestfit' the destination image with the top left corner offset
11064%        relative to the polar mapping center.
11065%
11066%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11067%        style of image sparseion.
11068%
11069%        Affine, Perspective, and Bilinear, will do least squares fitting of
11070%        the distrotion when more than the minimum number of control point
11071%        pairs are provided.
11072%
11073%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11074%        less than 4 control point pairs are provided. While Affine sparseions
11075%        will let you use any number of control point pairs, that is Zero pairs
11076%        is a No-Op (viewport only) distrotion, one pair is a translation and
11077%        two pairs of control points will do a scale-rotate-translate, without
11078%        any shearing.
11079%
11080%    o number_arguments: the number of arguments given for this sparseion
11081%      method.
11082%
11083%    o arguments: the arguments for this sparseion method.
11084%
11085*/
11086WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11087  const SparseColorMethod method,const size_t number_arguments,
11088  const double *arguments)
11089{
11090  Image
11091    *sparse_image;
11092
11093  assert(wand != (MagickWand *) NULL);
11094  assert(wand->signature == WandSignature);
11095  if( IfMagickTrue(wand->debug) )
11096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11097
11098  if (wand->images == (Image *) NULL)
11099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11100  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11101    wand->exception);
11102  if (sparse_image == (Image *) NULL)
11103    return(MagickFalse);
11104  ReplaceImageInList(&wand->images,sparse_image);
11105  return(MagickTrue);
11106}
11107
11108/*
11109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11110%                                                                             %
11111%                                                                             %
11112%                                                                             %
11113%   M a g i c k S p l i c e I m a g e                                         %
11114%                                                                             %
11115%                                                                             %
11116%                                                                             %
11117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11118%
11119%  MagickSpliceImage() splices a solid color into the image.
11120%
11121%  The format of the MagickSpliceImage method is:
11122%
11123%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11124%        const size_t width,const size_t height,const ssize_t x,
11125%        const ssize_t y)
11126%
11127%  A description of each parameter follows:
11128%
11129%    o wand: the magick wand.
11130%
11131%    o width: the region width.
11132%
11133%    o height: the region height.
11134%
11135%    o x: the region x offset.
11136%
11137%    o y: the region y offset.
11138%
11139*/
11140WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11141  const size_t width,const size_t height,const ssize_t x,
11142  const ssize_t y)
11143{
11144  Image
11145    *splice_image;
11146
11147  RectangleInfo
11148    splice;
11149
11150  assert(wand != (MagickWand *) NULL);
11151  assert(wand->signature == WandSignature);
11152  if( IfMagickTrue(wand->debug) )
11153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11154
11155  if (wand->images == (Image *) NULL)
11156    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11157  splice.width=width;
11158  splice.height=height;
11159  splice.x=x;
11160  splice.y=y;
11161  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11162  if (splice_image == (Image *) NULL)
11163    return(MagickFalse);
11164  ReplaceImageInList(&wand->images,splice_image);
11165  return(MagickTrue);
11166}
11167
11168/*
11169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11170%                                                                             %
11171%                                                                             %
11172%                                                                             %
11173%   M a g i c k S p r e a d I m a g e                                         %
11174%                                                                             %
11175%                                                                             %
11176%                                                                             %
11177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11178%
11179%  MagickSpreadImage() is a special effects method that randomly displaces each
11180%  pixel in a block defined by the radius parameter.
11181%
11182%  The format of the MagickSpreadImage method is:
11183%
11184%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11185%        const PixelInterpolateMethod method)
11186%
11187%  A description of each parameter follows:
11188%
11189%    o wand: the magick wand.
11190%
11191%    o radius:  Choose a random pixel in a neighborhood of this extent.
11192%
11193%    o method: the pixel interpolation method.
11194%
11195*/
11196WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11197  const double radius,const PixelInterpolateMethod method)
11198{
11199  Image
11200    *spread_image;
11201
11202  assert(wand != (MagickWand *) NULL);
11203  assert(wand->signature == WandSignature);
11204  if( IfMagickTrue(wand->debug) )
11205    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11206
11207  if (wand->images == (Image *) NULL)
11208    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11209  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11210  if (spread_image == (Image *) NULL)
11211    return(MagickFalse);
11212  ReplaceImageInList(&wand->images,spread_image);
11213  return(MagickTrue);
11214}
11215
11216/*
11217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11218%                                                                             %
11219%                                                                             %
11220%                                                                             %
11221%   M a g i c k S t a t i s t i c I m a g e                                   %
11222%                                                                             %
11223%                                                                             %
11224%                                                                             %
11225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11226%
11227%  MagickStatisticImage() replace each pixel with corresponding statistic from
11228%  the neighborhood of the specified width and height.
11229%
11230%  The format of the MagickStatisticImage method is:
11231%
11232%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11233%        const StatisticType type,const double width,const size_t height)
11234%
11235%  A description of each parameter follows:
11236%
11237%    o wand: the magick wand.
11238%
11239%    o type: the statistic type (e.g. median, mode, etc.).
11240%
11241%    o width: the width of the pixel neighborhood.
11242%
11243%    o height: the height of the pixel neighborhood.
11244%
11245*/
11246WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11247  const StatisticType type,const size_t width,const size_t height)
11248{
11249  Image
11250    *statistic_image;
11251
11252  assert(wand != (MagickWand *) NULL);
11253  assert(wand->signature == WandSignature);
11254  if( IfMagickTrue(wand->debug) )
11255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11256
11257  if (wand->images == (Image *) NULL)
11258    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11259  statistic_image=StatisticImage(wand->images,type,width,height,
11260    wand->exception);
11261  if (statistic_image == (Image *) NULL)
11262    return(MagickFalse);
11263  ReplaceImageInList(&wand->images,statistic_image);
11264  return(MagickTrue);
11265}
11266
11267/*
11268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11269%                                                                             %
11270%                                                                             %
11271%                                                                             %
11272%   M a g i c k S t e g a n o I m a g e                                       %
11273%                                                                             %
11274%                                                                             %
11275%                                                                             %
11276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11277%
11278%  MagickSteganoImage() hides a digital watermark within the image.
11279%  Recover the hidden watermark later to prove that the authenticity of
11280%  an image.  Offset defines the start position within the image to hide
11281%  the watermark.
11282%
11283%  The format of the MagickSteganoImage method is:
11284%
11285%      MagickWand *MagickSteganoImage(MagickWand *wand,
11286%        const MagickWand *watermark_wand,const ssize_t offset)
11287%
11288%  A description of each parameter follows:
11289%
11290%    o wand: the magick wand.
11291%
11292%    o watermark_wand: the watermark wand.
11293%
11294%    o offset: Start hiding at this offset into the image.
11295%
11296*/
11297WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11298  const MagickWand *watermark_wand,const ssize_t offset)
11299{
11300  Image
11301    *stegano_image;
11302
11303  assert(wand != (MagickWand *) NULL);
11304  assert(wand->signature == WandSignature);
11305  if( IfMagickTrue(wand->debug) )
11306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11307
11308  if ((wand->images == (Image *) NULL) ||
11309      (watermark_wand->images == (Image *) NULL))
11310    {
11311      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11312        "ContainsNoImages","`%s'",wand->name);
11313      return((MagickWand *) NULL);
11314    }
11315  wand->images->offset=offset;
11316  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11317    wand->exception);
11318  if (stegano_image == (Image *) NULL)
11319    return((MagickWand *) NULL);
11320  return(CloneMagickWandFromImages(wand,stegano_image));
11321}
11322
11323/*
11324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11325%                                                                             %
11326%                                                                             %
11327%                                                                             %
11328%   M a g i c k S t e r e o I m a g e                                         %
11329%                                                                             %
11330%                                                                             %
11331%                                                                             %
11332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11333%
11334%  MagickStereoImage() composites two images and produces a single image that
11335%  is the composite of a left and right image of a stereo pair
11336%
11337%  The format of the MagickStereoImage method is:
11338%
11339%      MagickWand *MagickStereoImage(MagickWand *wand,
11340%        const MagickWand *offset_wand)
11341%
11342%  A description of each parameter follows:
11343%
11344%    o wand: the magick wand.
11345%
11346%    o offset_wand: Another image wand.
11347%
11348*/
11349WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11350  const MagickWand *offset_wand)
11351{
11352  Image
11353    *stereo_image;
11354
11355  assert(wand != (MagickWand *) NULL);
11356  assert(wand->signature == WandSignature);
11357  if( IfMagickTrue(wand->debug) )
11358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11359
11360  if ((wand->images == (Image *) NULL) ||
11361      (offset_wand->images == (Image *) NULL))
11362    {
11363      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11364        "ContainsNoImages","`%s'",wand->name);
11365      return((MagickWand *) NULL);
11366    }
11367  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11368  if (stereo_image == (Image *) NULL)
11369    return((MagickWand *) NULL);
11370  return(CloneMagickWandFromImages(wand,stereo_image));
11371}
11372
11373/*
11374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11375%                                                                             %
11376%                                                                             %
11377%                                                                             %
11378%   M a g i c k S t r i p I m a g e                                           %
11379%                                                                             %
11380%                                                                             %
11381%                                                                             %
11382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11383%
11384%  MagickStripImage() strips an image of all profiles and comments.
11385%
11386%  The format of the MagickStripImage method is:
11387%
11388%      MagickBooleanType MagickStripImage(MagickWand *wand)
11389%
11390%  A description of each parameter follows:
11391%
11392%    o wand: the magick wand.
11393%
11394*/
11395WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11396{
11397  assert(wand != (MagickWand *) NULL);
11398  assert(wand->signature == WandSignature);
11399  if( IfMagickTrue(wand->debug) )
11400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11401
11402  if (wand->images == (Image *) NULL)
11403    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11404  return(StripImage(wand->images,wand->exception));
11405}
11406
11407/*
11408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11409%                                                                             %
11410%                                                                             %
11411%                                                                             %
11412%   M a g i c k S w i r l I m a g e                                           %
11413%                                                                             %
11414%                                                                             %
11415%                                                                             %
11416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11417%
11418%  MagickSwirlImage() swirls the pixels about the center of the image, where
11419%  degrees indicates the sweep of the arc through which each pixel is moved.
11420%  You get a more dramatic effect as the degrees move from 1 to 360.
11421%
11422%  The format of the MagickSwirlImage method is:
11423%
11424%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11425%        const PixelInterpolateMethod method)
11426%
11427%  A description of each parameter follows:
11428%
11429%    o wand: the magick wand.
11430%
11431%    o degrees: Define the tightness of the swirling effect.
11432%
11433%    o method: the pixel interpolation method.
11434%
11435*/
11436WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11437  const double degrees,const PixelInterpolateMethod method)
11438{
11439  Image
11440    *swirl_image;
11441
11442  assert(wand != (MagickWand *) NULL);
11443  assert(wand->signature == WandSignature);
11444  if( IfMagickTrue(wand->debug) )
11445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11446
11447  if (wand->images == (Image *) NULL)
11448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11449  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11450  if (swirl_image == (Image *) NULL)
11451    return(MagickFalse);
11452  ReplaceImageInList(&wand->images,swirl_image);
11453  return(MagickTrue);
11454}
11455
11456/*
11457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11458%                                                                             %
11459%                                                                             %
11460%                                                                             %
11461%   M a g i c k T e x t u r e I m a g e                                       %
11462%                                                                             %
11463%                                                                             %
11464%                                                                             %
11465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11466%
11467%  MagickTextureImage() repeatedly tiles the texture image across and down the
11468%  image canvas.
11469%
11470%  The format of the MagickTextureImage method is:
11471%
11472%      MagickWand *MagickTextureImage(MagickWand *wand,
11473%        const MagickWand *texture_wand)
11474%
11475%  A description of each parameter follows:
11476%
11477%    o wand: the magick wand.
11478%
11479%    o texture_wand: the texture wand
11480%
11481*/
11482WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11483  const MagickWand *texture_wand)
11484{
11485  Image
11486    *texture_image;
11487
11488  MagickBooleanType
11489    status;
11490
11491  assert(wand != (MagickWand *) NULL);
11492  assert(wand->signature == WandSignature);
11493  if( IfMagickTrue(wand->debug) )
11494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11495
11496  if ((wand->images == (Image *) NULL) ||
11497      (texture_wand->images == (Image *) NULL))
11498    {
11499      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11500        "ContainsNoImages","`%s'",wand->name);
11501      return((MagickWand *) NULL);
11502    }
11503  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11504  if (texture_image == (Image *) NULL)
11505    return((MagickWand *) NULL);
11506  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11507  if( IfMagickFalse(status) )
11508    {
11509      texture_image=DestroyImage(texture_image);
11510      return((MagickWand *) NULL);
11511    }
11512  return(CloneMagickWandFromImages(wand,texture_image));
11513}
11514
11515/*
11516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11517%                                                                             %
11518%                                                                             %
11519%                                                                             %
11520%   M a g i c k T h r e s h o l d I m a g e                                   %
11521%                                                                             %
11522%                                                                             %
11523%                                                                             %
11524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11525%
11526%  MagickThresholdImage() changes the value of individual pixels based on
11527%  the intensity of each pixel compared to threshold.  The result is a
11528%  high-contrast, two color image.
11529%
11530%  The format of the MagickThresholdImage method is:
11531%
11532%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11533%        const double threshold)
11534%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11535%        const ChannelType channel,const double threshold)
11536%
11537%  A description of each parameter follows:
11538%
11539%    o wand: the magick wand.
11540%
11541%    o channel: the image channel(s).
11542%
11543%    o threshold: Define the threshold value.
11544%
11545*/
11546WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11547  const double threshold)
11548{
11549  MagickBooleanType
11550    status;
11551
11552  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11553  return(status);
11554}
11555
11556WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11557  const ChannelType channel,const double threshold)
11558{
11559  MagickBooleanType
11560    status;
11561
11562  assert(wand != (MagickWand *) NULL);
11563  assert(wand->signature == WandSignature);
11564  if( IfMagickTrue(wand->debug) )
11565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11566
11567  if (wand->images == (Image *) NULL)
11568    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11569  status=BilevelImage(wand->images,threshold,wand->exception);
11570  return(status);
11571}
11572
11573/*
11574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11575%                                                                             %
11576%                                                                             %
11577%                                                                             %
11578%   M a g i c k T h u m b n a i l I m a g e                                   %
11579%                                                                             %
11580%                                                                             %
11581%                                                                             %
11582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11583%
11584%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11585%  and removes any associated profiles.  The goal is to produce small low cost
11586%  thumbnail images suited for display on the Web.
11587%
11588%  The format of the MagickThumbnailImage method is:
11589%
11590%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11591%        const size_t columns,const size_t rows)
11592%
11593%  A description of each parameter follows:
11594%
11595%    o wand: the magick wand.
11596%
11597%    o columns: the number of columns in the scaled image.
11598%
11599%    o rows: the number of rows in the scaled image.
11600%
11601*/
11602WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11603  const size_t columns,const size_t rows)
11604{
11605  Image
11606    *thumbnail_image;
11607
11608  assert(wand != (MagickWand *) NULL);
11609  assert(wand->signature == WandSignature);
11610  if( IfMagickTrue(wand->debug) )
11611    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11612
11613  if (wand->images == (Image *) NULL)
11614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11615  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11616  if (thumbnail_image == (Image *) NULL)
11617    return(MagickFalse);
11618  ReplaceImageInList(&wand->images,thumbnail_image);
11619  return(MagickTrue);
11620}
11621
11622/*
11623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11624%                                                                             %
11625%                                                                             %
11626%                                                                             %
11627%   M a g i c k T i n t I m a g e                                             %
11628%                                                                             %
11629%                                                                             %
11630%                                                                             %
11631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11632%
11633%  MagickTintImage() applies a color vector to each pixel in the image.  The
11634%  length of the vector is 0 for black and white and at its maximum for the
11635%  midtones.  The vector weighting function is
11636%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11637%
11638%  The format of the MagickTintImage method is:
11639%
11640%      MagickBooleanType MagickTintImage(MagickWand *wand,
11641%        const PixelWand *tint,const PixelWand *blend)
11642%
11643%  A description of each parameter follows:
11644%
11645%    o wand: the magick wand.
11646%
11647%    o tint: the tint pixel wand.
11648%
11649%    o alpha: the alpha pixel wand.
11650%
11651*/
11652WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11653  const PixelWand *tint,const PixelWand *blend)
11654{
11655  char
11656    percent_blend[MaxTextExtent];
11657
11658  Image
11659    *tint_image;
11660
11661  PixelInfo
11662    target;
11663
11664  assert(wand != (MagickWand *) NULL);
11665  assert(wand->signature == WandSignature);
11666  if( IfMagickTrue(wand->debug) )
11667    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11668
11669  if (wand->images == (Image *) NULL)
11670    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11671  if (wand->images->colorspace != CMYKColorspace)
11672    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11673      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11674      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11675      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11676      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11677      PixelGetAlphaQuantum(blend)));
11678  else
11679    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11680      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11681      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11682      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11683      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11684      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11685      PixelGetAlphaQuantum(blend)));
11686  target=PixelGetPixel(tint);
11687  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11688  if (tint_image == (Image *) NULL)
11689    return(MagickFalse);
11690  ReplaceImageInList(&wand->images,tint_image);
11691  return(MagickTrue);
11692}
11693
11694/*
11695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11696%                                                                             %
11697%                                                                             %
11698%                                                                             %
11699%   M a g i c k T r a n s f o r m I m a g e                                   %
11700%                                                                             %
11701%                                                                             %
11702%                                                                             %
11703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11704%
11705%  MagickTransformImage() is a convenience method that behaves like
11706%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11707%  information as a region geometry specification.  If the operation fails,
11708%  a NULL image handle is returned.
11709%
11710%  The format of the MagickTransformImage method is:
11711%
11712%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11713%        const char *geometry)
11714%
11715%  A description of each parameter follows:
11716%
11717%    o wand: the magick wand.
11718%
11719%    o crop: A crop geometry string.  This geometry defines a subregion of the
11720%      image to crop.
11721%
11722%    o geometry: An image geometry string.  This geometry defines the final
11723%      size of the image.
11724%
11725*/
11726WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11727  const char *crop,const char *geometry)
11728{
11729  Image
11730    *transform_image;
11731
11732  MagickBooleanType
11733    status;
11734
11735  assert(wand != (MagickWand *) NULL);
11736  assert(wand->signature == WandSignature);
11737  if( IfMagickTrue(wand->debug) )
11738    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11739
11740
11741  if (wand->images == (Image *) NULL)
11742    return((MagickWand *) NULL);
11743  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11744  if (transform_image == (Image *) NULL)
11745    return((MagickWand *) NULL);
11746  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11747  if( IfMagickFalse(status) )
11748    {
11749      transform_image=DestroyImage(transform_image);
11750      return((MagickWand *) NULL);
11751    }
11752  return(CloneMagickWandFromImages(wand,transform_image));
11753}
11754
11755/*
11756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11757%                                                                             %
11758%                                                                             %
11759%                                                                             %
11760%   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               %
11761%                                                                             %
11762%                                                                             %
11763%                                                                             %
11764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11765%
11766%  MagickTransformImageColorspace() transform the image colorspace.
11767%
11768%  The format of the MagickTransformImageColorspace method is:
11769%
11770%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11771%        const ColorspaceType colorspace)
11772%
11773%  A description of each parameter follows:
11774%
11775%    o wand: the magick wand.
11776%
11777%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11778%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11779%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11780%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11781%      HSLColorspace, or HWBColorspace.
11782%
11783*/
11784WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11785  const ColorspaceType colorspace)
11786{
11787  assert(wand != (MagickWand *) NULL);
11788  assert(wand->signature == WandSignature);
11789  if( IfMagickTrue(wand->debug) )
11790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11791
11792
11793  if (wand->images == (Image *) NULL)
11794    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11795  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11796}
11797
11798/*
11799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11800%                                                                             %
11801%                                                                             %
11802%                                                                             %
11803%   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                     %
11804%                                                                             %
11805%                                                                             %
11806%                                                                             %
11807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11808%
11809%  MagickTransparentPaintImage() changes any pixel that matches color with the
11810%  color defined by fill.
11811%
11812%  The format of the MagickTransparentPaintImage method is:
11813%
11814%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11815%        const PixelWand *target,const double alpha,const double fuzz,
11816%        const MagickBooleanType invert)
11817%
11818%  A description of each parameter follows:
11819%
11820%    o wand: the magick wand.
11821%
11822%    o target: Change this target color to specified alpha value within
11823%      the image.
11824%
11825%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11826%      transparent.
11827%
11828%    o fuzz: By default target must match a particular pixel color
11829%      exactly.  However, in many cases two colors may differ by a small amount.
11830%      The fuzz member of image defines how much tolerance is acceptable to
11831%      consider two colors as the same.  For example, set fuzz to 10 and the
11832%      color red at intensities of 100 and 102 respectively are now interpreted
11833%      as the same color for the purposes of the floodfill.
11834%
11835%    o invert: paint any pixel that does not match the target color.
11836%
11837*/
11838WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11839  const PixelWand *target,const double alpha,const double fuzz,
11840  const MagickBooleanType invert)
11841{
11842  MagickBooleanType
11843    status;
11844
11845  PixelInfo
11846    target_pixel;
11847
11848  assert(wand != (MagickWand *) NULL);
11849  assert(wand->signature == WandSignature);
11850  if( IfMagickTrue(wand->debug) )
11851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11852
11853
11854  if (wand->images == (Image *) NULL)
11855    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11856  PixelGetMagickColor(target,&target_pixel);
11857  wand->images->fuzz=fuzz;
11858  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11859    QuantumRange*alpha),invert,wand->exception);
11860  return(status);
11861}
11862
11863/*
11864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11865%                                                                             %
11866%                                                                             %
11867%                                                                             %
11868%   M a g i c k T r a n s p o s e I m a g e                                   %
11869%                                                                             %
11870%                                                                             %
11871%                                                                             %
11872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11873%
11874%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11875%  pixels around the central x-axis while rotating them 90-degrees.
11876%
11877%  The format of the MagickTransposeImage method is:
11878%
11879%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11880%
11881%  A description of each parameter follows:
11882%
11883%    o wand: the magick wand.
11884%
11885*/
11886WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11887{
11888  Image
11889    *transpose_image;
11890
11891  assert(wand != (MagickWand *) NULL);
11892  assert(wand->signature == WandSignature);
11893  if( IfMagickTrue(wand->debug) )
11894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11895
11896  if (wand->images == (Image *) NULL)
11897    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11898  transpose_image=TransposeImage(wand->images,wand->exception);
11899  if (transpose_image == (Image *) NULL)
11900    return(MagickFalse);
11901  ReplaceImageInList(&wand->images,transpose_image);
11902  return(MagickTrue);
11903}
11904
11905/*
11906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11907%                                                                             %
11908%                                                                             %
11909%                                                                             %
11910%   M a g i c k T r a n s v e r s e I m a g e                                 %
11911%                                                                             %
11912%                                                                             %
11913%                                                                             %
11914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11915%
11916%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11917%  pixels around the central y-axis while rotating them 270-degrees.
11918%
11919%  The format of the MagickTransverseImage method is:
11920%
11921%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11922%
11923%  A description of each parameter follows:
11924%
11925%    o wand: the magick wand.
11926%
11927*/
11928WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11929{
11930  Image
11931    *transverse_image;
11932
11933  assert(wand != (MagickWand *) NULL);
11934  assert(wand->signature == WandSignature);
11935  if( IfMagickTrue(wand->debug) )
11936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11937
11938  if (wand->images == (Image *) NULL)
11939    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11940  transverse_image=TransverseImage(wand->images,wand->exception);
11941  if (transverse_image == (Image *) NULL)
11942    return(MagickFalse);
11943  ReplaceImageInList(&wand->images,transverse_image);
11944  return(MagickTrue);
11945}
11946
11947/*
11948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11949%                                                                             %
11950%                                                                             %
11951%                                                                             %
11952%   M a g i c k T r i m I m a g e                                             %
11953%                                                                             %
11954%                                                                             %
11955%                                                                             %
11956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11957%
11958%  MagickTrimImage() remove edges that are the background color from the image.
11959%
11960%  The format of the MagickTrimImage method is:
11961%
11962%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11963%
11964%  A description of each parameter follows:
11965%
11966%    o wand: the magick wand.
11967%
11968%    o fuzz: By default target must match a particular pixel color
11969%      exactly.  However, in many cases two colors may differ by a small amount.
11970%      The fuzz member of image defines how much tolerance is acceptable to
11971%      consider two colors as the same.  For example, set fuzz to 10 and the
11972%      color red at intensities of 100 and 102 respectively are now interpreted
11973%      as the same color for the purposes of the floodfill.
11974%
11975*/
11976WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11977{
11978  Image
11979    *trim_image;
11980
11981  assert(wand != (MagickWand *) NULL);
11982  assert(wand->signature == WandSignature);
11983  if( IfMagickTrue(wand->debug) )
11984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11985
11986  if (wand->images == (Image *) NULL)
11987    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11988  wand->images->fuzz=fuzz;
11989  trim_image=TrimImage(wand->images,wand->exception);
11990  if (trim_image == (Image *) NULL)
11991    return(MagickFalse);
11992  ReplaceImageInList(&wand->images,trim_image);
11993  return(MagickTrue);
11994}
11995
11996/*
11997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11998%                                                                             %
11999%                                                                             %
12000%                                                                             %
12001%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12002%                                                                             %
12003%                                                                             %
12004%                                                                             %
12005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12006%
12007%  MagickUniqueImageColors() discards all but one of any pixel color.
12008%
12009%  The format of the MagickUniqueImageColors method is:
12010%
12011%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12012%
12013%  A description of each parameter follows:
12014%
12015%    o wand: the magick wand.
12016%
12017*/
12018WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12019{
12020  Image
12021    *unique_image;
12022
12023  assert(wand != (MagickWand *) NULL);
12024  assert(wand->signature == WandSignature);
12025  if( IfMagickTrue(wand->debug) )
12026    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12027
12028  if (wand->images == (Image *) NULL)
12029    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12030  unique_image=UniqueImageColors(wand->images,wand->exception);
12031  if (unique_image == (Image *) NULL)
12032    return(MagickFalse);
12033  ReplaceImageInList(&wand->images,unique_image);
12034  return(MagickTrue);
12035}
12036
12037/*
12038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12039%                                                                             %
12040%                                                                             %
12041%                                                                             %
12042%   M a g i c k U n s h a r p M a s k I m a g e                               %
12043%                                                                             %
12044%                                                                             %
12045%                                                                             %
12046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12047%
12048%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12049%  Gaussian operator of the given radius and standard deviation (sigma).
12050%  For reasonable results, radius should be larger than sigma.  Use a radius
12051%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12052%
12053%  The format of the MagickUnsharpMaskImage method is:
12054%
12055%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12056%        const double radius,const double sigma,const double amount,
12057%        const double threshold)
12058%
12059%  A description of each parameter follows:
12060%
12061%    o wand: the magick wand.
12062%
12063%    o radius: the radius of the Gaussian, in pixels, not counting the center
12064%      pixel.
12065%
12066%    o sigma: the standard deviation of the Gaussian, in pixels.
12067%
12068%    o amount: the percentage of the difference between the original and the
12069%      blur image that is added back into the original.
12070%
12071%    o threshold: the threshold in pixels needed to apply the diffence amount.
12072%
12073*/
12074WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12075  const double radius,const double sigma,const double amount,
12076  const double threshold)
12077{
12078  Image
12079    *unsharp_image;
12080
12081  assert(wand != (MagickWand *) NULL);
12082  assert(wand->signature == WandSignature);
12083  if( IfMagickTrue(wand->debug) )
12084    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12085
12086  if (wand->images == (Image *) NULL)
12087    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12088  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
12089    wand->exception);
12090  if (unsharp_image == (Image *) NULL)
12091    return(MagickFalse);
12092  ReplaceImageInList(&wand->images,unsharp_image);
12093  return(MagickTrue);
12094}
12095
12096/*
12097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12098%                                                                             %
12099%                                                                             %
12100%                                                                             %
12101%   M a g i c k V i g n e t t e I m a g e                                     %
12102%                                                                             %
12103%                                                                             %
12104%                                                                             %
12105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12106%
12107%  MagickVignetteImage() softens the edges of the image in vignette style.
12108%
12109%  The format of the MagickVignetteImage method is:
12110%
12111%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12112%        const double radius,const double sigma,const ssize_t x,
12113%        const ssize_t y)
12114%
12115%  A description of each parameter follows:
12116%
12117%    o wand: the magick wand.
12118%
12119%    o radius: the radius.
12120%
12121%    o sigma: the sigma.
12122%
12123%    o x, y:  Define the x and y ellipse offset.
12124%
12125*/
12126WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12127  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12128{
12129  Image
12130    *vignette_image;
12131
12132  assert(wand != (MagickWand *) NULL);
12133  assert(wand->signature == WandSignature);
12134  if( IfMagickTrue(wand->debug) )
12135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12136
12137  if (wand->images == (Image *) NULL)
12138    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12139  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12140  if (vignette_image == (Image *) NULL)
12141    return(MagickFalse);
12142  ReplaceImageInList(&wand->images,vignette_image);
12143  return(MagickTrue);
12144}
12145
12146/*
12147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12148%                                                                             %
12149%                                                                             %
12150%                                                                             %
12151%   M a g i c k W a v e I m a g e                                             %
12152%                                                                             %
12153%                                                                             %
12154%                                                                             %
12155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12156%
12157%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12158%  the pixels vertically along a sine wave whose amplitude and wavelength
12159%  is specified by the given parameters.
12160%
12161%  The format of the MagickWaveImage method is:
12162%
12163%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12164%        const double amplitude,const double wave_length,
12165%        const PixelInterpolateMethod method)
12166%
12167%  A description of each parameter follows:
12168%
12169%    o wand: the magick wand.
12170%
12171%    o amplitude, wave_length:  Define the amplitude and wave length of the
12172%      sine wave.
12173%
12174%    o method: the pixel interpolation method.
12175%
12176*/
12177WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12178  const double amplitude,const double wave_length,
12179  const PixelInterpolateMethod method)
12180{
12181  Image
12182    *wave_image;
12183
12184  assert(wand != (MagickWand *) NULL);
12185  assert(wand->signature == WandSignature);
12186  if( IfMagickTrue(wand->debug) )
12187    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12188
12189  if (wand->images == (Image *) NULL)
12190    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12191  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12192    wand->exception);
12193  if (wave_image == (Image *) NULL)
12194    return(MagickFalse);
12195  ReplaceImageInList(&wand->images,wave_image);
12196  return(MagickTrue);
12197}
12198
12199/*
12200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12201%                                                                             %
12202%                                                                             %
12203%                                                                             %
12204%   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                         %
12205%                                                                             %
12206%                                                                             %
12207%                                                                             %
12208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12209%
12210%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12211%  above the threshold into white while leaving all pixels below the threshold
12212%  unchanged.
12213%
12214%  The format of the MagickWhiteThresholdImage method is:
12215%
12216%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12217%        const PixelWand *threshold)
12218%
12219%  A description of each parameter follows:
12220%
12221%    o wand: the magick wand.
12222%
12223%    o threshold: the pixel wand.
12224%
12225*/
12226WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12227  const PixelWand *threshold)
12228{
12229  char
12230    thresholds[MaxTextExtent];
12231
12232  assert(wand != (MagickWand *) NULL);
12233  assert(wand->signature == WandSignature);
12234  if( IfMagickTrue(wand->debug) )
12235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12236
12237  if (wand->images == (Image *) NULL)
12238    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12239  (void) FormatLocaleString(thresholds,MaxTextExtent,
12240    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12241    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12242    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12243  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12244}
12245
12246/*
12247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12248%                                                                             %
12249%                                                                             %
12250%                                                                             %
12251%   M a g i c k W r i t e I m a g e                                           %
12252%                                                                             %
12253%                                                                             %
12254%                                                                             %
12255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12256%
12257%  MagickWriteImage() writes an image to the specified filename.  If the
12258%  filename parameter is NULL, the image is written to the filename set
12259%  by MagickReadImage() or MagickSetImageFilename().
12260%
12261%  The format of the MagickWriteImage method is:
12262%
12263%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12264%        const char *filename)
12265%
12266%  A description of each parameter follows:
12267%
12268%    o wand: the magick wand.
12269%
12270%    o filename: the image filename.
12271%
12272%
12273*/
12274WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12275  const char *filename)
12276{
12277  Image
12278    *image;
12279
12280  ImageInfo
12281    *write_info;
12282
12283  MagickBooleanType
12284    status;
12285
12286  assert(wand != (MagickWand *) NULL);
12287  assert(wand->signature == WandSignature);
12288  if( IfMagickTrue(wand->debug) )
12289    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12290
12291  if (wand->images == (Image *) NULL)
12292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12293  if (filename != (const char *) NULL)
12294    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12295  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12296  if (image == (Image *) NULL)
12297    return(MagickFalse);
12298  write_info=CloneImageInfo(wand->image_info);
12299  write_info->adjoin=MagickTrue;
12300  status=WriteImage(write_info,image,wand->exception);
12301  image=DestroyImage(image);
12302  write_info=DestroyImageInfo(write_info);
12303  return(status);
12304}
12305
12306/*
12307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12308%                                                                             %
12309%                                                                             %
12310%                                                                             %
12311%   M a g i c k W r i t e I m a g e F i l e                                   %
12312%                                                                             %
12313%                                                                             %
12314%                                                                             %
12315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12316%
12317%  MagickWriteImageFile() writes an image to an open file descriptor.
12318%
12319%  The format of the MagickWriteImageFile method is:
12320%
12321%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12322%
12323%  A description of each parameter follows:
12324%
12325%    o wand: the magick wand.
12326%
12327%    o file: the file descriptor.
12328%
12329*/
12330WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12331{
12332  Image
12333    *image;
12334
12335  ImageInfo
12336    *write_info;
12337
12338  MagickBooleanType
12339    status;
12340
12341  assert(wand != (MagickWand *) NULL);
12342  assert(wand->signature == WandSignature);
12343  assert(file != (FILE *) NULL);
12344  if( IfMagickTrue(wand->debug) )
12345    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12346
12347  if (wand->images == (Image *) NULL)
12348    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12349  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12350  if (image == (Image *) NULL)
12351    return(MagickFalse);
12352  write_info=CloneImageInfo(wand->image_info);
12353  SetImageInfoFile(write_info,file);
12354  write_info->adjoin=MagickTrue;
12355  status=WriteImage(write_info,image,wand->exception);
12356  write_info=DestroyImageInfo(write_info);
12357  image=DestroyImage(image);
12358  return(status);
12359}
12360
12361/*
12362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12363%                                                                             %
12364%                                                                             %
12365%                                                                             %
12366%   M a g i c k W r i t e I m a g e s                                         %
12367%                                                                             %
12368%                                                                             %
12369%                                                                             %
12370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12371%
12372%  MagickWriteImages() writes an image or image sequence.
12373%
12374%  The format of the MagickWriteImages method is:
12375%
12376%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12377%        const char *filename,const MagickBooleanType adjoin)
12378%
12379%  A description of each parameter follows:
12380%
12381%    o wand: the magick wand.
12382%
12383%    o filename: the image filename.
12384%
12385%    o adjoin: join images into a single multi-image file.
12386%
12387*/
12388WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12389  const char *filename,const MagickBooleanType adjoin)
12390{
12391  ImageInfo
12392    *write_info;
12393
12394  MagickBooleanType
12395    status;
12396
12397  assert(wand != (MagickWand *) NULL);
12398  assert(wand->signature == WandSignature);
12399  if( IfMagickTrue(wand->debug) )
12400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12401
12402  if (wand->images == (Image *) NULL)
12403    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12404  write_info=CloneImageInfo(wand->image_info);
12405  write_info->adjoin=adjoin;
12406  status=WriteImages(write_info,wand->images,filename,wand->exception);
12407  write_info=DestroyImageInfo(write_info);
12408  return(status);
12409}
12410
12411/*
12412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12413%                                                                             %
12414%                                                                             %
12415%                                                                             %
12416%   M a g i c k W r i t e I m a g e s F i l e                                 %
12417%                                                                             %
12418%                                                                             %
12419%                                                                             %
12420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12421%
12422%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12423%
12424%  The format of the MagickWriteImagesFile method is:
12425%
12426%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12427%
12428%  A description of each parameter follows:
12429%
12430%    o wand: the magick wand.
12431%
12432%    o file: the file descriptor.
12433%
12434*/
12435WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12436{
12437  ImageInfo
12438    *write_info;
12439
12440  MagickBooleanType
12441    status;
12442
12443  assert(wand != (MagickWand *) NULL);
12444  assert(wand->signature == WandSignature);
12445  if( IfMagickTrue(wand->debug) )
12446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12447
12448  if (wand->images == (Image *) NULL)
12449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12450  write_info=CloneImageInfo(wand->image_info);
12451  SetImageInfoFile(write_info,file);
12452  write_info->adjoin=MagickTrue;
12453  status=WriteImages(write_info,wand->images,(const char *) NULL,
12454    wand->exception);
12455  write_info=DestroyImageInfo(write_info);
12456  return(status);
12457}
12458