magick-image.c revision b15b06c9f7ba2bf0e0ebcd88d0175536a5392c93
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%      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  if (wand->images == (Image *) NULL)
4729    {
4730      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4731        "ContainsNoImages","'%s'",wand->name);
4732      return((char *) NULL);
4733    }
4734  return(AcquireString(wand->images->magick));
4735}
4736
4737/*
4738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4739%                                                                             %
4740%                                                                             %
4741%                                                                             %
4742%   M a g i c k G e t I m a g e F u z z                                       %
4743%                                                                             %
4744%                                                                             %
4745%                                                                             %
4746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4747%
4748%  MagickGetImageFuzz() gets the image fuzz.
4749%
4750%  The format of the MagickGetImageFuzz method is:
4751%
4752%      double MagickGetImageFuzz(MagickWand *wand)
4753%
4754%  A description of each parameter follows:
4755%
4756%    o wand: the magick wand.
4757%
4758*/
4759WandExport double MagickGetImageFuzz(MagickWand *wand)
4760{
4761  assert(wand != (MagickWand *) NULL);
4762  assert(wand->signature == WandSignature);
4763  if( IfMagickTrue(wand->debug) )
4764    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4765
4766  if (wand->images == (Image *) NULL)
4767    {
4768      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4769        "ContainsNoImages","'%s'",wand->name);
4770      return(0.0);
4771    }
4772  return(wand->images->fuzz);
4773}
4774
4775/*
4776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4777%                                                                             %
4778%                                                                             %
4779%                                                                             %
4780%   M a g i c k G e t I m a g e G a m m a                                     %
4781%                                                                             %
4782%                                                                             %
4783%                                                                             %
4784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4785%
4786%  MagickGetImageGamma() gets the image gamma.
4787%
4788%  The format of the MagickGetImageGamma method is:
4789%
4790%      double MagickGetImageGamma(MagickWand *wand)
4791%
4792%  A description of each parameter follows:
4793%
4794%    o wand: the magick wand.
4795%
4796*/
4797WandExport double MagickGetImageGamma(MagickWand *wand)
4798{
4799  assert(wand != (MagickWand *) NULL);
4800  assert(wand->signature == WandSignature);
4801  if( IfMagickTrue(wand->debug) )
4802    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4803
4804  if (wand->images == (Image *) NULL)
4805    {
4806      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4807        "ContainsNoImages","'%s'",wand->name);
4808      return(0.0);
4809    }
4810  return(wand->images->gamma);
4811}
4812
4813/*
4814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4815%                                                                             %
4816%                                                                             %
4817%                                                                             %
4818%   M a g i c k G e t I m a g e G r a v i t y                                 %
4819%                                                                             %
4820%                                                                             %
4821%                                                                             %
4822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4823%
4824%  MagickGetImageGravity() gets the image gravity.
4825%
4826%  The format of the MagickGetImageGravity method is:
4827%
4828%      GravityType MagickGetImageGravity(MagickWand *wand)
4829%
4830%  A description of each parameter follows:
4831%
4832%    o wand: the magick wand.
4833%
4834*/
4835WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4836{
4837  assert(wand != (MagickWand *) NULL);
4838  assert(wand->signature == WandSignature);
4839  if( IfMagickTrue(wand->debug) )
4840    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4841
4842  if (wand->images == (Image *) NULL)
4843    {
4844      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4845        "ContainsNoImages","'%s'",wand->name);
4846      return(UndefinedGravity);
4847    }
4848  return(wand->images->gravity);
4849}
4850
4851/*
4852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4853%                                                                             %
4854%                                                                             %
4855%                                                                             %
4856%   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                       %
4857%                                                                             %
4858%                                                                             %
4859%                                                                             %
4860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861%
4862%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4863%
4864%  The format of the MagickGetImageGreenPrimary method is:
4865%
4866%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4867%        double *y)
4868%
4869%  A description of each parameter follows:
4870%
4871%    o wand: the magick wand.
4872%
4873%    o x: the chromaticity green primary x-point.
4874%
4875%    o y: the chromaticity green primary y-point.
4876%
4877*/
4878WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4879  double *x,double *y)
4880{
4881  assert(wand != (MagickWand *) NULL);
4882  assert(wand->signature == WandSignature);
4883  if( IfMagickTrue(wand->debug) )
4884    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4885
4886  if (wand->images == (Image *) NULL)
4887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4888  *x=wand->images->chromaticity.green_primary.x;
4889  *y=wand->images->chromaticity.green_primary.y;
4890  return(MagickTrue);
4891}
4892
4893/*
4894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4895%                                                                             %
4896%                                                                             %
4897%                                                                             %
4898%   M a g i c k G e t I m a g e H e i g h t                                   %
4899%                                                                             %
4900%                                                                             %
4901%                                                                             %
4902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4903%
4904%  MagickGetImageHeight() returns the image height.
4905%
4906%  The format of the MagickGetImageHeight method is:
4907%
4908%      size_t MagickGetImageHeight(MagickWand *wand)
4909%
4910%  A description of each parameter follows:
4911%
4912%    o wand: the magick wand.
4913%
4914*/
4915WandExport size_t MagickGetImageHeight(MagickWand *wand)
4916{
4917  assert(wand != (MagickWand *) NULL);
4918  assert(wand->signature == WandSignature);
4919  if( IfMagickTrue(wand->debug) )
4920    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4921
4922  if (wand->images == (Image *) NULL)
4923    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4924  return(wand->images->rows);
4925}
4926
4927/*
4928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4929%                                                                             %
4930%                                                                             %
4931%                                                                             %
4932%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4933%                                                                             %
4934%                                                                             %
4935%                                                                             %
4936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4937%
4938%  MagickGetImageHistogram() returns the image histogram as an array of
4939%  PixelWand wands.
4940%
4941%  The format of the MagickGetImageHistogram method is:
4942%
4943%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4944%        size_t *number_colors)
4945%
4946%  A description of each parameter follows:
4947%
4948%    o wand: the magick wand.
4949%
4950%    o number_colors: the number of unique colors in the image and the number
4951%      of pixel wands returned.
4952%
4953*/
4954WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4955  size_t *number_colors)
4956{
4957  PixelInfo
4958    *histogram;
4959
4960  PixelWand
4961    **pixel_wands;
4962
4963  register ssize_t
4964    i;
4965
4966  assert(wand != (MagickWand *) NULL);
4967  assert(wand->signature == WandSignature);
4968  if( IfMagickTrue(wand->debug) )
4969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4970
4971  if (wand->images == (Image *) NULL)
4972    {
4973      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4974        "ContainsNoImages","'%s'",wand->name);
4975      return((PixelWand **) NULL);
4976    }
4977  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4978  if (histogram == (PixelInfo *) NULL)
4979    return((PixelWand **) NULL);
4980  pixel_wands=NewPixelWands(*number_colors);
4981  for (i=0; i < (ssize_t) *number_colors; i++)
4982  {
4983    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4984    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4985  }
4986  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4987  return(pixel_wands);
4988}
4989
4990/*
4991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4992%                                                                             %
4993%                                                                             %
4994%                                                                             %
4995%   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                 %
4996%                                                                             %
4997%                                                                             %
4998%                                                                             %
4999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5000%
5001%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5002%
5003%  The format of the MagickGetImageInterlaceScheme method is:
5004%
5005%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5006%
5007%  A description of each parameter follows:
5008%
5009%    o wand: the magick wand.
5010%
5011*/
5012WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5013{
5014  assert(wand != (MagickWand *) NULL);
5015  assert(wand->signature == WandSignature);
5016  if( IfMagickTrue(wand->debug) )
5017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5018
5019  if (wand->images == (Image *) NULL)
5020    {
5021      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5022        "ContainsNoImages","'%s'",wand->name);
5023      return(UndefinedInterlace);
5024    }
5025  return(wand->images->interlace);
5026}
5027
5028/*
5029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5030%                                                                             %
5031%                                                                             %
5032%                                                                             %
5033%   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             %
5034%                                                                             %
5035%                                                                             %
5036%                                                                             %
5037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5038%
5039%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5040%  sepcified image.
5041%
5042%  The format of the MagickGetImageInterpolateMethod method is:
5043%
5044%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5045%        MagickWand *wand)
5046%
5047%  A description of each parameter follows:
5048%
5049%    o wand: the magick wand.
5050%
5051*/
5052WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5053  MagickWand *wand)
5054{
5055  assert(wand != (MagickWand *) NULL);
5056  assert(wand->signature == WandSignature);
5057  if( IfMagickTrue(wand->debug) )
5058    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5059
5060  if (wand->images == (Image *) NULL)
5061    {
5062      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5063        "ContainsNoImages","'%s'",wand->name);
5064      return(UndefinedInterpolatePixel);
5065    }
5066  return(wand->images->interpolate);
5067}
5068
5069/*
5070%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5071%                                                                             %
5072%                                                                             %
5073%                                                                             %
5074%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5075%                                                                             %
5076%                                                                             %
5077%                                                                             %
5078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5079%
5080%  MagickGetImageIterations() gets the image iterations.
5081%
5082%  The format of the MagickGetImageIterations method is:
5083%
5084%      size_t MagickGetImageIterations(MagickWand *wand)
5085%
5086%  A description of each parameter follows:
5087%
5088%    o wand: the magick wand.
5089%
5090*/
5091WandExport size_t MagickGetImageIterations(MagickWand *wand)
5092{
5093  assert(wand != (MagickWand *) NULL);
5094  assert(wand->signature == WandSignature);
5095  if( IfMagickTrue(wand->debug) )
5096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5097
5098  if (wand->images == (Image *) NULL)
5099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5100  return(wand->images->iterations);
5101}
5102
5103/*
5104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5105%                                                                             %
5106%                                                                             %
5107%                                                                             %
5108%   M a g i c k G e t I m a g e L e n g t h                                   %
5109%                                                                             %
5110%                                                                             %
5111%                                                                             %
5112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5113%
5114%  MagickGetImageLength() returns the image length in bytes.
5115%
5116%  The format of the MagickGetImageLength method is:
5117%
5118%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5119%        MagickSizeType *length)
5120%
5121%  A description of each parameter follows:
5122%
5123%    o wand: the magick wand.
5124%
5125%    o length: the image length in bytes.
5126%
5127*/
5128WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5129  MagickSizeType *length)
5130{
5131  assert(wand != (MagickWand *) NULL);
5132  assert(wand->signature == WandSignature);
5133  if( IfMagickTrue(wand->debug) )
5134    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5135
5136  if (wand->images == (Image *) NULL)
5137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5138  *length=GetBlobSize(wand->images);
5139  return(MagickTrue);
5140}
5141
5142/*
5143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5144%                                                                             %
5145%                                                                             %
5146%                                                                             %
5147%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5148%                                                                             %
5149%                                                                             %
5150%                                                                             %
5151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5152%
5153%  MagickGetImageMatteColor() returns the image matte color.
5154%
5155%  The format of the MagickGetImageMatteColor method is:
5156%
5157%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5158%        PixelWand *matte_color)
5159%
5160%  A description of each parameter follows:
5161%
5162%    o wand: the magick wand.
5163%
5164%    o matte_color: Return the matte color.
5165%
5166*/
5167WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5168  PixelWand *matte_color)
5169{
5170  assert(wand != (MagickWand *) NULL);
5171  assert(wand->signature == WandSignature);
5172  if( IfMagickTrue(wand->debug) )
5173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5174
5175  if (wand->images == (Image *) NULL)
5176    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5177  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5178  return(MagickTrue);
5179}
5180
5181/*
5182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5183%                                                                             %
5184%                                                                             %
5185%                                                                             %
5186%   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                         %
5187%                                                                             %
5188%                                                                             %
5189%                                                                             %
5190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5191%
5192%  MagickGetImageOrientation() returns the image orientation.
5193%
5194%  The format of the MagickGetImageOrientation method is:
5195%
5196%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5197%
5198%  A description of each parameter follows:
5199%
5200%    o wand: the magick wand.
5201%
5202*/
5203WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5204{
5205  assert(wand != (MagickWand *) NULL);
5206  assert(wand->signature == WandSignature);
5207  if( IfMagickTrue(wand->debug) )
5208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5209
5210  if (wand->images == (Image *) NULL)
5211    {
5212      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5213        "ContainsNoImages","'%s'",wand->name);
5214      return(UndefinedOrientation);
5215    }
5216  return(wand->images->orientation);
5217}
5218
5219/*
5220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5221%                                                                             %
5222%                                                                             %
5223%                                                                             %
5224%   M a g i c k G e t I m a g e P a g e                                       %
5225%                                                                             %
5226%                                                                             %
5227%                                                                             %
5228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5229%
5230%  MagickGetImagePage() returns the page geometry associated with the image.
5231%
5232%  The format of the MagickGetImagePage method is:
5233%
5234%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5235%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5236%
5237%  A description of each parameter follows:
5238%
5239%    o wand: the magick wand.
5240%
5241%    o width: the page width.
5242%
5243%    o height: the page height.
5244%
5245%    o x: the page x-offset.
5246%
5247%    o y: the page y-offset.
5248%
5249*/
5250WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5251  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5252{
5253  assert(wand != (const MagickWand *) NULL);
5254  assert(wand->signature == WandSignature);
5255  if( IfMagickTrue(wand->debug) )
5256    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5257
5258  if (wand->images == (Image *) NULL)
5259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5260  *width=wand->images->page.width;
5261  *height=wand->images->page.height;
5262  *x=wand->images->page.x;
5263  *y=wand->images->page.y;
5264  return(MagickTrue);
5265}
5266
5267/*
5268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5269%                                                                             %
5270%                                                                             %
5271%                                                                             %
5272%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5273%                                                                             %
5274%                                                                             %
5275%                                                                             %
5276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5277%
5278%  MagickGetImagePixelColor() returns the color of the specified pixel.
5279%
5280%  The format of the MagickGetImagePixelColor method is:
5281%
5282%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5283%        const ssize_t x,const ssize_t y,PixelWand *color)
5284%
5285%  A description of each parameter follows:
5286%
5287%    o wand: the magick wand.
5288%
5289%    o x,y: the pixel offset into the image.
5290%
5291%    o color: Return the colormap color in this wand.
5292%
5293*/
5294WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5295  const ssize_t x,const ssize_t y,PixelWand *color)
5296{
5297  register const Quantum
5298    *p;
5299
5300  CacheView
5301    *image_view;
5302
5303  assert(wand != (MagickWand *) NULL);
5304  assert(wand->signature == WandSignature);
5305  if( IfMagickTrue(wand->debug) )
5306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5307
5308  if (wand->images == (Image *) NULL)
5309    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5310  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5311  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5312  if (p == (const Quantum *) NULL)
5313    {
5314      image_view=DestroyCacheView(image_view);
5315      return(MagickFalse);
5316    }
5317  PixelSetQuantumPixel(wand->images,p,color);
5318  image_view=DestroyCacheView(image_view);
5319  return(MagickTrue);
5320}
5321
5322/*
5323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5324%                                                                             %
5325%                                                                             %
5326%                                                                             %
5327%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5328%                                                                             %
5329%                                                                             %
5330%                                                                             %
5331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5332%
5333%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5334%
5335%  The format of the MagickGetImageRedPrimary method is:
5336%
5337%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5338%        double *y)
5339%
5340%  A description of each parameter follows:
5341%
5342%    o wand: the magick wand.
5343%
5344%    o x: the chromaticity red primary x-point.
5345%
5346%    o y: the chromaticity red primary y-point.
5347%
5348*/
5349WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5350  double *x,double *y)
5351{
5352  assert(wand != (MagickWand *) NULL);
5353  assert(wand->signature == WandSignature);
5354  if( IfMagickTrue(wand->debug) )
5355    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5356
5357  if (wand->images == (Image *) NULL)
5358    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5359  *x=wand->images->chromaticity.red_primary.x;
5360  *y=wand->images->chromaticity.red_primary.y;
5361  return(MagickTrue);
5362}
5363
5364/*
5365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5366%                                                                             %
5367%                                                                             %
5368%                                                                             %
5369%   M a g i c k G e t I m a g e R e g i o n                                   %
5370%                                                                             %
5371%                                                                             %
5372%                                                                             %
5373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5374%
5375%  MagickGetImageRegion() extracts a region of the image and returns it as a
5376%  a new wand.
5377%
5378%  The format of the MagickGetImageRegion method is:
5379%
5380%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5381%        const size_t width,const size_t height,const ssize_t x,
5382%        const ssize_t y)
5383%
5384%  A description of each parameter follows:
5385%
5386%    o wand: the magick wand.
5387%
5388%    o width: the region width.
5389%
5390%    o height: the region height.
5391%
5392%    o x: the region x offset.
5393%
5394%    o y: the region y offset.
5395%
5396*/
5397WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5398  const size_t width,const size_t height,const ssize_t x,
5399  const ssize_t y)
5400{
5401  Image
5402    *region_image;
5403
5404  RectangleInfo
5405    region;
5406
5407  assert(wand != (MagickWand *) NULL);
5408  assert(wand->signature == WandSignature);
5409  if( IfMagickTrue(wand->debug) )
5410    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5411
5412  if (wand->images == (Image *) NULL)
5413    return((MagickWand *) NULL);
5414  region.width=width;
5415  region.height=height;
5416  region.x=x;
5417  region.y=y;
5418  region_image=CropImage(wand->images,&region,wand->exception);
5419  if (region_image == (Image *) NULL)
5420    return((MagickWand *) NULL);
5421  return(CloneMagickWandFromImages(wand,region_image));
5422}
5423
5424/*
5425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5426%                                                                             %
5427%                                                                             %
5428%                                                                             %
5429%   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                 %
5430%                                                                             %
5431%                                                                             %
5432%                                                                             %
5433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5434%
5435%  MagickGetImageRenderingIntent() gets the image rendering intent.
5436%
5437%  The format of the MagickGetImageRenderingIntent method is:
5438%
5439%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5440%
5441%  A description of each parameter follows:
5442%
5443%    o wand: the magick wand.
5444%
5445*/
5446WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5447{
5448  assert(wand != (MagickWand *) NULL);
5449  assert(wand->signature == WandSignature);
5450  if( IfMagickTrue(wand->debug) )
5451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5452
5453  if (wand->images == (Image *) NULL)
5454    {
5455      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5456        "ContainsNoImages","'%s'",wand->name);
5457      return(UndefinedIntent);
5458    }
5459  return((RenderingIntent) wand->images->rendering_intent);
5460}
5461
5462/*
5463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5464%                                                                             %
5465%                                                                             %
5466%                                                                             %
5467%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5468%                                                                             %
5469%                                                                             %
5470%                                                                             %
5471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5472%
5473%  MagickGetImageResolution() gets the image X and Y resolution.
5474%
5475%  The format of the MagickGetImageResolution method is:
5476%
5477%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5478%        double *y)
5479%
5480%  A description of each parameter follows:
5481%
5482%    o wand: the magick wand.
5483%
5484%    o x: the image x-resolution.
5485%
5486%    o y: the image y-resolution.
5487%
5488*/
5489WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5490  double *x,double *y)
5491{
5492  assert(wand != (MagickWand *) NULL);
5493  assert(wand->signature == WandSignature);
5494  if( IfMagickTrue(wand->debug) )
5495    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5496
5497  if (wand->images == (Image *) NULL)
5498    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5499  *x=wand->images->resolution.x;
5500  *y=wand->images->resolution.y;
5501  return(MagickTrue);
5502}
5503
5504/*
5505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5506%                                                                             %
5507%                                                                             %
5508%                                                                             %
5509%   M a g i c k G e t I m a g e S c e n e                                     %
5510%                                                                             %
5511%                                                                             %
5512%                                                                             %
5513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5514%
5515%  MagickGetImageScene() gets the image scene.
5516%
5517%  The format of the MagickGetImageScene method is:
5518%
5519%      size_t MagickGetImageScene(MagickWand *wand)
5520%
5521%  A description of each parameter follows:
5522%
5523%    o wand: the magick wand.
5524%
5525*/
5526WandExport size_t MagickGetImageScene(MagickWand *wand)
5527{
5528  assert(wand != (MagickWand *) NULL);
5529  assert(wand->signature == WandSignature);
5530  if( IfMagickTrue(wand->debug) )
5531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5532
5533  if (wand->images == (Image *) NULL)
5534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5535  return(wand->images->scene);
5536}
5537
5538/*
5539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5540%                                                                             %
5541%                                                                             %
5542%                                                                             %
5543%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5544%                                                                             %
5545%                                                                             %
5546%                                                                             %
5547%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5548%
5549%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5550%  pixel stream.
5551%
5552%  The format of the MagickGetImageSignature method is:
5553%
5554%      char *MagickGetImageSignature(MagickWand *wand)
5555%
5556%  A description of each parameter follows:
5557%
5558%    o wand: the magick wand.
5559%
5560*/
5561WandExport char *MagickGetImageSignature(MagickWand *wand)
5562{
5563  const char
5564    *value;
5565
5566  MagickBooleanType
5567    status;
5568
5569  assert(wand != (MagickWand *) NULL);
5570  assert(wand->signature == WandSignature);
5571  if( IfMagickTrue(wand->debug) )
5572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5573
5574  if (wand->images == (Image *) NULL)
5575    {
5576      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5577        "ContainsNoImages","'%s'",wand->name);
5578      return((char *) NULL);
5579    }
5580  status=SignatureImage(wand->images,wand->exception);
5581  if( IfMagickFalse(status) )
5582    return((char *) NULL);
5583  value=GetImageProperty(wand->images,"signature",wand->exception);
5584  if (value == (const char *) NULL)
5585    return((char *) NULL);
5586  return(AcquireString(value));
5587}
5588
5589/*
5590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5591%                                                                             %
5592%                                                                             %
5593%                                                                             %
5594%   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                   %
5595%                                                                             %
5596%                                                                             %
5597%                                                                             %
5598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5599%
5600%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5601%
5602%  The format of the MagickGetImageTicksPerSecond method is:
5603%
5604%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5605%
5606%  A description of each parameter follows:
5607%
5608%    o wand: the magick wand.
5609%
5610*/
5611WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5612{
5613  assert(wand != (MagickWand *) NULL);
5614  assert(wand->signature == WandSignature);
5615  if( IfMagickTrue(wand->debug) )
5616    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5617
5618  if (wand->images == (Image *) NULL)
5619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5620  return((size_t) wand->images->ticks_per_second);
5621}
5622
5623/*
5624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5625%                                                                             %
5626%                                                                             %
5627%                                                                             %
5628%   M a g i c k G e t I m a g e T y p e                                       %
5629%                                                                             %
5630%                                                                             %
5631%                                                                             %
5632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5633%
5634%  MagickGetImageType() gets the potential image type:
5635%
5636%        Bilevel        Grayscale       GrayscaleMatte
5637%        Palette        PaletteMatte    TrueColor
5638%        TrueColorMatte ColorSeparation ColorSeparationMatte
5639%
5640%  To ensure the image type matches its potential, use MagickSetImageType():
5641%
5642%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5643%
5644%  The format of the MagickGetImageType method is:
5645%
5646%      ImageType MagickGetImageType(MagickWand *wand)
5647%
5648%  A description of each parameter follows:
5649%
5650%    o wand: the magick wand.
5651%
5652*/
5653WandExport ImageType MagickGetImageType(MagickWand *wand)
5654{
5655  assert(wand != (MagickWand *) NULL);
5656  assert(wand->signature == WandSignature);
5657  if( IfMagickTrue(wand->debug) )
5658    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5659
5660  if (wand->images == (Image *) NULL)
5661    {
5662      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5663        "ContainsNoImages","'%s'",wand->name);
5664      return(UndefinedType);
5665    }
5666  return(GetImageType(wand->images,wand->exception));
5667}
5668
5669/*
5670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5671%                                                                             %
5672%                                                                             %
5673%                                                                             %
5674%   M a g i c k G e t I m a g e U n i t s                                     %
5675%                                                                             %
5676%                                                                             %
5677%                                                                             %
5678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5679%
5680%  MagickGetImageUnits() gets the image units of resolution.
5681%
5682%  The format of the MagickGetImageUnits method is:
5683%
5684%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5685%
5686%  A description of each parameter follows:
5687%
5688%    o wand: the magick wand.
5689%
5690*/
5691WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5692{
5693  assert(wand != (MagickWand *) NULL);
5694  assert(wand->signature == WandSignature);
5695  if( IfMagickTrue(wand->debug) )
5696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5697
5698  if (wand->images == (Image *) NULL)
5699    {
5700      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5701        "ContainsNoImages","'%s'",wand->name);
5702      return(UndefinedResolution);
5703    }
5704  return(wand->images->units);
5705}
5706
5707/*
5708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5709%                                                                             %
5710%                                                                             %
5711%                                                                             %
5712%   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           %
5713%                                                                             %
5714%                                                                             %
5715%                                                                             %
5716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5717%
5718%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5719%  sepcified image.
5720%
5721%  The format of the MagickGetImageVirtualPixelMethod method is:
5722%
5723%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5724%
5725%  A description of each parameter follows:
5726%
5727%    o wand: the magick wand.
5728%
5729*/
5730WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5731{
5732  assert(wand != (MagickWand *) NULL);
5733  assert(wand->signature == WandSignature);
5734  if( IfMagickTrue(wand->debug) )
5735    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5736
5737  if (wand->images == (Image *) NULL)
5738    {
5739      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5740        "ContainsNoImages","'%s'",wand->name);
5741      return(UndefinedVirtualPixelMethod);
5742    }
5743  return(GetImageVirtualPixelMethod(wand->images));
5744}
5745
5746/*
5747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5748%                                                                             %
5749%                                                                             %
5750%                                                                             %
5751%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5752%                                                                             %
5753%                                                                             %
5754%                                                                             %
5755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5756%
5757%  MagickGetImageWhitePoint() returns the chromaticy white point.
5758%
5759%  The format of the MagickGetImageWhitePoint method is:
5760%
5761%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5762%        double *y)
5763%
5764%  A description of each parameter follows:
5765%
5766%    o wand: the magick wand.
5767%
5768%    o x: the chromaticity white x-point.
5769%
5770%    o y: the chromaticity white y-point.
5771%
5772*/
5773WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5774  double *x,double *y)
5775{
5776  assert(wand != (MagickWand *) NULL);
5777  assert(wand->signature == WandSignature);
5778  if( IfMagickTrue(wand->debug) )
5779    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5780
5781  if (wand->images == (Image *) NULL)
5782    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5783  *x=wand->images->chromaticity.white_point.x;
5784  *y=wand->images->chromaticity.white_point.y;
5785  return(MagickTrue);
5786}
5787
5788/*
5789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5790%                                                                             %
5791%                                                                             %
5792%                                                                             %
5793%   M a g i c k G e t I m a g e W i d t h                                     %
5794%                                                                             %
5795%                                                                             %
5796%                                                                             %
5797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5798%
5799%  MagickGetImageWidth() returns the image width.
5800%
5801%  The format of the MagickGetImageWidth method is:
5802%
5803%      size_t MagickGetImageWidth(MagickWand *wand)
5804%
5805%  A description of each parameter follows:
5806%
5807%    o wand: the magick wand.
5808%
5809*/
5810WandExport size_t MagickGetImageWidth(MagickWand *wand)
5811{
5812  assert(wand != (MagickWand *) NULL);
5813  assert(wand->signature == WandSignature);
5814  if( IfMagickTrue(wand->debug) )
5815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5816
5817  if (wand->images == (Image *) NULL)
5818    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5819  return(wand->images->columns);
5820}
5821
5822/*
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824%                                                                             %
5825%                                                                             %
5826%                                                                             %
5827%   M a g i c k G e t N u m b e r I m a g e s                                 %
5828%                                                                             %
5829%                                                                             %
5830%                                                                             %
5831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5832%
5833%  MagickGetNumberImages() returns the number of images associated with a
5834%  magick wand.
5835%
5836%  The format of the MagickGetNumberImages method is:
5837%
5838%      size_t MagickGetNumberImages(MagickWand *wand)
5839%
5840%  A description of each parameter follows:
5841%
5842%    o wand: the magick wand.
5843%
5844*/
5845WandExport size_t MagickGetNumberImages(MagickWand *wand)
5846{
5847  assert(wand != (MagickWand *) NULL);
5848  assert(wand->signature == WandSignature);
5849  if( IfMagickTrue(wand->debug) )
5850    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5851
5852  return(GetImageListLength(wand->images));
5853}
5854
5855/*
5856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5857%                                                                             %
5858%                                                                             %
5859%                                                                             %
5860%   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                 %
5861%                                                                             %
5862%                                                                             %
5863%                                                                             %
5864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5865%
5866%  MagickGetImageTotalInkDensity() gets the image total ink density.
5867%
5868%  The format of the MagickGetImageTotalInkDensity method is:
5869%
5870%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5871%
5872%  A description of each parameter follows:
5873%
5874%    o wand: the magick wand.
5875%
5876*/
5877WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5878{
5879  assert(wand != (MagickWand *) NULL);
5880  assert(wand->signature == WandSignature);
5881  if( IfMagickTrue(wand->debug) )
5882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5883
5884  if (wand->images == (Image *) NULL)
5885    {
5886      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5887        "ContainsNoImages","'%s'",wand->name);
5888      return(0.0);
5889    }
5890  return(GetImageTotalInkDensity(wand->images,wand->exception));
5891}
5892
5893/*
5894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5895%                                                                             %
5896%                                                                             %
5897%                                                                             %
5898%   M a g i c k H a l d C l u t I m a g e                                     %
5899%                                                                             %
5900%                                                                             %
5901%                                                                             %
5902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5903%
5904%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5905%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5906%  dimensions.  Create it with the HALD coder.  You can apply any color
5907%  transformation to the Hald image and then use this method to apply the
5908%  transform to the image.
5909%
5910%  The format of the MagickHaldClutImage method is:
5911%
5912%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5913%        const MagickWand *hald_wand)
5914%
5915%  A description of each parameter follows:
5916%
5917%    o wand: the magick wand.
5918%
5919%    o hald_image: the hald CLUT image.
5920%
5921*/
5922WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5923  const MagickWand *hald_wand)
5924{
5925  MagickBooleanType
5926    status;
5927
5928  assert(wand != (MagickWand *) NULL);
5929  assert(wand->signature == WandSignature);
5930  if( IfMagickTrue(wand->debug) )
5931    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5932
5933  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5934    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5935  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5936  return(status);
5937}
5938
5939/*
5940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5941%                                                                             %
5942%                                                                             %
5943%                                                                             %
5944%   M a g i c k H a s N e x t I m a g e                                       %
5945%                                                                             %
5946%                                                                             %
5947%                                                                             %
5948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5949%
5950%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5951%  traversing the list in the forward direction
5952%
5953%  The format of the MagickHasNextImage method is:
5954%
5955%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5956%
5957%  A description of each parameter follows:
5958%
5959%    o wand: the magick wand.
5960%
5961*/
5962WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5963{
5964  assert(wand != (MagickWand *) NULL);
5965  assert(wand->signature == WandSignature);
5966  if( IfMagickTrue(wand->debug) )
5967    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5968
5969  if (wand->images == (Image *) NULL)
5970    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5971  if (GetNextImageInList(wand->images) == (Image *) NULL)
5972    return(MagickFalse);
5973  return(MagickTrue);
5974}
5975
5976/*
5977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5978%                                                                             %
5979%                                                                             %
5980%                                                                             %
5981%   M a g i c k H a s P r e v i o u s I m a g e                               %
5982%                                                                             %
5983%                                                                             %
5984%                                                                             %
5985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5986%
5987%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5988%  traversing the list in the reverse direction
5989%
5990%  The format of the MagickHasPreviousImage method is:
5991%
5992%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5993%
5994%  A description of each parameter follows:
5995%
5996%    o wand: the magick wand.
5997%
5998*/
5999WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6000{
6001  assert(wand != (MagickWand *) NULL);
6002  assert(wand->signature == WandSignature);
6003  if( IfMagickTrue(wand->debug) )
6004    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6005
6006  if (wand->images == (Image *) NULL)
6007    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6008  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6009    return(MagickFalse);
6010  return(MagickTrue);
6011}
6012
6013/*
6014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6015%                                                                             %
6016%                                                                             %
6017%                                                                             %
6018%   M a g i c k I d e n t i f y I m a g e                                     %
6019%                                                                             %
6020%                                                                             %
6021%                                                                             %
6022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6023%
6024%  MagickIdentifyImage() identifies an image by printing its attributes to the
6025%  file.  Attributes include the image width, height, size, and others.
6026%
6027%  The format of the MagickIdentifyImage method is:
6028%
6029%      const char *MagickIdentifyImage(MagickWand *wand)
6030%
6031%  A description of each parameter follows:
6032%
6033%    o wand: the magick wand.
6034%
6035*/
6036WandExport char *MagickIdentifyImage(MagickWand *wand)
6037{
6038  char
6039    *description,
6040    filename[MaxTextExtent];
6041
6042  FILE
6043    *file;
6044
6045  int
6046    unique_file;
6047
6048  assert(wand != (MagickWand *) NULL);
6049  assert(wand->signature == WandSignature);
6050  if( IfMagickTrue(wand->debug) )
6051    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6052
6053  if (wand->images == (Image *) NULL)
6054    {
6055      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6056        "ContainsNoImages","'%s'",wand->name);
6057      return((char *) NULL);
6058    }
6059  description=(char *) NULL;
6060  unique_file=AcquireUniqueFileResource(filename);
6061  file=(FILE *) NULL;
6062  if (unique_file != -1)
6063    file=fdopen(unique_file,"wb");
6064  if ((unique_file == -1) || (file == (FILE *) NULL))
6065    {
6066      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6067        "UnableToCreateTemporaryFile","'%s'",wand->name);
6068      return((char *) NULL);
6069    }
6070  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6071  (void) fclose(file);
6072  description=FileToString(filename,~0,wand->exception);
6073  (void) RelinquishUniqueFileResource(filename);
6074  return(description);
6075}
6076
6077/*
6078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6079%                                                                             %
6080%                                                                             %
6081%                                                                             %
6082%   M a g i c k I m p l o d e I m a g e                                       %
6083%                                                                             %
6084%                                                                             %
6085%                                                                             %
6086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6087%
6088%  MagickImplodeImage() creates a new image that is a copy of an existing
6089%  one with the image pixels "implode" by the specified percentage.  It
6090%  allocates the memory necessary for the new Image structure and returns a
6091%  pointer to the new image.
6092%
6093%  The format of the MagickImplodeImage method is:
6094%
6095%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6096%        const double radius,const PixelInterpolateMethod method)
6097%
6098%  A description of each parameter follows:
6099%
6100%    o wand: the magick wand.
6101%
6102%    o amount: Define the extent of the implosion.
6103%
6104%    o method: the pixel interpolation method.
6105%
6106*/
6107WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6108  const double amount,const PixelInterpolateMethod method)
6109{
6110  Image
6111    *implode_image;
6112
6113  assert(wand != (MagickWand *) NULL);
6114  assert(wand->signature == WandSignature);
6115  if( IfMagickTrue(wand->debug) )
6116    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6117
6118  if (wand->images == (Image *) NULL)
6119    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6120  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6121  if (implode_image == (Image *) NULL)
6122    return(MagickFalse);
6123  ReplaceImageInList(&wand->images,implode_image);
6124  return(MagickTrue);
6125}
6126
6127/*
6128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6129%                                                                             %
6130%                                                                             %
6131%                                                                             %
6132%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6133%                                                                             %
6134%                                                                             %
6135%                                                                             %
6136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6137%
6138%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6139%  location you specify.  The method returns MagickFalse on success otherwise
6140%  MagickTrue if an error is encountered.  The pixel data can be either char,
6141%  short int, int, ssize_t, float, or double in the order specified by map.
6142%
6143%  Suppose your want to upload the first scanline of a 640x480 image from
6144%  character data in red-green-blue order:
6145%
6146%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6147%
6148%  The format of the MagickImportImagePixels method is:
6149%
6150%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6151%        const ssize_t x,const ssize_t y,const size_t columns,
6152%        const size_t rows,const char *map,const StorageType storage,
6153%        const void *pixels)
6154%
6155%  A description of each parameter follows:
6156%
6157%    o wand: the magick wand.
6158%
6159%    o x, y, columns, rows:  These values define the perimeter of a region
6160%      of pixels you want to define.
6161%
6162%    o map:  This string reflects the expected ordering of the pixel array.
6163%      It can be any combination or order of R = red, G = green, B = blue,
6164%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6165%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6166%      P = pad.
6167%
6168%    o storage: Define the data type of the pixels.  Float and double types are
6169%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6170%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6171%      or DoublePixel.
6172%
6173%    o pixels: This array of values contain the pixel components as defined by
6174%      map and type.  You must preallocate this array where the expected
6175%      length varies depending on the values of width, height, map, and type.
6176%
6177*/
6178WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6179  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6180  const char *map,const StorageType storage,const void *pixels)
6181{
6182  MagickBooleanType
6183    status;
6184
6185  assert(wand != (MagickWand *) NULL);
6186  assert(wand->signature == WandSignature);
6187  if( IfMagickTrue(wand->debug) )
6188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6189
6190  if (wand->images == (Image *) NULL)
6191    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6192  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6193    wand->exception);
6194  return(status);
6195}
6196
6197/*
6198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6199%                                                                             %
6200%                                                                             %
6201%                                                                             %
6202%   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               %
6203%                                                                             %
6204%                                                                             %
6205%                                                                             %
6206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6207%
6208%  MagickInterpolativeResizeImage() resize image using a interpolative
6209%  method.
6210%
6211%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6212%        const size_t columns,const size_t rows,
6213%        const PixelInterpolateMethod method)
6214%
6215%  A description of each parameter follows:
6216%
6217%    o wand: the magick wand.
6218%
6219%    o columns: the number of columns in the scaled image.
6220%
6221%    o rows: the number of rows in the scaled image.
6222%
6223%    o interpolate: the pixel interpolation method.
6224%
6225*/
6226WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6227  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6228{
6229  Image
6230    *resize_image;
6231
6232  assert(wand != (MagickWand *) NULL);
6233  assert(wand->signature == WandSignature);
6234  if( IfMagickTrue(wand->debug) )
6235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6236
6237  if (wand->images == (Image *) NULL)
6238    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6239  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6240    wand->exception);
6241  if (resize_image == (Image *) NULL)
6242    return(MagickFalse);
6243  ReplaceImageInList(&wand->images,resize_image);
6244  return(MagickTrue);
6245}
6246
6247/*
6248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6249%                                                                             %
6250%                                                                             %
6251%                                                                             %
6252%   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       %
6253%                                                                             %
6254%                                                                             %
6255%                                                                             %
6256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6257%
6258%  MagickInverseFourierTransformImage() implements the inverse discrete
6259%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6260%  imaginary image pair.
6261%
6262%  The format of the MagickInverseFourierTransformImage method is:
6263%
6264%      MagickBooleanType MagickInverseFourierTransformImage(
6265%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6266%        const MagickBooleanType magnitude)
6267%
6268%  A description of each parameter follows:
6269%
6270%    o magnitude_wand: the magnitude or real wand.
6271%
6272%    o phase_wand: the phase or imaginary wand.
6273%
6274%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6275%      imaginary image pair.
6276%
6277*/
6278WandExport MagickBooleanType MagickInverseFourierTransformImage(
6279  MagickWand *magnitude_wand,MagickWand *phase_wand,
6280  const MagickBooleanType magnitude)
6281{
6282  Image
6283    *inverse_image;
6284
6285  MagickWand
6286    *wand;
6287
6288  assert(magnitude_wand != (MagickWand *) NULL);
6289  assert(magnitude_wand->signature == WandSignature);
6290  if( IfMagickTrue(magnitude_wand->debug) )
6291    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6292
6293      magnitude_wand->name);
6294  wand=magnitude_wand;
6295  if (magnitude_wand->images == (Image *) NULL)
6296    ThrowWandException(WandError,"ContainsNoImages",
6297      magnitude_wand->name);
6298  assert(phase_wand != (MagickWand *) NULL);
6299  assert(phase_wand->signature == WandSignature);
6300  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6301    phase_wand->images,magnitude,wand->exception);
6302  if (inverse_image == (Image *) NULL)
6303    return(MagickFalse);
6304  ReplaceImageInList(&wand->images,inverse_image);
6305  return(MagickTrue);
6306}
6307
6308/*
6309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6310%                                                                             %
6311%                                                                             %
6312%                                                                             %
6313%   M a g i c k L a b e l I m a g e                                           %
6314%                                                                             %
6315%                                                                             %
6316%                                                                             %
6317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6318%
6319%  MagickLabelImage() adds a label to your image.
6320%
6321%  The format of the MagickLabelImage method is:
6322%
6323%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6324%
6325%  A description of each parameter follows:
6326%
6327%    o wand: the magick wand.
6328%
6329%    o label: the image label.
6330%
6331*/
6332WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6333  const char *label)
6334{
6335  MagickBooleanType
6336    status;
6337
6338  assert(wand != (MagickWand *) NULL);
6339  assert(wand->signature == WandSignature);
6340  if( IfMagickTrue(wand->debug) )
6341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6342
6343  if (wand->images == (Image *) NULL)
6344    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6345  status=SetImageProperty(wand->images,"label",label,wand->exception);
6346  return(status);
6347}
6348
6349/*
6350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6351%                                                                             %
6352%                                                                             %
6353%                                                                             %
6354%   M a g i c k L e v e l I m a g e                                           %
6355%                                                                             %
6356%                                                                             %
6357%                                                                             %
6358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6359%
6360%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6361%  falling between specified white and black points to the full available
6362%  quantum range. The parameters provided represent the black, mid, and white
6363%  points. The black point specifies the darkest color in the image. Colors
6364%  darker than the black point are set to zero. Mid point specifies a gamma
6365%  correction to apply to the image.  White point specifies the lightest color
6366%  in the image. Colors brighter than the white point are set to the maximum
6367%  quantum value.
6368%
6369%  The format of the MagickLevelImage method is:
6370%
6371%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6372%        const double black_point,const double gamma,const double white_point)
6373%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6374%        const ChannelType channel,const double black_point,const double gamma,
6375%        const double white_point)
6376%
6377%  A description of each parameter follows:
6378%
6379%    o wand: the magick wand.
6380%
6381%    o channel: Identify which channel to level: RedPixelChannel,
6382%      GreenPixelChannel, etc.
6383%
6384%    o black_point: the black point.
6385%
6386%    o gamma: the gamma.
6387%
6388%    o white_point: the white point.
6389%
6390*/
6391WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6392  const double black_point,const double gamma,const double white_point)
6393{
6394  MagickBooleanType
6395    status;
6396
6397  assert(wand != (MagickWand *) NULL);
6398  assert(wand->signature == WandSignature);
6399  if( IfMagickTrue(wand->debug) )
6400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6401
6402  if (wand->images == (Image *) NULL)
6403    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6404  status=LevelImage(wand->images,black_point,white_point,gamma,
6405    wand->exception);
6406  return(status);
6407}
6408
6409/*
6410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6411%                                                                             %
6412%                                                                             %
6413%                                                                             %
6414%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6415%                                                                             %
6416%                                                                             %
6417%                                                                             %
6418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6419%
6420%  MagickLinearStretchImage() stretches with saturation the image intensity.
6421%
6422%  You can also reduce the influence of a particular channel with a gamma
6423%  value of 0.
6424%
6425%  The format of the MagickLinearStretchImage method is:
6426%
6427%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6428%        const double black_point,const double white_point)
6429%
6430%  A description of each parameter follows:
6431%
6432%    o wand: the magick wand.
6433%
6434%    o black_point: the black point.
6435%
6436%    o white_point: the white point.
6437%
6438*/
6439WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6440  const double black_point,const double white_point)
6441{
6442  MagickBooleanType
6443    status;
6444
6445  assert(wand != (MagickWand *) NULL);
6446  assert(wand->signature == WandSignature);
6447  if( IfMagickTrue(wand->debug) )
6448    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6449
6450  if (wand->images == (Image *) NULL)
6451    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6452  status=LinearStretchImage(wand->images,black_point,white_point,
6453    wand->exception);
6454  return(status);
6455}
6456
6457/*
6458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6459%                                                                             %
6460%                                                                             %
6461%                                                                             %
6462%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6463%                                                                             %
6464%                                                                             %
6465%                                                                             %
6466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6467%
6468%  MagickLiquidRescaleImage() rescales image with seam carving.
6469%
6470%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6471%        const size_t columns,const size_t rows,
6472%        const double delta_x,const double rigidity)
6473%
6474%  A description of each parameter follows:
6475%
6476%    o wand: the magick wand.
6477%
6478%    o columns: the number of columns in the scaled image.
6479%
6480%    o rows: the number of rows in the scaled image.
6481%
6482%    o delta_x: maximum seam transversal step (0 means straight seams).
6483%
6484%    o rigidity: introduce a bias for non-straight seams (typically 0).
6485%
6486*/
6487WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6488  const size_t columns,const size_t rows,const double delta_x,
6489  const double rigidity)
6490{
6491  Image
6492    *rescale_image;
6493
6494  assert(wand != (MagickWand *) NULL);
6495  assert(wand->signature == WandSignature);
6496  if( IfMagickTrue(wand->debug) )
6497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6498
6499  if (wand->images == (Image *) NULL)
6500    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6501  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6502    rigidity,wand->exception);
6503  if (rescale_image == (Image *) NULL)
6504    return(MagickFalse);
6505  ReplaceImageInList(&wand->images,rescale_image);
6506  return(MagickTrue);
6507}
6508
6509/*
6510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6511%                                                                             %
6512%                                                                             %
6513%                                                                             %
6514%   M a g i c k M a g n i f y I m a g e                                       %
6515%                                                                             %
6516%                                                                             %
6517%                                                                             %
6518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6519%
6520%  MagickMagnifyImage() is a convenience method that scales an image
6521%  proportionally to twice its original size.
6522%
6523%  The format of the MagickMagnifyImage method is:
6524%
6525%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6526%
6527%  A description of each parameter follows:
6528%
6529%    o wand: the magick wand.
6530%
6531*/
6532WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6533{
6534  Image
6535    *magnify_image;
6536
6537  assert(wand != (MagickWand *) NULL);
6538  assert(wand->signature == WandSignature);
6539  if( IfMagickTrue(wand->debug) )
6540    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6541
6542  if (wand->images == (Image *) NULL)
6543    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6544  magnify_image=MagnifyImage(wand->images,wand->exception);
6545  if (magnify_image == (Image *) NULL)
6546    return(MagickFalse);
6547  ReplaceImageInList(&wand->images,magnify_image);
6548  return(MagickTrue);
6549}
6550
6551/*
6552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6553%                                                                             %
6554%                                                                             %
6555%                                                                             %
6556%   M a g i c k M e r g e I m a g e L a y e r s                               %
6557%                                                                             %
6558%                                                                             %
6559%                                                                             %
6560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6561%
6562%  MagickMergeImageLayers() composes all the image layers from the current
6563%  given image onward to produce a single image of the merged layers.
6564%
6565%  The inital canvas's size depends on the given ImageLayerMethod, and is
6566%  initialized using the first images background color.  The images
6567%  are then compositied onto that image in sequence using the given
6568%  composition that has been assigned to each individual image.
6569%
6570%  The format of the MagickMergeImageLayers method is:
6571%
6572%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6573%        const ImageLayerMethod method)
6574%
6575%  A description of each parameter follows:
6576%
6577%    o wand: the magick wand.
6578%
6579%    o method: the method of selecting the size of the initial canvas.
6580%
6581%        MergeLayer: Merge all layers onto a canvas just large enough
6582%           to hold all the actual images. The virtual canvas of the
6583%           first image is preserved but otherwise ignored.
6584%
6585%        FlattenLayer: Use the virtual canvas size of first image.
6586%           Images which fall outside this canvas is clipped.
6587%           This can be used to 'fill out' a given virtual canvas.
6588%
6589%        MosaicLayer: Start with the virtual canvas of the first image,
6590%           enlarging left and right edges to contain all images.
6591%           Images with negative offsets will be clipped.
6592%
6593*/
6594WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6595  const ImageLayerMethod method)
6596{
6597  Image
6598    *mosaic_image;
6599
6600  assert(wand != (MagickWand *) NULL);
6601  assert(wand->signature == WandSignature);
6602  if( IfMagickTrue(wand->debug) )
6603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6604
6605  if (wand->images == (Image *) NULL)
6606    return((MagickWand *) NULL);
6607  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6608  if (mosaic_image == (Image *) NULL)
6609    return((MagickWand *) NULL);
6610  return(CloneMagickWandFromImages(wand,mosaic_image));
6611}
6612
6613/*
6614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6615%                                                                             %
6616%                                                                             %
6617%                                                                             %
6618%   M a g i c k M i n i f y I m a g e                                         %
6619%                                                                             %
6620%                                                                             %
6621%                                                                             %
6622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6623%
6624%  MagickMinifyImage() is a convenience method that scales an image
6625%  proportionally to one-half its original size
6626%
6627%  The format of the MagickMinifyImage method is:
6628%
6629%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6630%
6631%  A description of each parameter follows:
6632%
6633%    o wand: the magick wand.
6634%
6635*/
6636WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6637{
6638  Image
6639    *minify_image;
6640
6641  assert(wand != (MagickWand *) NULL);
6642  assert(wand->signature == WandSignature);
6643  if( IfMagickTrue(wand->debug) )
6644    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6645
6646  if (wand->images == (Image *) NULL)
6647    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6648  minify_image=MinifyImage(wand->images,wand->exception);
6649  if (minify_image == (Image *) NULL)
6650    return(MagickFalse);
6651  ReplaceImageInList(&wand->images,minify_image);
6652  return(MagickTrue);
6653}
6654
6655/*
6656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6657%                                                                             %
6658%                                                                             %
6659%                                                                             %
6660%   M a g i c k M o d u l a t e I m a g e                                     %
6661%                                                                             %
6662%                                                                             %
6663%                                                                             %
6664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6665%
6666%  MagickModulateImage() lets you control the brightness, saturation, and hue
6667%  of an image.  Hue is the percentage of absolute rotation from the current
6668%  position.  For example 50 results in a counter-clockwise rotation of 90
6669%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6670%  both resulting in a rotation of 180 degrees.
6671%
6672%  To increase the color brightness by 20% and decrease the color saturation by
6673%  10% and leave the hue unchanged, use: 120,90,100.
6674%
6675%  The format of the MagickModulateImage method is:
6676%
6677%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6678%        const double brightness,const double saturation,const double hue)
6679%
6680%  A description of each parameter follows:
6681%
6682%    o wand: the magick wand.
6683%
6684%    o brightness: the percent change in brighness.
6685%
6686%    o saturation: the percent change in saturation.
6687%
6688%    o hue: the percent change in hue.
6689%
6690*/
6691WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6692  const double brightness,const double saturation,const double hue)
6693{
6694  char
6695    modulate[MaxTextExtent];
6696
6697  MagickBooleanType
6698    status;
6699
6700  assert(wand != (MagickWand *) NULL);
6701  assert(wand->signature == WandSignature);
6702  if( IfMagickTrue(wand->debug) )
6703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6704
6705  if (wand->images == (Image *) NULL)
6706    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6707  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6708    brightness,saturation,hue);
6709  status=ModulateImage(wand->images,modulate,wand->exception);
6710  return(status);
6711}
6712
6713/*
6714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6715%                                                                             %
6716%                                                                             %
6717%                                                                             %
6718%   M a g i c k M o n t a g e I m a g e                                       %
6719%                                                                             %
6720%                                                                             %
6721%                                                                             %
6722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6723%
6724%  MagickMontageImage() creates a composite image by combining several
6725%  separate images. The images are tiled on the composite image with the name
6726%  of the image optionally appearing just below the individual tile.
6727%
6728%  The format of the MagickMontageImage method is:
6729%
6730%      MagickWand *MagickMontageImage(MagickWand *wand,
6731%        const DrawingWand drawing_wand,const char *tile_geometry,
6732%        const char *thumbnail_geometry,const MontageMode mode,
6733%        const char *frame)
6734%
6735%  A description of each parameter follows:
6736%
6737%    o wand: the magick wand.
6738%
6739%    o drawing_wand: the drawing wand.  The font name, size, and color are
6740%      obtained from this wand.
6741%
6742%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6743%
6744%    o thumbnail_geometry: Preferred image size and border size of each
6745%      thumbnail (e.g. 120x120+4+3>).
6746%
6747%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6748%
6749%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6750%      The frame color is that of the thumbnail's matte color.
6751%
6752*/
6753WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6754  const DrawingWand *drawing_wand,const char *tile_geometry,
6755  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6756{
6757  char
6758    *font;
6759
6760  Image
6761    *montage_image;
6762
6763  MontageInfo
6764    *montage_info;
6765
6766  PixelWand
6767    *pixel_wand;
6768
6769  assert(wand != (MagickWand *) NULL);
6770  assert(wand->signature == WandSignature);
6771  if( IfMagickTrue(wand->debug) )
6772    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6773
6774  if (wand->images == (Image *) NULL)
6775    return((MagickWand *) NULL);
6776  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6777  switch (mode)
6778  {
6779    case FrameMode:
6780    {
6781      (void) CloneString(&montage_info->frame,"15x15+3+3");
6782      montage_info->shadow=MagickTrue;
6783      break;
6784    }
6785    case UnframeMode:
6786    {
6787      montage_info->frame=(char *) NULL;
6788      montage_info->shadow=MagickFalse;
6789      montage_info->border_width=0;
6790      break;
6791    }
6792    case ConcatenateMode:
6793    {
6794      montage_info->frame=(char *) NULL;
6795      montage_info->shadow=MagickFalse;
6796      (void) CloneString(&montage_info->geometry,"+0+0");
6797      montage_info->border_width=0;
6798      break;
6799    }
6800    default:
6801      break;
6802  }
6803  font=DrawGetFont(drawing_wand);
6804  if (font != (char *) NULL)
6805    (void) CloneString(&montage_info->font,font);
6806  if (frame != (char *) NULL)
6807    (void) CloneString(&montage_info->frame,frame);
6808  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6809  pixel_wand=NewPixelWand();
6810  DrawGetFillColor(drawing_wand,pixel_wand);
6811  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6812  DrawGetStrokeColor(drawing_wand,pixel_wand);
6813  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6814  pixel_wand=DestroyPixelWand(pixel_wand);
6815  if (thumbnail_geometry != (char *) NULL)
6816    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6817  if (tile_geometry != (char *) NULL)
6818    (void) CloneString(&montage_info->tile,tile_geometry);
6819  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6820    wand->exception);
6821  montage_info=DestroyMontageInfo(montage_info);
6822  if (montage_image == (Image *) NULL)
6823    return((MagickWand *) NULL);
6824  return(CloneMagickWandFromImages(wand,montage_image));
6825}
6826
6827/*
6828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6829%                                                                             %
6830%                                                                             %
6831%                                                                             %
6832%   M a g i c k M o r p h I m a g e s                                         %
6833%                                                                             %
6834%                                                                             %
6835%                                                                             %
6836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6837%
6838%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6839%  and size are linearly interpolated to give the appearance of a
6840%  meta-morphosis from one image to the next.
6841%
6842%  The format of the MagickMorphImages method is:
6843%
6844%      MagickWand *MagickMorphImages(MagickWand *wand,
6845%        const size_t number_frames)
6846%
6847%  A description of each parameter follows:
6848%
6849%    o wand: the magick wand.
6850%
6851%    o number_frames: the number of in-between images to generate.
6852%
6853*/
6854WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6855  const size_t number_frames)
6856{
6857  Image
6858    *morph_image;
6859
6860  assert(wand != (MagickWand *) NULL);
6861  assert(wand->signature == WandSignature);
6862  if( IfMagickTrue(wand->debug) )
6863    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6864
6865  if (wand->images == (Image *) NULL)
6866    return((MagickWand *) NULL);
6867  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6868  if (morph_image == (Image *) NULL)
6869    return((MagickWand *) NULL);
6870  return(CloneMagickWandFromImages(wand,morph_image));
6871}
6872
6873/*
6874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6875%                                                                             %
6876%                                                                             %
6877%                                                                             %
6878%   M a g i c k M o r p h o l o g y I m a g e                                 %
6879%                                                                             %
6880%                                                                             %
6881%                                                                             %
6882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6883%
6884%  MagickMorphologyImage() applies a user supplied kernel to the image
6885%  according to the given mophology method.
6886%
6887%  The format of the MagickMorphologyImage method is:
6888%
6889%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6890%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6891%
6892%  A description of each parameter follows:
6893%
6894%    o wand: the magick wand.
6895%
6896%    o method: the morphology method to be applied.
6897%
6898%    o iterations: apply the operation this many times (or no change).
6899%      A value of -1 means loop until no change found.  How this is applied
6900%      may depend on the morphology method.  Typically this is a value of 1.
6901%
6902%    o kernel: An array of doubles representing the morphology kernel.
6903%
6904*/
6905WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6906  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6907{
6908  Image
6909    *morphology_image;
6910
6911  assert(wand != (MagickWand *) NULL);
6912  assert(wand->signature == WandSignature);
6913  if( IfMagickTrue(wand->debug) )
6914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6915
6916  if (kernel == (const KernelInfo *) NULL)
6917    return(MagickFalse);
6918  if (wand->images == (Image *) NULL)
6919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6920  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6921    wand->exception);
6922  if (morphology_image == (Image *) NULL)
6923    return(MagickFalse);
6924  ReplaceImageInList(&wand->images,morphology_image);
6925  return(MagickTrue);
6926}
6927
6928/*
6929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6930%                                                                             %
6931%                                                                             %
6932%                                                                             %
6933%   M a g i c k M o t i o n B l u r I m a g e                                 %
6934%                                                                             %
6935%                                                                             %
6936%                                                                             %
6937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6938%
6939%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6940%  Gaussian operator of the given radius and standard deviation (sigma).
6941%  For reasonable results, radius should be larger than sigma.  Use a
6942%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6943%  Angle gives the angle of the blurring motion.
6944%
6945%  The format of the MagickMotionBlurImage method is:
6946%
6947%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6948%        const double radius,const double sigma,const double angle)
6949%
6950%  A description of each parameter follows:
6951%
6952%    o wand: the magick wand.
6953%
6954%    o radius: the radius of the Gaussian, in pixels, not counting
6955%      the center pixel.
6956%
6957%    o sigma: the standard deviation of the Gaussian, in pixels.
6958%
6959%    o angle: Apply the effect along this angle.
6960%
6961*/
6962WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6963  const double radius,const double sigma,const double angle)
6964{
6965  Image
6966    *blur_image;
6967
6968  assert(wand != (MagickWand *) NULL);
6969  assert(wand->signature == WandSignature);
6970  if( IfMagickTrue(wand->debug) )
6971    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6972
6973  if (wand->images == (Image *) NULL)
6974    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6975  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6976  if (blur_image == (Image *) NULL)
6977    return(MagickFalse);
6978  ReplaceImageInList(&wand->images,blur_image);
6979  return(MagickTrue);
6980}
6981
6982/*
6983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6984%                                                                             %
6985%                                                                             %
6986%                                                                             %
6987%   M a g i c k N e g a t e I m a g e                                         %
6988%                                                                             %
6989%                                                                             %
6990%                                                                             %
6991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6992%
6993%  MagickNegateImage() negates the colors in the reference image.  The
6994%  Grayscale option means that only grayscale values within the image are
6995%  negated.
6996%
6997%  You can also reduce the influence of a particular channel with a gamma
6998%  value of 0.
6999%
7000%  The format of the MagickNegateImage method is:
7001%
7002%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7003%        const MagickBooleanType gray)
7004%
7005%  A description of each parameter follows:
7006%
7007%    o wand: the magick wand.
7008%
7009%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7010%
7011*/
7012WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7013  const MagickBooleanType gray)
7014{
7015  MagickBooleanType
7016    status;
7017
7018  assert(wand != (MagickWand *) NULL);
7019  assert(wand->signature == WandSignature);
7020  if( IfMagickTrue(wand->debug) )
7021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7022
7023  if (wand->images == (Image *) NULL)
7024    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7025  status=NegateImage(wand->images,gray,wand->exception);
7026  return(status);
7027}
7028
7029/*
7030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7031%                                                                             %
7032%                                                                             %
7033%                                                                             %
7034%   M a g i c k N e w I m a g e                                               %
7035%                                                                             %
7036%                                                                             %
7037%                                                                             %
7038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7039%
7040%  MagickNewImage() adds a blank image canvas of the specified size and
7041%  background color to the wand.
7042%
7043%  The format of the MagickNewImage method is:
7044%
7045%      MagickBooleanType MagickNewImage(MagickWand *wand,
7046%        const size_t columns,const size_t rows,
7047%        const PixelWand *background)
7048%
7049%  A description of each parameter follows:
7050%
7051%    o wand: the magick wand.
7052%
7053%    o width: the image width.
7054%
7055%    o height: the image height.
7056%
7057%    o background: the image color.
7058%
7059*/
7060WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7061  const size_t height,const PixelWand *background)
7062{
7063  Image
7064    *images;
7065
7066  PixelInfo
7067    pixel;
7068
7069  assert(wand != (MagickWand *) NULL);
7070  assert(wand->signature == WandSignature);
7071  if( IfMagickTrue(wand->debug) )
7072    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7073
7074  PixelGetMagickColor(background,&pixel);
7075  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7076  if (images == (Image *) NULL)
7077    return(MagickFalse);
7078  return(InsertImageInWand(wand,images));
7079}
7080
7081/*
7082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7083%                                                                             %
7084%                                                                             %
7085%                                                                             %
7086%   M a g i c k N e x t I m a g e                                             %
7087%                                                                             %
7088%                                                                             %
7089%                                                                             %
7090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7091%
7092%  MagickNextImage() sets the next image in the wand as the current image.
7093%
7094%  It is typically used after MagickResetIterator(), after which its first use
7095%  will set the first image as the current image (unless the wand is empty).
7096%
7097%  It will return MagickFalse when no more images are left to be returned
7098%  which happens when the wand is empty, or the current image is the last
7099%  image.
7100%
7101%  When the above condition (end of image list) is reached, the iterator is
7102%  automaticall set so that you can start using MagickPreviousImage() to
7103%  again iterate over the images in the reverse direction, starting with the
7104%  last image (again).  You can jump to this condition immeditally using
7105%  MagickSetLastIterator().
7106%
7107%  The format of the MagickNextImage method is:
7108%
7109%      MagickBooleanType MagickNextImage(MagickWand *wand)
7110%
7111%  A description of each parameter follows:
7112%
7113%    o wand: the magick wand.
7114%
7115*/
7116WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7117{
7118  assert(wand != (MagickWand *) NULL);
7119  assert(wand->signature == WandSignature);
7120  if( IfMagickTrue(wand->debug) )
7121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7122
7123  if (wand->images == (Image *) NULL)
7124    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7125  wand->insert_before=MagickFalse; /* Inserts is now appended */
7126  if( IfMagickTrue(wand->image_pending) )
7127    {
7128      wand->image_pending=MagickFalse;
7129      return(MagickTrue);
7130    }
7131  if (GetNextImageInList(wand->images) == (Image *) NULL)
7132    {
7133      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7134      return(MagickFalse);
7135    }
7136  wand->images=GetNextImageInList(wand->images);
7137  return(MagickTrue);
7138}
7139
7140/*
7141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7142%                                                                             %
7143%                                                                             %
7144%                                                                             %
7145%   M a g i c k N o r m a l i z e I m a g e                                   %
7146%                                                                             %
7147%                                                                             %
7148%                                                                             %
7149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7150%
7151%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7152%  the pixels color to span the entire range of colors available
7153%
7154%  You can also reduce the influence of a particular channel with a gamma
7155%  value of 0.
7156%
7157%  The format of the MagickNormalizeImage method is:
7158%
7159%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7160%
7161%  A description of each parameter follows:
7162%
7163%    o wand: the magick wand.
7164%
7165*/
7166WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7167{
7168  MagickBooleanType
7169    status;
7170
7171  assert(wand != (MagickWand *) NULL);
7172  assert(wand->signature == WandSignature);
7173  if( IfMagickTrue(wand->debug) )
7174    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7175
7176  if (wand->images == (Image *) NULL)
7177    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7178  status=NormalizeImage(wand->images,wand->exception);
7179  return(status);
7180}
7181
7182/*
7183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7184%                                                                             %
7185%                                                                             %
7186%                                                                             %
7187%   M a g i c k O i l P a i n t I m a g e                                     %
7188%                                                                             %
7189%                                                                             %
7190%                                                                             %
7191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7192%
7193%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7194%  painting.  Each pixel is replaced by the most frequent color occurring
7195%  in a circular region defined by radius.
7196%
7197%  The format of the MagickOilPaintImage method is:
7198%
7199%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7200%        const double radius,const double sigma)
7201%
7202%  A description of each parameter follows:
7203%
7204%    o wand: the magick wand.
7205%
7206%    o radius: the radius of the circular neighborhood.
7207%
7208%    o sigma: the standard deviation of the Gaussian, in pixels.
7209%
7210*/
7211WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7212  const double radius,const double sigma)
7213{
7214  Image
7215    *paint_image;
7216
7217  assert(wand != (MagickWand *) NULL);
7218  assert(wand->signature == WandSignature);
7219  if( IfMagickTrue(wand->debug) )
7220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7221
7222  if (wand->images == (Image *) NULL)
7223    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7224  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7225  if (paint_image == (Image *) NULL)
7226    return(MagickFalse);
7227  ReplaceImageInList(&wand->images,paint_image);
7228  return(MagickTrue);
7229}
7230
7231/*
7232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7233%                                                                             %
7234%                                                                             %
7235%                                                                             %
7236%   M a g i c k O p a q u e P a i n t I m a g e                               %
7237%                                                                             %
7238%                                                                             %
7239%                                                                             %
7240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7241%
7242%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7243%  defined by fill.
7244%
7245%  The format of the MagickOpaquePaintImage method is:
7246%
7247%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7248%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7249%        const MagickBooleanType invert)
7250%
7251%  A description of each parameter follows:
7252%
7253%    o wand: the magick wand.
7254%
7255%    o target: Change this target color to the fill color within the image.
7256%
7257%    o fill: the fill pixel wand.
7258%
7259%    o fuzz: By default target must match a particular pixel color
7260%      exactly.  However, in many cases two colors may differ by a small amount.
7261%      The fuzz member of image defines how much tolerance is acceptable to
7262%      consider two colors as the same.  For example, set fuzz to 10 and the
7263%      color red at intensities of 100 and 102 respectively are now interpreted
7264%      as the same color for the purposes of the floodfill.
7265%
7266%    o invert: paint any pixel that does not match the target color.
7267%
7268*/
7269WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7270  const PixelWand *target,const PixelWand *fill,const double fuzz,
7271  const MagickBooleanType invert)
7272{
7273  MagickBooleanType
7274    status;
7275
7276  PixelInfo
7277    fill_pixel,
7278    target_pixel;
7279
7280  assert(wand != (MagickWand *) NULL);
7281  assert(wand->signature == WandSignature);
7282  if( IfMagickTrue(wand->debug) )
7283    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7284
7285  if (wand->images == (Image *) NULL)
7286    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7287  PixelGetMagickColor(target,&target_pixel);
7288  PixelGetMagickColor(fill,&fill_pixel);
7289  wand->images->fuzz=fuzz;
7290  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7291    wand->exception);
7292  return(status);
7293}
7294
7295/*
7296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7297%                                                                             %
7298%                                                                             %
7299%                                                                             %
7300%   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                         %
7301%                                                                             %
7302%                                                                             %
7303%                                                                             %
7304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7305%
7306%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7307%  previous image in the sequence.  From this it attempts to select the
7308%  smallest cropped image to replace each frame, while preserving the results
7309%  of the animation.
7310%
7311%  The format of the MagickOptimizeImageLayers method is:
7312%
7313%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7314%
7315%  A description of each parameter follows:
7316%
7317%    o wand: the magick wand.
7318%
7319*/
7320WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7321{
7322  Image
7323    *optimize_image;
7324
7325  assert(wand != (MagickWand *) NULL);
7326  assert(wand->signature == WandSignature);
7327  if( IfMagickTrue(wand->debug) )
7328    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7329
7330  if (wand->images == (Image *) NULL)
7331    return((MagickWand *) NULL);
7332  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7333  if (optimize_image == (Image *) NULL)
7334    return((MagickWand *) NULL);
7335  return(CloneMagickWandFromImages(wand,optimize_image));
7336}
7337
7338/*
7339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7340%                                                                             %
7341%                                                                             %
7342%                                                                             %
7343%   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             %
7344%                                                                             %
7345%                                                                             %
7346%                                                                             %
7347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7348%
7349%  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7350%  compares the overlayed pixels against the disposal image resulting from all
7351%  the previous frames in the animation.  Any pixel that does not change the
7352%  disposal image (and thus does not effect the outcome of an overlay) is made
7353%  transparent.
7354%
7355%  WARNING: This modifies the current images directly, rather than generate
7356%  a new image sequence.
7357%  The format of the MagickOptimizeImageTransparency method is:
7358%
7359%      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7360%
7361%  A description of each parameter follows:
7362%
7363%    o wand: the magick wand.
7364%
7365*/
7366WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7367{
7368  assert(wand != (MagickWand *) NULL);
7369  assert(wand->signature == WandSignature);
7370  if( IfMagickTrue(wand->debug) )
7371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7372  if (wand->images == (Image *) NULL)
7373    return(MagickFalse);
7374  OptimizeImageTransparency(wand->images,wand->exception);
7375  return(MagickTrue);
7376}
7377
7378/*
7379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7380%                                                                             %
7381%                                                                             %
7382%                                                                             %
7383%     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                   %
7384%                                                                             %
7385%                                                                             %
7386%                                                                             %
7387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7388%
7389%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7390%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7391%  which can be different for different channels, according to the input
7392%  arguments.
7393%
7394%  The format of the MagickOrderedPosterizeImage method is:
7395%
7396%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7397%        const char *threshold_map)
7398%
7399%  A description of each parameter follows:
7400%
7401%    o image: the image.
7402%
7403%    o threshold_map: A string containing the name of the threshold dither
7404%      map to use, followed by zero or more numbers representing the number of
7405%      color levels tho dither between.
7406%
7407%      Any level number less than 2 is equivalent to 2, and means only binary
7408%      dithering will be applied to each color channel.
7409%
7410%      No numbers also means a 2 level (bitmap) dither will be applied to all
7411%      channels, while a single number is the number of levels applied to each
7412%      channel in sequence.  More numbers will be applied in turn to each of
7413%      the color channels.
7414%
7415%      For example: "o3x3,6" generates a 6 level posterization of the image
7416%      with a ordered 3x3 diffused pixel dither being applied between each
7417%      level. While checker,8,8,4 will produce a 332 colormaped image with
7418%      only a single checkerboard hash pattern (50% grey) between each color
7419%      level, to basically double the number of color levels with a bare
7420%      minimim of dithering.
7421%
7422*/
7423WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7424  const char *threshold_map)
7425{
7426  MagickBooleanType
7427    status;
7428
7429  assert(wand != (MagickWand *) NULL);
7430  assert(wand->signature == WandSignature);
7431  if( IfMagickTrue(wand->debug) )
7432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7433
7434  if (wand->images == (Image *) NULL)
7435    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7436  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7437  return(status);
7438}
7439
7440/*
7441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7442%                                                                             %
7443%                                                                             %
7444%                                                                             %
7445%   M a g i c k P i n g I m a g e                                             %
7446%                                                                             %
7447%                                                                             %
7448%                                                                             %
7449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7450%
7451%  MagickPingImage() is the same as MagickReadImage() except the only valid
7452%  information returned is the image width, height, size, and format.  It
7453%  is designed to efficiently obtain this information from a file without
7454%  reading the entire image sequence into memory.
7455%
7456%  The format of the MagickPingImage method is:
7457%
7458%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7459%
7460%  A description of each parameter follows:
7461%
7462%    o wand: the magick wand.
7463%
7464%    o filename: the image filename.
7465%
7466*/
7467WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7468  const char *filename)
7469{
7470  Image
7471    *images;
7472
7473  ImageInfo
7474    *ping_info;
7475
7476  assert(wand != (MagickWand *) NULL);
7477  assert(wand->signature == WandSignature);
7478  if( IfMagickTrue(wand->debug) )
7479    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7480
7481  ping_info=CloneImageInfo(wand->image_info);
7482  if (filename != (const char *) NULL)
7483    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7484  images=PingImage(ping_info,wand->exception);
7485  ping_info=DestroyImageInfo(ping_info);
7486  if (images == (Image *) NULL)
7487    return(MagickFalse);
7488  return(InsertImageInWand(wand,images));
7489}
7490
7491/*
7492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7493%                                                                             %
7494%                                                                             %
7495%                                                                             %
7496%   M a g i c k P i n g I m a g e B l o b                                     %
7497%                                                                             %
7498%                                                                             %
7499%                                                                             %
7500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7501%
7502%  MagickPingImageBlob() pings an image or image sequence from a blob.
7503%
7504%  The format of the MagickPingImageBlob method is:
7505%
7506%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7507%        const void *blob,const size_t length)
7508%
7509%  A description of each parameter follows:
7510%
7511%    o wand: the magick wand.
7512%
7513%    o blob: the blob.
7514%
7515%    o length: the blob length.
7516%
7517*/
7518WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7519  const void *blob,const size_t length)
7520{
7521  Image
7522    *images;
7523
7524  ImageInfo
7525    *read_info;
7526
7527  assert(wand != (MagickWand *) NULL);
7528  assert(wand->signature == WandSignature);
7529  if( IfMagickTrue(wand->debug) )
7530    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7531
7532  read_info=CloneImageInfo(wand->image_info);
7533  SetImageInfoBlob(read_info,blob,length);
7534  images=PingImage(read_info,wand->exception);
7535  read_info=DestroyImageInfo(read_info);
7536  if (images == (Image *) NULL)
7537    return(MagickFalse);
7538  return(InsertImageInWand(wand,images));
7539}
7540
7541/*
7542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7543%                                                                             %
7544%                                                                             %
7545%                                                                             %
7546%   M a g i c k P i n g I m a g e F i l e                                     %
7547%                                                                             %
7548%                                                                             %
7549%                                                                             %
7550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7551%
7552%  MagickPingImageFile() pings an image or image sequence from an open file
7553%  descriptor.
7554%
7555%  The format of the MagickPingImageFile method is:
7556%
7557%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7558%
7559%  A description of each parameter follows:
7560%
7561%    o wand: the magick wand.
7562%
7563%    o file: the file descriptor.
7564%
7565*/
7566WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7567{
7568  Image
7569    *images;
7570
7571  ImageInfo
7572    *read_info;
7573
7574  assert(wand != (MagickWand *) NULL);
7575  assert(wand->signature == WandSignature);
7576  assert(file != (FILE *) NULL);
7577  if( IfMagickTrue(wand->debug) )
7578    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7579
7580  read_info=CloneImageInfo(wand->image_info);
7581  SetImageInfoFile(read_info,file);
7582  images=PingImage(read_info,wand->exception);
7583  read_info=DestroyImageInfo(read_info);
7584  if (images == (Image *) NULL)
7585    return(MagickFalse);
7586  return(InsertImageInWand(wand,images));
7587}
7588
7589/*
7590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7591%                                                                             %
7592%                                                                             %
7593%                                                                             %
7594%   M a g i c k P o l a r o i d I m a g e                                     %
7595%                                                                             %
7596%                                                                             %
7597%                                                                             %
7598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7599%
7600%  MagickPolaroidImage() simulates a Polaroid picture.
7601%
7602%  The format of the MagickPolaroidImage method is:
7603%
7604%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7605%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7606%        const PixelInterpolateMethod method)
7607%
7608%  A description of each parameter follows:
7609%
7610%    o wand: the magick wand.
7611%
7612%    o drawing_wand: the draw wand.
7613%
7614%    o caption: the Polaroid caption.
7615%
7616%    o angle: Apply the effect along this angle.
7617%
7618%    o method: the pixel interpolation method.
7619%
7620*/
7621WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7622  const DrawingWand *drawing_wand,const char *caption,const double angle,
7623  const PixelInterpolateMethod method)
7624{
7625  DrawInfo
7626    *draw_info;
7627
7628  Image
7629    *polaroid_image;
7630
7631  assert(wand != (MagickWand *) NULL);
7632  assert(wand->signature == WandSignature);
7633  if( IfMagickTrue(wand->debug) )
7634    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7635
7636  if (wand->images == (Image *) NULL)
7637    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7638  draw_info=PeekDrawingWand(drawing_wand);
7639  if (draw_info == (DrawInfo *) NULL)
7640    return(MagickFalse);
7641  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7642    wand->exception);
7643  if (polaroid_image == (Image *) NULL)
7644    return(MagickFalse);
7645  ReplaceImageInList(&wand->images,polaroid_image);
7646  return(MagickTrue);
7647}
7648
7649/*
7650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7651%                                                                             %
7652%                                                                             %
7653%                                                                             %
7654%   M a g i c k P o s t e r i z e I m a g e                                   %
7655%                                                                             %
7656%                                                                             %
7657%                                                                             %
7658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7659%
7660%  MagickPosterizeImage() reduces the image to a limited number of color level.
7661%
7662%  The format of the MagickPosterizeImage method is:
7663%
7664%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7665%        const size_t levels,const DitherMethod method)
7666%
7667%  A description of each parameter follows:
7668%
7669%    o wand: the magick wand.
7670%
7671%    o levels: Number of color levels allowed in each channel.  Very low values
7672%      (2, 3, or 4) have the most visible effect.
7673%
7674%    o method: choose the dither method: UndefinedDitherMethod,
7675%      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7676%
7677*/
7678WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7679  const size_t levels,const DitherMethod dither)
7680{
7681  MagickBooleanType
7682    status;
7683
7684  assert(wand != (MagickWand *) NULL);
7685  assert(wand->signature == WandSignature);
7686  if( IfMagickTrue(wand->debug) )
7687    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7688
7689  if (wand->images == (Image *) NULL)
7690    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7691  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7692  return(status);
7693}
7694
7695/*
7696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7697%                                                                             %
7698%                                                                             %
7699%                                                                             %
7700%   M a g i c k P r e v i e w I m a g e s                                     %
7701%                                                                             %
7702%                                                                             %
7703%                                                                             %
7704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7705%
7706%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7707%  image processing operation applied at varying strengths.  This helpful
7708%  to quickly pin-point an appropriate parameter for an image processing
7709%  operation.
7710%
7711%  The format of the MagickPreviewImages method is:
7712%
7713%      MagickWand *MagickPreviewImages(MagickWand *wand,
7714%        const PreviewType preview)
7715%
7716%  A description of each parameter follows:
7717%
7718%    o wand: the magick wand.
7719%
7720%    o preview: the preview type.
7721%
7722*/
7723WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7724  const PreviewType preview)
7725{
7726  Image
7727    *preview_image;
7728
7729  assert(wand != (MagickWand *) NULL);
7730  assert(wand->signature == WandSignature);
7731  if( IfMagickTrue(wand->debug) )
7732    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7733
7734  if (wand->images == (Image *) NULL)
7735    return((MagickWand *) NULL);
7736  preview_image=PreviewImage(wand->images,preview,wand->exception);
7737  if (preview_image == (Image *) NULL)
7738    return((MagickWand *) NULL);
7739  return(CloneMagickWandFromImages(wand,preview_image));
7740}
7741
7742/*
7743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7744%                                                                             %
7745%                                                                             %
7746%                                                                             %
7747%   M a g i c k P r e v i o u s I m a g e                                     %
7748%                                                                             %
7749%                                                                             %
7750%                                                                             %
7751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7752%
7753%  MagickPreviousImage() sets the previous image in the wand as the current
7754%  image.
7755%
7756%  It is typically used after MagickSetLastIterator(), after which its first
7757%  use will set the last image as the current image (unless the wand is empty).
7758%
7759%  It will return MagickFalse when no more images are left to be returned
7760%  which happens when the wand is empty, or the current image is the first
7761%  image.  At that point the iterator is than reset to again process images in
7762%  the forward direction, again starting with the first image in list. Images
7763%  added at this point are prepended.
7764%
7765%  Also at that point any images added to the wand using MagickAddImages() or
7766%  MagickReadImages() will be prepended before the first image. In this sense
7767%  the condition is not quite exactly the same as MagickResetIterator().
7768%
7769%  The format of the MagickPreviousImage method is:
7770%
7771%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7772%
7773%  A description of each parameter follows:
7774%
7775%    o wand: the magick wand.
7776%
7777*/
7778WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7779{
7780  assert(wand != (MagickWand *) NULL);
7781  assert(wand->signature == WandSignature);
7782  if( IfMagickTrue(wand->debug) )
7783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7784
7785  if (wand->images == (Image *) NULL)
7786    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7787
7788  if( IfMagickTrue(wand->image_pending) )
7789    {
7790      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7791      return(MagickTrue);
7792    }
7793  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7794    {
7795      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7796      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7797      return(MagickFalse);
7798    }
7799  wand->images=GetPreviousImageInList(wand->images);
7800  return(MagickTrue);
7801}
7802
7803/*
7804%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7805%                                                                             %
7806%                                                                             %
7807%                                                                             %
7808%   M a g i c k Q u a n t i z e I m a g e                                     %
7809%                                                                             %
7810%                                                                             %
7811%                                                                             %
7812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7813%
7814%  MagickQuantizeImage() analyzes the colors within a reference image and
7815%  chooses a fixed number of colors to represent the image.  The goal of the
7816%  algorithm is to minimize the color difference between the input and output
7817%  image while minimizing the processing time.
7818%
7819%  The format of the MagickQuantizeImage method is:
7820%
7821%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7822%        const size_t number_colors,const ColorspaceType colorspace,
7823%        const size_t treedepth,const DitherMethod dither_method,
7824%        const MagickBooleanType measure_error)
7825%
7826%  A description of each parameter follows:
7827%
7828%    o wand: the magick wand.
7829%
7830%    o number_colors: the number of colors.
7831%
7832%    o colorspace: Perform color reduction in this colorspace, typically
7833%      RGBColorspace.
7834%
7835%    o treedepth: Normally, this integer value is zero or one.  A zero or
7836%      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
7837%      reference image with the least amount of memory and the fastest
7838%      computational speed.  In some cases, such as an image with low color
7839%      dispersion (a few number of colors), a value other than
7840%      Log4(number_colors) is required.  To expand the color tree completely,
7841%      use a value of 8.
7842%
7843%    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7844%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7845%
7846%    o measure_error: A value other than zero measures the difference between
7847%      the original and quantized images.  This difference is the total
7848%      quantization error.  The error is computed by summing over all pixels
7849%      in an image the distance squared in RGB space between each reference
7850%      pixel value and its quantized value.
7851%
7852*/
7853WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7854  const size_t number_colors,const ColorspaceType colorspace,
7855  const size_t treedepth,const DitherMethod dither_method,
7856  const MagickBooleanType measure_error)
7857{
7858  MagickBooleanType
7859    status;
7860
7861  QuantizeInfo
7862    *quantize_info;
7863
7864  assert(wand != (MagickWand *) NULL);
7865  assert(wand->signature == WandSignature);
7866  if( IfMagickTrue(wand->debug) )
7867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868
7869  if (wand->images == (Image *) NULL)
7870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7871  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7872  quantize_info->number_colors=number_colors;
7873  quantize_info->dither_method=dither_method;
7874  quantize_info->tree_depth=treedepth;
7875  quantize_info->colorspace=colorspace;
7876  quantize_info->measure_error=measure_error;
7877  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7878  quantize_info=DestroyQuantizeInfo(quantize_info);
7879  return(status);
7880}
7881
7882/*
7883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7884%                                                                             %
7885%                                                                             %
7886%                                                                             %
7887%   M a g i c k Q u a n t i z e I m a g e s                                   %
7888%                                                                             %
7889%                                                                             %
7890%                                                                             %
7891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7892%
7893%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7894%  chooses a fixed number of colors to represent the image.  The goal of the
7895%  algorithm is to minimize the color difference between the input and output
7896%  image while minimizing the processing time.
7897%
7898%  The format of the MagickQuantizeImages method is:
7899%
7900%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7901%        const size_t number_colors,const ColorspaceType colorspace,
7902%        const size_t treedepth,const DitherMethod dither_method,
7903%        const MagickBooleanType measure_error)
7904%
7905%  A description of each parameter follows:
7906%
7907%    o wand: the magick wand.
7908%
7909%    o number_colors: the number of colors.
7910%
7911%    o colorspace: Perform color reduction in this colorspace, typically
7912%      RGBColorspace.
7913%
7914%    o treedepth: Normally, this integer value is zero or one.  A zero or
7915%      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
7916%      reference image with the least amount of memory and the fastest
7917%      computational speed.  In some cases, such as an image with low color
7918%      dispersion (a few number of colors), a value other than
7919%      Log4(number_colors) is required.  To expand the color tree completely,
7920%      use a value of 8.
7921%
7922%    o dither_method: choose from these dither methods: NoDitherMethod,
7923%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7924%
7925%    o measure_error: A value other than zero measures the difference between
7926%      the original and quantized images.  This difference is the total
7927%      quantization error.  The error is computed by summing over all pixels
7928%      in an image the distance squared in RGB space between each reference
7929%      pixel value and its quantized value.
7930%
7931*/
7932WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7933  const size_t number_colors,const ColorspaceType colorspace,
7934  const size_t treedepth,const DitherMethod dither_method,
7935  const MagickBooleanType measure_error)
7936{
7937  MagickBooleanType
7938    status;
7939
7940  QuantizeInfo
7941    *quantize_info;
7942
7943  assert(wand != (MagickWand *) NULL);
7944  assert(wand->signature == WandSignature);
7945  if( IfMagickTrue(wand->debug) )
7946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7947
7948  if (wand->images == (Image *) NULL)
7949    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7950  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7951  quantize_info->number_colors=number_colors;
7952  quantize_info->dither_method=dither_method;
7953  quantize_info->tree_depth=treedepth;
7954  quantize_info->colorspace=colorspace;
7955  quantize_info->measure_error=measure_error;
7956  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7957  quantize_info=DestroyQuantizeInfo(quantize_info);
7958  return(status);
7959}
7960
7961/*
7962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7963%                                                                             %
7964%                                                                             %
7965%                                                                             %
7966%   M a g i c k R a d i a l B l u r I m a g e                                 %
7967%                                                                             %
7968%                                                                             %
7969%                                                                             %
7970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7971%
7972%  MagickRadialBlurImage() radial blurs an image.
7973%
7974%  The format of the MagickRadialBlurImage method is:
7975%
7976%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7977%        const double angle)
7978%
7979%  A description of each parameter follows:
7980%
7981%    o wand: the magick wand.
7982%
7983%    o angle: the angle of the blur in degrees.
7984%
7985*/
7986WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7987  const double angle)
7988{
7989  Image
7990    *blur_image;
7991
7992  assert(wand != (MagickWand *) NULL);
7993  assert(wand->signature == WandSignature);
7994  if( IfMagickTrue(wand->debug) )
7995    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7996
7997  if (wand->images == (Image *) NULL)
7998    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7999  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
8000  if (blur_image == (Image *) NULL)
8001    return(MagickFalse);
8002  ReplaceImageInList(&wand->images,blur_image);
8003  return(MagickTrue);
8004}
8005
8006/*
8007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8008%                                                                             %
8009%                                                                             %
8010%                                                                             %
8011%   M a g i c k R a i s e I m a g e                                           %
8012%                                                                             %
8013%                                                                             %
8014%                                                                             %
8015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8016%
8017%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8018%  by lightening and darkening the edges of the image.  Members width and
8019%  height of raise_info define the width of the vertical and horizontal
8020%  edge of the effect.
8021%
8022%  The format of the MagickRaiseImage method is:
8023%
8024%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8025%        const size_t width,const size_t height,const ssize_t x,
8026%        const ssize_t y,const MagickBooleanType raise)
8027%
8028%  A description of each parameter follows:
8029%
8030%    o wand: the magick wand.
8031%
8032%    o width,height,x,y:  Define the dimensions of the area to raise.
8033%
8034%    o raise: A value other than zero creates a 3-D raise effect,
8035%      otherwise it has a lowered effect.
8036%
8037*/
8038WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8039  const size_t width,const size_t height,const ssize_t x,
8040  const ssize_t y,const MagickBooleanType raise)
8041{
8042  MagickBooleanType
8043    status;
8044
8045  RectangleInfo
8046    raise_info;
8047
8048  assert(wand != (MagickWand *) NULL);
8049  assert(wand->signature == WandSignature);
8050  if( IfMagickTrue(wand->debug) )
8051    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8052
8053  if (wand->images == (Image *) NULL)
8054    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8055  raise_info.width=width;
8056  raise_info.height=height;
8057  raise_info.x=x;
8058  raise_info.y=y;
8059  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8060  return(status);
8061}
8062
8063/*
8064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8065%                                                                             %
8066%                                                                             %
8067%                                                                             %
8068%   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                       %
8069%                                                                             %
8070%                                                                             %
8071%                                                                             %
8072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8073%
8074%  MagickRandomThresholdImage() changes the value of individual pixels based on
8075%  the intensity of each pixel compared to threshold.  The result is a
8076%  high-contrast, two color image.
8077%
8078%  The format of the MagickRandomThresholdImage method is:
8079%
8080%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8081%        const double low,const double high)
8082%
8083%  A description of each parameter follows:
8084%
8085%    o wand: the magick wand.
8086%
8087%    o low,high: Specify the high and low thresholds.  These values range from
8088%      0 to QuantumRange.
8089%
8090*/
8091WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8092  const double low,const double high)
8093{
8094  char
8095    threshold[MaxTextExtent];
8096
8097  assert(wand != (MagickWand *) NULL);
8098  assert(wand->signature == WandSignature);
8099  if( IfMagickTrue(wand->debug) )
8100    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8101
8102  if (wand->images == (Image *) NULL)
8103    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8104  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8105  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8106}
8107
8108/*
8109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8110%                                                                             %
8111%                                                                             %
8112%                                                                             %
8113%   M a g i c k R e a d I m a g e                                             %
8114%                                                                             %
8115%                                                                             %
8116%                                                                             %
8117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8118%
8119%  MagickReadImage() reads an image or image sequence.  The images are inserted
8120%  jjust before the current image pointer position.
8121%
8122%  Use MagickSetFirstIterator(), to insert new images before all the current
8123%  images in the wand, MagickSetLastIterator() to append add to the end,
8124%  MagickSetImageIndex() to place images just after the given index.
8125%
8126%  The format of the MagickReadImage method is:
8127%
8128%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8129%
8130%  A description of each parameter follows:
8131%
8132%    o wand: the magick wand.
8133%
8134%    o filename: the image filename.
8135%
8136*/
8137WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8138  const char *filename)
8139{
8140  Image
8141    *images;
8142
8143  ImageInfo
8144    *read_info;
8145
8146  assert(wand != (MagickWand *) NULL);
8147  assert(wand->signature == WandSignature);
8148  if( IfMagickTrue(wand->debug) )
8149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8150
8151  read_info=CloneImageInfo(wand->image_info);
8152  if (filename != (const char *) NULL)
8153    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8154  images=ReadImage(read_info,wand->exception);
8155  read_info=DestroyImageInfo(read_info);
8156  if (images == (Image *) NULL)
8157    return(MagickFalse);
8158  return(InsertImageInWand(wand,images));
8159}
8160
8161/*
8162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8163%                                                                             %
8164%                                                                             %
8165%                                                                             %
8166%   M a g i c k R e a d I m a g e B l o b                                     %
8167%                                                                             %
8168%                                                                             %
8169%                                                                             %
8170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8171%
8172%  MagickReadImageBlob() reads an image or image sequence from a blob.
8173%  In all other respects it is like MagickReadImage().
8174%
8175%  The format of the MagickReadImageBlob method is:
8176%
8177%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8178%        const void *blob,const size_t length)
8179%
8180%  A description of each parameter follows:
8181%
8182%    o wand: the magick wand.
8183%
8184%    o blob: the blob.
8185%
8186%    o length: the blob length.
8187%
8188*/
8189WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8190  const void *blob,const size_t length)
8191{
8192  Image
8193    *images;
8194
8195  assert(wand != (MagickWand *) NULL);
8196  assert(wand->signature == WandSignature);
8197  if( IfMagickTrue(wand->debug) )
8198    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8199
8200  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8201  if (images == (Image *) NULL)
8202    return(MagickFalse);
8203  return(InsertImageInWand(wand,images));
8204}
8205
8206/*
8207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8208%                                                                             %
8209%                                                                             %
8210%                                                                             %
8211%   M a g i c k R e a d I m a g e F i l e                                     %
8212%                                                                             %
8213%                                                                             %
8214%                                                                             %
8215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8216%
8217%  MagickReadImageFile() reads an image or image sequence from an already
8218%  opened file descriptor.  Otherwise it is like MagickReadImage().
8219%
8220%  The format of the MagickReadImageFile method is:
8221%
8222%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8223%
8224%  A description of each parameter follows:
8225%
8226%    o wand: the magick wand.
8227%
8228%    o file: the file descriptor.
8229%
8230*/
8231WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8232{
8233  Image
8234    *images;
8235
8236  ImageInfo
8237    *read_info;
8238
8239  assert(wand != (MagickWand *) NULL);
8240  assert(wand->signature == WandSignature);
8241  assert(file != (FILE *) NULL);
8242  if( IfMagickTrue(wand->debug) )
8243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8244
8245  read_info=CloneImageInfo(wand->image_info);
8246  SetImageInfoFile(read_info,file);
8247  images=ReadImage(read_info,wand->exception);
8248  read_info=DestroyImageInfo(read_info);
8249  if (images == (Image *) NULL)
8250    return(MagickFalse);
8251  return(InsertImageInWand(wand,images));
8252}
8253
8254/*
8255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8256%                                                                             %
8257%                                                                             %
8258%                                                                             %
8259%   M a g i c k R e m a p I m a g e                                           %
8260%                                                                             %
8261%                                                                             %
8262%                                                                             %
8263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8264%
8265%  MagickRemapImage() replaces the colors of an image with the closest color
8266%  from a reference image.
8267%
8268%  The format of the MagickRemapImage method is:
8269%
8270%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8271%        const MagickWand *remap_wand,const DitherMethod method)
8272%
8273%  A description of each parameter follows:
8274%
8275%    o wand: the magick wand.
8276%
8277%    o affinity: the affinity wand.
8278%
8279%    o method: choose from these dither methods: NoDitherMethod,
8280%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8281%
8282*/
8283WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8284  const MagickWand *remap_wand,const DitherMethod dither_method)
8285{
8286  MagickBooleanType
8287    status;
8288
8289  QuantizeInfo
8290    *quantize_info;
8291
8292  assert(wand != (MagickWand *) NULL);
8293  assert(wand->signature == WandSignature);
8294  if( IfMagickTrue(wand->debug) )
8295    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8296
8297  if ((wand->images == (Image *) NULL) ||
8298      (remap_wand->images == (Image *) NULL))
8299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8300  quantize_info=AcquireQuantizeInfo(wand->image_info);
8301  quantize_info->dither_method=dither_method;
8302  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8303    wand->exception);
8304  quantize_info=DestroyQuantizeInfo(quantize_info);
8305  return(status);
8306}
8307
8308/*
8309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8310%                                                                             %
8311%                                                                             %
8312%                                                                             %
8313%   M a g i c k R e m o v e I m a g e                                         %
8314%                                                                             %
8315%                                                                             %
8316%                                                                             %
8317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8318%
8319%  MagickRemoveImage() removes an image from the image list.
8320%
8321%  The format of the MagickRemoveImage method is:
8322%
8323%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8324%
8325%  A description of each parameter follows:
8326%
8327%    o wand: the magick wand.
8328%
8329%    o insert: the splice wand.
8330%
8331*/
8332WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8333{
8334  assert(wand != (MagickWand *) NULL);
8335  assert(wand->signature == WandSignature);
8336  if( IfMagickTrue(wand->debug) )
8337    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8338
8339  if (wand->images == (Image *) NULL)
8340    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8341  DeleteImageFromList(&wand->images);
8342  return(MagickTrue);
8343}
8344
8345/*
8346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8347%                                                                             %
8348%                                                                             %
8349%                                                                             %
8350%   M a g i c k R e s a m p l e I m a g e                                     %
8351%                                                                             %
8352%                                                                             %
8353%                                                                             %
8354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8355%
8356%  MagickResampleImage() resample image to desired resolution.
8357%
8358%    Bessel   Blackman   Box
8359%    Catrom   Cubic      Gaussian
8360%    Hanning  Hermite    Lanczos
8361%    Mitchell Point      Quandratic
8362%    Sinc     Triangle
8363%
8364%  Most of the filters are FIR (finite impulse response), however, Bessel,
8365%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8366%  are windowed (brought down to zero) with the Blackman filter.
8367%
8368%  The format of the MagickResampleImage method is:
8369%
8370%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8371%        const double x_resolution,const double y_resolution,
8372%        const FilterTypes filter)
8373%
8374%  A description of each parameter follows:
8375%
8376%    o wand: the magick wand.
8377%
8378%    o x_resolution: the new image x resolution.
8379%
8380%    o y_resolution: the new image y resolution.
8381%
8382%    o filter: Image filter to use.
8383%
8384*/
8385WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8386  const double x_resolution,const double y_resolution,const FilterTypes filter)
8387{
8388  Image
8389    *resample_image;
8390
8391  assert(wand != (MagickWand *) NULL);
8392  assert(wand->signature == WandSignature);
8393  if( IfMagickTrue(wand->debug) )
8394    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8395
8396  if (wand->images == (Image *) NULL)
8397    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8398  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8399    wand->exception);
8400  if (resample_image == (Image *) NULL)
8401    return(MagickFalse);
8402  ReplaceImageInList(&wand->images,resample_image);
8403  return(MagickTrue);
8404}
8405
8406/*
8407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8408%                                                                             %
8409%                                                                             %
8410%                                                                             %
8411%   M a g i c k R e s e t I m a g e P a g e                                   %
8412%                                                                             %
8413%                                                                             %
8414%                                                                             %
8415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8416%
8417%  MagickResetImagePage() resets the Wand page canvas and position.
8418%
8419%  The format of the MagickResetImagePage method is:
8420%
8421%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8422%        const char *page)
8423%
8424%  A description of each parameter follows:
8425%
8426%    o wand: the magick wand.
8427%
8428%    o page: the relative page specification.
8429%
8430*/
8431WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8432  const char *page)
8433{
8434  assert(wand != (MagickWand *) NULL);
8435  assert(wand->signature == WandSignature);
8436  if( IfMagickTrue(wand->debug) )
8437    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8438
8439  if (wand->images == (Image *) NULL)
8440    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8441  if ((page == (char *) NULL) || (*page == '\0'))
8442    {
8443      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8444      return(MagickTrue);
8445    }
8446  return(ResetImagePage(wand->images,page));
8447}
8448
8449/*
8450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8451%                                                                             %
8452%                                                                             %
8453%                                                                             %
8454%   M a g i c k R e s i z e I m a g e                                         %
8455%                                                                             %
8456%                                                                             %
8457%                                                                             %
8458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8459%
8460%  MagickResizeImage() scales an image to the desired dimensions with one of
8461%  these filters:
8462%
8463%    Bessel   Blackman   Box
8464%    Catrom   Cubic      Gaussian
8465%    Hanning  Hermite    Lanczos
8466%    Mitchell Point      Quandratic
8467%    Sinc     Triangle
8468%
8469%  Most of the filters are FIR (finite impulse response), however, Bessel,
8470%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8471%  are windowed (brought down to zero) with the Blackman filter.
8472%
8473%  The format of the MagickResizeImage method is:
8474%
8475%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8476%        const size_t columns,const size_t rows,const FilterTypes filter)
8477%
8478%  A description of each parameter follows:
8479%
8480%    o wand: the magick wand.
8481%
8482%    o columns: the number of columns in the scaled image.
8483%
8484%    o rows: the number of rows in the scaled image.
8485%
8486%    o filter: Image filter to use.
8487%
8488*/
8489WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8490  const size_t columns,const size_t rows,const FilterTypes filter)
8491{
8492  Image
8493    *resize_image;
8494
8495  assert(wand != (MagickWand *) NULL);
8496  assert(wand->signature == WandSignature);
8497  if( IfMagickTrue(wand->debug) )
8498    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8499
8500  if (wand->images == (Image *) NULL)
8501    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8502  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8503  if (resize_image == (Image *) NULL)
8504    return(MagickFalse);
8505  ReplaceImageInList(&wand->images,resize_image);
8506  return(MagickTrue);
8507}
8508
8509/*
8510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8511%                                                                             %
8512%                                                                             %
8513%                                                                             %
8514%   M a g i c k R o l l I m a g e                                             %
8515%                                                                             %
8516%                                                                             %
8517%                                                                             %
8518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8519%
8520%  MagickRollImage() offsets an image as defined by x and y.
8521%
8522%  The format of the MagickRollImage method is:
8523%
8524%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8525%        const size_t y)
8526%
8527%  A description of each parameter follows:
8528%
8529%    o wand: the magick wand.
8530%
8531%    o x: the x offset.
8532%
8533%    o y: the y offset.
8534%
8535%
8536*/
8537WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8538  const ssize_t x,const ssize_t y)
8539{
8540  Image
8541    *roll_image;
8542
8543  assert(wand != (MagickWand *) NULL);
8544  assert(wand->signature == WandSignature);
8545  if( IfMagickTrue(wand->debug) )
8546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8547
8548  if (wand->images == (Image *) NULL)
8549    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8550  roll_image=RollImage(wand->images,x,y,wand->exception);
8551  if (roll_image == (Image *) NULL)
8552    return(MagickFalse);
8553  ReplaceImageInList(&wand->images,roll_image);
8554  return(MagickTrue);
8555}
8556
8557/*
8558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8559%                                                                             %
8560%                                                                             %
8561%                                                                             %
8562%   M a g i c k R o t a t e I m a g e                                         %
8563%                                                                             %
8564%                                                                             %
8565%                                                                             %
8566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8567%
8568%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8569%  triangles left over from rotating the image are filled with the
8570%  background color.
8571%
8572%  The format of the MagickRotateImage method is:
8573%
8574%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8575%        const PixelWand *background,const double degrees)
8576%
8577%  A description of each parameter follows:
8578%
8579%    o wand: the magick wand.
8580%
8581%    o background: the background pixel wand.
8582%
8583%    o degrees: the number of degrees to rotate the image.
8584%
8585%
8586*/
8587WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8588  const PixelWand *background,const double degrees)
8589{
8590  Image
8591    *rotate_image;
8592
8593  assert(wand != (MagickWand *) NULL);
8594  assert(wand->signature == WandSignature);
8595  if( IfMagickTrue(wand->debug) )
8596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8597
8598  if (wand->images == (Image *) NULL)
8599    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8600  PixelGetQuantumPacket(background,&wand->images->background_color);
8601  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8602  if (rotate_image == (Image *) NULL)
8603    return(MagickFalse);
8604  ReplaceImageInList(&wand->images,rotate_image);
8605  return(MagickTrue);
8606}
8607
8608/*
8609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8610%                                                                             %
8611%                                                                             %
8612%                                                                             %
8613%   M a g i c k S a m p l e I m a g e                                         %
8614%                                                                             %
8615%                                                                             %
8616%                                                                             %
8617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8618%
8619%  MagickSampleImage() scales an image to the desired dimensions with pixel
8620%  sampling.  Unlike other scaling methods, this method does not introduce
8621%  any additional color into the scaled image.
8622%
8623%  The format of the MagickSampleImage method is:
8624%
8625%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8626%        const size_t columns,const size_t rows)
8627%
8628%  A description of each parameter follows:
8629%
8630%    o wand: the magick wand.
8631%
8632%    o columns: the number of columns in the scaled image.
8633%
8634%    o rows: the number of rows in the scaled image.
8635%
8636%
8637*/
8638WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8639  const size_t columns,const size_t rows)
8640{
8641  Image
8642    *sample_image;
8643
8644  assert(wand != (MagickWand *) NULL);
8645  assert(wand->signature == WandSignature);
8646  if( IfMagickTrue(wand->debug) )
8647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8648
8649  if (wand->images == (Image *) NULL)
8650    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8651  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8652  if (sample_image == (Image *) NULL)
8653    return(MagickFalse);
8654  ReplaceImageInList(&wand->images,sample_image);
8655  return(MagickTrue);
8656}
8657
8658/*
8659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8660%                                                                             %
8661%                                                                             %
8662%                                                                             %
8663%   M a g i c k S c a l e I m a g e                                           %
8664%                                                                             %
8665%                                                                             %
8666%                                                                             %
8667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8668%
8669%  MagickScaleImage() scales the size of an image to the given dimensions.
8670%
8671%  The format of the MagickScaleImage method is:
8672%
8673%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8674%        const size_t columns,const size_t rows)
8675%
8676%  A description of each parameter follows:
8677%
8678%    o wand: the magick wand.
8679%
8680%    o columns: the number of columns in the scaled image.
8681%
8682%    o rows: the number of rows in the scaled image.
8683%
8684%
8685*/
8686WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8687  const size_t columns,const size_t rows)
8688{
8689  Image
8690    *scale_image;
8691
8692  assert(wand != (MagickWand *) NULL);
8693  assert(wand->signature == WandSignature);
8694  if( IfMagickTrue(wand->debug) )
8695    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8696
8697  if (wand->images == (Image *) NULL)
8698    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8699  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8700  if (scale_image == (Image *) NULL)
8701    return(MagickFalse);
8702  ReplaceImageInList(&wand->images,scale_image);
8703  return(MagickTrue);
8704}
8705
8706/*
8707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8708%                                                                             %
8709%                                                                             %
8710%                                                                             %
8711%   M a g i c k S e g m e n t I m a g e                                       %
8712%                                                                             %
8713%                                                                             %
8714%                                                                             %
8715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8716%
8717%  MagickSegmentImage() segments an image by analyzing the histograms of the
8718%  color components and identifying units that are homogeneous with the fuzzy
8719%  C-means technique.
8720%
8721%  The format of the SegmentImage method is:
8722%
8723%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8724%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8725%        const double cluster_threshold,const double smooth_threshold)
8726%
8727%  A description of each parameter follows.
8728%
8729%    o wand: the wand.
8730%
8731%    o colorspace: the image colorspace.
8732%
8733%    o verbose:  Set to MagickTrue to print detailed information about the
8734%      identified classes.
8735%
8736%    o cluster_threshold:  This represents the minimum number of pixels
8737%      contained in a hexahedra before it can be considered valid (expressed as
8738%      a percentage).
8739%
8740%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8741%      derivative of the histogram.  As the value is increased, you can expect a
8742%      smoother second derivative.
8743%
8744*/
8745MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8746  const ColorspaceType colorspace,const MagickBooleanType verbose,
8747  const double cluster_threshold,const double smooth_threshold)
8748{
8749  MagickBooleanType
8750    status;
8751
8752  assert(wand != (MagickWand *) NULL);
8753  assert(wand->signature == WandSignature);
8754  if( IfMagickTrue(wand->debug) )
8755    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8756
8757  if (wand->images == (Image *) NULL)
8758    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8759  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8760    smooth_threshold,wand->exception);
8761  return(status);
8762}
8763
8764/*
8765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8766%                                                                             %
8767%                                                                             %
8768%                                                                             %
8769%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8770%                                                                             %
8771%                                                                             %
8772%                                                                             %
8773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8774%
8775%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8776%  threshold. It is similar to the unsharpen mask that sharpens everything with
8777%  contrast above a certain threshold.
8778%
8779%  The format of the MagickSelectiveBlurImage method is:
8780%
8781%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8782%        const double radius,const double sigma,const double threshold)
8783%
8784%  A description of each parameter follows:
8785%
8786%    o wand: the magick wand.
8787%
8788%    o radius: the radius of the gaussian, in pixels, not counting the center
8789%      pixel.
8790%
8791%    o sigma: the standard deviation of the gaussian, in pixels.
8792%
8793%    o threshold: only pixels within this contrast threshold are included
8794%      in the blur operation.
8795%
8796*/
8797WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8798  const double radius,const double sigma,const double threshold)
8799{
8800  Image
8801    *blur_image;
8802
8803  assert(wand != (MagickWand *) NULL);
8804  assert(wand->signature == WandSignature);
8805  if( IfMagickTrue(wand->debug) )
8806    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8807
8808  if (wand->images == (Image *) NULL)
8809    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8810  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8811    wand->exception);
8812  if (blur_image == (Image *) NULL)
8813    return(MagickFalse);
8814  ReplaceImageInList(&wand->images,blur_image);
8815  return(MagickTrue);
8816}
8817
8818/*
8819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8820%                                                                             %
8821%                                                                             %
8822%                                                                             %
8823%   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                       %
8824%                                                                             %
8825%                                                                             %
8826%                                                                             %
8827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8828%
8829%  MagickSeparateImage() separates a channel from the image and returns a
8830%  grayscale image.  A channel is a particular color component of each pixel
8831%  in the image.
8832%
8833%  The format of the MagickSeparateImage method is:
8834%
8835%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8836%        const ChannelType channel)
8837%
8838%  A description of each parameter follows:
8839%
8840%    o wand: the magick wand.
8841%
8842%    o channel: the channel.
8843%
8844*/
8845WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8846  const ChannelType channel)
8847{
8848  Image
8849    *separate_image;
8850
8851  assert(wand != (MagickWand *) NULL);
8852  assert(wand->signature == WandSignature);
8853  if( IfMagickTrue(wand->debug) )
8854    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8855
8856  if (wand->images == (Image *) NULL)
8857    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8858  separate_image=SeparateImage(wand->images,channel,wand->exception);
8859  if (separate_image == (Image *) NULL)
8860    return(MagickFalse);
8861  ReplaceImageInList(&wand->images,separate_image);
8862  return(MagickTrue);
8863}
8864
8865/*
8866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8867%                                                                             %
8868%                                                                             %
8869%                                                                             %
8870%     M a g i c k S e p i a T o n e I m a g e                                 %
8871%                                                                             %
8872%                                                                             %
8873%                                                                             %
8874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8875%
8876%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8877%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8878%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8879%  threshold of 80% is a good starting point for a reasonable tone.
8880%
8881%  The format of the MagickSepiaToneImage method is:
8882%
8883%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8884%        const double threshold)
8885%
8886%  A description of each parameter follows:
8887%
8888%    o wand: the magick wand.
8889%
8890%    o threshold:  Define the extent of the sepia toning.
8891%
8892*/
8893WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8894  const double threshold)
8895{
8896  Image
8897    *sepia_image;
8898
8899  assert(wand != (MagickWand *) NULL);
8900  assert(wand->signature == WandSignature);
8901  if( IfMagickTrue(wand->debug) )
8902    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8903
8904  if (wand->images == (Image *) NULL)
8905    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8906  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8907  if (sepia_image == (Image *) NULL)
8908    return(MagickFalse);
8909  ReplaceImageInList(&wand->images,sepia_image);
8910  return(MagickTrue);
8911}
8912
8913/*
8914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8915%                                                                             %
8916%                                                                             %
8917%                                                                             %
8918%   M a g i c k S e t I m a g e                                               %
8919%                                                                             %
8920%                                                                             %
8921%                                                                             %
8922%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8923%
8924%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8925%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8926%  wand.
8927%
8928%  The format of the MagickSetImage method is:
8929%
8930%      MagickBooleanType MagickSetImage(MagickWand *wand,
8931%        const MagickWand *set_wand)
8932%
8933%  A description of each parameter follows:
8934%
8935%    o wand: the magick wand.
8936%
8937%    o set_wand: the set_wand wand.
8938%
8939*/
8940WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8941  const MagickWand *set_wand)
8942{
8943  Image
8944    *images;
8945
8946  assert(wand != (MagickWand *) NULL);
8947  assert(wand->signature == WandSignature);
8948  if( IfMagickTrue(wand->debug) )
8949    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8950
8951  assert(set_wand != (MagickWand *) NULL);
8952  assert(set_wand->signature == WandSignature);
8953  if( IfMagickTrue(wand->debug) )
8954    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8955
8956  if (set_wand->images == (Image *) NULL)
8957    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8958  images=CloneImageList(set_wand->images,wand->exception);
8959  if (images == (Image *) NULL)
8960    return(MagickFalse);
8961  ReplaceImageInList(&wand->images,images);
8962  return(MagickTrue);
8963}
8964
8965/*
8966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8967%                                                                             %
8968%                                                                             %
8969%                                                                             %
8970%   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                       %
8971%                                                                             %
8972%                                                                             %
8973%                                                                             %
8974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8975%
8976%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8977%  alpha channel.
8978%
8979%  The format of the MagickSetImageAlphaChannel method is:
8980%
8981%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8982%        const AlphaChannelOption alpha_type)
8983%
8984%  A description of each parameter follows:
8985%
8986%    o wand: the magick wand.
8987%
8988%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8989%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8990%
8991*/
8992WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8993  const AlphaChannelOption alpha_type)
8994{
8995  assert(wand != (MagickWand *) NULL);
8996  assert(wand->signature == WandSignature);
8997  if( IfMagickTrue(wand->debug) )
8998    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8999
9000  if (wand->images == (Image *) NULL)
9001    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9002  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9003}
9004
9005/*
9006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9007%                                                                             %
9008%                                                                             %
9009%                                                                             %
9010%   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                 %
9011%                                                                             %
9012%                                                                             %
9013%                                                                             %
9014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9015%
9016%  MagickSetImageBackgroundColor() sets the image background color.
9017%
9018%  The format of the MagickSetImageBackgroundColor method is:
9019%
9020%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9021%        const PixelWand *background)
9022%
9023%  A description of each parameter follows:
9024%
9025%    o wand: the magick wand.
9026%
9027%    o background: the background pixel wand.
9028%
9029*/
9030WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9031  const PixelWand *background)
9032{
9033  assert(wand != (MagickWand *) NULL);
9034  assert(wand->signature == WandSignature);
9035  if( IfMagickTrue(wand->debug) )
9036    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9037
9038  if (wand->images == (Image *) NULL)
9039    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9040  PixelGetQuantumPacket(background,&wand->images->background_color);
9041  return(MagickTrue);
9042}
9043
9044/*
9045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9046%                                                                             %
9047%                                                                             %
9048%                                                                             %
9049%   M a g i c k S e t I m a g e B l u e P r i m a r y                         %
9050%                                                                             %
9051%                                                                             %
9052%                                                                             %
9053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9054%
9055%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9056%
9057%  The format of the MagickSetImageBluePrimary method is:
9058%
9059%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9060%        const double x,const double y)
9061%
9062%  A description of each parameter follows:
9063%
9064%    o wand: the magick wand.
9065%
9066%    o x: the blue primary x-point.
9067%
9068%    o y: the blue primary y-point.
9069%
9070*/
9071WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9072  const double x,const double y)
9073{
9074  assert(wand != (MagickWand *) NULL);
9075  assert(wand->signature == WandSignature);
9076  if( IfMagickTrue(wand->debug) )
9077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9078
9079  if (wand->images == (Image *) NULL)
9080    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9081  wand->images->chromaticity.blue_primary.x=x;
9082  wand->images->chromaticity.blue_primary.y=y;
9083  return(MagickTrue);
9084}
9085
9086/*
9087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9088%                                                                             %
9089%                                                                             %
9090%                                                                             %
9091%   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                         %
9092%                                                                             %
9093%                                                                             %
9094%                                                                             %
9095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9096%
9097%  MagickSetImageBorderColor() sets the image border color.
9098%
9099%  The format of the MagickSetImageBorderColor method is:
9100%
9101%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9102%        const PixelWand *border)
9103%
9104%  A description of each parameter follows:
9105%
9106%    o wand: the magick wand.
9107%
9108%    o border: the border pixel wand.
9109%
9110*/
9111WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9112  const PixelWand *border)
9113{
9114  assert(wand != (MagickWand *) NULL);
9115  assert(wand->signature == WandSignature);
9116  if( IfMagickTrue(wand->debug) )
9117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9118
9119  if (wand->images == (Image *) NULL)
9120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9121  PixelGetQuantumPacket(border,&wand->images->border_color);
9122  return(MagickTrue);
9123}
9124
9125/*
9126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9127%                                                                             %
9128%                                                                             %
9129%                                                                             %
9130%   M a g i c k S e t I m a g e C l i p M a s k                               %
9131%                                                                             %
9132%                                                                             %
9133%                                                                             %
9134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9135%
9136%  MagickSetImageMask() sets image clip mask.
9137%
9138%  The format of the MagickSetImageMask method is:
9139%
9140%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9141%        const MagickWand *clip_mask)
9142%
9143%  A description of each parameter follows:
9144%
9145%    o wand: the magick wand.
9146%
9147%    o clip_mask: the clip_mask wand.
9148%
9149*/
9150WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9151  const MagickWand *clip_mask)
9152{
9153  assert(wand != (MagickWand *) NULL);
9154  assert(wand->signature == WandSignature);
9155  if( IfMagickTrue(wand->debug) )
9156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9157
9158  assert(clip_mask != (MagickWand *) NULL);
9159  assert(clip_mask->signature == WandSignature);
9160  if( IfMagickTrue(clip_mask->debug) )
9161    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9162
9163  if (clip_mask->images == (Image *) NULL)
9164    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9165  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9166}
9167
9168/*
9169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9170%                                                                             %
9171%                                                                             %
9172%                                                                             %
9173%   M a g i c k S e t I m a g e C o l o r                                     %
9174%                                                                             %
9175%                                                                             %
9176%                                                                             %
9177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9178%
9179%  MagickSetImageColor() set the entire wand canvas to the specified color.
9180%
9181%  The format of the MagickSetImageColor method is:
9182%
9183%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9184%        const PixelWand *color)
9185%
9186%  A description of each parameter follows:
9187%
9188%    o wand: the magick wand.
9189%
9190%    o background: the image color.
9191%
9192*/
9193WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9194  const PixelWand *color)
9195{
9196  PixelInfo
9197    pixel;
9198
9199  assert(wand != (MagickWand *) NULL);
9200  assert(wand->signature == WandSignature);
9201  if( IfMagickTrue(wand->debug) )
9202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9203
9204  PixelGetMagickColor(color,&pixel);
9205  return(SetImageColor(wand->images,&pixel,wand->exception));
9206}
9207
9208/*
9209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9210%                                                                             %
9211%                                                                             %
9212%                                                                             %
9213%   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                     %
9214%                                                                             %
9215%                                                                             %
9216%                                                                             %
9217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9218%
9219%  MagickSetImageColormapColor() sets the color of the specified colormap
9220%  index.
9221%
9222%  The format of the MagickSetImageColormapColor method is:
9223%
9224%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9225%        const size_t index,const PixelWand *color)
9226%
9227%  A description of each parameter follows:
9228%
9229%    o wand: the magick wand.
9230%
9231%    o index: the offset into the image colormap.
9232%
9233%    o color: Return the colormap color in this wand.
9234%
9235*/
9236WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9237  const size_t index,const PixelWand *color)
9238{
9239  assert(wand != (MagickWand *) NULL);
9240  assert(wand->signature == WandSignature);
9241  if( IfMagickTrue(wand->debug) )
9242    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9243
9244  if (wand->images == (Image *) NULL)
9245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9246  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9247      (index >= wand->images->colors))
9248    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9249  PixelGetQuantumPacket(color,wand->images->colormap+index);
9250  return(SyncImage(wand->images,wand->exception));
9251}
9252
9253/*
9254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9255%                                                                             %
9256%                                                                             %
9257%                                                                             %
9258%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9259%                                                                             %
9260%                                                                             %
9261%                                                                             %
9262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9263%
9264%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9265%  the image data.
9266%
9267%  The format of the MagickSetImageColorspace method is:
9268%
9269%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9270%        const ColorspaceType colorspace)
9271%
9272%  A description of each parameter follows:
9273%
9274%    o wand: the magick wand.
9275%
9276%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9277%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9278%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9279%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9280%      HSLColorspace, or HWBColorspace.
9281%
9282*/
9283WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9284  const ColorspaceType colorspace)
9285{
9286  assert(wand != (MagickWand *) NULL);
9287  assert(wand->signature == WandSignature);
9288  if( IfMagickTrue(wand->debug) )
9289    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9290
9291  if (wand->images == (Image *) NULL)
9292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9293  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9294}
9295
9296/*
9297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9298%                                                                             %
9299%                                                                             %
9300%                                                                             %
9301%   M a g i c k S e t I m a g e C o m p o s e                                 %
9302%                                                                             %
9303%                                                                             %
9304%                                                                             %
9305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9306%
9307%  MagickSetImageCompose() sets the image composite operator, useful for
9308%  specifying how to composite the image thumbnail when using the
9309%  MagickMontageImage() method.
9310%
9311%  The format of the MagickSetImageCompose method is:
9312%
9313%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9314%        const CompositeOperator compose)
9315%
9316%  A description of each parameter follows:
9317%
9318%    o wand: the magick wand.
9319%
9320%    o compose: the image composite operator.
9321%
9322*/
9323WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9324  const CompositeOperator compose)
9325{
9326  assert(wand != (MagickWand *) NULL);
9327  assert(wand->signature == WandSignature);
9328  if( IfMagickTrue(wand->debug) )
9329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9330
9331  if (wand->images == (Image *) NULL)
9332    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9333  wand->images->compose=compose;
9334  return(MagickTrue);
9335}
9336
9337/*
9338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9339%                                                                             %
9340%                                                                             %
9341%                                                                             %
9342%   M a g i c k S e t I m a g e C o m p r e s s i o n                         %
9343%                                                                             %
9344%                                                                             %
9345%                                                                             %
9346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9347%
9348%  MagickSetImageCompression() sets the image compression.
9349%
9350%  The format of the MagickSetImageCompression method is:
9351%
9352%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9353%        const CompressionType compression)
9354%
9355%  A description of each parameter follows:
9356%
9357%    o wand: the magick wand.
9358%
9359%    o compression: the image compression type.
9360%
9361*/
9362WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9363  const CompressionType compression)
9364{
9365  assert(wand != (MagickWand *) NULL);
9366  assert(wand->signature == WandSignature);
9367  if( IfMagickTrue(wand->debug) )
9368    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9369
9370  if (wand->images == (Image *) NULL)
9371    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9372  wand->images->compression=compression;
9373  return(MagickTrue);
9374}
9375
9376/*
9377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9378%                                                                             %
9379%                                                                             %
9380%                                                                             %
9381%   M a g i c k S e t I m a g e C o m p r e s s i o n Q u a l i t y           %
9382%                                                                             %
9383%                                                                             %
9384%                                                                             %
9385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9386%
9387%  MagickSetImageCompressionQuality() sets the image compression quality.
9388%
9389%  The format of the MagickSetImageCompressionQuality method is:
9390%
9391%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9392%        const size_t quality)
9393%
9394%  A description of each parameter follows:
9395%
9396%    o wand: the magick wand.
9397%
9398%    o quality: the image compression tlityype.
9399%
9400*/
9401WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9402  const size_t quality)
9403{
9404  assert(wand != (MagickWand *) NULL);
9405  assert(wand->signature == WandSignature);
9406  if( IfMagickTrue(wand->debug) )
9407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9408
9409  if (wand->images == (Image *) NULL)
9410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9411  wand->images->quality=quality;
9412  return(MagickTrue);
9413}
9414
9415/*
9416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9417%                                                                             %
9418%                                                                             %
9419%                                                                             %
9420%   M a g i c k S e t I m a g e D e l a y                                     %
9421%                                                                             %
9422%                                                                             %
9423%                                                                             %
9424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9425%
9426%  MagickSetImageDelay() sets the image delay.
9427%
9428%  The format of the MagickSetImageDelay method is:
9429%
9430%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9431%        const size_t delay)
9432%
9433%  A description of each parameter follows:
9434%
9435%    o wand: the magick wand.
9436%
9437%    o delay: the image delay in ticks-per-second units.
9438%
9439*/
9440WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9441  const size_t delay)
9442{
9443  assert(wand != (MagickWand *) NULL);
9444  assert(wand->signature == WandSignature);
9445  if( IfMagickTrue(wand->debug) )
9446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9447
9448  if (wand->images == (Image *) NULL)
9449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450  wand->images->delay=delay;
9451  return(MagickTrue);
9452}
9453
9454/*
9455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9456%                                                                             %
9457%                                                                             %
9458%                                                                             %
9459%   M a g i c k S e t I m a g e D e p t h                                     %
9460%                                                                             %
9461%                                                                             %
9462%                                                                             %
9463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464%
9465%  MagickSetImageDepth() sets the image depth.
9466%
9467%  The format of the MagickSetImageDepth method is:
9468%
9469%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9470%        const size_t depth)
9471%
9472%  A description of each parameter follows:
9473%
9474%    o wand: the magick wand.
9475%
9476%    o depth: the image depth in bits: 8, 16, or 32.
9477%
9478*/
9479WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9480  const size_t depth)
9481{
9482  assert(wand != (MagickWand *) NULL);
9483  assert(wand->signature == WandSignature);
9484  if( IfMagickTrue(wand->debug) )
9485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9486
9487  if (wand->images == (Image *) NULL)
9488    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9489  return(SetImageDepth(wand->images,depth,wand->exception));
9490}
9491
9492/*
9493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9494%                                                                             %
9495%                                                                             %
9496%                                                                             %
9497%   M a g i c k S e t I m a g e D i s p o s e                                 %
9498%                                                                             %
9499%                                                                             %
9500%                                                                             %
9501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9502%
9503%  MagickSetImageDispose() sets the image disposal method.
9504%
9505%  The format of the MagickSetImageDispose method is:
9506%
9507%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9508%        const DisposeType dispose)
9509%
9510%  A description of each parameter follows:
9511%
9512%    o wand: the magick wand.
9513%
9514%    o dispose: the image disposeal type.
9515%
9516*/
9517WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9518  const DisposeType dispose)
9519{
9520  assert(wand != (MagickWand *) NULL);
9521  assert(wand->signature == WandSignature);
9522  if( IfMagickTrue(wand->debug) )
9523    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9524
9525  if (wand->images == (Image *) NULL)
9526    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9527  wand->images->dispose=dispose;
9528  return(MagickTrue);
9529}
9530
9531/*
9532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9533%                                                                             %
9534%                                                                             %
9535%                                                                             %
9536%   M a g i c k S e t I m a g e E n d i a n                                   %
9537%                                                                             %
9538%                                                                             %
9539%                                                                             %
9540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9541%
9542%  MagickSetImageEndian() sets the image endian method.
9543%
9544%  The format of the MagickSetImageEndian method is:
9545%
9546%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9547%        const EndianType endian)
9548%
9549%  A description of each parameter follows:
9550%
9551%    o wand: the magick wand.
9552%
9553%    o endian: the image endian type.
9554%
9555*/
9556WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9557  const EndianType endian)
9558{
9559  assert(wand != (MagickWand *) NULL);
9560  assert(wand->signature == WandSignature);
9561  if (wand->debug != MagickFalse)
9562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9563  if (wand->images == (Image *) NULL)
9564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9565  wand->images->endian=endian;
9566  return(MagickTrue);
9567}
9568
9569/*
9570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9571%                                                                             %
9572%                                                                             %
9573%                                                                             %
9574%   M a g i c k S e t I m a g e E x t e n t                                   %
9575%                                                                             %
9576%                                                                             %
9577%                                                                             %
9578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9579%
9580%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9581%
9582%  The format of the MagickSetImageExtent method is:
9583%
9584%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9585%        const size_t columns,const unsigned rows)
9586%
9587%  A description of each parameter follows:
9588%
9589%    o wand: the magick wand.
9590%
9591%    o columns:  The image width in pixels.
9592%
9593%    o rows:  The image height in pixels.
9594%
9595*/
9596WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9597  const size_t columns,const size_t rows)
9598{
9599  assert(wand != (MagickWand *) NULL);
9600  assert(wand->signature == WandSignature);
9601  if( IfMagickTrue(wand->debug) )
9602    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9603
9604  if (wand->images == (Image *) NULL)
9605    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9606  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9607}
9608
9609/*
9610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9611%                                                                             %
9612%                                                                             %
9613%                                                                             %
9614%   M a g i c k S e t I m a g e F i l e n a m e                               %
9615%                                                                             %
9616%                                                                             %
9617%                                                                             %
9618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9619%
9620%  MagickSetImageFilename() sets the filename of a particular image in a
9621%  sequence.
9622%
9623%  The format of the MagickSetImageFilename method is:
9624%
9625%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9626%        const char *filename)
9627%
9628%  A description of each parameter follows:
9629%
9630%    o wand: the magick wand.
9631%
9632%    o filename: the image filename.
9633%
9634*/
9635WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9636  const char *filename)
9637{
9638  assert(wand != (MagickWand *) NULL);
9639  assert(wand->signature == WandSignature);
9640  if( IfMagickTrue(wand->debug) )
9641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9642
9643  if (wand->images == (Image *) NULL)
9644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9645  if (filename != (const char *) NULL)
9646    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9647  return(MagickTrue);
9648}
9649
9650/*
9651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9652%                                                                             %
9653%                                                                             %
9654%                                                                             %
9655%   M a g i c k S e t I m a g e F o r m a t                                   %
9656%                                                                             %
9657%                                                                             %
9658%                                                                             %
9659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9660%
9661%  MagickSetImageFormat() sets the format of a particular image in a
9662%  sequence.
9663%
9664%  The format of the MagickSetImageFormat method is:
9665%
9666%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9667%        const char *format)
9668%
9669%  A description of each parameter follows:
9670%
9671%    o wand: the magick wand.
9672%
9673%    o format: the image format.
9674%
9675*/
9676WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9677  const char *format)
9678{
9679  const MagickInfo
9680    *magick_info;
9681
9682  assert(wand != (MagickWand *) NULL);
9683  assert(wand->signature == WandSignature);
9684  if( IfMagickTrue(wand->debug) )
9685    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9686
9687  if (wand->images == (Image *) NULL)
9688    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9689  if ((format == (char *) NULL) || (*format == '\0'))
9690    {
9691      *wand->images->magick='\0';
9692      return(MagickTrue);
9693    }
9694  magick_info=GetMagickInfo(format,wand->exception);
9695  if (magick_info == (const MagickInfo *) NULL)
9696    return(MagickFalse);
9697  ClearMagickException(wand->exception);
9698  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9699  return(MagickTrue);
9700}
9701
9702/*
9703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9704%                                                                             %
9705%                                                                             %
9706%                                                                             %
9707%   M a g i c k S e t I m a g e F u z z                                       %
9708%                                                                             %
9709%                                                                             %
9710%                                                                             %
9711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9712%
9713%  MagickSetImageFuzz() sets the image fuzz.
9714%
9715%  The format of the MagickSetImageFuzz method is:
9716%
9717%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9718%        const double fuzz)
9719%
9720%  A description of each parameter follows:
9721%
9722%    o wand: the magick wand.
9723%
9724%    o fuzz: the image fuzz.
9725%
9726*/
9727WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9728  const double fuzz)
9729{
9730  assert(wand != (MagickWand *) NULL);
9731  assert(wand->signature == WandSignature);
9732  if( IfMagickTrue(wand->debug) )
9733    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9734
9735  if (wand->images == (Image *) NULL)
9736    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9737  wand->images->fuzz=fuzz;
9738  return(MagickTrue);
9739}
9740
9741/*
9742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9743%                                                                             %
9744%                                                                             %
9745%                                                                             %
9746%   M a g i c k S e t I m a g e G a m m a                                     %
9747%                                                                             %
9748%                                                                             %
9749%                                                                             %
9750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9751%
9752%  MagickSetImageGamma() sets the image gamma.
9753%
9754%  The format of the MagickSetImageGamma method is:
9755%
9756%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9757%        const double gamma)
9758%
9759%  A description of each parameter follows:
9760%
9761%    o wand: the magick wand.
9762%
9763%    o gamma: the image gamma.
9764%
9765*/
9766WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9767  const double gamma)
9768{
9769  assert(wand != (MagickWand *) NULL);
9770  assert(wand->signature == WandSignature);
9771  if( IfMagickTrue(wand->debug) )
9772    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9773
9774  if (wand->images == (Image *) NULL)
9775    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9776  wand->images->gamma=gamma;
9777  return(MagickTrue);
9778}
9779
9780/*
9781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9782%                                                                             %
9783%                                                                             %
9784%                                                                             %
9785%   M a g i c k S e t I m a g e G r a v i t y                                 %
9786%                                                                             %
9787%                                                                             %
9788%                                                                             %
9789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9790%
9791%  MagickSetImageGravity() sets the image gravity type.
9792%
9793%  The format of the MagickSetImageGravity method is:
9794%
9795%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9796%        const GravityType gravity)
9797%
9798%  A description of each parameter follows:
9799%
9800%    o wand: the magick wand.
9801%
9802%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9803%      PlaneInterlace, PartitionInterlace.
9804%
9805*/
9806WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9807  const GravityType gravity)
9808{
9809  assert(wand != (MagickWand *) NULL);
9810  assert(wand->signature == WandSignature);
9811  if( IfMagickTrue(wand->debug) )
9812    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9813
9814  if (wand->images == (Image *) NULL)
9815    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9816  wand->images->gravity=gravity;
9817  return(MagickTrue);
9818}
9819
9820/*
9821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9822%                                                                             %
9823%                                                                             %
9824%                                                                             %
9825%   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                       %
9826%                                                                             %
9827%                                                                             %
9828%                                                                             %
9829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9830%
9831%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9832%  point.
9833%
9834%  The format of the MagickSetImageGreenPrimary method is:
9835%
9836%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9837%        const double x,const double y)
9838%
9839%  A description of each parameter follows:
9840%
9841%    o wand: the magick wand.
9842%
9843%    o x: the green primary x-point.
9844%
9845%    o y: the green primary y-point.
9846%
9847%
9848*/
9849WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9850  const double x,const double y)
9851{
9852  assert(wand != (MagickWand *) NULL);
9853  assert(wand->signature == WandSignature);
9854  if( IfMagickTrue(wand->debug) )
9855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9856
9857  if (wand->images == (Image *) NULL)
9858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9859  wand->images->chromaticity.green_primary.x=x;
9860  wand->images->chromaticity.green_primary.y=y;
9861  return(MagickTrue);
9862}
9863
9864/*
9865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9866%                                                                             %
9867%                                                                             %
9868%                                                                             %
9869%   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                 %
9870%                                                                             %
9871%                                                                             %
9872%                                                                             %
9873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9874%
9875%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9876%
9877%  The format of the MagickSetImageInterlaceScheme method is:
9878%
9879%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9880%        const InterlaceType interlace)
9881%
9882%  A description of each parameter follows:
9883%
9884%    o wand: the magick wand.
9885%
9886%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9887%      PlaneInterlace, PartitionInterlace.
9888%
9889*/
9890WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9891  const InterlaceType interlace)
9892{
9893  assert(wand != (MagickWand *) NULL);
9894  assert(wand->signature == WandSignature);
9895  if( IfMagickTrue(wand->debug) )
9896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9897
9898  if (wand->images == (Image *) NULL)
9899    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9900  wand->images->interlace=interlace;
9901  return(MagickTrue);
9902}
9903
9904/*
9905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9906%                                                                             %
9907%                                                                             %
9908%                                                                             %
9909%   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             %
9910%                                                                             %
9911%                                                                             %
9912%                                                                             %
9913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9914%
9915%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9916%
9917%  The format of the MagickSetImagePixelInterpolateMethod method is:
9918%
9919%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9920%        const PixelInterpolateMethod method)
9921%
9922%  A description of each parameter follows:
9923%
9924%    o wand: the magick wand.
9925%
9926%    o method: the image interpole pixel methods: choose from Undefined,
9927%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9928%
9929*/
9930WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9931  const PixelInterpolateMethod method)
9932{
9933  assert(wand != (MagickWand *) NULL);
9934  assert(wand->signature == WandSignature);
9935  if( IfMagickTrue(wand->debug) )
9936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9937
9938  if (wand->images == (Image *) NULL)
9939    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9940  wand->images->interpolate=method;
9941  return(MagickTrue);
9942}
9943
9944/*
9945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9946%                                                                             %
9947%                                                                             %
9948%                                                                             %
9949%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9950%                                                                             %
9951%                                                                             %
9952%                                                                             %
9953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9954%
9955%  MagickSetImageIterations() sets the image iterations.
9956%
9957%  The format of the MagickSetImageIterations method is:
9958%
9959%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9960%        const size_t iterations)
9961%
9962%  A description of each parameter follows:
9963%
9964%    o wand: the magick wand.
9965%
9966%    o delay: the image delay in 1/100th of a second.
9967%
9968*/
9969WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9970  const size_t iterations)
9971{
9972  assert(wand != (MagickWand *) NULL);
9973  assert(wand->signature == WandSignature);
9974  if( IfMagickTrue(wand->debug) )
9975    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9976
9977  if (wand->images == (Image *) NULL)
9978    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9979  wand->images->iterations=iterations;
9980  return(MagickTrue);
9981}
9982
9983/*
9984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9985%                                                                             %
9986%                                                                             %
9987%                                                                             %
9988%   M a g i c k S e t I m a g e M a t t e                                     %
9989%                                                                             %
9990%                                                                             %
9991%                                                                             %
9992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9993%
9994%  MagickSetImageMatte() sets the image matte channel.
9995%
9996%  The format of the MagickSetImageMatteColor method is:
9997%
9998%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9999%        const MagickBooleanType *matte)
10000%
10001%  A description of each parameter follows:
10002%
10003%    o wand: the magick wand.
10004%
10005%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10006%      MagickFalse.
10007%
10008*/
10009WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10010  const MagickBooleanType matte)
10011{
10012  assert(wand != (MagickWand *) NULL);
10013  assert(wand->signature == WandSignature);
10014  if( IfMagickTrue(wand->debug) )
10015    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10016
10017  if (wand->images == (Image *) NULL)
10018    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10019  if( IfMagickFalse(wand->images->matte) && IsMagickTrue(matte))
10020    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10021  wand->images->matte=matte;
10022  return(MagickTrue);
10023}
10024
10025/*
10026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10027%                                                                             %
10028%                                                                             %
10029%                                                                             %
10030%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10031%                                                                             %
10032%                                                                             %
10033%                                                                             %
10034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10035%
10036%  MagickSetImageMatteColor() sets the image matte color.
10037%
10038%  The format of the MagickSetImageMatteColor method is:
10039%
10040%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10041%        const PixelWand *matte)
10042%
10043%  A description of each parameter follows:
10044%
10045%    o wand: the magick wand.
10046%
10047%    o matte: the matte pixel wand.
10048%
10049*/
10050WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10051  const PixelWand *matte)
10052{
10053  assert(wand != (MagickWand *) NULL);
10054  assert(wand->signature == WandSignature);
10055  if( IfMagickTrue(wand->debug) )
10056    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10057
10058  if (wand->images == (Image *) NULL)
10059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10060  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10061  return(MagickTrue);
10062}
10063
10064/*
10065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10066%                                                                             %
10067%                                                                             %
10068%                                                                             %
10069%   M a g i c k S e t I m a g e O p a c i t y                                 %
10070%                                                                             %
10071%                                                                             %
10072%                                                                             %
10073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10074%
10075%  MagickSetImageAlpha() sets the image to the specified alpha level.
10076%
10077%  The format of the MagickSetImageAlpha method is:
10078%
10079%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10080%        const double alpha)
10081%
10082%  A description of each parameter follows:
10083%
10084%    o wand: the magick wand.
10085%
10086%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10087%      transparent.
10088%
10089*/
10090WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10091  const double alpha)
10092{
10093  MagickBooleanType
10094    status;
10095
10096  assert(wand != (MagickWand *) NULL);
10097  assert(wand->signature == WandSignature);
10098  if( IfMagickTrue(wand->debug) )
10099    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10100
10101  if (wand->images == (Image *) NULL)
10102    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10103  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10104    wand->exception);
10105  return(status);
10106}
10107
10108/*
10109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10110%                                                                             %
10111%                                                                             %
10112%                                                                             %
10113%   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                         %
10114%                                                                             %
10115%                                                                             %
10116%                                                                             %
10117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10118%
10119%  MagickSetImageOrientation() sets the image orientation.
10120%
10121%  The format of the MagickSetImageOrientation method is:
10122%
10123%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10124%        const OrientationType orientation)
10125%
10126%  A description of each parameter follows:
10127%
10128%    o wand: the magick wand.
10129%
10130%    o orientation: the image orientation type.
10131%
10132*/
10133WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10134  const OrientationType orientation)
10135{
10136  assert(wand != (MagickWand *) NULL);
10137  assert(wand->signature == WandSignature);
10138  if( IfMagickTrue(wand->debug) )
10139    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10140
10141  if (wand->images == (Image *) NULL)
10142    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10143  wand->images->orientation=orientation;
10144  return(MagickTrue);
10145}
10146
10147/*
10148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10149%                                                                             %
10150%                                                                             %
10151%                                                                             %
10152%   M a g i c k S e t I m a g e P a g e                                       %
10153%                                                                             %
10154%                                                                             %
10155%                                                                             %
10156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10157%
10158%  MagickSetImagePage() sets the page geometry of the image.
10159%
10160%  The format of the MagickSetImagePage method is:
10161%
10162%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10163%        const size_t width,const size_t height,const ssize_t x,
10164%        const ssize_t y)
10165%
10166%  A description of each parameter follows:
10167%
10168%    o wand: the magick wand.
10169%
10170%    o width: the page width.
10171%
10172%    o height: the page height.
10173%
10174%    o x: the page x-offset.
10175%
10176%    o y: the page y-offset.
10177%
10178*/
10179WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10180  const size_t width,const size_t height,const ssize_t x,
10181  const ssize_t y)
10182{
10183  assert(wand != (MagickWand *) NULL);
10184  assert(wand->signature == WandSignature);
10185  if( IfMagickTrue(wand->debug) )
10186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10187
10188  if (wand->images == (Image *) NULL)
10189    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10190  wand->images->page.width=width;
10191  wand->images->page.height=height;
10192  wand->images->page.x=x;
10193  wand->images->page.y=y;
10194  return(MagickTrue);
10195}
10196
10197/*
10198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10199%                                                                             %
10200%                                                                             %
10201%                                                                             %
10202%   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                 %
10203%                                                                             %
10204%                                                                             %
10205%                                                                             %
10206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10207%
10208%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10209%  specified method and returns the previous progress monitor if any.  The
10210%  progress monitor method looks like this:
10211%
10212%    MagickBooleanType MagickProgressMonitor(const char *text,
10213%      const MagickOffsetType offset,const MagickSizeType span,
10214%      void *client_data)
10215%
10216%  If the progress monitor returns MagickFalse, the current operation is
10217%  interrupted.
10218%
10219%  The format of the MagickSetImageProgressMonitor method is:
10220%
10221%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10222%        const MagickProgressMonitor progress_monitor,void *client_data)
10223%
10224%  A description of each parameter follows:
10225%
10226%    o wand: the magick wand.
10227%
10228%    o progress_monitor: Specifies a pointer to a method to monitor progress
10229%      of an image operation.
10230%
10231%    o client_data: Specifies a pointer to any client data.
10232%
10233*/
10234WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10235  const MagickProgressMonitor progress_monitor,void *client_data)
10236{
10237  MagickProgressMonitor
10238    previous_monitor;
10239
10240  assert(wand != (MagickWand *) NULL);
10241  assert(wand->signature == WandSignature);
10242  if( IfMagickTrue(wand->debug) )
10243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10244
10245  if (wand->images == (Image *) NULL)
10246    {
10247      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10248        "ContainsNoImages","'%s'",wand->name);
10249      return((MagickProgressMonitor) NULL);
10250    }
10251  previous_monitor=SetImageProgressMonitor(wand->images,
10252    progress_monitor,client_data);
10253  return(previous_monitor);
10254}
10255
10256/*
10257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10258%                                                                             %
10259%                                                                             %
10260%                                                                             %
10261%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10262%                                                                             %
10263%                                                                             %
10264%                                                                             %
10265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266%
10267%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10268%
10269%  The format of the MagickSetImageRedPrimary method is:
10270%
10271%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10272%        const double x,const double y)
10273%
10274%  A description of each parameter follows:
10275%
10276%    o wand: the magick wand.
10277%
10278%    o x: the red primary x-point.
10279%
10280%    o y: the red primary y-point.
10281%
10282*/
10283WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10284  const double x,const double y)
10285{
10286  assert(wand != (MagickWand *) NULL);
10287  assert(wand->signature == WandSignature);
10288  if( IfMagickTrue(wand->debug) )
10289    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10290
10291  if (wand->images == (Image *) NULL)
10292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10293  wand->images->chromaticity.red_primary.x=x;
10294  wand->images->chromaticity.red_primary.y=y;
10295  return(MagickTrue);
10296}
10297
10298/*
10299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10300%                                                                             %
10301%                                                                             %
10302%                                                                             %
10303%   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                 %
10304%                                                                             %
10305%                                                                             %
10306%                                                                             %
10307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10308%
10309%  MagickSetImageRenderingIntent() sets the image rendering intent.
10310%
10311%  The format of the MagickSetImageRenderingIntent method is:
10312%
10313%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10314%        const RenderingIntent rendering_intent)
10315%
10316%  A description of each parameter follows:
10317%
10318%    o wand: the magick wand.
10319%
10320%    o rendering_intent: the image rendering intent: UndefinedIntent,
10321%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10322%
10323*/
10324WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10325  const RenderingIntent rendering_intent)
10326{
10327  assert(wand != (MagickWand *) NULL);
10328  assert(wand->signature == WandSignature);
10329  if( IfMagickTrue(wand->debug) )
10330    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10331
10332  if (wand->images == (Image *) NULL)
10333    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10334  wand->images->rendering_intent=rendering_intent;
10335  return(MagickTrue);
10336}
10337
10338/*
10339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10340%                                                                             %
10341%                                                                             %
10342%                                                                             %
10343%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10344%                                                                             %
10345%                                                                             %
10346%                                                                             %
10347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10348%
10349%  MagickSetImageResolution() sets the image resolution.
10350%
10351%  The format of the MagickSetImageResolution method is:
10352%
10353%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10354%        const double x_resolution,const double y_resolution)
10355%
10356%  A description of each parameter follows:
10357%
10358%    o wand: the magick wand.
10359%
10360%    o x_resolution: the image x resolution.
10361%
10362%    o y_resolution: the image y resolution.
10363%
10364*/
10365WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10366  const double x_resolution,const double y_resolution)
10367{
10368  assert(wand != (MagickWand *) NULL);
10369  assert(wand->signature == WandSignature);
10370  if( IfMagickTrue(wand->debug) )
10371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10372
10373  if (wand->images == (Image *) NULL)
10374    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10375  wand->images->resolution.x=x_resolution;
10376  wand->images->resolution.y=y_resolution;
10377  return(MagickTrue);
10378}
10379
10380/*
10381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10382%                                                                             %
10383%                                                                             %
10384%                                                                             %
10385%   M a g i c k S e t I m a g e S c e n e                                     %
10386%                                                                             %
10387%                                                                             %
10388%                                                                             %
10389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10390%
10391%  MagickSetImageScene() sets the image scene.
10392%
10393%  The format of the MagickSetImageScene method is:
10394%
10395%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10396%        const size_t scene)
10397%
10398%  A description of each parameter follows:
10399%
10400%    o wand: the magick wand.
10401%
10402%    o delay: the image scene number.
10403%
10404*/
10405WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10406  const size_t scene)
10407{
10408  assert(wand != (MagickWand *) NULL);
10409  assert(wand->signature == WandSignature);
10410  if( IfMagickTrue(wand->debug) )
10411    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10412
10413  if (wand->images == (Image *) NULL)
10414    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10415  wand->images->scene=scene;
10416  return(MagickTrue);
10417}
10418
10419/*
10420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10421%                                                                             %
10422%                                                                             %
10423%                                                                             %
10424%   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                   %
10425%                                                                             %
10426%                                                                             %
10427%                                                                             %
10428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10429%
10430%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10431%
10432%  The format of the MagickSetImageTicksPerSecond method is:
10433%
10434%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10435%        const ssize_t ticks_per-second)
10436%
10437%  A description of each parameter follows:
10438%
10439%    o wand: the magick wand.
10440%
10441%    o ticks_per_second: the units to use for the image delay.
10442%
10443*/
10444WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10445  const ssize_t ticks_per_second)
10446{
10447  assert(wand != (MagickWand *) NULL);
10448  assert(wand->signature == WandSignature);
10449  if( IfMagickTrue(wand->debug) )
10450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10451
10452  if (wand->images == (Image *) NULL)
10453    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10454  wand->images->ticks_per_second=ticks_per_second;
10455  return(MagickTrue);
10456}
10457
10458/*
10459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10460%                                                                             %
10461%                                                                             %
10462%                                                                             %
10463%   M a g i c k S e t I m a g e T y p e                                       %
10464%                                                                             %
10465%                                                                             %
10466%                                                                             %
10467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10468%
10469%  MagickSetImageType() sets the image type.
10470%
10471%  The format of the MagickSetImageType method is:
10472%
10473%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10474%        const ImageType image_type)
10475%
10476%  A description of each parameter follows:
10477%
10478%    o wand: the magick wand.
10479%
10480%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10481%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10482%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10483%      or OptimizeType.
10484%
10485*/
10486WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10487  const ImageType image_type)
10488{
10489  assert(wand != (MagickWand *) NULL);
10490  assert(wand->signature == WandSignature);
10491  if( IfMagickTrue(wand->debug) )
10492    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10493
10494  if (wand->images == (Image *) NULL)
10495    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10496  return(SetImageType(wand->images,image_type,wand->exception));
10497}
10498
10499/*
10500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10501%                                                                             %
10502%                                                                             %
10503%                                                                             %
10504%   M a g i c k S e t I m a g e U n i t s                                     %
10505%                                                                             %
10506%                                                                             %
10507%                                                                             %
10508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10509%
10510%  MagickSetImageUnits() sets the image units of resolution.
10511%
10512%  The format of the MagickSetImageUnits method is:
10513%
10514%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10515%        const ResolutionType units)
10516%
10517%  A description of each parameter follows:
10518%
10519%    o wand: the magick wand.
10520%
10521%    o units: the image units of resolution : UndefinedResolution,
10522%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10523%
10524*/
10525WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10526  const ResolutionType units)
10527{
10528  assert(wand != (MagickWand *) NULL);
10529  assert(wand->signature == WandSignature);
10530  if( IfMagickTrue(wand->debug) )
10531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10532
10533  if (wand->images == (Image *) NULL)
10534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10535  wand->images->units=units;
10536  return(MagickTrue);
10537}
10538
10539/*
10540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10541%                                                                             %
10542%                                                                             %
10543%                                                                             %
10544%   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           %
10545%                                                                             %
10546%                                                                             %
10547%                                                                             %
10548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10549%
10550%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10551%
10552%  The format of the MagickSetImageVirtualPixelMethod method is:
10553%
10554%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10555%        const VirtualPixelMethod method)
10556%
10557%  A description of each parameter follows:
10558%
10559%    o wand: the magick wand.
10560%
10561%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10562%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10563%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10564%
10565*/
10566WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10567  const VirtualPixelMethod method)
10568{
10569  assert(wand != (MagickWand *) NULL);
10570  assert(wand->signature == WandSignature);
10571  if( IfMagickTrue(wand->debug) )
10572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10573
10574  if (wand->images == (Image *) NULL)
10575    return(UndefinedVirtualPixelMethod);
10576  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10577}
10578
10579/*
10580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10581%                                                                             %
10582%                                                                             %
10583%                                                                             %
10584%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10585%                                                                             %
10586%                                                                             %
10587%                                                                             %
10588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10589%
10590%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10591%
10592%  The format of the MagickSetImageWhitePoint method is:
10593%
10594%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10595%        const double x,const double y)
10596%
10597%  A description of each parameter follows:
10598%
10599%    o wand: the magick wand.
10600%
10601%    o x: the white x-point.
10602%
10603%    o y: the white y-point.
10604%
10605*/
10606WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10607  const double x,const double y)
10608{
10609  assert(wand != (MagickWand *) NULL);
10610  assert(wand->signature == WandSignature);
10611  if( IfMagickTrue(wand->debug) )
10612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10613
10614  if (wand->images == (Image *) NULL)
10615    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10616  wand->images->chromaticity.white_point.x=x;
10617  wand->images->chromaticity.white_point.y=y;
10618  return(MagickTrue);
10619}
10620
10621/*
10622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10623%                                                                             %
10624%                                                                             %
10625%                                                                             %
10626%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10627%                                                                             %
10628%                                                                             %
10629%                                                                             %
10630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10631%
10632%  MagickShadeImage() shines a distant light on an image to create a
10633%  three-dimensional effect. You control the positioning of the light with
10634%  azimuth and elevation; azimuth is measured in degrees off the x axis
10635%  and elevation is measured in pixels above the Z axis.
10636%
10637%  The format of the MagickShadeImage method is:
10638%
10639%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10640%        const MagickBooleanType gray,const double azimuth,
10641%        const double elevation)
10642%
10643%  A description of each parameter follows:
10644%
10645%    o wand: the magick wand.
10646%
10647%    o gray: A value other than zero shades the intensity of each pixel.
10648%
10649%    o azimuth, elevation:  Define the light source direction.
10650%
10651*/
10652WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10653  const MagickBooleanType gray,const double asimuth,const double elevation)
10654{
10655  Image
10656    *shade_image;
10657
10658  assert(wand != (MagickWand *) NULL);
10659  assert(wand->signature == WandSignature);
10660  if( IfMagickTrue(wand->debug) )
10661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10662
10663  if (wand->images == (Image *) NULL)
10664    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10665  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10666  if (shade_image == (Image *) NULL)
10667    return(MagickFalse);
10668  ReplaceImageInList(&wand->images,shade_image);
10669  return(MagickTrue);
10670}
10671
10672/*
10673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10674%                                                                             %
10675%                                                                             %
10676%                                                                             %
10677%   M a g i c k S h a d o w I m a g e                                         %
10678%                                                                             %
10679%                                                                             %
10680%                                                                             %
10681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10682%
10683%  MagickShadowImage() simulates an image shadow.
10684%
10685%  The format of the MagickShadowImage method is:
10686%
10687%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10688%        const double sigma,const ssize_t x,const ssize_t y)
10689%
10690%  A description of each parameter follows:
10691%
10692%    o wand: the magick wand.
10693%
10694%    o alpha: percentage transparency.
10695%
10696%    o sigma: the standard deviation of the Gaussian, in pixels.
10697%
10698%    o x: the shadow x-offset.
10699%
10700%    o y: the shadow y-offset.
10701%
10702*/
10703WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10704  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10705{
10706  Image
10707    *shadow_image;
10708
10709  assert(wand != (MagickWand *) NULL);
10710  assert(wand->signature == WandSignature);
10711  if( IfMagickTrue(wand->debug) )
10712    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10713
10714  if (wand->images == (Image *) NULL)
10715    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10716  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10717  if (shadow_image == (Image *) NULL)
10718    return(MagickFalse);
10719  ReplaceImageInList(&wand->images,shadow_image);
10720  return(MagickTrue);
10721}
10722
10723/*
10724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725%                                                                             %
10726%                                                                             %
10727%                                                                             %
10728%   M a g i c k S h a r p e n I m a g e                                       %
10729%                                                                             %
10730%                                                                             %
10731%                                                                             %
10732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733%
10734%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10735%  Gaussian operator of the given radius and standard deviation (sigma).
10736%  For reasonable results, the radius should be larger than sigma.  Use a
10737%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10738%
10739%  The format of the MagickSharpenImage method is:
10740%
10741%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10742%        const double radius,const double sigma)
10743%
10744%  A description of each parameter follows:
10745%
10746%    o wand: the magick wand.
10747%
10748%    o radius: the radius of the Gaussian, in pixels, not counting the center
10749%      pixel.
10750%
10751%    o sigma: the standard deviation of the Gaussian, in pixels.
10752%
10753*/
10754WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10755  const double radius,const double sigma)
10756{
10757  Image
10758    *sharp_image;
10759
10760  assert(wand != (MagickWand *) NULL);
10761  assert(wand->signature == WandSignature);
10762  if( IfMagickTrue(wand->debug) )
10763    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10764
10765  if (wand->images == (Image *) NULL)
10766    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10767  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10768  if (sharp_image == (Image *) NULL)
10769    return(MagickFalse);
10770  ReplaceImageInList(&wand->images,sharp_image);
10771  return(MagickTrue);
10772}
10773
10774/*
10775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10776%                                                                             %
10777%                                                                             %
10778%                                                                             %
10779%   M a g i c k S h a v e I m a g e                                           %
10780%                                                                             %
10781%                                                                             %
10782%                                                                             %
10783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10784%
10785%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10786%  memory necessary for the new Image structure and returns a pointer to the
10787%  new image.
10788%
10789%  The format of the MagickShaveImage method is:
10790%
10791%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10792%        const size_t columns,const size_t rows)
10793%
10794%  A description of each parameter follows:
10795%
10796%    o wand: the magick wand.
10797%
10798%    o columns: the number of columns in the scaled image.
10799%
10800%    o rows: the number of rows in the scaled image.
10801%
10802%
10803*/
10804WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10805  const size_t columns,const size_t rows)
10806{
10807  Image
10808    *shave_image;
10809
10810  RectangleInfo
10811    shave_info;
10812
10813  assert(wand != (MagickWand *) NULL);
10814  assert(wand->signature == WandSignature);
10815  if( IfMagickTrue(wand->debug) )
10816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10817
10818  if (wand->images == (Image *) NULL)
10819    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10820  shave_info.width=columns;
10821  shave_info.height=rows;
10822  shave_info.x=0;
10823  shave_info.y=0;
10824  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10825  if (shave_image == (Image *) NULL)
10826    return(MagickFalse);
10827  ReplaceImageInList(&wand->images,shave_image);
10828  return(MagickTrue);
10829}
10830
10831/*
10832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10833%                                                                             %
10834%                                                                             %
10835%                                                                             %
10836%   M a g i c k S h e a r I m a g e                                           %
10837%                                                                             %
10838%                                                                             %
10839%                                                                             %
10840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10841%
10842%  MagickShearImage() slides one edge of an image along the X or Y axis,
10843%  creating a parallelogram.  An X direction shear slides an edge along the X
10844%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10845%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10846%  is measured relative to the Y axis, and similarly, for Y direction shears
10847%  y_shear is measured relative to the X axis.  Empty triangles left over from
10848%  shearing the image are filled with the background color.
10849%
10850%  The format of the MagickShearImage method is:
10851%
10852%      MagickBooleanType MagickShearImage(MagickWand *wand,
10853%        const PixelWand *background,const double x_shear,const double y_shear)
10854%
10855%  A description of each parameter follows:
10856%
10857%    o wand: the magick wand.
10858%
10859%    o background: the background pixel wand.
10860%
10861%    o x_shear: the number of degrees to shear the image.
10862%
10863%    o y_shear: the number of degrees to shear the image.
10864%
10865*/
10866WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10867  const PixelWand *background,const double x_shear,const double y_shear)
10868{
10869  Image
10870    *shear_image;
10871
10872  assert(wand != (MagickWand *) NULL);
10873  assert(wand->signature == WandSignature);
10874  if( IfMagickTrue(wand->debug) )
10875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10876
10877  if (wand->images == (Image *) NULL)
10878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10879  PixelGetQuantumPacket(background,&wand->images->background_color);
10880  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10881  if (shear_image == (Image *) NULL)
10882    return(MagickFalse);
10883  ReplaceImageInList(&wand->images,shear_image);
10884  return(MagickTrue);
10885}
10886
10887/*
10888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889%                                                                             %
10890%                                                                             %
10891%                                                                             %
10892%   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                   %
10893%                                                                             %
10894%                                                                             %
10895%                                                                             %
10896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10897%
10898%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10899%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10900%  image using a sigmoidal transfer function without saturating highlights or
10901%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10902%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10903%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10904%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10905%  is reduced.
10906%
10907%  The format of the MagickSigmoidalContrastImage method is:
10908%
10909%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10910%        const MagickBooleanType sharpen,const double alpha,const double beta)
10911%
10912%  A description of each parameter follows:
10913%
10914%    o wand: the magick wand.
10915%
10916%    o sharpen: Increase or decrease image contrast.
10917%
10918%    o alpha: strength of the contrast, the larger the number the more
10919%      'threshold-like' it becomes.
10920%
10921%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10922%
10923*/
10924WandExport MagickBooleanType MagickSigmoidalContrastImage(
10925  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10926  const double beta)
10927{
10928  MagickBooleanType
10929    status;
10930
10931  assert(wand != (MagickWand *) NULL);
10932  assert(wand->signature == WandSignature);
10933  if( IfMagickTrue(wand->debug) )
10934    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10935
10936  if (wand->images == (Image *) NULL)
10937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10938  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10939    wand->exception);
10940  return(status);
10941}
10942
10943/*
10944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10945%                                                                             %
10946%                                                                             %
10947%                                                                             %
10948%   M a g i c k S i m i l a r i t y I m a g e                                 %
10949%                                                                             %
10950%                                                                             %
10951%                                                                             %
10952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10953%
10954%  MagickSimilarityImage() compares the reference image of the image and
10955%  returns the best match offset.  In addition, it returns a similarity image
10956%  such that an exact match location is completely white and if none of the
10957%  pixels match, black, otherwise some gray level in-between.
10958%
10959%  The format of the MagickSimilarityImage method is:
10960%
10961%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10962%        const MagickWand *reference,const MetricType metric,
10963%        RectangeInfo *offset,double *similarity)
10964%
10965%  A description of each parameter follows:
10966%
10967%    o wand: the magick wand.
10968%
10969%    o reference: the reference wand.
10970%
10971%    o metric: the metric.
10972%
10973%    o offset: the best match offset of the reference image within the image.
10974%
10975%    o similarity: the computed similarity between the images.
10976%
10977*/
10978WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10979  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10980  double *similarity)
10981{
10982  Image
10983    *similarity_image;
10984
10985  assert(wand != (MagickWand *) NULL);
10986  assert(wand->signature == WandSignature);
10987  if( IfMagickTrue(wand->debug) )
10988    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10989
10990  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10991    {
10992      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10993        "ContainsNoImages","'%s'",wand->name);
10994      return((MagickWand *) NULL);
10995    }
10996  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10997    similarity,wand->exception);
10998  if (similarity_image == (Image *) NULL)
10999    return((MagickWand *) NULL);
11000  return(CloneMagickWandFromImages(wand,similarity_image));
11001}
11002
11003/*
11004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11005%                                                                             %
11006%                                                                             %
11007%                                                                             %
11008%   M a g i c k S k e t c h I m a g e                                         %
11009%                                                                             %
11010%                                                                             %
11011%                                                                             %
11012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11013%
11014%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11015%  a Gaussian operator of the given radius and standard deviation (sigma).
11016%  For reasonable results, radius should be larger than sigma.  Use a
11017%  radius of 0 and SketchImage() selects a suitable radius for you.
11018%  Angle gives the angle of the blurring motion.
11019%
11020%  The format of the MagickSketchImage method is:
11021%
11022%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11023%        const double radius,const double sigma,const double angle)
11024%
11025%  A description of each parameter follows:
11026%
11027%    o wand: the magick wand.
11028%
11029%    o radius: the radius of the Gaussian, in pixels, not counting
11030%      the center pixel.
11031%
11032%    o sigma: the standard deviation of the Gaussian, in pixels.
11033%
11034%    o angle: apply the effect along this angle.
11035%
11036*/
11037WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11038  const double radius,const double sigma,const double angle)
11039{
11040  Image
11041    *sketch_image;
11042
11043  assert(wand != (MagickWand *) NULL);
11044  assert(wand->signature == WandSignature);
11045  if( IfMagickTrue(wand->debug) )
11046    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11047
11048  if (wand->images == (Image *) NULL)
11049    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11050  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11051  if (sketch_image == (Image *) NULL)
11052    return(MagickFalse);
11053  ReplaceImageInList(&wand->images,sketch_image);
11054  return(MagickTrue);
11055}
11056
11057/*
11058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11059%                                                                             %
11060%                                                                             %
11061%                                                                             %
11062%   M a g i c k S m u s h I m a g e s                                         %
11063%                                                                             %
11064%                                                                             %
11065%                                                                             %
11066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11067%
11068%  MagickSmushImages() takes all images from the current image pointer to the
11069%  end of the image list and smushs them to each other top-to-bottom if the
11070%  stack parameter is true, otherwise left-to-right.
11071%
11072%  The format of the MagickSmushImages method is:
11073%
11074%      MagickWand *MagickSmushImages(MagickWand *wand,
11075%        const MagickBooleanType stack,const ssize_t offset)
11076%
11077%  A description of each parameter follows:
11078%
11079%    o wand: the magick wand.
11080%
11081%    o stack: By default, images are stacked left-to-right. Set stack to
11082%      MagickTrue to stack them top-to-bottom.
11083%
11084%    o offset: minimum distance in pixels between images.
11085%
11086*/
11087WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11088  const MagickBooleanType stack,const ssize_t offset)
11089{
11090  Image
11091    *smush_image;
11092
11093  assert(wand != (MagickWand *) NULL);
11094  assert(wand->signature == WandSignature);
11095  if( IfMagickTrue(wand->debug) )
11096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11097
11098  if (wand->images == (Image *) NULL)
11099    return((MagickWand *) NULL);
11100  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11101  if (smush_image == (Image *) NULL)
11102    return((MagickWand *) NULL);
11103  return(CloneMagickWandFromImages(wand,smush_image));
11104}
11105
11106/*
11107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11108%                                                                             %
11109%                                                                             %
11110%                                                                             %
11111%     M a g i c k S o l a r i z e I m a g e                                   %
11112%                                                                             %
11113%                                                                             %
11114%                                                                             %
11115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11116%
11117%  MagickSolarizeImage() applies a special effect to the image, similar to the
11118%  effect achieved in a photo darkroom by selectively exposing areas of photo
11119%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11120%  measure of the extent of the solarization.
11121%
11122%  The format of the MagickSolarizeImage method is:
11123%
11124%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11125%        const double threshold)
11126%
11127%  A description of each parameter follows:
11128%
11129%    o wand: the magick wand.
11130%
11131%    o threshold:  Define the extent of the solarization.
11132%
11133*/
11134WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11135  const double threshold)
11136{
11137  MagickBooleanType
11138    status;
11139
11140  assert(wand != (MagickWand *) NULL);
11141  assert(wand->signature == WandSignature);
11142  if( IfMagickTrue(wand->debug) )
11143    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11144
11145  if (wand->images == (Image *) NULL)
11146    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11147  status=SolarizeImage(wand->images,threshold,wand->exception);
11148  return(status);
11149}
11150
11151/*
11152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11153%                                                                             %
11154%                                                                             %
11155%                                                                             %
11156%   M a g i c k S p a r s e C o l o r I m a g e                               %
11157%                                                                             %
11158%                                                                             %
11159%                                                                             %
11160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11161%
11162%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11163%  colors found at those coordinates, across the whole image, using various
11164%  methods.
11165%
11166%  The format of the MagickSparseColorImage method is:
11167%
11168%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11169%        const SparseColorMethod method,const size_t number_arguments,
11170%        const double *arguments)
11171%
11172%  A description of each parameter follows:
11173%
11174%    o image: the image to be sparseed.
11175%
11176%    o method: the method of image sparseion.
11177%
11178%        ArcSparseColorion will always ignore source image offset, and always
11179%        'bestfit' the destination image with the top left corner offset
11180%        relative to the polar mapping center.
11181%
11182%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11183%        style of image sparseion.
11184%
11185%        Affine, Perspective, and Bilinear, will do least squares fitting of
11186%        the distrotion when more than the minimum number of control point
11187%        pairs are provided.
11188%
11189%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11190%        less than 4 control point pairs are provided. While Affine sparseions
11191%        will let you use any number of control point pairs, that is Zero pairs
11192%        is a No-Op (viewport only) distrotion, one pair is a translation and
11193%        two pairs of control points will do a scale-rotate-translate, without
11194%        any shearing.
11195%
11196%    o number_arguments: the number of arguments given for this sparseion
11197%      method.
11198%
11199%    o arguments: the arguments for this sparseion method.
11200%
11201*/
11202WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11203  const SparseColorMethod method,const size_t number_arguments,
11204  const double *arguments)
11205{
11206  Image
11207    *sparse_image;
11208
11209  assert(wand != (MagickWand *) NULL);
11210  assert(wand->signature == WandSignature);
11211  if( IfMagickTrue(wand->debug) )
11212    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11213
11214  if (wand->images == (Image *) NULL)
11215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11216  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11217    wand->exception);
11218  if (sparse_image == (Image *) NULL)
11219    return(MagickFalse);
11220  ReplaceImageInList(&wand->images,sparse_image);
11221  return(MagickTrue);
11222}
11223
11224/*
11225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11226%                                                                             %
11227%                                                                             %
11228%                                                                             %
11229%   M a g i c k S p l i c e I m a g e                                         %
11230%                                                                             %
11231%                                                                             %
11232%                                                                             %
11233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11234%
11235%  MagickSpliceImage() splices a solid color into the image.
11236%
11237%  The format of the MagickSpliceImage method is:
11238%
11239%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11240%        const size_t width,const size_t height,const ssize_t x,
11241%        const ssize_t y)
11242%
11243%  A description of each parameter follows:
11244%
11245%    o wand: the magick wand.
11246%
11247%    o width: the region width.
11248%
11249%    o height: the region height.
11250%
11251%    o x: the region x offset.
11252%
11253%    o y: the region y offset.
11254%
11255*/
11256WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11257  const size_t width,const size_t height,const ssize_t x,
11258  const ssize_t y)
11259{
11260  Image
11261    *splice_image;
11262
11263  RectangleInfo
11264    splice;
11265
11266  assert(wand != (MagickWand *) NULL);
11267  assert(wand->signature == WandSignature);
11268  if( IfMagickTrue(wand->debug) )
11269    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11270
11271  if (wand->images == (Image *) NULL)
11272    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11273  splice.width=width;
11274  splice.height=height;
11275  splice.x=x;
11276  splice.y=y;
11277  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11278  if (splice_image == (Image *) NULL)
11279    return(MagickFalse);
11280  ReplaceImageInList(&wand->images,splice_image);
11281  return(MagickTrue);
11282}
11283
11284/*
11285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11286%                                                                             %
11287%                                                                             %
11288%                                                                             %
11289%   M a g i c k S p r e a d I m a g e                                         %
11290%                                                                             %
11291%                                                                             %
11292%                                                                             %
11293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11294%
11295%  MagickSpreadImage() is a special effects method that randomly displaces each
11296%  pixel in a block defined by the radius parameter.
11297%
11298%  The format of the MagickSpreadImage method is:
11299%
11300%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11301%        const PixelInterpolateMethod method)
11302%
11303%  A description of each parameter follows:
11304%
11305%    o wand: the magick wand.
11306%
11307%    o radius:  Choose a random pixel in a neighborhood of this extent.
11308%
11309%    o method: the pixel interpolation method.
11310%
11311*/
11312WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11313  const double radius,const PixelInterpolateMethod method)
11314{
11315  Image
11316    *spread_image;
11317
11318  assert(wand != (MagickWand *) NULL);
11319  assert(wand->signature == WandSignature);
11320  if( IfMagickTrue(wand->debug) )
11321    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11322
11323  if (wand->images == (Image *) NULL)
11324    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11325  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11326  if (spread_image == (Image *) NULL)
11327    return(MagickFalse);
11328  ReplaceImageInList(&wand->images,spread_image);
11329  return(MagickTrue);
11330}
11331
11332/*
11333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334%                                                                             %
11335%                                                                             %
11336%                                                                             %
11337%   M a g i c k S t a t i s t i c I m a g e                                   %
11338%                                                                             %
11339%                                                                             %
11340%                                                                             %
11341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11342%
11343%  MagickStatisticImage() replace each pixel with corresponding statistic from
11344%  the neighborhood of the specified width and height.
11345%
11346%  The format of the MagickStatisticImage method is:
11347%
11348%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11349%        const StatisticType type,const double width,const size_t height)
11350%
11351%  A description of each parameter follows:
11352%
11353%    o wand: the magick wand.
11354%
11355%    o type: the statistic type (e.g. median, mode, etc.).
11356%
11357%    o width: the width of the pixel neighborhood.
11358%
11359%    o height: the height of the pixel neighborhood.
11360%
11361*/
11362WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11363  const StatisticType type,const size_t width,const size_t height)
11364{
11365  Image
11366    *statistic_image;
11367
11368  assert(wand != (MagickWand *) NULL);
11369  assert(wand->signature == WandSignature);
11370  if( IfMagickTrue(wand->debug) )
11371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11372
11373  if (wand->images == (Image *) NULL)
11374    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11375  statistic_image=StatisticImage(wand->images,type,width,height,
11376    wand->exception);
11377  if (statistic_image == (Image *) NULL)
11378    return(MagickFalse);
11379  ReplaceImageInList(&wand->images,statistic_image);
11380  return(MagickTrue);
11381}
11382
11383/*
11384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11385%                                                                             %
11386%                                                                             %
11387%                                                                             %
11388%   M a g i c k S t e g a n o I m a g e                                       %
11389%                                                                             %
11390%                                                                             %
11391%                                                                             %
11392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11393%
11394%  MagickSteganoImage() hides a digital watermark within the image.
11395%  Recover the hidden watermark later to prove that the authenticity of
11396%  an image.  Offset defines the start position within the image to hide
11397%  the watermark.
11398%
11399%  The format of the MagickSteganoImage method is:
11400%
11401%      MagickWand *MagickSteganoImage(MagickWand *wand,
11402%        const MagickWand *watermark_wand,const ssize_t offset)
11403%
11404%  A description of each parameter follows:
11405%
11406%    o wand: the magick wand.
11407%
11408%    o watermark_wand: the watermark wand.
11409%
11410%    o offset: Start hiding at this offset into the image.
11411%
11412*/
11413WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11414  const MagickWand *watermark_wand,const ssize_t offset)
11415{
11416  Image
11417    *stegano_image;
11418
11419  assert(wand != (MagickWand *) NULL);
11420  assert(wand->signature == WandSignature);
11421  if( IfMagickTrue(wand->debug) )
11422    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11423
11424  if ((wand->images == (Image *) NULL) ||
11425      (watermark_wand->images == (Image *) NULL))
11426    {
11427      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11428        "ContainsNoImages","'%s'",wand->name);
11429      return((MagickWand *) NULL);
11430    }
11431  wand->images->offset=offset;
11432  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11433    wand->exception);
11434  if (stegano_image == (Image *) NULL)
11435    return((MagickWand *) NULL);
11436  return(CloneMagickWandFromImages(wand,stegano_image));
11437}
11438
11439/*
11440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11441%                                                                             %
11442%                                                                             %
11443%                                                                             %
11444%   M a g i c k S t e r e o I m a g e                                         %
11445%                                                                             %
11446%                                                                             %
11447%                                                                             %
11448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11449%
11450%  MagickStereoImage() composites two images and produces a single image that
11451%  is the composite of a left and right image of a stereo pair
11452%
11453%  The format of the MagickStereoImage method is:
11454%
11455%      MagickWand *MagickStereoImage(MagickWand *wand,
11456%        const MagickWand *offset_wand)
11457%
11458%  A description of each parameter follows:
11459%
11460%    o wand: the magick wand.
11461%
11462%    o offset_wand: Another image wand.
11463%
11464*/
11465WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11466  const MagickWand *offset_wand)
11467{
11468  Image
11469    *stereo_image;
11470
11471  assert(wand != (MagickWand *) NULL);
11472  assert(wand->signature == WandSignature);
11473  if( IfMagickTrue(wand->debug) )
11474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11475
11476  if ((wand->images == (Image *) NULL) ||
11477      (offset_wand->images == (Image *) NULL))
11478    {
11479      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11480        "ContainsNoImages","'%s'",wand->name);
11481      return((MagickWand *) NULL);
11482    }
11483  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11484  if (stereo_image == (Image *) NULL)
11485    return((MagickWand *) NULL);
11486  return(CloneMagickWandFromImages(wand,stereo_image));
11487}
11488
11489/*
11490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11491%                                                                             %
11492%                                                                             %
11493%                                                                             %
11494%   M a g i c k S t r i p I m a g e                                           %
11495%                                                                             %
11496%                                                                             %
11497%                                                                             %
11498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11499%
11500%  MagickStripImage() strips an image of all profiles and comments.
11501%
11502%  The format of the MagickStripImage method is:
11503%
11504%      MagickBooleanType MagickStripImage(MagickWand *wand)
11505%
11506%  A description of each parameter follows:
11507%
11508%    o wand: the magick wand.
11509%
11510*/
11511WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11512{
11513  assert(wand != (MagickWand *) NULL);
11514  assert(wand->signature == WandSignature);
11515  if( IfMagickTrue(wand->debug) )
11516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11517
11518  if (wand->images == (Image *) NULL)
11519    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11520  return(StripImage(wand->images,wand->exception));
11521}
11522
11523/*
11524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11525%                                                                             %
11526%                                                                             %
11527%                                                                             %
11528%   M a g i c k S w i r l I m a g e                                           %
11529%                                                                             %
11530%                                                                             %
11531%                                                                             %
11532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11533%
11534%  MagickSwirlImage() swirls the pixels about the center of the image, where
11535%  degrees indicates the sweep of the arc through which each pixel is moved.
11536%  You get a more dramatic effect as the degrees move from 1 to 360.
11537%
11538%  The format of the MagickSwirlImage method is:
11539%
11540%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11541%        const PixelInterpolateMethod method)
11542%
11543%  A description of each parameter follows:
11544%
11545%    o wand: the magick wand.
11546%
11547%    o degrees: Define the tightness of the swirling effect.
11548%
11549%    o method: the pixel interpolation method.
11550%
11551*/
11552WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11553  const double degrees,const PixelInterpolateMethod method)
11554{
11555  Image
11556    *swirl_image;
11557
11558  assert(wand != (MagickWand *) NULL);
11559  assert(wand->signature == WandSignature);
11560  if( IfMagickTrue(wand->debug) )
11561    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11562
11563  if (wand->images == (Image *) NULL)
11564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11565  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11566  if (swirl_image == (Image *) NULL)
11567    return(MagickFalse);
11568  ReplaceImageInList(&wand->images,swirl_image);
11569  return(MagickTrue);
11570}
11571
11572/*
11573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11574%                                                                             %
11575%                                                                             %
11576%                                                                             %
11577%   M a g i c k T e x t u r e I m a g e                                       %
11578%                                                                             %
11579%                                                                             %
11580%                                                                             %
11581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11582%
11583%  MagickTextureImage() repeatedly tiles the texture image across and down the
11584%  image canvas.
11585%
11586%  The format of the MagickTextureImage method is:
11587%
11588%      MagickWand *MagickTextureImage(MagickWand *wand,
11589%        const MagickWand *texture_wand)
11590%
11591%  A description of each parameter follows:
11592%
11593%    o wand: the magick wand.
11594%
11595%    o texture_wand: the texture wand
11596%
11597*/
11598WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11599  const MagickWand *texture_wand)
11600{
11601  Image
11602    *texture_image;
11603
11604  MagickBooleanType
11605    status;
11606
11607  assert(wand != (MagickWand *) NULL);
11608  assert(wand->signature == WandSignature);
11609  if( IfMagickTrue(wand->debug) )
11610    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11611
11612  if ((wand->images == (Image *) NULL) ||
11613      (texture_wand->images == (Image *) NULL))
11614    {
11615      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11616        "ContainsNoImages","'%s'",wand->name);
11617      return((MagickWand *) NULL);
11618    }
11619  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11620  if (texture_image == (Image *) NULL)
11621    return((MagickWand *) NULL);
11622  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11623  if( IfMagickFalse(status) )
11624    {
11625      texture_image=DestroyImage(texture_image);
11626      return((MagickWand *) NULL);
11627    }
11628  return(CloneMagickWandFromImages(wand,texture_image));
11629}
11630
11631/*
11632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11633%                                                                             %
11634%                                                                             %
11635%                                                                             %
11636%   M a g i c k T h r e s h o l d I m a g e                                   %
11637%                                                                             %
11638%                                                                             %
11639%                                                                             %
11640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11641%
11642%  MagickThresholdImage() changes the value of individual pixels based on
11643%  the intensity of each pixel compared to threshold.  The result is a
11644%  high-contrast, two color image.
11645%
11646%  The format of the MagickThresholdImage method is:
11647%
11648%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11649%        const double threshold)
11650%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11651%        const ChannelType channel,const double threshold)
11652%
11653%  A description of each parameter follows:
11654%
11655%    o wand: the magick wand.
11656%
11657%    o channel: the image channel(s).
11658%
11659%    o threshold: Define the threshold value.
11660%
11661*/
11662WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11663  const double threshold)
11664{
11665  MagickBooleanType
11666    status;
11667
11668  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11669  return(status);
11670}
11671
11672WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11673  const ChannelType channel,const double threshold)
11674{
11675  MagickBooleanType
11676    status;
11677
11678  assert(wand != (MagickWand *) NULL);
11679  assert(wand->signature == WandSignature);
11680  if( IfMagickTrue(wand->debug) )
11681    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11682
11683  if (wand->images == (Image *) NULL)
11684    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11685  status=BilevelImage(wand->images,threshold,wand->exception);
11686  return(status);
11687}
11688
11689/*
11690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11691%                                                                             %
11692%                                                                             %
11693%                                                                             %
11694%   M a g i c k T h u m b n a i l I m a g e                                   %
11695%                                                                             %
11696%                                                                             %
11697%                                                                             %
11698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11699%
11700%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11701%  and removes any associated profiles.  The goal is to produce small low cost
11702%  thumbnail images suited for display on the Web.
11703%
11704%  The format of the MagickThumbnailImage method is:
11705%
11706%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11707%        const size_t columns,const size_t rows)
11708%
11709%  A description of each parameter follows:
11710%
11711%    o wand: the magick wand.
11712%
11713%    o columns: the number of columns in the scaled image.
11714%
11715%    o rows: the number of rows in the scaled image.
11716%
11717*/
11718WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11719  const size_t columns,const size_t rows)
11720{
11721  Image
11722    *thumbnail_image;
11723
11724  assert(wand != (MagickWand *) NULL);
11725  assert(wand->signature == WandSignature);
11726  if( IfMagickTrue(wand->debug) )
11727    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11728
11729  if (wand->images == (Image *) NULL)
11730    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11731  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11732  if (thumbnail_image == (Image *) NULL)
11733    return(MagickFalse);
11734  ReplaceImageInList(&wand->images,thumbnail_image);
11735  return(MagickTrue);
11736}
11737
11738/*
11739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11740%                                                                             %
11741%                                                                             %
11742%                                                                             %
11743%   M a g i c k T i n t I m a g e                                             %
11744%                                                                             %
11745%                                                                             %
11746%                                                                             %
11747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11748%
11749%  MagickTintImage() applies a color vector to each pixel in the image.  The
11750%  length of the vector is 0 for black and white and at its maximum for the
11751%  midtones.  The vector weighting function is
11752%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11753%
11754%  The format of the MagickTintImage method is:
11755%
11756%      MagickBooleanType MagickTintImage(MagickWand *wand,
11757%        const PixelWand *tint,const PixelWand *blend)
11758%
11759%  A description of each parameter follows:
11760%
11761%    o wand: the magick wand.
11762%
11763%    o tint: the tint pixel wand.
11764%
11765%    o alpha: the alpha pixel wand.
11766%
11767*/
11768WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11769  const PixelWand *tint,const PixelWand *blend)
11770{
11771  char
11772    percent_blend[MaxTextExtent];
11773
11774  Image
11775    *tint_image;
11776
11777  PixelInfo
11778    target;
11779
11780  assert(wand != (MagickWand *) NULL);
11781  assert(wand->signature == WandSignature);
11782  if( IfMagickTrue(wand->debug) )
11783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11784
11785  if (wand->images == (Image *) NULL)
11786    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11787  if (wand->images->colorspace != CMYKColorspace)
11788    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11789      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11790      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11791      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11792      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11793      PixelGetAlphaQuantum(blend)));
11794  else
11795    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11796      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11797      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11798      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11799      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11800      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11801      PixelGetAlphaQuantum(blend)));
11802  target=PixelGetPixel(tint);
11803  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11804  if (tint_image == (Image *) NULL)
11805    return(MagickFalse);
11806  ReplaceImageInList(&wand->images,tint_image);
11807  return(MagickTrue);
11808}
11809
11810/*
11811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11812%                                                                             %
11813%                                                                             %
11814%                                                                             %
11815%   M a g i c k T r a n s f o r m I m a g e                                   %
11816%                                                                             %
11817%                                                                             %
11818%                                                                             %
11819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11820%
11821%  MagickTransformImage() is a convenience method that behaves like
11822%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11823%  information as a region geometry specification.  If the operation fails,
11824%  a NULL image handle is returned.
11825%
11826%  The format of the MagickTransformImage method is:
11827%
11828%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11829%        const char *geometry)
11830%
11831%  A description of each parameter follows:
11832%
11833%    o wand: the magick wand.
11834%
11835%    o crop: A crop geometry string.  This geometry defines a subregion of the
11836%      image to crop.
11837%
11838%    o geometry: An image geometry string.  This geometry defines the final
11839%      size of the image.
11840%
11841*/
11842WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11843  const char *crop,const char *geometry)
11844{
11845  Image
11846    *transform_image;
11847
11848  MagickBooleanType
11849    status;
11850
11851  assert(wand != (MagickWand *) NULL);
11852  assert(wand->signature == WandSignature);
11853  if( IfMagickTrue(wand->debug) )
11854    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11855
11856
11857  if (wand->images == (Image *) NULL)
11858    return((MagickWand *) NULL);
11859  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11860  if (transform_image == (Image *) NULL)
11861    return((MagickWand *) NULL);
11862  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11863  if( IfMagickFalse(status) )
11864    {
11865      transform_image=DestroyImage(transform_image);
11866      return((MagickWand *) NULL);
11867    }
11868  return(CloneMagickWandFromImages(wand,transform_image));
11869}
11870
11871/*
11872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11873%                                                                             %
11874%                                                                             %
11875%                                                                             %
11876%   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               %
11877%                                                                             %
11878%                                                                             %
11879%                                                                             %
11880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11881%
11882%  MagickTransformImageColorspace() transform the image colorspace, setting
11883%  the images colorspace while transforming the images data to that
11884%  colorspace.
11885%
11886%  The format of the MagickTransformImageColorspace method is:
11887%
11888%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11889%        const ColorspaceType colorspace)
11890%
11891%  A description of each parameter follows:
11892%
11893%    o wand: the magick wand.
11894%
11895%    o colorspace: the image colorspace:   UndefinedColorspace,
11896%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11897%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11898%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11899%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11900%      HSLColorspace, HWBColorspace.
11901%
11902*/
11903WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11904  const ColorspaceType colorspace)
11905{
11906  assert(wand != (MagickWand *) NULL);
11907  assert(wand->signature == WandSignature);
11908  if( IfMagickTrue(wand->debug) )
11909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11910
11911
11912  if (wand->images == (Image *) NULL)
11913    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11914  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11915}
11916
11917/*
11918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11919%                                                                             %
11920%                                                                             %
11921%                                                                             %
11922%   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                     %
11923%                                                                             %
11924%                                                                             %
11925%                                                                             %
11926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11927%
11928%  MagickTransparentPaintImage() changes any pixel that matches color with the
11929%  color defined by fill.
11930%
11931%  The format of the MagickTransparentPaintImage method is:
11932%
11933%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11934%        const PixelWand *target,const double alpha,const double fuzz,
11935%        const MagickBooleanType invert)
11936%
11937%  A description of each parameter follows:
11938%
11939%    o wand: the magick wand.
11940%
11941%    o target: Change this target color to specified alpha value within
11942%      the image.
11943%
11944%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11945%      transparent.
11946%
11947%    o fuzz: By default target must match a particular pixel color
11948%      exactly.  However, in many cases two colors may differ by a small amount.
11949%      The fuzz member of image defines how much tolerance is acceptable to
11950%      consider two colors as the same.  For example, set fuzz to 10 and the
11951%      color red at intensities of 100 and 102 respectively are now interpreted
11952%      as the same color for the purposes of the floodfill.
11953%
11954%    o invert: paint any pixel that does not match the target color.
11955%
11956*/
11957WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11958  const PixelWand *target,const double alpha,const double fuzz,
11959  const MagickBooleanType invert)
11960{
11961  MagickBooleanType
11962    status;
11963
11964  PixelInfo
11965    target_pixel;
11966
11967  assert(wand != (MagickWand *) NULL);
11968  assert(wand->signature == WandSignature);
11969  if( IfMagickTrue(wand->debug) )
11970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11971
11972
11973  if (wand->images == (Image *) NULL)
11974    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11975  PixelGetMagickColor(target,&target_pixel);
11976  wand->images->fuzz=fuzz;
11977  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11978    QuantumRange*alpha),invert,wand->exception);
11979  return(status);
11980}
11981
11982/*
11983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11984%                                                                             %
11985%                                                                             %
11986%                                                                             %
11987%   M a g i c k T r a n s p o s e I m a g e                                   %
11988%                                                                             %
11989%                                                                             %
11990%                                                                             %
11991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11992%
11993%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11994%  pixels around the central x-axis while rotating them 90-degrees.
11995%
11996%  The format of the MagickTransposeImage method is:
11997%
11998%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11999%
12000%  A description of each parameter follows:
12001%
12002%    o wand: the magick wand.
12003%
12004*/
12005WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12006{
12007  Image
12008    *transpose_image;
12009
12010  assert(wand != (MagickWand *) NULL);
12011  assert(wand->signature == WandSignature);
12012  if( IfMagickTrue(wand->debug) )
12013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12014
12015  if (wand->images == (Image *) NULL)
12016    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12017  transpose_image=TransposeImage(wand->images,wand->exception);
12018  if (transpose_image == (Image *) NULL)
12019    return(MagickFalse);
12020  ReplaceImageInList(&wand->images,transpose_image);
12021  return(MagickTrue);
12022}
12023
12024/*
12025%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12026%                                                                             %
12027%                                                                             %
12028%                                                                             %
12029%   M a g i c k T r a n s v e r s e I m a g e                                 %
12030%                                                                             %
12031%                                                                             %
12032%                                                                             %
12033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12034%
12035%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12036%  pixels around the central y-axis while rotating them 270-degrees.
12037%
12038%  The format of the MagickTransverseImage method is:
12039%
12040%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12041%
12042%  A description of each parameter follows:
12043%
12044%    o wand: the magick wand.
12045%
12046*/
12047WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12048{
12049  Image
12050    *transverse_image;
12051
12052  assert(wand != (MagickWand *) NULL);
12053  assert(wand->signature == WandSignature);
12054  if( IfMagickTrue(wand->debug) )
12055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12056
12057  if (wand->images == (Image *) NULL)
12058    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12059  transverse_image=TransverseImage(wand->images,wand->exception);
12060  if (transverse_image == (Image *) NULL)
12061    return(MagickFalse);
12062  ReplaceImageInList(&wand->images,transverse_image);
12063  return(MagickTrue);
12064}
12065
12066/*
12067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12068%                                                                             %
12069%                                                                             %
12070%                                                                             %
12071%   M a g i c k T r i m I m a g e                                             %
12072%                                                                             %
12073%                                                                             %
12074%                                                                             %
12075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12076%
12077%  MagickTrimImage() remove edges that are the background color from the image.
12078%
12079%  The format of the MagickTrimImage method is:
12080%
12081%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12082%
12083%  A description of each parameter follows:
12084%
12085%    o wand: the magick wand.
12086%
12087%    o fuzz: By default target must match a particular pixel color
12088%      exactly.  However, in many cases two colors may differ by a small amount.
12089%      The fuzz member of image defines how much tolerance is acceptable to
12090%      consider two colors as the same.  For example, set fuzz to 10 and the
12091%      color red at intensities of 100 and 102 respectively are now interpreted
12092%      as the same color for the purposes of the floodfill.
12093%
12094*/
12095WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12096{
12097  Image
12098    *trim_image;
12099
12100  assert(wand != (MagickWand *) NULL);
12101  assert(wand->signature == WandSignature);
12102  if( IfMagickTrue(wand->debug) )
12103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12104
12105  if (wand->images == (Image *) NULL)
12106    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12107  wand->images->fuzz=fuzz;
12108  trim_image=TrimImage(wand->images,wand->exception);
12109  if (trim_image == (Image *) NULL)
12110    return(MagickFalse);
12111  ReplaceImageInList(&wand->images,trim_image);
12112  return(MagickTrue);
12113}
12114
12115/*
12116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12117%                                                                             %
12118%                                                                             %
12119%                                                                             %
12120%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12121%                                                                             %
12122%                                                                             %
12123%                                                                             %
12124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12125%
12126%  MagickUniqueImageColors() discards all but one of any pixel color.
12127%
12128%  The format of the MagickUniqueImageColors method is:
12129%
12130%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12131%
12132%  A description of each parameter follows:
12133%
12134%    o wand: the magick wand.
12135%
12136*/
12137WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12138{
12139  Image
12140    *unique_image;
12141
12142  assert(wand != (MagickWand *) NULL);
12143  assert(wand->signature == WandSignature);
12144  if( IfMagickTrue(wand->debug) )
12145    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12146
12147  if (wand->images == (Image *) NULL)
12148    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12149  unique_image=UniqueImageColors(wand->images,wand->exception);
12150  if (unique_image == (Image *) NULL)
12151    return(MagickFalse);
12152  ReplaceImageInList(&wand->images,unique_image);
12153  return(MagickTrue);
12154}
12155
12156/*
12157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12158%                                                                             %
12159%                                                                             %
12160%                                                                             %
12161%   M a g i c k U n s h a r p M a s k I m a g e                               %
12162%                                                                             %
12163%                                                                             %
12164%                                                                             %
12165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12166%
12167%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12168%  Gaussian operator of the given radius and standard deviation (sigma).
12169%  For reasonable results, radius should be larger than sigma.  Use a radius
12170%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12171%
12172%  The format of the MagickUnsharpMaskImage method is:
12173%
12174%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12175%        const double radius,const double sigma,const double amount,
12176%        const double threshold)
12177%
12178%  A description of each parameter follows:
12179%
12180%    o wand: the magick wand.
12181%
12182%    o radius: the radius of the Gaussian, in pixels, not counting the center
12183%      pixel.
12184%
12185%    o sigma: the standard deviation of the Gaussian, in pixels.
12186%
12187%    o amount: the percentage of the difference between the original and the
12188%      blur image that is added back into the original.
12189%
12190%    o threshold: the threshold in pixels needed to apply the diffence amount.
12191%
12192*/
12193WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12194  const double radius,const double sigma,const double amount,
12195  const double threshold)
12196{
12197  Image
12198    *unsharp_image;
12199
12200  assert(wand != (MagickWand *) NULL);
12201  assert(wand->signature == WandSignature);
12202  if( IfMagickTrue(wand->debug) )
12203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12204
12205  if (wand->images == (Image *) NULL)
12206    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12207  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
12208    wand->exception);
12209  if (unsharp_image == (Image *) NULL)
12210    return(MagickFalse);
12211  ReplaceImageInList(&wand->images,unsharp_image);
12212  return(MagickTrue);
12213}
12214
12215/*
12216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12217%                                                                             %
12218%                                                                             %
12219%                                                                             %
12220%   M a g i c k V i g n e t t e I m a g e                                     %
12221%                                                                             %
12222%                                                                             %
12223%                                                                             %
12224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12225%
12226%  MagickVignetteImage() softens the edges of the image in vignette style.
12227%
12228%  The format of the MagickVignetteImage method is:
12229%
12230%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12231%        const double radius,const double sigma,const ssize_t x,
12232%        const ssize_t y)
12233%
12234%  A description of each parameter follows:
12235%
12236%    o wand: the magick wand.
12237%
12238%    o radius: the radius.
12239%
12240%    o sigma: the sigma.
12241%
12242%    o x, y:  Define the x and y ellipse offset.
12243%
12244*/
12245WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12246  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12247{
12248  Image
12249    *vignette_image;
12250
12251  assert(wand != (MagickWand *) NULL);
12252  assert(wand->signature == WandSignature);
12253  if( IfMagickTrue(wand->debug) )
12254    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12255
12256  if (wand->images == (Image *) NULL)
12257    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12258  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12259  if (vignette_image == (Image *) NULL)
12260    return(MagickFalse);
12261  ReplaceImageInList(&wand->images,vignette_image);
12262  return(MagickTrue);
12263}
12264
12265/*
12266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12267%                                                                             %
12268%                                                                             %
12269%                                                                             %
12270%   M a g i c k W a v e I m a g e                                             %
12271%                                                                             %
12272%                                                                             %
12273%                                                                             %
12274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12275%
12276%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12277%  the pixels vertically along a sine wave whose amplitude and wavelength
12278%  is specified by the given parameters.
12279%
12280%  The format of the MagickWaveImage method is:
12281%
12282%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12283%        const double amplitude,const double wave_length,
12284%        const PixelInterpolateMethod method)
12285%
12286%  A description of each parameter follows:
12287%
12288%    o wand: the magick wand.
12289%
12290%    o amplitude, wave_length:  Define the amplitude and wave length of the
12291%      sine wave.
12292%
12293%    o method: the pixel interpolation method.
12294%
12295*/
12296WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12297  const double amplitude,const double wave_length,
12298  const PixelInterpolateMethod method)
12299{
12300  Image
12301    *wave_image;
12302
12303  assert(wand != (MagickWand *) NULL);
12304  assert(wand->signature == WandSignature);
12305  if( IfMagickTrue(wand->debug) )
12306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12307
12308  if (wand->images == (Image *) NULL)
12309    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12310  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12311    wand->exception);
12312  if (wave_image == (Image *) NULL)
12313    return(MagickFalse);
12314  ReplaceImageInList(&wand->images,wave_image);
12315  return(MagickTrue);
12316}
12317
12318/*
12319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12320%                                                                             %
12321%                                                                             %
12322%                                                                             %
12323%   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                         %
12324%                                                                             %
12325%                                                                             %
12326%                                                                             %
12327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12328%
12329%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12330%  above the threshold into white while leaving all pixels below the threshold
12331%  unchanged.
12332%
12333%  The format of the MagickWhiteThresholdImage method is:
12334%
12335%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12336%        const PixelWand *threshold)
12337%
12338%  A description of each parameter follows:
12339%
12340%    o wand: the magick wand.
12341%
12342%    o threshold: the pixel wand.
12343%
12344*/
12345WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12346  const PixelWand *threshold)
12347{
12348  char
12349    thresholds[MaxTextExtent];
12350
12351  assert(wand != (MagickWand *) NULL);
12352  assert(wand->signature == WandSignature);
12353  if( IfMagickTrue(wand->debug) )
12354    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12355
12356  if (wand->images == (Image *) NULL)
12357    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12358  (void) FormatLocaleString(thresholds,MaxTextExtent,
12359    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12360    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12361    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12362  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12363}
12364
12365/*
12366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12367%                                                                             %
12368%                                                                             %
12369%                                                                             %
12370%   M a g i c k W r i t e I m a g e                                           %
12371%                                                                             %
12372%                                                                             %
12373%                                                                             %
12374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12375%
12376%  MagickWriteImage() writes an image to the specified filename.  If the
12377%  filename parameter is NULL, the image is written to the filename set
12378%  by MagickReadImage() or MagickSetImageFilename().
12379%
12380%  The format of the MagickWriteImage method is:
12381%
12382%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12383%        const char *filename)
12384%
12385%  A description of each parameter follows:
12386%
12387%    o wand: the magick wand.
12388%
12389%    o filename: the image filename.
12390%
12391%
12392*/
12393WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12394  const char *filename)
12395{
12396  Image
12397    *image;
12398
12399  ImageInfo
12400    *write_info;
12401
12402  MagickBooleanType
12403    status;
12404
12405  assert(wand != (MagickWand *) NULL);
12406  assert(wand->signature == WandSignature);
12407  if( IfMagickTrue(wand->debug) )
12408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12409
12410  if (wand->images == (Image *) NULL)
12411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12412  if (filename != (const char *) NULL)
12413    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12414  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12415  if (image == (Image *) NULL)
12416    return(MagickFalse);
12417  write_info=CloneImageInfo(wand->image_info);
12418  write_info->adjoin=MagickTrue;
12419  status=WriteImage(write_info,image,wand->exception);
12420  image=DestroyImage(image);
12421  write_info=DestroyImageInfo(write_info);
12422  return(status);
12423}
12424
12425/*
12426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12427%                                                                             %
12428%                                                                             %
12429%                                                                             %
12430%   M a g i c k W r i t e I m a g e F i l e                                   %
12431%                                                                             %
12432%                                                                             %
12433%                                                                             %
12434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12435%
12436%  MagickWriteImageFile() writes an image to an open file descriptor.
12437%
12438%  The format of the MagickWriteImageFile method is:
12439%
12440%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12441%
12442%  A description of each parameter follows:
12443%
12444%    o wand: the magick wand.
12445%
12446%    o file: the file descriptor.
12447%
12448*/
12449WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12450{
12451  Image
12452    *image;
12453
12454  ImageInfo
12455    *write_info;
12456
12457  MagickBooleanType
12458    status;
12459
12460  assert(wand != (MagickWand *) NULL);
12461  assert(wand->signature == WandSignature);
12462  assert(file != (FILE *) NULL);
12463  if( IfMagickTrue(wand->debug) )
12464    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12465
12466  if (wand->images == (Image *) NULL)
12467    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12468  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12469  if (image == (Image *) NULL)
12470    return(MagickFalse);
12471  write_info=CloneImageInfo(wand->image_info);
12472  SetImageInfoFile(write_info,file);
12473  write_info->adjoin=MagickTrue;
12474  status=WriteImage(write_info,image,wand->exception);
12475  write_info=DestroyImageInfo(write_info);
12476  image=DestroyImage(image);
12477  return(status);
12478}
12479
12480/*
12481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12482%                                                                             %
12483%                                                                             %
12484%                                                                             %
12485%   M a g i c k W r i t e I m a g e s                                         %
12486%                                                                             %
12487%                                                                             %
12488%                                                                             %
12489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12490%
12491%  MagickWriteImages() writes an image or image sequence.
12492%
12493%  The format of the MagickWriteImages method is:
12494%
12495%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12496%        const char *filename,const MagickBooleanType adjoin)
12497%
12498%  A description of each parameter follows:
12499%
12500%    o wand: the magick wand.
12501%
12502%    o filename: the image filename.
12503%
12504%    o adjoin: join images into a single multi-image file.
12505%
12506*/
12507WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12508  const char *filename,const MagickBooleanType adjoin)
12509{
12510  ImageInfo
12511    *write_info;
12512
12513  MagickBooleanType
12514    status;
12515
12516  assert(wand != (MagickWand *) NULL);
12517  assert(wand->signature == WandSignature);
12518  if( IfMagickTrue(wand->debug) )
12519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12520
12521  if (wand->images == (Image *) NULL)
12522    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12523  write_info=CloneImageInfo(wand->image_info);
12524  write_info->adjoin=adjoin;
12525  status=WriteImages(write_info,wand->images,filename,wand->exception);
12526  write_info=DestroyImageInfo(write_info);
12527  return(status);
12528}
12529
12530/*
12531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12532%                                                                             %
12533%                                                                             %
12534%                                                                             %
12535%   M a g i c k W r i t e I m a g e s F i l e                                 %
12536%                                                                             %
12537%                                                                             %
12538%                                                                             %
12539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12540%
12541%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12542%
12543%  The format of the MagickWriteImagesFile method is:
12544%
12545%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12546%
12547%  A description of each parameter follows:
12548%
12549%    o wand: the magick wand.
12550%
12551%    o file: the file descriptor.
12552%
12553*/
12554WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12555{
12556  ImageInfo
12557    *write_info;
12558
12559  MagickBooleanType
12560    status;
12561
12562  assert(wand != (MagickWand *) NULL);
12563  assert(wand->signature == WandSignature);
12564  if( IfMagickTrue(wand->debug) )
12565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12566
12567  if (wand->images == (Image *) NULL)
12568    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12569  write_info=CloneImageInfo(wand->image_info);
12570  SetImageInfoFile(write_info,file);
12571  write_info->adjoin=MagickTrue;
12572  status=WriteImages(write_info,wand->images,(const char *) NULL,
12573    wand->exception);
12574  write_info=DestroyImageInfo(write_info);
12575  return(status);
12576}
12577