magick-image.c revision e6510f626199c1d08b91acb0aa0a2e729bb65f34
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%        const ColorspaceType colorspace)
1647%
1648%  A description of each parameter follows:
1649%
1650%    o wand: the magick wand.
1651%
1652%    o colorspace: the colorspace.
1653%
1654*/
1655WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1656  const ColorspaceType colorspace)
1657{
1658  Image
1659    *combine_image;
1660
1661  assert(wand != (MagickWand *) NULL);
1662  assert(wand->signature == WandSignature);
1663  if( IfMagickTrue(wand->debug) )
1664    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1665
1666  if (wand->images == (Image *) NULL)
1667    return((MagickWand *) NULL);
1668  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1669  if (combine_image == (Image *) NULL)
1670    return((MagickWand *) NULL);
1671  return(CloneMagickWandFromImages(wand,combine_image));
1672}
1673
1674/*
1675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1676%                                                                             %
1677%                                                                             %
1678%                                                                             %
1679%   M a g i c k C o m m e n t I m a g e                                       %
1680%                                                                             %
1681%                                                                             %
1682%                                                                             %
1683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1684%
1685%  MagickCommentImage() adds a comment to your image.
1686%
1687%  The format of the MagickCommentImage method is:
1688%
1689%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1690%        const char *comment)
1691%
1692%  A description of each parameter follows:
1693%
1694%    o wand: the magick wand.
1695%
1696%    o comment: the image comment.
1697%
1698*/
1699WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1700  const char *comment)
1701{
1702  MagickBooleanType
1703    status;
1704
1705  assert(wand != (MagickWand *) NULL);
1706  assert(wand->signature == WandSignature);
1707  if( IfMagickTrue(wand->debug) )
1708    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1709
1710  if (wand->images == (Image *) NULL)
1711    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1712  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1713  return(status);
1714}
1715
1716/*
1717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1718%                                                                             %
1719%                                                                             %
1720%                                                                             %
1721%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1722%                                                                             %
1723%                                                                             %
1724%                                                                             %
1725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1726%
1727%  MagickCompareImagesLayers() compares each image with the next in a sequence
1728%  and returns the maximum bounding region of any pixel differences it
1729%  discovers.
1730%
1731%  The format of the MagickCompareImagesLayers method is:
1732%
1733%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1734%        const ImageLayerMethod method)
1735%
1736%  A description of each parameter follows:
1737%
1738%    o wand: the magick wand.
1739%
1740%    o method: the compare method.
1741%
1742*/
1743WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1744  const ImageLayerMethod method)
1745{
1746  Image
1747    *layers_image;
1748
1749  assert(wand != (MagickWand *) NULL);
1750  assert(wand->signature == WandSignature);
1751  if( IfMagickTrue(wand->debug) )
1752    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1753
1754  if (wand->images == (Image *) NULL)
1755    return((MagickWand *) NULL);
1756  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1757  if (layers_image == (Image *) NULL)
1758    return((MagickWand *) NULL);
1759  return(CloneMagickWandFromImages(wand,layers_image));
1760}
1761
1762/*
1763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1764%                                                                             %
1765%                                                                             %
1766%                                                                             %
1767%   M a g i c k C o m p a r e I m a g e s                                     %
1768%                                                                             %
1769%                                                                             %
1770%                                                                             %
1771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1772%
1773%  MagickCompareImages() compares an image to a reconstructed image and returns
1774%  the specified difference image.
1775%
1776%  The format of the MagickCompareImages method is:
1777%
1778%      MagickWand *MagickCompareImages(MagickWand *wand,
1779%        const MagickWand *reference,const MetricType metric,
1780%        double *distortion)
1781%
1782%  A description of each parameter follows:
1783%
1784%    o wand: the magick wand.
1785%
1786%    o reference: the reference wand.
1787%
1788%    o metric: the metric.
1789%
1790%    o distortion: the computed distortion between the images.
1791%
1792*/
1793WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1794  const MagickWand *reference,const MetricType metric,double *distortion)
1795{
1796  Image
1797    *compare_image;
1798
1799
1800  assert(wand != (MagickWand *) NULL);
1801  assert(wand->signature == WandSignature);
1802  if( IfMagickTrue(wand->debug) )
1803    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1804
1805  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1806    {
1807      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1808        "ContainsNoImages","'%s'",wand->name);
1809      return((MagickWand *) NULL);
1810    }
1811  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1812    wand->exception);
1813  if (compare_image == (Image *) NULL)
1814    return((MagickWand *) NULL);
1815  return(CloneMagickWandFromImages(wand,compare_image));
1816}
1817
1818/*
1819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1820%                                                                             %
1821%                                                                             %
1822%                                                                             %
1823%   M a g i c k C o m p o s i t e I m a g e                                   %
1824%                                                                             %
1825%                                                                             %
1826%                                                                             %
1827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1828%
1829%  MagickCompositeImage() composite one image onto another at the specified
1830%  offset.
1831%
1832%  The format of the MagickCompositeImage method is:
1833%
1834%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1835%        const MagickWand *source_wand,const CompositeOperator compose,
1836%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1837%
1838%  A description of each parameter follows:
1839%
1840%    o wand: the magick wand holding the destination images
1841%
1842%    o source_image: the magick wand holding source image.
1843%
1844%    o compose: This operator affects how the composite is applied to the
1845%      image.  The default is Over.  These are some of the compose methods
1846%      availble.
1847%
1848%        OverCompositeOp       InCompositeOp         OutCompositeOp
1849%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1850%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1851%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1852%        DisplaceCompositeOp
1853%
1854%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1855%
1856%    o x: the column offset of the composited image.
1857%
1858%    o y: the row offset of the composited image.
1859%
1860*/
1861WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1862  const MagickWand *source_wand,const CompositeOperator compose,
1863  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1864{
1865  MagickBooleanType
1866    status;
1867
1868  assert(wand != (MagickWand *) NULL);
1869  assert(wand->signature == WandSignature);
1870  if( IfMagickTrue(wand->debug) )
1871    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1872
1873  if ((wand->images == (Image *) NULL) ||
1874      (source_wand->images == (Image *) NULL))
1875    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1876  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1877    x,y,wand->exception);
1878  return(status);
1879}
1880
1881/*
1882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1883%                                                                             %
1884%                                                                             %
1885%                                                                             %
1886%   M a g i c k C o m p o s i t e L a y e r s                                 %
1887%                                                                             %
1888%                                                                             %
1889%                                                                             %
1890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1891%
1892%  MagickCompositeLayers() composite the images in the source wand over the
1893%  images in the destination wand in sequence, starting with the current
1894%  image in both lists.
1895%
1896%  Each layer from the two image lists are composted together until the end of
1897%  one of the image lists is reached.  The offset of each composition is also
1898%  adjusted to match the virtual canvas offsets of each layer. As such the
1899%  given offset is relative to the virtual canvas, and not the actual image.
1900%
1901%  Composition uses given x and y offsets, as the 'origin' location of the
1902%  source images virtual canvas (not the real image) allowing you to compose a
1903%  list of 'layer images' into the destiantioni images.  This makes it well
1904%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1905%  Animations' onto a static or other 'Coaleased Animation' destination image
1906%  list.  GIF disposal handling is not looked at.
1907%
1908%  Special case:- If one of the image sequences is the last image (just a
1909%  single image remaining), that image is repeatally composed with all the
1910%  images in the other image list.  Either the source or destination lists may
1911%  be the single image, for this situation.
1912%
1913%  In the case of a single destination image (or last image given), that image
1914%  will ve cloned to match the number of images remaining in the source image
1915%  list.
1916%
1917%  This is equivelent to the "-layer Composite" Shell API operator.
1918%
1919%  The format of the MagickCompositeLayers method is:
1920%
1921%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1922%        const MagickWand *source_wand, const CompositeOperator compose,
1923%        const ssize_t x,const ssize_t y)
1924%
1925%  A description of each parameter follows:
1926%
1927%    o wand: the magick wand holding destaintion images
1928%
1929%    o source_wand: the wand holding the source images
1930%
1931%    o compose, x, y:  composition arguments
1932%
1933*/
1934WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1935  const MagickWand *source_wand,const CompositeOperator compose,
1936  const ssize_t x,const ssize_t y)
1937{
1938  MagickBooleanType
1939    status;
1940
1941  assert(wand != (MagickWand *) NULL);
1942  assert(wand->signature == WandSignature);
1943  if( IfMagickTrue(wand->debug) )
1944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1945
1946  if ((wand->images == (Image *) NULL) ||
1947      (source_wand->images == (Image *) NULL))
1948    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1949  CompositeLayers(wand->images,compose,source_wand->images,x,y,
1950        wand->exception);
1951  status=MagickTrue;  /* FUTURE: determine status from exceptions */
1952  return(status);
1953}
1954
1955/*
1956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1957%                                                                             %
1958%                                                                             %
1959%                                                                             %
1960%   M a g i c k C o n t r a s t I m a g e                                     %
1961%                                                                             %
1962%                                                                             %
1963%                                                                             %
1964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1965%
1966%  MagickContrastImage() enhances the intensity differences between the lighter
1967%  and darker elements of the image.  Set sharpen to a value other than 0 to
1968%  increase the image contrast otherwise the contrast is reduced.
1969%
1970%  The format of the MagickContrastImage method is:
1971%
1972%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1973%        const MagickBooleanType sharpen)
1974%
1975%  A description of each parameter follows:
1976%
1977%    o wand: the magick wand.
1978%
1979%    o sharpen: Increase or decrease image contrast.
1980%
1981%
1982*/
1983WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1984  const MagickBooleanType sharpen)
1985{
1986  MagickBooleanType
1987    status;
1988
1989  assert(wand != (MagickWand *) NULL);
1990  assert(wand->signature == WandSignature);
1991  if( IfMagickTrue(wand->debug) )
1992    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1993
1994  if (wand->images == (Image *) NULL)
1995    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1996  status=ContrastImage(wand->images,sharpen,wand->exception);
1997  return(status);
1998}
1999
2000/*
2001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2002%                                                                             %
2003%                                                                             %
2004%                                                                             %
2005%   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                       %
2006%                                                                             %
2007%                                                                             %
2008%                                                                             %
2009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010%
2011%  MagickContrastStretchImage() enhances the contrast of a color image by
2012%  adjusting the pixels color to span the entire range of colors available.
2013%  You can also reduce the influence of a particular channel with a gamma
2014%  value of 0.
2015%
2016%  The format of the MagickContrastStretchImage method is:
2017%
2018%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2019%        const double black_point,const double white_point)
2020%
2021%  A description of each parameter follows:
2022%
2023%    o wand: the magick wand.
2024%
2025%    o black_point: the black point.
2026%
2027%    o white_point: the white point.
2028%
2029*/
2030WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2031  const double black_point,const double white_point)
2032{
2033  MagickBooleanType
2034    status;
2035
2036  assert(wand != (MagickWand *) NULL);
2037  assert(wand->signature == WandSignature);
2038  if( IfMagickTrue(wand->debug) )
2039    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2040
2041  if (wand->images == (Image *) NULL)
2042    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2043  status=ContrastStretchImage(wand->images,black_point,white_point,
2044    wand->exception);
2045  return(status);
2046}
2047
2048/*
2049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2050%                                                                             %
2051%                                                                             %
2052%                                                                             %
2053%   M a g i c k C o n v o l v e I m a g e                                     %
2054%                                                                             %
2055%                                                                             %
2056%                                                                             %
2057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2058%
2059%  MagickConvolveImage() applies a custom convolution kernel to the image.
2060%
2061%  The format of the MagickConvolveImage method is:
2062%
2063%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2064%        const KernelInfo *kernel)
2065%
2066%  A description of each parameter follows:
2067%
2068%    o wand: the magick wand.
2069%
2070%    o kernel: An array of doubles representing the convolution kernel.
2071%
2072*/
2073WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2074  const KernelInfo *kernel)
2075{
2076  Image
2077    *filter_image;
2078
2079  assert(wand != (MagickWand *) NULL);
2080  assert(wand->signature == WandSignature);
2081  if( IfMagickTrue(wand->debug) )
2082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2083
2084  if (kernel == (const KernelInfo *) NULL)
2085    return(MagickFalse);
2086  if (wand->images == (Image *) NULL)
2087    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2088  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2089  if (filter_image == (Image *) NULL)
2090    return(MagickFalse);
2091  ReplaceImageInList(&wand->images,filter_image);
2092  return(MagickTrue);
2093}
2094
2095/*
2096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2097%                                                                             %
2098%                                                                             %
2099%                                                                             %
2100%   M a g i c k C r o p I m a g e                                             %
2101%                                                                             %
2102%                                                                             %
2103%                                                                             %
2104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2105%
2106%  MagickCropImage() extracts a region of the image.
2107%
2108%  The format of the MagickCropImage method is:
2109%
2110%      MagickBooleanType MagickCropImage(MagickWand *wand,
2111%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2112%
2113%  A description of each parameter follows:
2114%
2115%    o wand: the magick wand.
2116%
2117%    o width: the region width.
2118%
2119%    o height: the region height.
2120%
2121%    o x: the region x-offset.
2122%
2123%    o y: the region y-offset.
2124%
2125*/
2126WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2127  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2128{
2129  Image
2130    *crop_image;
2131
2132  RectangleInfo
2133    crop;
2134
2135  assert(wand != (MagickWand *) NULL);
2136  assert(wand->signature == WandSignature);
2137  if( IfMagickTrue(wand->debug) )
2138    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2139
2140  if (wand->images == (Image *) NULL)
2141    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2142  crop.width=width;
2143  crop.height=height;
2144  crop.x=x;
2145  crop.y=y;
2146  crop_image=CropImage(wand->images,&crop,wand->exception);
2147  if (crop_image == (Image *) NULL)
2148    return(MagickFalse);
2149  ReplaceImageInList(&wand->images,crop_image);
2150  return(MagickTrue);
2151}
2152
2153/*
2154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2155%                                                                             %
2156%                                                                             %
2157%                                                                             %
2158%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2159%                                                                             %
2160%                                                                             %
2161%                                                                             %
2162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2163%
2164%  MagickCycleColormapImage() displaces an image's colormap by a given number
2165%  of positions.  If you cycle the colormap a number of times you can produce
2166%  a psychodelic effect.
2167%
2168%  The format of the MagickCycleColormapImage method is:
2169%
2170%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2171%        const ssize_t displace)
2172%
2173%  A description of each parameter follows:
2174%
2175%    o wand: the magick wand.
2176%
2177%    o pixel_wand: the pixel wand.
2178%
2179*/
2180WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2181  const ssize_t displace)
2182{
2183  MagickBooleanType
2184    status;
2185
2186  assert(wand != (MagickWand *) NULL);
2187  assert(wand->signature == WandSignature);
2188  if( IfMagickTrue(wand->debug) )
2189    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2190
2191  if (wand->images == (Image *) NULL)
2192    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2193  status=CycleColormapImage(wand->images,displace,wand->exception);
2194  return(status);
2195}
2196
2197/*
2198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199%                                                                             %
2200%                                                                             %
2201%                                                                             %
2202%   M a g i c k C o n s t i t u t e I m a g e                                 %
2203%                                                                             %
2204%                                                                             %
2205%                                                                             %
2206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2207%
2208%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2209%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2210%  The data can be char, short int, int, float, or double.  Float and double
2211%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2212%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2213%  example, to create a 640x480 image from unsigned red-green-blue character
2214%  data, use
2215%
2216%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2217%
2218%  The format of the MagickConstituteImage method is:
2219%
2220%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2221%        const size_t columns,const size_t rows,const char *map,
2222%        const StorageType storage,void *pixels)
2223%
2224%  A description of each parameter follows:
2225%
2226%    o wand: the magick wand.
2227%
2228%    o columns: width in pixels of the image.
2229%
2230%    o rows: height in pixels of the image.
2231%
2232%    o map:  This string reflects the expected ordering of the pixel array.
2233%      It can be any combination or order of R = red, G = green, B = blue,
2234%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2235%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2236%      P = pad.
2237%
2238%    o storage: Define the data type of the pixels.  Float and double types are
2239%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2240%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2241%      LongPixel, QuantumPixel, or ShortPixel.
2242%
2243%    o pixels: This array of values contain the pixel components as defined by
2244%      map and type.  You must preallocate this array where the expected
2245%      length varies depending on the values of width, height, map, and type.
2246%
2247%
2248*/
2249WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2250  const size_t columns,const size_t rows,const char *map,
2251  const StorageType storage,const void *pixels)
2252{
2253  Image
2254    *images;
2255
2256  assert(wand != (MagickWand *) NULL);
2257  assert(wand->signature == WandSignature);
2258  if( IfMagickTrue(wand->debug) )
2259    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2260
2261  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2262  if (images == (Image *) NULL)
2263    return(MagickFalse);
2264  return(InsertImageInWand(wand,images));
2265}
2266
2267/*
2268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269%                                                                             %
2270%                                                                             %
2271%                                                                             %
2272%   M a g i c k D e c i p h e r I m a g e                                     %
2273%                                                                             %
2274%                                                                             %
2275%                                                                             %
2276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277%
2278%  MagickDecipherImage() converts cipher pixels to plain pixels.
2279%
2280%  The format of the MagickDecipherImage method is:
2281%
2282%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2283%        const char *passphrase)
2284%
2285%  A description of each parameter follows:
2286%
2287%    o wand: the magick wand.
2288%
2289%    o passphrase: the passphrase.
2290%
2291*/
2292WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2293  const char *passphrase)
2294{
2295  assert(wand != (MagickWand *) NULL);
2296  assert(wand->signature == WandSignature);
2297  if( IfMagickTrue(wand->debug) )
2298    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2299
2300  if (wand->images == (Image *) NULL)
2301    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2302  return(DecipherImage(wand->images,passphrase,wand->exception));
2303}
2304
2305/*
2306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2307%                                                                             %
2308%                                                                             %
2309%                                                                             %
2310%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2311%                                                                             %
2312%                                                                             %
2313%                                                                             %
2314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2315%
2316%  MagickDeconstructImages() compares each image with the next in a sequence
2317%  and returns the maximum bounding region of any pixel differences it
2318%  discovers.
2319%
2320%  The format of the MagickDeconstructImages method is:
2321%
2322%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2323%
2324%  A description of each parameter follows:
2325%
2326%    o wand: the magick wand.
2327%
2328*/
2329WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2330{
2331  Image
2332    *deconstruct_image;
2333
2334  assert(wand != (MagickWand *) NULL);
2335  assert(wand->signature == WandSignature);
2336  if( IfMagickTrue(wand->debug) )
2337    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2338
2339  if (wand->images == (Image *) NULL)
2340    return((MagickWand *) NULL);
2341  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2342    wand->exception);
2343  if (deconstruct_image == (Image *) NULL)
2344    return((MagickWand *) NULL);
2345  return(CloneMagickWandFromImages(wand,deconstruct_image));
2346}
2347
2348/*
2349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2350%                                                                             %
2351%                                                                             %
2352%                                                                             %
2353%     M a g i c k D e s k e w I m a g e                                       %
2354%                                                                             %
2355%                                                                             %
2356%                                                                             %
2357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2358%
2359%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2360%  occurs in scanned images because of the camera being misaligned,
2361%  imperfections in the scanning or surface, or simply because the paper was
2362%  not placed completely flat when scanned.
2363%
2364%  The format of the MagickDeskewImage method is:
2365%
2366%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2367%        const double threshold)
2368%
2369%  A description of each parameter follows:
2370%
2371%    o wand: the magick wand.
2372%
2373%    o threshold: separate background from foreground.
2374%
2375*/
2376WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2377  const double threshold)
2378{
2379  Image
2380    *sepia_image;
2381
2382  assert(wand != (MagickWand *) NULL);
2383  assert(wand->signature == WandSignature);
2384  if( IfMagickTrue(wand->debug) )
2385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2386
2387  if (wand->images == (Image *) NULL)
2388    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2389  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2390  if (sepia_image == (Image *) NULL)
2391    return(MagickFalse);
2392  ReplaceImageInList(&wand->images,sepia_image);
2393  return(MagickTrue);
2394}
2395
2396/*
2397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2398%                                                                             %
2399%                                                                             %
2400%                                                                             %
2401%     M a g i c k D e s p e c k l e I m a g e                                 %
2402%                                                                             %
2403%                                                                             %
2404%                                                                             %
2405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2406%
2407%  MagickDespeckleImage() reduces the speckle noise in an image while
2408%  perserving the edges of the original image.
2409%
2410%  The format of the MagickDespeckleImage method is:
2411%
2412%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2413%
2414%  A description of each parameter follows:
2415%
2416%    o wand: the magick wand.
2417%
2418*/
2419WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2420{
2421  Image
2422    *despeckle_image;
2423
2424  assert(wand != (MagickWand *) NULL);
2425  assert(wand->signature == WandSignature);
2426  if( IfMagickTrue(wand->debug) )
2427    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2428
2429  if (wand->images == (Image *) NULL)
2430    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2431  despeckle_image=DespeckleImage(wand->images,wand->exception);
2432  if (despeckle_image == (Image *) NULL)
2433    return(MagickFalse);
2434  ReplaceImageInList(&wand->images,despeckle_image);
2435  return(MagickTrue);
2436}
2437
2438/*
2439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2440%                                                                             %
2441%                                                                             %
2442%                                                                             %
2443%   M a g i c k D e s t r o y I m a g e                                       %
2444%                                                                             %
2445%                                                                             %
2446%                                                                             %
2447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2448%
2449%  MagickDestroyImage() dereferences an image, deallocating memory associated
2450%  with the image if the reference count becomes zero.
2451%
2452%  The format of the MagickDestroyImage method is:
2453%
2454%      Image *MagickDestroyImage(Image *image)
2455%
2456%  A description of each parameter follows:
2457%
2458%    o image: the image.
2459%
2460*/
2461WandExport Image *MagickDestroyImage(Image *image)
2462{
2463  return(DestroyImage(image));
2464}
2465
2466/*
2467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2468%                                                                             %
2469%                                                                             %
2470%                                                                             %
2471%   M a g i c k D i s p l a y I m a g e                                       %
2472%                                                                             %
2473%                                                                             %
2474%                                                                             %
2475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2476%
2477%  MagickDisplayImage() displays an image.
2478%
2479%  The format of the MagickDisplayImage method is:
2480%
2481%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2482%        const char *server_name)
2483%
2484%  A description of each parameter follows:
2485%
2486%    o wand: the magick wand.
2487%
2488%    o server_name: the X server name.
2489%
2490*/
2491WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2492  const char *server_name)
2493{
2494  Image
2495    *image;
2496
2497  MagickBooleanType
2498    status;
2499
2500  assert(wand != (MagickWand *) NULL);
2501  assert(wand->signature == WandSignature);
2502  if( IfMagickTrue(wand->debug) )
2503    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2504
2505  if (wand->images == (Image *) NULL)
2506    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2507  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2508  if (image == (Image *) NULL)
2509    return(MagickFalse);
2510  (void) CloneString(&wand->image_info->server_name,server_name);
2511  status=DisplayImages(wand->image_info,image,wand->exception);
2512  image=DestroyImage(image);
2513  return(status);
2514}
2515
2516/*
2517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2518%                                                                             %
2519%                                                                             %
2520%                                                                             %
2521%   M a g i c k D i s p l a y I m a g e s                                     %
2522%                                                                             %
2523%                                                                             %
2524%                                                                             %
2525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2526%
2527%  MagickDisplayImages() displays an image or image sequence.
2528%
2529%  The format of the MagickDisplayImages method is:
2530%
2531%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2532%        const char *server_name)
2533%
2534%  A description of each parameter follows:
2535%
2536%    o wand: the magick wand.
2537%
2538%    o server_name: the X server name.
2539%
2540*/
2541WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2542  const char *server_name)
2543{
2544  MagickBooleanType
2545    status;
2546
2547  assert(wand != (MagickWand *) NULL);
2548  assert(wand->signature == WandSignature);
2549  if( IfMagickTrue(wand->debug) )
2550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2551
2552  (void) CloneString(&wand->image_info->server_name,server_name);
2553  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2554  return(status);
2555}
2556
2557/*
2558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2559%                                                                             %
2560%                                                                             %
2561%                                                                             %
2562%   M a g i c k D i s t o r t I m a g e                                       %
2563%                                                                             %
2564%                                                                             %
2565%                                                                             %
2566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2567%
2568%  MagickDistortImage() distorts an image using various distortion methods, by
2569%  mapping color lookups of the source image to a new destination image
2570%  usally of the same size as the source image, unless 'bestfit' is set to
2571%  true.
2572%
2573%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2574%  adjusted to ensure the whole source 'image' will just fit within the final
2575%  destination image, which will be sized and offset accordingly.  Also in
2576%  many cases the virtual offset of the source image will be taken into
2577%  account in the mapping.
2578%
2579%  The format of the MagickDistortImage method is:
2580%
2581%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2582%        const DistortImageMethod method,const size_t number_arguments,
2583%        const double *arguments,const MagickBooleanType bestfit)
2584%
2585%  A description of each parameter follows:
2586%
2587%    o image: the image to be distorted.
2588%
2589%    o method: the method of image distortion.
2590%
2591%        ArcDistortion always ignores the source image offset, and always
2592%        'bestfit' the destination image with the top left corner offset
2593%        relative to the polar mapping center.
2594%
2595%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2596%        style of image distortion.
2597%
2598%        Affine, Perspective, and Bilinear, do least squares fitting of the
2599%        distortion when more than the minimum number of control point pairs
2600%        are provided.
2601%
2602%        Perspective, and Bilinear, falls back to a Affine distortion when less
2603%        that 4 control point pairs are provided. While Affine distortions let
2604%        you use any number of control point pairs, that is Zero pairs is a
2605%        no-Op (viewport only) distrotion, one pair is a translation and two
2606%        pairs of control points do a scale-rotate-translate, without any
2607%        shearing.
2608%
2609%    o number_arguments: the number of arguments given for this distortion
2610%      method.
2611%
2612%    o arguments: the arguments for this distortion method.
2613%
2614%    o bestfit: Attempt to resize destination to fit distorted source.
2615%
2616*/
2617WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2618  const DistortImageMethod method,const size_t number_arguments,
2619  const double *arguments,const MagickBooleanType bestfit)
2620{
2621  Image
2622    *distort_image;
2623
2624  assert(wand != (MagickWand *) NULL);
2625  assert(wand->signature == WandSignature);
2626  if( IfMagickTrue(wand->debug) )
2627    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2628
2629  if (wand->images == (Image *) NULL)
2630    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2631  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2632    bestfit,wand->exception);
2633  if (distort_image == (Image *) NULL)
2634    return(MagickFalse);
2635  ReplaceImageInList(&wand->images,distort_image);
2636  return(MagickTrue);
2637}
2638
2639/*
2640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2641%                                                                             %
2642%                                                                             %
2643%                                                                             %
2644%   M a g i c k D r a w I m a g e                                             %
2645%                                                                             %
2646%                                                                             %
2647%                                                                             %
2648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2649%
2650%  MagickDrawImage() renders the drawing wand on the current image.
2651%
2652%  The format of the MagickDrawImage method is:
2653%
2654%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2655%        const DrawingWand *drawing_wand)
2656%
2657%  A description of each parameter follows:
2658%
2659%    o wand: the magick wand.
2660%
2661%    o drawing_wand: the draw wand.
2662%
2663*/
2664WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2665  const DrawingWand *drawing_wand)
2666{
2667  char
2668    *primitive;
2669
2670  DrawInfo
2671    *draw_info;
2672
2673  MagickBooleanType
2674    status;
2675
2676  assert(wand != (MagickWand *) NULL);
2677  assert(wand->signature == WandSignature);
2678  if( IfMagickTrue(wand->debug) )
2679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2680
2681  if (wand->images == (Image *) NULL)
2682    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2683  draw_info=PeekDrawingWand(drawing_wand);
2684  if ((draw_info == (DrawInfo *) NULL) ||
2685      (draw_info->primitive == (char *) NULL))
2686    return(MagickFalse);
2687  primitive=AcquireString(draw_info->primitive);
2688  draw_info=DestroyDrawInfo(draw_info);
2689  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2690  draw_info->primitive=primitive;
2691  status=DrawImage(wand->images,draw_info,wand->exception);
2692  draw_info=DestroyDrawInfo(draw_info);
2693  return(status);
2694}
2695
2696/*
2697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2698%                                                                             %
2699%                                                                             %
2700%                                                                             %
2701%   M a g i c k E d g e I m a g e                                             %
2702%                                                                             %
2703%                                                                             %
2704%                                                                             %
2705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2706%
2707%  MagickEdgeImage() enhance edges within the image with a convolution filter
2708%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2709%  radius for you.
2710%
2711%  The format of the MagickEdgeImage method is:
2712%
2713%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2714%        const double sigma)
2715%
2716%  A description of each parameter follows:
2717%
2718%    o wand: the magick wand.
2719%
2720%    o radius: the radius of the pixel neighborhood.
2721%
2722%    o sigma: the standard deviation of the Gaussian, in pixels.
2723%
2724*/
2725WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2726  const double radius,const double sigma)
2727{
2728  Image
2729    *edge_image;
2730
2731  assert(wand != (MagickWand *) NULL);
2732  assert(wand->signature == WandSignature);
2733  if( IfMagickTrue(wand->debug) )
2734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2735
2736  if (wand->images == (Image *) NULL)
2737    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2738  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2739  if (edge_image == (Image *) NULL)
2740    return(MagickFalse);
2741  ReplaceImageInList(&wand->images,edge_image);
2742  return(MagickTrue);
2743}
2744
2745/*
2746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2747%                                                                             %
2748%                                                                             %
2749%                                                                             %
2750%   M a g i c k E m b o s s I m a g e                                         %
2751%                                                                             %
2752%                                                                             %
2753%                                                                             %
2754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2755%
2756%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2757%  effect.  We convolve the image with a Gaussian operator of the given radius
2758%  and standard deviation (sigma).  For reasonable results, radius should be
2759%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2760%  radius for you.
2761%
2762%  The format of the MagickEmbossImage method is:
2763%
2764%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2765%        const double sigma)
2766%
2767%  A description of each parameter follows:
2768%
2769%    o wand: the magick wand.
2770%
2771%    o radius: the radius of the Gaussian, in pixels, not counting the center
2772%      pixel.
2773%
2774%    o sigma: the standard deviation of the Gaussian, in pixels.
2775%
2776*/
2777WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2778  const double radius,const double sigma)
2779{
2780  Image
2781    *emboss_image;
2782
2783  assert(wand != (MagickWand *) NULL);
2784  assert(wand->signature == WandSignature);
2785  if( IfMagickTrue(wand->debug) )
2786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2787
2788  if (wand->images == (Image *) NULL)
2789    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2790  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2791  if (emboss_image == (Image *) NULL)
2792    return(MagickFalse);
2793  ReplaceImageInList(&wand->images,emboss_image);
2794  return(MagickTrue);
2795}
2796
2797/*
2798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2799%                                                                             %
2800%                                                                             %
2801%                                                                             %
2802%   M a g i c k E n c i p h e r I m a g e                                     %
2803%                                                                             %
2804%                                                                             %
2805%                                                                             %
2806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2807%
2808%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2809%
2810%  The format of the MagickEncipherImage method is:
2811%
2812%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2813%        const char *passphrase)
2814%
2815%  A description of each parameter follows:
2816%
2817%    o wand: the magick wand.
2818%
2819%    o passphrase: the passphrase.
2820%
2821*/
2822WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2823  const char *passphrase)
2824{
2825  assert(wand != (MagickWand *) NULL);
2826  assert(wand->signature == WandSignature);
2827  if( IfMagickTrue(wand->debug) )
2828    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2829
2830  if (wand->images == (Image *) NULL)
2831    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2832  return(EncipherImage(wand->images,passphrase,wand->exception));
2833}
2834
2835/*
2836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2837%                                                                             %
2838%                                                                             %
2839%                                                                             %
2840%   M a g i c k E n h a n c e I m a g e                                       %
2841%                                                                             %
2842%                                                                             %
2843%                                                                             %
2844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2845%
2846%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2847%  noisy image.
2848%
2849%  The format of the MagickEnhanceImage method is:
2850%
2851%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2852%
2853%  A description of each parameter follows:
2854%
2855%    o wand: the magick wand.
2856%
2857*/
2858WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2859{
2860  Image
2861    *enhance_image;
2862
2863  assert(wand != (MagickWand *) NULL);
2864  assert(wand->signature == WandSignature);
2865  if( IfMagickTrue(wand->debug) )
2866    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2867
2868  if (wand->images == (Image *) NULL)
2869    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2870  enhance_image=EnhanceImage(wand->images,wand->exception);
2871  if (enhance_image == (Image *) NULL)
2872    return(MagickFalse);
2873  ReplaceImageInList(&wand->images,enhance_image);
2874  return(MagickTrue);
2875}
2876
2877/*
2878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2879%                                                                             %
2880%                                                                             %
2881%                                                                             %
2882%   M a g i c k E q u a l i z e I m a g e                                     %
2883%                                                                             %
2884%                                                                             %
2885%                                                                             %
2886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2887%
2888%  MagickEqualizeImage() equalizes the image histogram.
2889%
2890%  The format of the MagickEqualizeImage method is:
2891%
2892%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2893%
2894%  A description of each parameter follows:
2895%
2896%    o wand: the magick wand.
2897%
2898%    o channel: the image channel(s).
2899%
2900*/
2901WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2902{
2903  MagickBooleanType
2904    status;
2905
2906  assert(wand != (MagickWand *) NULL);
2907  assert(wand->signature == WandSignature);
2908  if( IfMagickTrue(wand->debug) )
2909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2910
2911  if (wand->images == (Image *) NULL)
2912    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2913  status=EqualizeImage(wand->images,wand->exception);
2914  return(status);
2915}
2916
2917/*
2918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2919%                                                                             %
2920%                                                                             %
2921%                                                                             %
2922%   M a g i c k E v a l u a t e I m a g e                                     %
2923%                                                                             %
2924%                                                                             %
2925%                                                                             %
2926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2927%
2928%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2929%  expression to an image.  Use these operators to lighten or darken an image,
2930%  to increase or decrease contrast in an image, or to produce the "negative"
2931%  of an image.
2932%
2933%  The format of the MagickEvaluateImage method is:
2934%
2935%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2936%        const MagickEvaluateOperator operator,const double value)
2937%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2938%        const MagickEvaluateOperator operator)
2939%
2940%  A description of each parameter follows:
2941%
2942%    o wand: the magick wand.
2943%
2944%    o op: A channel operator.
2945%
2946%    o value: A value value.
2947%
2948*/
2949
2950WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2951  const MagickEvaluateOperator op)
2952{
2953  Image
2954    *evaluate_image;
2955
2956  assert(wand != (MagickWand *) NULL);
2957  assert(wand->signature == WandSignature);
2958  if( IfMagickTrue(wand->debug) )
2959    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2960
2961  if (wand->images == (Image *) NULL)
2962    return((MagickWand *) NULL);
2963  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2964  if (evaluate_image == (Image *) NULL)
2965    return((MagickWand *) NULL);
2966  return(CloneMagickWandFromImages(wand,evaluate_image));
2967}
2968
2969WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2970  const MagickEvaluateOperator op,const double value)
2971{
2972  MagickBooleanType
2973    status;
2974
2975  assert(wand != (MagickWand *) NULL);
2976  assert(wand->signature == WandSignature);
2977  if( IfMagickTrue(wand->debug) )
2978    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2979
2980  if (wand->images == (Image *) NULL)
2981    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2982  status=EvaluateImage(wand->images,op,value,wand->exception);
2983  return(status);
2984}
2985
2986/*
2987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2988%                                                                             %
2989%                                                                             %
2990%                                                                             %
2991%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2992%                                                                             %
2993%                                                                             %
2994%                                                                             %
2995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2996%
2997%  MagickExportImagePixels() extracts pixel data from an image and returns it
2998%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2999%  an error is encountered.  The data is returned as char, short int, int,
3000%  ssize_t, float, or double in the order specified by map.
3001%
3002%  Suppose you want to extract the first scanline of a 640x480 image as
3003%  character data in red-green-blue order:
3004%
3005%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3006%
3007%  The format of the MagickExportImagePixels method is:
3008%
3009%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3010%        const ssize_t x,const ssize_t y,const size_t columns,
3011%        const size_t rows,const char *map,const StorageType storage,
3012%        void *pixels)
3013%
3014%  A description of each parameter follows:
3015%
3016%    o wand: the magick wand.
3017%
3018%    o x, y, columns, rows:  These values define the perimeter
3019%      of a region of pixels you want to extract.
3020%
3021%    o map:  This string reflects the expected ordering of the pixel array.
3022%      It can be any combination or order of R = red, G = green, B = blue,
3023%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3024%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3025%      P = pad.
3026%
3027%    o storage: Define the data type of the pixels.  Float and double types are
3028%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3029%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3030%      LongPixel, QuantumPixel, or ShortPixel.
3031%
3032%    o pixels: This array of values contain the pixel components as defined by
3033%      map and type.  You must preallocate this array where the expected
3034%      length varies depending on the values of width, height, map, and type.
3035%
3036*/
3037WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3038  const ssize_t x,const ssize_t y,const size_t columns,
3039  const size_t rows,const char *map,const StorageType storage,
3040  void *pixels)
3041{
3042  MagickBooleanType
3043    status;
3044
3045  assert(wand != (MagickWand *) NULL);
3046  assert(wand->signature == WandSignature);
3047  if( IfMagickTrue(wand->debug) )
3048    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3049
3050  if (wand->images == (Image *) NULL)
3051    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3052  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3053    storage,pixels,wand->exception);
3054  return(status);
3055}
3056
3057/*
3058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3059%                                                                             %
3060%                                                                             %
3061%                                                                             %
3062%   M a g i c k E x t e n t I m a g e                                         %
3063%                                                                             %
3064%                                                                             %
3065%                                                                             %
3066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3067%
3068%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3069%  and wand background color.  Set the (x,y) offset of the geometry to move
3070%  the original wand relative to the extended wand.
3071%
3072%  The format of the MagickExtentImage method is:
3073%
3074%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3075%        const size_t height,const ssize_t x,const ssize_t y)
3076%
3077%  A description of each parameter follows:
3078%
3079%    o wand: the magick wand.
3080%
3081%    o width: the region width.
3082%
3083%    o height: the region height.
3084%
3085%    o x: the region x offset.
3086%
3087%    o y: the region y offset.
3088%
3089*/
3090WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3091  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3092{
3093  Image
3094    *extent_image;
3095
3096  RectangleInfo
3097    extent;
3098
3099  assert(wand != (MagickWand *) NULL);
3100  assert(wand->signature == WandSignature);
3101  if( IfMagickTrue(wand->debug) )
3102    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3103
3104  if (wand->images == (Image *) NULL)
3105    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3106  extent.width=width;
3107  extent.height=height;
3108  extent.x=x;
3109  extent.y=y;
3110  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3111  if (extent_image == (Image *) NULL)
3112    return(MagickFalse);
3113  ReplaceImageInList(&wand->images,extent_image);
3114  return(MagickTrue);
3115}
3116
3117/*
3118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3119%                                                                             %
3120%                                                                             %
3121%                                                                             %
3122%   M a g i c k F l i p I m a g e                                             %
3123%                                                                             %
3124%                                                                             %
3125%                                                                             %
3126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3127%
3128%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3129%  around the central x-axis.
3130%
3131%  The format of the MagickFlipImage method is:
3132%
3133%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3134%
3135%  A description of each parameter follows:
3136%
3137%    o wand: the magick wand.
3138%
3139*/
3140WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3141{
3142  Image
3143    *flip_image;
3144
3145  assert(wand != (MagickWand *) NULL);
3146  assert(wand->signature == WandSignature);
3147  if( IfMagickTrue(wand->debug) )
3148    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3149
3150  if (wand->images == (Image *) NULL)
3151    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3152  flip_image=FlipImage(wand->images,wand->exception);
3153  if (flip_image == (Image *) NULL)
3154    return(MagickFalse);
3155  ReplaceImageInList(&wand->images,flip_image);
3156  return(MagickTrue);
3157}
3158
3159/*
3160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3161%                                                                             %
3162%                                                                             %
3163%                                                                             %
3164%   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                         %
3165%                                                                             %
3166%                                                                             %
3167%                                                                             %
3168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3169%
3170%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3171%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3172%  specified, the color value is changed for any neighbor pixel that does not
3173%  match the bordercolor member of image.
3174%
3175%  The format of the MagickFloodfillPaintImage method is:
3176%
3177%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3178%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3179%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3180%
3181%  A description of each parameter follows:
3182%
3183%    o wand: the magick wand.
3184%
3185%    o fill: the floodfill color pixel wand.
3186%
3187%    o fuzz: By default target must match a particular pixel color
3188%      exactly.  However, in many cases two colors may differ by a small amount.
3189%      The fuzz member of image defines how much tolerance is acceptable to
3190%      consider two colors as the same.  For example, set fuzz to 10 and the
3191%      color red at intensities of 100 and 102 respectively are now interpreted
3192%      as the same color for the purposes of the floodfill.
3193%
3194%    o bordercolor: the border color pixel wand.
3195%
3196%    o x,y: the starting location of the operation.
3197%
3198%    o invert: paint any pixel that does not match the target color.
3199%
3200*/
3201WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3202  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3203  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3204{
3205  DrawInfo
3206    *draw_info;
3207
3208  MagickBooleanType
3209    status;
3210
3211  PixelInfo
3212    target;
3213
3214  assert(wand != (MagickWand *) NULL);
3215  assert(wand->signature == WandSignature);
3216  if( IfMagickTrue(wand->debug) )
3217    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3218
3219  if (wand->images == (Image *) NULL)
3220    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3221  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3222  PixelGetQuantumPacket(fill,&draw_info->fill);
3223  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3224    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3225  if (bordercolor != (PixelWand *) NULL)
3226    PixelGetMagickColor(bordercolor,&target);
3227  wand->images->fuzz=fuzz;
3228  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3229    wand->exception);
3230  draw_info=DestroyDrawInfo(draw_info);
3231  return(status);
3232}
3233
3234/*
3235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3236%                                                                             %
3237%                                                                             %
3238%                                                                             %
3239%   M a g i c k F l o p I m a g e                                             %
3240%                                                                             %
3241%                                                                             %
3242%                                                                             %
3243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3244%
3245%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3246%  around the central y-axis.
3247%
3248%  The format of the MagickFlopImage method is:
3249%
3250%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3251%
3252%  A description of each parameter follows:
3253%
3254%    o wand: the magick wand.
3255%
3256*/
3257WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3258{
3259  Image
3260    *flop_image;
3261
3262  assert(wand != (MagickWand *) NULL);
3263  assert(wand->signature == WandSignature);
3264  if( IfMagickTrue(wand->debug) )
3265    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266
3267  if (wand->images == (Image *) NULL)
3268    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3269  flop_image=FlopImage(wand->images,wand->exception);
3270  if (flop_image == (Image *) NULL)
3271    return(MagickFalse);
3272  ReplaceImageInList(&wand->images,flop_image);
3273  return(MagickTrue);
3274}
3275
3276/*
3277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3278%                                                                             %
3279%                                                                             %
3280%                                                                             %
3281%   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                     %
3282%                                                                             %
3283%                                                                             %
3284%                                                                             %
3285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3286%
3287%  MagickForwardFourierTransformImage() implements the discrete Fourier
3288%  transform (DFT) of the image either as a magnitude / phase or real /
3289%  imaginary image pair.
3290%
3291%  The format of the MagickForwardFourierTransformImage method is:
3292%
3293%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3294%        const MagickBooleanType magnitude)
3295%
3296%  A description of each parameter follows:
3297%
3298%    o wand: the magick wand.
3299%
3300%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3301%      imaginary image pair.
3302%
3303*/
3304WandExport MagickBooleanType MagickForwardFourierTransformImage(
3305  MagickWand *wand,const MagickBooleanType magnitude)
3306{
3307  Image
3308    *forward_image;
3309
3310  assert(wand != (MagickWand *) NULL);
3311  assert(wand->signature == WandSignature);
3312  if( IfMagickTrue(wand->debug) )
3313    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3314
3315  if (wand->images == (Image *) NULL)
3316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3317  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3318    wand->exception);
3319  if (forward_image == (Image *) NULL)
3320    return(MagickFalse);
3321  ReplaceImageInList(&wand->images,forward_image);
3322  return(MagickTrue);
3323}
3324
3325/*
3326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3327%                                                                             %
3328%                                                                             %
3329%                                                                             %
3330%   M a g i c k F r a m e I m a g e                                           %
3331%                                                                             %
3332%                                                                             %
3333%                                                                             %
3334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3335%
3336%  MagickFrameImage() adds a simulated three-dimensional border around the
3337%  image.  The width and height specify the border width of the vertical and
3338%  horizontal sides of the frame.  The inner and outer bevels indicate the
3339%  width of the inner and outer shadows of the frame.
3340%
3341%  The format of the MagickFrameImage method is:
3342%
3343%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3344%        const PixelWand *matte_color,const size_t width,
3345%        const size_t height,const ssize_t inner_bevel,
3346%        const ssize_t outer_bevel,const CompositeOperator compose)
3347%
3348%  A description of each parameter follows:
3349%
3350%    o wand: the magick wand.
3351%
3352%    o matte_color: the frame color pixel wand.
3353%
3354%    o width: the border width.
3355%
3356%    o height: the border height.
3357%
3358%    o inner_bevel: the inner bevel width.
3359%
3360%    o outer_bevel: the outer bevel width.
3361%
3362%    o compose: the composite operator.
3363%
3364*/
3365WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3366  const PixelWand *matte_color,const size_t width,const size_t height,
3367  const ssize_t inner_bevel,const ssize_t outer_bevel,
3368  const CompositeOperator compose)
3369{
3370  Image
3371    *frame_image;
3372
3373  FrameInfo
3374    frame_info;
3375
3376  assert(wand != (MagickWand *) NULL);
3377  assert(wand->signature == WandSignature);
3378  if( IfMagickTrue(wand->debug) )
3379    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3380
3381  if (wand->images == (Image *) NULL)
3382    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3383  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3384  frame_info.width=wand->images->columns+2*width;
3385  frame_info.height=wand->images->rows+2*height;
3386  frame_info.x=(ssize_t) width;
3387  frame_info.y=(ssize_t) height;
3388  frame_info.inner_bevel=inner_bevel;
3389  frame_info.outer_bevel=outer_bevel;
3390  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3391  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3392  if (frame_image == (Image *) NULL)
3393    return(MagickFalse);
3394  ReplaceImageInList(&wand->images,frame_image);
3395  return(MagickTrue);
3396}
3397
3398/*
3399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3400%                                                                             %
3401%                                                                             %
3402%                                                                             %
3403%   M a g i c k F u n c t i o n I m a g e                                     %
3404%                                                                             %
3405%                                                                             %
3406%                                                                             %
3407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3408%
3409%  MagickFunctionImage() applys an arithmetic, relational, or logical
3410%  expression to an image.  Use these operators to lighten or darken an image,
3411%  to increase or decrease contrast in an image, or to produce the "negative"
3412%  of an image.
3413%
3414%  The format of the MagickFunctionImage method is:
3415%
3416%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3417%        const MagickFunction function,const size_t number_arguments,
3418%        const double *arguments)
3419%
3420%  A description of each parameter follows:
3421%
3422%    o wand: the magick wand.
3423%
3424%    o function: the image function.
3425%
3426%    o number_arguments: the number of function arguments.
3427%
3428%    o arguments: the function arguments.
3429%
3430*/
3431WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3432  const MagickFunction function,const size_t number_arguments,
3433  const double *arguments)
3434{
3435  MagickBooleanType
3436    status;
3437
3438  assert(wand != (MagickWand *) NULL);
3439  assert(wand->signature == WandSignature);
3440  if( IfMagickTrue(wand->debug) )
3441    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3442
3443  if (wand->images == (Image *) NULL)
3444    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3445  status=FunctionImage(wand->images,function,number_arguments,arguments,
3446    wand->exception);
3447  return(status);
3448}
3449
3450/*
3451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452%                                                                             %
3453%                                                                             %
3454%                                                                             %
3455%   M a g i c k F x I m a g e                                                 %
3456%                                                                             %
3457%                                                                             %
3458%                                                                             %
3459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3460%
3461%  MagickFxImage() evaluate expression for each pixel in the image.
3462%
3463%  The format of the MagickFxImage method is:
3464%
3465%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3466%
3467%  A description of each parameter follows:
3468%
3469%    o wand: the magick wand.
3470%
3471%    o expression: the expression.
3472%
3473*/
3474WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3475{
3476  Image
3477    *fx_image;
3478
3479  assert(wand != (MagickWand *) NULL);
3480  assert(wand->signature == WandSignature);
3481  if( IfMagickTrue(wand->debug) )
3482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3483
3484  if (wand->images == (Image *) NULL)
3485    return((MagickWand *) NULL);
3486  fx_image=FxImage(wand->images,expression,wand->exception);
3487  if (fx_image == (Image *) NULL)
3488    return((MagickWand *) NULL);
3489  return(CloneMagickWandFromImages(wand,fx_image));
3490}
3491
3492/*
3493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3494%                                                                             %
3495%                                                                             %
3496%                                                                             %
3497%   M a g i c k G a m m a I m a g e                                           %
3498%                                                                             %
3499%                                                                             %
3500%                                                                             %
3501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3502%
3503%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3504%  different devices will have perceptual differences in the way the image's
3505%  intensities are represented on the screen.  Specify individual gamma levels
3506%  for the red, green, and blue channels, or adjust all three with the gamma
3507%  parameter.  Values typically range from 0.8 to 2.3.
3508%
3509%  You can also reduce the influence of a particular channel with a gamma
3510%  value of 0.
3511%
3512%  The format of the MagickGammaImage method is:
3513%
3514%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3515%
3516%  A description of each parameter follows:
3517%
3518%    o wand: the magick wand.
3519%
3520%    o level: Define the level of gamma correction.
3521%
3522*/
3523WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3524  const double gamma)
3525{
3526  MagickBooleanType
3527    status;
3528
3529  assert(wand != (MagickWand *) NULL);
3530  assert(wand->signature == WandSignature);
3531  if( IfMagickTrue(wand->debug) )
3532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3533
3534  if (wand->images == (Image *) NULL)
3535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3536  status=GammaImage(wand->images,gamma,wand->exception);
3537  return(status);
3538}
3539
3540/*
3541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3542%                                                                             %
3543%                                                                             %
3544%                                                                             %
3545%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3546%                                                                             %
3547%                                                                             %
3548%                                                                             %
3549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3550%
3551%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3552%  Gaussian operator of the given radius and standard deviation (sigma).
3553%  For reasonable results, the radius should be larger than sigma.  Use a
3554%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3555%
3556%  The format of the MagickGaussianBlurImage method is:
3557%
3558%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3559%        const double radius,const double sigma)
3560%
3561%  A description of each parameter follows:
3562%
3563%    o wand: the magick wand.
3564%
3565%    o radius: the radius of the Gaussian, in pixels, not counting the center
3566%      pixel.
3567%
3568%    o sigma: the standard deviation of the Gaussian, in pixels.
3569%
3570*/
3571WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3572  const double radius,const double sigma)
3573{
3574  Image
3575    *blur_image;
3576
3577  assert(wand != (MagickWand *) NULL);
3578  assert(wand->signature == WandSignature);
3579  if( IfMagickTrue(wand->debug) )
3580    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3581
3582  if (wand->images == (Image *) NULL)
3583    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3584  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3585  if (blur_image == (Image *) NULL)
3586    return(MagickFalse);
3587  ReplaceImageInList(&wand->images,blur_image);
3588  return(MagickTrue);
3589}
3590
3591/*
3592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3593%                                                                             %
3594%                                                                             %
3595%                                                                             %
3596%   M a g i c k G e t I m a g e                                               %
3597%                                                                             %
3598%                                                                             %
3599%                                                                             %
3600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3601%
3602%  MagickGetImage() gets the image at the current image index.
3603%
3604%  The format of the MagickGetImage method is:
3605%
3606%      MagickWand *MagickGetImage(MagickWand *wand)
3607%
3608%  A description of each parameter follows:
3609%
3610%    o wand: the magick wand.
3611%
3612*/
3613WandExport MagickWand *MagickGetImage(MagickWand *wand)
3614{
3615  Image
3616    *image;
3617
3618  assert(wand != (MagickWand *) NULL);
3619  assert(wand->signature == WandSignature);
3620  if( IfMagickTrue(wand->debug) )
3621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622
3623  if (wand->images == (Image *) NULL)
3624    {
3625      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3626        "ContainsNoImages","'%s'",wand->name);
3627      return((MagickWand *) NULL);
3628    }
3629  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3630  if (image == (Image *) NULL)
3631    return((MagickWand *) NULL);
3632  return(CloneMagickWandFromImages(wand,image));
3633}
3634
3635/*
3636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3637%                                                                             %
3638%                                                                             %
3639%                                                                             %
3640%   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                       %
3641%                                                                             %
3642%                                                                             %
3643%                                                                             %
3644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3645%
3646%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3647%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3648%  than CMYKA.
3649%
3650%  The format of the MagickGetImageAlphaChannel method is:
3651%
3652%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3653%
3654%  A description of each parameter follows:
3655%
3656%    o wand: the magick wand.
3657%
3658*/
3659WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3660{
3661  assert(wand != (MagickWand *) NULL);
3662  assert(wand->signature == WandSignature);
3663  if( IfMagickTrue(wand->debug) )
3664    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3665
3666  if (wand->images == (Image *) NULL)
3667    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3668  return(GetImageAlphaChannel(wand->images));
3669}
3670
3671/*
3672%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3673%                                                                             %
3674%                                                                             %
3675%                                                                             %
3676%   M a g i c k G e t I m a g e C l i p M a s k                               %
3677%                                                                             %
3678%                                                                             %
3679%                                                                             %
3680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3681%
3682%  MagickGetImageMask() gets the image clip mask at the current image index.
3683%
3684%  The format of the MagickGetImageMask method is:
3685%
3686%      MagickWand *MagickGetImageMask(MagickWand *wand)
3687%
3688%  A description of each parameter follows:
3689%
3690%    o wand: the magick wand.
3691%
3692*/
3693WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3694{
3695  Image
3696    *image;
3697
3698  assert(wand != (MagickWand *) NULL);
3699  assert(wand->signature == WandSignature);
3700  if( IfMagickTrue(wand->debug) )
3701    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3702
3703  if (wand->images == (Image *) NULL)
3704    {
3705      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3706        "ContainsNoImages","'%s'",wand->name);
3707      return((MagickWand *) NULL);
3708    }
3709  image=GetImageMask(wand->images,wand->exception);
3710  if (image == (Image *) NULL)
3711    return((MagickWand *) NULL);
3712  return(CloneMagickWandFromImages(wand,image));
3713}
3714
3715/*
3716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3717%                                                                             %
3718%                                                                             %
3719%                                                                             %
3720%   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                 %
3721%                                                                             %
3722%                                                                             %
3723%                                                                             %
3724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3725%
3726%  MagickGetImageBackgroundColor() returns the image background color.
3727%
3728%  The format of the MagickGetImageBackgroundColor method is:
3729%
3730%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3731%        PixelWand *background_color)
3732%
3733%  A description of each parameter follows:
3734%
3735%    o wand: the magick wand.
3736%
3737%    o background_color: Return the background color.
3738%
3739*/
3740WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3741  PixelWand *background_color)
3742{
3743  assert(wand != (MagickWand *) NULL);
3744  assert(wand->signature == WandSignature);
3745  if( IfMagickTrue(wand->debug) )
3746    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3747
3748  if (wand->images == (Image *) NULL)
3749    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3750  PixelSetPixelColor(background_color,&wand->images->background_color);
3751  return(MagickTrue);
3752}
3753
3754/*
3755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3756%                                                                             %
3757%                                                                             %
3758%                                                                             %
3759%   M a g i c k G e t I m a g e B l o b                                       %
3760%                                                                             %
3761%                                                                             %
3762%                                                                             %
3763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3764%
3765%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3766%  the image as a blob (a formatted "file" in memory) and its length, starting
3767%  from the current position in the image sequence.  Use MagickSetImageFormat()
3768%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3769%
3770%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3771%  the image sequence.
3772%
3773%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3774%
3775%  The format of the MagickGetImageBlob method is:
3776%
3777%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3778%
3779%  A description of each parameter follows:
3780%
3781%    o wand: the magick wand.
3782%
3783%    o length: the length of the blob.
3784%
3785*/
3786WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3787{
3788  assert(wand != (MagickWand *) NULL);
3789  assert(wand->signature == WandSignature);
3790  if( IfMagickTrue(wand->debug) )
3791    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3792
3793  if (wand->images == (Image *) NULL)
3794    {
3795      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3796        "ContainsNoImages","'%s'",wand->name);
3797      return((unsigned char *) NULL);
3798    }
3799  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3800}
3801
3802/*
3803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3804%                                                                             %
3805%                                                                             %
3806%                                                                             %
3807%   M a g i c k G e t I m a g e s B l o b                                     %
3808%                                                                             %
3809%                                                                             %
3810%                                                                             %
3811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3812%
3813%  MagickGetImageBlob() implements direct to memory image formats.  It
3814%  returns the image sequence as a blob and its length.  The format of the image
3815%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3816%  return a different image format, use MagickSetImageFormat().
3817%
3818%  Note, some image formats do not permit multiple images to the same image
3819%  stream (e.g. JPEG).  in this instance, just the first image of the
3820%  sequence is returned as a blob.
3821%
3822%  The format of the MagickGetImagesBlob method is:
3823%
3824%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3825%
3826%  A description of each parameter follows:
3827%
3828%    o wand: the magick wand.
3829%
3830%    o length: the length of the blob.
3831%
3832*/
3833WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3834{
3835  unsigned char
3836    *blob;
3837
3838  assert(wand != (MagickWand *) NULL);
3839  assert(wand->signature == WandSignature);
3840  if( IfMagickTrue(wand->debug) )
3841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3842
3843  if (wand->images == (Image *) NULL)
3844    {
3845      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3846        "ContainsNoImages","'%s'",wand->name);
3847      return((unsigned char *) NULL);
3848    }
3849  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3850    wand->exception);
3851  return(blob);
3852}
3853
3854/*
3855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3856%                                                                             %
3857%                                                                             %
3858%                                                                             %
3859%   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                         %
3860%                                                                             %
3861%                                                                             %
3862%                                                                             %
3863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3864%
3865%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3866%  image.
3867%
3868%  The format of the MagickGetImageBluePrimary method is:
3869%
3870%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3871%        double *y)
3872%
3873%  A description of each parameter follows:
3874%
3875%    o wand: the magick wand.
3876%
3877%    o x: the chromaticity blue primary x-point.
3878%
3879%    o y: the chromaticity blue primary y-point.
3880%
3881*/
3882WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3883  double *x,double *y)
3884{
3885  assert(wand != (MagickWand *) NULL);
3886  assert(wand->signature == WandSignature);
3887  if( IfMagickTrue(wand->debug) )
3888    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3889
3890  if (wand->images == (Image *) NULL)
3891    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3892  *x=wand->images->chromaticity.blue_primary.x;
3893  *y=wand->images->chromaticity.blue_primary.y;
3894  return(MagickTrue);
3895}
3896
3897/*
3898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3899%                                                                             %
3900%                                                                             %
3901%                                                                             %
3902%   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                         %
3903%                                                                             %
3904%                                                                             %
3905%                                                                             %
3906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3907%
3908%  MagickGetImageBorderColor() returns the image border color.
3909%
3910%  The format of the MagickGetImageBorderColor method is:
3911%
3912%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3913%        PixelWand *border_color)
3914%
3915%  A description of each parameter follows:
3916%
3917%    o wand: the magick wand.
3918%
3919%    o border_color: Return the border color.
3920%
3921*/
3922WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3923  PixelWand *border_color)
3924{
3925  assert(wand != (MagickWand *) NULL);
3926  assert(wand->signature == WandSignature);
3927  if( IfMagickTrue(wand->debug) )
3928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3929
3930  if (wand->images == (Image *) NULL)
3931    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3932  PixelSetPixelColor(border_color,&wand->images->border_color);
3933  return(MagickTrue);
3934}
3935
3936/*
3937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938%                                                                             %
3939%                                                                             %
3940%                                                                             %
3941%   M a g i c k G e t I m a g e F e a t u r e s                               %
3942%                                                                             %
3943%                                                                             %
3944%                                                                             %
3945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3946%
3947%  MagickGetImageFeatures() returns features for each channel in the
3948%  image in each of four directions (horizontal, vertical, left and right
3949%  diagonals) for the specified distance.  The features include the angular
3950%  second moment, contrast, correlation, sum of squares: variance, inverse
3951%  difference moment, sum average, sum varience, sum entropy, entropy,
3952%  difference variance, difference entropy, information measures of
3953%  correlation 1, information measures of correlation 2, and maximum
3954%  correlation coefficient.  You can access the red channel contrast, for
3955%  example, like this:
3956%
3957%      channel_features=MagickGetImageFeatures(wand,1);
3958%      contrast=channel_features[RedPixelChannel].contrast[0];
3959%
3960%  Use MagickRelinquishMemory() to free the statistics buffer.
3961%
3962%  The format of the MagickGetImageFeatures method is:
3963%
3964%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3965%        const size_t distance)
3966%
3967%  A description of each parameter follows:
3968%
3969%    o wand: the magick wand.
3970%
3971%    o distance: the distance.
3972%
3973*/
3974WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3975  const size_t distance)
3976{
3977  assert(wand != (MagickWand *) NULL);
3978  assert(wand->signature == WandSignature);
3979  if( IfMagickTrue(wand->debug) )
3980    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3981
3982  if (wand->images == (Image *) NULL)
3983    {
3984      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3985        "ContainsNoImages","'%s'",wand->name);
3986      return((ChannelFeatures *) NULL);
3987    }
3988  return(GetImageFeatures(wand->images,distance,wand->exception));
3989}
3990
3991/*
3992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3993%                                                                             %
3994%                                                                             %
3995%                                                                             %
3996%   M a g i c k G e t I m a g e K u r t o s i s                               %
3997%                                                                             %
3998%                                                                             %
3999%                                                                             %
4000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001%
4002%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4003%  more image channels.
4004%
4005%  The format of the MagickGetImageKurtosis method is:
4006%
4007%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4008%        double *kurtosis,double *skewness)
4009%
4010%  A description of each parameter follows:
4011%
4012%    o wand: the magick wand.
4013%
4014%    o kurtosis:  The kurtosis for the specified channel(s).
4015%
4016%    o skewness:  The skewness for the specified channel(s).
4017%
4018*/
4019WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4020  double *kurtosis,double *skewness)
4021{
4022  MagickBooleanType
4023    status;
4024
4025  assert(wand != (MagickWand *) NULL);
4026  assert(wand->signature == WandSignature);
4027  if( IfMagickTrue(wand->debug) )
4028    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4029
4030  if (wand->images == (Image *) NULL)
4031    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4032  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4033  return(status);
4034}
4035
4036/*
4037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4038%                                                                             %
4039%                                                                             %
4040%                                                                             %
4041%   M a g i c k G e t I m a g e M e a n                                       %
4042%                                                                             %
4043%                                                                             %
4044%                                                                             %
4045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4046%
4047%  MagickGetImageMean() gets the mean and standard deviation of one or more
4048%  image channels.
4049%
4050%  The format of the MagickGetImageMean method is:
4051%
4052%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4053%        double *standard_deviation)
4054%
4055%  A description of each parameter follows:
4056%
4057%    o wand: the magick wand.
4058%
4059%    o channel: the image channel(s).
4060%
4061%    o mean:  The mean pixel value for the specified channel(s).
4062%
4063%    o standard_deviation:  The standard deviation for the specified channel(s).
4064%
4065*/
4066WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4067  double *standard_deviation)
4068{
4069  MagickBooleanType
4070    status;
4071
4072  assert(wand != (MagickWand *) NULL);
4073  assert(wand->signature == WandSignature);
4074  if( IfMagickTrue(wand->debug) )
4075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4076
4077  if (wand->images == (Image *) NULL)
4078    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4079  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4080  return(status);
4081}
4082
4083/*
4084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4085%                                                                             %
4086%                                                                             %
4087%                                                                             %
4088%   M a g i c k G e t I m a g e R a n g e                                     %
4089%                                                                             %
4090%                                                                             %
4091%                                                                             %
4092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4093%
4094%  MagickGetImageRange() gets the range for one or more image channels.
4095%
4096%  The format of the MagickGetImageRange method is:
4097%
4098%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4099%        double *maxima)
4100%
4101%  A description of each parameter follows:
4102%
4103%    o wand: the magick wand.
4104%
4105%    o minima:  The minimum pixel value for the specified channel(s).
4106%
4107%    o maxima:  The maximum pixel value for the specified channel(s).
4108%
4109*/
4110WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4111  double *minima,double *maxima)
4112{
4113  MagickBooleanType
4114    status;
4115
4116  assert(wand != (MagickWand *) NULL);
4117  assert(wand->signature == WandSignature);
4118  if( IfMagickTrue(wand->debug) )
4119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4120
4121  if (wand->images == (Image *) NULL)
4122    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4123  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4124  return(status);
4125}
4126
4127/*
4128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4129%                                                                             %
4130%                                                                             %
4131%                                                                             %
4132%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4133%                                                                             %
4134%                                                                             %
4135%                                                                             %
4136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4137%
4138%  MagickGetImageStatistics() returns statistics for each channel in the
4139%  image.  The statistics include the channel depth, its minima and
4140%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4141%  You can access the red channel mean, for example, like this:
4142%
4143%      channel_statistics=MagickGetImageStatistics(wand);
4144%      red_mean=channel_statistics[RedPixelChannel].mean;
4145%
4146%  Use MagickRelinquishMemory() to free the statistics buffer.
4147%
4148%  The format of the MagickGetImageStatistics method is:
4149%
4150%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4151%
4152%  A description of each parameter follows:
4153%
4154%    o wand: the magick wand.
4155%
4156*/
4157WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4158{
4159  assert(wand != (MagickWand *) NULL);
4160  assert(wand->signature == WandSignature);
4161  if( IfMagickTrue(wand->debug) )
4162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4163
4164  if (wand->images == (Image *) NULL)
4165    {
4166      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4167        "ContainsNoImages","'%s'",wand->name);
4168      return((ChannelStatistics *) NULL);
4169    }
4170  return(GetImageStatistics(wand->images,wand->exception));
4171}
4172
4173/*
4174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4175%                                                                             %
4176%                                                                             %
4177%                                                                             %
4178%   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                     %
4179%                                                                             %
4180%                                                                             %
4181%                                                                             %
4182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4183%
4184%  MagickGetImageColormapColor() returns the color of the specified colormap
4185%  index.
4186%
4187%  The format of the MagickGetImageColormapColor method is:
4188%
4189%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4190%        const size_t index,PixelWand *color)
4191%
4192%  A description of each parameter follows:
4193%
4194%    o wand: the magick wand.
4195%
4196%    o index: the offset into the image colormap.
4197%
4198%    o color: Return the colormap color in this wand.
4199%
4200*/
4201WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4202  const size_t index,PixelWand *color)
4203{
4204  assert(wand != (MagickWand *) NULL);
4205  assert(wand->signature == WandSignature);
4206  if( IfMagickTrue(wand->debug) )
4207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4208
4209  if (wand->images == (Image *) NULL)
4210    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4211  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4212      (index >= wand->images->colors))
4213    {
4214      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4215        "InvalidColormapIndex","'%s'",wand->name);
4216      return(MagickFalse);
4217    }
4218  PixelSetPixelColor(color,wand->images->colormap+index);
4219  return(MagickTrue);
4220}
4221
4222/*
4223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4224%                                                                             %
4225%                                                                             %
4226%                                                                             %
4227%   M a g i c k G e t I m a g e C o l o r s                                   %
4228%                                                                             %
4229%                                                                             %
4230%                                                                             %
4231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4232%
4233%  MagickGetImageColors() gets the number of unique colors in the image.
4234%
4235%  The format of the MagickGetImageColors method is:
4236%
4237%      size_t MagickGetImageColors(MagickWand *wand)
4238%
4239%  A description of each parameter follows:
4240%
4241%    o wand: the magick wand.
4242%
4243*/
4244WandExport size_t MagickGetImageColors(MagickWand *wand)
4245{
4246  assert(wand != (MagickWand *) NULL);
4247  assert(wand->signature == WandSignature);
4248  if( IfMagickTrue(wand->debug) )
4249    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4250
4251  if (wand->images == (Image *) NULL)
4252    {
4253      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4254        "ContainsNoImages","'%s'",wand->name);
4255      return(0);
4256    }
4257  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4258}
4259
4260/*
4261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4262%                                                                             %
4263%                                                                             %
4264%                                                                             %
4265%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4266%                                                                             %
4267%                                                                             %
4268%                                                                             %
4269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4270%
4271%  MagickGetImageColorspace() gets the image colorspace.
4272%
4273%  The format of the MagickGetImageColorspace method is:
4274%
4275%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4276%
4277%  A description of each parameter follows:
4278%
4279%    o wand: the magick wand.
4280%
4281*/
4282WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4283{
4284  assert(wand != (MagickWand *) NULL);
4285  assert(wand->signature == WandSignature);
4286  if( IfMagickTrue(wand->debug) )
4287    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4288
4289  if (wand->images == (Image *) NULL)
4290    {
4291      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4292        "ContainsNoImages","'%s'",wand->name);
4293      return(UndefinedColorspace);
4294    }
4295  return(wand->images->colorspace);
4296}
4297
4298/*
4299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4300%                                                                             %
4301%                                                                             %
4302%                                                                             %
4303%   M a g i c k G e t I m a g e C o m p o s e                                 %
4304%                                                                             %
4305%                                                                             %
4306%                                                                             %
4307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4308%
4309%  MagickGetImageCompose() returns the composite operator associated with the
4310%  image.
4311%
4312%  The format of the MagickGetImageCompose method is:
4313%
4314%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4315%
4316%  A description of each parameter follows:
4317%
4318%    o wand: the magick wand.
4319%
4320*/
4321WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4322{
4323  assert(wand != (MagickWand *) NULL);
4324  assert(wand->signature == WandSignature);
4325  if( IfMagickTrue(wand->debug) )
4326    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4327
4328  if (wand->images == (Image *) NULL)
4329    {
4330      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4331        "ContainsNoImages","'%s'",wand->name);
4332      return(UndefinedCompositeOp);
4333    }
4334  return(wand->images->compose);
4335}
4336
4337/*
4338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4339%                                                                             %
4340%                                                                             %
4341%                                                                             %
4342%   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                         %
4343%                                                                             %
4344%                                                                             %
4345%                                                                             %
4346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4347%
4348%  MagickGetImageCompression() gets the image compression.
4349%
4350%  The format of the MagickGetImageCompression method is:
4351%
4352%      CompressionType MagickGetImageCompression(MagickWand *wand)
4353%
4354%  A description of each parameter follows:
4355%
4356%    o wand: the magick wand.
4357%
4358*/
4359WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4360{
4361  assert(wand != (MagickWand *) NULL);
4362  assert(wand->signature == WandSignature);
4363  if( IfMagickTrue(wand->debug) )
4364    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4365
4366  if (wand->images == (Image *) NULL)
4367    {
4368      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4369        "ContainsNoImages","'%s'",wand->name);
4370      return(UndefinedCompression);
4371    }
4372  return(wand->images->compression);
4373}
4374
4375/*
4376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4377%                                                                             %
4378%                                                                             %
4379%                                                                             %
4380%   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           %
4381%                                                                             %
4382%                                                                             %
4383%                                                                             %
4384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4385%
4386%  MagickGetImageCompressionQuality() gets the image compression quality.
4387%
4388%  The format of the MagickGetImageCompressionQuality method is:
4389%
4390%      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4391%
4392%  A description of each parameter follows:
4393%
4394%    o wand: the magick wand.
4395%
4396*/
4397WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4398{
4399  assert(wand != (MagickWand *) NULL);
4400  assert(wand->signature == WandSignature);
4401  if( IfMagickTrue(wand->debug) )
4402    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4403
4404  if (wand->images == (Image *) NULL)
4405    {
4406      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4407        "ContainsNoImages","'%s'",wand->name);
4408      return(0UL);
4409    }
4410  return(wand->images->quality);
4411}
4412
4413/*
4414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4415%                                                                             %
4416%                                                                             %
4417%                                                                             %
4418%   M a g i c k G e t I m a g e D e l a y                                     %
4419%                                                                             %
4420%                                                                             %
4421%                                                                             %
4422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4423%
4424%  MagickGetImageDelay() gets the image delay.
4425%
4426%  The format of the MagickGetImageDelay method is:
4427%
4428%      size_t MagickGetImageDelay(MagickWand *wand)
4429%
4430%  A description of each parameter follows:
4431%
4432%    o wand: the magick wand.
4433%
4434*/
4435WandExport size_t MagickGetImageDelay(MagickWand *wand)
4436{
4437  assert(wand != (MagickWand *) NULL);
4438  assert(wand->signature == WandSignature);
4439  if( IfMagickTrue(wand->debug) )
4440    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4441
4442  if (wand->images == (Image *) NULL)
4443    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4444  return(wand->images->delay);
4445}
4446
4447/*
4448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4449%                                                                             %
4450%                                                                             %
4451%                                                                             %
4452%   M a g i c k G e t I m a g e D e p t h                                     %
4453%                                                                             %
4454%                                                                             %
4455%                                                                             %
4456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4457%
4458%  MagickGetImageDepth() gets the image depth.
4459%
4460%  The format of the MagickGetImageDepth method is:
4461%
4462%      size_t MagickGetImageDepth(MagickWand *wand)
4463%
4464%  A description of each parameter follows:
4465%
4466%    o wand: the magick wand.
4467%
4468*/
4469WandExport size_t MagickGetImageDepth(MagickWand *wand)
4470{
4471  assert(wand != (MagickWand *) NULL);
4472  assert(wand->signature == WandSignature);
4473  if( IfMagickTrue(wand->debug) )
4474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4475
4476  if (wand->images == (Image *) NULL)
4477    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4478  return(wand->images->depth);
4479}
4480
4481/*
4482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4483%                                                                             %
4484%                                                                             %
4485%                                                                             %
4486%   M a g i c k G e t I m a g e D i s p o s e                                 %
4487%                                                                             %
4488%                                                                             %
4489%                                                                             %
4490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4491%
4492%  MagickGetImageDispose() gets the image disposal method.
4493%
4494%  The format of the MagickGetImageDispose method is:
4495%
4496%      DisposeType MagickGetImageDispose(MagickWand *wand)
4497%
4498%  A description of each parameter follows:
4499%
4500%    o wand: the magick wand.
4501%
4502*/
4503WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4504{
4505  assert(wand != (MagickWand *) NULL);
4506  assert(wand->signature == WandSignature);
4507  if( IfMagickTrue(wand->debug) )
4508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4509
4510  if (wand->images == (Image *) NULL)
4511    {
4512      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4513        "ContainsNoImages","'%s'",wand->name);
4514      return(UndefinedDispose);
4515    }
4516  return((DisposeType) wand->images->dispose);
4517}
4518
4519/*
4520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4521%                                                                             %
4522%                                                                             %
4523%                                                                             %
4524%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4525%                                                                             %
4526%                                                                             %
4527%                                                                             %
4528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4529%
4530%  MagickGetImageDistortion() compares an image to a reconstructed image and
4531%  returns the specified distortion metric.
4532%
4533%  The format of the MagickGetImageDistortion method is:
4534%
4535%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4536%        const MagickWand *reference,const MetricType metric,
4537%        double *distortion)
4538%
4539%  A description of each parameter follows:
4540%
4541%    o wand: the magick wand.
4542%
4543%    o reference: the reference wand.
4544%
4545%    o metric: the metric.
4546%
4547%    o distortion: the computed distortion between the images.
4548%
4549*/
4550WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4551  const MagickWand *reference,const MetricType metric,double *distortion)
4552{
4553  MagickBooleanType
4554    status;
4555
4556  assert(wand != (MagickWand *) NULL);
4557  assert(wand->signature == WandSignature);
4558  if( IfMagickTrue(wand->debug) )
4559    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4560
4561  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4562    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4563  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4564    wand->exception);
4565  return(status);
4566}
4567
4568/*
4569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4570%                                                                             %
4571%                                                                             %
4572%                                                                             %
4573%   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                         %
4574%                                                                             %
4575%                                                                             %
4576%                                                                             %
4577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578%
4579%  MagickGetImageDistortions() compares one or more pixel channels of an
4580%  image to a reconstructed image and returns the specified distortion metrics.
4581%
4582%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4583%
4584%  The format of the MagickGetImageDistortion method is:
4585%
4586%      double *MagickGetImageDistortion(MagickWand *wand,
4587%        const MagickWand *reference,const MetricType metric)
4588%
4589%  A description of each parameter follows:
4590%
4591%    o wand: the magick wand.
4592%
4593%    o reference: the reference wand.
4594%
4595%    o metric: the metric.
4596%
4597*/
4598WandExport double *MagickGetImageDistortions(MagickWand *wand,
4599  const MagickWand *reference,const MetricType metric)
4600{
4601  double
4602    *channel_distortion;
4603
4604  assert(wand != (MagickWand *) NULL);
4605  assert(wand->signature == WandSignature);
4606  if( IfMagickTrue(wand->debug) )
4607    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4608
4609  assert(reference != (MagickWand *) NULL);
4610  assert(reference->signature == WandSignature);
4611  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4612    {
4613      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4614        "ContainsNoImages","'%s'",wand->name);
4615      return((double *) NULL);
4616    }
4617  channel_distortion=GetImageDistortions(wand->images,reference->images,
4618    metric,wand->exception);
4619  return(channel_distortion);
4620}
4621
4622/*
4623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4624%                                                                             %
4625%                                                                             %
4626%                                                                             %
4627%   M a g i c k G e t I m a g e E n d i a n                                   %
4628%                                                                             %
4629%                                                                             %
4630%                                                                             %
4631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4632%
4633%  MagickGetImageEndian() gets the image endian.
4634%
4635%  The format of the MagickGetImageEndian method is:
4636%
4637%      EndianType MagickGetImageEndian(MagickWand *wand)
4638%
4639%  A description of each parameter follows:
4640%
4641%    o wand: the magick wand.
4642%
4643*/
4644WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4645{
4646  assert(wand != (MagickWand *) NULL);
4647  assert(wand->signature == WandSignature);
4648  if( IfMagickTrue(wand->debug) )
4649    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4650
4651  if (wand->images == (Image *) NULL)
4652    {
4653      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4654        "ContainsNoImages","'%s'",wand->name);
4655      return(UndefinedEndian);
4656    }
4657  return(wand->images->endian);
4658}
4659
4660/*
4661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4662%                                                                             %
4663%                                                                             %
4664%                                                                             %
4665%   M a g i c k G e t I m a g e F i l e n a m e                               %
4666%                                                                             %
4667%                                                                             %
4668%                                                                             %
4669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4670%
4671%  MagickGetImageFilename() returns the filename of a particular image in a
4672%  sequence.
4673%
4674%  The format of the MagickGetImageFilename method is:
4675%
4676%      char *MagickGetImageFilename(MagickWand *wand)
4677%
4678%  A description of each parameter follows:
4679%
4680%    o wand: the magick wand.
4681%
4682*/
4683WandExport char *MagickGetImageFilename(MagickWand *wand)
4684{
4685  assert(wand != (MagickWand *) NULL);
4686  assert(wand->signature == WandSignature);
4687  if( IfMagickTrue(wand->debug) )
4688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4689
4690  if (wand->images == (Image *) NULL)
4691    {
4692      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4693        "ContainsNoImages","'%s'",wand->name);
4694      return((char *) NULL);
4695    }
4696  return(AcquireString(wand->images->filename));
4697}
4698
4699/*
4700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4701%                                                                             %
4702%                                                                             %
4703%                                                                             %
4704%   M a g i c k G e t I m a g e F o r m a t                                   %
4705%                                                                             %
4706%                                                                             %
4707%                                                                             %
4708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4709%
4710%  MagickGetImageFormat() returns the format of a particular image in a
4711%  sequence.
4712%
4713%  The format of the MagickGetImageFormat method is:
4714%
4715%      const char *MagickGetImageFormat(MagickWand *wand)
4716%
4717%  A description of each parameter follows:
4718%
4719%    o wand: the magick wand.
4720%
4721*/
4722WandExport char *MagickGetImageFormat(MagickWand *wand)
4723{
4724  assert(wand != (MagickWand *) NULL);
4725  assert(wand->signature == WandSignature);
4726  if( IfMagickTrue(wand->debug) )
4727    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4728
4729  if (wand->images == (Image *) NULL)
4730    {
4731      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4732        "ContainsNoImages","'%s'",wand->name);
4733      return((char *) NULL);
4734    }
4735  return(AcquireString(wand->images->magick));
4736}
4737
4738/*
4739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4740%                                                                             %
4741%                                                                             %
4742%                                                                             %
4743%   M a g i c k G e t I m a g e F u z z                                       %
4744%                                                                             %
4745%                                                                             %
4746%                                                                             %
4747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4748%
4749%  MagickGetImageFuzz() gets the image fuzz.
4750%
4751%  The format of the MagickGetImageFuzz method is:
4752%
4753%      double MagickGetImageFuzz(MagickWand *wand)
4754%
4755%  A description of each parameter follows:
4756%
4757%    o wand: the magick wand.
4758%
4759*/
4760WandExport double MagickGetImageFuzz(MagickWand *wand)
4761{
4762  assert(wand != (MagickWand *) NULL);
4763  assert(wand->signature == WandSignature);
4764  if( IfMagickTrue(wand->debug) )
4765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4766
4767  if (wand->images == (Image *) NULL)
4768    {
4769      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4770        "ContainsNoImages","'%s'",wand->name);
4771      return(0.0);
4772    }
4773  return(wand->images->fuzz);
4774}
4775
4776/*
4777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4778%                                                                             %
4779%                                                                             %
4780%                                                                             %
4781%   M a g i c k G e t I m a g e G a m m a                                     %
4782%                                                                             %
4783%                                                                             %
4784%                                                                             %
4785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4786%
4787%  MagickGetImageGamma() gets the image gamma.
4788%
4789%  The format of the MagickGetImageGamma method is:
4790%
4791%      double MagickGetImageGamma(MagickWand *wand)
4792%
4793%  A description of each parameter follows:
4794%
4795%    o wand: the magick wand.
4796%
4797*/
4798WandExport double MagickGetImageGamma(MagickWand *wand)
4799{
4800  assert(wand != (MagickWand *) NULL);
4801  assert(wand->signature == WandSignature);
4802  if( IfMagickTrue(wand->debug) )
4803    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4804
4805  if (wand->images == (Image *) NULL)
4806    {
4807      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4808        "ContainsNoImages","'%s'",wand->name);
4809      return(0.0);
4810    }
4811  return(wand->images->gamma);
4812}
4813
4814/*
4815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4816%                                                                             %
4817%                                                                             %
4818%                                                                             %
4819%   M a g i c k G e t I m a g e G r a v i t y                                 %
4820%                                                                             %
4821%                                                                             %
4822%                                                                             %
4823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4824%
4825%  MagickGetImageGravity() gets the image gravity.
4826%
4827%  The format of the MagickGetImageGravity method is:
4828%
4829%      GravityType MagickGetImageGravity(MagickWand *wand)
4830%
4831%  A description of each parameter follows:
4832%
4833%    o wand: the magick wand.
4834%
4835*/
4836WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4837{
4838  assert(wand != (MagickWand *) NULL);
4839  assert(wand->signature == WandSignature);
4840  if( IfMagickTrue(wand->debug) )
4841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4842
4843  if (wand->images == (Image *) NULL)
4844    {
4845      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4846        "ContainsNoImages","'%s'",wand->name);
4847      return(UndefinedGravity);
4848    }
4849  return(wand->images->gravity);
4850}
4851
4852/*
4853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854%                                                                             %
4855%                                                                             %
4856%                                                                             %
4857%   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                       %
4858%                                                                             %
4859%                                                                             %
4860%                                                                             %
4861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862%
4863%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4864%
4865%  The format of the MagickGetImageGreenPrimary method is:
4866%
4867%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4868%        double *y)
4869%
4870%  A description of each parameter follows:
4871%
4872%    o wand: the magick wand.
4873%
4874%    o x: the chromaticity green primary x-point.
4875%
4876%    o y: the chromaticity green primary y-point.
4877%
4878*/
4879WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4880  double *x,double *y)
4881{
4882  assert(wand != (MagickWand *) NULL);
4883  assert(wand->signature == WandSignature);
4884  if( IfMagickTrue(wand->debug) )
4885    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4886
4887  if (wand->images == (Image *) NULL)
4888    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4889  *x=wand->images->chromaticity.green_primary.x;
4890  *y=wand->images->chromaticity.green_primary.y;
4891  return(MagickTrue);
4892}
4893
4894/*
4895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896%                                                                             %
4897%                                                                             %
4898%                                                                             %
4899%   M a g i c k G e t I m a g e H e i g h t                                   %
4900%                                                                             %
4901%                                                                             %
4902%                                                                             %
4903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4904%
4905%  MagickGetImageHeight() returns the image height.
4906%
4907%  The format of the MagickGetImageHeight method is:
4908%
4909%      size_t MagickGetImageHeight(MagickWand *wand)
4910%
4911%  A description of each parameter follows:
4912%
4913%    o wand: the magick wand.
4914%
4915*/
4916WandExport size_t MagickGetImageHeight(MagickWand *wand)
4917{
4918  assert(wand != (MagickWand *) NULL);
4919  assert(wand->signature == WandSignature);
4920  if( IfMagickTrue(wand->debug) )
4921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4922
4923  if (wand->images == (Image *) NULL)
4924    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4925  return(wand->images->rows);
4926}
4927
4928/*
4929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930%                                                                             %
4931%                                                                             %
4932%                                                                             %
4933%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4934%                                                                             %
4935%                                                                             %
4936%                                                                             %
4937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938%
4939%  MagickGetImageHistogram() returns the image histogram as an array of
4940%  PixelWand wands.
4941%
4942%  The format of the MagickGetImageHistogram method is:
4943%
4944%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4945%        size_t *number_colors)
4946%
4947%  A description of each parameter follows:
4948%
4949%    o wand: the magick wand.
4950%
4951%    o number_colors: the number of unique colors in the image and the number
4952%      of pixel wands returned.
4953%
4954*/
4955WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4956  size_t *number_colors)
4957{
4958  PixelInfo
4959    *histogram;
4960
4961  PixelWand
4962    **pixel_wands;
4963
4964  register ssize_t
4965    i;
4966
4967  assert(wand != (MagickWand *) NULL);
4968  assert(wand->signature == WandSignature);
4969  if( IfMagickTrue(wand->debug) )
4970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4971
4972  if (wand->images == (Image *) NULL)
4973    {
4974      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4975        "ContainsNoImages","'%s'",wand->name);
4976      return((PixelWand **) NULL);
4977    }
4978  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4979  if (histogram == (PixelInfo *) NULL)
4980    return((PixelWand **) NULL);
4981  pixel_wands=NewPixelWands(*number_colors);
4982  for (i=0; i < (ssize_t) *number_colors; i++)
4983  {
4984    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4985    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4986  }
4987  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4988  return(pixel_wands);
4989}
4990
4991/*
4992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4993%                                                                             %
4994%                                                                             %
4995%                                                                             %
4996%   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                 %
4997%                                                                             %
4998%                                                                             %
4999%                                                                             %
5000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5001%
5002%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5003%
5004%  The format of the MagickGetImageInterlaceScheme method is:
5005%
5006%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5007%
5008%  A description of each parameter follows:
5009%
5010%    o wand: the magick wand.
5011%
5012*/
5013WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5014{
5015  assert(wand != (MagickWand *) NULL);
5016  assert(wand->signature == WandSignature);
5017  if( IfMagickTrue(wand->debug) )
5018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5019
5020  if (wand->images == (Image *) NULL)
5021    {
5022      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5023        "ContainsNoImages","'%s'",wand->name);
5024      return(UndefinedInterlace);
5025    }
5026  return(wand->images->interlace);
5027}
5028
5029/*
5030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5031%                                                                             %
5032%                                                                             %
5033%                                                                             %
5034%   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             %
5035%                                                                             %
5036%                                                                             %
5037%                                                                             %
5038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5039%
5040%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5041%  sepcified image.
5042%
5043%  The format of the MagickGetImageInterpolateMethod method is:
5044%
5045%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5046%        MagickWand *wand)
5047%
5048%  A description of each parameter follows:
5049%
5050%    o wand: the magick wand.
5051%
5052*/
5053WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5054  MagickWand *wand)
5055{
5056  assert(wand != (MagickWand *) NULL);
5057  assert(wand->signature == WandSignature);
5058  if( IfMagickTrue(wand->debug) )
5059    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5060
5061  if (wand->images == (Image *) NULL)
5062    {
5063      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5064        "ContainsNoImages","'%s'",wand->name);
5065      return(UndefinedInterpolatePixel);
5066    }
5067  return(wand->images->interpolate);
5068}
5069
5070/*
5071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5072%                                                                             %
5073%                                                                             %
5074%                                                                             %
5075%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5076%                                                                             %
5077%                                                                             %
5078%                                                                             %
5079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5080%
5081%  MagickGetImageIterations() gets the image iterations.
5082%
5083%  The format of the MagickGetImageIterations method is:
5084%
5085%      size_t MagickGetImageIterations(MagickWand *wand)
5086%
5087%  A description of each parameter follows:
5088%
5089%    o wand: the magick wand.
5090%
5091*/
5092WandExport size_t MagickGetImageIterations(MagickWand *wand)
5093{
5094  assert(wand != (MagickWand *) NULL);
5095  assert(wand->signature == WandSignature);
5096  if( IfMagickTrue(wand->debug) )
5097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5098
5099  if (wand->images == (Image *) NULL)
5100    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5101  return(wand->images->iterations);
5102}
5103
5104/*
5105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5106%                                                                             %
5107%                                                                             %
5108%                                                                             %
5109%   M a g i c k G e t I m a g e L e n g t h                                   %
5110%                                                                             %
5111%                                                                             %
5112%                                                                             %
5113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5114%
5115%  MagickGetImageLength() returns the image length in bytes.
5116%
5117%  The format of the MagickGetImageLength method is:
5118%
5119%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5120%        MagickSizeType *length)
5121%
5122%  A description of each parameter follows:
5123%
5124%    o wand: the magick wand.
5125%
5126%    o length: the image length in bytes.
5127%
5128*/
5129WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5130  MagickSizeType *length)
5131{
5132  assert(wand != (MagickWand *) NULL);
5133  assert(wand->signature == WandSignature);
5134  if( IfMagickTrue(wand->debug) )
5135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5136
5137  if (wand->images == (Image *) NULL)
5138    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5139  *length=GetBlobSize(wand->images);
5140  return(MagickTrue);
5141}
5142
5143/*
5144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5145%                                                                             %
5146%                                                                             %
5147%                                                                             %
5148%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5149%                                                                             %
5150%                                                                             %
5151%                                                                             %
5152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5153%
5154%  MagickGetImageMatteColor() returns the image matte color.
5155%
5156%  The format of the MagickGetImageMatteColor method is:
5157%
5158%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5159%        PixelWand *matte_color)
5160%
5161%  A description of each parameter follows:
5162%
5163%    o wand: the magick wand.
5164%
5165%    o matte_color: Return the matte color.
5166%
5167*/
5168WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5169  PixelWand *matte_color)
5170{
5171  assert(wand != (MagickWand *) NULL);
5172  assert(wand->signature == WandSignature);
5173  if( IfMagickTrue(wand->debug) )
5174    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5175
5176  if (wand->images == (Image *) NULL)
5177    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5178  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5179  return(MagickTrue);
5180}
5181
5182/*
5183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5184%                                                                             %
5185%                                                                             %
5186%                                                                             %
5187%   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                         %
5188%                                                                             %
5189%                                                                             %
5190%                                                                             %
5191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5192%
5193%  MagickGetImageOrientation() returns the image orientation.
5194%
5195%  The format of the MagickGetImageOrientation method is:
5196%
5197%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5198%
5199%  A description of each parameter follows:
5200%
5201%    o wand: the magick wand.
5202%
5203*/
5204WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5205{
5206  assert(wand != (MagickWand *) NULL);
5207  assert(wand->signature == WandSignature);
5208  if( IfMagickTrue(wand->debug) )
5209    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5210
5211  if (wand->images == (Image *) NULL)
5212    {
5213      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5214        "ContainsNoImages","'%s'",wand->name);
5215      return(UndefinedOrientation);
5216    }
5217  return(wand->images->orientation);
5218}
5219
5220/*
5221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5222%                                                                             %
5223%                                                                             %
5224%                                                                             %
5225%   M a g i c k G e t I m a g e P a g e                                       %
5226%                                                                             %
5227%                                                                             %
5228%                                                                             %
5229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5230%
5231%  MagickGetImagePage() returns the page geometry associated with the image.
5232%
5233%  The format of the MagickGetImagePage method is:
5234%
5235%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5236%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5237%
5238%  A description of each parameter follows:
5239%
5240%    o wand: the magick wand.
5241%
5242%    o width: the page width.
5243%
5244%    o height: the page height.
5245%
5246%    o x: the page x-offset.
5247%
5248%    o y: the page y-offset.
5249%
5250*/
5251WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5252  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5253{
5254  assert(wand != (const MagickWand *) NULL);
5255  assert(wand->signature == WandSignature);
5256  if( IfMagickTrue(wand->debug) )
5257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5258
5259  if (wand->images == (Image *) NULL)
5260    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5261  *width=wand->images->page.width;
5262  *height=wand->images->page.height;
5263  *x=wand->images->page.x;
5264  *y=wand->images->page.y;
5265  return(MagickTrue);
5266}
5267
5268/*
5269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5270%                                                                             %
5271%                                                                             %
5272%                                                                             %
5273%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5274%                                                                             %
5275%                                                                             %
5276%                                                                             %
5277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5278%
5279%  MagickGetImagePixelColor() returns the color of the specified pixel.
5280%
5281%  The format of the MagickGetImagePixelColor method is:
5282%
5283%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5284%        const ssize_t x,const ssize_t y,PixelWand *color)
5285%
5286%  A description of each parameter follows:
5287%
5288%    o wand: the magick wand.
5289%
5290%    o x,y: the pixel offset into the image.
5291%
5292%    o color: Return the colormap color in this wand.
5293%
5294*/
5295WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5296  const ssize_t x,const ssize_t y,PixelWand *color)
5297{
5298  register const Quantum
5299    *p;
5300
5301  CacheView
5302    *image_view;
5303
5304  assert(wand != (MagickWand *) NULL);
5305  assert(wand->signature == WandSignature);
5306  if( IfMagickTrue(wand->debug) )
5307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5308
5309  if (wand->images == (Image *) NULL)
5310    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5311  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5312  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5313  if (p == (const Quantum *) NULL)
5314    {
5315      image_view=DestroyCacheView(image_view);
5316      return(MagickFalse);
5317    }
5318  PixelSetQuantumPixel(wand->images,p,color);
5319  image_view=DestroyCacheView(image_view);
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 d P r i m a r y                           %
5329%                                                                             %
5330%                                                                             %
5331%                                                                             %
5332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5333%
5334%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5335%
5336%  The format of the MagickGetImageRedPrimary method is:
5337%
5338%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5339%        double *y)
5340%
5341%  A description of each parameter follows:
5342%
5343%    o wand: the magick wand.
5344%
5345%    o x: the chromaticity red primary x-point.
5346%
5347%    o y: the chromaticity red primary y-point.
5348%
5349*/
5350WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5351  double *x,double *y)
5352{
5353  assert(wand != (MagickWand *) NULL);
5354  assert(wand->signature == WandSignature);
5355  if( IfMagickTrue(wand->debug) )
5356    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5357
5358  if (wand->images == (Image *) NULL)
5359    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5360  *x=wand->images->chromaticity.red_primary.x;
5361  *y=wand->images->chromaticity.red_primary.y;
5362  return(MagickTrue);
5363}
5364
5365/*
5366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5367%                                                                             %
5368%                                                                             %
5369%                                                                             %
5370%   M a g i c k G e t I m a g e R e g i o n                                   %
5371%                                                                             %
5372%                                                                             %
5373%                                                                             %
5374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5375%
5376%  MagickGetImageRegion() extracts a region of the image and returns it as a
5377%  a new wand.
5378%
5379%  The format of the MagickGetImageRegion method is:
5380%
5381%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5382%        const size_t width,const size_t height,const ssize_t x,
5383%        const ssize_t y)
5384%
5385%  A description of each parameter follows:
5386%
5387%    o wand: the magick wand.
5388%
5389%    o width: the region width.
5390%
5391%    o height: the region height.
5392%
5393%    o x: the region x offset.
5394%
5395%    o y: the region y offset.
5396%
5397*/
5398WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5399  const size_t width,const size_t height,const ssize_t x,
5400  const ssize_t y)
5401{
5402  Image
5403    *region_image;
5404
5405  RectangleInfo
5406    region;
5407
5408  assert(wand != (MagickWand *) NULL);
5409  assert(wand->signature == WandSignature);
5410  if( IfMagickTrue(wand->debug) )
5411    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5412
5413  if (wand->images == (Image *) NULL)
5414    return((MagickWand *) NULL);
5415  region.width=width;
5416  region.height=height;
5417  region.x=x;
5418  region.y=y;
5419  region_image=CropImage(wand->images,&region,wand->exception);
5420  if (region_image == (Image *) NULL)
5421    return((MagickWand *) NULL);
5422  return(CloneMagickWandFromImages(wand,region_image));
5423}
5424
5425/*
5426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5427%                                                                             %
5428%                                                                             %
5429%                                                                             %
5430%   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                 %
5431%                                                                             %
5432%                                                                             %
5433%                                                                             %
5434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5435%
5436%  MagickGetImageRenderingIntent() gets the image rendering intent.
5437%
5438%  The format of the MagickGetImageRenderingIntent method is:
5439%
5440%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5441%
5442%  A description of each parameter follows:
5443%
5444%    o wand: the magick wand.
5445%
5446*/
5447WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5448{
5449  assert(wand != (MagickWand *) NULL);
5450  assert(wand->signature == WandSignature);
5451  if( IfMagickTrue(wand->debug) )
5452    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5453
5454  if (wand->images == (Image *) NULL)
5455    {
5456      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5457        "ContainsNoImages","'%s'",wand->name);
5458      return(UndefinedIntent);
5459    }
5460  return((RenderingIntent) wand->images->rendering_intent);
5461}
5462
5463/*
5464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5465%                                                                             %
5466%                                                                             %
5467%                                                                             %
5468%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5469%                                                                             %
5470%                                                                             %
5471%                                                                             %
5472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5473%
5474%  MagickGetImageResolution() gets the image X and Y resolution.
5475%
5476%  The format of the MagickGetImageResolution method is:
5477%
5478%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5479%        double *y)
5480%
5481%  A description of each parameter follows:
5482%
5483%    o wand: the magick wand.
5484%
5485%    o x: the image x-resolution.
5486%
5487%    o y: the image y-resolution.
5488%
5489*/
5490WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5491  double *x,double *y)
5492{
5493  assert(wand != (MagickWand *) NULL);
5494  assert(wand->signature == WandSignature);
5495  if( IfMagickTrue(wand->debug) )
5496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5497
5498  if (wand->images == (Image *) NULL)
5499    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5500  *x=wand->images->resolution.x;
5501  *y=wand->images->resolution.y;
5502  return(MagickTrue);
5503}
5504
5505/*
5506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5507%                                                                             %
5508%                                                                             %
5509%                                                                             %
5510%   M a g i c k G e t I m a g e S c e n e                                     %
5511%                                                                             %
5512%                                                                             %
5513%                                                                             %
5514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5515%
5516%  MagickGetImageScene() gets the image scene.
5517%
5518%  The format of the MagickGetImageScene method is:
5519%
5520%      size_t MagickGetImageScene(MagickWand *wand)
5521%
5522%  A description of each parameter follows:
5523%
5524%    o wand: the magick wand.
5525%
5526*/
5527WandExport size_t MagickGetImageScene(MagickWand *wand)
5528{
5529  assert(wand != (MagickWand *) NULL);
5530  assert(wand->signature == WandSignature);
5531  if( IfMagickTrue(wand->debug) )
5532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5533
5534  if (wand->images == (Image *) NULL)
5535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5536  return(wand->images->scene);
5537}
5538
5539/*
5540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5541%                                                                             %
5542%                                                                             %
5543%                                                                             %
5544%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5545%                                                                             %
5546%                                                                             %
5547%                                                                             %
5548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5549%
5550%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5551%  pixel stream.
5552%
5553%  The format of the MagickGetImageSignature method is:
5554%
5555%      char *MagickGetImageSignature(MagickWand *wand)
5556%
5557%  A description of each parameter follows:
5558%
5559%    o wand: the magick wand.
5560%
5561*/
5562WandExport char *MagickGetImageSignature(MagickWand *wand)
5563{
5564  const char
5565    *value;
5566
5567  MagickBooleanType
5568    status;
5569
5570  assert(wand != (MagickWand *) NULL);
5571  assert(wand->signature == WandSignature);
5572  if( IfMagickTrue(wand->debug) )
5573    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5574
5575  if (wand->images == (Image *) NULL)
5576    {
5577      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5578        "ContainsNoImages","'%s'",wand->name);
5579      return((char *) NULL);
5580    }
5581  status=SignatureImage(wand->images,wand->exception);
5582  if( IfMagickFalse(status) )
5583    return((char *) NULL);
5584  value=GetImageProperty(wand->images,"signature",wand->exception);
5585  if (value == (const char *) NULL)
5586    return((char *) NULL);
5587  return(AcquireString(value));
5588}
5589
5590/*
5591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592%                                                                             %
5593%                                                                             %
5594%                                                                             %
5595%   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                   %
5596%                                                                             %
5597%                                                                             %
5598%                                                                             %
5599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5600%
5601%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5602%
5603%  The format of the MagickGetImageTicksPerSecond method is:
5604%
5605%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5606%
5607%  A description of each parameter follows:
5608%
5609%    o wand: the magick wand.
5610%
5611*/
5612WandExport size_t MagickGetImageTicksPerSecond(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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5621  return((size_t) wand->images->ticks_per_second);
5622}
5623
5624/*
5625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626%                                                                             %
5627%                                                                             %
5628%                                                                             %
5629%   M a g i c k G e t I m a g e T y p e                                       %
5630%                                                                             %
5631%                                                                             %
5632%                                                                             %
5633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634%
5635%  MagickGetImageType() gets the potential image type:
5636%
5637%        Bilevel        Grayscale       GrayscaleMatte
5638%        Palette        PaletteMatte    TrueColor
5639%        TrueColorMatte ColorSeparation ColorSeparationMatte
5640%
5641%  To ensure the image type matches its potential, use MagickSetImageType():
5642%
5643%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5644%
5645%  The format of the MagickGetImageType method is:
5646%
5647%      ImageType MagickGetImageType(MagickWand *wand)
5648%
5649%  A description of each parameter follows:
5650%
5651%    o wand: the magick wand.
5652%
5653*/
5654WandExport ImageType MagickGetImageType(MagickWand *wand)
5655{
5656  assert(wand != (MagickWand *) NULL);
5657  assert(wand->signature == WandSignature);
5658  if( IfMagickTrue(wand->debug) )
5659    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5660
5661  if (wand->images == (Image *) NULL)
5662    {
5663      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5664        "ContainsNoImages","'%s'",wand->name);
5665      return(UndefinedType);
5666    }
5667  return(GetImageType(wand->images,wand->exception));
5668}
5669
5670/*
5671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5672%                                                                             %
5673%                                                                             %
5674%                                                                             %
5675%   M a g i c k G e t I m a g e U n i t s                                     %
5676%                                                                             %
5677%                                                                             %
5678%                                                                             %
5679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5680%
5681%  MagickGetImageUnits() gets the image units of resolution.
5682%
5683%  The format of the MagickGetImageUnits method is:
5684%
5685%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5686%
5687%  A description of each parameter follows:
5688%
5689%    o wand: the magick wand.
5690%
5691*/
5692WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5693{
5694  assert(wand != (MagickWand *) NULL);
5695  assert(wand->signature == WandSignature);
5696  if( IfMagickTrue(wand->debug) )
5697    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5698
5699  if (wand->images == (Image *) NULL)
5700    {
5701      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5702        "ContainsNoImages","'%s'",wand->name);
5703      return(UndefinedResolution);
5704    }
5705  return(wand->images->units);
5706}
5707
5708/*
5709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5710%                                                                             %
5711%                                                                             %
5712%                                                                             %
5713%   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           %
5714%                                                                             %
5715%                                                                             %
5716%                                                                             %
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%
5719%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5720%  sepcified image.
5721%
5722%  The format of the MagickGetImageVirtualPixelMethod method is:
5723%
5724%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5725%
5726%  A description of each parameter follows:
5727%
5728%    o wand: the magick wand.
5729%
5730*/
5731WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5732{
5733  assert(wand != (MagickWand *) NULL);
5734  assert(wand->signature == WandSignature);
5735  if( IfMagickTrue(wand->debug) )
5736    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5737
5738  if (wand->images == (Image *) NULL)
5739    {
5740      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5741        "ContainsNoImages","'%s'",wand->name);
5742      return(UndefinedVirtualPixelMethod);
5743    }
5744  return(GetImageVirtualPixelMethod(wand->images));
5745}
5746
5747/*
5748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5749%                                                                             %
5750%                                                                             %
5751%                                                                             %
5752%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5753%                                                                             %
5754%                                                                             %
5755%                                                                             %
5756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5757%
5758%  MagickGetImageWhitePoint() returns the chromaticy white point.
5759%
5760%  The format of the MagickGetImageWhitePoint method is:
5761%
5762%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5763%        double *y)
5764%
5765%  A description of each parameter follows:
5766%
5767%    o wand: the magick wand.
5768%
5769%    o x: the chromaticity white x-point.
5770%
5771%    o y: the chromaticity white y-point.
5772%
5773*/
5774WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5775  double *x,double *y)
5776{
5777  assert(wand != (MagickWand *) NULL);
5778  assert(wand->signature == WandSignature);
5779  if( IfMagickTrue(wand->debug) )
5780    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5781
5782  if (wand->images == (Image *) NULL)
5783    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5784  *x=wand->images->chromaticity.white_point.x;
5785  *y=wand->images->chromaticity.white_point.y;
5786  return(MagickTrue);
5787}
5788
5789/*
5790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5791%                                                                             %
5792%                                                                             %
5793%                                                                             %
5794%   M a g i c k G e t I m a g e W i d t h                                     %
5795%                                                                             %
5796%                                                                             %
5797%                                                                             %
5798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5799%
5800%  MagickGetImageWidth() returns the image width.
5801%
5802%  The format of the MagickGetImageWidth method is:
5803%
5804%      size_t MagickGetImageWidth(MagickWand *wand)
5805%
5806%  A description of each parameter follows:
5807%
5808%    o wand: the magick wand.
5809%
5810*/
5811WandExport size_t MagickGetImageWidth(MagickWand *wand)
5812{
5813  assert(wand != (MagickWand *) NULL);
5814  assert(wand->signature == WandSignature);
5815  if( IfMagickTrue(wand->debug) )
5816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5817
5818  if (wand->images == (Image *) NULL)
5819    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5820  return(wand->images->columns);
5821}
5822
5823/*
5824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5825%                                                                             %
5826%                                                                             %
5827%                                                                             %
5828%   M a g i c k G e t N u m b e r I m a g e s                                 %
5829%                                                                             %
5830%                                                                             %
5831%                                                                             %
5832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5833%
5834%  MagickGetNumberImages() returns the number of images associated with a
5835%  magick wand.
5836%
5837%  The format of the MagickGetNumberImages method is:
5838%
5839%      size_t MagickGetNumberImages(MagickWand *wand)
5840%
5841%  A description of each parameter follows:
5842%
5843%    o wand: the magick wand.
5844%
5845*/
5846WandExport size_t MagickGetNumberImages(MagickWand *wand)
5847{
5848  assert(wand != (MagickWand *) NULL);
5849  assert(wand->signature == WandSignature);
5850  if( IfMagickTrue(wand->debug) )
5851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5852
5853  return(GetImageListLength(wand->images));
5854}
5855
5856/*
5857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5858%                                                                             %
5859%                                                                             %
5860%                                                                             %
5861%   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                 %
5862%                                                                             %
5863%                                                                             %
5864%                                                                             %
5865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5866%
5867%  MagickGetImageTotalInkDensity() gets the image total ink density.
5868%
5869%  The format of the MagickGetImageTotalInkDensity method is:
5870%
5871%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5872%
5873%  A description of each parameter follows:
5874%
5875%    o wand: the magick wand.
5876%
5877*/
5878WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5879{
5880  assert(wand != (MagickWand *) NULL);
5881  assert(wand->signature == WandSignature);
5882  if( IfMagickTrue(wand->debug) )
5883    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5884
5885  if (wand->images == (Image *) NULL)
5886    {
5887      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5888        "ContainsNoImages","'%s'",wand->name);
5889      return(0.0);
5890    }
5891  return(GetImageTotalInkDensity(wand->images,wand->exception));
5892}
5893
5894/*
5895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5896%                                                                             %
5897%                                                                             %
5898%                                                                             %
5899%   M a g i c k H a l d C l u t I m a g e                                     %
5900%                                                                             %
5901%                                                                             %
5902%                                                                             %
5903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5904%
5905%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5906%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5907%  dimensions.  Create it with the HALD coder.  You can apply any color
5908%  transformation to the Hald image and then use this method to apply the
5909%  transform to the image.
5910%
5911%  The format of the MagickHaldClutImage method is:
5912%
5913%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5914%        const MagickWand *hald_wand)
5915%
5916%  A description of each parameter follows:
5917%
5918%    o wand: the magick wand.
5919%
5920%    o hald_image: the hald CLUT image.
5921%
5922*/
5923WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5924  const MagickWand *hald_wand)
5925{
5926  MagickBooleanType
5927    status;
5928
5929  assert(wand != (MagickWand *) NULL);
5930  assert(wand->signature == WandSignature);
5931  if( IfMagickTrue(wand->debug) )
5932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5933
5934  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5935    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5936  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5937  return(status);
5938}
5939
5940/*
5941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5942%                                                                             %
5943%                                                                             %
5944%                                                                             %
5945%   M a g i c k H a s N e x t I m a g e                                       %
5946%                                                                             %
5947%                                                                             %
5948%                                                                             %
5949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5950%
5951%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5952%  traversing the list in the forward direction
5953%
5954%  The format of the MagickHasNextImage method is:
5955%
5956%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5957%
5958%  A description of each parameter follows:
5959%
5960%    o wand: the magick wand.
5961%
5962*/
5963WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5964{
5965  assert(wand != (MagickWand *) NULL);
5966  assert(wand->signature == WandSignature);
5967  if( IfMagickTrue(wand->debug) )
5968    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5969
5970  if (wand->images == (Image *) NULL)
5971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5972  if (GetNextImageInList(wand->images) == (Image *) NULL)
5973    return(MagickFalse);
5974  return(MagickTrue);
5975}
5976
5977/*
5978%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5979%                                                                             %
5980%                                                                             %
5981%                                                                             %
5982%   M a g i c k H a s P r e v i o u s I m a g e                               %
5983%                                                                             %
5984%                                                                             %
5985%                                                                             %
5986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5987%
5988%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5989%  traversing the list in the reverse direction
5990%
5991%  The format of the MagickHasPreviousImage method is:
5992%
5993%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5994%
5995%  A description of each parameter follows:
5996%
5997%    o wand: the magick wand.
5998%
5999*/
6000WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6001{
6002  assert(wand != (MagickWand *) NULL);
6003  assert(wand->signature == WandSignature);
6004  if( IfMagickTrue(wand->debug) )
6005    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6006
6007  if (wand->images == (Image *) NULL)
6008    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6009  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6010    return(MagickFalse);
6011  return(MagickTrue);
6012}
6013
6014/*
6015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6016%                                                                             %
6017%                                                                             %
6018%                                                                             %
6019%   M a g i c k I d e n t i f y I m a g e                                     %
6020%                                                                             %
6021%                                                                             %
6022%                                                                             %
6023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6024%
6025%  MagickIdentifyImage() identifies an image by printing its attributes to the
6026%  file.  Attributes include the image width, height, size, and others.
6027%
6028%  The format of the MagickIdentifyImage method is:
6029%
6030%      const char *MagickIdentifyImage(MagickWand *wand)
6031%
6032%  A description of each parameter follows:
6033%
6034%    o wand: the magick wand.
6035%
6036*/
6037WandExport char *MagickIdentifyImage(MagickWand *wand)
6038{
6039  char
6040    *description,
6041    filename[MaxTextExtent];
6042
6043  FILE
6044    *file;
6045
6046  int
6047    unique_file;
6048
6049  assert(wand != (MagickWand *) NULL);
6050  assert(wand->signature == WandSignature);
6051  if( IfMagickTrue(wand->debug) )
6052    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6053
6054  if (wand->images == (Image *) NULL)
6055    {
6056      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6057        "ContainsNoImages","'%s'",wand->name);
6058      return((char *) NULL);
6059    }
6060  description=(char *) NULL;
6061  unique_file=AcquireUniqueFileResource(filename);
6062  file=(FILE *) NULL;
6063  if (unique_file != -1)
6064    file=fdopen(unique_file,"wb");
6065  if ((unique_file == -1) || (file == (FILE *) NULL))
6066    {
6067      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6068        "UnableToCreateTemporaryFile","'%s'",wand->name);
6069      return((char *) NULL);
6070    }
6071  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6072  (void) fclose(file);
6073  description=FileToString(filename,~0,wand->exception);
6074  (void) RelinquishUniqueFileResource(filename);
6075  return(description);
6076}
6077
6078/*
6079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6080%                                                                             %
6081%                                                                             %
6082%                                                                             %
6083%   M a g i c k I m p l o d e I m a g e                                       %
6084%                                                                             %
6085%                                                                             %
6086%                                                                             %
6087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6088%
6089%  MagickImplodeImage() creates a new image that is a copy of an existing
6090%  one with the image pixels "implode" by the specified percentage.  It
6091%  allocates the memory necessary for the new Image structure and returns a
6092%  pointer to the new image.
6093%
6094%  The format of the MagickImplodeImage method is:
6095%
6096%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6097%        const double radius,const PixelInterpolateMethod method)
6098%
6099%  A description of each parameter follows:
6100%
6101%    o wand: the magick wand.
6102%
6103%    o amount: Define the extent of the implosion.
6104%
6105%    o method: the pixel interpolation method.
6106%
6107*/
6108WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6109  const double amount,const PixelInterpolateMethod method)
6110{
6111  Image
6112    *implode_image;
6113
6114  assert(wand != (MagickWand *) NULL);
6115  assert(wand->signature == WandSignature);
6116  if( IfMagickTrue(wand->debug) )
6117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6118
6119  if (wand->images == (Image *) NULL)
6120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6121  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6122  if (implode_image == (Image *) NULL)
6123    return(MagickFalse);
6124  ReplaceImageInList(&wand->images,implode_image);
6125  return(MagickTrue);
6126}
6127
6128/*
6129%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6130%                                                                             %
6131%                                                                             %
6132%                                                                             %
6133%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6134%                                                                             %
6135%                                                                             %
6136%                                                                             %
6137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6138%
6139%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6140%  location you specify.  The method returns MagickFalse on success otherwise
6141%  MagickTrue if an error is encountered.  The pixel data can be either char,
6142%  short int, int, ssize_t, float, or double in the order specified by map.
6143%
6144%  Suppose your want to upload the first scanline of a 640x480 image from
6145%  character data in red-green-blue order:
6146%
6147%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6148%
6149%  The format of the MagickImportImagePixels method is:
6150%
6151%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6152%        const ssize_t x,const ssize_t y,const size_t columns,
6153%        const size_t rows,const char *map,const StorageType storage,
6154%        const void *pixels)
6155%
6156%  A description of each parameter follows:
6157%
6158%    o wand: the magick wand.
6159%
6160%    o x, y, columns, rows:  These values define the perimeter of a region
6161%      of pixels you want to define.
6162%
6163%    o map:  This string reflects the expected ordering of the pixel array.
6164%      It can be any combination or order of R = red, G = green, B = blue,
6165%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6166%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6167%      P = pad.
6168%
6169%    o storage: Define the data type of the pixels.  Float and double types are
6170%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6171%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6172%      or DoublePixel.
6173%
6174%    o pixels: This array of values contain the pixel components as defined by
6175%      map and type.  You must preallocate this array where the expected
6176%      length varies depending on the values of width, height, map, and type.
6177%
6178*/
6179WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6180  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6181  const char *map,const StorageType storage,const void *pixels)
6182{
6183  MagickBooleanType
6184    status;
6185
6186  assert(wand != (MagickWand *) NULL);
6187  assert(wand->signature == WandSignature);
6188  if( IfMagickTrue(wand->debug) )
6189    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6190
6191  if (wand->images == (Image *) NULL)
6192    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6193  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6194    wand->exception);
6195  return(status);
6196}
6197
6198/*
6199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6200%                                                                             %
6201%                                                                             %
6202%                                                                             %
6203%   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               %
6204%                                                                             %
6205%                                                                             %
6206%                                                                             %
6207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6208%
6209%  MagickInterpolativeResizeImage() resize image using a interpolative
6210%  method.
6211%
6212%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6213%        const size_t columns,const size_t rows,
6214%        const PixelInterpolateMethod method)
6215%
6216%  A description of each parameter follows:
6217%
6218%    o wand: the magick wand.
6219%
6220%    o columns: the number of columns in the scaled image.
6221%
6222%    o rows: the number of rows in the scaled image.
6223%
6224%    o interpolate: the pixel interpolation method.
6225%
6226*/
6227WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6228  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6229{
6230  Image
6231    *resize_image;
6232
6233  assert(wand != (MagickWand *) NULL);
6234  assert(wand->signature == WandSignature);
6235  if( IfMagickTrue(wand->debug) )
6236    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6237
6238  if (wand->images == (Image *) NULL)
6239    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6240  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6241    wand->exception);
6242  if (resize_image == (Image *) NULL)
6243    return(MagickFalse);
6244  ReplaceImageInList(&wand->images,resize_image);
6245  return(MagickTrue);
6246}
6247
6248/*
6249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6250%                                                                             %
6251%                                                                             %
6252%                                                                             %
6253%   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       %
6254%                                                                             %
6255%                                                                             %
6256%                                                                             %
6257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6258%
6259%  MagickInverseFourierTransformImage() implements the inverse discrete
6260%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6261%  imaginary image pair.
6262%
6263%  The format of the MagickInverseFourierTransformImage method is:
6264%
6265%      MagickBooleanType MagickInverseFourierTransformImage(
6266%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6267%        const MagickBooleanType magnitude)
6268%
6269%  A description of each parameter follows:
6270%
6271%    o magnitude_wand: the magnitude or real wand.
6272%
6273%    o phase_wand: the phase or imaginary wand.
6274%
6275%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6276%      imaginary image pair.
6277%
6278*/
6279WandExport MagickBooleanType MagickInverseFourierTransformImage(
6280  MagickWand *magnitude_wand,MagickWand *phase_wand,
6281  const MagickBooleanType magnitude)
6282{
6283  Image
6284    *inverse_image;
6285
6286  MagickWand
6287    *wand;
6288
6289  assert(magnitude_wand != (MagickWand *) NULL);
6290  assert(magnitude_wand->signature == WandSignature);
6291  if( IfMagickTrue(magnitude_wand->debug) )
6292    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6293
6294      magnitude_wand->name);
6295  wand=magnitude_wand;
6296  if (magnitude_wand->images == (Image *) NULL)
6297    ThrowWandException(WandError,"ContainsNoImages",
6298      magnitude_wand->name);
6299  assert(phase_wand != (MagickWand *) NULL);
6300  assert(phase_wand->signature == WandSignature);
6301  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6302    phase_wand->images,magnitude,wand->exception);
6303  if (inverse_image == (Image *) NULL)
6304    return(MagickFalse);
6305  ReplaceImageInList(&wand->images,inverse_image);
6306  return(MagickTrue);
6307}
6308
6309/*
6310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6311%                                                                             %
6312%                                                                             %
6313%                                                                             %
6314%   M a g i c k L a b e l I m a g e                                           %
6315%                                                                             %
6316%                                                                             %
6317%                                                                             %
6318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6319%
6320%  MagickLabelImage() adds a label to your image.
6321%
6322%  The format of the MagickLabelImage method is:
6323%
6324%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6325%
6326%  A description of each parameter follows:
6327%
6328%    o wand: the magick wand.
6329%
6330%    o label: the image label.
6331%
6332*/
6333WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6334  const char *label)
6335{
6336  MagickBooleanType
6337    status;
6338
6339  assert(wand != (MagickWand *) NULL);
6340  assert(wand->signature == WandSignature);
6341  if( IfMagickTrue(wand->debug) )
6342    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6343
6344  if (wand->images == (Image *) NULL)
6345    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6346  status=SetImageProperty(wand->images,"label",label,wand->exception);
6347  return(status);
6348}
6349
6350/*
6351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6352%                                                                             %
6353%                                                                             %
6354%                                                                             %
6355%   M a g i c k L e v e l I m a g e                                           %
6356%                                                                             %
6357%                                                                             %
6358%                                                                             %
6359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6360%
6361%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6362%  falling between specified white and black points to the full available
6363%  quantum range. The parameters provided represent the black, mid, and white
6364%  points. The black point specifies the darkest color in the image. Colors
6365%  darker than the black point are set to zero. Mid point specifies a gamma
6366%  correction to apply to the image.  White point specifies the lightest color
6367%  in the image. Colors brighter than the white point are set to the maximum
6368%  quantum value.
6369%
6370%  The format of the MagickLevelImage method is:
6371%
6372%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6373%        const double black_point,const double gamma,const double white_point)
6374%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6375%        const ChannelType channel,const double black_point,const double gamma,
6376%        const double white_point)
6377%
6378%  A description of each parameter follows:
6379%
6380%    o wand: the magick wand.
6381%
6382%    o channel: Identify which channel to level: RedPixelChannel,
6383%      GreenPixelChannel, etc.
6384%
6385%    o black_point: the black point.
6386%
6387%    o gamma: the gamma.
6388%
6389%    o white_point: the white point.
6390%
6391*/
6392WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6393  const double black_point,const double gamma,const double white_point)
6394{
6395  MagickBooleanType
6396    status;
6397
6398  assert(wand != (MagickWand *) NULL);
6399  assert(wand->signature == WandSignature);
6400  if( IfMagickTrue(wand->debug) )
6401    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6402
6403  if (wand->images == (Image *) NULL)
6404    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6405  status=LevelImage(wand->images,black_point,white_point,gamma,
6406    wand->exception);
6407  return(status);
6408}
6409
6410/*
6411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6412%                                                                             %
6413%                                                                             %
6414%                                                                             %
6415%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6416%                                                                             %
6417%                                                                             %
6418%                                                                             %
6419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6420%
6421%  MagickLinearStretchImage() stretches with saturation the image intensity.
6422%
6423%  You can also reduce the influence of a particular channel with a gamma
6424%  value of 0.
6425%
6426%  The format of the MagickLinearStretchImage method is:
6427%
6428%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6429%        const double black_point,const double white_point)
6430%
6431%  A description of each parameter follows:
6432%
6433%    o wand: the magick wand.
6434%
6435%    o black_point: the black point.
6436%
6437%    o white_point: the white point.
6438%
6439*/
6440WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6441  const double black_point,const double white_point)
6442{
6443  MagickBooleanType
6444    status;
6445
6446  assert(wand != (MagickWand *) NULL);
6447  assert(wand->signature == WandSignature);
6448  if( IfMagickTrue(wand->debug) )
6449    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6450
6451  if (wand->images == (Image *) NULL)
6452    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6453  status=LinearStretchImage(wand->images,black_point,white_point,
6454    wand->exception);
6455  return(status);
6456}
6457
6458/*
6459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6460%                                                                             %
6461%                                                                             %
6462%                                                                             %
6463%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6464%                                                                             %
6465%                                                                             %
6466%                                                                             %
6467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6468%
6469%  MagickLiquidRescaleImage() rescales image with seam carving.
6470%
6471%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6472%        const size_t columns,const size_t rows,
6473%        const double delta_x,const double rigidity)
6474%
6475%  A description of each parameter follows:
6476%
6477%    o wand: the magick wand.
6478%
6479%    o columns: the number of columns in the scaled image.
6480%
6481%    o rows: the number of rows in the scaled image.
6482%
6483%    o delta_x: maximum seam transversal step (0 means straight seams).
6484%
6485%    o rigidity: introduce a bias for non-straight seams (typically 0).
6486%
6487*/
6488WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6489  const size_t columns,const size_t rows,const double delta_x,
6490  const double rigidity)
6491{
6492  Image
6493    *rescale_image;
6494
6495  assert(wand != (MagickWand *) NULL);
6496  assert(wand->signature == WandSignature);
6497  if( IfMagickTrue(wand->debug) )
6498    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6499
6500  if (wand->images == (Image *) NULL)
6501    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6502  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6503    rigidity,wand->exception);
6504  if (rescale_image == (Image *) NULL)
6505    return(MagickFalse);
6506  ReplaceImageInList(&wand->images,rescale_image);
6507  return(MagickTrue);
6508}
6509
6510/*
6511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6512%                                                                             %
6513%                                                                             %
6514%                                                                             %
6515%   M a g i c k M a g n i f y I m a g e                                       %
6516%                                                                             %
6517%                                                                             %
6518%                                                                             %
6519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520%
6521%  MagickMagnifyImage() is a convenience method that scales an image
6522%  proportionally to twice its original size.
6523%
6524%  The format of the MagickMagnifyImage method is:
6525%
6526%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6527%
6528%  A description of each parameter follows:
6529%
6530%    o wand: the magick wand.
6531%
6532*/
6533WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6534{
6535  Image
6536    *magnify_image;
6537
6538  assert(wand != (MagickWand *) NULL);
6539  assert(wand->signature == WandSignature);
6540  if( IfMagickTrue(wand->debug) )
6541    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6542
6543  if (wand->images == (Image *) NULL)
6544    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6545  magnify_image=MagnifyImage(wand->images,wand->exception);
6546  if (magnify_image == (Image *) NULL)
6547    return(MagickFalse);
6548  ReplaceImageInList(&wand->images,magnify_image);
6549  return(MagickTrue);
6550}
6551
6552/*
6553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554%                                                                             %
6555%                                                                             %
6556%                                                                             %
6557%   M a g i c k M e r g e I m a g e L a y e r s                               %
6558%                                                                             %
6559%                                                                             %
6560%                                                                             %
6561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6562%
6563%  MagickMergeImageLayers() composes all the image layers from the current
6564%  given image onward to produce a single image of the merged layers.
6565%
6566%  The inital canvas's size depends on the given ImageLayerMethod, and is
6567%  initialized using the first images background color.  The images
6568%  are then compositied onto that image in sequence using the given
6569%  composition that has been assigned to each individual image.
6570%
6571%  The format of the MagickMergeImageLayers method is:
6572%
6573%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6574%        const ImageLayerMethod method)
6575%
6576%  A description of each parameter follows:
6577%
6578%    o wand: the magick wand.
6579%
6580%    o method: the method of selecting the size of the initial canvas.
6581%
6582%        MergeLayer: Merge all layers onto a canvas just large enough
6583%           to hold all the actual images. The virtual canvas of the
6584%           first image is preserved but otherwise ignored.
6585%
6586%        FlattenLayer: Use the virtual canvas size of first image.
6587%           Images which fall outside this canvas is clipped.
6588%           This can be used to 'fill out' a given virtual canvas.
6589%
6590%        MosaicLayer: Start with the virtual canvas of the first image,
6591%           enlarging left and right edges to contain all images.
6592%           Images with negative offsets will be clipped.
6593%
6594*/
6595WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6596  const ImageLayerMethod method)
6597{
6598  Image
6599    *mosaic_image;
6600
6601  assert(wand != (MagickWand *) NULL);
6602  assert(wand->signature == WandSignature);
6603  if( IfMagickTrue(wand->debug) )
6604    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6605
6606  if (wand->images == (Image *) NULL)
6607    return((MagickWand *) NULL);
6608  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6609  if (mosaic_image == (Image *) NULL)
6610    return((MagickWand *) NULL);
6611  return(CloneMagickWandFromImages(wand,mosaic_image));
6612}
6613
6614/*
6615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6616%                                                                             %
6617%                                                                             %
6618%                                                                             %
6619%   M a g i c k M i n i f y I m a g e                                         %
6620%                                                                             %
6621%                                                                             %
6622%                                                                             %
6623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6624%
6625%  MagickMinifyImage() is a convenience method that scales an image
6626%  proportionally to one-half its original size
6627%
6628%  The format of the MagickMinifyImage method is:
6629%
6630%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6631%
6632%  A description of each parameter follows:
6633%
6634%    o wand: the magick wand.
6635%
6636*/
6637WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6638{
6639  Image
6640    *minify_image;
6641
6642  assert(wand != (MagickWand *) NULL);
6643  assert(wand->signature == WandSignature);
6644  if( IfMagickTrue(wand->debug) )
6645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6646
6647  if (wand->images == (Image *) NULL)
6648    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6649  minify_image=MinifyImage(wand->images,wand->exception);
6650  if (minify_image == (Image *) NULL)
6651    return(MagickFalse);
6652  ReplaceImageInList(&wand->images,minify_image);
6653  return(MagickTrue);
6654}
6655
6656/*
6657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6658%                                                                             %
6659%                                                                             %
6660%                                                                             %
6661%   M a g i c k M o d u l a t e I m a g e                                     %
6662%                                                                             %
6663%                                                                             %
6664%                                                                             %
6665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6666%
6667%  MagickModulateImage() lets you control the brightness, saturation, and hue
6668%  of an image.  Hue is the percentage of absolute rotation from the current
6669%  position.  For example 50 results in a counter-clockwise rotation of 90
6670%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6671%  both resulting in a rotation of 180 degrees.
6672%
6673%  To increase the color brightness by 20% and decrease the color saturation by
6674%  10% and leave the hue unchanged, use: 120,90,100.
6675%
6676%  The format of the MagickModulateImage method is:
6677%
6678%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6679%        const double brightness,const double saturation,const double hue)
6680%
6681%  A description of each parameter follows:
6682%
6683%    o wand: the magick wand.
6684%
6685%    o brightness: the percent change in brighness.
6686%
6687%    o saturation: the percent change in saturation.
6688%
6689%    o hue: the percent change in hue.
6690%
6691*/
6692WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6693  const double brightness,const double saturation,const double hue)
6694{
6695  char
6696    modulate[MaxTextExtent];
6697
6698  MagickBooleanType
6699    status;
6700
6701  assert(wand != (MagickWand *) NULL);
6702  assert(wand->signature == WandSignature);
6703  if( IfMagickTrue(wand->debug) )
6704    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6705
6706  if (wand->images == (Image *) NULL)
6707    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6708  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6709    brightness,saturation,hue);
6710  status=ModulateImage(wand->images,modulate,wand->exception);
6711  return(status);
6712}
6713
6714/*
6715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6716%                                                                             %
6717%                                                                             %
6718%                                                                             %
6719%   M a g i c k M o n t a g e I m a g e                                       %
6720%                                                                             %
6721%                                                                             %
6722%                                                                             %
6723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6724%
6725%  MagickMontageImage() creates a composite image by combining several
6726%  separate images. The images are tiled on the composite image with the name
6727%  of the image optionally appearing just below the individual tile.
6728%
6729%  The format of the MagickMontageImage method is:
6730%
6731%      MagickWand *MagickMontageImage(MagickWand *wand,
6732%        const DrawingWand drawing_wand,const char *tile_geometry,
6733%        const char *thumbnail_geometry,const MontageMode mode,
6734%        const char *frame)
6735%
6736%  A description of each parameter follows:
6737%
6738%    o wand: the magick wand.
6739%
6740%    o drawing_wand: the drawing wand.  The font name, size, and color are
6741%      obtained from this wand.
6742%
6743%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6744%
6745%    o thumbnail_geometry: Preferred image size and border size of each
6746%      thumbnail (e.g. 120x120+4+3>).
6747%
6748%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6749%
6750%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6751%      The frame color is that of the thumbnail's matte color.
6752%
6753*/
6754WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6755  const DrawingWand *drawing_wand,const char *tile_geometry,
6756  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6757{
6758  char
6759    *font;
6760
6761  Image
6762    *montage_image;
6763
6764  MontageInfo
6765    *montage_info;
6766
6767  PixelWand
6768    *pixel_wand;
6769
6770  assert(wand != (MagickWand *) NULL);
6771  assert(wand->signature == WandSignature);
6772  if( IfMagickTrue(wand->debug) )
6773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6774
6775  if (wand->images == (Image *) NULL)
6776    return((MagickWand *) NULL);
6777  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6778  switch (mode)
6779  {
6780    case FrameMode:
6781    {
6782      (void) CloneString(&montage_info->frame,"15x15+3+3");
6783      montage_info->shadow=MagickTrue;
6784      break;
6785    }
6786    case UnframeMode:
6787    {
6788      montage_info->frame=(char *) NULL;
6789      montage_info->shadow=MagickFalse;
6790      montage_info->border_width=0;
6791      break;
6792    }
6793    case ConcatenateMode:
6794    {
6795      montage_info->frame=(char *) NULL;
6796      montage_info->shadow=MagickFalse;
6797      (void) CloneString(&montage_info->geometry,"+0+0");
6798      montage_info->border_width=0;
6799      break;
6800    }
6801    default:
6802      break;
6803  }
6804  font=DrawGetFont(drawing_wand);
6805  if (font != (char *) NULL)
6806    (void) CloneString(&montage_info->font,font);
6807  if (frame != (char *) NULL)
6808    (void) CloneString(&montage_info->frame,frame);
6809  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6810  pixel_wand=NewPixelWand();
6811  DrawGetFillColor(drawing_wand,pixel_wand);
6812  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6813  DrawGetStrokeColor(drawing_wand,pixel_wand);
6814  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6815  pixel_wand=DestroyPixelWand(pixel_wand);
6816  if (thumbnail_geometry != (char *) NULL)
6817    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6818  if (tile_geometry != (char *) NULL)
6819    (void) CloneString(&montage_info->tile,tile_geometry);
6820  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6821    wand->exception);
6822  montage_info=DestroyMontageInfo(montage_info);
6823  if (montage_image == (Image *) NULL)
6824    return((MagickWand *) NULL);
6825  return(CloneMagickWandFromImages(wand,montage_image));
6826}
6827
6828/*
6829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830%                                                                             %
6831%                                                                             %
6832%                                                                             %
6833%   M a g i c k M o r p h I m a g e s                                         %
6834%                                                                             %
6835%                                                                             %
6836%                                                                             %
6837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838%
6839%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6840%  and size are linearly interpolated to give the appearance of a
6841%  meta-morphosis from one image to the next.
6842%
6843%  The format of the MagickMorphImages method is:
6844%
6845%      MagickWand *MagickMorphImages(MagickWand *wand,
6846%        const size_t number_frames)
6847%
6848%  A description of each parameter follows:
6849%
6850%    o wand: the magick wand.
6851%
6852%    o number_frames: the number of in-between images to generate.
6853%
6854*/
6855WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6856  const size_t number_frames)
6857{
6858  Image
6859    *morph_image;
6860
6861  assert(wand != (MagickWand *) NULL);
6862  assert(wand->signature == WandSignature);
6863  if( IfMagickTrue(wand->debug) )
6864    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6865
6866  if (wand->images == (Image *) NULL)
6867    return((MagickWand *) NULL);
6868  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6869  if (morph_image == (Image *) NULL)
6870    return((MagickWand *) NULL);
6871  return(CloneMagickWandFromImages(wand,morph_image));
6872}
6873
6874/*
6875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6876%                                                                             %
6877%                                                                             %
6878%                                                                             %
6879%   M a g i c k M o r p h o l o g y I m a g e                                 %
6880%                                                                             %
6881%                                                                             %
6882%                                                                             %
6883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6884%
6885%  MagickMorphologyImage() applies a user supplied kernel to the image
6886%  according to the given mophology method.
6887%
6888%  The format of the MagickMorphologyImage method is:
6889%
6890%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6891%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6892%
6893%  A description of each parameter follows:
6894%
6895%    o wand: the magick wand.
6896%
6897%    o method: the morphology method to be applied.
6898%
6899%    o iterations: apply the operation this many times (or no change).
6900%      A value of -1 means loop until no change found.  How this is applied
6901%      may depend on the morphology method.  Typically this is a value of 1.
6902%
6903%    o kernel: An array of doubles representing the morphology kernel.
6904%
6905*/
6906WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6907  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6908{
6909  Image
6910    *morphology_image;
6911
6912  assert(wand != (MagickWand *) NULL);
6913  assert(wand->signature == WandSignature);
6914  if( IfMagickTrue(wand->debug) )
6915    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6916
6917  if (kernel == (const KernelInfo *) NULL)
6918    return(MagickFalse);
6919  if (wand->images == (Image *) NULL)
6920    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6921  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6922    wand->exception);
6923  if (morphology_image == (Image *) NULL)
6924    return(MagickFalse);
6925  ReplaceImageInList(&wand->images,morphology_image);
6926  return(MagickTrue);
6927}
6928
6929/*
6930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6931%                                                                             %
6932%                                                                             %
6933%                                                                             %
6934%   M a g i c k M o t i o n B l u r I m a g e                                 %
6935%                                                                             %
6936%                                                                             %
6937%                                                                             %
6938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6939%
6940%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6941%  Gaussian operator of the given radius and standard deviation (sigma).
6942%  For reasonable results, radius should be larger than sigma.  Use a
6943%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6944%  Angle gives the angle of the blurring motion.
6945%
6946%  The format of the MagickMotionBlurImage method is:
6947%
6948%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6949%        const double radius,const double sigma,const double angle)
6950%
6951%  A description of each parameter follows:
6952%
6953%    o wand: the magick wand.
6954%
6955%    o radius: the radius of the Gaussian, in pixels, not counting
6956%      the center pixel.
6957%
6958%    o sigma: the standard deviation of the Gaussian, in pixels.
6959%
6960%    o angle: Apply the effect along this angle.
6961%
6962*/
6963WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6964  const double radius,const double sigma,const double angle)
6965{
6966  Image
6967    *blur_image;
6968
6969  assert(wand != (MagickWand *) NULL);
6970  assert(wand->signature == WandSignature);
6971  if( IfMagickTrue(wand->debug) )
6972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6973
6974  if (wand->images == (Image *) NULL)
6975    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6976  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6977  if (blur_image == (Image *) NULL)
6978    return(MagickFalse);
6979  ReplaceImageInList(&wand->images,blur_image);
6980  return(MagickTrue);
6981}
6982
6983/*
6984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6985%                                                                             %
6986%                                                                             %
6987%                                                                             %
6988%   M a g i c k N e g a t e I m a g e                                         %
6989%                                                                             %
6990%                                                                             %
6991%                                                                             %
6992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6993%
6994%  MagickNegateImage() negates the colors in the reference image.  The
6995%  Grayscale option means that only grayscale values within the image are
6996%  negated.
6997%
6998%  You can also reduce the influence of a particular channel with a gamma
6999%  value of 0.
7000%
7001%  The format of the MagickNegateImage method is:
7002%
7003%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7004%        const MagickBooleanType gray)
7005%
7006%  A description of each parameter follows:
7007%
7008%    o wand: the magick wand.
7009%
7010%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7011%
7012*/
7013WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7014  const MagickBooleanType gray)
7015{
7016  MagickBooleanType
7017    status;
7018
7019  assert(wand != (MagickWand *) NULL);
7020  assert(wand->signature == WandSignature);
7021  if( IfMagickTrue(wand->debug) )
7022    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7023
7024  if (wand->images == (Image *) NULL)
7025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7026  status=NegateImage(wand->images,gray,wand->exception);
7027  return(status);
7028}
7029
7030/*
7031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7032%                                                                             %
7033%                                                                             %
7034%                                                                             %
7035%   M a g i c k N e w I m a g e                                               %
7036%                                                                             %
7037%                                                                             %
7038%                                                                             %
7039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7040%
7041%  MagickNewImage() adds a blank image canvas of the specified size and
7042%  background color to the wand.
7043%
7044%  The format of the MagickNewImage method is:
7045%
7046%      MagickBooleanType MagickNewImage(MagickWand *wand,
7047%        const size_t columns,const size_t rows,
7048%        const PixelWand *background)
7049%
7050%  A description of each parameter follows:
7051%
7052%    o wand: the magick wand.
7053%
7054%    o width: the image width.
7055%
7056%    o height: the image height.
7057%
7058%    o background: the image color.
7059%
7060*/
7061WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7062  const size_t height,const PixelWand *background)
7063{
7064  Image
7065    *images;
7066
7067  PixelInfo
7068    pixel;
7069
7070  assert(wand != (MagickWand *) NULL);
7071  assert(wand->signature == WandSignature);
7072  if( IfMagickTrue(wand->debug) )
7073    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7074
7075  PixelGetMagickColor(background,&pixel);
7076  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7077  if (images == (Image *) NULL)
7078    return(MagickFalse);
7079  return(InsertImageInWand(wand,images));
7080}
7081
7082/*
7083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7084%                                                                             %
7085%                                                                             %
7086%                                                                             %
7087%   M a g i c k N e x t I m a g e                                             %
7088%                                                                             %
7089%                                                                             %
7090%                                                                             %
7091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092%
7093%  MagickNextImage() sets the next image in the wand as the current image.
7094%
7095%  It is typically used after MagickResetIterator(), after which its first use
7096%  will set the first image as the current image (unless the wand is empty).
7097%
7098%  It will return MagickFalse when no more images are left to be returned
7099%  which happens when the wand is empty, or the current image is the last
7100%  image.
7101%
7102%  When the above condition (end of image list) is reached, the iterator is
7103%  automaticall set so that you can start using MagickPreviousImage() to
7104%  again iterate over the images in the reverse direction, starting with the
7105%  last image (again).  You can jump to this condition immeditally using
7106%  MagickSetLastIterator().
7107%
7108%  The format of the MagickNextImage method is:
7109%
7110%      MagickBooleanType MagickNextImage(MagickWand *wand)
7111%
7112%  A description of each parameter follows:
7113%
7114%    o wand: the magick wand.
7115%
7116*/
7117WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7118{
7119  assert(wand != (MagickWand *) NULL);
7120  assert(wand->signature == WandSignature);
7121  if( IfMagickTrue(wand->debug) )
7122    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7123
7124  if (wand->images == (Image *) NULL)
7125    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7126  wand->insert_before=MagickFalse; /* Inserts is now appended */
7127  if( IfMagickTrue(wand->image_pending) )
7128    {
7129      wand->image_pending=MagickFalse;
7130      return(MagickTrue);
7131    }
7132  if (GetNextImageInList(wand->images) == (Image *) NULL)
7133    {
7134      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7135      return(MagickFalse);
7136    }
7137  wand->images=GetNextImageInList(wand->images);
7138  return(MagickTrue);
7139}
7140
7141/*
7142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143%                                                                             %
7144%                                                                             %
7145%                                                                             %
7146%   M a g i c k N o r m a l i z e I m a g e                                   %
7147%                                                                             %
7148%                                                                             %
7149%                                                                             %
7150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151%
7152%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7153%  the pixels color to span the entire range of colors available
7154%
7155%  You can also reduce the influence of a particular channel with a gamma
7156%  value of 0.
7157%
7158%  The format of the MagickNormalizeImage method is:
7159%
7160%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7161%
7162%  A description of each parameter follows:
7163%
7164%    o wand: the magick wand.
7165%
7166*/
7167WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7168{
7169  MagickBooleanType
7170    status;
7171
7172  assert(wand != (MagickWand *) NULL);
7173  assert(wand->signature == WandSignature);
7174  if( IfMagickTrue(wand->debug) )
7175    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7176
7177  if (wand->images == (Image *) NULL)
7178    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7179  status=NormalizeImage(wand->images,wand->exception);
7180  return(status);
7181}
7182
7183/*
7184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7185%                                                                             %
7186%                                                                             %
7187%                                                                             %
7188%   M a g i c k O i l P a i n t I m a g e                                     %
7189%                                                                             %
7190%                                                                             %
7191%                                                                             %
7192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7193%
7194%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7195%  painting.  Each pixel is replaced by the most frequent color occurring
7196%  in a circular region defined by radius.
7197%
7198%  The format of the MagickOilPaintImage method is:
7199%
7200%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7201%        const double radius,const double sigma)
7202%
7203%  A description of each parameter follows:
7204%
7205%    o wand: the magick wand.
7206%
7207%    o radius: the radius of the circular neighborhood.
7208%
7209%    o sigma: the standard deviation of the Gaussian, in pixels.
7210%
7211*/
7212WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7213  const double radius,const double sigma)
7214{
7215  Image
7216    *paint_image;
7217
7218  assert(wand != (MagickWand *) NULL);
7219  assert(wand->signature == WandSignature);
7220  if( IfMagickTrue(wand->debug) )
7221    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7222
7223  if (wand->images == (Image *) NULL)
7224    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7225  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7226  if (paint_image == (Image *) NULL)
7227    return(MagickFalse);
7228  ReplaceImageInList(&wand->images,paint_image);
7229  return(MagickTrue);
7230}
7231
7232/*
7233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7234%                                                                             %
7235%                                                                             %
7236%                                                                             %
7237%   M a g i c k O p a q u e P a i n t I m a g e                               %
7238%                                                                             %
7239%                                                                             %
7240%                                                                             %
7241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7242%
7243%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7244%  defined by fill.
7245%
7246%  The format of the MagickOpaquePaintImage method is:
7247%
7248%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7249%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7250%        const MagickBooleanType invert)
7251%
7252%  A description of each parameter follows:
7253%
7254%    o wand: the magick wand.
7255%
7256%    o target: Change this target color to the fill color within the image.
7257%
7258%    o fill: the fill pixel wand.
7259%
7260%    o fuzz: By default target must match a particular pixel color
7261%      exactly.  However, in many cases two colors may differ by a small amount.
7262%      The fuzz member of image defines how much tolerance is acceptable to
7263%      consider two colors as the same.  For example, set fuzz to 10 and the
7264%      color red at intensities of 100 and 102 respectively are now interpreted
7265%      as the same color for the purposes of the floodfill.
7266%
7267%    o invert: paint any pixel that does not match the target color.
7268%
7269*/
7270WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7271  const PixelWand *target,const PixelWand *fill,const double fuzz,
7272  const MagickBooleanType invert)
7273{
7274  MagickBooleanType
7275    status;
7276
7277  PixelInfo
7278    fill_pixel,
7279    target_pixel;
7280
7281  assert(wand != (MagickWand *) NULL);
7282  assert(wand->signature == WandSignature);
7283  if( IfMagickTrue(wand->debug) )
7284    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7285
7286  if (wand->images == (Image *) NULL)
7287    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7288  PixelGetMagickColor(target,&target_pixel);
7289  PixelGetMagickColor(fill,&fill_pixel);
7290  wand->images->fuzz=fuzz;
7291  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7292    wand->exception);
7293  return(status);
7294}
7295
7296/*
7297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298%                                                                             %
7299%                                                                             %
7300%                                                                             %
7301%   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                         %
7302%                                                                             %
7303%                                                                             %
7304%                                                                             %
7305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7306%
7307%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7308%  previous image in the sequence.  From this it attempts to select the
7309%  smallest cropped image to replace each frame, while preserving the results
7310%  of the animation.
7311%
7312%  The format of the MagickOptimizeImageLayers method is:
7313%
7314%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7315%
7316%  A description of each parameter follows:
7317%
7318%    o wand: the magick wand.
7319%
7320*/
7321WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7322{
7323  Image
7324    *optimize_image;
7325
7326  assert(wand != (MagickWand *) NULL);
7327  assert(wand->signature == WandSignature);
7328  if( IfMagickTrue(wand->debug) )
7329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7330
7331  if (wand->images == (Image *) NULL)
7332    return((MagickWand *) NULL);
7333  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7334  if (optimize_image == (Image *) NULL)
7335    return((MagickWand *) NULL);
7336  return(CloneMagickWandFromImages(wand,optimize_image));
7337}
7338
7339/*
7340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7341%                                                                             %
7342%                                                                             %
7343%                                                                             %
7344%   M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y             %
7345%                                                                             %
7346%                                                                             %
7347%                                                                             %
7348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7349%
7350%  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7351%  compares the overlayed pixels against the disposal image resulting from all
7352%  the previous frames in the animation.  Any pixel that does not change the
7353%  disposal image (and thus does not effect the outcome of an overlay) is made
7354%  transparent.
7355%
7356%  WARNING: This modifies the current images directly, rather than generate
7357%  a new image sequence.
7358%  The format of the MagickOptimizeImageTransparency method is:
7359%
7360%      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7361%
7362%  A description of each parameter follows:
7363%
7364%    o wand: the magick wand.
7365%
7366*/
7367WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7368{
7369  assert(wand != (MagickWand *) NULL);
7370  assert(wand->signature == WandSignature);
7371  if( IfMagickTrue(wand->debug) )
7372    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7373  if (wand->images == (Image *) NULL)
7374    return(MagickFalse);
7375  OptimizeImageTransparency(wand->images,wand->exception);
7376  return(MagickTrue);
7377}
7378
7379/*
7380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7381%                                                                             %
7382%                                                                             %
7383%                                                                             %
7384%     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                   %
7385%                                                                             %
7386%                                                                             %
7387%                                                                             %
7388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7389%
7390%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7391%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7392%  which can be different for different channels, according to the input
7393%  arguments.
7394%
7395%  The format of the MagickOrderedPosterizeImage method is:
7396%
7397%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7398%        const char *threshold_map)
7399%
7400%  A description of each parameter follows:
7401%
7402%    o image: the image.
7403%
7404%    o threshold_map: A string containing the name of the threshold dither
7405%      map to use, followed by zero or more numbers representing the number of
7406%      color levels tho dither between.
7407%
7408%      Any level number less than 2 is equivalent to 2, and means only binary
7409%      dithering will be applied to each color channel.
7410%
7411%      No numbers also means a 2 level (bitmap) dither will be applied to all
7412%      channels, while a single number is the number of levels applied to each
7413%      channel in sequence.  More numbers will be applied in turn to each of
7414%      the color channels.
7415%
7416%      For example: "o3x3,6" generates a 6 level posterization of the image
7417%      with a ordered 3x3 diffused pixel dither being applied between each
7418%      level. While checker,8,8,4 will produce a 332 colormaped image with
7419%      only a single checkerboard hash pattern (50% grey) between each color
7420%      level, to basically double the number of color levels with a bare
7421%      minimim of dithering.
7422%
7423*/
7424WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7425  const char *threshold_map)
7426{
7427  MagickBooleanType
7428    status;
7429
7430  assert(wand != (MagickWand *) NULL);
7431  assert(wand->signature == WandSignature);
7432  if( IfMagickTrue(wand->debug) )
7433    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7434
7435  if (wand->images == (Image *) NULL)
7436    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7437  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7438  return(status);
7439}
7440
7441/*
7442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7443%                                                                             %
7444%                                                                             %
7445%                                                                             %
7446%   M a g i c k P i n g I m a g e                                             %
7447%                                                                             %
7448%                                                                             %
7449%                                                                             %
7450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7451%
7452%  MagickPingImage() is the same as MagickReadImage() except the only valid
7453%  information returned is the image width, height, size, and format.  It
7454%  is designed to efficiently obtain this information from a file without
7455%  reading the entire image sequence into memory.
7456%
7457%  The format of the MagickPingImage method is:
7458%
7459%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7460%
7461%  A description of each parameter follows:
7462%
7463%    o wand: the magick wand.
7464%
7465%    o filename: the image filename.
7466%
7467*/
7468WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7469  const char *filename)
7470{
7471  Image
7472    *images;
7473
7474  ImageInfo
7475    *ping_info;
7476
7477  assert(wand != (MagickWand *) NULL);
7478  assert(wand->signature == WandSignature);
7479  if( IfMagickTrue(wand->debug) )
7480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7481
7482  ping_info=CloneImageInfo(wand->image_info);
7483  if (filename != (const char *) NULL)
7484    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7485  images=PingImage(ping_info,wand->exception);
7486  ping_info=DestroyImageInfo(ping_info);
7487  if (images == (Image *) NULL)
7488    return(MagickFalse);
7489  return(InsertImageInWand(wand,images));
7490}
7491
7492/*
7493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7494%                                                                             %
7495%                                                                             %
7496%                                                                             %
7497%   M a g i c k P i n g I m a g e B l o b                                     %
7498%                                                                             %
7499%                                                                             %
7500%                                                                             %
7501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7502%
7503%  MagickPingImageBlob() pings an image or image sequence from a blob.
7504%
7505%  The format of the MagickPingImageBlob method is:
7506%
7507%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7508%        const void *blob,const size_t length)
7509%
7510%  A description of each parameter follows:
7511%
7512%    o wand: the magick wand.
7513%
7514%    o blob: the blob.
7515%
7516%    o length: the blob length.
7517%
7518*/
7519WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7520  const void *blob,const size_t length)
7521{
7522  Image
7523    *images;
7524
7525  ImageInfo
7526    *read_info;
7527
7528  assert(wand != (MagickWand *) NULL);
7529  assert(wand->signature == WandSignature);
7530  if( IfMagickTrue(wand->debug) )
7531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7532
7533  read_info=CloneImageInfo(wand->image_info);
7534  SetImageInfoBlob(read_info,blob,length);
7535  images=PingImage(read_info,wand->exception);
7536  read_info=DestroyImageInfo(read_info);
7537  if (images == (Image *) NULL)
7538    return(MagickFalse);
7539  return(InsertImageInWand(wand,images));
7540}
7541
7542/*
7543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7544%                                                                             %
7545%                                                                             %
7546%                                                                             %
7547%   M a g i c k P i n g I m a g e F i l e                                     %
7548%                                                                             %
7549%                                                                             %
7550%                                                                             %
7551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7552%
7553%  MagickPingImageFile() pings an image or image sequence from an open file
7554%  descriptor.
7555%
7556%  The format of the MagickPingImageFile method is:
7557%
7558%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7559%
7560%  A description of each parameter follows:
7561%
7562%    o wand: the magick wand.
7563%
7564%    o file: the file descriptor.
7565%
7566*/
7567WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7568{
7569  Image
7570    *images;
7571
7572  ImageInfo
7573    *read_info;
7574
7575  assert(wand != (MagickWand *) NULL);
7576  assert(wand->signature == WandSignature);
7577  assert(file != (FILE *) NULL);
7578  if( IfMagickTrue(wand->debug) )
7579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7580
7581  read_info=CloneImageInfo(wand->image_info);
7582  SetImageInfoFile(read_info,file);
7583  images=PingImage(read_info,wand->exception);
7584  read_info=DestroyImageInfo(read_info);
7585  if (images == (Image *) NULL)
7586    return(MagickFalse);
7587  return(InsertImageInWand(wand,images));
7588}
7589
7590/*
7591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7592%                                                                             %
7593%                                                                             %
7594%                                                                             %
7595%   M a g i c k P o l a r o i d I m a g e                                     %
7596%                                                                             %
7597%                                                                             %
7598%                                                                             %
7599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7600%
7601%  MagickPolaroidImage() simulates a Polaroid picture.
7602%
7603%  The format of the MagickPolaroidImage method is:
7604%
7605%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7606%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7607%        const PixelInterpolateMethod method)
7608%
7609%  A description of each parameter follows:
7610%
7611%    o wand: the magick wand.
7612%
7613%    o drawing_wand: the draw wand.
7614%
7615%    o caption: the Polaroid caption.
7616%
7617%    o angle: Apply the effect along this angle.
7618%
7619%    o method: the pixel interpolation method.
7620%
7621*/
7622WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7623  const DrawingWand *drawing_wand,const char *caption,const double angle,
7624  const PixelInterpolateMethod method)
7625{
7626  DrawInfo
7627    *draw_info;
7628
7629  Image
7630    *polaroid_image;
7631
7632  assert(wand != (MagickWand *) NULL);
7633  assert(wand->signature == WandSignature);
7634  if( IfMagickTrue(wand->debug) )
7635    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7636
7637  if (wand->images == (Image *) NULL)
7638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7639  draw_info=PeekDrawingWand(drawing_wand);
7640  if (draw_info == (DrawInfo *) NULL)
7641    return(MagickFalse);
7642  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7643    wand->exception);
7644  if (polaroid_image == (Image *) NULL)
7645    return(MagickFalse);
7646  ReplaceImageInList(&wand->images,polaroid_image);
7647  return(MagickTrue);
7648}
7649
7650/*
7651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7652%                                                                             %
7653%                                                                             %
7654%                                                                             %
7655%   M a g i c k P o s t e r i z e I m a g e                                   %
7656%                                                                             %
7657%                                                                             %
7658%                                                                             %
7659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7660%
7661%  MagickPosterizeImage() reduces the image to a limited number of color level.
7662%
7663%  The format of the MagickPosterizeImage method is:
7664%
7665%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7666%        const size_t levels,const DitherMethod method)
7667%
7668%  A description of each parameter follows:
7669%
7670%    o wand: the magick wand.
7671%
7672%    o levels: Number of color levels allowed in each channel.  Very low values
7673%      (2, 3, or 4) have the most visible effect.
7674%
7675%    o method: choose the dither method: UndefinedDitherMethod,
7676%      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7677%
7678*/
7679WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7680  const size_t levels,const DitherMethod dither)
7681{
7682  MagickBooleanType
7683    status;
7684
7685  assert(wand != (MagickWand *) NULL);
7686  assert(wand->signature == WandSignature);
7687  if( IfMagickTrue(wand->debug) )
7688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7689
7690  if (wand->images == (Image *) NULL)
7691    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7692  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7693  return(status);
7694}
7695
7696/*
7697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7698%                                                                             %
7699%                                                                             %
7700%                                                                             %
7701%   M a g i c k P r e v i e w I m a g e s                                     %
7702%                                                                             %
7703%                                                                             %
7704%                                                                             %
7705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7706%
7707%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7708%  image processing operation applied at varying strengths.  This helpful
7709%  to quickly pin-point an appropriate parameter for an image processing
7710%  operation.
7711%
7712%  The format of the MagickPreviewImages method is:
7713%
7714%      MagickWand *MagickPreviewImages(MagickWand *wand,
7715%        const PreviewType preview)
7716%
7717%  A description of each parameter follows:
7718%
7719%    o wand: the magick wand.
7720%
7721%    o preview: the preview type.
7722%
7723*/
7724WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7725  const PreviewType preview)
7726{
7727  Image
7728    *preview_image;
7729
7730  assert(wand != (MagickWand *) NULL);
7731  assert(wand->signature == WandSignature);
7732  if( IfMagickTrue(wand->debug) )
7733    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7734
7735  if (wand->images == (Image *) NULL)
7736    return((MagickWand *) NULL);
7737  preview_image=PreviewImage(wand->images,preview,wand->exception);
7738  if (preview_image == (Image *) NULL)
7739    return((MagickWand *) NULL);
7740  return(CloneMagickWandFromImages(wand,preview_image));
7741}
7742
7743/*
7744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7745%                                                                             %
7746%                                                                             %
7747%                                                                             %
7748%   M a g i c k P r e v i o u s I m a g e                                     %
7749%                                                                             %
7750%                                                                             %
7751%                                                                             %
7752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7753%
7754%  MagickPreviousImage() sets the previous image in the wand as the current
7755%  image.
7756%
7757%  It is typically used after MagickSetLastIterator(), after which its first
7758%  use will set the last image as the current image (unless the wand is empty).
7759%
7760%  It will return MagickFalse when no more images are left to be returned
7761%  which happens when the wand is empty, or the current image is the first
7762%  image.  At that point the iterator is than reset to again process images in
7763%  the forward direction, again starting with the first image in list. Images
7764%  added at this point are prepended.
7765%
7766%  Also at that point any images added to the wand using MagickAddImages() or
7767%  MagickReadImages() will be prepended before the first image. In this sense
7768%  the condition is not quite exactly the same as MagickResetIterator().
7769%
7770%  The format of the MagickPreviousImage method is:
7771%
7772%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7773%
7774%  A description of each parameter follows:
7775%
7776%    o wand: the magick wand.
7777%
7778*/
7779WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7780{
7781  assert(wand != (MagickWand *) NULL);
7782  assert(wand->signature == WandSignature);
7783  if( IfMagickTrue(wand->debug) )
7784    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7785
7786  if (wand->images == (Image *) NULL)
7787    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7788
7789  if( IfMagickTrue(wand->image_pending) )
7790    {
7791      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7792      return(MagickTrue);
7793    }
7794  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7795    {
7796      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7797      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7798      return(MagickFalse);
7799    }
7800  wand->images=GetPreviousImageInList(wand->images);
7801  return(MagickTrue);
7802}
7803
7804/*
7805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7806%                                                                             %
7807%                                                                             %
7808%                                                                             %
7809%   M a g i c k Q u a n t i z e I m a g e                                     %
7810%                                                                             %
7811%                                                                             %
7812%                                                                             %
7813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7814%
7815%  MagickQuantizeImage() analyzes the colors within a reference image and
7816%  chooses a fixed number of colors to represent the image.  The goal of the
7817%  algorithm is to minimize the color difference between the input and output
7818%  image while minimizing the processing time.
7819%
7820%  The format of the MagickQuantizeImage method is:
7821%
7822%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7823%        const size_t number_colors,const ColorspaceType colorspace,
7824%        const size_t treedepth,const DitherMethod dither_method,
7825%        const MagickBooleanType measure_error)
7826%
7827%  A description of each parameter follows:
7828%
7829%    o wand: the magick wand.
7830%
7831%    o number_colors: the number of colors.
7832%
7833%    o colorspace: Perform color reduction in this colorspace, typically
7834%      RGBColorspace.
7835%
7836%    o treedepth: Normally, this integer value is zero or one.  A zero or
7837%      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
7838%      reference image with the least amount of memory and the fastest
7839%      computational speed.  In some cases, such as an image with low color
7840%      dispersion (a few number of colors), a value other than
7841%      Log4(number_colors) is required.  To expand the color tree completely,
7842%      use a value of 8.
7843%
7844%    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7845%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7846%
7847%    o measure_error: A value other than zero measures the difference between
7848%      the original and quantized images.  This difference is the total
7849%      quantization error.  The error is computed by summing over all pixels
7850%      in an image the distance squared in RGB space between each reference
7851%      pixel value and its quantized value.
7852%
7853*/
7854WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7855  const size_t number_colors,const ColorspaceType colorspace,
7856  const size_t treedepth,const DitherMethod dither_method,
7857  const MagickBooleanType measure_error)
7858{
7859  MagickBooleanType
7860    status;
7861
7862  QuantizeInfo
7863    *quantize_info;
7864
7865  assert(wand != (MagickWand *) NULL);
7866  assert(wand->signature == WandSignature);
7867  if( IfMagickTrue(wand->debug) )
7868    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7869
7870  if (wand->images == (Image *) NULL)
7871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7872  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7873  quantize_info->number_colors=number_colors;
7874  quantize_info->dither_method=dither_method;
7875  quantize_info->tree_depth=treedepth;
7876  quantize_info->colorspace=colorspace;
7877  quantize_info->measure_error=measure_error;
7878  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7879  quantize_info=DestroyQuantizeInfo(quantize_info);
7880  return(status);
7881}
7882
7883/*
7884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7885%                                                                             %
7886%                                                                             %
7887%                                                                             %
7888%   M a g i c k Q u a n t i z e I m a g e s                                   %
7889%                                                                             %
7890%                                                                             %
7891%                                                                             %
7892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7893%
7894%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7895%  chooses a fixed number of colors to represent the image.  The goal of the
7896%  algorithm is to minimize the color difference between the input and output
7897%  image while minimizing the processing time.
7898%
7899%  The format of the MagickQuantizeImages method is:
7900%
7901%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7902%        const size_t number_colors,const ColorspaceType colorspace,
7903%        const size_t treedepth,const DitherMethod dither_method,
7904%        const MagickBooleanType measure_error)
7905%
7906%  A description of each parameter follows:
7907%
7908%    o wand: the magick wand.
7909%
7910%    o number_colors: the number of colors.
7911%
7912%    o colorspace: Perform color reduction in this colorspace, typically
7913%      RGBColorspace.
7914%
7915%    o treedepth: Normally, this integer value is zero or one.  A zero or
7916%      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
7917%      reference image with the least amount of memory and the fastest
7918%      computational speed.  In some cases, such as an image with low color
7919%      dispersion (a few number of colors), a value other than
7920%      Log4(number_colors) is required.  To expand the color tree completely,
7921%      use a value of 8.
7922%
7923%    o dither_method: choose from these dither methods: NoDitherMethod,
7924%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7925%
7926%    o measure_error: A value other than zero measures the difference between
7927%      the original and quantized images.  This difference is the total
7928%      quantization error.  The error is computed by summing over all pixels
7929%      in an image the distance squared in RGB space between each reference
7930%      pixel value and its quantized value.
7931%
7932*/
7933WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7934  const size_t number_colors,const ColorspaceType colorspace,
7935  const size_t treedepth,const DitherMethod dither_method,
7936  const MagickBooleanType measure_error)
7937{
7938  MagickBooleanType
7939    status;
7940
7941  QuantizeInfo
7942    *quantize_info;
7943
7944  assert(wand != (MagickWand *) NULL);
7945  assert(wand->signature == WandSignature);
7946  if( IfMagickTrue(wand->debug) )
7947    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7948
7949  if (wand->images == (Image *) NULL)
7950    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7951  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7952  quantize_info->number_colors=number_colors;
7953  quantize_info->dither_method=dither_method;
7954  quantize_info->tree_depth=treedepth;
7955  quantize_info->colorspace=colorspace;
7956  quantize_info->measure_error=measure_error;
7957  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7958  quantize_info=DestroyQuantizeInfo(quantize_info);
7959  return(status);
7960}
7961
7962/*
7963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7964%                                                                             %
7965%                                                                             %
7966%                                                                             %
7967%   M a g i c k R a d i a l B l u r I m a g e                                 %
7968%                                                                             %
7969%                                                                             %
7970%                                                                             %
7971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7972%
7973%  MagickRadialBlurImage() radial blurs an image.
7974%
7975%  The format of the MagickRadialBlurImage method is:
7976%
7977%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7978%        const double angle)
7979%
7980%  A description of each parameter follows:
7981%
7982%    o wand: the magick wand.
7983%
7984%    o angle: the angle of the blur in degrees.
7985%
7986*/
7987WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7988  const double angle)
7989{
7990  Image
7991    *blur_image;
7992
7993  assert(wand != (MagickWand *) NULL);
7994  assert(wand->signature == WandSignature);
7995  if( IfMagickTrue(wand->debug) )
7996    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7997
7998  if (wand->images == (Image *) NULL)
7999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8000  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
8001  if (blur_image == (Image *) NULL)
8002    return(MagickFalse);
8003  ReplaceImageInList(&wand->images,blur_image);
8004  return(MagickTrue);
8005}
8006
8007/*
8008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8009%                                                                             %
8010%                                                                             %
8011%                                                                             %
8012%   M a g i c k R a i s e I m a g e                                           %
8013%                                                                             %
8014%                                                                             %
8015%                                                                             %
8016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8017%
8018%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8019%  by lightening and darkening the edges of the image.  Members width and
8020%  height of raise_info define the width of the vertical and horizontal
8021%  edge of the effect.
8022%
8023%  The format of the MagickRaiseImage method is:
8024%
8025%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8026%        const size_t width,const size_t height,const ssize_t x,
8027%        const ssize_t y,const MagickBooleanType raise)
8028%
8029%  A description of each parameter follows:
8030%
8031%    o wand: the magick wand.
8032%
8033%    o width,height,x,y:  Define the dimensions of the area to raise.
8034%
8035%    o raise: A value other than zero creates a 3-D raise effect,
8036%      otherwise it has a lowered effect.
8037%
8038*/
8039WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8040  const size_t width,const size_t height,const ssize_t x,
8041  const ssize_t y,const MagickBooleanType raise)
8042{
8043  MagickBooleanType
8044    status;
8045
8046  RectangleInfo
8047    raise_info;
8048
8049  assert(wand != (MagickWand *) NULL);
8050  assert(wand->signature == WandSignature);
8051  if( IfMagickTrue(wand->debug) )
8052    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8053
8054  if (wand->images == (Image *) NULL)
8055    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8056  raise_info.width=width;
8057  raise_info.height=height;
8058  raise_info.x=x;
8059  raise_info.y=y;
8060  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8061  return(status);
8062}
8063
8064/*
8065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8066%                                                                             %
8067%                                                                             %
8068%                                                                             %
8069%   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                       %
8070%                                                                             %
8071%                                                                             %
8072%                                                                             %
8073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8074%
8075%  MagickRandomThresholdImage() changes the value of individual pixels based on
8076%  the intensity of each pixel compared to threshold.  The result is a
8077%  high-contrast, two color image.
8078%
8079%  The format of the MagickRandomThresholdImage method is:
8080%
8081%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8082%        const double low,const double high)
8083%
8084%  A description of each parameter follows:
8085%
8086%    o wand: the magick wand.
8087%
8088%    o low,high: Specify the high and low thresholds.  These values range from
8089%      0 to QuantumRange.
8090%
8091*/
8092WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8093  const double low,const double high)
8094{
8095  char
8096    threshold[MaxTextExtent];
8097
8098  assert(wand != (MagickWand *) NULL);
8099  assert(wand->signature == WandSignature);
8100  if( IfMagickTrue(wand->debug) )
8101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8102
8103  if (wand->images == (Image *) NULL)
8104    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8105  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8106  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8107}
8108
8109/*
8110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8111%                                                                             %
8112%                                                                             %
8113%                                                                             %
8114%   M a g i c k R e a d I m a g e                                             %
8115%                                                                             %
8116%                                                                             %
8117%                                                                             %
8118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8119%
8120%  MagickReadImage() reads an image or image sequence.  The images are inserted
8121%  jjust before the current image pointer position.
8122%
8123%  Use MagickSetFirstIterator(), to insert new images before all the current
8124%  images in the wand, MagickSetLastIterator() to append add to the end,
8125%  MagickSetImageIndex() to place images just after the given index.
8126%
8127%  The format of the MagickReadImage method is:
8128%
8129%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8130%
8131%  A description of each parameter follows:
8132%
8133%    o wand: the magick wand.
8134%
8135%    o filename: the image filename.
8136%
8137*/
8138WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8139  const char *filename)
8140{
8141  Image
8142    *images;
8143
8144  ImageInfo
8145    *read_info;
8146
8147  assert(wand != (MagickWand *) NULL);
8148  assert(wand->signature == WandSignature);
8149  if( IfMagickTrue(wand->debug) )
8150    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8151
8152  read_info=CloneImageInfo(wand->image_info);
8153  if (filename != (const char *) NULL)
8154    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8155  images=ReadImage(read_info,wand->exception);
8156  read_info=DestroyImageInfo(read_info);
8157  if (images == (Image *) NULL)
8158    return(MagickFalse);
8159  return(InsertImageInWand(wand,images));
8160}
8161
8162/*
8163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8164%                                                                             %
8165%                                                                             %
8166%                                                                             %
8167%   M a g i c k R e a d I m a g e B l o b                                     %
8168%                                                                             %
8169%                                                                             %
8170%                                                                             %
8171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8172%
8173%  MagickReadImageBlob() reads an image or image sequence from a blob.
8174%  In all other respects it is like MagickReadImage().
8175%
8176%  The format of the MagickReadImageBlob method is:
8177%
8178%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8179%        const void *blob,const size_t length)
8180%
8181%  A description of each parameter follows:
8182%
8183%    o wand: the magick wand.
8184%
8185%    o blob: the blob.
8186%
8187%    o length: the blob length.
8188%
8189*/
8190WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8191  const void *blob,const size_t length)
8192{
8193  Image
8194    *images;
8195
8196  assert(wand != (MagickWand *) NULL);
8197  assert(wand->signature == WandSignature);
8198  if( IfMagickTrue(wand->debug) )
8199    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8200
8201  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8202  if (images == (Image *) NULL)
8203    return(MagickFalse);
8204  return(InsertImageInWand(wand,images));
8205}
8206
8207/*
8208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8209%                                                                             %
8210%                                                                             %
8211%                                                                             %
8212%   M a g i c k R e a d I m a g e F i l e                                     %
8213%                                                                             %
8214%                                                                             %
8215%                                                                             %
8216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8217%
8218%  MagickReadImageFile() reads an image or image sequence from an already
8219%  opened file descriptor.  Otherwise it is like MagickReadImage().
8220%
8221%  The format of the MagickReadImageFile method is:
8222%
8223%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8224%
8225%  A description of each parameter follows:
8226%
8227%    o wand: the magick wand.
8228%
8229%    o file: the file descriptor.
8230%
8231*/
8232WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8233{
8234  Image
8235    *images;
8236
8237  ImageInfo
8238    *read_info;
8239
8240  assert(wand != (MagickWand *) NULL);
8241  assert(wand->signature == WandSignature);
8242  assert(file != (FILE *) NULL);
8243  if( IfMagickTrue(wand->debug) )
8244    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8245
8246  read_info=CloneImageInfo(wand->image_info);
8247  SetImageInfoFile(read_info,file);
8248  images=ReadImage(read_info,wand->exception);
8249  read_info=DestroyImageInfo(read_info);
8250  if (images == (Image *) NULL)
8251    return(MagickFalse);
8252  return(InsertImageInWand(wand,images));
8253}
8254
8255/*
8256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8257%                                                                             %
8258%                                                                             %
8259%                                                                             %
8260%   M a g i c k R e m a p I m a g e                                           %
8261%                                                                             %
8262%                                                                             %
8263%                                                                             %
8264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8265%
8266%  MagickRemapImage() replaces the colors of an image with the closest color
8267%  from a reference image.
8268%
8269%  The format of the MagickRemapImage method is:
8270%
8271%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8272%        const MagickWand *remap_wand,const DitherMethod method)
8273%
8274%  A description of each parameter follows:
8275%
8276%    o wand: the magick wand.
8277%
8278%    o affinity: the affinity wand.
8279%
8280%    o method: choose from these dither methods: NoDitherMethod,
8281%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8282%
8283*/
8284WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8285  const MagickWand *remap_wand,const DitherMethod dither_method)
8286{
8287  MagickBooleanType
8288    status;
8289
8290  QuantizeInfo
8291    *quantize_info;
8292
8293  assert(wand != (MagickWand *) NULL);
8294  assert(wand->signature == WandSignature);
8295  if( IfMagickTrue(wand->debug) )
8296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8297
8298  if ((wand->images == (Image *) NULL) ||
8299      (remap_wand->images == (Image *) NULL))
8300    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8301  quantize_info=AcquireQuantizeInfo(wand->image_info);
8302  quantize_info->dither_method=dither_method;
8303  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8304    wand->exception);
8305  quantize_info=DestroyQuantizeInfo(quantize_info);
8306  return(status);
8307}
8308
8309/*
8310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8311%                                                                             %
8312%                                                                             %
8313%                                                                             %
8314%   M a g i c k R e m o v e I m a g e                                         %
8315%                                                                             %
8316%                                                                             %
8317%                                                                             %
8318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8319%
8320%  MagickRemoveImage() removes an image from the image list.
8321%
8322%  The format of the MagickRemoveImage method is:
8323%
8324%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8325%
8326%  A description of each parameter follows:
8327%
8328%    o wand: the magick wand.
8329%
8330%    o insert: the splice wand.
8331%
8332*/
8333WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8334{
8335  assert(wand != (MagickWand *) NULL);
8336  assert(wand->signature == WandSignature);
8337  if( IfMagickTrue(wand->debug) )
8338    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8339
8340  if (wand->images == (Image *) NULL)
8341    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8342  DeleteImageFromList(&wand->images);
8343  return(MagickTrue);
8344}
8345
8346/*
8347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8348%                                                                             %
8349%                                                                             %
8350%                                                                             %
8351%   M a g i c k R e s a m p l e I m a g e                                     %
8352%                                                                             %
8353%                                                                             %
8354%                                                                             %
8355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8356%
8357%  MagickResampleImage() resample image to desired resolution.
8358%
8359%    Bessel   Blackman   Box
8360%    Catrom   Cubic      Gaussian
8361%    Hanning  Hermite    Lanczos
8362%    Mitchell Point      Quandratic
8363%    Sinc     Triangle
8364%
8365%  Most of the filters are FIR (finite impulse response), however, Bessel,
8366%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8367%  are windowed (brought down to zero) with the Blackman filter.
8368%
8369%  The format of the MagickResampleImage method is:
8370%
8371%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8372%        const double x_resolution,const double y_resolution,
8373%        const FilterTypes filter)
8374%
8375%  A description of each parameter follows:
8376%
8377%    o wand: the magick wand.
8378%
8379%    o x_resolution: the new image x resolution.
8380%
8381%    o y_resolution: the new image y resolution.
8382%
8383%    o filter: Image filter to use.
8384%
8385*/
8386WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8387  const double x_resolution,const double y_resolution,const FilterTypes filter)
8388{
8389  Image
8390    *resample_image;
8391
8392  assert(wand != (MagickWand *) NULL);
8393  assert(wand->signature == WandSignature);
8394  if( IfMagickTrue(wand->debug) )
8395    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8396
8397  if (wand->images == (Image *) NULL)
8398    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8399  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8400    wand->exception);
8401  if (resample_image == (Image *) NULL)
8402    return(MagickFalse);
8403  ReplaceImageInList(&wand->images,resample_image);
8404  return(MagickTrue);
8405}
8406
8407/*
8408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8409%                                                                             %
8410%                                                                             %
8411%                                                                             %
8412%   M a g i c k R e s e t I m a g e P a g e                                   %
8413%                                                                             %
8414%                                                                             %
8415%                                                                             %
8416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8417%
8418%  MagickResetImagePage() resets the Wand page canvas and position.
8419%
8420%  The format of the MagickResetImagePage method is:
8421%
8422%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8423%        const char *page)
8424%
8425%  A description of each parameter follows:
8426%
8427%    o wand: the magick wand.
8428%
8429%    o page: the relative page specification.
8430%
8431*/
8432WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8433  const char *page)
8434{
8435  assert(wand != (MagickWand *) NULL);
8436  assert(wand->signature == WandSignature);
8437  if( IfMagickTrue(wand->debug) )
8438    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8439
8440  if (wand->images == (Image *) NULL)
8441    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8442  if ((page == (char *) NULL) || (*page == '\0'))
8443    {
8444      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8445      return(MagickTrue);
8446    }
8447  return(ResetImagePage(wand->images,page));
8448}
8449
8450/*
8451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8452%                                                                             %
8453%                                                                             %
8454%                                                                             %
8455%   M a g i c k R e s i z e I m a g e                                         %
8456%                                                                             %
8457%                                                                             %
8458%                                                                             %
8459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8460%
8461%  MagickResizeImage() scales an image to the desired dimensions with one of
8462%  these filters:
8463%
8464%    Bessel   Blackman   Box
8465%    Catrom   Cubic      Gaussian
8466%    Hanning  Hermite    Lanczos
8467%    Mitchell Point      Quandratic
8468%    Sinc     Triangle
8469%
8470%  Most of the filters are FIR (finite impulse response), however, Bessel,
8471%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8472%  are windowed (brought down to zero) with the Blackman filter.
8473%
8474%  The format of the MagickResizeImage method is:
8475%
8476%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8477%        const size_t columns,const size_t rows,const FilterTypes filter)
8478%
8479%  A description of each parameter follows:
8480%
8481%    o wand: the magick wand.
8482%
8483%    o columns: the number of columns in the scaled image.
8484%
8485%    o rows: the number of rows in the scaled image.
8486%
8487%    o filter: Image filter to use.
8488%
8489*/
8490WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8491  const size_t columns,const size_t rows,const FilterTypes filter)
8492{
8493  Image
8494    *resize_image;
8495
8496  assert(wand != (MagickWand *) NULL);
8497  assert(wand->signature == WandSignature);
8498  if( IfMagickTrue(wand->debug) )
8499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8500
8501  if (wand->images == (Image *) NULL)
8502    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8503  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8504  if (resize_image == (Image *) NULL)
8505    return(MagickFalse);
8506  ReplaceImageInList(&wand->images,resize_image);
8507  return(MagickTrue);
8508}
8509
8510/*
8511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8512%                                                                             %
8513%                                                                             %
8514%                                                                             %
8515%   M a g i c k R o l l I m a g e                                             %
8516%                                                                             %
8517%                                                                             %
8518%                                                                             %
8519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8520%
8521%  MagickRollImage() offsets an image as defined by x and y.
8522%
8523%  The format of the MagickRollImage method is:
8524%
8525%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8526%        const size_t y)
8527%
8528%  A description of each parameter follows:
8529%
8530%    o wand: the magick wand.
8531%
8532%    o x: the x offset.
8533%
8534%    o y: the y offset.
8535%
8536%
8537*/
8538WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8539  const ssize_t x,const ssize_t y)
8540{
8541  Image
8542    *roll_image;
8543
8544  assert(wand != (MagickWand *) NULL);
8545  assert(wand->signature == WandSignature);
8546  if( IfMagickTrue(wand->debug) )
8547    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8548
8549  if (wand->images == (Image *) NULL)
8550    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8551  roll_image=RollImage(wand->images,x,y,wand->exception);
8552  if (roll_image == (Image *) NULL)
8553    return(MagickFalse);
8554  ReplaceImageInList(&wand->images,roll_image);
8555  return(MagickTrue);
8556}
8557
8558/*
8559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8560%                                                                             %
8561%                                                                             %
8562%                                                                             %
8563%   M a g i c k R o t a t e I m a g e                                         %
8564%                                                                             %
8565%                                                                             %
8566%                                                                             %
8567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568%
8569%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8570%  triangles left over from rotating the image are filled with the
8571%  background color.
8572%
8573%  The format of the MagickRotateImage method is:
8574%
8575%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8576%        const PixelWand *background,const double degrees)
8577%
8578%  A description of each parameter follows:
8579%
8580%    o wand: the magick wand.
8581%
8582%    o background: the background pixel wand.
8583%
8584%    o degrees: the number of degrees to rotate the image.
8585%
8586%
8587*/
8588WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8589  const PixelWand *background,const double degrees)
8590{
8591  Image
8592    *rotate_image;
8593
8594  assert(wand != (MagickWand *) NULL);
8595  assert(wand->signature == WandSignature);
8596  if( IfMagickTrue(wand->debug) )
8597    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8598
8599  if (wand->images == (Image *) NULL)
8600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8601  PixelGetQuantumPacket(background,&wand->images->background_color);
8602  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8603  if (rotate_image == (Image *) NULL)
8604    return(MagickFalse);
8605  ReplaceImageInList(&wand->images,rotate_image);
8606  return(MagickTrue);
8607}
8608
8609/*
8610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611%                                                                             %
8612%                                                                             %
8613%                                                                             %
8614%   M a g i c k S a m p l e I m a g e                                         %
8615%                                                                             %
8616%                                                                             %
8617%                                                                             %
8618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8619%
8620%  MagickSampleImage() scales an image to the desired dimensions with pixel
8621%  sampling.  Unlike other scaling methods, this method does not introduce
8622%  any additional color into the scaled image.
8623%
8624%  The format of the MagickSampleImage method is:
8625%
8626%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8627%        const size_t columns,const size_t rows)
8628%
8629%  A description of each parameter follows:
8630%
8631%    o wand: the magick wand.
8632%
8633%    o columns: the number of columns in the scaled image.
8634%
8635%    o rows: the number of rows in the scaled image.
8636%
8637%
8638*/
8639WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8640  const size_t columns,const size_t rows)
8641{
8642  Image
8643    *sample_image;
8644
8645  assert(wand != (MagickWand *) NULL);
8646  assert(wand->signature == WandSignature);
8647  if( IfMagickTrue(wand->debug) )
8648    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8649
8650  if (wand->images == (Image *) NULL)
8651    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8652  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8653  if (sample_image == (Image *) NULL)
8654    return(MagickFalse);
8655  ReplaceImageInList(&wand->images,sample_image);
8656  return(MagickTrue);
8657}
8658
8659/*
8660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8661%                                                                             %
8662%                                                                             %
8663%                                                                             %
8664%   M a g i c k S c a l e I m a g e                                           %
8665%                                                                             %
8666%                                                                             %
8667%                                                                             %
8668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8669%
8670%  MagickScaleImage() scales the size of an image to the given dimensions.
8671%
8672%  The format of the MagickScaleImage method is:
8673%
8674%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8675%        const size_t columns,const size_t rows)
8676%
8677%  A description of each parameter follows:
8678%
8679%    o wand: the magick wand.
8680%
8681%    o columns: the number of columns in the scaled image.
8682%
8683%    o rows: the number of rows in the scaled image.
8684%
8685%
8686*/
8687WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8688  const size_t columns,const size_t rows)
8689{
8690  Image
8691    *scale_image;
8692
8693  assert(wand != (MagickWand *) NULL);
8694  assert(wand->signature == WandSignature);
8695  if( IfMagickTrue(wand->debug) )
8696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8697
8698  if (wand->images == (Image *) NULL)
8699    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8700  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8701  if (scale_image == (Image *) NULL)
8702    return(MagickFalse);
8703  ReplaceImageInList(&wand->images,scale_image);
8704  return(MagickTrue);
8705}
8706
8707/*
8708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8709%                                                                             %
8710%                                                                             %
8711%                                                                             %
8712%   M a g i c k S e g m e n t I m a g e                                       %
8713%                                                                             %
8714%                                                                             %
8715%                                                                             %
8716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8717%
8718%  MagickSegmentImage() segments an image by analyzing the histograms of the
8719%  color components and identifying units that are homogeneous with the fuzzy
8720%  C-means technique.
8721%
8722%  The format of the SegmentImage method is:
8723%
8724%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8725%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8726%        const double cluster_threshold,const double smooth_threshold)
8727%
8728%  A description of each parameter follows.
8729%
8730%    o wand: the wand.
8731%
8732%    o colorspace: the image colorspace.
8733%
8734%    o verbose:  Set to MagickTrue to print detailed information about the
8735%      identified classes.
8736%
8737%    o cluster_threshold:  This represents the minimum number of pixels
8738%      contained in a hexahedra before it can be considered valid (expressed as
8739%      a percentage).
8740%
8741%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8742%      derivative of the histogram.  As the value is increased, you can expect a
8743%      smoother second derivative.
8744%
8745*/
8746MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8747  const ColorspaceType colorspace,const MagickBooleanType verbose,
8748  const double cluster_threshold,const double smooth_threshold)
8749{
8750  MagickBooleanType
8751    status;
8752
8753  assert(wand != (MagickWand *) NULL);
8754  assert(wand->signature == WandSignature);
8755  if( IfMagickTrue(wand->debug) )
8756    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8757
8758  if (wand->images == (Image *) NULL)
8759    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8760  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8761    smooth_threshold,wand->exception);
8762  return(status);
8763}
8764
8765/*
8766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8767%                                                                             %
8768%                                                                             %
8769%                                                                             %
8770%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8771%                                                                             %
8772%                                                                             %
8773%                                                                             %
8774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8775%
8776%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8777%  threshold. It is similar to the unsharpen mask that sharpens everything with
8778%  contrast above a certain threshold.
8779%
8780%  The format of the MagickSelectiveBlurImage method is:
8781%
8782%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8783%        const double radius,const double sigma,const double threshold)
8784%
8785%  A description of each parameter follows:
8786%
8787%    o wand: the magick wand.
8788%
8789%    o radius: the radius of the gaussian, in pixels, not counting the center
8790%      pixel.
8791%
8792%    o sigma: the standard deviation of the gaussian, in pixels.
8793%
8794%    o threshold: only pixels within this contrast threshold are included
8795%      in the blur operation.
8796%
8797*/
8798WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8799  const double radius,const double sigma,const double threshold)
8800{
8801  Image
8802    *blur_image;
8803
8804  assert(wand != (MagickWand *) NULL);
8805  assert(wand->signature == WandSignature);
8806  if( IfMagickTrue(wand->debug) )
8807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8808
8809  if (wand->images == (Image *) NULL)
8810    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8811  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8812    wand->exception);
8813  if (blur_image == (Image *) NULL)
8814    return(MagickFalse);
8815  ReplaceImageInList(&wand->images,blur_image);
8816  return(MagickTrue);
8817}
8818
8819/*
8820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8821%                                                                             %
8822%                                                                             %
8823%                                                                             %
8824%   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                       %
8825%                                                                             %
8826%                                                                             %
8827%                                                                             %
8828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8829%
8830%  MagickSeparateImage() separates a channel from the image and returns a
8831%  grayscale image.  A channel is a particular color component of each pixel
8832%  in the image.
8833%
8834%  The format of the MagickSeparateImage method is:
8835%
8836%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8837%        const ChannelType channel)
8838%
8839%  A description of each parameter follows:
8840%
8841%    o wand: the magick wand.
8842%
8843%    o channel: the channel.
8844%
8845*/
8846WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8847  const ChannelType channel)
8848{
8849  Image
8850    *separate_image;
8851
8852  assert(wand != (MagickWand *) NULL);
8853  assert(wand->signature == WandSignature);
8854  if( IfMagickTrue(wand->debug) )
8855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8856
8857  if (wand->images == (Image *) NULL)
8858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8859  separate_image=SeparateImage(wand->images,channel,wand->exception);
8860  if (separate_image == (Image *) NULL)
8861    return(MagickFalse);
8862  ReplaceImageInList(&wand->images,separate_image);
8863  return(MagickTrue);
8864}
8865
8866/*
8867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8868%                                                                             %
8869%                                                                             %
8870%                                                                             %
8871%     M a g i c k S e p i a T o n e I m a g e                                 %
8872%                                                                             %
8873%                                                                             %
8874%                                                                             %
8875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8876%
8877%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8878%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8879%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8880%  threshold of 80% is a good starting point for a reasonable tone.
8881%
8882%  The format of the MagickSepiaToneImage method is:
8883%
8884%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8885%        const double threshold)
8886%
8887%  A description of each parameter follows:
8888%
8889%    o wand: the magick wand.
8890%
8891%    o threshold:  Define the extent of the sepia toning.
8892%
8893*/
8894WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8895  const double threshold)
8896{
8897  Image
8898    *sepia_image;
8899
8900  assert(wand != (MagickWand *) NULL);
8901  assert(wand->signature == WandSignature);
8902  if( IfMagickTrue(wand->debug) )
8903    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8904
8905  if (wand->images == (Image *) NULL)
8906    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8907  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8908  if (sepia_image == (Image *) NULL)
8909    return(MagickFalse);
8910  ReplaceImageInList(&wand->images,sepia_image);
8911  return(MagickTrue);
8912}
8913
8914/*
8915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8916%                                                                             %
8917%                                                                             %
8918%                                                                             %
8919%   M a g i c k S e t I m a g e                                               %
8920%                                                                             %
8921%                                                                             %
8922%                                                                             %
8923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8924%
8925%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8926%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8927%  wand.
8928%
8929%  The format of the MagickSetImage method is:
8930%
8931%      MagickBooleanType MagickSetImage(MagickWand *wand,
8932%        const MagickWand *set_wand)
8933%
8934%  A description of each parameter follows:
8935%
8936%    o wand: the magick wand.
8937%
8938%    o set_wand: the set_wand wand.
8939%
8940*/
8941WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8942  const MagickWand *set_wand)
8943{
8944  Image
8945    *images;
8946
8947  assert(wand != (MagickWand *) NULL);
8948  assert(wand->signature == WandSignature);
8949  if( IfMagickTrue(wand->debug) )
8950    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8951
8952  assert(set_wand != (MagickWand *) NULL);
8953  assert(set_wand->signature == WandSignature);
8954  if( IfMagickTrue(wand->debug) )
8955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8956
8957  if (set_wand->images == (Image *) NULL)
8958    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8959  images=CloneImageList(set_wand->images,wand->exception);
8960  if (images == (Image *) NULL)
8961    return(MagickFalse);
8962  ReplaceImageInList(&wand->images,images);
8963  return(MagickTrue);
8964}
8965
8966/*
8967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8968%                                                                             %
8969%                                                                             %
8970%                                                                             %
8971%   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                       %
8972%                                                                             %
8973%                                                                             %
8974%                                                                             %
8975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8976%
8977%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8978%  alpha channel.
8979%
8980%  The format of the MagickSetImageAlphaChannel method is:
8981%
8982%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8983%        const AlphaChannelType alpha_type)
8984%
8985%  A description of each parameter follows:
8986%
8987%    o wand: the magick wand.
8988%
8989%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8990%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8991%
8992*/
8993WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8994  const AlphaChannelType alpha_type)
8995{
8996  assert(wand != (MagickWand *) NULL);
8997  assert(wand->signature == WandSignature);
8998  if( IfMagickTrue(wand->debug) )
8999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9000
9001  if (wand->images == (Image *) NULL)
9002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9003  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9004}
9005
9006/*
9007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9008%                                                                             %
9009%                                                                             %
9010%                                                                             %
9011%   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                 %
9012%                                                                             %
9013%                                                                             %
9014%                                                                             %
9015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9016%
9017%  MagickSetImageBackgroundColor() sets the image background color.
9018%
9019%  The format of the MagickSetImageBackgroundColor method is:
9020%
9021%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9022%        const PixelWand *background)
9023%
9024%  A description of each parameter follows:
9025%
9026%    o wand: the magick wand.
9027%
9028%    o background: the background pixel wand.
9029%
9030*/
9031WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9032  const PixelWand *background)
9033{
9034  assert(wand != (MagickWand *) NULL);
9035  assert(wand->signature == WandSignature);
9036  if( IfMagickTrue(wand->debug) )
9037    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9038
9039  if (wand->images == (Image *) NULL)
9040    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9041  PixelGetQuantumPacket(background,&wand->images->background_color);
9042  return(MagickTrue);
9043}
9044
9045/*
9046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9047%                                                                             %
9048%                                                                             %
9049%                                                                             %
9050%   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                         %
9051%                                                                             %
9052%                                                                             %
9053%                                                                             %
9054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9055%
9056%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9057%
9058%  The format of the MagickSetImageBluePrimary method is:
9059%
9060%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9061%        const double x,const double y)
9062%
9063%  A description of each parameter follows:
9064%
9065%    o wand: the magick wand.
9066%
9067%    o x: the blue primary x-point.
9068%
9069%    o y: the blue primary y-point.
9070%
9071*/
9072WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9073  const double x,const double y)
9074{
9075  assert(wand != (MagickWand *) NULL);
9076  assert(wand->signature == WandSignature);
9077  if( IfMagickTrue(wand->debug) )
9078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9079
9080  if (wand->images == (Image *) NULL)
9081    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9082  wand->images->chromaticity.blue_primary.x=x;
9083  wand->images->chromaticity.blue_primary.y=y;
9084  return(MagickTrue);
9085}
9086
9087/*
9088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9089%                                                                             %
9090%                                                                             %
9091%                                                                             %
9092%   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                         %
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9097%
9098%  MagickSetImageBorderColor() sets the image border color.
9099%
9100%  The format of the MagickSetImageBorderColor method is:
9101%
9102%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9103%        const PixelWand *border)
9104%
9105%  A description of each parameter follows:
9106%
9107%    o wand: the magick wand.
9108%
9109%    o border: the border pixel wand.
9110%
9111*/
9112WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9113  const PixelWand *border)
9114{
9115  assert(wand != (MagickWand *) NULL);
9116  assert(wand->signature == WandSignature);
9117  if( IfMagickTrue(wand->debug) )
9118    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9119
9120  if (wand->images == (Image *) NULL)
9121    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9122  PixelGetQuantumPacket(border,&wand->images->border_color);
9123  return(MagickTrue);
9124}
9125
9126/*
9127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9128%                                                                             %
9129%                                                                             %
9130%                                                                             %
9131%   M a g i c k S e t I m a g e C l i p M a s k                               %
9132%                                                                             %
9133%                                                                             %
9134%                                                                             %
9135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9136%
9137%  MagickSetImageMask() sets image clip mask.
9138%
9139%  The format of the MagickSetImageMask method is:
9140%
9141%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9142%        const MagickWand *clip_mask)
9143%
9144%  A description of each parameter follows:
9145%
9146%    o wand: the magick wand.
9147%
9148%    o clip_mask: the clip_mask wand.
9149%
9150*/
9151WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9152  const MagickWand *clip_mask)
9153{
9154  assert(wand != (MagickWand *) NULL);
9155  assert(wand->signature == WandSignature);
9156  if( IfMagickTrue(wand->debug) )
9157    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9158
9159  assert(clip_mask != (MagickWand *) NULL);
9160  assert(clip_mask->signature == WandSignature);
9161  if( IfMagickTrue(clip_mask->debug) )
9162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9163
9164  if (clip_mask->images == (Image *) NULL)
9165    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9166  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9167}
9168
9169/*
9170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9171%                                                                             %
9172%                                                                             %
9173%                                                                             %
9174%   M a g i c k S e t I m a g e C o l o r                                     %
9175%                                                                             %
9176%                                                                             %
9177%                                                                             %
9178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9179%
9180%  MagickSetImageColor() set the entire wand canvas to the specified color.
9181%
9182%  The format of the MagickSetImageColor method is:
9183%
9184%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9185%        const PixelWand *color)
9186%
9187%  A description of each parameter follows:
9188%
9189%    o wand: the magick wand.
9190%
9191%    o background: the image color.
9192%
9193*/
9194WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9195  const PixelWand *color)
9196{
9197  PixelInfo
9198    pixel;
9199
9200  assert(wand != (MagickWand *) NULL);
9201  assert(wand->signature == WandSignature);
9202  if( IfMagickTrue(wand->debug) )
9203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9204
9205  PixelGetMagickColor(color,&pixel);
9206  return(SetImageColor(wand->images,&pixel,wand->exception));
9207}
9208
9209/*
9210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9211%                                                                             %
9212%                                                                             %
9213%                                                                             %
9214%   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                     %
9215%                                                                             %
9216%                                                                             %
9217%                                                                             %
9218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9219%
9220%  MagickSetImageColormapColor() sets the color of the specified colormap
9221%  index.
9222%
9223%  The format of the MagickSetImageColormapColor method is:
9224%
9225%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9226%        const size_t index,const PixelWand *color)
9227%
9228%  A description of each parameter follows:
9229%
9230%    o wand: the magick wand.
9231%
9232%    o index: the offset into the image colormap.
9233%
9234%    o color: Return the colormap color in this wand.
9235%
9236*/
9237WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9238  const size_t index,const PixelWand *color)
9239{
9240  assert(wand != (MagickWand *) NULL);
9241  assert(wand->signature == WandSignature);
9242  if( IfMagickTrue(wand->debug) )
9243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9244
9245  if (wand->images == (Image *) NULL)
9246    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9247  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9248      (index >= wand->images->colors))
9249    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9250  PixelGetQuantumPacket(color,wand->images->colormap+index);
9251  return(SyncImage(wand->images,wand->exception));
9252}
9253
9254/*
9255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9256%                                                                             %
9257%                                                                             %
9258%                                                                             %
9259%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9260%                                                                             %
9261%                                                                             %
9262%                                                                             %
9263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9264%
9265%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9266%  the image data.
9267%
9268%  The format of the MagickSetImageColorspace method is:
9269%
9270%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9271%        const ColorspaceType colorspace)
9272%
9273%  A description of each parameter follows:
9274%
9275%    o wand: the magick wand.
9276%
9277%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9278%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9279%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9280%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9281%      HSLColorspace, or HWBColorspace.
9282%
9283*/
9284WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9285  const ColorspaceType colorspace)
9286{
9287  assert(wand != (MagickWand *) NULL);
9288  assert(wand->signature == WandSignature);
9289  if( IfMagickTrue(wand->debug) )
9290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9291
9292  if (wand->images == (Image *) NULL)
9293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9294  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9295}
9296
9297/*
9298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9299%                                                                             %
9300%                                                                             %
9301%                                                                             %
9302%   M a g i c k S e t I m a g e C o m p o s e                                 %
9303%                                                                             %
9304%                                                                             %
9305%                                                                             %
9306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9307%
9308%  MagickSetImageCompose() sets the image composite operator, useful for
9309%  specifying how to composite the image thumbnail when using the
9310%  MagickMontageImage() method.
9311%
9312%  The format of the MagickSetImageCompose method is:
9313%
9314%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9315%        const CompositeOperator compose)
9316%
9317%  A description of each parameter follows:
9318%
9319%    o wand: the magick wand.
9320%
9321%    o compose: the image composite operator.
9322%
9323*/
9324WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9325  const CompositeOperator compose)
9326{
9327  assert(wand != (MagickWand *) NULL);
9328  assert(wand->signature == WandSignature);
9329  if( IfMagickTrue(wand->debug) )
9330    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9331
9332  if (wand->images == (Image *) NULL)
9333    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9334  wand->images->compose=compose;
9335  return(MagickTrue);
9336}
9337
9338/*
9339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9340%                                                                             %
9341%                                                                             %
9342%                                                                             %
9343%   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                         %
9344%                                                                             %
9345%                                                                             %
9346%                                                                             %
9347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9348%
9349%  MagickSetImageCompression() sets the image compression.
9350%
9351%  The format of the MagickSetImageCompression method is:
9352%
9353%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9354%        const CompressionType compression)
9355%
9356%  A description of each parameter follows:
9357%
9358%    o wand: the magick wand.
9359%
9360%    o compression: the image compression type.
9361%
9362*/
9363WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9364  const CompressionType compression)
9365{
9366  assert(wand != (MagickWand *) NULL);
9367  assert(wand->signature == WandSignature);
9368  if( IfMagickTrue(wand->debug) )
9369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9370
9371  if (wand->images == (Image *) NULL)
9372    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9373  wand->images->compression=compression;
9374  return(MagickTrue);
9375}
9376
9377/*
9378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9379%                                                                             %
9380%                                                                             %
9381%                                                                             %
9382%   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           %
9383%                                                                             %
9384%                                                                             %
9385%                                                                             %
9386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9387%
9388%  MagickSetImageCompressionQuality() sets the image compression quality.
9389%
9390%  The format of the MagickSetImageCompressionQuality method is:
9391%
9392%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9393%        const size_t quality)
9394%
9395%  A description of each parameter follows:
9396%
9397%    o wand: the magick wand.
9398%
9399%    o quality: the image compression tlityype.
9400%
9401*/
9402WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9403  const size_t quality)
9404{
9405  assert(wand != (MagickWand *) NULL);
9406  assert(wand->signature == WandSignature);
9407  if( IfMagickTrue(wand->debug) )
9408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9409
9410  if (wand->images == (Image *) NULL)
9411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9412  wand->images->quality=quality;
9413  return(MagickTrue);
9414}
9415
9416/*
9417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9418%                                                                             %
9419%                                                                             %
9420%                                                                             %
9421%   M a g i c k S e t I m a g e D e l a y                                     %
9422%                                                                             %
9423%                                                                             %
9424%                                                                             %
9425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9426%
9427%  MagickSetImageDelay() sets the image delay.
9428%
9429%  The format of the MagickSetImageDelay method is:
9430%
9431%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9432%        const size_t delay)
9433%
9434%  A description of each parameter follows:
9435%
9436%    o wand: the magick wand.
9437%
9438%    o delay: the image delay in ticks-per-second units.
9439%
9440*/
9441WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9442  const size_t delay)
9443{
9444  assert(wand != (MagickWand *) NULL);
9445  assert(wand->signature == WandSignature);
9446  if( IfMagickTrue(wand->debug) )
9447    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448
9449  if (wand->images == (Image *) NULL)
9450    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9451  wand->images->delay=delay;
9452  return(MagickTrue);
9453}
9454
9455/*
9456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457%                                                                             %
9458%                                                                             %
9459%                                                                             %
9460%   M a g i c k S e t I m a g e D e p t h                                     %
9461%                                                                             %
9462%                                                                             %
9463%                                                                             %
9464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9465%
9466%  MagickSetImageDepth() sets the image depth.
9467%
9468%  The format of the MagickSetImageDepth method is:
9469%
9470%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9471%        const size_t depth)
9472%
9473%  A description of each parameter follows:
9474%
9475%    o wand: the magick wand.
9476%
9477%    o depth: the image depth in bits: 8, 16, or 32.
9478%
9479*/
9480WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9481  const size_t depth)
9482{
9483  assert(wand != (MagickWand *) NULL);
9484  assert(wand->signature == WandSignature);
9485  if( IfMagickTrue(wand->debug) )
9486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9487
9488  if (wand->images == (Image *) NULL)
9489    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490  return(SetImageDepth(wand->images,depth,wand->exception));
9491}
9492
9493/*
9494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9495%                                                                             %
9496%                                                                             %
9497%                                                                             %
9498%   M a g i c k S e t I m a g e D i s p o s e                                 %
9499%                                                                             %
9500%                                                                             %
9501%                                                                             %
9502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503%
9504%  MagickSetImageDispose() sets the image disposal method.
9505%
9506%  The format of the MagickSetImageDispose method is:
9507%
9508%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9509%        const DisposeType dispose)
9510%
9511%  A description of each parameter follows:
9512%
9513%    o wand: the magick wand.
9514%
9515%    o dispose: the image disposeal type.
9516%
9517*/
9518WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9519  const DisposeType dispose)
9520{
9521  assert(wand != (MagickWand *) NULL);
9522  assert(wand->signature == WandSignature);
9523  if( IfMagickTrue(wand->debug) )
9524    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9525
9526  if (wand->images == (Image *) NULL)
9527    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9528  wand->images->dispose=dispose;
9529  return(MagickTrue);
9530}
9531
9532/*
9533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9534%                                                                             %
9535%                                                                             %
9536%                                                                             %
9537%   M a g i c k S e t I m a g e E n d i a n                                   %
9538%                                                                             %
9539%                                                                             %
9540%                                                                             %
9541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9542%
9543%  MagickSetImageEndian() sets the image endian method.
9544%
9545%  The format of the MagickSetImageEndian method is:
9546%
9547%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9548%        const EndianType endian)
9549%
9550%  A description of each parameter follows:
9551%
9552%    o wand: the magick wand.
9553%
9554%    o endian: the image endian type.
9555%
9556*/
9557WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9558  const EndianType endian)
9559{
9560  assert(wand != (MagickWand *) NULL);
9561  assert(wand->signature == WandSignature);
9562  if (wand->debug != MagickFalse)
9563    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9564  if (wand->images == (Image *) NULL)
9565    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9566  wand->images->endian=endian;
9567  return(MagickTrue);
9568}
9569
9570/*
9571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9572%                                                                             %
9573%                                                                             %
9574%                                                                             %
9575%   M a g i c k S e t I m a g e E x t e n t                                   %
9576%                                                                             %
9577%                                                                             %
9578%                                                                             %
9579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580%
9581%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9582%
9583%  The format of the MagickSetImageExtent method is:
9584%
9585%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9586%        const size_t columns,const unsigned rows)
9587%
9588%  A description of each parameter follows:
9589%
9590%    o wand: the magick wand.
9591%
9592%    o columns:  The image width in pixels.
9593%
9594%    o rows:  The image height in pixels.
9595%
9596*/
9597WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9598  const size_t columns,const size_t rows)
9599{
9600  assert(wand != (MagickWand *) NULL);
9601  assert(wand->signature == WandSignature);
9602  if( IfMagickTrue(wand->debug) )
9603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9604
9605  if (wand->images == (Image *) NULL)
9606    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9607  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9608}
9609
9610/*
9611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9612%                                                                             %
9613%                                                                             %
9614%                                                                             %
9615%   M a g i c k S e t I m a g e F i l e n a m e                               %
9616%                                                                             %
9617%                                                                             %
9618%                                                                             %
9619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9620%
9621%  MagickSetImageFilename() sets the filename of a particular image in a
9622%  sequence.
9623%
9624%  The format of the MagickSetImageFilename method is:
9625%
9626%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9627%        const char *filename)
9628%
9629%  A description of each parameter follows:
9630%
9631%    o wand: the magick wand.
9632%
9633%    o filename: the image filename.
9634%
9635*/
9636WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9637  const char *filename)
9638{
9639  assert(wand != (MagickWand *) NULL);
9640  assert(wand->signature == WandSignature);
9641  if( IfMagickTrue(wand->debug) )
9642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9643
9644  if (wand->images == (Image *) NULL)
9645    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9646  if (filename != (const char *) NULL)
9647    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9648  return(MagickTrue);
9649}
9650
9651/*
9652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9653%                                                                             %
9654%                                                                             %
9655%                                                                             %
9656%   M a g i c k S e t I m a g e F o r m a t                                   %
9657%                                                                             %
9658%                                                                             %
9659%                                                                             %
9660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9661%
9662%  MagickSetImageFormat() sets the format of a particular image in a
9663%  sequence.
9664%
9665%  The format of the MagickSetImageFormat method is:
9666%
9667%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9668%        const char *format)
9669%
9670%  A description of each parameter follows:
9671%
9672%    o wand: the magick wand.
9673%
9674%    o format: the image format.
9675%
9676*/
9677WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9678  const char *format)
9679{
9680  const MagickInfo
9681    *magick_info;
9682
9683  assert(wand != (MagickWand *) NULL);
9684  assert(wand->signature == WandSignature);
9685  if( IfMagickTrue(wand->debug) )
9686    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9687
9688  if (wand->images == (Image *) NULL)
9689    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9690  if ((format == (char *) NULL) || (*format == '\0'))
9691    {
9692      *wand->images->magick='\0';
9693      return(MagickTrue);
9694    }
9695  magick_info=GetMagickInfo(format,wand->exception);
9696  if (magick_info == (const MagickInfo *) NULL)
9697    return(MagickFalse);
9698  ClearMagickException(wand->exception);
9699  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9700  return(MagickTrue);
9701}
9702
9703/*
9704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9705%                                                                             %
9706%                                                                             %
9707%                                                                             %
9708%   M a g i c k S e t I m a g e F u z z                                       %
9709%                                                                             %
9710%                                                                             %
9711%                                                                             %
9712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9713%
9714%  MagickSetImageFuzz() sets the image fuzz.
9715%
9716%  The format of the MagickSetImageFuzz method is:
9717%
9718%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9719%        const double fuzz)
9720%
9721%  A description of each parameter follows:
9722%
9723%    o wand: the magick wand.
9724%
9725%    o fuzz: the image fuzz.
9726%
9727*/
9728WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9729  const double fuzz)
9730{
9731  assert(wand != (MagickWand *) NULL);
9732  assert(wand->signature == WandSignature);
9733  if( IfMagickTrue(wand->debug) )
9734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9735
9736  if (wand->images == (Image *) NULL)
9737    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9738  wand->images->fuzz=fuzz;
9739  return(MagickTrue);
9740}
9741
9742/*
9743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9744%                                                                             %
9745%                                                                             %
9746%                                                                             %
9747%   M a g i c k S e t I m a g e G a m m a                                     %
9748%                                                                             %
9749%                                                                             %
9750%                                                                             %
9751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9752%
9753%  MagickSetImageGamma() sets the image gamma.
9754%
9755%  The format of the MagickSetImageGamma method is:
9756%
9757%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9758%        const double gamma)
9759%
9760%  A description of each parameter follows:
9761%
9762%    o wand: the magick wand.
9763%
9764%    o gamma: the image gamma.
9765%
9766*/
9767WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9768  const double gamma)
9769{
9770  assert(wand != (MagickWand *) NULL);
9771  assert(wand->signature == WandSignature);
9772  if( IfMagickTrue(wand->debug) )
9773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9774
9775  if (wand->images == (Image *) NULL)
9776    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9777  wand->images->gamma=gamma;
9778  return(MagickTrue);
9779}
9780
9781/*
9782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783%                                                                             %
9784%                                                                             %
9785%                                                                             %
9786%   M a g i c k S e t I m a g e G r a v i t y                                 %
9787%                                                                             %
9788%                                                                             %
9789%                                                                             %
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%
9792%  MagickSetImageGravity() sets the image gravity type.
9793%
9794%  The format of the MagickSetImageGravity method is:
9795%
9796%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9797%        const GravityType gravity)
9798%
9799%  A description of each parameter follows:
9800%
9801%    o wand: the magick wand.
9802%
9803%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9804%      PlaneInterlace, PartitionInterlace.
9805%
9806*/
9807WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9808  const GravityType gravity)
9809{
9810  assert(wand != (MagickWand *) NULL);
9811  assert(wand->signature == WandSignature);
9812  if( IfMagickTrue(wand->debug) )
9813    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9814
9815  if (wand->images == (Image *) NULL)
9816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9817  wand->images->gravity=gravity;
9818  return(MagickTrue);
9819}
9820
9821/*
9822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9823%                                                                             %
9824%                                                                             %
9825%                                                                             %
9826%   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                       %
9827%                                                                             %
9828%                                                                             %
9829%                                                                             %
9830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9831%
9832%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9833%  point.
9834%
9835%  The format of the MagickSetImageGreenPrimary method is:
9836%
9837%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9838%        const double x,const double y)
9839%
9840%  A description of each parameter follows:
9841%
9842%    o wand: the magick wand.
9843%
9844%    o x: the green primary x-point.
9845%
9846%    o y: the green primary y-point.
9847%
9848%
9849*/
9850WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9851  const double x,const double y)
9852{
9853  assert(wand != (MagickWand *) NULL);
9854  assert(wand->signature == WandSignature);
9855  if( IfMagickTrue(wand->debug) )
9856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9857
9858  if (wand->images == (Image *) NULL)
9859    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9860  wand->images->chromaticity.green_primary.x=x;
9861  wand->images->chromaticity.green_primary.y=y;
9862  return(MagickTrue);
9863}
9864
9865/*
9866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9867%                                                                             %
9868%                                                                             %
9869%                                                                             %
9870%   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                 %
9871%                                                                             %
9872%                                                                             %
9873%                                                                             %
9874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9875%
9876%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9877%
9878%  The format of the MagickSetImageInterlaceScheme method is:
9879%
9880%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9881%        const InterlaceType interlace)
9882%
9883%  A description of each parameter follows:
9884%
9885%    o wand: the magick wand.
9886%
9887%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9888%      PlaneInterlace, PartitionInterlace.
9889%
9890*/
9891WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9892  const InterlaceType interlace)
9893{
9894  assert(wand != (MagickWand *) NULL);
9895  assert(wand->signature == WandSignature);
9896  if( IfMagickTrue(wand->debug) )
9897    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9898
9899  if (wand->images == (Image *) NULL)
9900    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9901  wand->images->interlace=interlace;
9902  return(MagickTrue);
9903}
9904
9905/*
9906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9907%                                                                             %
9908%                                                                             %
9909%                                                                             %
9910%   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             %
9911%                                                                             %
9912%                                                                             %
9913%                                                                             %
9914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9915%
9916%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9917%
9918%  The format of the MagickSetImagePixelInterpolateMethod method is:
9919%
9920%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9921%        const PixelInterpolateMethod method)
9922%
9923%  A description of each parameter follows:
9924%
9925%    o wand: the magick wand.
9926%
9927%    o method: the image interpole pixel methods: choose from Undefined,
9928%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9929%
9930*/
9931WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9932  const PixelInterpolateMethod method)
9933{
9934  assert(wand != (MagickWand *) NULL);
9935  assert(wand->signature == WandSignature);
9936  if( IfMagickTrue(wand->debug) )
9937    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9938
9939  if (wand->images == (Image *) NULL)
9940    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9941  wand->images->interpolate=method;
9942  return(MagickTrue);
9943}
9944
9945/*
9946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947%                                                                             %
9948%                                                                             %
9949%                                                                             %
9950%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9951%                                                                             %
9952%                                                                             %
9953%                                                                             %
9954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955%
9956%  MagickSetImageIterations() sets the image iterations.
9957%
9958%  The format of the MagickSetImageIterations method is:
9959%
9960%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9961%        const size_t iterations)
9962%
9963%  A description of each parameter follows:
9964%
9965%    o wand: the magick wand.
9966%
9967%    o delay: the image delay in 1/100th of a second.
9968%
9969*/
9970WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9971  const size_t iterations)
9972{
9973  assert(wand != (MagickWand *) NULL);
9974  assert(wand->signature == WandSignature);
9975  if( IfMagickTrue(wand->debug) )
9976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9977
9978  if (wand->images == (Image *) NULL)
9979    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9980  wand->images->iterations=iterations;
9981  return(MagickTrue);
9982}
9983
9984/*
9985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9986%                                                                             %
9987%                                                                             %
9988%                                                                             %
9989%   M a g i c k S e t I m a g e M a t t e                                     %
9990%                                                                             %
9991%                                                                             %
9992%                                                                             %
9993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9994%
9995%  MagickSetImageMatte() sets the image matte channel.
9996%
9997%  The format of the MagickSetImageMatteColor method is:
9998%
9999%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10000%        const MagickBooleanType *matte)
10001%
10002%  A description of each parameter follows:
10003%
10004%    o wand: the magick wand.
10005%
10006%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10007%      MagickFalse.
10008%
10009*/
10010WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10011  const MagickBooleanType matte)
10012{
10013  assert(wand != (MagickWand *) NULL);
10014  assert(wand->signature == WandSignature);
10015  if( IfMagickTrue(wand->debug) )
10016    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10017
10018  if (wand->images == (Image *) NULL)
10019    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10020  if( IfMagickFalse(wand->images->matte) && IsMagickTrue(matte))
10021    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10022  wand->images->matte=matte;
10023  return(MagickTrue);
10024}
10025
10026/*
10027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10028%                                                                             %
10029%                                                                             %
10030%                                                                             %
10031%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10032%                                                                             %
10033%                                                                             %
10034%                                                                             %
10035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10036%
10037%  MagickSetImageMatteColor() sets the image matte color.
10038%
10039%  The format of the MagickSetImageMatteColor method is:
10040%
10041%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10042%        const PixelWand *matte)
10043%
10044%  A description of each parameter follows:
10045%
10046%    o wand: the magick wand.
10047%
10048%    o matte: the matte pixel wand.
10049%
10050*/
10051WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10052  const PixelWand *matte)
10053{
10054  assert(wand != (MagickWand *) NULL);
10055  assert(wand->signature == WandSignature);
10056  if( IfMagickTrue(wand->debug) )
10057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10058
10059  if (wand->images == (Image *) NULL)
10060    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10061  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10062  return(MagickTrue);
10063}
10064
10065/*
10066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10067%                                                                             %
10068%                                                                             %
10069%                                                                             %
10070%   M a g i c k S e t I m a g e O p a c i t y                                 %
10071%                                                                             %
10072%                                                                             %
10073%                                                                             %
10074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10075%
10076%  MagickSetImageAlpha() sets the image to the specified alpha level.
10077%
10078%  The format of the MagickSetImageAlpha method is:
10079%
10080%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10081%        const double alpha)
10082%
10083%  A description of each parameter follows:
10084%
10085%    o wand: the magick wand.
10086%
10087%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10088%      transparent.
10089%
10090*/
10091WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10092  const double alpha)
10093{
10094  MagickBooleanType
10095    status;
10096
10097  assert(wand != (MagickWand *) NULL);
10098  assert(wand->signature == WandSignature);
10099  if( IfMagickTrue(wand->debug) )
10100    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10101
10102  if (wand->images == (Image *) NULL)
10103    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10104  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10105    wand->exception);
10106  return(status);
10107}
10108
10109/*
10110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10111%                                                                             %
10112%                                                                             %
10113%                                                                             %
10114%   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                         %
10115%                                                                             %
10116%                                                                             %
10117%                                                                             %
10118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10119%
10120%  MagickSetImageOrientation() sets the image orientation.
10121%
10122%  The format of the MagickSetImageOrientation method is:
10123%
10124%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10125%        const OrientationType orientation)
10126%
10127%  A description of each parameter follows:
10128%
10129%    o wand: the magick wand.
10130%
10131%    o orientation: the image orientation type.
10132%
10133*/
10134WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10135  const OrientationType orientation)
10136{
10137  assert(wand != (MagickWand *) NULL);
10138  assert(wand->signature == WandSignature);
10139  if( IfMagickTrue(wand->debug) )
10140    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10141
10142  if (wand->images == (Image *) NULL)
10143    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10144  wand->images->orientation=orientation;
10145  return(MagickTrue);
10146}
10147
10148/*
10149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10150%                                                                             %
10151%                                                                             %
10152%                                                                             %
10153%   M a g i c k S e t I m a g e P a g e                                       %
10154%                                                                             %
10155%                                                                             %
10156%                                                                             %
10157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10158%
10159%  MagickSetImagePage() sets the page geometry of the image.
10160%
10161%  The format of the MagickSetImagePage method is:
10162%
10163%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10164%        const size_t width,const size_t height,const ssize_t x,
10165%        const ssize_t y)
10166%
10167%  A description of each parameter follows:
10168%
10169%    o wand: the magick wand.
10170%
10171%    o width: the page width.
10172%
10173%    o height: the page height.
10174%
10175%    o x: the page x-offset.
10176%
10177%    o y: the page y-offset.
10178%
10179*/
10180WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10181  const size_t width,const size_t height,const ssize_t x,
10182  const ssize_t y)
10183{
10184  assert(wand != (MagickWand *) NULL);
10185  assert(wand->signature == WandSignature);
10186  if( IfMagickTrue(wand->debug) )
10187    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10188
10189  if (wand->images == (Image *) NULL)
10190    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10191  wand->images->page.width=width;
10192  wand->images->page.height=height;
10193  wand->images->page.x=x;
10194  wand->images->page.y=y;
10195  return(MagickTrue);
10196}
10197
10198/*
10199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10200%                                                                             %
10201%                                                                             %
10202%                                                                             %
10203%   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                 %
10204%                                                                             %
10205%                                                                             %
10206%                                                                             %
10207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10208%
10209%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10210%  specified method and returns the previous progress monitor if any.  The
10211%  progress monitor method looks like this:
10212%
10213%    MagickBooleanType MagickProgressMonitor(const char *text,
10214%      const MagickOffsetType offset,const MagickSizeType span,
10215%      void *client_data)
10216%
10217%  If the progress monitor returns MagickFalse, the current operation is
10218%  interrupted.
10219%
10220%  The format of the MagickSetImageProgressMonitor method is:
10221%
10222%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10223%        const MagickProgressMonitor progress_monitor,void *client_data)
10224%
10225%  A description of each parameter follows:
10226%
10227%    o wand: the magick wand.
10228%
10229%    o progress_monitor: Specifies a pointer to a method to monitor progress
10230%      of an image operation.
10231%
10232%    o client_data: Specifies a pointer to any client data.
10233%
10234*/
10235WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10236  const MagickProgressMonitor progress_monitor,void *client_data)
10237{
10238  MagickProgressMonitor
10239    previous_monitor;
10240
10241  assert(wand != (MagickWand *) NULL);
10242  assert(wand->signature == WandSignature);
10243  if( IfMagickTrue(wand->debug) )
10244    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10245
10246  if (wand->images == (Image *) NULL)
10247    {
10248      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10249        "ContainsNoImages","'%s'",wand->name);
10250      return((MagickProgressMonitor) NULL);
10251    }
10252  previous_monitor=SetImageProgressMonitor(wand->images,
10253    progress_monitor,client_data);
10254  return(previous_monitor);
10255}
10256
10257/*
10258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10259%                                                                             %
10260%                                                                             %
10261%                                                                             %
10262%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10263%                                                                             %
10264%                                                                             %
10265%                                                                             %
10266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10267%
10268%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10269%
10270%  The format of the MagickSetImageRedPrimary method is:
10271%
10272%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10273%        const double x,const double y)
10274%
10275%  A description of each parameter follows:
10276%
10277%    o wand: the magick wand.
10278%
10279%    o x: the red primary x-point.
10280%
10281%    o y: the red primary y-point.
10282%
10283*/
10284WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10285  const double x,const double y)
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->chromaticity.red_primary.x=x;
10295  wand->images->chromaticity.red_primary.y=y;
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 R e n d e r i n g I n t e n t                 %
10305%                                                                             %
10306%                                                                             %
10307%                                                                             %
10308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10309%
10310%  MagickSetImageRenderingIntent() sets the image rendering intent.
10311%
10312%  The format of the MagickSetImageRenderingIntent method is:
10313%
10314%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10315%        const RenderingIntent rendering_intent)
10316%
10317%  A description of each parameter follows:
10318%
10319%    o wand: the magick wand.
10320%
10321%    o rendering_intent: the image rendering intent: UndefinedIntent,
10322%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10323%
10324*/
10325WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10326  const RenderingIntent rendering_intent)
10327{
10328  assert(wand != (MagickWand *) NULL);
10329  assert(wand->signature == WandSignature);
10330  if( IfMagickTrue(wand->debug) )
10331    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10332
10333  if (wand->images == (Image *) NULL)
10334    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10335  wand->images->rendering_intent=rendering_intent;
10336  return(MagickTrue);
10337}
10338
10339/*
10340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10341%                                                                             %
10342%                                                                             %
10343%                                                                             %
10344%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10345%                                                                             %
10346%                                                                             %
10347%                                                                             %
10348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10349%
10350%  MagickSetImageResolution() sets the image resolution.
10351%
10352%  The format of the MagickSetImageResolution method is:
10353%
10354%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10355%        const double x_resolution,const double y_resolution)
10356%
10357%  A description of each parameter follows:
10358%
10359%    o wand: the magick wand.
10360%
10361%    o x_resolution: the image x resolution.
10362%
10363%    o y_resolution: the image y resolution.
10364%
10365*/
10366WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10367  const double x_resolution,const double y_resolution)
10368{
10369  assert(wand != (MagickWand *) NULL);
10370  assert(wand->signature == WandSignature);
10371  if( IfMagickTrue(wand->debug) )
10372    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10373
10374  if (wand->images == (Image *) NULL)
10375    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10376  wand->images->resolution.x=x_resolution;
10377  wand->images->resolution.y=y_resolution;
10378  return(MagickTrue);
10379}
10380
10381/*
10382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10383%                                                                             %
10384%                                                                             %
10385%                                                                             %
10386%   M a g i c k S e t I m a g e S c e n e                                     %
10387%                                                                             %
10388%                                                                             %
10389%                                                                             %
10390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10391%
10392%  MagickSetImageScene() sets the image scene.
10393%
10394%  The format of the MagickSetImageScene method is:
10395%
10396%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10397%        const size_t scene)
10398%
10399%  A description of each parameter follows:
10400%
10401%    o wand: the magick wand.
10402%
10403%    o delay: the image scene number.
10404%
10405*/
10406WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10407  const size_t scene)
10408{
10409  assert(wand != (MagickWand *) NULL);
10410  assert(wand->signature == WandSignature);
10411  if( IfMagickTrue(wand->debug) )
10412    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10413
10414  if (wand->images == (Image *) NULL)
10415    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10416  wand->images->scene=scene;
10417  return(MagickTrue);
10418}
10419
10420/*
10421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10422%                                                                             %
10423%                                                                             %
10424%                                                                             %
10425%   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                   %
10426%                                                                             %
10427%                                                                             %
10428%                                                                             %
10429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10430%
10431%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10432%
10433%  The format of the MagickSetImageTicksPerSecond method is:
10434%
10435%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10436%        const ssize_t ticks_per-second)
10437%
10438%  A description of each parameter follows:
10439%
10440%    o wand: the magick wand.
10441%
10442%    o ticks_per_second: the units to use for the image delay.
10443%
10444*/
10445WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10446  const ssize_t ticks_per_second)
10447{
10448  assert(wand != (MagickWand *) NULL);
10449  assert(wand->signature == WandSignature);
10450  if( IfMagickTrue(wand->debug) )
10451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10452
10453  if (wand->images == (Image *) NULL)
10454    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10455  wand->images->ticks_per_second=ticks_per_second;
10456  return(MagickTrue);
10457}
10458
10459/*
10460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10461%                                                                             %
10462%                                                                             %
10463%                                                                             %
10464%   M a g i c k S e t I m a g e T y p e                                       %
10465%                                                                             %
10466%                                                                             %
10467%                                                                             %
10468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10469%
10470%  MagickSetImageType() sets the image type.
10471%
10472%  The format of the MagickSetImageType method is:
10473%
10474%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10475%        const ImageType image_type)
10476%
10477%  A description of each parameter follows:
10478%
10479%    o wand: the magick wand.
10480%
10481%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10482%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10483%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10484%      or OptimizeType.
10485%
10486*/
10487WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10488  const ImageType image_type)
10489{
10490  assert(wand != (MagickWand *) NULL);
10491  assert(wand->signature == WandSignature);
10492  if( IfMagickTrue(wand->debug) )
10493    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10494
10495  if (wand->images == (Image *) NULL)
10496    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10497  return(SetImageType(wand->images,image_type,wand->exception));
10498}
10499
10500/*
10501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10502%                                                                             %
10503%                                                                             %
10504%                                                                             %
10505%   M a g i c k S e t I m a g e U n i t s                                     %
10506%                                                                             %
10507%                                                                             %
10508%                                                                             %
10509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10510%
10511%  MagickSetImageUnits() sets the image units of resolution.
10512%
10513%  The format of the MagickSetImageUnits method is:
10514%
10515%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10516%        const ResolutionType units)
10517%
10518%  A description of each parameter follows:
10519%
10520%    o wand: the magick wand.
10521%
10522%    o units: the image units of resolution : UndefinedResolution,
10523%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10524%
10525*/
10526WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10527  const ResolutionType units)
10528{
10529  assert(wand != (MagickWand *) NULL);
10530  assert(wand->signature == WandSignature);
10531  if( IfMagickTrue(wand->debug) )
10532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10533
10534  if (wand->images == (Image *) NULL)
10535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10536  wand->images->units=units;
10537  return(MagickTrue);
10538}
10539
10540/*
10541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10542%                                                                             %
10543%                                                                             %
10544%                                                                             %
10545%   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           %
10546%                                                                             %
10547%                                                                             %
10548%                                                                             %
10549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10550%
10551%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10552%
10553%  The format of the MagickSetImageVirtualPixelMethod method is:
10554%
10555%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10556%        const VirtualPixelMethod method)
10557%
10558%  A description of each parameter follows:
10559%
10560%    o wand: the magick wand.
10561%
10562%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10563%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10564%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10565%
10566*/
10567WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10568  const VirtualPixelMethod method)
10569{
10570  assert(wand != (MagickWand *) NULL);
10571  assert(wand->signature == WandSignature);
10572  if( IfMagickTrue(wand->debug) )
10573    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10574
10575  if (wand->images == (Image *) NULL)
10576    return(UndefinedVirtualPixelMethod);
10577  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10578}
10579
10580/*
10581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10582%                                                                             %
10583%                                                                             %
10584%                                                                             %
10585%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10586%                                                                             %
10587%                                                                             %
10588%                                                                             %
10589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10590%
10591%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10592%
10593%  The format of the MagickSetImageWhitePoint method is:
10594%
10595%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10596%        const double x,const double y)
10597%
10598%  A description of each parameter follows:
10599%
10600%    o wand: the magick wand.
10601%
10602%    o x: the white x-point.
10603%
10604%    o y: the white y-point.
10605%
10606*/
10607WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10608  const double x,const double y)
10609{
10610  assert(wand != (MagickWand *) NULL);
10611  assert(wand->signature == WandSignature);
10612  if( IfMagickTrue(wand->debug) )
10613    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10614
10615  if (wand->images == (Image *) NULL)
10616    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10617  wand->images->chromaticity.white_point.x=x;
10618  wand->images->chromaticity.white_point.y=y;
10619  return(MagickTrue);
10620}
10621
10622/*
10623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10624%                                                                             %
10625%                                                                             %
10626%                                                                             %
10627%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10628%                                                                             %
10629%                                                                             %
10630%                                                                             %
10631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10632%
10633%  MagickShadeImage() shines a distant light on an image to create a
10634%  three-dimensional effect. You control the positioning of the light with
10635%  azimuth and elevation; azimuth is measured in degrees off the x axis
10636%  and elevation is measured in pixels above the Z axis.
10637%
10638%  The format of the MagickShadeImage method is:
10639%
10640%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10641%        const MagickBooleanType gray,const double azimuth,
10642%        const double elevation)
10643%
10644%  A description of each parameter follows:
10645%
10646%    o wand: the magick wand.
10647%
10648%    o gray: A value other than zero shades the intensity of each pixel.
10649%
10650%    o azimuth, elevation:  Define the light source direction.
10651%
10652*/
10653WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10654  const MagickBooleanType gray,const double asimuth,const double elevation)
10655{
10656  Image
10657    *shade_image;
10658
10659  assert(wand != (MagickWand *) NULL);
10660  assert(wand->signature == WandSignature);
10661  if( IfMagickTrue(wand->debug) )
10662    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10663
10664  if (wand->images == (Image *) NULL)
10665    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10666  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10667  if (shade_image == (Image *) NULL)
10668    return(MagickFalse);
10669  ReplaceImageInList(&wand->images,shade_image);
10670  return(MagickTrue);
10671}
10672
10673/*
10674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10675%                                                                             %
10676%                                                                             %
10677%                                                                             %
10678%   M a g i c k S h a d o w I m a g e                                         %
10679%                                                                             %
10680%                                                                             %
10681%                                                                             %
10682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10683%
10684%  MagickShadowImage() simulates an image shadow.
10685%
10686%  The format of the MagickShadowImage method is:
10687%
10688%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10689%        const double sigma,const ssize_t x,const ssize_t y)
10690%
10691%  A description of each parameter follows:
10692%
10693%    o wand: the magick wand.
10694%
10695%    o alpha: percentage transparency.
10696%
10697%    o sigma: the standard deviation of the Gaussian, in pixels.
10698%
10699%    o x: the shadow x-offset.
10700%
10701%    o y: the shadow y-offset.
10702%
10703*/
10704WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10705  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10706{
10707  Image
10708    *shadow_image;
10709
10710  assert(wand != (MagickWand *) NULL);
10711  assert(wand->signature == WandSignature);
10712  if( IfMagickTrue(wand->debug) )
10713    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10714
10715  if (wand->images == (Image *) NULL)
10716    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10717  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10718  if (shadow_image == (Image *) NULL)
10719    return(MagickFalse);
10720  ReplaceImageInList(&wand->images,shadow_image);
10721  return(MagickTrue);
10722}
10723
10724/*
10725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10726%                                                                             %
10727%                                                                             %
10728%                                                                             %
10729%   M a g i c k S h a r p e n I m a g e                                       %
10730%                                                                             %
10731%                                                                             %
10732%                                                                             %
10733%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10734%
10735%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10736%  Gaussian operator of the given radius and standard deviation (sigma).
10737%  For reasonable results, the radius should be larger than sigma.  Use a
10738%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10739%
10740%  The format of the MagickSharpenImage method is:
10741%
10742%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10743%        const double radius,const double sigma)
10744%
10745%  A description of each parameter follows:
10746%
10747%    o wand: the magick wand.
10748%
10749%    o radius: the radius of the Gaussian, in pixels, not counting the center
10750%      pixel.
10751%
10752%    o sigma: the standard deviation of the Gaussian, in pixels.
10753%
10754*/
10755WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10756  const double radius,const double sigma)
10757{
10758  Image
10759    *sharp_image;
10760
10761  assert(wand != (MagickWand *) NULL);
10762  assert(wand->signature == WandSignature);
10763  if( IfMagickTrue(wand->debug) )
10764    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10765
10766  if (wand->images == (Image *) NULL)
10767    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10768  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10769  if (sharp_image == (Image *) NULL)
10770    return(MagickFalse);
10771  ReplaceImageInList(&wand->images,sharp_image);
10772  return(MagickTrue);
10773}
10774
10775/*
10776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10777%                                                                             %
10778%                                                                             %
10779%                                                                             %
10780%   M a g i c k S h a v e I m a g e                                           %
10781%                                                                             %
10782%                                                                             %
10783%                                                                             %
10784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10785%
10786%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10787%  memory necessary for the new Image structure and returns a pointer to the
10788%  new image.
10789%
10790%  The format of the MagickShaveImage method is:
10791%
10792%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10793%        const size_t columns,const size_t rows)
10794%
10795%  A description of each parameter follows:
10796%
10797%    o wand: the magick wand.
10798%
10799%    o columns: the number of columns in the scaled image.
10800%
10801%    o rows: the number of rows in the scaled image.
10802%
10803%
10804*/
10805WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10806  const size_t columns,const size_t rows)
10807{
10808  Image
10809    *shave_image;
10810
10811  RectangleInfo
10812    shave_info;
10813
10814  assert(wand != (MagickWand *) NULL);
10815  assert(wand->signature == WandSignature);
10816  if( IfMagickTrue(wand->debug) )
10817    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10818
10819  if (wand->images == (Image *) NULL)
10820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10821  shave_info.width=columns;
10822  shave_info.height=rows;
10823  shave_info.x=0;
10824  shave_info.y=0;
10825  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10826  if (shave_image == (Image *) NULL)
10827    return(MagickFalse);
10828  ReplaceImageInList(&wand->images,shave_image);
10829  return(MagickTrue);
10830}
10831
10832/*
10833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10834%                                                                             %
10835%                                                                             %
10836%                                                                             %
10837%   M a g i c k S h e a r I m a g e                                           %
10838%                                                                             %
10839%                                                                             %
10840%                                                                             %
10841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10842%
10843%  MagickShearImage() slides one edge of an image along the X or Y axis,
10844%  creating a parallelogram.  An X direction shear slides an edge along the X
10845%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10846%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10847%  is measured relative to the Y axis, and similarly, for Y direction shears
10848%  y_shear is measured relative to the X axis.  Empty triangles left over from
10849%  shearing the image are filled with the background color.
10850%
10851%  The format of the MagickShearImage method is:
10852%
10853%      MagickBooleanType MagickShearImage(MagickWand *wand,
10854%        const PixelWand *background,const double x_shear,const double y_shear)
10855%
10856%  A description of each parameter follows:
10857%
10858%    o wand: the magick wand.
10859%
10860%    o background: the background pixel wand.
10861%
10862%    o x_shear: the number of degrees to shear the image.
10863%
10864%    o y_shear: the number of degrees to shear the image.
10865%
10866*/
10867WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10868  const PixelWand *background,const double x_shear,const double y_shear)
10869{
10870  Image
10871    *shear_image;
10872
10873  assert(wand != (MagickWand *) NULL);
10874  assert(wand->signature == WandSignature);
10875  if( IfMagickTrue(wand->debug) )
10876    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10877
10878  if (wand->images == (Image *) NULL)
10879    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10880  PixelGetQuantumPacket(background,&wand->images->background_color);
10881  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10882  if (shear_image == (Image *) NULL)
10883    return(MagickFalse);
10884  ReplaceImageInList(&wand->images,shear_image);
10885  return(MagickTrue);
10886}
10887
10888/*
10889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10890%                                                                             %
10891%                                                                             %
10892%                                                                             %
10893%   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                   %
10894%                                                                             %
10895%                                                                             %
10896%                                                                             %
10897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10898%
10899%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10900%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10901%  image using a sigmoidal transfer function without saturating highlights or
10902%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10903%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10904%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10905%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10906%  is reduced.
10907%
10908%  The format of the MagickSigmoidalContrastImage method is:
10909%
10910%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10911%        const MagickBooleanType sharpen,const double alpha,const double beta)
10912%
10913%  A description of each parameter follows:
10914%
10915%    o wand: the magick wand.
10916%
10917%    o sharpen: Increase or decrease image contrast.
10918%
10919%    o alpha: strength of the contrast, the larger the number the more
10920%      'threshold-like' it becomes.
10921%
10922%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10923%
10924*/
10925WandExport MagickBooleanType MagickSigmoidalContrastImage(
10926  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10927  const double beta)
10928{
10929  MagickBooleanType
10930    status;
10931
10932  assert(wand != (MagickWand *) NULL);
10933  assert(wand->signature == WandSignature);
10934  if( IfMagickTrue(wand->debug) )
10935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10936
10937  if (wand->images == (Image *) NULL)
10938    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10939  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10940    wand->exception);
10941  return(status);
10942}
10943
10944/*
10945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10946%                                                                             %
10947%                                                                             %
10948%                                                                             %
10949%   M a g i c k S i m i l a r i t y I m a g e                                 %
10950%                                                                             %
10951%                                                                             %
10952%                                                                             %
10953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10954%
10955%  MagickSimilarityImage() compares the reference image of the image and
10956%  returns the best match offset.  In addition, it returns a similarity image
10957%  such that an exact match location is completely white and if none of the
10958%  pixels match, black, otherwise some gray level in-between.
10959%
10960%  The format of the MagickSimilarityImage method is:
10961%
10962%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10963%        const MagickWand *reference,const MetricType metric,
10964%        RectangeInfo *offset,double *similarity)
10965%
10966%  A description of each parameter follows:
10967%
10968%    o wand: the magick wand.
10969%
10970%    o reference: the reference wand.
10971%
10972%    o metric: the metric.
10973%
10974%    o offset: the best match offset of the reference image within the image.
10975%
10976%    o similarity: the computed similarity between the images.
10977%
10978*/
10979WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10980  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10981  double *similarity)
10982{
10983  Image
10984    *similarity_image;
10985
10986  assert(wand != (MagickWand *) NULL);
10987  assert(wand->signature == WandSignature);
10988  if( IfMagickTrue(wand->debug) )
10989    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10990
10991  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10992    {
10993      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10994        "ContainsNoImages","'%s'",wand->name);
10995      return((MagickWand *) NULL);
10996    }
10997  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10998    similarity,wand->exception);
10999  if (similarity_image == (Image *) NULL)
11000    return((MagickWand *) NULL);
11001  return(CloneMagickWandFromImages(wand,similarity_image));
11002}
11003
11004/*
11005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11006%                                                                             %
11007%                                                                             %
11008%                                                                             %
11009%   M a g i c k S k e t c h I m a g e                                         %
11010%                                                                             %
11011%                                                                             %
11012%                                                                             %
11013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11014%
11015%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11016%  a Gaussian operator of the given radius and standard deviation (sigma).
11017%  For reasonable results, radius should be larger than sigma.  Use a
11018%  radius of 0 and SketchImage() selects a suitable radius for you.
11019%  Angle gives the angle of the blurring motion.
11020%
11021%  The format of the MagickSketchImage method is:
11022%
11023%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11024%        const double radius,const double sigma,const double angle)
11025%
11026%  A description of each parameter follows:
11027%
11028%    o wand: the magick wand.
11029%
11030%    o radius: the radius of the Gaussian, in pixels, not counting
11031%      the center pixel.
11032%
11033%    o sigma: the standard deviation of the Gaussian, in pixels.
11034%
11035%    o angle: apply the effect along this angle.
11036%
11037*/
11038WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11039  const double radius,const double sigma,const double angle)
11040{
11041  Image
11042    *sketch_image;
11043
11044  assert(wand != (MagickWand *) NULL);
11045  assert(wand->signature == WandSignature);
11046  if( IfMagickTrue(wand->debug) )
11047    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11048
11049  if (wand->images == (Image *) NULL)
11050    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11051  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11052  if (sketch_image == (Image *) NULL)
11053    return(MagickFalse);
11054  ReplaceImageInList(&wand->images,sketch_image);
11055  return(MagickTrue);
11056}
11057
11058/*
11059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11060%                                                                             %
11061%                                                                             %
11062%                                                                             %
11063%   M a g i c k S m u s h I m a g e s                                         %
11064%                                                                             %
11065%                                                                             %
11066%                                                                             %
11067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11068%
11069%  MagickSmushImages() takes all images from the current image pointer to the
11070%  end of the image list and smushs them to each other top-to-bottom if the
11071%  stack parameter is true, otherwise left-to-right.
11072%
11073%  The format of the MagickSmushImages method is:
11074%
11075%      MagickWand *MagickSmushImages(MagickWand *wand,
11076%        const MagickBooleanType stack,const ssize_t offset)
11077%
11078%  A description of each parameter follows:
11079%
11080%    o wand: the magick wand.
11081%
11082%    o stack: By default, images are stacked left-to-right. Set stack to
11083%      MagickTrue to stack them top-to-bottom.
11084%
11085%    o offset: minimum distance in pixels between images.
11086%
11087*/
11088WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11089  const MagickBooleanType stack,const ssize_t offset)
11090{
11091  Image
11092    *smush_image;
11093
11094  assert(wand != (MagickWand *) NULL);
11095  assert(wand->signature == WandSignature);
11096  if( IfMagickTrue(wand->debug) )
11097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11098
11099  if (wand->images == (Image *) NULL)
11100    return((MagickWand *) NULL);
11101  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11102  if (smush_image == (Image *) NULL)
11103    return((MagickWand *) NULL);
11104  return(CloneMagickWandFromImages(wand,smush_image));
11105}
11106
11107/*
11108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11109%                                                                             %
11110%                                                                             %
11111%                                                                             %
11112%     M a g i c k S o l a r i z e I m a g e                                   %
11113%                                                                             %
11114%                                                                             %
11115%                                                                             %
11116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11117%
11118%  MagickSolarizeImage() applies a special effect to the image, similar to the
11119%  effect achieved in a photo darkroom by selectively exposing areas of photo
11120%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11121%  measure of the extent of the solarization.
11122%
11123%  The format of the MagickSolarizeImage method is:
11124%
11125%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11126%        const double threshold)
11127%
11128%  A description of each parameter follows:
11129%
11130%    o wand: the magick wand.
11131%
11132%    o threshold:  Define the extent of the solarization.
11133%
11134*/
11135WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11136  const double threshold)
11137{
11138  MagickBooleanType
11139    status;
11140
11141  assert(wand != (MagickWand *) NULL);
11142  assert(wand->signature == WandSignature);
11143  if( IfMagickTrue(wand->debug) )
11144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11145
11146  if (wand->images == (Image *) NULL)
11147    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11148  status=SolarizeImage(wand->images,threshold,wand->exception);
11149  return(status);
11150}
11151
11152/*
11153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11154%                                                                             %
11155%                                                                             %
11156%                                                                             %
11157%   M a g i c k S p a r s e C o l o r I m a g e                               %
11158%                                                                             %
11159%                                                                             %
11160%                                                                             %
11161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11162%
11163%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11164%  colors found at those coordinates, across the whole image, using various
11165%  methods.
11166%
11167%  The format of the MagickSparseColorImage method is:
11168%
11169%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11170%        const SparseColorMethod method,const size_t number_arguments,
11171%        const double *arguments)
11172%
11173%  A description of each parameter follows:
11174%
11175%    o image: the image to be sparseed.
11176%
11177%    o method: the method of image sparseion.
11178%
11179%        ArcSparseColorion will always ignore source image offset, and always
11180%        'bestfit' the destination image with the top left corner offset
11181%        relative to the polar mapping center.
11182%
11183%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11184%        style of image sparseion.
11185%
11186%        Affine, Perspective, and Bilinear, will do least squares fitting of
11187%        the distrotion when more than the minimum number of control point
11188%        pairs are provided.
11189%
11190%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11191%        less than 4 control point pairs are provided. While Affine sparseions
11192%        will let you use any number of control point pairs, that is Zero pairs
11193%        is a No-Op (viewport only) distrotion, one pair is a translation and
11194%        two pairs of control points will do a scale-rotate-translate, without
11195%        any shearing.
11196%
11197%    o number_arguments: the number of arguments given for this sparseion
11198%      method.
11199%
11200%    o arguments: the arguments for this sparseion method.
11201%
11202*/
11203WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11204  const SparseColorMethod method,const size_t number_arguments,
11205  const double *arguments)
11206{
11207  Image
11208    *sparse_image;
11209
11210  assert(wand != (MagickWand *) NULL);
11211  assert(wand->signature == WandSignature);
11212  if( IfMagickTrue(wand->debug) )
11213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11214
11215  if (wand->images == (Image *) NULL)
11216    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11217  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11218    wand->exception);
11219  if (sparse_image == (Image *) NULL)
11220    return(MagickFalse);
11221  ReplaceImageInList(&wand->images,sparse_image);
11222  return(MagickTrue);
11223}
11224
11225/*
11226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11227%                                                                             %
11228%                                                                             %
11229%                                                                             %
11230%   M a g i c k S p l i c e I m a g e                                         %
11231%                                                                             %
11232%                                                                             %
11233%                                                                             %
11234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11235%
11236%  MagickSpliceImage() splices a solid color into the image.
11237%
11238%  The format of the MagickSpliceImage method is:
11239%
11240%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11241%        const size_t width,const size_t height,const ssize_t x,
11242%        const ssize_t y)
11243%
11244%  A description of each parameter follows:
11245%
11246%    o wand: the magick wand.
11247%
11248%    o width: the region width.
11249%
11250%    o height: the region height.
11251%
11252%    o x: the region x offset.
11253%
11254%    o y: the region y offset.
11255%
11256*/
11257WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11258  const size_t width,const size_t height,const ssize_t x,
11259  const ssize_t y)
11260{
11261  Image
11262    *splice_image;
11263
11264  RectangleInfo
11265    splice;
11266
11267  assert(wand != (MagickWand *) NULL);
11268  assert(wand->signature == WandSignature);
11269  if( IfMagickTrue(wand->debug) )
11270    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11271
11272  if (wand->images == (Image *) NULL)
11273    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11274  splice.width=width;
11275  splice.height=height;
11276  splice.x=x;
11277  splice.y=y;
11278  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11279  if (splice_image == (Image *) NULL)
11280    return(MagickFalse);
11281  ReplaceImageInList(&wand->images,splice_image);
11282  return(MagickTrue);
11283}
11284
11285/*
11286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11287%                                                                             %
11288%                                                                             %
11289%                                                                             %
11290%   M a g i c k S p r e a d I m a g e                                         %
11291%                                                                             %
11292%                                                                             %
11293%                                                                             %
11294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11295%
11296%  MagickSpreadImage() is a special effects method that randomly displaces each
11297%  pixel in a block defined by the radius parameter.
11298%
11299%  The format of the MagickSpreadImage method is:
11300%
11301%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11302%        const PixelInterpolateMethod method)
11303%
11304%  A description of each parameter follows:
11305%
11306%    o wand: the magick wand.
11307%
11308%    o radius:  Choose a random pixel in a neighborhood of this extent.
11309%
11310%    o method: the pixel interpolation method.
11311%
11312*/
11313WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11314  const double radius,const PixelInterpolateMethod method)
11315{
11316  Image
11317    *spread_image;
11318
11319  assert(wand != (MagickWand *) NULL);
11320  assert(wand->signature == WandSignature);
11321  if( IfMagickTrue(wand->debug) )
11322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11323
11324  if (wand->images == (Image *) NULL)
11325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11326  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11327  if (spread_image == (Image *) NULL)
11328    return(MagickFalse);
11329  ReplaceImageInList(&wand->images,spread_image);
11330  return(MagickTrue);
11331}
11332
11333/*
11334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11335%                                                                             %
11336%                                                                             %
11337%                                                                             %
11338%   M a g i c k S t a t i s t i c I m a g e                                   %
11339%                                                                             %
11340%                                                                             %
11341%                                                                             %
11342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11343%
11344%  MagickStatisticImage() replace each pixel with corresponding statistic from
11345%  the neighborhood of the specified width and height.
11346%
11347%  The format of the MagickStatisticImage method is:
11348%
11349%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11350%        const StatisticType type,const double width,const size_t height)
11351%
11352%  A description of each parameter follows:
11353%
11354%    o wand: the magick wand.
11355%
11356%    o type: the statistic type (e.g. median, mode, etc.).
11357%
11358%    o width: the width of the pixel neighborhood.
11359%
11360%    o height: the height of the pixel neighborhood.
11361%
11362*/
11363WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11364  const StatisticType type,const size_t width,const size_t height)
11365{
11366  Image
11367    *statistic_image;
11368
11369  assert(wand != (MagickWand *) NULL);
11370  assert(wand->signature == WandSignature);
11371  if( IfMagickTrue(wand->debug) )
11372    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11373
11374  if (wand->images == (Image *) NULL)
11375    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11376  statistic_image=StatisticImage(wand->images,type,width,height,
11377    wand->exception);
11378  if (statistic_image == (Image *) NULL)
11379    return(MagickFalse);
11380  ReplaceImageInList(&wand->images,statistic_image);
11381  return(MagickTrue);
11382}
11383
11384/*
11385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11386%                                                                             %
11387%                                                                             %
11388%                                                                             %
11389%   M a g i c k S t e g a n o I m a g e                                       %
11390%                                                                             %
11391%                                                                             %
11392%                                                                             %
11393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11394%
11395%  MagickSteganoImage() hides a digital watermark within the image.
11396%  Recover the hidden watermark later to prove that the authenticity of
11397%  an image.  Offset defines the start position within the image to hide
11398%  the watermark.
11399%
11400%  The format of the MagickSteganoImage method is:
11401%
11402%      MagickWand *MagickSteganoImage(MagickWand *wand,
11403%        const MagickWand *watermark_wand,const ssize_t offset)
11404%
11405%  A description of each parameter follows:
11406%
11407%    o wand: the magick wand.
11408%
11409%    o watermark_wand: the watermark wand.
11410%
11411%    o offset: Start hiding at this offset into the image.
11412%
11413*/
11414WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11415  const MagickWand *watermark_wand,const ssize_t offset)
11416{
11417  Image
11418    *stegano_image;
11419
11420  assert(wand != (MagickWand *) NULL);
11421  assert(wand->signature == WandSignature);
11422  if( IfMagickTrue(wand->debug) )
11423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11424
11425  if ((wand->images == (Image *) NULL) ||
11426      (watermark_wand->images == (Image *) NULL))
11427    {
11428      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11429        "ContainsNoImages","'%s'",wand->name);
11430      return((MagickWand *) NULL);
11431    }
11432  wand->images->offset=offset;
11433  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11434    wand->exception);
11435  if (stegano_image == (Image *) NULL)
11436    return((MagickWand *) NULL);
11437  return(CloneMagickWandFromImages(wand,stegano_image));
11438}
11439
11440/*
11441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11442%                                                                             %
11443%                                                                             %
11444%                                                                             %
11445%   M a g i c k S t e r e o I m a g e                                         %
11446%                                                                             %
11447%                                                                             %
11448%                                                                             %
11449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11450%
11451%  MagickStereoImage() composites two images and produces a single image that
11452%  is the composite of a left and right image of a stereo pair
11453%
11454%  The format of the MagickStereoImage method is:
11455%
11456%      MagickWand *MagickStereoImage(MagickWand *wand,
11457%        const MagickWand *offset_wand)
11458%
11459%  A description of each parameter follows:
11460%
11461%    o wand: the magick wand.
11462%
11463%    o offset_wand: Another image wand.
11464%
11465*/
11466WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11467  const MagickWand *offset_wand)
11468{
11469  Image
11470    *stereo_image;
11471
11472  assert(wand != (MagickWand *) NULL);
11473  assert(wand->signature == WandSignature);
11474  if( IfMagickTrue(wand->debug) )
11475    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11476
11477  if ((wand->images == (Image *) NULL) ||
11478      (offset_wand->images == (Image *) NULL))
11479    {
11480      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11481        "ContainsNoImages","'%s'",wand->name);
11482      return((MagickWand *) NULL);
11483    }
11484  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11485  if (stereo_image == (Image *) NULL)
11486    return((MagickWand *) NULL);
11487  return(CloneMagickWandFromImages(wand,stereo_image));
11488}
11489
11490/*
11491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11492%                                                                             %
11493%                                                                             %
11494%                                                                             %
11495%   M a g i c k S t r i p I m a g e                                           %
11496%                                                                             %
11497%                                                                             %
11498%                                                                             %
11499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11500%
11501%  MagickStripImage() strips an image of all profiles and comments.
11502%
11503%  The format of the MagickStripImage method is:
11504%
11505%      MagickBooleanType MagickStripImage(MagickWand *wand)
11506%
11507%  A description of each parameter follows:
11508%
11509%    o wand: the magick wand.
11510%
11511*/
11512WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11513{
11514  assert(wand != (MagickWand *) NULL);
11515  assert(wand->signature == WandSignature);
11516  if( IfMagickTrue(wand->debug) )
11517    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11518
11519  if (wand->images == (Image *) NULL)
11520    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11521  return(StripImage(wand->images,wand->exception));
11522}
11523
11524/*
11525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11526%                                                                             %
11527%                                                                             %
11528%                                                                             %
11529%   M a g i c k S w i r l I m a g e                                           %
11530%                                                                             %
11531%                                                                             %
11532%                                                                             %
11533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11534%
11535%  MagickSwirlImage() swirls the pixels about the center of the image, where
11536%  degrees indicates the sweep of the arc through which each pixel is moved.
11537%  You get a more dramatic effect as the degrees move from 1 to 360.
11538%
11539%  The format of the MagickSwirlImage method is:
11540%
11541%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11542%        const PixelInterpolateMethod method)
11543%
11544%  A description of each parameter follows:
11545%
11546%    o wand: the magick wand.
11547%
11548%    o degrees: Define the tightness of the swirling effect.
11549%
11550%    o method: the pixel interpolation method.
11551%
11552*/
11553WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11554  const double degrees,const PixelInterpolateMethod method)
11555{
11556  Image
11557    *swirl_image;
11558
11559  assert(wand != (MagickWand *) NULL);
11560  assert(wand->signature == WandSignature);
11561  if( IfMagickTrue(wand->debug) )
11562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11563
11564  if (wand->images == (Image *) NULL)
11565    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11566  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11567  if (swirl_image == (Image *) NULL)
11568    return(MagickFalse);
11569  ReplaceImageInList(&wand->images,swirl_image);
11570  return(MagickTrue);
11571}
11572
11573/*
11574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11575%                                                                             %
11576%                                                                             %
11577%                                                                             %
11578%   M a g i c k T e x t u r e I m a g e                                       %
11579%                                                                             %
11580%                                                                             %
11581%                                                                             %
11582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11583%
11584%  MagickTextureImage() repeatedly tiles the texture image across and down the
11585%  image canvas.
11586%
11587%  The format of the MagickTextureImage method is:
11588%
11589%      MagickWand *MagickTextureImage(MagickWand *wand,
11590%        const MagickWand *texture_wand)
11591%
11592%  A description of each parameter follows:
11593%
11594%    o wand: the magick wand.
11595%
11596%    o texture_wand: the texture wand
11597%
11598*/
11599WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11600  const MagickWand *texture_wand)
11601{
11602  Image
11603    *texture_image;
11604
11605  MagickBooleanType
11606    status;
11607
11608  assert(wand != (MagickWand *) NULL);
11609  assert(wand->signature == WandSignature);
11610  if( IfMagickTrue(wand->debug) )
11611    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11612
11613  if ((wand->images == (Image *) NULL) ||
11614      (texture_wand->images == (Image *) NULL))
11615    {
11616      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11617        "ContainsNoImages","'%s'",wand->name);
11618      return((MagickWand *) NULL);
11619    }
11620  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11621  if (texture_image == (Image *) NULL)
11622    return((MagickWand *) NULL);
11623  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11624  if( IfMagickFalse(status) )
11625    {
11626      texture_image=DestroyImage(texture_image);
11627      return((MagickWand *) NULL);
11628    }
11629  return(CloneMagickWandFromImages(wand,texture_image));
11630}
11631
11632/*
11633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11634%                                                                             %
11635%                                                                             %
11636%                                                                             %
11637%   M a g i c k T h r e s h o l d I m a g e                                   %
11638%                                                                             %
11639%                                                                             %
11640%                                                                             %
11641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642%
11643%  MagickThresholdImage() changes the value of individual pixels based on
11644%  the intensity of each pixel compared to threshold.  The result is a
11645%  high-contrast, two color image.
11646%
11647%  The format of the MagickThresholdImage method is:
11648%
11649%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11650%        const double threshold)
11651%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11652%        const ChannelType channel,const double threshold)
11653%
11654%  A description of each parameter follows:
11655%
11656%    o wand: the magick wand.
11657%
11658%    o channel: the image channel(s).
11659%
11660%    o threshold: Define the threshold value.
11661%
11662*/
11663WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11664  const double threshold)
11665{
11666  MagickBooleanType
11667    status;
11668
11669  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11670  return(status);
11671}
11672
11673WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11674  const ChannelType channel,const double threshold)
11675{
11676  MagickBooleanType
11677    status;
11678
11679  assert(wand != (MagickWand *) NULL);
11680  assert(wand->signature == WandSignature);
11681  if( IfMagickTrue(wand->debug) )
11682    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11683
11684  if (wand->images == (Image *) NULL)
11685    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11686  status=BilevelImage(wand->images,threshold,wand->exception);
11687  return(status);
11688}
11689
11690/*
11691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11692%                                                                             %
11693%                                                                             %
11694%                                                                             %
11695%   M a g i c k T h u m b n a i l I m a g e                                   %
11696%                                                                             %
11697%                                                                             %
11698%                                                                             %
11699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11700%
11701%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11702%  and removes any associated profiles.  The goal is to produce small low cost
11703%  thumbnail images suited for display on the Web.
11704%
11705%  The format of the MagickThumbnailImage method is:
11706%
11707%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11708%        const size_t columns,const size_t rows)
11709%
11710%  A description of each parameter follows:
11711%
11712%    o wand: the magick wand.
11713%
11714%    o columns: the number of columns in the scaled image.
11715%
11716%    o rows: the number of rows in the scaled image.
11717%
11718*/
11719WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11720  const size_t columns,const size_t rows)
11721{
11722  Image
11723    *thumbnail_image;
11724
11725  assert(wand != (MagickWand *) NULL);
11726  assert(wand->signature == WandSignature);
11727  if( IfMagickTrue(wand->debug) )
11728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11729
11730  if (wand->images == (Image *) NULL)
11731    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11732  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11733  if (thumbnail_image == (Image *) NULL)
11734    return(MagickFalse);
11735  ReplaceImageInList(&wand->images,thumbnail_image);
11736  return(MagickTrue);
11737}
11738
11739/*
11740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11741%                                                                             %
11742%                                                                             %
11743%                                                                             %
11744%   M a g i c k T i n t I m a g e                                             %
11745%                                                                             %
11746%                                                                             %
11747%                                                                             %
11748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11749%
11750%  MagickTintImage() applies a color vector to each pixel in the image.  The
11751%  length of the vector is 0 for black and white and at its maximum for the
11752%  midtones.  The vector weighting function is
11753%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11754%
11755%  The format of the MagickTintImage method is:
11756%
11757%      MagickBooleanType MagickTintImage(MagickWand *wand,
11758%        const PixelWand *tint,const PixelWand *blend)
11759%
11760%  A description of each parameter follows:
11761%
11762%    o wand: the magick wand.
11763%
11764%    o tint: the tint pixel wand.
11765%
11766%    o alpha: the alpha pixel wand.
11767%
11768*/
11769WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11770  const PixelWand *tint,const PixelWand *blend)
11771{
11772  char
11773    percent_blend[MaxTextExtent];
11774
11775  Image
11776    *tint_image;
11777
11778  PixelInfo
11779    target;
11780
11781  assert(wand != (MagickWand *) NULL);
11782  assert(wand->signature == WandSignature);
11783  if( IfMagickTrue(wand->debug) )
11784    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11785
11786  if (wand->images == (Image *) NULL)
11787    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11788  if (wand->images->colorspace != CMYKColorspace)
11789    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11790      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11791      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11792      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11793      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11794      PixelGetAlphaQuantum(blend)));
11795  else
11796    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11797      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11798      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11799      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11800      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11801      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11802      PixelGetAlphaQuantum(blend)));
11803  target=PixelGetPixel(tint);
11804  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11805  if (tint_image == (Image *) NULL)
11806    return(MagickFalse);
11807  ReplaceImageInList(&wand->images,tint_image);
11808  return(MagickTrue);
11809}
11810
11811/*
11812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11813%                                                                             %
11814%                                                                             %
11815%                                                                             %
11816%   M a g i c k T r a n s f o r m I m a g e                                   %
11817%                                                                             %
11818%                                                                             %
11819%                                                                             %
11820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11821%
11822%  MagickTransformImage() is a convenience method that behaves like
11823%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11824%  information as a region geometry specification.  If the operation fails,
11825%  a NULL image handle is returned.
11826%
11827%  The format of the MagickTransformImage method is:
11828%
11829%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11830%        const char *geometry)
11831%
11832%  A description of each parameter follows:
11833%
11834%    o wand: the magick wand.
11835%
11836%    o crop: A crop geometry string.  This geometry defines a subregion of the
11837%      image to crop.
11838%
11839%    o geometry: An image geometry string.  This geometry defines the final
11840%      size of the image.
11841%
11842*/
11843WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11844  const char *crop,const char *geometry)
11845{
11846  Image
11847    *transform_image;
11848
11849  MagickBooleanType
11850    status;
11851
11852  assert(wand != (MagickWand *) NULL);
11853  assert(wand->signature == WandSignature);
11854  if( IfMagickTrue(wand->debug) )
11855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11856
11857
11858  if (wand->images == (Image *) NULL)
11859    return((MagickWand *) NULL);
11860  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11861  if (transform_image == (Image *) NULL)
11862    return((MagickWand *) NULL);
11863  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11864  if( IfMagickFalse(status) )
11865    {
11866      transform_image=DestroyImage(transform_image);
11867      return((MagickWand *) NULL);
11868    }
11869  return(CloneMagickWandFromImages(wand,transform_image));
11870}
11871
11872/*
11873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11874%                                                                             %
11875%                                                                             %
11876%                                                                             %
11877%   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               %
11878%                                                                             %
11879%                                                                             %
11880%                                                                             %
11881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11882%
11883%  MagickTransformImageColorspace() transform the image colorspace, setting
11884%  the images colorspace while transforming the images data to that
11885%  colorspace.
11886%
11887%  The format of the MagickTransformImageColorspace method is:
11888%
11889%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11890%        const ColorspaceType colorspace)
11891%
11892%  A description of each parameter follows:
11893%
11894%    o wand: the magick wand.
11895%
11896%    o colorspace: the image colorspace:   UndefinedColorspace,
11897%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11898%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11899%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11900%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11901%      HSLColorspace, HWBColorspace.
11902%
11903*/
11904WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11905  const ColorspaceType colorspace)
11906{
11907  assert(wand != (MagickWand *) NULL);
11908  assert(wand->signature == WandSignature);
11909  if( IfMagickTrue(wand->debug) )
11910    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11911
11912
11913  if (wand->images == (Image *) NULL)
11914    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11915  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11916}
11917
11918/*
11919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11920%                                                                             %
11921%                                                                             %
11922%                                                                             %
11923%   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                     %
11924%                                                                             %
11925%                                                                             %
11926%                                                                             %
11927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11928%
11929%  MagickTransparentPaintImage() changes any pixel that matches color with the
11930%  color defined by fill.
11931%
11932%  The format of the MagickTransparentPaintImage method is:
11933%
11934%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11935%        const PixelWand *target,const double alpha,const double fuzz,
11936%        const MagickBooleanType invert)
11937%
11938%  A description of each parameter follows:
11939%
11940%    o wand: the magick wand.
11941%
11942%    o target: Change this target color to specified alpha value within
11943%      the image.
11944%
11945%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11946%      transparent.
11947%
11948%    o fuzz: By default target must match a particular pixel color
11949%      exactly.  However, in many cases two colors may differ by a small amount.
11950%      The fuzz member of image defines how much tolerance is acceptable to
11951%      consider two colors as the same.  For example, set fuzz to 10 and the
11952%      color red at intensities of 100 and 102 respectively are now interpreted
11953%      as the same color for the purposes of the floodfill.
11954%
11955%    o invert: paint any pixel that does not match the target color.
11956%
11957*/
11958WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11959  const PixelWand *target,const double alpha,const double fuzz,
11960  const MagickBooleanType invert)
11961{
11962  MagickBooleanType
11963    status;
11964
11965  PixelInfo
11966    target_pixel;
11967
11968  assert(wand != (MagickWand *) NULL);
11969  assert(wand->signature == WandSignature);
11970  if( IfMagickTrue(wand->debug) )
11971    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11972
11973
11974  if (wand->images == (Image *) NULL)
11975    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11976  PixelGetMagickColor(target,&target_pixel);
11977  wand->images->fuzz=fuzz;
11978  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11979    QuantumRange*alpha),invert,wand->exception);
11980  return(status);
11981}
11982
11983/*
11984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11985%                                                                             %
11986%                                                                             %
11987%                                                                             %
11988%   M a g i c k T r a n s p o s e I m a g e                                   %
11989%                                                                             %
11990%                                                                             %
11991%                                                                             %
11992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11993%
11994%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11995%  pixels around the central x-axis while rotating them 90-degrees.
11996%
11997%  The format of the MagickTransposeImage method is:
11998%
11999%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12000%
12001%  A description of each parameter follows:
12002%
12003%    o wand: the magick wand.
12004%
12005*/
12006WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12007{
12008  Image
12009    *transpose_image;
12010
12011  assert(wand != (MagickWand *) NULL);
12012  assert(wand->signature == WandSignature);
12013  if( IfMagickTrue(wand->debug) )
12014    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12015
12016  if (wand->images == (Image *) NULL)
12017    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12018  transpose_image=TransposeImage(wand->images,wand->exception);
12019  if (transpose_image == (Image *) NULL)
12020    return(MagickFalse);
12021  ReplaceImageInList(&wand->images,transpose_image);
12022  return(MagickTrue);
12023}
12024
12025/*
12026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12027%                                                                             %
12028%                                                                             %
12029%                                                                             %
12030%   M a g i c k T r a n s v e r s e I m a g e                                 %
12031%                                                                             %
12032%                                                                             %
12033%                                                                             %
12034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12035%
12036%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12037%  pixels around the central y-axis while rotating them 270-degrees.
12038%
12039%  The format of the MagickTransverseImage method is:
12040%
12041%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12042%
12043%  A description of each parameter follows:
12044%
12045%    o wand: the magick wand.
12046%
12047*/
12048WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12049{
12050  Image
12051    *transverse_image;
12052
12053  assert(wand != (MagickWand *) NULL);
12054  assert(wand->signature == WandSignature);
12055  if( IfMagickTrue(wand->debug) )
12056    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12057
12058  if (wand->images == (Image *) NULL)
12059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12060  transverse_image=TransverseImage(wand->images,wand->exception);
12061  if (transverse_image == (Image *) NULL)
12062    return(MagickFalse);
12063  ReplaceImageInList(&wand->images,transverse_image);
12064  return(MagickTrue);
12065}
12066
12067/*
12068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12069%                                                                             %
12070%                                                                             %
12071%                                                                             %
12072%   M a g i c k T r i m I m a g e                                             %
12073%                                                                             %
12074%                                                                             %
12075%                                                                             %
12076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12077%
12078%  MagickTrimImage() remove edges that are the background color from the image.
12079%
12080%  The format of the MagickTrimImage method is:
12081%
12082%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12083%
12084%  A description of each parameter follows:
12085%
12086%    o wand: the magick wand.
12087%
12088%    o fuzz: By default target must match a particular pixel color
12089%      exactly.  However, in many cases two colors may differ by a small amount.
12090%      The fuzz member of image defines how much tolerance is acceptable to
12091%      consider two colors as the same.  For example, set fuzz to 10 and the
12092%      color red at intensities of 100 and 102 respectively are now interpreted
12093%      as the same color for the purposes of the floodfill.
12094%
12095*/
12096WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12097{
12098  Image
12099    *trim_image;
12100
12101  assert(wand != (MagickWand *) NULL);
12102  assert(wand->signature == WandSignature);
12103  if( IfMagickTrue(wand->debug) )
12104    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12105
12106  if (wand->images == (Image *) NULL)
12107    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12108  wand->images->fuzz=fuzz;
12109  trim_image=TrimImage(wand->images,wand->exception);
12110  if (trim_image == (Image *) NULL)
12111    return(MagickFalse);
12112  ReplaceImageInList(&wand->images,trim_image);
12113  return(MagickTrue);
12114}
12115
12116/*
12117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12118%                                                                             %
12119%                                                                             %
12120%                                                                             %
12121%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12122%                                                                             %
12123%                                                                             %
12124%                                                                             %
12125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12126%
12127%  MagickUniqueImageColors() discards all but one of any pixel color.
12128%
12129%  The format of the MagickUniqueImageColors method is:
12130%
12131%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12132%
12133%  A description of each parameter follows:
12134%
12135%    o wand: the magick wand.
12136%
12137*/
12138WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12139{
12140  Image
12141    *unique_image;
12142
12143  assert(wand != (MagickWand *) NULL);
12144  assert(wand->signature == WandSignature);
12145  if( IfMagickTrue(wand->debug) )
12146    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12147
12148  if (wand->images == (Image *) NULL)
12149    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12150  unique_image=UniqueImageColors(wand->images,wand->exception);
12151  if (unique_image == (Image *) NULL)
12152    return(MagickFalse);
12153  ReplaceImageInList(&wand->images,unique_image);
12154  return(MagickTrue);
12155}
12156
12157/*
12158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12159%                                                                             %
12160%                                                                             %
12161%                                                                             %
12162%   M a g i c k U n s h a r p M a s k I m a g e                               %
12163%                                                                             %
12164%                                                                             %
12165%                                                                             %
12166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12167%
12168%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12169%  Gaussian operator of the given radius and standard deviation (sigma).
12170%  For reasonable results, radius should be larger than sigma.  Use a radius
12171%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12172%
12173%  The format of the MagickUnsharpMaskImage method is:
12174%
12175%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12176%        const double radius,const double sigma,const double amount,
12177%        const double threshold)
12178%
12179%  A description of each parameter follows:
12180%
12181%    o wand: the magick wand.
12182%
12183%    o radius: the radius of the Gaussian, in pixels, not counting the center
12184%      pixel.
12185%
12186%    o sigma: the standard deviation of the Gaussian, in pixels.
12187%
12188%    o amount: the percentage of the difference between the original and the
12189%      blur image that is added back into the original.
12190%
12191%    o threshold: the threshold in pixels needed to apply the diffence amount.
12192%
12193*/
12194WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12195  const double radius,const double sigma,const double amount,
12196  const double threshold)
12197{
12198  Image
12199    *unsharp_image;
12200
12201  assert(wand != (MagickWand *) NULL);
12202  assert(wand->signature == WandSignature);
12203  if( IfMagickTrue(wand->debug) )
12204    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12205
12206  if (wand->images == (Image *) NULL)
12207    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12208  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
12209    wand->exception);
12210  if (unsharp_image == (Image *) NULL)
12211    return(MagickFalse);
12212  ReplaceImageInList(&wand->images,unsharp_image);
12213  return(MagickTrue);
12214}
12215
12216/*
12217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12218%                                                                             %
12219%                                                                             %
12220%                                                                             %
12221%   M a g i c k V i g n e t t e I m a g e                                     %
12222%                                                                             %
12223%                                                                             %
12224%                                                                             %
12225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12226%
12227%  MagickVignetteImage() softens the edges of the image in vignette style.
12228%
12229%  The format of the MagickVignetteImage method is:
12230%
12231%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12232%        const double radius,const double sigma,const ssize_t x,
12233%        const ssize_t y)
12234%
12235%  A description of each parameter follows:
12236%
12237%    o wand: the magick wand.
12238%
12239%    o radius: the radius.
12240%
12241%    o sigma: the sigma.
12242%
12243%    o x, y:  Define the x and y ellipse offset.
12244%
12245*/
12246WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12247  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12248{
12249  Image
12250    *vignette_image;
12251
12252  assert(wand != (MagickWand *) NULL);
12253  assert(wand->signature == WandSignature);
12254  if( IfMagickTrue(wand->debug) )
12255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12256
12257  if (wand->images == (Image *) NULL)
12258    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12259  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12260  if (vignette_image == (Image *) NULL)
12261    return(MagickFalse);
12262  ReplaceImageInList(&wand->images,vignette_image);
12263  return(MagickTrue);
12264}
12265
12266/*
12267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12268%                                                                             %
12269%                                                                             %
12270%                                                                             %
12271%   M a g i c k W a v e I m a g e                                             %
12272%                                                                             %
12273%                                                                             %
12274%                                                                             %
12275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12276%
12277%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12278%  the pixels vertically along a sine wave whose amplitude and wavelength
12279%  is specified by the given parameters.
12280%
12281%  The format of the MagickWaveImage method is:
12282%
12283%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12284%        const double amplitude,const double wave_length,
12285%        const PixelInterpolateMethod method)
12286%
12287%  A description of each parameter follows:
12288%
12289%    o wand: the magick wand.
12290%
12291%    o amplitude, wave_length:  Define the amplitude and wave length of the
12292%      sine wave.
12293%
12294%    o method: the pixel interpolation method.
12295%
12296*/
12297WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12298  const double amplitude,const double wave_length,
12299  const PixelInterpolateMethod method)
12300{
12301  Image
12302    *wave_image;
12303
12304  assert(wand != (MagickWand *) NULL);
12305  assert(wand->signature == WandSignature);
12306  if( IfMagickTrue(wand->debug) )
12307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12308
12309  if (wand->images == (Image *) NULL)
12310    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12311  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12312    wand->exception);
12313  if (wave_image == (Image *) NULL)
12314    return(MagickFalse);
12315  ReplaceImageInList(&wand->images,wave_image);
12316  return(MagickTrue);
12317}
12318
12319/*
12320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12321%                                                                             %
12322%                                                                             %
12323%                                                                             %
12324%   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                         %
12325%                                                                             %
12326%                                                                             %
12327%                                                                             %
12328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12329%
12330%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12331%  above the threshold into white while leaving all pixels below the threshold
12332%  unchanged.
12333%
12334%  The format of the MagickWhiteThresholdImage method is:
12335%
12336%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12337%        const PixelWand *threshold)
12338%
12339%  A description of each parameter follows:
12340%
12341%    o wand: the magick wand.
12342%
12343%    o threshold: the pixel wand.
12344%
12345*/
12346WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12347  const PixelWand *threshold)
12348{
12349  char
12350    thresholds[MaxTextExtent];
12351
12352  assert(wand != (MagickWand *) NULL);
12353  assert(wand->signature == WandSignature);
12354  if( IfMagickTrue(wand->debug) )
12355    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12356
12357  if (wand->images == (Image *) NULL)
12358    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12359  (void) FormatLocaleString(thresholds,MaxTextExtent,
12360    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12361    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12362    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12363  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12364}
12365
12366/*
12367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12368%                                                                             %
12369%                                                                             %
12370%                                                                             %
12371%   M a g i c k W r i t e I m a g e                                           %
12372%                                                                             %
12373%                                                                             %
12374%                                                                             %
12375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12376%
12377%  MagickWriteImage() writes an image to the specified filename.  If the
12378%  filename parameter is NULL, the image is written to the filename set
12379%  by MagickReadImage() or MagickSetImageFilename().
12380%
12381%  The format of the MagickWriteImage method is:
12382%
12383%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12384%        const char *filename)
12385%
12386%  A description of each parameter follows:
12387%
12388%    o wand: the magick wand.
12389%
12390%    o filename: the image filename.
12391%
12392%
12393*/
12394WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12395  const char *filename)
12396{
12397  Image
12398    *image;
12399
12400  ImageInfo
12401    *write_info;
12402
12403  MagickBooleanType
12404    status;
12405
12406  assert(wand != (MagickWand *) NULL);
12407  assert(wand->signature == WandSignature);
12408  if( IfMagickTrue(wand->debug) )
12409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12410
12411  if (wand->images == (Image *) NULL)
12412    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12413  if (filename != (const char *) NULL)
12414    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12415  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12416  if (image == (Image *) NULL)
12417    return(MagickFalse);
12418  write_info=CloneImageInfo(wand->image_info);
12419  write_info->adjoin=MagickTrue;
12420  status=WriteImage(write_info,image,wand->exception);
12421  image=DestroyImage(image);
12422  write_info=DestroyImageInfo(write_info);
12423  return(status);
12424}
12425
12426/*
12427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12428%                                                                             %
12429%                                                                             %
12430%                                                                             %
12431%   M a g i c k W r i t e I m a g e F i l e                                   %
12432%                                                                             %
12433%                                                                             %
12434%                                                                             %
12435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12436%
12437%  MagickWriteImageFile() writes an image to an open file descriptor.
12438%
12439%  The format of the MagickWriteImageFile method is:
12440%
12441%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12442%
12443%  A description of each parameter follows:
12444%
12445%    o wand: the magick wand.
12446%
12447%    o file: the file descriptor.
12448%
12449*/
12450WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12451{
12452  Image
12453    *image;
12454
12455  ImageInfo
12456    *write_info;
12457
12458  MagickBooleanType
12459    status;
12460
12461  assert(wand != (MagickWand *) NULL);
12462  assert(wand->signature == WandSignature);
12463  assert(file != (FILE *) NULL);
12464  if( IfMagickTrue(wand->debug) )
12465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12466
12467  if (wand->images == (Image *) NULL)
12468    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12469  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12470  if (image == (Image *) NULL)
12471    return(MagickFalse);
12472  write_info=CloneImageInfo(wand->image_info);
12473  SetImageInfoFile(write_info,file);
12474  write_info->adjoin=MagickTrue;
12475  status=WriteImage(write_info,image,wand->exception);
12476  write_info=DestroyImageInfo(write_info);
12477  image=DestroyImage(image);
12478  return(status);
12479}
12480
12481/*
12482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12483%                                                                             %
12484%                                                                             %
12485%                                                                             %
12486%   M a g i c k W r i t e I m a g e s                                         %
12487%                                                                             %
12488%                                                                             %
12489%                                                                             %
12490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12491%
12492%  MagickWriteImages() writes an image or image sequence.
12493%
12494%  The format of the MagickWriteImages method is:
12495%
12496%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12497%        const char *filename,const MagickBooleanType adjoin)
12498%
12499%  A description of each parameter follows:
12500%
12501%    o wand: the magick wand.
12502%
12503%    o filename: the image filename.
12504%
12505%    o adjoin: join images into a single multi-image file.
12506%
12507*/
12508WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12509  const char *filename,const MagickBooleanType adjoin)
12510{
12511  ImageInfo
12512    *write_info;
12513
12514  MagickBooleanType
12515    status;
12516
12517  assert(wand != (MagickWand *) NULL);
12518  assert(wand->signature == WandSignature);
12519  if( IfMagickTrue(wand->debug) )
12520    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12521
12522  if (wand->images == (Image *) NULL)
12523    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12524  write_info=CloneImageInfo(wand->image_info);
12525  write_info->adjoin=adjoin;
12526  status=WriteImages(write_info,wand->images,filename,wand->exception);
12527  write_info=DestroyImageInfo(write_info);
12528  return(status);
12529}
12530
12531/*
12532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12533%                                                                             %
12534%                                                                             %
12535%                                                                             %
12536%   M a g i c k W r i t e I m a g e s F i l e                                 %
12537%                                                                             %
12538%                                                                             %
12539%                                                                             %
12540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12541%
12542%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12543%
12544%  The format of the MagickWriteImagesFile method is:
12545%
12546%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12547%
12548%  A description of each parameter follows:
12549%
12550%    o wand: the magick wand.
12551%
12552%    o file: the file descriptor.
12553%
12554*/
12555WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12556{
12557  ImageInfo
12558    *write_info;
12559
12560  MagickBooleanType
12561    status;
12562
12563  assert(wand != (MagickWand *) NULL);
12564  assert(wand->signature == WandSignature);
12565  if( IfMagickTrue(wand->debug) )
12566    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12567
12568  if (wand->images == (Image *) NULL)
12569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12570  write_info=CloneImageInfo(wand->image_info);
12571  SetImageInfoFile(write_info,file);
12572  write_info->adjoin=MagickTrue;
12573  status=WriteImages(write_info,wand->images,(const char *) NULL,
12574    wand->exception);
12575  write_info=DestroyImageInfo(write_info);
12576  return(status);
12577}
12578