magick-image.c revision cbda611068350bf4459f2dda1951f8823702e129
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 char *color_correction_collection)
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%  MagickGetImageCompressionQuality() gets the image compression quality.
4383%
4384%  The format of the MagickGetImageCompressionQuality method is:
4385%
4386%      size_t MagickGetImageCompressionQuality(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=AcquireVirtualCacheView(wand->images,wand->exception);
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%      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 size_t 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 DitherMethod dither_method,
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_method: choose from UndefinedDitherMethod, NoDitherMethod,
7763%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7764%
7765%    o measure_error: A value other than zero measures the difference between
7766%      the original and quantized images.  This difference is the total
7767%      quantization error.  The error is computed by summing over all pixels
7768%      in an image the distance squared in RGB space between each reference
7769%      pixel value and its quantized value.
7770%
7771*/
7772WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7773  const size_t number_colors,const ColorspaceType colorspace,
7774  const size_t treedepth,const DitherMethod dither_method,
7775  const MagickBooleanType measure_error)
7776{
7777  MagickBooleanType
7778    status;
7779
7780  QuantizeInfo
7781    *quantize_info;
7782
7783  assert(wand != (MagickWand *) NULL);
7784  assert(wand->signature == WandSignature);
7785  if( IfMagickTrue(wand->debug) )
7786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7787
7788  if (wand->images == (Image *) NULL)
7789    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7790  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7791  quantize_info->number_colors=number_colors;
7792  quantize_info->dither_method=dither_method;
7793  quantize_info->tree_depth=treedepth;
7794  quantize_info->colorspace=colorspace;
7795  quantize_info->measure_error=measure_error;
7796  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7797  quantize_info=DestroyQuantizeInfo(quantize_info);
7798  return(status);
7799}
7800
7801/*
7802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7803%                                                                             %
7804%                                                                             %
7805%                                                                             %
7806%   M a g i c k Q u a n t i z e I m a g e s                                   %
7807%                                                                             %
7808%                                                                             %
7809%                                                                             %
7810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7811%
7812%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7813%  chooses a fixed number of colors to represent the image.  The goal of the
7814%  algorithm is to minimize the color difference between the input and output
7815%  image while minimizing the processing time.
7816%
7817%  The format of the MagickQuantizeImages method is:
7818%
7819%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7820%        const size_t number_colors,const ColorspaceType colorspace,
7821%        const size_t treedepth,const DitherMethod dither_method,
7822%        const MagickBooleanType measure_error)
7823%
7824%  A description of each parameter follows:
7825%
7826%    o wand: the magick wand.
7827%
7828%    o number_colors: the number of colors.
7829%
7830%    o colorspace: Perform color reduction in this colorspace, typically
7831%      RGBColorspace.
7832%
7833%    o treedepth: Normally, this integer value is zero or one.  A zero or
7834%      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
7835%      reference image with the least amount of memory and the fastest
7836%      computational speed.  In some cases, such as an image with low color
7837%      dispersion (a few number of colors), a value other than
7838%      Log4(number_colors) is required.  To expand the color tree completely,
7839%      use a value of 8.
7840%
7841%    o dither_method: choose from these dither methods: NoDitherMethod,
7842%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7843%
7844%    o measure_error: A value other than zero measures the difference between
7845%      the original and quantized images.  This difference is the total
7846%      quantization error.  The error is computed by summing over all pixels
7847%      in an image the distance squared in RGB space between each reference
7848%      pixel value and its quantized value.
7849%
7850*/
7851WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7852  const size_t number_colors,const ColorspaceType colorspace,
7853  const size_t treedepth,const DitherMethod dither_method,
7854  const MagickBooleanType measure_error)
7855{
7856  MagickBooleanType
7857    status;
7858
7859  QuantizeInfo
7860    *quantize_info;
7861
7862  assert(wand != (MagickWand *) NULL);
7863  assert(wand->signature == WandSignature);
7864  if( IfMagickTrue(wand->debug) )
7865    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7866
7867  if (wand->images == (Image *) NULL)
7868    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7869  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7870  quantize_info->number_colors=number_colors;
7871  quantize_info->dither_method=dither_method;
7872  quantize_info->tree_depth=treedepth;
7873  quantize_info->colorspace=colorspace;
7874  quantize_info->measure_error=measure_error;
7875  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7876  quantize_info=DestroyQuantizeInfo(quantize_info);
7877  return(status);
7878}
7879
7880/*
7881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7882%                                                                             %
7883%                                                                             %
7884%                                                                             %
7885%   M a g i c k R a d i a l B l u r I m a g e                                 %
7886%                                                                             %
7887%                                                                             %
7888%                                                                             %
7889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7890%
7891%  MagickRadialBlurImage() radial blurs an image.
7892%
7893%  The format of the MagickRadialBlurImage method is:
7894%
7895%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7896%        const double angle)
7897%
7898%  A description of each parameter follows:
7899%
7900%    o wand: the magick wand.
7901%
7902%    o angle: the angle of the blur in degrees.
7903%
7904*/
7905WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7906  const double angle)
7907{
7908  Image
7909    *blur_image;
7910
7911  assert(wand != (MagickWand *) NULL);
7912  assert(wand->signature == WandSignature);
7913  if( IfMagickTrue(wand->debug) )
7914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7915
7916  if (wand->images == (Image *) NULL)
7917    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7918  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7919  if (blur_image == (Image *) NULL)
7920    return(MagickFalse);
7921  ReplaceImageInList(&wand->images,blur_image);
7922  return(MagickTrue);
7923}
7924
7925/*
7926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7927%                                                                             %
7928%                                                                             %
7929%                                                                             %
7930%   M a g i c k R a i s e I m a g e                                           %
7931%                                                                             %
7932%                                                                             %
7933%                                                                             %
7934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7935%
7936%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7937%  by lightening and darkening the edges of the image.  Members width and
7938%  height of raise_info define the width of the vertical and horizontal
7939%  edge of the effect.
7940%
7941%  The format of the MagickRaiseImage method is:
7942%
7943%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7944%        const size_t width,const size_t height,const ssize_t x,
7945%        const ssize_t y,const MagickBooleanType raise)
7946%
7947%  A description of each parameter follows:
7948%
7949%    o wand: the magick wand.
7950%
7951%    o width,height,x,y:  Define the dimensions of the area to raise.
7952%
7953%    o raise: A value other than zero creates a 3-D raise effect,
7954%      otherwise it has a lowered effect.
7955%
7956*/
7957WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7958  const size_t width,const size_t height,const ssize_t x,
7959  const ssize_t y,const MagickBooleanType raise)
7960{
7961  MagickBooleanType
7962    status;
7963
7964  RectangleInfo
7965    raise_info;
7966
7967  assert(wand != (MagickWand *) NULL);
7968  assert(wand->signature == WandSignature);
7969  if( IfMagickTrue(wand->debug) )
7970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7971
7972  if (wand->images == (Image *) NULL)
7973    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7974  raise_info.width=width;
7975  raise_info.height=height;
7976  raise_info.x=x;
7977  raise_info.y=y;
7978  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7979  return(status);
7980}
7981
7982/*
7983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7984%                                                                             %
7985%                                                                             %
7986%                                                                             %
7987%   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                       %
7988%                                                                             %
7989%                                                                             %
7990%                                                                             %
7991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7992%
7993%  MagickRandomThresholdImage() changes the value of individual pixels based on
7994%  the intensity of each pixel compared to threshold.  The result is a
7995%  high-contrast, two color image.
7996%
7997%  The format of the MagickRandomThresholdImage method is:
7998%
7999%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8000%        const double low,const double high)
8001%
8002%  A description of each parameter follows:
8003%
8004%    o wand: the magick wand.
8005%
8006%    o low,high: Specify the high and low thresholds.  These values range from
8007%      0 to QuantumRange.
8008%
8009*/
8010WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8011  const double low,const double high)
8012{
8013  char
8014    threshold[MaxTextExtent];
8015
8016  assert(wand != (MagickWand *) NULL);
8017  assert(wand->signature == WandSignature);
8018  if( IfMagickTrue(wand->debug) )
8019    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8020
8021  if (wand->images == (Image *) NULL)
8022    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8023  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8024  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8025}
8026
8027/*
8028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8029%                                                                             %
8030%                                                                             %
8031%                                                                             %
8032%   M a g i c k R e a d I m a g e                                             %
8033%                                                                             %
8034%                                                                             %
8035%                                                                             %
8036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8037%
8038%  MagickReadImage() reads an image or image sequence.  The images are inserted
8039%  jjust before the current image pointer position.
8040%
8041%  Use MagickSetFirstIterator(), to insert new images before all the current
8042%  images in the wand, MagickSetLastIterator() to append add to the end,
8043%  MagickSetImageIndex() to place images just after the given index.
8044%
8045%  The format of the MagickReadImage method is:
8046%
8047%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8048%
8049%  A description of each parameter follows:
8050%
8051%    o wand: the magick wand.
8052%
8053%    o filename: the image filename.
8054%
8055*/
8056WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8057  const char *filename)
8058{
8059  Image
8060    *images;
8061
8062  ImageInfo
8063    *read_info;
8064
8065  assert(wand != (MagickWand *) NULL);
8066  assert(wand->signature == WandSignature);
8067  if( IfMagickTrue(wand->debug) )
8068    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8069
8070  read_info=CloneImageInfo(wand->image_info);
8071  if (filename != (const char *) NULL)
8072    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8073  images=ReadImage(read_info,wand->exception);
8074  read_info=DestroyImageInfo(read_info);
8075  if (images == (Image *) NULL)
8076    return(MagickFalse);
8077  return(InsertImageInWand(wand,images));
8078}
8079
8080/*
8081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8082%                                                                             %
8083%                                                                             %
8084%                                                                             %
8085%   M a g i c k R e a d I m a g e B l o b                                     %
8086%                                                                             %
8087%                                                                             %
8088%                                                                             %
8089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8090%
8091%  MagickReadImageBlob() reads an image or image sequence from a blob.
8092%  In all other respects it is like MagickReadImage().
8093%
8094%  The format of the MagickReadImageBlob method is:
8095%
8096%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8097%        const void *blob,const size_t length)
8098%
8099%  A description of each parameter follows:
8100%
8101%    o wand: the magick wand.
8102%
8103%    o blob: the blob.
8104%
8105%    o length: the blob length.
8106%
8107*/
8108WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8109  const void *blob,const size_t length)
8110{
8111  Image
8112    *images;
8113
8114  assert(wand != (MagickWand *) NULL);
8115  assert(wand->signature == WandSignature);
8116  if( IfMagickTrue(wand->debug) )
8117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8118
8119  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8120  if (images == (Image *) NULL)
8121    return(MagickFalse);
8122  return(InsertImageInWand(wand,images));
8123}
8124
8125/*
8126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8127%                                                                             %
8128%                                                                             %
8129%                                                                             %
8130%   M a g i c k R e a d I m a g e F i l e                                     %
8131%                                                                             %
8132%                                                                             %
8133%                                                                             %
8134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8135%
8136%  MagickReadImageFile() reads an image or image sequence from an already
8137%  opened file descriptor.  Otherwise it is like MagickReadImage().
8138%
8139%  The format of the MagickReadImageFile method is:
8140%
8141%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8142%
8143%  A description of each parameter follows:
8144%
8145%    o wand: the magick wand.
8146%
8147%    o file: the file descriptor.
8148%
8149*/
8150WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8151{
8152  Image
8153    *images;
8154
8155  ImageInfo
8156    *read_info;
8157
8158  assert(wand != (MagickWand *) NULL);
8159  assert(wand->signature == WandSignature);
8160  assert(file != (FILE *) NULL);
8161  if( IfMagickTrue(wand->debug) )
8162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8163
8164  read_info=CloneImageInfo(wand->image_info);
8165  SetImageInfoFile(read_info,file);
8166  images=ReadImage(read_info,wand->exception);
8167  read_info=DestroyImageInfo(read_info);
8168  if (images == (Image *) NULL)
8169    return(MagickFalse);
8170  return(InsertImageInWand(wand,images));
8171}
8172
8173/*
8174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8175%                                                                             %
8176%                                                                             %
8177%                                                                             %
8178%   M a g i c k R e m a p I m a g e                                           %
8179%                                                                             %
8180%                                                                             %
8181%                                                                             %
8182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8183%
8184%  MagickRemapImage() replaces the colors of an image with the closest color
8185%  from a reference image.
8186%
8187%  The format of the MagickRemapImage method is:
8188%
8189%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8190%        const MagickWand *remap_wand,const DitherMethod method)
8191%
8192%  A description of each parameter follows:
8193%
8194%    o wand: the magick wand.
8195%
8196%    o affinity: the affinity wand.
8197%
8198%    o method: choose from these dither methods: NoDitherMethod,
8199%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8200%
8201*/
8202WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8203  const MagickWand *remap_wand,const DitherMethod dither_method)
8204{
8205  MagickBooleanType
8206    status;
8207
8208  QuantizeInfo
8209    *quantize_info;
8210
8211  assert(wand != (MagickWand *) NULL);
8212  assert(wand->signature == WandSignature);
8213  if( IfMagickTrue(wand->debug) )
8214    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8215
8216  if ((wand->images == (Image *) NULL) ||
8217      (remap_wand->images == (Image *) NULL))
8218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8219  quantize_info=AcquireQuantizeInfo(wand->image_info);
8220  quantize_info->dither_method=dither_method;
8221  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8222    wand->exception);
8223  quantize_info=DestroyQuantizeInfo(quantize_info);
8224  return(status);
8225}
8226
8227/*
8228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8229%                                                                             %
8230%                                                                             %
8231%                                                                             %
8232%   M a g i c k R e m o v e I m a g e                                         %
8233%                                                                             %
8234%                                                                             %
8235%                                                                             %
8236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8237%
8238%  MagickRemoveImage() removes an image from the image list.
8239%
8240%  The format of the MagickRemoveImage method is:
8241%
8242%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8243%
8244%  A description of each parameter follows:
8245%
8246%    o wand: the magick wand.
8247%
8248%    o insert: the splice wand.
8249%
8250*/
8251WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8252{
8253  assert(wand != (MagickWand *) NULL);
8254  assert(wand->signature == WandSignature);
8255  if( IfMagickTrue(wand->debug) )
8256    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8257
8258  if (wand->images == (Image *) NULL)
8259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8260  DeleteImageFromList(&wand->images);
8261  return(MagickTrue);
8262}
8263
8264/*
8265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8266%                                                                             %
8267%                                                                             %
8268%                                                                             %
8269%   M a g i c k R e s a m p l e I m a g e                                     %
8270%                                                                             %
8271%                                                                             %
8272%                                                                             %
8273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8274%
8275%  MagickResampleImage() resample image to desired resolution.
8276%
8277%    Bessel   Blackman   Box
8278%    Catrom   Cubic      Gaussian
8279%    Hanning  Hermite    Lanczos
8280%    Mitchell Point      Quandratic
8281%    Sinc     Triangle
8282%
8283%  Most of the filters are FIR (finite impulse response), however, Bessel,
8284%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8285%  are windowed (brought down to zero) with the Blackman filter.
8286%
8287%  The format of the MagickResampleImage method is:
8288%
8289%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8290%        const double x_resolution,const double y_resolution,
8291%        const FilterTypes filter)
8292%
8293%  A description of each parameter follows:
8294%
8295%    o wand: the magick wand.
8296%
8297%    o x_resolution: the new image x resolution.
8298%
8299%    o y_resolution: the new image y resolution.
8300%
8301%    o filter: Image filter to use.
8302%
8303*/
8304WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8305  const double x_resolution,const double y_resolution,const FilterTypes filter)
8306{
8307  Image
8308    *resample_image;
8309
8310  assert(wand != (MagickWand *) NULL);
8311  assert(wand->signature == WandSignature);
8312  if( IfMagickTrue(wand->debug) )
8313    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8314
8315  if (wand->images == (Image *) NULL)
8316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8317  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8318    wand->exception);
8319  if (resample_image == (Image *) NULL)
8320    return(MagickFalse);
8321  ReplaceImageInList(&wand->images,resample_image);
8322  return(MagickTrue);
8323}
8324
8325/*
8326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8327%                                                                             %
8328%                                                                             %
8329%                                                                             %
8330%   M a g i c k R e s e t I m a g e P a g e                                   %
8331%                                                                             %
8332%                                                                             %
8333%                                                                             %
8334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8335%
8336%  MagickResetImagePage() resets the Wand page canvas and position.
8337%
8338%  The format of the MagickResetImagePage method is:
8339%
8340%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8341%        const char *page)
8342%
8343%  A description of each parameter follows:
8344%
8345%    o wand: the magick wand.
8346%
8347%    o page: the relative page specification.
8348%
8349*/
8350WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8351  const char *page)
8352{
8353  assert(wand != (MagickWand *) NULL);
8354  assert(wand->signature == WandSignature);
8355  if( IfMagickTrue(wand->debug) )
8356    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8357
8358  if (wand->images == (Image *) NULL)
8359    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8360  if ((page == (char *) NULL) || (*page == '\0'))
8361    {
8362      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8363      return(MagickTrue);
8364    }
8365  return(ResetImagePage(wand->images,page));
8366}
8367
8368/*
8369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8370%                                                                             %
8371%                                                                             %
8372%                                                                             %
8373%   M a g i c k R e s i z e I m a g e                                         %
8374%                                                                             %
8375%                                                                             %
8376%                                                                             %
8377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8378%
8379%  MagickResizeImage() scales an image to the desired dimensions with one of
8380%  these filters:
8381%
8382%    Bessel   Blackman   Box
8383%    Catrom   Cubic      Gaussian
8384%    Hanning  Hermite    Lanczos
8385%    Mitchell Point      Quandratic
8386%    Sinc     Triangle
8387%
8388%  Most of the filters are FIR (finite impulse response), however, Bessel,
8389%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8390%  are windowed (brought down to zero) with the Blackman filter.
8391%
8392%  The format of the MagickResizeImage method is:
8393%
8394%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8395%        const size_t columns,const size_t rows,const FilterTypes filter)
8396%
8397%  A description of each parameter follows:
8398%
8399%    o wand: the magick wand.
8400%
8401%    o columns: the number of columns in the scaled image.
8402%
8403%    o rows: the number of rows in the scaled image.
8404%
8405%    o filter: Image filter to use.
8406%
8407*/
8408WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8409  const size_t columns,const size_t rows,const FilterTypes filter)
8410{
8411  Image
8412    *resize_image;
8413
8414  assert(wand != (MagickWand *) NULL);
8415  assert(wand->signature == WandSignature);
8416  if( IfMagickTrue(wand->debug) )
8417    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8418
8419  if (wand->images == (Image *) NULL)
8420    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8421  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8422  if (resize_image == (Image *) NULL)
8423    return(MagickFalse);
8424  ReplaceImageInList(&wand->images,resize_image);
8425  return(MagickTrue);
8426}
8427
8428/*
8429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8430%                                                                             %
8431%                                                                             %
8432%                                                                             %
8433%   M a g i c k R o l l I m a g e                                             %
8434%                                                                             %
8435%                                                                             %
8436%                                                                             %
8437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8438%
8439%  MagickRollImage() offsets an image as defined by x and y.
8440%
8441%  The format of the MagickRollImage method is:
8442%
8443%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8444%        const size_t y)
8445%
8446%  A description of each parameter follows:
8447%
8448%    o wand: the magick wand.
8449%
8450%    o x: the x offset.
8451%
8452%    o y: the y offset.
8453%
8454%
8455*/
8456WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8457  const ssize_t x,const ssize_t y)
8458{
8459  Image
8460    *roll_image;
8461
8462  assert(wand != (MagickWand *) NULL);
8463  assert(wand->signature == WandSignature);
8464  if( IfMagickTrue(wand->debug) )
8465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8466
8467  if (wand->images == (Image *) NULL)
8468    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8469  roll_image=RollImage(wand->images,x,y,wand->exception);
8470  if (roll_image == (Image *) NULL)
8471    return(MagickFalse);
8472  ReplaceImageInList(&wand->images,roll_image);
8473  return(MagickTrue);
8474}
8475
8476/*
8477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8478%                                                                             %
8479%                                                                             %
8480%                                                                             %
8481%   M a g i c k R o t a t e I m a g e                                         %
8482%                                                                             %
8483%                                                                             %
8484%                                                                             %
8485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8486%
8487%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8488%  triangles left over from rotating the image are filled with the
8489%  background color.
8490%
8491%  The format of the MagickRotateImage method is:
8492%
8493%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8494%        const PixelWand *background,const double degrees)
8495%
8496%  A description of each parameter follows:
8497%
8498%    o wand: the magick wand.
8499%
8500%    o background: the background pixel wand.
8501%
8502%    o degrees: the number of degrees to rotate the image.
8503%
8504%
8505*/
8506WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8507  const PixelWand *background,const double degrees)
8508{
8509  Image
8510    *rotate_image;
8511
8512  assert(wand != (MagickWand *) NULL);
8513  assert(wand->signature == WandSignature);
8514  if( IfMagickTrue(wand->debug) )
8515    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8516
8517  if (wand->images == (Image *) NULL)
8518    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8519  PixelGetQuantumPacket(background,&wand->images->background_color);
8520  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8521  if (rotate_image == (Image *) NULL)
8522    return(MagickFalse);
8523  ReplaceImageInList(&wand->images,rotate_image);
8524  return(MagickTrue);
8525}
8526
8527/*
8528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8529%                                                                             %
8530%                                                                             %
8531%                                                                             %
8532%   M a g i c k S a m p l e I m a g e                                         %
8533%                                                                             %
8534%                                                                             %
8535%                                                                             %
8536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8537%
8538%  MagickSampleImage() scales an image to the desired dimensions with pixel
8539%  sampling.  Unlike other scaling methods, this method does not introduce
8540%  any additional color into the scaled image.
8541%
8542%  The format of the MagickSampleImage method is:
8543%
8544%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8545%        const size_t columns,const size_t rows)
8546%
8547%  A description of each parameter follows:
8548%
8549%    o wand: the magick wand.
8550%
8551%    o columns: the number of columns in the scaled image.
8552%
8553%    o rows: the number of rows in the scaled image.
8554%
8555%
8556*/
8557WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8558  const size_t columns,const size_t rows)
8559{
8560  Image
8561    *sample_image;
8562
8563  assert(wand != (MagickWand *) NULL);
8564  assert(wand->signature == WandSignature);
8565  if( IfMagickTrue(wand->debug) )
8566    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8567
8568  if (wand->images == (Image *) NULL)
8569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8570  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8571  if (sample_image == (Image *) NULL)
8572    return(MagickFalse);
8573  ReplaceImageInList(&wand->images,sample_image);
8574  return(MagickTrue);
8575}
8576
8577/*
8578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8579%                                                                             %
8580%                                                                             %
8581%                                                                             %
8582%   M a g i c k S c a l e I m a g e                                           %
8583%                                                                             %
8584%                                                                             %
8585%                                                                             %
8586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8587%
8588%  MagickScaleImage() scales the size of an image to the given dimensions.
8589%
8590%  The format of the MagickScaleImage method is:
8591%
8592%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8593%        const size_t columns,const size_t rows)
8594%
8595%  A description of each parameter follows:
8596%
8597%    o wand: the magick wand.
8598%
8599%    o columns: the number of columns in the scaled image.
8600%
8601%    o rows: the number of rows in the scaled image.
8602%
8603%
8604*/
8605WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8606  const size_t columns,const size_t rows)
8607{
8608  Image
8609    *scale_image;
8610
8611  assert(wand != (MagickWand *) NULL);
8612  assert(wand->signature == WandSignature);
8613  if( IfMagickTrue(wand->debug) )
8614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8615
8616  if (wand->images == (Image *) NULL)
8617    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8618  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8619  if (scale_image == (Image *) NULL)
8620    return(MagickFalse);
8621  ReplaceImageInList(&wand->images,scale_image);
8622  return(MagickTrue);
8623}
8624
8625/*
8626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8627%                                                                             %
8628%                                                                             %
8629%                                                                             %
8630%   M a g i c k S e g m e n t I m a g e                                       %
8631%                                                                             %
8632%                                                                             %
8633%                                                                             %
8634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8635%
8636%  MagickSegmentImage() segments an image by analyzing the histograms of the
8637%  color components and identifying units that are homogeneous with the fuzzy
8638%  C-means technique.
8639%
8640%  The format of the SegmentImage method is:
8641%
8642%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8643%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8644%        const double cluster_threshold,const double smooth_threshold)
8645%
8646%  A description of each parameter follows.
8647%
8648%    o wand: the wand.
8649%
8650%    o colorspace: the image colorspace.
8651%
8652%    o verbose:  Set to MagickTrue to print detailed information about the
8653%      identified classes.
8654%
8655%    o cluster_threshold:  This represents the minimum number of pixels
8656%      contained in a hexahedra before it can be considered valid (expressed as
8657%      a percentage).
8658%
8659%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8660%      derivative of the histogram.  As the value is increased, you can expect a
8661%      smoother second derivative.
8662%
8663*/
8664MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8665  const ColorspaceType colorspace,const MagickBooleanType verbose,
8666  const double cluster_threshold,const double smooth_threshold)
8667{
8668  MagickBooleanType
8669    status;
8670
8671  assert(wand != (MagickWand *) NULL);
8672  assert(wand->signature == WandSignature);
8673  if( IfMagickTrue(wand->debug) )
8674    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8675
8676  if (wand->images == (Image *) NULL)
8677    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8678  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8679    smooth_threshold,wand->exception);
8680  return(status);
8681}
8682
8683/*
8684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8685%                                                                             %
8686%                                                                             %
8687%                                                                             %
8688%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8693%
8694%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8695%  threshold. It is similar to the unsharpen mask that sharpens everything with
8696%  contrast above a certain threshold.
8697%
8698%  The format of the MagickSelectiveBlurImage method is:
8699%
8700%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8701%        const double radius,const double sigma,const double threshold)
8702%
8703%  A description of each parameter follows:
8704%
8705%    o wand: the magick wand.
8706%
8707%    o radius: the radius of the gaussian, in pixels, not counting the center
8708%      pixel.
8709%
8710%    o sigma: the standard deviation of the gaussian, in pixels.
8711%
8712%    o threshold: only pixels within this contrast threshold are included
8713%      in the blur operation.
8714%
8715*/
8716WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8717  const double radius,const double sigma,const double threshold)
8718{
8719  Image
8720    *blur_image;
8721
8722  assert(wand != (MagickWand *) NULL);
8723  assert(wand->signature == WandSignature);
8724  if( IfMagickTrue(wand->debug) )
8725    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8726
8727  if (wand->images == (Image *) NULL)
8728    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8729  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8730    wand->exception);
8731  if (blur_image == (Image *) NULL)
8732    return(MagickFalse);
8733  ReplaceImageInList(&wand->images,blur_image);
8734  return(MagickTrue);
8735}
8736
8737/*
8738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8739%                                                                             %
8740%                                                                             %
8741%                                                                             %
8742%   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                       %
8743%                                                                             %
8744%                                                                             %
8745%                                                                             %
8746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8747%
8748%  MagickSeparateImage() separates a channel from the image and returns a
8749%  grayscale image.  A channel is a particular color component of each pixel
8750%  in the image.
8751%
8752%  The format of the MagickSeparateImage method is:
8753%
8754%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8755%        const ChannelType channel)
8756%
8757%  A description of each parameter follows:
8758%
8759%    o wand: the magick wand.
8760%
8761%    o channel: the channel.
8762%
8763*/
8764WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8765  const ChannelType channel)
8766{
8767  Image
8768    *separate_image;
8769
8770  assert(wand != (MagickWand *) NULL);
8771  assert(wand->signature == WandSignature);
8772  if( IfMagickTrue(wand->debug) )
8773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8774
8775  if (wand->images == (Image *) NULL)
8776    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8777  separate_image=SeparateImage(wand->images,channel,wand->exception);
8778  if (separate_image == (Image *) NULL)
8779    return(MagickFalse);
8780  ReplaceImageInList(&wand->images,separate_image);
8781  return(MagickTrue);
8782}
8783
8784/*
8785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8786%                                                                             %
8787%                                                                             %
8788%                                                                             %
8789%     M a g i c k S e p i a T o n e I m a g e                                 %
8790%                                                                             %
8791%                                                                             %
8792%                                                                             %
8793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8794%
8795%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8796%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8797%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8798%  threshold of 80% is a good starting point for a reasonable tone.
8799%
8800%  The format of the MagickSepiaToneImage method is:
8801%
8802%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8803%        const double threshold)
8804%
8805%  A description of each parameter follows:
8806%
8807%    o wand: the magick wand.
8808%
8809%    o threshold:  Define the extent of the sepia toning.
8810%
8811*/
8812WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8813  const double threshold)
8814{
8815  Image
8816    *sepia_image;
8817
8818  assert(wand != (MagickWand *) NULL);
8819  assert(wand->signature == WandSignature);
8820  if( IfMagickTrue(wand->debug) )
8821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8822
8823  if (wand->images == (Image *) NULL)
8824    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8825  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8826  if (sepia_image == (Image *) NULL)
8827    return(MagickFalse);
8828  ReplaceImageInList(&wand->images,sepia_image);
8829  return(MagickTrue);
8830}
8831
8832/*
8833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8834%                                                                             %
8835%                                                                             %
8836%                                                                             %
8837%   M a g i c k S e t I m a g e                                               %
8838%                                                                             %
8839%                                                                             %
8840%                                                                             %
8841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8842%
8843%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8844%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8845%  wand.
8846%
8847%  The format of the MagickSetImage method is:
8848%
8849%      MagickBooleanType MagickSetImage(MagickWand *wand,
8850%        const MagickWand *set_wand)
8851%
8852%  A description of each parameter follows:
8853%
8854%    o wand: the magick wand.
8855%
8856%    o set_wand: the set_wand wand.
8857%
8858*/
8859WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8860  const MagickWand *set_wand)
8861{
8862  Image
8863    *images;
8864
8865  assert(wand != (MagickWand *) NULL);
8866  assert(wand->signature == WandSignature);
8867  if( IfMagickTrue(wand->debug) )
8868    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8869
8870  assert(set_wand != (MagickWand *) NULL);
8871  assert(set_wand->signature == WandSignature);
8872  if( IfMagickTrue(wand->debug) )
8873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8874
8875  if (set_wand->images == (Image *) NULL)
8876    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8877  images=CloneImageList(set_wand->images,wand->exception);
8878  if (images == (Image *) NULL)
8879    return(MagickFalse);
8880  ReplaceImageInList(&wand->images,images);
8881  return(MagickTrue);
8882}
8883
8884/*
8885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8886%                                                                             %
8887%                                                                             %
8888%                                                                             %
8889%   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                       %
8890%                                                                             %
8891%                                                                             %
8892%                                                                             %
8893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8894%
8895%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8896%  alpha channel.
8897%
8898%  The format of the MagickSetImageAlphaChannel method is:
8899%
8900%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8901%        const AlphaChannelType alpha_type)
8902%
8903%  A description of each parameter follows:
8904%
8905%    o wand: the magick wand.
8906%
8907%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8908%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8909%
8910*/
8911WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8912  const AlphaChannelType alpha_type)
8913{
8914  assert(wand != (MagickWand *) NULL);
8915  assert(wand->signature == WandSignature);
8916  if( IfMagickTrue(wand->debug) )
8917    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8918
8919  if (wand->images == (Image *) NULL)
8920    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8921  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8922}
8923
8924/*
8925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8926%                                                                             %
8927%                                                                             %
8928%                                                                             %
8929%   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                 %
8930%                                                                             %
8931%                                                                             %
8932%                                                                             %
8933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8934%
8935%  MagickSetImageBackgroundColor() sets the image background color.
8936%
8937%  The format of the MagickSetImageBackgroundColor method is:
8938%
8939%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8940%        const PixelWand *background)
8941%
8942%  A description of each parameter follows:
8943%
8944%    o wand: the magick wand.
8945%
8946%    o background: the background pixel wand.
8947%
8948*/
8949WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8950  const PixelWand *background)
8951{
8952  assert(wand != (MagickWand *) NULL);
8953  assert(wand->signature == WandSignature);
8954  if( IfMagickTrue(wand->debug) )
8955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8956
8957  if (wand->images == (Image *) NULL)
8958    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8959  PixelGetQuantumPacket(background,&wand->images->background_color);
8960  return(MagickTrue);
8961}
8962
8963/*
8964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8965%                                                                             %
8966%                                                                             %
8967%                                                                             %
8968%   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                         %
8969%                                                                             %
8970%                                                                             %
8971%                                                                             %
8972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8973%
8974%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8975%
8976%  The format of the MagickSetImageBluePrimary method is:
8977%
8978%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8979%        const double x,const double y)
8980%
8981%  A description of each parameter follows:
8982%
8983%    o wand: the magick wand.
8984%
8985%    o x: the blue primary x-point.
8986%
8987%    o y: the blue primary y-point.
8988%
8989*/
8990WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8991  const double x,const double y)
8992{
8993  assert(wand != (MagickWand *) NULL);
8994  assert(wand->signature == WandSignature);
8995  if( IfMagickTrue(wand->debug) )
8996    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8997
8998  if (wand->images == (Image *) NULL)
8999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9000  wand->images->chromaticity.blue_primary.x=x;
9001  wand->images->chromaticity.blue_primary.y=y;
9002  return(MagickTrue);
9003}
9004
9005/*
9006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9007%                                                                             %
9008%                                                                             %
9009%                                                                             %
9010%   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                         %
9011%                                                                             %
9012%                                                                             %
9013%                                                                             %
9014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9015%
9016%  MagickSetImageBorderColor() sets the image border color.
9017%
9018%  The format of the MagickSetImageBorderColor method is:
9019%
9020%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9021%        const PixelWand *border)
9022%
9023%  A description of each parameter follows:
9024%
9025%    o wand: the magick wand.
9026%
9027%    o border: the border pixel wand.
9028%
9029*/
9030WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9031  const PixelWand *border)
9032{
9033  assert(wand != (MagickWand *) NULL);
9034  assert(wand->signature == WandSignature);
9035  if( IfMagickTrue(wand->debug) )
9036    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9037
9038  if (wand->images == (Image *) NULL)
9039    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9040  PixelGetQuantumPacket(border,&wand->images->border_color);
9041  return(MagickTrue);
9042}
9043
9044/*
9045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9046%                                                                             %
9047%                                                                             %
9048%                                                                             %
9049%   M a g i c k S e t I m a g e C l i p M a s k                               %
9050%                                                                             %
9051%                                                                             %
9052%                                                                             %
9053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9054%
9055%  MagickSetImageMask() sets image clip mask.
9056%
9057%  The format of the MagickSetImageMask method is:
9058%
9059%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9060%        const MagickWand *clip_mask)
9061%
9062%  A description of each parameter follows:
9063%
9064%    o wand: the magick wand.
9065%
9066%    o clip_mask: the clip_mask wand.
9067%
9068*/
9069WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9070  const MagickWand *clip_mask)
9071{
9072  assert(wand != (MagickWand *) NULL);
9073  assert(wand->signature == WandSignature);
9074  if( IfMagickTrue(wand->debug) )
9075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9076
9077  assert(clip_mask != (MagickWand *) NULL);
9078  assert(clip_mask->signature == WandSignature);
9079  if( IfMagickTrue(clip_mask->debug) )
9080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9081
9082  if (clip_mask->images == (Image *) NULL)
9083    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9084  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9085}
9086
9087/*
9088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9089%                                                                             %
9090%                                                                             %
9091%                                                                             %
9092%   M a g i c k S e t I m a g e C o l o r                                     %
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9097%
9098%  MagickSetImageColor() set the entire wand canvas to the specified color.
9099%
9100%  The format of the MagickSetImageColor method is:
9101%
9102%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9103%        const PixelWand *color)
9104%
9105%  A description of each parameter follows:
9106%
9107%    o wand: the magick wand.
9108%
9109%    o background: the image color.
9110%
9111*/
9112WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9113  const PixelWand *color)
9114{
9115  PixelInfo
9116    pixel;
9117
9118  assert(wand != (MagickWand *) NULL);
9119  assert(wand->signature == WandSignature);
9120  if( IfMagickTrue(wand->debug) )
9121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9122
9123  PixelGetMagickColor(color,&pixel);
9124  return(SetImageColor(wand->images,&pixel,wand->exception));
9125}
9126
9127/*
9128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9129%                                                                             %
9130%                                                                             %
9131%                                                                             %
9132%   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                     %
9133%                                                                             %
9134%                                                                             %
9135%                                                                             %
9136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9137%
9138%  MagickSetImageColormapColor() sets the color of the specified colormap
9139%  index.
9140%
9141%  The format of the MagickSetImageColormapColor method is:
9142%
9143%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9144%        const size_t index,const PixelWand *color)
9145%
9146%  A description of each parameter follows:
9147%
9148%    o wand: the magick wand.
9149%
9150%    o index: the offset into the image colormap.
9151%
9152%    o color: Return the colormap color in this wand.
9153%
9154*/
9155WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9156  const size_t index,const PixelWand *color)
9157{
9158  assert(wand != (MagickWand *) NULL);
9159  assert(wand->signature == WandSignature);
9160  if( IfMagickTrue(wand->debug) )
9161    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9162
9163  if (wand->images == (Image *) NULL)
9164    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9165  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9166      (index >= wand->images->colors))
9167    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9168  PixelGetQuantumPacket(color,wand->images->colormap+index);
9169  return(SyncImage(wand->images,wand->exception));
9170}
9171
9172/*
9173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9174%                                                                             %
9175%                                                                             %
9176%                                                                             %
9177%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9178%                                                                             %
9179%                                                                             %
9180%                                                                             %
9181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9182%
9183%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9184%  the image data.
9185%
9186%  The format of the MagickSetImageColorspace method is:
9187%
9188%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9189%        const ColorspaceType colorspace)
9190%
9191%  A description of each parameter follows:
9192%
9193%    o wand: the magick wand.
9194%
9195%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9196%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9197%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9198%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9199%      HSLColorspace, or HWBColorspace.
9200%
9201*/
9202WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9203  const ColorspaceType colorspace)
9204{
9205  assert(wand != (MagickWand *) NULL);
9206  assert(wand->signature == WandSignature);
9207  if( IfMagickTrue(wand->debug) )
9208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9209
9210  if (wand->images == (Image *) NULL)
9211    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9212  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9213}
9214
9215/*
9216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9217%                                                                             %
9218%                                                                             %
9219%                                                                             %
9220%   M a g i c k S e t I m a g e C o m p o s e                                 %
9221%                                                                             %
9222%                                                                             %
9223%                                                                             %
9224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9225%
9226%  MagickSetImageCompose() sets the image composite operator, useful for
9227%  specifying how to composite the image thumbnail when using the
9228%  MagickMontageImage() method.
9229%
9230%  The format of the MagickSetImageCompose method is:
9231%
9232%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9233%        const CompositeOperator compose)
9234%
9235%  A description of each parameter follows:
9236%
9237%    o wand: the magick wand.
9238%
9239%    o compose: the image composite operator.
9240%
9241*/
9242WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9243  const CompositeOperator compose)
9244{
9245  assert(wand != (MagickWand *) NULL);
9246  assert(wand->signature == WandSignature);
9247  if( IfMagickTrue(wand->debug) )
9248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9249
9250  if (wand->images == (Image *) NULL)
9251    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9252  wand->images->compose=compose;
9253  return(MagickTrue);
9254}
9255
9256/*
9257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9258%                                                                             %
9259%                                                                             %
9260%                                                                             %
9261%   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                         %
9262%                                                                             %
9263%                                                                             %
9264%                                                                             %
9265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9266%
9267%  MagickSetImageCompression() sets the image compression.
9268%
9269%  The format of the MagickSetImageCompression method is:
9270%
9271%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9272%        const CompressionType compression)
9273%
9274%  A description of each parameter follows:
9275%
9276%    o wand: the magick wand.
9277%
9278%    o compression: the image compression type.
9279%
9280*/
9281WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9282  const CompressionType compression)
9283{
9284  assert(wand != (MagickWand *) NULL);
9285  assert(wand->signature == WandSignature);
9286  if( IfMagickTrue(wand->debug) )
9287    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9288
9289  if (wand->images == (Image *) NULL)
9290    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9291  wand->images->compression=compression;
9292  return(MagickTrue);
9293}
9294
9295/*
9296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9297%                                                                             %
9298%                                                                             %
9299%                                                                             %
9300%   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           %
9301%                                                                             %
9302%                                                                             %
9303%                                                                             %
9304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9305%
9306%  MagickSetImageCompressionQuality() sets the image compression quality.
9307%
9308%  The format of the MagickSetImageCompressionQuality method is:
9309%
9310%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9311%        const size_t quality)
9312%
9313%  A description of each parameter follows:
9314%
9315%    o wand: the magick wand.
9316%
9317%    o quality: the image compression tlityype.
9318%
9319*/
9320WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9321  const size_t quality)
9322{
9323  assert(wand != (MagickWand *) NULL);
9324  assert(wand->signature == WandSignature);
9325  if( IfMagickTrue(wand->debug) )
9326    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9327
9328  if (wand->images == (Image *) NULL)
9329    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9330  wand->images->quality=quality;
9331  return(MagickTrue);
9332}
9333
9334/*
9335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9336%                                                                             %
9337%                                                                             %
9338%                                                                             %
9339%   M a g i c k S e t I m a g e D e l a y                                     %
9340%                                                                             %
9341%                                                                             %
9342%                                                                             %
9343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9344%
9345%  MagickSetImageDelay() sets the image delay.
9346%
9347%  The format of the MagickSetImageDelay method is:
9348%
9349%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9350%        const size_t delay)
9351%
9352%  A description of each parameter follows:
9353%
9354%    o wand: the magick wand.
9355%
9356%    o delay: the image delay in ticks-per-second units.
9357%
9358*/
9359WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9360  const size_t delay)
9361{
9362  assert(wand != (MagickWand *) NULL);
9363  assert(wand->signature == WandSignature);
9364  if( IfMagickTrue(wand->debug) )
9365    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9366
9367  if (wand->images == (Image *) NULL)
9368    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9369  wand->images->delay=delay;
9370  return(MagickTrue);
9371}
9372
9373/*
9374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9375%                                                                             %
9376%                                                                             %
9377%                                                                             %
9378%   M a g i c k S e t I m a g e D e p t h                                     %
9379%                                                                             %
9380%                                                                             %
9381%                                                                             %
9382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9383%
9384%  MagickSetImageDepth() sets the image depth.
9385%
9386%  The format of the MagickSetImageDepth method is:
9387%
9388%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9389%        const size_t depth)
9390%
9391%  A description of each parameter follows:
9392%
9393%    o wand: the magick wand.
9394%
9395%    o depth: the image depth in bits: 8, 16, or 32.
9396%
9397*/
9398WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9399  const size_t depth)
9400{
9401  assert(wand != (MagickWand *) NULL);
9402  assert(wand->signature == WandSignature);
9403  if( IfMagickTrue(wand->debug) )
9404    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9405
9406  if (wand->images == (Image *) NULL)
9407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9408  return(SetImageDepth(wand->images,depth,wand->exception));
9409}
9410
9411/*
9412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9413%                                                                             %
9414%                                                                             %
9415%                                                                             %
9416%   M a g i c k S e t I m a g e D i s p o s e                                 %
9417%                                                                             %
9418%                                                                             %
9419%                                                                             %
9420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9421%
9422%  MagickSetImageDispose() sets the image disposal method.
9423%
9424%  The format of the MagickSetImageDispose method is:
9425%
9426%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9427%        const DisposeType dispose)
9428%
9429%  A description of each parameter follows:
9430%
9431%    o wand: the magick wand.
9432%
9433%    o dispose: the image disposeal type.
9434%
9435*/
9436WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9437  const DisposeType dispose)
9438{
9439  assert(wand != (MagickWand *) NULL);
9440  assert(wand->signature == WandSignature);
9441  if( IfMagickTrue(wand->debug) )
9442    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9443
9444  if (wand->images == (Image *) NULL)
9445    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9446  wand->images->dispose=dispose;
9447  return(MagickTrue);
9448}
9449
9450/*
9451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9452%                                                                             %
9453%                                                                             %
9454%                                                                             %
9455%   M a g i c k S e t I m a g e E n d i a n                                   %
9456%                                                                             %
9457%                                                                             %
9458%                                                                             %
9459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9460%
9461%  MagickSetImageEndian() sets the image endian method.
9462%
9463%  The format of the MagickSetImageEndian method is:
9464%
9465%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9466%        const EndianType endian)
9467%
9468%  A description of each parameter follows:
9469%
9470%    o wand: the magick wand.
9471%
9472%    o endian: the image endian type.
9473%
9474*/
9475WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9476  const EndianType endian)
9477{
9478  assert(wand != (MagickWand *) NULL);
9479  assert(wand->signature == WandSignature);
9480  if (wand->debug != MagickFalse)
9481    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9482  if (wand->images == (Image *) NULL)
9483    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9484  wand->images->endian=endian;
9485  return(MagickTrue);
9486}
9487
9488/*
9489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9490%                                                                             %
9491%                                                                             %
9492%                                                                             %
9493%   M a g i c k S e t I m a g e E x t e n t                                   %
9494%                                                                             %
9495%                                                                             %
9496%                                                                             %
9497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9498%
9499%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9500%
9501%  The format of the MagickSetImageExtent method is:
9502%
9503%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9504%        const size_t columns,const unsigned rows)
9505%
9506%  A description of each parameter follows:
9507%
9508%    o wand: the magick wand.
9509%
9510%    o columns:  The image width in pixels.
9511%
9512%    o rows:  The image height in pixels.
9513%
9514*/
9515WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9516  const size_t columns,const size_t rows)
9517{
9518  assert(wand != (MagickWand *) NULL);
9519  assert(wand->signature == WandSignature);
9520  if( IfMagickTrue(wand->debug) )
9521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9522
9523  if (wand->images == (Image *) NULL)
9524    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9525  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9526}
9527
9528/*
9529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9530%                                                                             %
9531%                                                                             %
9532%                                                                             %
9533%   M a g i c k S e t I m a g e F i l e n a m e                               %
9534%                                                                             %
9535%                                                                             %
9536%                                                                             %
9537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9538%
9539%  MagickSetImageFilename() sets the filename of a particular image in a
9540%  sequence.
9541%
9542%  The format of the MagickSetImageFilename method is:
9543%
9544%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9545%        const char *filename)
9546%
9547%  A description of each parameter follows:
9548%
9549%    o wand: the magick wand.
9550%
9551%    o filename: the image filename.
9552%
9553*/
9554WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9555  const char *filename)
9556{
9557  assert(wand != (MagickWand *) NULL);
9558  assert(wand->signature == WandSignature);
9559  if( IfMagickTrue(wand->debug) )
9560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9561
9562  if (wand->images == (Image *) NULL)
9563    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9564  if (filename != (const char *) NULL)
9565    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9566  return(MagickTrue);
9567}
9568
9569/*
9570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9571%                                                                             %
9572%                                                                             %
9573%                                                                             %
9574%   M a g i c k S e t I m a g e F o r m a t                                   %
9575%                                                                             %
9576%                                                                             %
9577%                                                                             %
9578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9579%
9580%  MagickSetImageFormat() sets the format of a particular image in a
9581%  sequence.
9582%
9583%  The format of the MagickSetImageFormat method is:
9584%
9585%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9586%        const char *format)
9587%
9588%  A description of each parameter follows:
9589%
9590%    o wand: the magick wand.
9591%
9592%    o format: the image format.
9593%
9594*/
9595WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9596  const char *format)
9597{
9598  const MagickInfo
9599    *magick_info;
9600
9601  assert(wand != (MagickWand *) NULL);
9602  assert(wand->signature == WandSignature);
9603  if( IfMagickTrue(wand->debug) )
9604    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9605
9606  if (wand->images == (Image *) NULL)
9607    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9608  if ((format == (char *) NULL) || (*format == '\0'))
9609    {
9610      *wand->images->magick='\0';
9611      return(MagickTrue);
9612    }
9613  magick_info=GetMagickInfo(format,wand->exception);
9614  if (magick_info == (const MagickInfo *) NULL)
9615    return(MagickFalse);
9616  ClearMagickException(wand->exception);
9617  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9618  return(MagickTrue);
9619}
9620
9621/*
9622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9623%                                                                             %
9624%                                                                             %
9625%                                                                             %
9626%   M a g i c k S e t I m a g e F u z z                                       %
9627%                                                                             %
9628%                                                                             %
9629%                                                                             %
9630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9631%
9632%  MagickSetImageFuzz() sets the image fuzz.
9633%
9634%  The format of the MagickSetImageFuzz method is:
9635%
9636%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9637%        const double fuzz)
9638%
9639%  A description of each parameter follows:
9640%
9641%    o wand: the magick wand.
9642%
9643%    o fuzz: the image fuzz.
9644%
9645*/
9646WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9647  const double fuzz)
9648{
9649  assert(wand != (MagickWand *) NULL);
9650  assert(wand->signature == WandSignature);
9651  if( IfMagickTrue(wand->debug) )
9652    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9653
9654  if (wand->images == (Image *) NULL)
9655    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9656  wand->images->fuzz=fuzz;
9657  return(MagickTrue);
9658}
9659
9660/*
9661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9662%                                                                             %
9663%                                                                             %
9664%                                                                             %
9665%   M a g i c k S e t I m a g e G a m m a                                     %
9666%                                                                             %
9667%                                                                             %
9668%                                                                             %
9669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9670%
9671%  MagickSetImageGamma() sets the image gamma.
9672%
9673%  The format of the MagickSetImageGamma method is:
9674%
9675%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9676%        const double gamma)
9677%
9678%  A description of each parameter follows:
9679%
9680%    o wand: the magick wand.
9681%
9682%    o gamma: the image gamma.
9683%
9684*/
9685WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9686  const double gamma)
9687{
9688  assert(wand != (MagickWand *) NULL);
9689  assert(wand->signature == WandSignature);
9690  if( IfMagickTrue(wand->debug) )
9691    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9692
9693  if (wand->images == (Image *) NULL)
9694    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9695  wand->images->gamma=gamma;
9696  return(MagickTrue);
9697}
9698
9699/*
9700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9701%                                                                             %
9702%                                                                             %
9703%                                                                             %
9704%   M a g i c k S e t I m a g e G r a v i t y                                 %
9705%                                                                             %
9706%                                                                             %
9707%                                                                             %
9708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9709%
9710%  MagickSetImageGravity() sets the image gravity type.
9711%
9712%  The format of the MagickSetImageGravity method is:
9713%
9714%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9715%        const GravityType gravity)
9716%
9717%  A description of each parameter follows:
9718%
9719%    o wand: the magick wand.
9720%
9721%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9722%      PlaneInterlace, PartitionInterlace.
9723%
9724*/
9725WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9726  const GravityType gravity)
9727{
9728  assert(wand != (MagickWand *) NULL);
9729  assert(wand->signature == WandSignature);
9730  if( IfMagickTrue(wand->debug) )
9731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9732
9733  if (wand->images == (Image *) NULL)
9734    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9735  wand->images->gravity=gravity;
9736  return(MagickTrue);
9737}
9738
9739/*
9740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9741%                                                                             %
9742%                                                                             %
9743%                                                                             %
9744%   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                       %
9745%                                                                             %
9746%                                                                             %
9747%                                                                             %
9748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9749%
9750%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9751%  point.
9752%
9753%  The format of the MagickSetImageGreenPrimary method is:
9754%
9755%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9756%        const double x,const double y)
9757%
9758%  A description of each parameter follows:
9759%
9760%    o wand: the magick wand.
9761%
9762%    o x: the green primary x-point.
9763%
9764%    o y: the green primary y-point.
9765%
9766%
9767*/
9768WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9769  const double x,const double y)
9770{
9771  assert(wand != (MagickWand *) NULL);
9772  assert(wand->signature == WandSignature);
9773  if( IfMagickTrue(wand->debug) )
9774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775
9776  if (wand->images == (Image *) NULL)
9777    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9778  wand->images->chromaticity.green_primary.x=x;
9779  wand->images->chromaticity.green_primary.y=y;
9780  return(MagickTrue);
9781}
9782
9783/*
9784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9785%                                                                             %
9786%                                                                             %
9787%                                                                             %
9788%   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                 %
9789%                                                                             %
9790%                                                                             %
9791%                                                                             %
9792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9793%
9794%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9795%
9796%  The format of the MagickSetImageInterlaceScheme method is:
9797%
9798%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9799%        const InterlaceType interlace)
9800%
9801%  A description of each parameter follows:
9802%
9803%    o wand: the magick wand.
9804%
9805%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9806%      PlaneInterlace, PartitionInterlace.
9807%
9808*/
9809WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9810  const InterlaceType interlace)
9811{
9812  assert(wand != (MagickWand *) NULL);
9813  assert(wand->signature == WandSignature);
9814  if( IfMagickTrue(wand->debug) )
9815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9816
9817  if (wand->images == (Image *) NULL)
9818    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9819  wand->images->interlace=interlace;
9820  return(MagickTrue);
9821}
9822
9823/*
9824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9825%                                                                             %
9826%                                                                             %
9827%                                                                             %
9828%   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             %
9829%                                                                             %
9830%                                                                             %
9831%                                                                             %
9832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9833%
9834%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9835%
9836%  The format of the MagickSetImagePixelInterpolateMethod method is:
9837%
9838%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9839%        const PixelInterpolateMethod method)
9840%
9841%  A description of each parameter follows:
9842%
9843%    o wand: the magick wand.
9844%
9845%    o method: the image interpole pixel methods: choose from Undefined,
9846%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9847%
9848*/
9849WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9850  const PixelInterpolateMethod method)
9851{
9852  assert(wand != (MagickWand *) NULL);
9853  assert(wand->signature == WandSignature);
9854  if( IfMagickTrue(wand->debug) )
9855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9856
9857  if (wand->images == (Image *) NULL)
9858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9859  wand->images->interpolate=method;
9860  return(MagickTrue);
9861}
9862
9863/*
9864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9865%                                                                             %
9866%                                                                             %
9867%                                                                             %
9868%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9869%                                                                             %
9870%                                                                             %
9871%                                                                             %
9872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9873%
9874%  MagickSetImageIterations() sets the image iterations.
9875%
9876%  The format of the MagickSetImageIterations method is:
9877%
9878%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9879%        const size_t iterations)
9880%
9881%  A description of each parameter follows:
9882%
9883%    o wand: the magick wand.
9884%
9885%    o delay: the image delay in 1/100th of a second.
9886%
9887*/
9888WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9889  const size_t iterations)
9890{
9891  assert(wand != (MagickWand *) NULL);
9892  assert(wand->signature == WandSignature);
9893  if( IfMagickTrue(wand->debug) )
9894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9895
9896  if (wand->images == (Image *) NULL)
9897    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9898  wand->images->iterations=iterations;
9899  return(MagickTrue);
9900}
9901
9902/*
9903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9904%                                                                             %
9905%                                                                             %
9906%                                                                             %
9907%   M a g i c k S e t I m a g e M a t t e                                     %
9908%                                                                             %
9909%                                                                             %
9910%                                                                             %
9911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9912%
9913%  MagickSetImageMatte() sets the image matte channel.
9914%
9915%  The format of the MagickSetImageMatteColor method is:
9916%
9917%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9918%        const MagickBooleanType *matte)
9919%
9920%  A description of each parameter follows:
9921%
9922%    o wand: the magick wand.
9923%
9924%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9925%      MagickFalse.
9926%
9927*/
9928WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9929  const MagickBooleanType matte)
9930{
9931  assert(wand != (MagickWand *) NULL);
9932  assert(wand->signature == WandSignature);
9933  if( IfMagickTrue(wand->debug) )
9934    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9935
9936  if (wand->images == (Image *) NULL)
9937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9938  if( IfMagickFalse(wand->images->matte) && IsMagickTrue(matte))
9939    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9940  wand->images->matte=matte;
9941  return(MagickTrue);
9942}
9943
9944/*
9945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9946%                                                                             %
9947%                                                                             %
9948%                                                                             %
9949%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9950%                                                                             %
9951%                                                                             %
9952%                                                                             %
9953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9954%
9955%  MagickSetImageMatteColor() sets the image matte color.
9956%
9957%  The format of the MagickSetImageMatteColor method is:
9958%
9959%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9960%        const PixelWand *matte)
9961%
9962%  A description of each parameter follows:
9963%
9964%    o wand: the magick wand.
9965%
9966%    o matte: the matte pixel wand.
9967%
9968*/
9969WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9970  const PixelWand *matte)
9971{
9972  assert(wand != (MagickWand *) NULL);
9973  assert(wand->signature == WandSignature);
9974  if( IfMagickTrue(wand->debug) )
9975    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9976
9977  if (wand->images == (Image *) NULL)
9978    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9979  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9980  return(MagickTrue);
9981}
9982
9983/*
9984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9985%                                                                             %
9986%                                                                             %
9987%                                                                             %
9988%   M a g i c k S e t I m a g e O p a c i t y                                 %
9989%                                                                             %
9990%                                                                             %
9991%                                                                             %
9992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9993%
9994%  MagickSetImageAlpha() sets the image to the specified alpha level.
9995%
9996%  The format of the MagickSetImageAlpha method is:
9997%
9998%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9999%        const double alpha)
10000%
10001%  A description of each parameter follows:
10002%
10003%    o wand: the magick wand.
10004%
10005%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10006%      transparent.
10007%
10008*/
10009WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10010  const double alpha)
10011{
10012  MagickBooleanType
10013    status;
10014
10015  assert(wand != (MagickWand *) NULL);
10016  assert(wand->signature == WandSignature);
10017  if( IfMagickTrue(wand->debug) )
10018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10019
10020  if (wand->images == (Image *) NULL)
10021    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10022  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10023    wand->exception);
10024  return(status);
10025}
10026
10027/*
10028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10029%                                                                             %
10030%                                                                             %
10031%                                                                             %
10032%   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                         %
10033%                                                                             %
10034%                                                                             %
10035%                                                                             %
10036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10037%
10038%  MagickSetImageOrientation() sets the image orientation.
10039%
10040%  The format of the MagickSetImageOrientation method is:
10041%
10042%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10043%        const OrientationType orientation)
10044%
10045%  A description of each parameter follows:
10046%
10047%    o wand: the magick wand.
10048%
10049%    o orientation: the image orientation type.
10050%
10051*/
10052WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10053  const OrientationType orientation)
10054{
10055  assert(wand != (MagickWand *) NULL);
10056  assert(wand->signature == WandSignature);
10057  if( IfMagickTrue(wand->debug) )
10058    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10059
10060  if (wand->images == (Image *) NULL)
10061    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10062  wand->images->orientation=orientation;
10063  return(MagickTrue);
10064}
10065
10066/*
10067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10068%                                                                             %
10069%                                                                             %
10070%                                                                             %
10071%   M a g i c k S e t I m a g e P a g e                                       %
10072%                                                                             %
10073%                                                                             %
10074%                                                                             %
10075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10076%
10077%  MagickSetImagePage() sets the page geometry of the image.
10078%
10079%  The format of the MagickSetImagePage method is:
10080%
10081%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10082%        const size_t width,const size_t height,const ssize_t x,
10083%        const ssize_t y)
10084%
10085%  A description of each parameter follows:
10086%
10087%    o wand: the magick wand.
10088%
10089%    o width: the page width.
10090%
10091%    o height: the page height.
10092%
10093%    o x: the page x-offset.
10094%
10095%    o y: the page y-offset.
10096%
10097*/
10098WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10099  const size_t width,const size_t height,const ssize_t x,
10100  const ssize_t y)
10101{
10102  assert(wand != (MagickWand *) NULL);
10103  assert(wand->signature == WandSignature);
10104  if( IfMagickTrue(wand->debug) )
10105    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10106
10107  if (wand->images == (Image *) NULL)
10108    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10109  wand->images->page.width=width;
10110  wand->images->page.height=height;
10111  wand->images->page.x=x;
10112  wand->images->page.y=y;
10113  return(MagickTrue);
10114}
10115
10116/*
10117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10118%                                                                             %
10119%                                                                             %
10120%                                                                             %
10121%   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                 %
10122%                                                                             %
10123%                                                                             %
10124%                                                                             %
10125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10126%
10127%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10128%  specified method and returns the previous progress monitor if any.  The
10129%  progress monitor method looks like this:
10130%
10131%    MagickBooleanType MagickProgressMonitor(const char *text,
10132%      const MagickOffsetType offset,const MagickSizeType span,
10133%      void *client_data)
10134%
10135%  If the progress monitor returns MagickFalse, the current operation is
10136%  interrupted.
10137%
10138%  The format of the MagickSetImageProgressMonitor method is:
10139%
10140%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10141%        const MagickProgressMonitor progress_monitor,void *client_data)
10142%
10143%  A description of each parameter follows:
10144%
10145%    o wand: the magick wand.
10146%
10147%    o progress_monitor: Specifies a pointer to a method to monitor progress
10148%      of an image operation.
10149%
10150%    o client_data: Specifies a pointer to any client data.
10151%
10152*/
10153WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10154  const MagickProgressMonitor progress_monitor,void *client_data)
10155{
10156  MagickProgressMonitor
10157    previous_monitor;
10158
10159  assert(wand != (MagickWand *) NULL);
10160  assert(wand->signature == WandSignature);
10161  if( IfMagickTrue(wand->debug) )
10162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10163
10164  if (wand->images == (Image *) NULL)
10165    {
10166      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10167        "ContainsNoImages","'%s'",wand->name);
10168      return((MagickProgressMonitor) NULL);
10169    }
10170  previous_monitor=SetImageProgressMonitor(wand->images,
10171    progress_monitor,client_data);
10172  return(previous_monitor);
10173}
10174
10175/*
10176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10177%                                                                             %
10178%                                                                             %
10179%                                                                             %
10180%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10181%                                                                             %
10182%                                                                             %
10183%                                                                             %
10184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10185%
10186%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10187%
10188%  The format of the MagickSetImageRedPrimary method is:
10189%
10190%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10191%        const double x,const double y)
10192%
10193%  A description of each parameter follows:
10194%
10195%    o wand: the magick wand.
10196%
10197%    o x: the red primary x-point.
10198%
10199%    o y: the red primary y-point.
10200%
10201*/
10202WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10203  const double x,const double y)
10204{
10205  assert(wand != (MagickWand *) NULL);
10206  assert(wand->signature == WandSignature);
10207  if( IfMagickTrue(wand->debug) )
10208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10209
10210  if (wand->images == (Image *) NULL)
10211    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10212  wand->images->chromaticity.red_primary.x=x;
10213  wand->images->chromaticity.red_primary.y=y;
10214  return(MagickTrue);
10215}
10216
10217/*
10218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10219%                                                                             %
10220%                                                                             %
10221%                                                                             %
10222%   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                 %
10223%                                                                             %
10224%                                                                             %
10225%                                                                             %
10226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10227%
10228%  MagickSetImageRenderingIntent() sets the image rendering intent.
10229%
10230%  The format of the MagickSetImageRenderingIntent method is:
10231%
10232%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10233%        const RenderingIntent rendering_intent)
10234%
10235%  A description of each parameter follows:
10236%
10237%    o wand: the magick wand.
10238%
10239%    o rendering_intent: the image rendering intent: UndefinedIntent,
10240%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10241%
10242*/
10243WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10244  const RenderingIntent rendering_intent)
10245{
10246  assert(wand != (MagickWand *) NULL);
10247  assert(wand->signature == WandSignature);
10248  if( IfMagickTrue(wand->debug) )
10249    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10250
10251  if (wand->images == (Image *) NULL)
10252    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10253  wand->images->rendering_intent=rendering_intent;
10254  return(MagickTrue);
10255}
10256
10257/*
10258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10259%                                                                             %
10260%                                                                             %
10261%                                                                             %
10262%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10263%                                                                             %
10264%                                                                             %
10265%                                                                             %
10266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10267%
10268%  MagickSetImageResolution() sets the image resolution.
10269%
10270%  The format of the MagickSetImageResolution method is:
10271%
10272%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10273%        const double x_resolution,const double y_resolution)
10274%
10275%  A description of each parameter follows:
10276%
10277%    o wand: the magick wand.
10278%
10279%    o x_resolution: the image x resolution.
10280%
10281%    o y_resolution: the image y resolution.
10282%
10283*/
10284WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10285  const double x_resolution,const double y_resolution)
10286{
10287  assert(wand != (MagickWand *) NULL);
10288  assert(wand->signature == WandSignature);
10289  if( IfMagickTrue(wand->debug) )
10290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10291
10292  if (wand->images == (Image *) NULL)
10293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10294  wand->images->resolution.x=x_resolution;
10295  wand->images->resolution.y=y_resolution;
10296  return(MagickTrue);
10297}
10298
10299/*
10300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10301%                                                                             %
10302%                                                                             %
10303%                                                                             %
10304%   M a g i c k S e t I m a g e S c e n e                                     %
10305%                                                                             %
10306%                                                                             %
10307%                                                                             %
10308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10309%
10310%  MagickSetImageScene() sets the image scene.
10311%
10312%  The format of the MagickSetImageScene method is:
10313%
10314%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10315%        const size_t scene)
10316%
10317%  A description of each parameter follows:
10318%
10319%    o wand: the magick wand.
10320%
10321%    o delay: the image scene number.
10322%
10323*/
10324WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10325  const size_t scene)
10326{
10327  assert(wand != (MagickWand *) NULL);
10328  assert(wand->signature == WandSignature);
10329  if( IfMagickTrue(wand->debug) )
10330    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10331
10332  if (wand->images == (Image *) NULL)
10333    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10334  wand->images->scene=scene;
10335  return(MagickTrue);
10336}
10337
10338/*
10339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10340%                                                                             %
10341%                                                                             %
10342%                                                                             %
10343%   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                   %
10344%                                                                             %
10345%                                                                             %
10346%                                                                             %
10347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10348%
10349%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10350%
10351%  The format of the MagickSetImageTicksPerSecond method is:
10352%
10353%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10354%        const ssize_t ticks_per-second)
10355%
10356%  A description of each parameter follows:
10357%
10358%    o wand: the magick wand.
10359%
10360%    o ticks_per_second: the units to use for the image delay.
10361%
10362*/
10363WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10364  const ssize_t ticks_per_second)
10365{
10366  assert(wand != (MagickWand *) NULL);
10367  assert(wand->signature == WandSignature);
10368  if( IfMagickTrue(wand->debug) )
10369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10370
10371  if (wand->images == (Image *) NULL)
10372    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10373  wand->images->ticks_per_second=ticks_per_second;
10374  return(MagickTrue);
10375}
10376
10377/*
10378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10379%                                                                             %
10380%                                                                             %
10381%                                                                             %
10382%   M a g i c k S e t I m a g e T y p e                                       %
10383%                                                                             %
10384%                                                                             %
10385%                                                                             %
10386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10387%
10388%  MagickSetImageType() sets the image type.
10389%
10390%  The format of the MagickSetImageType method is:
10391%
10392%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10393%        const ImageType image_type)
10394%
10395%  A description of each parameter follows:
10396%
10397%    o wand: the magick wand.
10398%
10399%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10400%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10401%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10402%      or OptimizeType.
10403%
10404*/
10405WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10406  const ImageType image_type)
10407{
10408  assert(wand != (MagickWand *) NULL);
10409  assert(wand->signature == WandSignature);
10410  if( IfMagickTrue(wand->debug) )
10411    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10412
10413  if (wand->images == (Image *) NULL)
10414    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10415  return(SetImageType(wand->images,image_type,wand->exception));
10416}
10417
10418/*
10419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10420%                                                                             %
10421%                                                                             %
10422%                                                                             %
10423%   M a g i c k S e t I m a g e U n i t s                                     %
10424%                                                                             %
10425%                                                                             %
10426%                                                                             %
10427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10428%
10429%  MagickSetImageUnits() sets the image units of resolution.
10430%
10431%  The format of the MagickSetImageUnits method is:
10432%
10433%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10434%        const ResolutionType units)
10435%
10436%  A description of each parameter follows:
10437%
10438%    o wand: the magick wand.
10439%
10440%    o units: the image units of resolution : UndefinedResolution,
10441%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10442%
10443*/
10444WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10445  const ResolutionType units)
10446{
10447  assert(wand != (MagickWand *) NULL);
10448  assert(wand->signature == WandSignature);
10449  if( IfMagickTrue(wand->debug) )
10450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10451
10452  if (wand->images == (Image *) NULL)
10453    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10454  wand->images->units=units;
10455  return(MagickTrue);
10456}
10457
10458/*
10459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10460%                                                                             %
10461%                                                                             %
10462%                                                                             %
10463%   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           %
10464%                                                                             %
10465%                                                                             %
10466%                                                                             %
10467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10468%
10469%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10470%
10471%  The format of the MagickSetImageVirtualPixelMethod method is:
10472%
10473%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10474%        const VirtualPixelMethod method)
10475%
10476%  A description of each parameter follows:
10477%
10478%    o wand: the magick wand.
10479%
10480%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10481%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10482%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10483%
10484*/
10485WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10486  const VirtualPixelMethod method)
10487{
10488  assert(wand != (MagickWand *) NULL);
10489  assert(wand->signature == WandSignature);
10490  if( IfMagickTrue(wand->debug) )
10491    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10492
10493  if (wand->images == (Image *) NULL)
10494    return(UndefinedVirtualPixelMethod);
10495  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10496}
10497
10498/*
10499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10500%                                                                             %
10501%                                                                             %
10502%                                                                             %
10503%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10504%                                                                             %
10505%                                                                             %
10506%                                                                             %
10507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10508%
10509%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10510%
10511%  The format of the MagickSetImageWhitePoint method is:
10512%
10513%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10514%        const double x,const double y)
10515%
10516%  A description of each parameter follows:
10517%
10518%    o wand: the magick wand.
10519%
10520%    o x: the white x-point.
10521%
10522%    o y: the white y-point.
10523%
10524*/
10525WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10526  const double x,const double y)
10527{
10528  assert(wand != (MagickWand *) NULL);
10529  assert(wand->signature == WandSignature);
10530  if( IfMagickTrue(wand->debug) )
10531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10532
10533  if (wand->images == (Image *) NULL)
10534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10535  wand->images->chromaticity.white_point.x=x;
10536  wand->images->chromaticity.white_point.y=y;
10537  return(MagickTrue);
10538}
10539
10540/*
10541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10542%                                                                             %
10543%                                                                             %
10544%                                                                             %
10545%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10546%                                                                             %
10547%                                                                             %
10548%                                                                             %
10549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10550%
10551%  MagickShadeImage() shines a distant light on an image to create a
10552%  three-dimensional effect. You control the positioning of the light with
10553%  azimuth and elevation; azimuth is measured in degrees off the x axis
10554%  and elevation is measured in pixels above the Z axis.
10555%
10556%  The format of the MagickShadeImage method is:
10557%
10558%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10559%        const MagickBooleanType gray,const double azimuth,
10560%        const double elevation)
10561%
10562%  A description of each parameter follows:
10563%
10564%    o wand: the magick wand.
10565%
10566%    o gray: A value other than zero shades the intensity of each pixel.
10567%
10568%    o azimuth, elevation:  Define the light source direction.
10569%
10570*/
10571WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10572  const MagickBooleanType gray,const double asimuth,const double elevation)
10573{
10574  Image
10575    *shade_image;
10576
10577  assert(wand != (MagickWand *) NULL);
10578  assert(wand->signature == WandSignature);
10579  if( IfMagickTrue(wand->debug) )
10580    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10581
10582  if (wand->images == (Image *) NULL)
10583    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10584  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10585  if (shade_image == (Image *) NULL)
10586    return(MagickFalse);
10587  ReplaceImageInList(&wand->images,shade_image);
10588  return(MagickTrue);
10589}
10590
10591/*
10592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10593%                                                                             %
10594%                                                                             %
10595%                                                                             %
10596%   M a g i c k S h a d o w I m a g e                                         %
10597%                                                                             %
10598%                                                                             %
10599%                                                                             %
10600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10601%
10602%  MagickShadowImage() simulates an image shadow.
10603%
10604%  The format of the MagickShadowImage method is:
10605%
10606%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10607%        const double sigma,const ssize_t x,const ssize_t y)
10608%
10609%  A description of each parameter follows:
10610%
10611%    o wand: the magick wand.
10612%
10613%    o alpha: percentage transparency.
10614%
10615%    o sigma: the standard deviation of the Gaussian, in pixels.
10616%
10617%    o x: the shadow x-offset.
10618%
10619%    o y: the shadow y-offset.
10620%
10621*/
10622WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10623  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10624{
10625  Image
10626    *shadow_image;
10627
10628  assert(wand != (MagickWand *) NULL);
10629  assert(wand->signature == WandSignature);
10630  if( IfMagickTrue(wand->debug) )
10631    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10632
10633  if (wand->images == (Image *) NULL)
10634    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10635  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10636  if (shadow_image == (Image *) NULL)
10637    return(MagickFalse);
10638  ReplaceImageInList(&wand->images,shadow_image);
10639  return(MagickTrue);
10640}
10641
10642/*
10643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10644%                                                                             %
10645%                                                                             %
10646%                                                                             %
10647%   M a g i c k S h a r p e n I m a g e                                       %
10648%                                                                             %
10649%                                                                             %
10650%                                                                             %
10651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10652%
10653%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10654%  Gaussian operator of the given radius and standard deviation (sigma).
10655%  For reasonable results, the radius should be larger than sigma.  Use a
10656%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10657%
10658%  The format of the MagickSharpenImage method is:
10659%
10660%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10661%        const double radius,const double sigma)
10662%
10663%  A description of each parameter follows:
10664%
10665%    o wand: the magick wand.
10666%
10667%    o radius: the radius of the Gaussian, in pixels, not counting the center
10668%      pixel.
10669%
10670%    o sigma: the standard deviation of the Gaussian, in pixels.
10671%
10672*/
10673WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10674  const double radius,const double sigma)
10675{
10676  Image
10677    *sharp_image;
10678
10679  assert(wand != (MagickWand *) NULL);
10680  assert(wand->signature == WandSignature);
10681  if( IfMagickTrue(wand->debug) )
10682    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10683
10684  if (wand->images == (Image *) NULL)
10685    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10686  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10687  if (sharp_image == (Image *) NULL)
10688    return(MagickFalse);
10689  ReplaceImageInList(&wand->images,sharp_image);
10690  return(MagickTrue);
10691}
10692
10693/*
10694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10695%                                                                             %
10696%                                                                             %
10697%                                                                             %
10698%   M a g i c k S h a v e I m a g e                                           %
10699%                                                                             %
10700%                                                                             %
10701%                                                                             %
10702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10703%
10704%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10705%  memory necessary for the new Image structure and returns a pointer to the
10706%  new image.
10707%
10708%  The format of the MagickShaveImage method is:
10709%
10710%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10711%        const size_t columns,const size_t rows)
10712%
10713%  A description of each parameter follows:
10714%
10715%    o wand: the magick wand.
10716%
10717%    o columns: the number of columns in the scaled image.
10718%
10719%    o rows: the number of rows in the scaled image.
10720%
10721%
10722*/
10723WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10724  const size_t columns,const size_t rows)
10725{
10726  Image
10727    *shave_image;
10728
10729  RectangleInfo
10730    shave_info;
10731
10732  assert(wand != (MagickWand *) NULL);
10733  assert(wand->signature == WandSignature);
10734  if( IfMagickTrue(wand->debug) )
10735    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10736
10737  if (wand->images == (Image *) NULL)
10738    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10739  shave_info.width=columns;
10740  shave_info.height=rows;
10741  shave_info.x=0;
10742  shave_info.y=0;
10743  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10744  if (shave_image == (Image *) NULL)
10745    return(MagickFalse);
10746  ReplaceImageInList(&wand->images,shave_image);
10747  return(MagickTrue);
10748}
10749
10750/*
10751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10752%                                                                             %
10753%                                                                             %
10754%                                                                             %
10755%   M a g i c k S h e a r I m a g e                                           %
10756%                                                                             %
10757%                                                                             %
10758%                                                                             %
10759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10760%
10761%  MagickShearImage() slides one edge of an image along the X or Y axis,
10762%  creating a parallelogram.  An X direction shear slides an edge along the X
10763%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10764%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10765%  is measured relative to the Y axis, and similarly, for Y direction shears
10766%  y_shear is measured relative to the X axis.  Empty triangles left over from
10767%  shearing the image are filled with the background color.
10768%
10769%  The format of the MagickShearImage method is:
10770%
10771%      MagickBooleanType MagickShearImage(MagickWand *wand,
10772%        const PixelWand *background,const double x_shear,const double y_shear)
10773%
10774%  A description of each parameter follows:
10775%
10776%    o wand: the magick wand.
10777%
10778%    o background: the background pixel wand.
10779%
10780%    o x_shear: the number of degrees to shear the image.
10781%
10782%    o y_shear: the number of degrees to shear the image.
10783%
10784*/
10785WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10786  const PixelWand *background,const double x_shear,const double y_shear)
10787{
10788  Image
10789    *shear_image;
10790
10791  assert(wand != (MagickWand *) NULL);
10792  assert(wand->signature == WandSignature);
10793  if( IfMagickTrue(wand->debug) )
10794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10795
10796  if (wand->images == (Image *) NULL)
10797    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10798  PixelGetQuantumPacket(background,&wand->images->background_color);
10799  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10800  if (shear_image == (Image *) NULL)
10801    return(MagickFalse);
10802  ReplaceImageInList(&wand->images,shear_image);
10803  return(MagickTrue);
10804}
10805
10806/*
10807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10808%                                                                             %
10809%                                                                             %
10810%                                                                             %
10811%   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                   %
10812%                                                                             %
10813%                                                                             %
10814%                                                                             %
10815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10816%
10817%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10818%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10819%  image using a sigmoidal transfer function without saturating highlights or
10820%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10821%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10822%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10823%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10824%  is reduced.
10825%
10826%  The format of the MagickSigmoidalContrastImage method is:
10827%
10828%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10829%        const MagickBooleanType sharpen,const double alpha,const double beta)
10830%
10831%  A description of each parameter follows:
10832%
10833%    o wand: the magick wand.
10834%
10835%    o sharpen: Increase or decrease image contrast.
10836%
10837%    o alpha: strength of the contrast, the larger the number the more
10838%      'threshold-like' it becomes.
10839%
10840%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10841%
10842*/
10843WandExport MagickBooleanType MagickSigmoidalContrastImage(
10844  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10845  const double beta)
10846{
10847  MagickBooleanType
10848    status;
10849
10850  assert(wand != (MagickWand *) NULL);
10851  assert(wand->signature == WandSignature);
10852  if( IfMagickTrue(wand->debug) )
10853    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10854
10855  if (wand->images == (Image *) NULL)
10856    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10857  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10858    wand->exception);
10859  return(status);
10860}
10861
10862/*
10863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10864%                                                                             %
10865%                                                                             %
10866%                                                                             %
10867%   M a g i c k S i m i l a r i t y I m a g e                                 %
10868%                                                                             %
10869%                                                                             %
10870%                                                                             %
10871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10872%
10873%  MagickSimilarityImage() compares the reference image of the image and
10874%  returns the best match offset.  In addition, it returns a similarity image
10875%  such that an exact match location is completely white and if none of the
10876%  pixels match, black, otherwise some gray level in-between.
10877%
10878%  The format of the MagickSimilarityImage method is:
10879%
10880%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10881%        const MagickWand *reference,const MetricType metric,
10882%        RectangeInfo *offset,double *similarity)
10883%
10884%  A description of each parameter follows:
10885%
10886%    o wand: the magick wand.
10887%
10888%    o reference: the reference wand.
10889%
10890%    o metric: the metric.
10891%
10892%    o offset: the best match offset of the reference image within the image.
10893%
10894%    o similarity: the computed similarity between the images.
10895%
10896*/
10897WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10898  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10899  double *similarity)
10900{
10901  Image
10902    *similarity_image;
10903
10904  assert(wand != (MagickWand *) NULL);
10905  assert(wand->signature == WandSignature);
10906  if( IfMagickTrue(wand->debug) )
10907    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10908
10909  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10910    {
10911      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10912        "ContainsNoImages","'%s'",wand->name);
10913      return((MagickWand *) NULL);
10914    }
10915  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10916    similarity,wand->exception);
10917  if (similarity_image == (Image *) NULL)
10918    return((MagickWand *) NULL);
10919  return(CloneMagickWandFromImages(wand,similarity_image));
10920}
10921
10922/*
10923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10924%                                                                             %
10925%                                                                             %
10926%                                                                             %
10927%   M a g i c k S k e t c h I m a g e                                         %
10928%                                                                             %
10929%                                                                             %
10930%                                                                             %
10931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10932%
10933%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10934%  a Gaussian operator of the given radius and standard deviation (sigma).
10935%  For reasonable results, radius should be larger than sigma.  Use a
10936%  radius of 0 and SketchImage() selects a suitable radius for you.
10937%  Angle gives the angle of the blurring motion.
10938%
10939%  The format of the MagickSketchImage method is:
10940%
10941%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10942%        const double radius,const double sigma,const double angle)
10943%
10944%  A description of each parameter follows:
10945%
10946%    o wand: the magick wand.
10947%
10948%    o radius: the radius of the Gaussian, in pixels, not counting
10949%      the center pixel.
10950%
10951%    o sigma: the standard deviation of the Gaussian, in pixels.
10952%
10953%    o angle: apply the effect along this angle.
10954%
10955*/
10956WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10957  const double radius,const double sigma,const double angle)
10958{
10959  Image
10960    *sketch_image;
10961
10962  assert(wand != (MagickWand *) NULL);
10963  assert(wand->signature == WandSignature);
10964  if( IfMagickTrue(wand->debug) )
10965    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10966
10967  if (wand->images == (Image *) NULL)
10968    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10969  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10970  if (sketch_image == (Image *) NULL)
10971    return(MagickFalse);
10972  ReplaceImageInList(&wand->images,sketch_image);
10973  return(MagickTrue);
10974}
10975
10976/*
10977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10978%                                                                             %
10979%                                                                             %
10980%                                                                             %
10981%   M a g i c k S m u s h I m a g e s                                         %
10982%                                                                             %
10983%                                                                             %
10984%                                                                             %
10985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10986%
10987%  MagickSmushImages() takes all images from the current image pointer to the
10988%  end of the image list and smushs them to each other top-to-bottom if the
10989%  stack parameter is true, otherwise left-to-right.
10990%
10991%  The format of the MagickSmushImages method is:
10992%
10993%      MagickWand *MagickSmushImages(MagickWand *wand,
10994%        const MagickBooleanType stack,const ssize_t offset)
10995%
10996%  A description of each parameter follows:
10997%
10998%    o wand: the magick wand.
10999%
11000%    o stack: By default, images are stacked left-to-right. Set stack to
11001%      MagickTrue to stack them top-to-bottom.
11002%
11003%    o offset: minimum distance in pixels between images.
11004%
11005*/
11006WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11007  const MagickBooleanType stack,const ssize_t offset)
11008{
11009  Image
11010    *smush_image;
11011
11012  assert(wand != (MagickWand *) NULL);
11013  assert(wand->signature == WandSignature);
11014  if( IfMagickTrue(wand->debug) )
11015    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11016
11017  if (wand->images == (Image *) NULL)
11018    return((MagickWand *) NULL);
11019  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11020  if (smush_image == (Image *) NULL)
11021    return((MagickWand *) NULL);
11022  return(CloneMagickWandFromImages(wand,smush_image));
11023}
11024
11025/*
11026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11027%                                                                             %
11028%                                                                             %
11029%                                                                             %
11030%     M a g i c k S o l a r i z e I m a g e                                   %
11031%                                                                             %
11032%                                                                             %
11033%                                                                             %
11034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11035%
11036%  MagickSolarizeImage() applies a special effect to the image, similar to the
11037%  effect achieved in a photo darkroom by selectively exposing areas of photo
11038%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11039%  measure of the extent of the solarization.
11040%
11041%  The format of the MagickSolarizeImage method is:
11042%
11043%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11044%        const double threshold)
11045%
11046%  A description of each parameter follows:
11047%
11048%    o wand: the magick wand.
11049%
11050%    o threshold:  Define the extent of the solarization.
11051%
11052*/
11053WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11054  const double threshold)
11055{
11056  MagickBooleanType
11057    status;
11058
11059  assert(wand != (MagickWand *) NULL);
11060  assert(wand->signature == WandSignature);
11061  if( IfMagickTrue(wand->debug) )
11062    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11063
11064  if (wand->images == (Image *) NULL)
11065    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11066  status=SolarizeImage(wand->images,threshold,wand->exception);
11067  return(status);
11068}
11069
11070/*
11071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11072%                                                                             %
11073%                                                                             %
11074%                                                                             %
11075%   M a g i c k S p a r s e C o l o r I m a g e                               %
11076%                                                                             %
11077%                                                                             %
11078%                                                                             %
11079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11080%
11081%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11082%  colors found at those coordinates, across the whole image, using various
11083%  methods.
11084%
11085%  The format of the MagickSparseColorImage method is:
11086%
11087%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11088%        const SparseColorMethod method,const size_t number_arguments,
11089%        const double *arguments)
11090%
11091%  A description of each parameter follows:
11092%
11093%    o image: the image to be sparseed.
11094%
11095%    o method: the method of image sparseion.
11096%
11097%        ArcSparseColorion will always ignore source image offset, and always
11098%        'bestfit' the destination image with the top left corner offset
11099%        relative to the polar mapping center.
11100%
11101%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11102%        style of image sparseion.
11103%
11104%        Affine, Perspective, and Bilinear, will do least squares fitting of
11105%        the distrotion when more than the minimum number of control point
11106%        pairs are provided.
11107%
11108%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11109%        less than 4 control point pairs are provided. While Affine sparseions
11110%        will let you use any number of control point pairs, that is Zero pairs
11111%        is a No-Op (viewport only) distrotion, one pair is a translation and
11112%        two pairs of control points will do a scale-rotate-translate, without
11113%        any shearing.
11114%
11115%    o number_arguments: the number of arguments given for this sparseion
11116%      method.
11117%
11118%    o arguments: the arguments for this sparseion method.
11119%
11120*/
11121WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11122  const SparseColorMethod method,const size_t number_arguments,
11123  const double *arguments)
11124{
11125  Image
11126    *sparse_image;
11127
11128  assert(wand != (MagickWand *) NULL);
11129  assert(wand->signature == WandSignature);
11130  if( IfMagickTrue(wand->debug) )
11131    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11132
11133  if (wand->images == (Image *) NULL)
11134    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11135  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11136    wand->exception);
11137  if (sparse_image == (Image *) NULL)
11138    return(MagickFalse);
11139  ReplaceImageInList(&wand->images,sparse_image);
11140  return(MagickTrue);
11141}
11142
11143/*
11144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11145%                                                                             %
11146%                                                                             %
11147%                                                                             %
11148%   M a g i c k S p l i c e I m a g e                                         %
11149%                                                                             %
11150%                                                                             %
11151%                                                                             %
11152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11153%
11154%  MagickSpliceImage() splices a solid color into the image.
11155%
11156%  The format of the MagickSpliceImage method is:
11157%
11158%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11159%        const size_t width,const size_t height,const ssize_t x,
11160%        const ssize_t y)
11161%
11162%  A description of each parameter follows:
11163%
11164%    o wand: the magick wand.
11165%
11166%    o width: the region width.
11167%
11168%    o height: the region height.
11169%
11170%    o x: the region x offset.
11171%
11172%    o y: the region y offset.
11173%
11174*/
11175WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11176  const size_t width,const size_t height,const ssize_t x,
11177  const ssize_t y)
11178{
11179  Image
11180    *splice_image;
11181
11182  RectangleInfo
11183    splice;
11184
11185  assert(wand != (MagickWand *) NULL);
11186  assert(wand->signature == WandSignature);
11187  if( IfMagickTrue(wand->debug) )
11188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11189
11190  if (wand->images == (Image *) NULL)
11191    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11192  splice.width=width;
11193  splice.height=height;
11194  splice.x=x;
11195  splice.y=y;
11196  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11197  if (splice_image == (Image *) NULL)
11198    return(MagickFalse);
11199  ReplaceImageInList(&wand->images,splice_image);
11200  return(MagickTrue);
11201}
11202
11203/*
11204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11205%                                                                             %
11206%                                                                             %
11207%                                                                             %
11208%   M a g i c k S p r e a d I m a g e                                         %
11209%                                                                             %
11210%                                                                             %
11211%                                                                             %
11212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11213%
11214%  MagickSpreadImage() is a special effects method that randomly displaces each
11215%  pixel in a block defined by the radius parameter.
11216%
11217%  The format of the MagickSpreadImage method is:
11218%
11219%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11220%        const PixelInterpolateMethod method)
11221%
11222%  A description of each parameter follows:
11223%
11224%    o wand: the magick wand.
11225%
11226%    o radius:  Choose a random pixel in a neighborhood of this extent.
11227%
11228%    o method: the pixel interpolation method.
11229%
11230*/
11231WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11232  const double radius,const PixelInterpolateMethod method)
11233{
11234  Image
11235    *spread_image;
11236
11237  assert(wand != (MagickWand *) NULL);
11238  assert(wand->signature == WandSignature);
11239  if( IfMagickTrue(wand->debug) )
11240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11241
11242  if (wand->images == (Image *) NULL)
11243    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11244  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11245  if (spread_image == (Image *) NULL)
11246    return(MagickFalse);
11247  ReplaceImageInList(&wand->images,spread_image);
11248  return(MagickTrue);
11249}
11250
11251/*
11252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11253%                                                                             %
11254%                                                                             %
11255%                                                                             %
11256%   M a g i c k S t a t i s t i c I m a g e                                   %
11257%                                                                             %
11258%                                                                             %
11259%                                                                             %
11260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11261%
11262%  MagickStatisticImage() replace each pixel with corresponding statistic from
11263%  the neighborhood of the specified width and height.
11264%
11265%  The format of the MagickStatisticImage method is:
11266%
11267%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11268%        const StatisticType type,const double width,const size_t height)
11269%
11270%  A description of each parameter follows:
11271%
11272%    o wand: the magick wand.
11273%
11274%    o type: the statistic type (e.g. median, mode, etc.).
11275%
11276%    o width: the width of the pixel neighborhood.
11277%
11278%    o height: the height of the pixel neighborhood.
11279%
11280*/
11281WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11282  const StatisticType type,const size_t width,const size_t height)
11283{
11284  Image
11285    *statistic_image;
11286
11287  assert(wand != (MagickWand *) NULL);
11288  assert(wand->signature == WandSignature);
11289  if( IfMagickTrue(wand->debug) )
11290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11291
11292  if (wand->images == (Image *) NULL)
11293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11294  statistic_image=StatisticImage(wand->images,type,width,height,
11295    wand->exception);
11296  if (statistic_image == (Image *) NULL)
11297    return(MagickFalse);
11298  ReplaceImageInList(&wand->images,statistic_image);
11299  return(MagickTrue);
11300}
11301
11302/*
11303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11304%                                                                             %
11305%                                                                             %
11306%                                                                             %
11307%   M a g i c k S t e g a n o I m a g e                                       %
11308%                                                                             %
11309%                                                                             %
11310%                                                                             %
11311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11312%
11313%  MagickSteganoImage() hides a digital watermark within the image.
11314%  Recover the hidden watermark later to prove that the authenticity of
11315%  an image.  Offset defines the start position within the image to hide
11316%  the watermark.
11317%
11318%  The format of the MagickSteganoImage method is:
11319%
11320%      MagickWand *MagickSteganoImage(MagickWand *wand,
11321%        const MagickWand *watermark_wand,const ssize_t offset)
11322%
11323%  A description of each parameter follows:
11324%
11325%    o wand: the magick wand.
11326%
11327%    o watermark_wand: the watermark wand.
11328%
11329%    o offset: Start hiding at this offset into the image.
11330%
11331*/
11332WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11333  const MagickWand *watermark_wand,const ssize_t offset)
11334{
11335  Image
11336    *stegano_image;
11337
11338  assert(wand != (MagickWand *) NULL);
11339  assert(wand->signature == WandSignature);
11340  if( IfMagickTrue(wand->debug) )
11341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11342
11343  if ((wand->images == (Image *) NULL) ||
11344      (watermark_wand->images == (Image *) NULL))
11345    {
11346      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11347        "ContainsNoImages","'%s'",wand->name);
11348      return((MagickWand *) NULL);
11349    }
11350  wand->images->offset=offset;
11351  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11352    wand->exception);
11353  if (stegano_image == (Image *) NULL)
11354    return((MagickWand *) NULL);
11355  return(CloneMagickWandFromImages(wand,stegano_image));
11356}
11357
11358/*
11359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11360%                                                                             %
11361%                                                                             %
11362%                                                                             %
11363%   M a g i c k S t e r e o I m a g e                                         %
11364%                                                                             %
11365%                                                                             %
11366%                                                                             %
11367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11368%
11369%  MagickStereoImage() composites two images and produces a single image that
11370%  is the composite of a left and right image of a stereo pair
11371%
11372%  The format of the MagickStereoImage method is:
11373%
11374%      MagickWand *MagickStereoImage(MagickWand *wand,
11375%        const MagickWand *offset_wand)
11376%
11377%  A description of each parameter follows:
11378%
11379%    o wand: the magick wand.
11380%
11381%    o offset_wand: Another image wand.
11382%
11383*/
11384WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11385  const MagickWand *offset_wand)
11386{
11387  Image
11388    *stereo_image;
11389
11390  assert(wand != (MagickWand *) NULL);
11391  assert(wand->signature == WandSignature);
11392  if( IfMagickTrue(wand->debug) )
11393    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11394
11395  if ((wand->images == (Image *) NULL) ||
11396      (offset_wand->images == (Image *) NULL))
11397    {
11398      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11399        "ContainsNoImages","'%s'",wand->name);
11400      return((MagickWand *) NULL);
11401    }
11402  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11403  if (stereo_image == (Image *) NULL)
11404    return((MagickWand *) NULL);
11405  return(CloneMagickWandFromImages(wand,stereo_image));
11406}
11407
11408/*
11409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11410%                                                                             %
11411%                                                                             %
11412%                                                                             %
11413%   M a g i c k S t r i p I m a g e                                           %
11414%                                                                             %
11415%                                                                             %
11416%                                                                             %
11417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11418%
11419%  MagickStripImage() strips an image of all profiles and comments.
11420%
11421%  The format of the MagickStripImage method is:
11422%
11423%      MagickBooleanType MagickStripImage(MagickWand *wand)
11424%
11425%  A description of each parameter follows:
11426%
11427%    o wand: the magick wand.
11428%
11429*/
11430WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11431{
11432  assert(wand != (MagickWand *) NULL);
11433  assert(wand->signature == WandSignature);
11434  if( IfMagickTrue(wand->debug) )
11435    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11436
11437  if (wand->images == (Image *) NULL)
11438    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11439  return(StripImage(wand->images,wand->exception));
11440}
11441
11442/*
11443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11444%                                                                             %
11445%                                                                             %
11446%                                                                             %
11447%   M a g i c k S w i r l I m a g e                                           %
11448%                                                                             %
11449%                                                                             %
11450%                                                                             %
11451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11452%
11453%  MagickSwirlImage() swirls the pixels about the center of the image, where
11454%  degrees indicates the sweep of the arc through which each pixel is moved.
11455%  You get a more dramatic effect as the degrees move from 1 to 360.
11456%
11457%  The format of the MagickSwirlImage method is:
11458%
11459%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11460%        const PixelInterpolateMethod method)
11461%
11462%  A description of each parameter follows:
11463%
11464%    o wand: the magick wand.
11465%
11466%    o degrees: Define the tightness of the swirling effect.
11467%
11468%    o method: the pixel interpolation method.
11469%
11470*/
11471WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11472  const double degrees,const PixelInterpolateMethod method)
11473{
11474  Image
11475    *swirl_image;
11476
11477  assert(wand != (MagickWand *) NULL);
11478  assert(wand->signature == WandSignature);
11479  if( IfMagickTrue(wand->debug) )
11480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11481
11482  if (wand->images == (Image *) NULL)
11483    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11484  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11485  if (swirl_image == (Image *) NULL)
11486    return(MagickFalse);
11487  ReplaceImageInList(&wand->images,swirl_image);
11488  return(MagickTrue);
11489}
11490
11491/*
11492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11493%                                                                             %
11494%                                                                             %
11495%                                                                             %
11496%   M a g i c k T e x t u r e I m a g e                                       %
11497%                                                                             %
11498%                                                                             %
11499%                                                                             %
11500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11501%
11502%  MagickTextureImage() repeatedly tiles the texture image across and down the
11503%  image canvas.
11504%
11505%  The format of the MagickTextureImage method is:
11506%
11507%      MagickWand *MagickTextureImage(MagickWand *wand,
11508%        const MagickWand *texture_wand)
11509%
11510%  A description of each parameter follows:
11511%
11512%    o wand: the magick wand.
11513%
11514%    o texture_wand: the texture wand
11515%
11516*/
11517WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11518  const MagickWand *texture_wand)
11519{
11520  Image
11521    *texture_image;
11522
11523  MagickBooleanType
11524    status;
11525
11526  assert(wand != (MagickWand *) NULL);
11527  assert(wand->signature == WandSignature);
11528  if( IfMagickTrue(wand->debug) )
11529    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11530
11531  if ((wand->images == (Image *) NULL) ||
11532      (texture_wand->images == (Image *) NULL))
11533    {
11534      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11535        "ContainsNoImages","'%s'",wand->name);
11536      return((MagickWand *) NULL);
11537    }
11538  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11539  if (texture_image == (Image *) NULL)
11540    return((MagickWand *) NULL);
11541  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11542  if( IfMagickFalse(status) )
11543    {
11544      texture_image=DestroyImage(texture_image);
11545      return((MagickWand *) NULL);
11546    }
11547  return(CloneMagickWandFromImages(wand,texture_image));
11548}
11549
11550/*
11551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11552%                                                                             %
11553%                                                                             %
11554%                                                                             %
11555%   M a g i c k T h r e s h o l d I m a g e                                   %
11556%                                                                             %
11557%                                                                             %
11558%                                                                             %
11559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11560%
11561%  MagickThresholdImage() changes the value of individual pixels based on
11562%  the intensity of each pixel compared to threshold.  The result is a
11563%  high-contrast, two color image.
11564%
11565%  The format of the MagickThresholdImage method is:
11566%
11567%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11568%        const double threshold)
11569%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11570%        const ChannelType channel,const double threshold)
11571%
11572%  A description of each parameter follows:
11573%
11574%    o wand: the magick wand.
11575%
11576%    o channel: the image channel(s).
11577%
11578%    o threshold: Define the threshold value.
11579%
11580*/
11581WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11582  const double threshold)
11583{
11584  MagickBooleanType
11585    status;
11586
11587  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11588  return(status);
11589}
11590
11591WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11592  const ChannelType channel,const double threshold)
11593{
11594  MagickBooleanType
11595    status;
11596
11597  assert(wand != (MagickWand *) NULL);
11598  assert(wand->signature == WandSignature);
11599  if( IfMagickTrue(wand->debug) )
11600    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11601
11602  if (wand->images == (Image *) NULL)
11603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11604  status=BilevelImage(wand->images,threshold,wand->exception);
11605  return(status);
11606}
11607
11608/*
11609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11610%                                                                             %
11611%                                                                             %
11612%                                                                             %
11613%   M a g i c k T h u m b n a i l I m a g e                                   %
11614%                                                                             %
11615%                                                                             %
11616%                                                                             %
11617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11618%
11619%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11620%  and removes any associated profiles.  The goal is to produce small low cost
11621%  thumbnail images suited for display on the Web.
11622%
11623%  The format of the MagickThumbnailImage method is:
11624%
11625%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11626%        const size_t columns,const size_t rows)
11627%
11628%  A description of each parameter follows:
11629%
11630%    o wand: the magick wand.
11631%
11632%    o columns: the number of columns in the scaled image.
11633%
11634%    o rows: the number of rows in the scaled image.
11635%
11636*/
11637WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11638  const size_t columns,const size_t rows)
11639{
11640  Image
11641    *thumbnail_image;
11642
11643  assert(wand != (MagickWand *) NULL);
11644  assert(wand->signature == WandSignature);
11645  if( IfMagickTrue(wand->debug) )
11646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11647
11648  if (wand->images == (Image *) NULL)
11649    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11650  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11651  if (thumbnail_image == (Image *) NULL)
11652    return(MagickFalse);
11653  ReplaceImageInList(&wand->images,thumbnail_image);
11654  return(MagickTrue);
11655}
11656
11657/*
11658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11659%                                                                             %
11660%                                                                             %
11661%                                                                             %
11662%   M a g i c k T i n t I m a g e                                             %
11663%                                                                             %
11664%                                                                             %
11665%                                                                             %
11666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11667%
11668%  MagickTintImage() applies a color vector to each pixel in the image.  The
11669%  length of the vector is 0 for black and white and at its maximum for the
11670%  midtones.  The vector weighting function is
11671%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11672%
11673%  The format of the MagickTintImage method is:
11674%
11675%      MagickBooleanType MagickTintImage(MagickWand *wand,
11676%        const PixelWand *tint,const PixelWand *blend)
11677%
11678%  A description of each parameter follows:
11679%
11680%    o wand: the magick wand.
11681%
11682%    o tint: the tint pixel wand.
11683%
11684%    o alpha: the alpha pixel wand.
11685%
11686*/
11687WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11688  const PixelWand *tint,const PixelWand *blend)
11689{
11690  char
11691    percent_blend[MaxTextExtent];
11692
11693  Image
11694    *tint_image;
11695
11696  PixelInfo
11697    target;
11698
11699  assert(wand != (MagickWand *) NULL);
11700  assert(wand->signature == WandSignature);
11701  if( IfMagickTrue(wand->debug) )
11702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11703
11704  if (wand->images == (Image *) NULL)
11705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11706  if (wand->images->colorspace != CMYKColorspace)
11707    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11708      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11709      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11710      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11711      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11712      PixelGetAlphaQuantum(blend)));
11713  else
11714    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11715      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11716      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11717      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11718      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11719      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11720      PixelGetAlphaQuantum(blend)));
11721  target=PixelGetPixel(tint);
11722  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11723  if (tint_image == (Image *) NULL)
11724    return(MagickFalse);
11725  ReplaceImageInList(&wand->images,tint_image);
11726  return(MagickTrue);
11727}
11728
11729/*
11730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11731%                                                                             %
11732%                                                                             %
11733%                                                                             %
11734%   M a g i c k T r a n s f o r m I m a g e                                   %
11735%                                                                             %
11736%                                                                             %
11737%                                                                             %
11738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11739%
11740%  MagickTransformImage() is a convenience method that behaves like
11741%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11742%  information as a region geometry specification.  If the operation fails,
11743%  a NULL image handle is returned.
11744%
11745%  The format of the MagickTransformImage method is:
11746%
11747%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11748%        const char *geometry)
11749%
11750%  A description of each parameter follows:
11751%
11752%    o wand: the magick wand.
11753%
11754%    o crop: A crop geometry string.  This geometry defines a subregion of the
11755%      image to crop.
11756%
11757%    o geometry: An image geometry string.  This geometry defines the final
11758%      size of the image.
11759%
11760*/
11761WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11762  const char *crop,const char *geometry)
11763{
11764  Image
11765    *transform_image;
11766
11767  MagickBooleanType
11768    status;
11769
11770  assert(wand != (MagickWand *) NULL);
11771  assert(wand->signature == WandSignature);
11772  if( IfMagickTrue(wand->debug) )
11773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11774
11775
11776  if (wand->images == (Image *) NULL)
11777    return((MagickWand *) NULL);
11778  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11779  if (transform_image == (Image *) NULL)
11780    return((MagickWand *) NULL);
11781  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11782  if( IfMagickFalse(status) )
11783    {
11784      transform_image=DestroyImage(transform_image);
11785      return((MagickWand *) NULL);
11786    }
11787  return(CloneMagickWandFromImages(wand,transform_image));
11788}
11789
11790/*
11791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11792%                                                                             %
11793%                                                                             %
11794%                                                                             %
11795%   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               %
11796%                                                                             %
11797%                                                                             %
11798%                                                                             %
11799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11800%
11801%  MagickTransformImageColorspace() transform the image colorspace, setting
11802%  the images colorspace while transforming the images data to that
11803%  colorspace.
11804%
11805%  The format of the MagickTransformImageColorspace method is:
11806%
11807%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11808%        const ColorspaceType colorspace)
11809%
11810%  A description of each parameter follows:
11811%
11812%    o wand: the magick wand.
11813%
11814%    o colorspace: the image colorspace:   UndefinedColorspace,
11815%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11816%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11817%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11818%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11819%      HSLColorspace, HWBColorspace.
11820%
11821*/
11822WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11823  const ColorspaceType colorspace)
11824{
11825  assert(wand != (MagickWand *) NULL);
11826  assert(wand->signature == WandSignature);
11827  if( IfMagickTrue(wand->debug) )
11828    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11829
11830
11831  if (wand->images == (Image *) NULL)
11832    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11833  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11834}
11835
11836/*
11837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11838%                                                                             %
11839%                                                                             %
11840%                                                                             %
11841%   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                     %
11842%                                                                             %
11843%                                                                             %
11844%                                                                             %
11845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11846%
11847%  MagickTransparentPaintImage() changes any pixel that matches color with the
11848%  color defined by fill.
11849%
11850%  The format of the MagickTransparentPaintImage method is:
11851%
11852%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11853%        const PixelWand *target,const double alpha,const double fuzz,
11854%        const MagickBooleanType invert)
11855%
11856%  A description of each parameter follows:
11857%
11858%    o wand: the magick wand.
11859%
11860%    o target: Change this target color to specified alpha value within
11861%      the image.
11862%
11863%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11864%      transparent.
11865%
11866%    o fuzz: By default target must match a particular pixel color
11867%      exactly.  However, in many cases two colors may differ by a small amount.
11868%      The fuzz member of image defines how much tolerance is acceptable to
11869%      consider two colors as the same.  For example, set fuzz to 10 and the
11870%      color red at intensities of 100 and 102 respectively are now interpreted
11871%      as the same color for the purposes of the floodfill.
11872%
11873%    o invert: paint any pixel that does not match the target color.
11874%
11875*/
11876WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11877  const PixelWand *target,const double alpha,const double fuzz,
11878  const MagickBooleanType invert)
11879{
11880  MagickBooleanType
11881    status;
11882
11883  PixelInfo
11884    target_pixel;
11885
11886  assert(wand != (MagickWand *) NULL);
11887  assert(wand->signature == WandSignature);
11888  if( IfMagickTrue(wand->debug) )
11889    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11890
11891
11892  if (wand->images == (Image *) NULL)
11893    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11894  PixelGetMagickColor(target,&target_pixel);
11895  wand->images->fuzz=fuzz;
11896  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11897    QuantumRange*alpha),invert,wand->exception);
11898  return(status);
11899}
11900
11901/*
11902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11903%                                                                             %
11904%                                                                             %
11905%                                                                             %
11906%   M a g i c k T r a n s p o s e I m a g e                                   %
11907%                                                                             %
11908%                                                                             %
11909%                                                                             %
11910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11911%
11912%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11913%  pixels around the central x-axis while rotating them 90-degrees.
11914%
11915%  The format of the MagickTransposeImage method is:
11916%
11917%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11918%
11919%  A description of each parameter follows:
11920%
11921%    o wand: the magick wand.
11922%
11923*/
11924WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11925{
11926  Image
11927    *transpose_image;
11928
11929  assert(wand != (MagickWand *) NULL);
11930  assert(wand->signature == WandSignature);
11931  if( IfMagickTrue(wand->debug) )
11932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11933
11934  if (wand->images == (Image *) NULL)
11935    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11936  transpose_image=TransposeImage(wand->images,wand->exception);
11937  if (transpose_image == (Image *) NULL)
11938    return(MagickFalse);
11939  ReplaceImageInList(&wand->images,transpose_image);
11940  return(MagickTrue);
11941}
11942
11943/*
11944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11945%                                                                             %
11946%                                                                             %
11947%                                                                             %
11948%   M a g i c k T r a n s v e r s e I m a g e                                 %
11949%                                                                             %
11950%                                                                             %
11951%                                                                             %
11952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11953%
11954%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11955%  pixels around the central y-axis while rotating them 270-degrees.
11956%
11957%  The format of the MagickTransverseImage method is:
11958%
11959%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11960%
11961%  A description of each parameter follows:
11962%
11963%    o wand: the magick wand.
11964%
11965*/
11966WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11967{
11968  Image
11969    *transverse_image;
11970
11971  assert(wand != (MagickWand *) NULL);
11972  assert(wand->signature == WandSignature);
11973  if( IfMagickTrue(wand->debug) )
11974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11975
11976  if (wand->images == (Image *) NULL)
11977    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11978  transverse_image=TransverseImage(wand->images,wand->exception);
11979  if (transverse_image == (Image *) NULL)
11980    return(MagickFalse);
11981  ReplaceImageInList(&wand->images,transverse_image);
11982  return(MagickTrue);
11983}
11984
11985/*
11986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11987%                                                                             %
11988%                                                                             %
11989%                                                                             %
11990%   M a g i c k T r i m I m a g e                                             %
11991%                                                                             %
11992%                                                                             %
11993%                                                                             %
11994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11995%
11996%  MagickTrimImage() remove edges that are the background color from the image.
11997%
11998%  The format of the MagickTrimImage method is:
11999%
12000%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12001%
12002%  A description of each parameter follows:
12003%
12004%    o wand: the magick wand.
12005%
12006%    o fuzz: By default target must match a particular pixel color
12007%      exactly.  However, in many cases two colors may differ by a small amount.
12008%      The fuzz member of image defines how much tolerance is acceptable to
12009%      consider two colors as the same.  For example, set fuzz to 10 and the
12010%      color red at intensities of 100 and 102 respectively are now interpreted
12011%      as the same color for the purposes of the floodfill.
12012%
12013*/
12014WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12015{
12016  Image
12017    *trim_image;
12018
12019  assert(wand != (MagickWand *) NULL);
12020  assert(wand->signature == WandSignature);
12021  if( IfMagickTrue(wand->debug) )
12022    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12023
12024  if (wand->images == (Image *) NULL)
12025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12026  wand->images->fuzz=fuzz;
12027  trim_image=TrimImage(wand->images,wand->exception);
12028  if (trim_image == (Image *) NULL)
12029    return(MagickFalse);
12030  ReplaceImageInList(&wand->images,trim_image);
12031  return(MagickTrue);
12032}
12033
12034/*
12035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12036%                                                                             %
12037%                                                                             %
12038%                                                                             %
12039%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12040%                                                                             %
12041%                                                                             %
12042%                                                                             %
12043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12044%
12045%  MagickUniqueImageColors() discards all but one of any pixel color.
12046%
12047%  The format of the MagickUniqueImageColors method is:
12048%
12049%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12050%
12051%  A description of each parameter follows:
12052%
12053%    o wand: the magick wand.
12054%
12055*/
12056WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12057{
12058  Image
12059    *unique_image;
12060
12061  assert(wand != (MagickWand *) NULL);
12062  assert(wand->signature == WandSignature);
12063  if( IfMagickTrue(wand->debug) )
12064    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12065
12066  if (wand->images == (Image *) NULL)
12067    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12068  unique_image=UniqueImageColors(wand->images,wand->exception);
12069  if (unique_image == (Image *) NULL)
12070    return(MagickFalse);
12071  ReplaceImageInList(&wand->images,unique_image);
12072  return(MagickTrue);
12073}
12074
12075/*
12076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12077%                                                                             %
12078%                                                                             %
12079%                                                                             %
12080%   M a g i c k U n s h a r p M a s k I m a g e                               %
12081%                                                                             %
12082%                                                                             %
12083%                                                                             %
12084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12085%
12086%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12087%  Gaussian operator of the given radius and standard deviation (sigma).
12088%  For reasonable results, radius should be larger than sigma.  Use a radius
12089%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12090%
12091%  The format of the MagickUnsharpMaskImage method is:
12092%
12093%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12094%        const double radius,const double sigma,const double amount,
12095%        const double threshold)
12096%
12097%  A description of each parameter follows:
12098%
12099%    o wand: the magick wand.
12100%
12101%    o radius: the radius of the Gaussian, in pixels, not counting the center
12102%      pixel.
12103%
12104%    o sigma: the standard deviation of the Gaussian, in pixels.
12105%
12106%    o amount: the percentage of the difference between the original and the
12107%      blur image that is added back into the original.
12108%
12109%    o threshold: the threshold in pixels needed to apply the diffence amount.
12110%
12111*/
12112WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12113  const double radius,const double sigma,const double amount,
12114  const double threshold)
12115{
12116  Image
12117    *unsharp_image;
12118
12119  assert(wand != (MagickWand *) NULL);
12120  assert(wand->signature == WandSignature);
12121  if( IfMagickTrue(wand->debug) )
12122    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12123
12124  if (wand->images == (Image *) NULL)
12125    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12126  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
12127    wand->exception);
12128  if (unsharp_image == (Image *) NULL)
12129    return(MagickFalse);
12130  ReplaceImageInList(&wand->images,unsharp_image);
12131  return(MagickTrue);
12132}
12133
12134/*
12135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12136%                                                                             %
12137%                                                                             %
12138%                                                                             %
12139%   M a g i c k V i g n e t t e I m a g e                                     %
12140%                                                                             %
12141%                                                                             %
12142%                                                                             %
12143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12144%
12145%  MagickVignetteImage() softens the edges of the image in vignette style.
12146%
12147%  The format of the MagickVignetteImage method is:
12148%
12149%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12150%        const double radius,const double sigma,const ssize_t x,
12151%        const ssize_t y)
12152%
12153%  A description of each parameter follows:
12154%
12155%    o wand: the magick wand.
12156%
12157%    o radius: the radius.
12158%
12159%    o sigma: the sigma.
12160%
12161%    o x, y:  Define the x and y ellipse offset.
12162%
12163*/
12164WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12165  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12166{
12167  Image
12168    *vignette_image;
12169
12170  assert(wand != (MagickWand *) NULL);
12171  assert(wand->signature == WandSignature);
12172  if( IfMagickTrue(wand->debug) )
12173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12174
12175  if (wand->images == (Image *) NULL)
12176    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12177  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12178  if (vignette_image == (Image *) NULL)
12179    return(MagickFalse);
12180  ReplaceImageInList(&wand->images,vignette_image);
12181  return(MagickTrue);
12182}
12183
12184/*
12185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12186%                                                                             %
12187%                                                                             %
12188%                                                                             %
12189%   M a g i c k W a v e I m a g e                                             %
12190%                                                                             %
12191%                                                                             %
12192%                                                                             %
12193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12194%
12195%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12196%  the pixels vertically along a sine wave whose amplitude and wavelength
12197%  is specified by the given parameters.
12198%
12199%  The format of the MagickWaveImage method is:
12200%
12201%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12202%        const double amplitude,const double wave_length,
12203%        const PixelInterpolateMethod method)
12204%
12205%  A description of each parameter follows:
12206%
12207%    o wand: the magick wand.
12208%
12209%    o amplitude, wave_length:  Define the amplitude and wave length of the
12210%      sine wave.
12211%
12212%    o method: the pixel interpolation method.
12213%
12214*/
12215WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12216  const double amplitude,const double wave_length,
12217  const PixelInterpolateMethod method)
12218{
12219  Image
12220    *wave_image;
12221
12222  assert(wand != (MagickWand *) NULL);
12223  assert(wand->signature == WandSignature);
12224  if( IfMagickTrue(wand->debug) )
12225    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12226
12227  if (wand->images == (Image *) NULL)
12228    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12229  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12230    wand->exception);
12231  if (wave_image == (Image *) NULL)
12232    return(MagickFalse);
12233  ReplaceImageInList(&wand->images,wave_image);
12234  return(MagickTrue);
12235}
12236
12237/*
12238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12239%                                                                             %
12240%                                                                             %
12241%                                                                             %
12242%   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                         %
12243%                                                                             %
12244%                                                                             %
12245%                                                                             %
12246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12247%
12248%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12249%  above the threshold into white while leaving all pixels below the threshold
12250%  unchanged.
12251%
12252%  The format of the MagickWhiteThresholdImage method is:
12253%
12254%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12255%        const PixelWand *threshold)
12256%
12257%  A description of each parameter follows:
12258%
12259%    o wand: the magick wand.
12260%
12261%    o threshold: the pixel wand.
12262%
12263*/
12264WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12265  const PixelWand *threshold)
12266{
12267  char
12268    thresholds[MaxTextExtent];
12269
12270  assert(wand != (MagickWand *) NULL);
12271  assert(wand->signature == WandSignature);
12272  if( IfMagickTrue(wand->debug) )
12273    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12274
12275  if (wand->images == (Image *) NULL)
12276    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12277  (void) FormatLocaleString(thresholds,MaxTextExtent,
12278    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12279    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12280    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12281  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12282}
12283
12284/*
12285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12286%                                                                             %
12287%                                                                             %
12288%                                                                             %
12289%   M a g i c k W r i t e I m a g e                                           %
12290%                                                                             %
12291%                                                                             %
12292%                                                                             %
12293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12294%
12295%  MagickWriteImage() writes an image to the specified filename.  If the
12296%  filename parameter is NULL, the image is written to the filename set
12297%  by MagickReadImage() or MagickSetImageFilename().
12298%
12299%  The format of the MagickWriteImage method is:
12300%
12301%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12302%        const char *filename)
12303%
12304%  A description of each parameter follows:
12305%
12306%    o wand: the magick wand.
12307%
12308%    o filename: the image filename.
12309%
12310%
12311*/
12312WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12313  const char *filename)
12314{
12315  Image
12316    *image;
12317
12318  ImageInfo
12319    *write_info;
12320
12321  MagickBooleanType
12322    status;
12323
12324  assert(wand != (MagickWand *) NULL);
12325  assert(wand->signature == WandSignature);
12326  if( IfMagickTrue(wand->debug) )
12327    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12328
12329  if (wand->images == (Image *) NULL)
12330    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12331  if (filename != (const char *) NULL)
12332    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12333  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12334  if (image == (Image *) NULL)
12335    return(MagickFalse);
12336  write_info=CloneImageInfo(wand->image_info);
12337  write_info->adjoin=MagickTrue;
12338  status=WriteImage(write_info,image,wand->exception);
12339  image=DestroyImage(image);
12340  write_info=DestroyImageInfo(write_info);
12341  return(status);
12342}
12343
12344/*
12345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12346%                                                                             %
12347%                                                                             %
12348%                                                                             %
12349%   M a g i c k W r i t e I m a g e F i l e                                   %
12350%                                                                             %
12351%                                                                             %
12352%                                                                             %
12353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12354%
12355%  MagickWriteImageFile() writes an image to an open file descriptor.
12356%
12357%  The format of the MagickWriteImageFile method is:
12358%
12359%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12360%
12361%  A description of each parameter follows:
12362%
12363%    o wand: the magick wand.
12364%
12365%    o file: the file descriptor.
12366%
12367*/
12368WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12369{
12370  Image
12371    *image;
12372
12373  ImageInfo
12374    *write_info;
12375
12376  MagickBooleanType
12377    status;
12378
12379  assert(wand != (MagickWand *) NULL);
12380  assert(wand->signature == WandSignature);
12381  assert(file != (FILE *) NULL);
12382  if( IfMagickTrue(wand->debug) )
12383    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12384
12385  if (wand->images == (Image *) NULL)
12386    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12387  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12388  if (image == (Image *) NULL)
12389    return(MagickFalse);
12390  write_info=CloneImageInfo(wand->image_info);
12391  SetImageInfoFile(write_info,file);
12392  write_info->adjoin=MagickTrue;
12393  status=WriteImage(write_info,image,wand->exception);
12394  write_info=DestroyImageInfo(write_info);
12395  image=DestroyImage(image);
12396  return(status);
12397}
12398
12399/*
12400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12401%                                                                             %
12402%                                                                             %
12403%                                                                             %
12404%   M a g i c k W r i t e I m a g e s                                         %
12405%                                                                             %
12406%                                                                             %
12407%                                                                             %
12408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12409%
12410%  MagickWriteImages() writes an image or image sequence.
12411%
12412%  The format of the MagickWriteImages method is:
12413%
12414%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12415%        const char *filename,const MagickBooleanType adjoin)
12416%
12417%  A description of each parameter follows:
12418%
12419%    o wand: the magick wand.
12420%
12421%    o filename: the image filename.
12422%
12423%    o adjoin: join images into a single multi-image file.
12424%
12425*/
12426WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12427  const char *filename,const MagickBooleanType adjoin)
12428{
12429  ImageInfo
12430    *write_info;
12431
12432  MagickBooleanType
12433    status;
12434
12435  assert(wand != (MagickWand *) NULL);
12436  assert(wand->signature == WandSignature);
12437  if( IfMagickTrue(wand->debug) )
12438    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12439
12440  if (wand->images == (Image *) NULL)
12441    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12442  write_info=CloneImageInfo(wand->image_info);
12443  write_info->adjoin=adjoin;
12444  status=WriteImages(write_info,wand->images,filename,wand->exception);
12445  write_info=DestroyImageInfo(write_info);
12446  return(status);
12447}
12448
12449/*
12450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12451%                                                                             %
12452%                                                                             %
12453%                                                                             %
12454%   M a g i c k W r i t e I m a g e s F i l e                                 %
12455%                                                                             %
12456%                                                                             %
12457%                                                                             %
12458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12459%
12460%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12461%
12462%  The format of the MagickWriteImagesFile method is:
12463%
12464%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12465%
12466%  A description of each parameter follows:
12467%
12468%    o wand: the magick wand.
12469%
12470%    o file: the file descriptor.
12471%
12472*/
12473WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12474{
12475  ImageInfo
12476    *write_info;
12477
12478  MagickBooleanType
12479    status;
12480
12481  assert(wand != (MagickWand *) NULL);
12482  assert(wand->signature == WandSignature);
12483  if( IfMagickTrue(wand->debug) )
12484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12485
12486  if (wand->images == (Image *) NULL)
12487    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12488  write_info=CloneImageInfo(wand->image_info);
12489  SetImageInfoFile(write_info,file);
12490  write_info->adjoin=MagickTrue;
12491  status=WriteImages(write_info,wand->images,(const char *) NULL,
12492    wand->exception);
12493  write_info=DestroyImageInfo(write_info);
12494  return(status);
12495}
12496