magick-image.c revision efe601ce9ea5ad34ad0e8ad6e61d9be9b148b2a3
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-2013 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  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103  if (clone_wand == (MagickWand *) NULL)
104    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105      images->filename);
106  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107  clone_wand->id=AcquireWandId();
108  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109    MagickWandId,(double) clone_wand->id);
110  clone_wand->exception=AcquireExceptionInfo();
111  InheritException(clone_wand->exception,wand->exception);
112  clone_wand->image_info=CloneImageInfo(wand->image_info);
113  clone_wand->images=images;
114  clone_wand->debug=IsEventLogging();
115  clone_wand->signature=WandSignature;
116  if (IfMagickTrue(clone_wand->debug))
117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118  return(clone_wand);
119}
120
121/*
122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123%                                                                             %
124%                                                                             %
125%                                                                             %
126%   G e t I m a g e F r o m M a g i c k W a n d                               %
127%                                                                             %
128%                                                                             %
129%                                                                             %
130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131%
132%  GetImageFromMagickWand() returns the current image from the magick wand.
133%
134%  The format of the GetImageFromMagickWand method is:
135%
136%      Image *GetImageFromMagickWand(const MagickWand *wand)
137%
138%  A description of each parameter follows:
139%
140%    o wand: the magick wand.
141%
142*/
143WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
144{
145  assert(wand != (MagickWand *) NULL);
146  assert(wand->signature == WandSignature);
147  if (IfMagickTrue(wand->debug))
148    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
149  if (wand->images == (Image *) NULL)
150    {
151      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
152        "ContainsNoImages","`%s'",wand->name);
153      return((Image *) NULL);
154    }
155  return(wand->images);
156}
157
158/*
159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160%                                                                             %
161%                                                                             %
162%                                                                             %
163%   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                       %
164%                                                                             %
165%                                                                             %
166%                                                                             %
167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168%
169%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
170%  less intensely near image edges and more intensely far from edges. We
171%  blur the image with a Gaussian operator of the given radius and standard
172%  deviation (sigma).  For reasonable results, radius should be larger than
173%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
174%  suitable radius for you.
175%
176%  The format of the MagickAdaptiveBlurImage method is:
177%
178%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
179%        const double radius,const double sigma)
180%
181%  A description of each parameter follows:
182%
183%    o wand: the magick wand.
184%
185%    o radius: the radius of the Gaussian, in pixels, not counting the center
186%      pixel.
187%
188%    o sigma: the standard deviation of the Gaussian, in pixels.
189%
190*/
191WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
192  const double radius,const double sigma)
193{
194  Image
195    *sharp_image;
196
197  assert(wand != (MagickWand *) NULL);
198  assert(wand->signature == WandSignature);
199  if (IfMagickTrue(wand->debug))
200    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
201  if (wand->images == (Image *) NULL)
202    ThrowWandException(WandError,"ContainsNoImages",wand->name);
203  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
204  if (sharp_image == (Image *) NULL)
205    return(MagickFalse);
206  ReplaceImageInList(&wand->images,sharp_image);
207  return(MagickTrue);
208}
209
210/*
211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212%                                                                             %
213%                                                                             %
214%                                                                             %
215%   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                         %
216%                                                                             %
217%                                                                             %
218%                                                                             %
219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220%
221%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
222%  triangulation.
223%
224%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
225%        const size_t columns,const size_t rows)
226%
227%  A description of each parameter follows:
228%
229%    o wand: the magick wand.
230%
231%    o columns: the number of columns in the scaled image.
232%
233%    o rows: the number of rows in the scaled image.
234%
235*/
236WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
237  const size_t columns,const size_t rows)
238{
239  Image
240    *resize_image;
241
242  assert(wand != (MagickWand *) NULL);
243  assert(wand->signature == WandSignature);
244  if (IfMagickTrue(wand->debug))
245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
246  if (wand->images == (Image *) NULL)
247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
248  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
249  if (resize_image == (Image *) NULL)
250    return(MagickFalse);
251  ReplaceImageInList(&wand->images,resize_image);
252  return(MagickTrue);
253}
254
255/*
256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257%                                                                             %
258%                                                                             %
259%                                                                             %
260%   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                       %
261%                                                                             %
262%                                                                             %
263%                                                                             %
264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265%
266%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
267%  more intensely near image edges and less intensely far from edges. We
268%  sharpen the image with a Gaussian operator of the given radius and standard
269%  deviation (sigma).  For reasonable results, radius should be larger than
270%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
271%  suitable radius for you.
272%
273%  The format of the MagickAdaptiveSharpenImage method is:
274%
275%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
276%        const double radius,const double sigma)
277%
278%  A description of each parameter follows:
279%
280%    o wand: the magick wand.
281%
282%    o radius: the radius of the Gaussian, in pixels, not counting the center
283%      pixel.
284%
285%    o sigma: the standard deviation of the Gaussian, in pixels.
286%
287*/
288WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
289  const double radius,const double sigma)
290{
291  Image
292    *sharp_image;
293
294  assert(wand != (MagickWand *) NULL);
295  assert(wand->signature == WandSignature);
296  if (IfMagickTrue(wand->debug))
297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
298  if (wand->images == (Image *) NULL)
299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
300  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
301  if (sharp_image == (Image *) NULL)
302    return(MagickFalse);
303  ReplaceImageInList(&wand->images,sharp_image);
304  return(MagickTrue);
305}
306
307/*
308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309%                                                                             %
310%                                                                             %
311%                                                                             %
312%   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                   %
313%                                                                             %
314%                                                                             %
315%                                                                             %
316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317%
318%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
319%  based on the range of intensity values in its local neighborhood.  This
320%  allows for thresholding of an image whose global intensity histogram
321%  doesn't contain distinctive peaks.
322%
323%  The format of the AdaptiveThresholdImage method is:
324%
325%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
326%        const size_t width,const size_t height,const double bias)
327%
328%  A description of each parameter follows:
329%
330%    o wand: the magick wand.
331%
332%    o width: the width of the local neighborhood.
333%
334%    o height: the height of the local neighborhood.
335%
336%    o offset: the mean bias.
337%
338*/
339WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
340  const size_t width,const size_t height,const double bias)
341{
342  Image
343    *threshold_image;
344
345  assert(wand != (MagickWand *) NULL);
346  assert(wand->signature == WandSignature);
347  if (IfMagickTrue(wand->debug))
348    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
349  if (wand->images == (Image *) NULL)
350    ThrowWandException(WandError,"ContainsNoImages",wand->name);
351  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
352    wand->exception);
353  if (threshold_image == (Image *) NULL)
354    return(MagickFalse);
355  ReplaceImageInList(&wand->images,threshold_image);
356  return(MagickTrue);
357}
358
359/*
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361%                                                                             %
362%                                                                             %
363%                                                                             %
364%   M a g i c k A d d I m a g e                                               %
365%                                                                             %
366%                                                                             %
367%                                                                             %
368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369%
370%  MagickAddImage() adds a clone of the images from the second wand and
371%  inserts them into the first wand.
372%
373%  Use MagickSetLastIterator(), to append new images into an existing wand,
374%  current image will be set to last image so later adds with also be
375%  appened to end of wand.
376%
377%  Use MagickSetFirstIterator() to prepend new images into wand, any more
378%  images added will also be prepended before other images in the wand.
379%  However the order of a list of new images will not change.
380%
381%  Otherwise the new images will be inserted just after the current image,
382%  and any later image will also be added after this current image but
383%  before the previously added images.  Caution is advised when multiple
384%  image adds are inserted into the middle of the wand image list.
385%
386%  The format of the MagickAddImage method is:
387%
388%      MagickBooleanType MagickAddImage(MagickWand *wand,
389%        const MagickWand *add_wand)
390%
391%  A description of each parameter follows:
392%
393%    o wand: the magick wand.
394%
395%    o add_wand: A wand that contains the image list to be added
396%
397*/
398static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
399  Image *images)
400{
401  if (wand->images == (Image *) NULL)
402    {
403      /*
404        No images in wand, just add them, set current as appropriate.
405      */
406      if (IfMagickTrue(wand->insert_before))
407        wand->images=GetFirstImageInList(images);
408      else
409        wand->images=GetLastImageInList(images);
410      return(MagickTrue);
411    }
412  /* user jumped to first image, so prepend new images - remain active */
413  if (IfMagickTrue((wand->insert_before)) &&
414       (wand->images->previous == (Image *) NULL))
415    {
416      PrependImageToList(&wand->images,images);
417      wand->images=GetFirstImageInList(images);
418      return(MagickTrue);
419    }
420  /*
421    Note you should never have 'insert_before' true when current image is not
422    the first image in the wand!  That is no insert before current image, only
423    after current image
424  */
425  if (wand->images->next == (Image *) NULL)
426    {
427      /*
428        At last image, append new images.
429      */
430      InsertImageInList(&wand->images,images);
431      wand->images=GetLastImageInList(images);
432      return(MagickTrue);
433    }
434  /*
435    Insert new images, just after the current image.
436  */
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  assert(add_wand != (MagickWand *) NULL);
452  assert(add_wand->signature == WandSignature);
453  if (add_wand->images == (Image *) NULL)
454    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
455  /*
456    Clone images in second wand, and insert into first.
457  */
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  if (wand->images == (Image *) NULL)
503    ThrowWandException(WandError,"ContainsNoImages",wand->name);
504  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
505  if (noise_image == (Image *) NULL)
506    return(MagickFalse);
507  ReplaceImageInList(&wand->images,noise_image);
508  return(MagickTrue);
509}
510
511/*
512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513%                                                                             %
514%                                                                             %
515%                                                                             %
516%   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                       %
517%                                                                             %
518%                                                                             %
519%                                                                             %
520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521%
522%  MagickAffineTransformImage() transforms an image as dictated by the affine
523%  matrix of the drawing wand.
524%
525%  The format of the MagickAffineTransformImage method is:
526%
527%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
528%        const DrawingWand *drawing_wand)
529%
530%  A description of each parameter follows:
531%
532%    o wand: the magick wand.
533%
534%    o drawing_wand: the draw wand.
535%
536*/
537WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
538  const DrawingWand *drawing_wand)
539{
540  DrawInfo
541    *draw_info;
542
543  Image
544    *affine_image;
545
546  assert(wand != (MagickWand *) NULL);
547  assert(wand->signature == WandSignature);
548  if (IfMagickTrue(wand->debug))
549    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
550  if (wand->images == (Image *) NULL)
551    ThrowWandException(WandError,"ContainsNoImages",wand->name);
552  draw_info=PeekDrawingWand(drawing_wand);
553  if (draw_info == (DrawInfo *) NULL)
554    return(MagickFalse);
555  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
556    wand->exception);
557  draw_info=DestroyDrawInfo(draw_info);
558  if (affine_image == (Image *) NULL)
559    return(MagickFalse);
560  ReplaceImageInList(&wand->images,affine_image);
561  return(MagickTrue);
562}
563
564/*
565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566%                                                                             %
567%                                                                             %
568%                                                                             %
569%   M a g i c k A n n o t a t e I m a g e                                     %
570%                                                                             %
571%                                                                             %
572%                                                                             %
573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574%
575%  MagickAnnotateImage() annotates an image with text.
576%
577%  The format of the MagickAnnotateImage method is:
578%
579%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
580%        const DrawingWand *drawing_wand,const double x,const double y,
581%        const double angle,const char *text)
582%
583%  A description of each parameter follows:
584%
585%    o wand: the magick wand.
586%
587%    o drawing_wand: the draw wand.
588%
589%    o x: x ordinate to left of text
590%
591%    o y: y ordinate to text baseline
592%
593%    o angle: rotate text relative to this angle.
594%
595%    o text: text to draw
596%
597*/
598WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
599  const DrawingWand *drawing_wand,const double x,const double y,
600  const double angle,const char *text)
601{
602  char
603    geometry[MaxTextExtent];
604
605  DrawInfo
606    *draw_info;
607
608  MagickBooleanType
609    status;
610
611  assert(wand != (MagickWand *) NULL);
612  assert(wand->signature == WandSignature);
613  if (IfMagickTrue(wand->debug))
614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
615  if (wand->images == (Image *) NULL)
616    ThrowWandException(WandError,"ContainsNoImages",wand->name);
617  draw_info=PeekDrawingWand(drawing_wand);
618  if (draw_info == (DrawInfo *) NULL)
619    return(MagickFalse);
620  (void) CloneString(&draw_info->text,text);
621  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
622  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
623  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
624  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
625  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
626  (void) CloneString(&draw_info->geometry,geometry);
627  status=AnnotateImage(wand->images,draw_info,wand->exception);
628  draw_info=DestroyDrawInfo(draw_info);
629  return(status);
630}
631
632/*
633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
634%                                                                             %
635%                                                                             %
636%                                                                             %
637%   M a g i c k A n i m a t e I m a g e s                                     %
638%                                                                             %
639%                                                                             %
640%                                                                             %
641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
642%
643%  MagickAnimateImages() animates an image or image sequence.
644%
645%  The format of the MagickAnimateImages method is:
646%
647%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
648%        const char *server_name)
649%
650%  A description of each parameter follows:
651%
652%    o wand: the magick wand.
653%
654%    o server_name: the X server name.
655%
656*/
657WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
658  const char *server_name)
659{
660  MagickBooleanType
661    status;
662
663  assert(wand != (MagickWand *) NULL);
664  assert(wand->signature == WandSignature);
665  if (IfMagickTrue(wand->debug))
666    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
667  (void) CloneString(&wand->image_info->server_name,server_name);
668  status=AnimateImages(wand->image_info,wand->images,wand->exception);
669  return(status);
670}
671
672/*
673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
674%                                                                             %
675%                                                                             %
676%                                                                             %
677%   M a g i c k A p p e n d I m a g e s                                       %
678%                                                                             %
679%                                                                             %
680%                                                                             %
681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
682%
683%  MagickAppendImages() append the images in a wand from the current image
684%  onwards, creating a new wand with the single image result.  This is
685%  affected by the gravity and background settings of the first image.
686%
687%  Typically you would call either MagickResetIterator() or
688%  MagickSetFirstImage() before calling this function to ensure that all
689%  the images in the wand's image list will be appended together.
690%
691%  The format of the MagickAppendImages method is:
692%
693%      MagickWand *MagickAppendImages(MagickWand *wand,
694%        const MagickBooleanType stack)
695%
696%  A description of each parameter follows:
697%
698%    o wand: the magick wand.
699%
700%    o stack: By default, images are stacked left-to-right. Set stack to
701%      MagickTrue to stack them top-to-bottom.
702%
703*/
704WandExport MagickWand *MagickAppendImages(MagickWand *wand,
705  const MagickBooleanType stack)
706{
707  Image
708    *append_image;
709
710  assert(wand != (MagickWand *) NULL);
711  assert(wand->signature == WandSignature);
712  if (IfMagickTrue(wand->debug))
713    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
714  if (wand->images == (Image *) NULL)
715    return((MagickWand *) NULL);
716  append_image=AppendImages(wand->images,stack,wand->exception);
717  if (append_image == (Image *) NULL)
718    return((MagickWand *) NULL);
719  return(CloneMagickWandFromImages(wand,append_image));
720}
721
722/*
723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
724%                                                                             %
725%                                                                             %
726%                                                                             %
727%   M a g i c k A u t o G a m m a I m a g e                                   %
728%                                                                             %
729%                                                                             %
730%                                                                             %
731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
732%
733%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
734%  image to try make set its gamma appropriatally.
735%
736%  The format of the MagickAutoGammaImage method is:
737%
738%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
739%
740%  A description of each parameter follows:
741%
742%    o wand: the magick wand.
743%
744*/
745WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
746{
747  MagickBooleanType
748    status;
749
750  assert(wand != (MagickWand *) NULL);
751  assert(wand->signature == WandSignature);
752  if (IfMagickTrue(wand->debug))
753    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
754  if (wand->images == (Image *) NULL)
755    ThrowWandException(WandError,"ContainsNoImages",wand->name);
756  status=AutoGammaImage(wand->images,wand->exception);
757  return(status);
758}
759
760/*
761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
762%                                                                             %
763%                                                                             %
764%                                                                             %
765%   M a g i c k A u t o L e v e l I m a g e                                   %
766%                                                                             %
767%                                                                             %
768%                                                                             %
769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
770%
771%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
772%  scaling the minimum and maximum values to the full quantum range.
773%
774%  The format of the MagickAutoLevelImage method is:
775%
776%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
777%
778%  A description of each parameter follows:
779%
780%    o wand: the magick wand.
781%
782*/
783WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
784{
785  MagickBooleanType
786    status;
787
788  assert(wand != (MagickWand *) NULL);
789  assert(wand->signature == WandSignature);
790  if (IfMagickTrue(wand->debug))
791    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
792  if (wand->images == (Image *) NULL)
793    ThrowWandException(WandError,"ContainsNoImages",wand->name);
794  status=AutoLevelImage(wand->images,wand->exception);
795  return(status);
796}
797
798/*
799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
800%                                                                             %
801%                                                                             %
802%                                                                             %
803%   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                         %
804%                                                                             %
805%                                                                             %
806%                                                                             %
807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808%
809%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
810%  pixels below the threshold into black while leaving all pixels above the
811%  threshold unchanged.
812%
813%  The format of the MagickBlackThresholdImage method is:
814%
815%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
816%        const PixelWand *threshold)
817%
818%  A description of each parameter follows:
819%
820%    o wand: the magick wand.
821%
822%    o threshold: the pixel wand.
823%
824*/
825WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
826  const PixelWand *threshold)
827{
828  char
829    thresholds[MaxTextExtent];
830
831  MagickBooleanType
832    status;
833
834  assert(wand != (MagickWand *) NULL);
835  assert(wand->signature == WandSignature);
836  if (IfMagickTrue(wand->debug))
837    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
838  if (wand->images == (Image *) NULL)
839    ThrowWandException(WandError,"ContainsNoImages",wand->name);
840  (void) FormatLocaleString(thresholds,MaxTextExtent,
841    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
842    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
843    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
844  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
845  return(status);
846}
847
848/*
849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
850%                                                                             %
851%                                                                             %
852%                                                                             %
853%   M a g i c k B l u e S h i f t I m a g e                                   %
854%                                                                             %
855%                                                                             %
856%                                                                             %
857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858%
859%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
860%  nighttime in the moonlight.
861%
862%  The format of the MagickBlueShiftImage method is:
863%
864%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
865%        const double factor)
866%
867%  A description of each parameter follows:
868%
869%    o wand: the magick wand.
870%
871%    o factor: the blue shift factor (default 1.5)
872%
873*/
874WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
875  const double factor)
876{
877  Image
878    *shift_image;
879
880  assert(wand != (MagickWand *) NULL);
881  assert(wand->signature == WandSignature);
882  if (IfMagickTrue(wand->debug))
883    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
884  if (wand->images == (Image *) NULL)
885    ThrowWandException(WandError,"ContainsNoImages",wand->name);
886  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
887  if (shift_image == (Image *) NULL)
888    return(MagickFalse);
889  ReplaceImageInList(&wand->images,shift_image);
890  return(MagickTrue);
891}
892
893/*
894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
895%                                                                             %
896%                                                                             %
897%                                                                             %
898%   M a g i c k B l u r I m a g e                                             %
899%                                                                             %
900%                                                                             %
901%                                                                             %
902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
903%
904%  MagickBlurImage() blurs an image.  We convolve the image with a
905%  gaussian operator of the given radius and standard deviation (sigma).
906%  For reasonable results, the radius should be larger than sigma.  Use a
907%  radius of 0 and BlurImage() selects a suitable radius for you.
908%
909%  The format of the MagickBlurImage method is:
910%
911%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
912%        const double sigma)
913%
914%  A description of each parameter follows:
915%
916%    o wand: the magick wand.
917%
918%    o radius: the radius of the , in pixels, not counting the center
919%      pixel.
920%
921%    o sigma: the standard deviation of the , in pixels.
922%
923*/
924WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
925  const double radius,const double sigma)
926{
927  Image
928    *blur_image;
929
930  assert(wand != (MagickWand *) NULL);
931  assert(wand->signature == WandSignature);
932  if (IfMagickTrue(wand->debug))
933    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
934  if (wand->images == (Image *) NULL)
935    ThrowWandException(WandError,"ContainsNoImages",wand->name);
936  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
937  if (blur_image == (Image *) NULL)
938    return(MagickFalse);
939  ReplaceImageInList(&wand->images,blur_image);
940  return(MagickTrue);
941}
942
943/*
944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
945%                                                                             %
946%                                                                             %
947%                                                                             %
948%   M a g i c k B o r d e r I m a g e                                         %
949%                                                                             %
950%                                                                             %
951%                                                                             %
952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
953%
954%  MagickBorderImage() surrounds the image with a border of the color defined
955%  by the bordercolor pixel wand.
956%
957%  The format of the MagickBorderImage method is:
958%
959%      MagickBooleanType MagickBorderImage(MagickWand *wand,
960%        const PixelWand *bordercolor,const size_t width,
961%        const size_t height,const CompositeOperator compose)
962%
963%  A description of each parameter follows:
964%
965%    o wand: the magick wand.
966%
967%    o bordercolor: the border color pixel wand.
968%
969%    o width: the border width.
970%
971%    o height: the border height.
972%
973%    o compose: the composite operator.
974%
975*/
976WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
977  const PixelWand *bordercolor,const size_t width,const size_t height,
978  const CompositeOperator compose)
979{
980  Image
981    *border_image;
982
983  RectangleInfo
984    border_info;
985
986  assert(wand != (MagickWand *) NULL);
987  assert(wand->signature == WandSignature);
988  if (IfMagickTrue(wand->debug))
989    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
990  if (wand->images == (Image *) NULL)
991    ThrowWandException(WandError,"ContainsNoImages",wand->name);
992  border_info.width=width;
993  border_info.height=height;
994  border_info.x=0;
995  border_info.y=0;
996  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
997  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
998  if (border_image == (Image *) NULL)
999    return(MagickFalse);
1000  ReplaceImageInList(&wand->images,border_image);
1001  return(MagickTrue);
1002}
1003
1004/*
1005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1006%                                                                             %
1007%                                                                             %
1008%                                                                             %
1009%   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   %
1010%                                                                             %
1011%                                                                             %
1012%                                                                             %
1013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1014%
1015%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1016%  of an image.  It converts the brightness and contrast parameters into slope
1017%  and intercept and calls a polynomical function to apply to the image.
1018
1019%
1020%  The format of the MagickBrightnessContrastImage method is:
1021%
1022%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1023%        const double brightness,const double contrast)
1024%
1025%  A description of each parameter follows:
1026%
1027%    o wand: the magick wand.
1028%
1029%    o brightness: the brightness percent (-100 .. 100).
1030%
1031%    o contrast: the contrast percent (-100 .. 100).
1032%
1033*/
1034WandExport MagickBooleanType MagickBrightnessContrastImage(
1035  MagickWand *wand,const double brightness,const double contrast)
1036{
1037  MagickBooleanType
1038    status;
1039
1040  assert(wand != (MagickWand *) NULL);
1041  assert(wand->signature == WandSignature);
1042  if (IfMagickTrue(wand->debug))
1043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1044  if (wand->images == (Image *) NULL)
1045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1046  status=BrightnessContrastImage(wand->images,brightness,contrast,
1047    wand->exception);
1048  return(status);
1049}
1050
1051/*
1052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1053%                                                                             %
1054%                                                                             %
1055%                                                                             %
1056%   M a g i c k C h a n n e l F x I m a g e                                   %
1057%                                                                             %
1058%                                                                             %
1059%                                                                             %
1060%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1061%
1062%  MagickChannelFxImage() applies a channel expression to the specified image.
1063%  The expression consists of one or more channels, either mnemonic or numeric
1064%  (e.g. red, 1), separated by actions as follows:
1065%
1066%    <=>     exchange two channels (e.g. red<=>blue)
1067%    =>      transfer a channel to another (e.g. red=>green)
1068%    ,       separate channel operations (e.g. red, green)
1069%    |       read channels from next input image (e.g. red | green)
1070%    ;       write channels to next output image (e.g. red; green; blue)
1071%
1072%  A channel without a operation symbol implies extract. For example, to create
1073%  3 grayscale images from the red, green, and blue channels of an image, use:
1074%
1075%    -channel-fx "red; green; blue"
1076%
1077%  The format of the MagickChannelFxImage method is:
1078%
1079%      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1080%
1081%  A description of each parameter follows:
1082%
1083%    o wand: the magick wand.
1084%
1085%    o expression: the expression.
1086%
1087*/
1088WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1089  const char *expression)
1090{
1091  Image
1092    *fx_image;
1093
1094  assert(wand != (MagickWand *) NULL);
1095  assert(wand->signature == WandSignature);
1096  if (IfMagickTrue(wand->debug))
1097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1098  if (wand->images == (Image *) NULL)
1099    return((MagickWand *) NULL);
1100  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1101  if (fx_image == (Image *) NULL)
1102    return((MagickWand *) NULL);
1103  return(CloneMagickWandFromImages(wand,fx_image));
1104}
1105
1106/*
1107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1108%                                                                             %
1109%                                                                             %
1110%                                                                             %
1111%   M a g i c k C h a r c o a l I m a g e                                     %
1112%                                                                             %
1113%                                                                             %
1114%                                                                             %
1115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116%
1117%  MagickCharcoalImage() simulates a charcoal drawing.
1118%
1119%  The format of the MagickCharcoalImage method is:
1120%
1121%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1122%        const double radius,const double sigma)
1123%
1124%  A description of each parameter follows:
1125%
1126%    o wand: the magick wand.
1127%
1128%    o radius: the radius of the Gaussian, in pixels, not counting the center
1129%      pixel.
1130%
1131%    o sigma: the standard deviation of the Gaussian, in pixels.
1132%
1133*/
1134WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1135  const double radius,const double sigma)
1136{
1137  Image
1138    *charcoal_image;
1139
1140  assert(wand != (MagickWand *) NULL);
1141  assert(wand->signature == WandSignature);
1142  if (IfMagickTrue(wand->debug))
1143    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1144  if (wand->images == (Image *) NULL)
1145    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1146  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1147  if (charcoal_image == (Image *) NULL)
1148    return(MagickFalse);
1149  ReplaceImageInList(&wand->images,charcoal_image);
1150  return(MagickTrue);
1151}
1152
1153/*
1154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1155%                                                                             %
1156%                                                                             %
1157%                                                                             %
1158%   M a g i c k C h o p I m a g e                                             %
1159%                                                                             %
1160%                                                                             %
1161%                                                                             %
1162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1163%
1164%  MagickChopImage() removes a region of an image and collapses the image to
1165%  occupy the removed portion
1166%
1167%  The format of the MagickChopImage method is:
1168%
1169%      MagickBooleanType MagickChopImage(MagickWand *wand,
1170%        const size_t width,const size_t height,const ssize_t x,
1171%        const ssize_t y)
1172%
1173%  A description of each parameter follows:
1174%
1175%    o wand: the magick wand.
1176%
1177%    o width: the region width.
1178%
1179%    o height: the region height.
1180%
1181%    o x: the region x offset.
1182%
1183%    o y: the region y offset.
1184%
1185%
1186*/
1187WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1188  const size_t width,const size_t height,const ssize_t x,
1189  const ssize_t y)
1190{
1191  Image
1192    *chop_image;
1193
1194  RectangleInfo
1195    chop;
1196
1197  assert(wand != (MagickWand *) NULL);
1198  assert(wand->signature == WandSignature);
1199  if (IfMagickTrue(wand->debug))
1200    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1201  if (wand->images == (Image *) NULL)
1202    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1203  chop.width=width;
1204  chop.height=height;
1205  chop.x=x;
1206  chop.y=y;
1207  chop_image=ChopImage(wand->images,&chop,wand->exception);
1208  if (chop_image == (Image *) NULL)
1209    return(MagickFalse);
1210  ReplaceImageInList(&wand->images,chop_image);
1211  return(MagickTrue);
1212}
1213
1214/*
1215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1216%                                                                             %
1217%                                                                             %
1218%                                                                             %
1219%   M a g i c k C l a m p I m a g e                                           %
1220%                                                                             %
1221%                                                                             %
1222%                                                                             %
1223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1224%
1225%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1226%
1227%  The format of the MagickClampImage method is:
1228%
1229%      MagickBooleanType MagickClampImage(MagickWand *wand)
1230%
1231%  A description of each parameter follows:
1232%
1233%    o wand: the magick wand.
1234%
1235%    o channel: the channel.
1236%
1237*/
1238WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1239{
1240  assert(wand != (MagickWand *) NULL);
1241  assert(wand->signature == WandSignature);
1242  if (IfMagickTrue(wand->debug))
1243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1244  if (wand->images == (Image *) NULL)
1245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1246  return(ClampImage(wand->images,wand->exception));
1247}
1248
1249/*
1250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1251%                                                                             %
1252%                                                                             %
1253%                                                                             %
1254%   M a g i c k C l i p I m a g e                                             %
1255%                                                                             %
1256%                                                                             %
1257%                                                                             %
1258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1259%
1260%  MagickClipImage() clips along the first path from the 8BIM profile, if
1261%  present.
1262%
1263%  The format of the MagickClipImage method is:
1264%
1265%      MagickBooleanType MagickClipImage(MagickWand *wand)
1266%
1267%  A description of each parameter follows:
1268%
1269%    o wand: the magick wand.
1270%
1271*/
1272WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1273{
1274  MagickBooleanType
1275    status;
1276
1277  assert(wand != (MagickWand *) NULL);
1278  assert(wand->signature == WandSignature);
1279  if (IfMagickTrue(wand->debug))
1280    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1281  if (wand->images == (Image *) NULL)
1282    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1283  status=ClipImage(wand->images,wand->exception);
1284  return(status);
1285}
1286
1287/*
1288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289%                                                                             %
1290%                                                                             %
1291%                                                                             %
1292%   M a g i c k C l i p I m a g e P a t h                                     %
1293%                                                                             %
1294%                                                                             %
1295%                                                                             %
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297%
1298%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1299%  present. Later operations take effect inside the path.  Id may be a number
1300%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1301%  path.
1302%
1303%  The format of the MagickClipImagePath method is:
1304%
1305%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1306%        const char *pathname,const MagickBooleanType inside)
1307%
1308%  A description of each parameter follows:
1309%
1310%    o wand: the magick wand.
1311%
1312%    o pathname: name of clipping path resource. If name is preceded by #, use
1313%      clipping path numbered by name.
1314%
1315%    o inside: if non-zero, later operations take effect inside clipping path.
1316%      Otherwise later operations take effect outside clipping path.
1317%
1318*/
1319WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1320  const char *pathname,const MagickBooleanType inside)
1321{
1322  MagickBooleanType
1323    status;
1324
1325  assert(wand != (MagickWand *) NULL);
1326  assert(wand->signature == WandSignature);
1327  if (IfMagickTrue(wand->debug))
1328    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1329  if (wand->images == (Image *) NULL)
1330    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1331  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1332  return(status);
1333}
1334
1335/*
1336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1337%                                                                             %
1338%                                                                             %
1339%                                                                             %
1340%   M a g i c k C l u t I m a g e                                             %
1341%                                                                             %
1342%                                                                             %
1343%                                                                             %
1344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1345%
1346%  MagickClutImage() replaces colors in the image from a color lookup table.
1347%
1348%  The format of the MagickClutImage method is:
1349%
1350%      MagickBooleanType MagickClutImage(MagickWand *wand,
1351%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1352%
1353%  A description of each parameter follows:
1354%
1355%    o wand: the magick wand.
1356%
1357%    o clut_image: the clut image.
1358%
1359%    o method: the pixel interpolation method.
1360%
1361*/
1362WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1363  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1364{
1365  MagickBooleanType
1366    status;
1367
1368  assert(wand != (MagickWand *) NULL);
1369  assert(wand->signature == WandSignature);
1370  if (IfMagickTrue(wand->debug))
1371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1372  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1373    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1374  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1375  return(status);
1376}
1377
1378/*
1379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1380%                                                                             %
1381%                                                                             %
1382%                                                                             %
1383%   M a g i c k C o a l e s c e I m a g e s                                   %
1384%                                                                             %
1385%                                                                             %
1386%                                                                             %
1387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1388%
1389%  MagickCoalesceImages() composites a set of images while respecting any page
1390%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1391%  typically start with an image background and each subsequent image
1392%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1393%  where each image in the sequence is the same size as the first and
1394%  composited with the next image in the sequence.
1395%
1396%  The format of the MagickCoalesceImages method is:
1397%
1398%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1399%
1400%  A description of each parameter follows:
1401%
1402%    o wand: the magick wand.
1403%
1404*/
1405WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1406{
1407  Image
1408    *coalesce_image;
1409
1410  assert(wand != (MagickWand *) NULL);
1411  assert(wand->signature == WandSignature);
1412  if (IfMagickTrue(wand->debug))
1413    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1414  if (wand->images == (Image *) NULL)
1415    return((MagickWand *) NULL);
1416  coalesce_image=CoalesceImages(wand->images,wand->exception);
1417  if (coalesce_image == (Image *) NULL)
1418    return((MagickWand *) NULL);
1419  return(CloneMagickWandFromImages(wand,coalesce_image));
1420}
1421
1422/*
1423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1424%                                                                             %
1425%                                                                             %
1426%                                                                             %
1427%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1428%                                                                             %
1429%                                                                             %
1430%                                                                             %
1431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1432%
1433%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1434%  Collection (CCC) file which solely contains one or more color corrections
1435%  and applies the color correction to the image.  Here is a sample CCC file:
1436%
1437%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1438%          <ColorCorrection id="cc03345">
1439%                <SOPNode>
1440%                     <Slope> 0.9 1.2 0.5 </Slope>
1441%                     <Offset> 0.4 -0.5 0.6 </Offset>
1442%                     <Power> 1.0 0.8 1.5 </Power>
1443%                </SOPNode>
1444%                <SATNode>
1445%                     <Saturation> 0.85 </Saturation>
1446%                </SATNode>
1447%          </ColorCorrection>
1448%    </ColorCorrectionCollection>
1449%
1450%  which includes the offset, slope, and power for each of the RGB channels
1451%  as well as the saturation.
1452%
1453%  The format of the MagickColorDecisionListImage method is:
1454%
1455%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1456%        const char *color_correction_collection)
1457%
1458%  A description of each parameter follows:
1459%
1460%    o wand: the magick wand.
1461%
1462%    o color_correction_collection: the color correction collection in XML.
1463%
1464*/
1465WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1466  const char *color_correction_collection)
1467{
1468  MagickBooleanType
1469    status;
1470
1471  assert(wand != (MagickWand *) NULL);
1472  assert(wand->signature == WandSignature);
1473  if (IfMagickTrue(wand->debug))
1474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1475  if (wand->images == (Image *) NULL)
1476    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1477  status=ColorDecisionListImage(wand->images,color_correction_collection,
1478    wand->exception);
1479  return(status);
1480}
1481
1482/*
1483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1484%                                                                             %
1485%                                                                             %
1486%                                                                             %
1487%   M a g i c k C o l o r i z e I m a g e                                     %
1488%                                                                             %
1489%                                                                             %
1490%                                                                             %
1491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1492%
1493%  MagickColorizeImage() blends the fill color with each pixel in the image.
1494%
1495%  The format of the MagickColorizeImage method is:
1496%
1497%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1498%        const PixelWand *colorize,const PixelWand *blend)
1499%
1500%  A description of each parameter follows:
1501%
1502%    o wand: the magick wand.
1503%
1504%    o colorize: the colorize pixel wand.
1505%
1506%    o alpha: the alpha pixel wand.
1507%
1508*/
1509WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1510  const PixelWand *colorize,const PixelWand *blend)
1511{
1512  char
1513    percent_blend[MaxTextExtent];
1514
1515  Image
1516    *colorize_image;
1517
1518  PixelInfo
1519    target;
1520
1521  assert(wand != (MagickWand *) NULL);
1522  assert(wand->signature == WandSignature);
1523  if (IfMagickTrue(wand->debug))
1524    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1525  if (wand->images == (Image *) NULL)
1526    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1527  GetPixelInfo(wand->images,&target);
1528  if (target.colorspace != CMYKColorspace)
1529    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1530      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1531      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1532      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1533      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1534      PixelGetAlphaQuantum(blend)));
1535  else
1536    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1537      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1538      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1539      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1540      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1541      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1542      PixelGetAlphaQuantum(blend)));
1543  target=PixelGetPixel(colorize);
1544  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1545    wand->exception);
1546  if (colorize_image == (Image *) NULL)
1547    return(MagickFalse);
1548  ReplaceImageInList(&wand->images,colorize_image);
1549  return(MagickTrue);
1550}
1551
1552/*
1553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1554%                                                                             %
1555%                                                                             %
1556%                                                                             %
1557%   M a g i c k C o l o r M a t r i x I m a g e                               %
1558%                                                                             %
1559%                                                                             %
1560%                                                                             %
1561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1562%
1563%  MagickColorMatrixImage() apply color transformation to an image. The method
1564%  permits saturation changes, hue rotation, luminance to alpha, and various
1565%  other effects.  Although variable-sized transformation matrices can be used,
1566%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1567%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1568%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1569%  and offsets are normalized (divide Flash offset by 255).
1570%
1571%  The format of the MagickColorMatrixImage method is:
1572%
1573%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1574%        const KernelInfo *color_matrix)
1575%
1576%  A description of each parameter follows:
1577%
1578%    o wand: the magick wand.
1579%
1580%    o color_matrix:  the color matrix.
1581%
1582*/
1583WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1584  const KernelInfo *color_matrix)
1585{
1586  Image
1587    *color_image;
1588
1589  assert(wand != (MagickWand *) NULL);
1590  assert(wand->signature == WandSignature);
1591  if (IfMagickTrue(wand->debug))
1592    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1593  if (color_matrix == (const KernelInfo *) NULL)
1594    return(MagickFalse);
1595  if (wand->images == (Image *) NULL)
1596    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1597  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1598  if (color_image == (Image *) NULL)
1599    return(MagickFalse);
1600  ReplaceImageInList(&wand->images,color_image);
1601  return(MagickTrue);
1602}
1603
1604/*
1605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1606%                                                                             %
1607%                                                                             %
1608%                                                                             %
1609%   M a g i c k C o m b i n e I m a g e s                                     %
1610%                                                                             %
1611%                                                                             %
1612%                                                                             %
1613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614%
1615%  MagickCombineImages() combines one or more images into a single image.  The
1616%  grayscale value of the pixels of each image in the sequence is assigned in
1617%  order to the specified  hannels of the combined image.   The typical
1618%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1619%
1620%  The format of the MagickCombineImages method is:
1621%
1622%      MagickWand *MagickCombineImages(MagickWand *wand,
1623%        const ColorspaceType colorspace)
1624%
1625%  A description of each parameter follows:
1626%
1627%    o wand: the magick wand.
1628%
1629%    o colorspace: the colorspace.
1630%
1631*/
1632WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1633  const ColorspaceType colorspace)
1634{
1635  Image
1636    *combine_image;
1637
1638  assert(wand != (MagickWand *) NULL);
1639  assert(wand->signature == WandSignature);
1640  if (IfMagickTrue(wand->debug))
1641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1642  if (wand->images == (Image *) NULL)
1643    return((MagickWand *) NULL);
1644  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1645  if (combine_image == (Image *) NULL)
1646    return((MagickWand *) NULL);
1647  return(CloneMagickWandFromImages(wand,combine_image));
1648}
1649
1650/*
1651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652%                                                                             %
1653%                                                                             %
1654%                                                                             %
1655%   M a g i c k C o m m e n t I m a g e                                       %
1656%                                                                             %
1657%                                                                             %
1658%                                                                             %
1659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1660%
1661%  MagickCommentImage() adds a comment to your image.
1662%
1663%  The format of the MagickCommentImage method is:
1664%
1665%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1666%        const char *comment)
1667%
1668%  A description of each parameter follows:
1669%
1670%    o wand: the magick wand.
1671%
1672%    o comment: the image comment.
1673%
1674*/
1675WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1676  const char *comment)
1677{
1678  MagickBooleanType
1679    status;
1680
1681  assert(wand != (MagickWand *) NULL);
1682  assert(wand->signature == WandSignature);
1683  if (IfMagickTrue(wand->debug))
1684    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1685  if (wand->images == (Image *) NULL)
1686    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1687  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1688  return(status);
1689}
1690
1691/*
1692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1693%                                                                             %
1694%                                                                             %
1695%                                                                             %
1696%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1697%                                                                             %
1698%                                                                             %
1699%                                                                             %
1700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1701%
1702%  MagickCompareImagesLayers() compares each image with the next in a sequence
1703%  and returns the maximum bounding region of any pixel differences it
1704%  discovers.
1705%
1706%  The format of the MagickCompareImagesLayers method is:
1707%
1708%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1709%        const LayerMethod method)
1710%
1711%  A description of each parameter follows:
1712%
1713%    o wand: the magick wand.
1714%
1715%    o method: the compare method.
1716%
1717*/
1718WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1719  const LayerMethod method)
1720{
1721  Image
1722    *layers_image;
1723
1724  assert(wand != (MagickWand *) NULL);
1725  assert(wand->signature == WandSignature);
1726  if (IfMagickTrue(wand->debug))
1727    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1728  if (wand->images == (Image *) NULL)
1729    return((MagickWand *) NULL);
1730  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1731  if (layers_image == (Image *) NULL)
1732    return((MagickWand *) NULL);
1733  return(CloneMagickWandFromImages(wand,layers_image));
1734}
1735
1736/*
1737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1738%                                                                             %
1739%                                                                             %
1740%                                                                             %
1741%   M a g i c k C o m p a r e I m a g e s                                     %
1742%                                                                             %
1743%                                                                             %
1744%                                                                             %
1745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1746%
1747%  MagickCompareImages() compares an image to a reconstructed image and returns
1748%  the specified difference image.
1749%
1750%  The format of the MagickCompareImages method is:
1751%
1752%      MagickWand *MagickCompareImages(MagickWand *wand,
1753%        const MagickWand *reference,const MetricType metric,
1754%        double *distortion)
1755%
1756%  A description of each parameter follows:
1757%
1758%    o wand: the magick wand.
1759%
1760%    o reference: the reference wand.
1761%
1762%    o metric: the metric.
1763%
1764%    o distortion: the computed distortion between the images.
1765%
1766*/
1767WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1768  const MagickWand *reference,const MetricType metric,double *distortion)
1769{
1770  Image
1771    *compare_image;
1772
1773
1774  assert(wand != (MagickWand *) NULL);
1775  assert(wand->signature == WandSignature);
1776  if (IfMagickTrue(wand->debug))
1777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1778  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1779    {
1780      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1781        "ContainsNoImages","`%s'",wand->name);
1782      return((MagickWand *) NULL);
1783    }
1784  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1785    wand->exception);
1786  if (compare_image == (Image *) NULL)
1787    return((MagickWand *) NULL);
1788  return(CloneMagickWandFromImages(wand,compare_image));
1789}
1790
1791/*
1792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1793%                                                                             %
1794%                                                                             %
1795%                                                                             %
1796%   M a g i c k C o m p o s i t e I m a g e                                   %
1797%                                                                             %
1798%                                                                             %
1799%                                                                             %
1800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1801%
1802%  MagickCompositeImage() composite one image onto another at the specified
1803%  offset.
1804%
1805%  The format of the MagickCompositeImage method is:
1806%
1807%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1808%        const MagickWand *source_wand,const CompositeOperator compose,
1809%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1810%
1811%  A description of each parameter follows:
1812%
1813%    o wand: the magick wand holding the destination images
1814%
1815%    o source_image: the magick wand holding source image.
1816%
1817%    o compose: This operator affects how the composite is applied to the
1818%      image.  The default is Over.  These are some of the compose methods
1819%      availble.
1820%
1821%        OverCompositeOp       InCompositeOp         OutCompositeOp
1822%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1823%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1824%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1825%        DisplaceCompositeOp
1826%
1827%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1828%
1829%    o x: the column offset of the composited image.
1830%
1831%    o y: the row offset of the composited image.
1832%
1833*/
1834WandExport 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  MagickBooleanType
1839    status;
1840
1841  assert(wand != (MagickWand *) NULL);
1842  assert(wand->signature == WandSignature);
1843  if (IfMagickTrue(wand->debug))
1844    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1845  if ((wand->images == (Image *) NULL) ||
1846      (source_wand->images == (Image *) NULL))
1847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1848  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1849    x,y,wand->exception);
1850  return(status);
1851}
1852
1853/*
1854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1855%                                                                             %
1856%                                                                             %
1857%                                                                             %
1858%   M a g i c k C o m p o s i t e L a y e r s                                 %
1859%                                                                             %
1860%                                                                             %
1861%                                                                             %
1862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1863%
1864%  MagickCompositeLayers() composite the images in the source wand over the
1865%  images in the destination wand in sequence, starting with the current
1866%  image in both lists.
1867%
1868%  Each layer from the two image lists are composted together until the end of
1869%  one of the image lists is reached.  The offset of each composition is also
1870%  adjusted to match the virtual canvas offsets of each layer. As such the
1871%  given offset is relative to the virtual canvas, and not the actual image.
1872%
1873%  Composition uses given x and y offsets, as the 'origin' location of the
1874%  source images virtual canvas (not the real image) allowing you to compose a
1875%  list of 'layer images' into the destiantioni images.  This makes it well
1876%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1877%  Animations' onto a static or other 'Coaleased Animation' destination image
1878%  list.  GIF disposal handling is not looked at.
1879%
1880%  Special case:- If one of the image sequences is the last image (just a
1881%  single image remaining), that image is repeatally composed with all the
1882%  images in the other image list.  Either the source or destination lists may
1883%  be the single image, for this situation.
1884%
1885%  In the case of a single destination image (or last image given), that image
1886%  will ve cloned to match the number of images remaining in the source image
1887%  list.
1888%
1889%  This is equivelent to the "-layer Composite" Shell API operator.
1890%
1891%  The format of the MagickCompositeLayers method is:
1892%
1893%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1894%        const MagickWand *source_wand, const CompositeOperator compose,
1895%        const ssize_t x,const ssize_t y)
1896%
1897%  A description of each parameter follows:
1898%
1899%    o wand: the magick wand holding destaintion images
1900%
1901%    o source_wand: the wand holding the source images
1902%
1903%    o compose, x, y:  composition arguments
1904%
1905*/
1906WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1907  const MagickWand *source_wand,const CompositeOperator compose,
1908  const ssize_t x,const ssize_t y)
1909{
1910  MagickBooleanType
1911    status;
1912
1913  assert(wand != (MagickWand *) NULL);
1914  assert(wand->signature == WandSignature);
1915  if (IfMagickTrue(wand->debug))
1916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1917  if ((wand->images == (Image *) NULL) ||
1918      (source_wand->images == (Image *) NULL))
1919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1920  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
1921  status=MagickTrue;  /* FUTURE: determine status from exceptions */
1922  return(status);
1923}
1924
1925/*
1926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1927%                                                                             %
1928%                                                                             %
1929%                                                                             %
1930%   M a g i c k C o n t r a s t I m a g e                                     %
1931%                                                                             %
1932%                                                                             %
1933%                                                                             %
1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1935%
1936%  MagickContrastImage() enhances the intensity differences between the lighter
1937%  and darker elements of the image.  Set sharpen to a value other than 0 to
1938%  increase the image contrast otherwise the contrast is reduced.
1939%
1940%  The format of the MagickContrastImage method is:
1941%
1942%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1943%        const MagickBooleanType sharpen)
1944%
1945%  A description of each parameter follows:
1946%
1947%    o wand: the magick wand.
1948%
1949%    o sharpen: Increase or decrease image contrast.
1950%
1951%
1952*/
1953WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1954  const MagickBooleanType sharpen)
1955{
1956  MagickBooleanType
1957    status;
1958
1959  assert(wand != (MagickWand *) NULL);
1960  assert(wand->signature == WandSignature);
1961  if (IfMagickTrue(wand->debug))
1962    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1963  if (wand->images == (Image *) NULL)
1964    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1965  status=ContrastImage(wand->images,sharpen,wand->exception);
1966  return(status);
1967}
1968
1969/*
1970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1971%                                                                             %
1972%                                                                             %
1973%                                                                             %
1974%   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                       %
1975%                                                                             %
1976%                                                                             %
1977%                                                                             %
1978%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1979%
1980%  MagickContrastStretchImage() enhances the contrast of a color image by
1981%  adjusting the pixels color to span the entire range of colors available.
1982%  You can also reduce the influence of a particular channel with a gamma
1983%  value of 0.
1984%
1985%  The format of the MagickContrastStretchImage method is:
1986%
1987%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1988%        const double black_point,const double white_point)
1989%
1990%  A description of each parameter follows:
1991%
1992%    o wand: the magick wand.
1993%
1994%    o black_point: the black point.
1995%
1996%    o white_point: the white point.
1997%
1998*/
1999WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2000  const double black_point,const double white_point)
2001{
2002  MagickBooleanType
2003    status;
2004
2005  assert(wand != (MagickWand *) NULL);
2006  assert(wand->signature == WandSignature);
2007  if (IfMagickTrue(wand->debug))
2008    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2009  if (wand->images == (Image *) NULL)
2010    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2011  status=ContrastStretchImage(wand->images,black_point,white_point,
2012    wand->exception);
2013  return(status);
2014}
2015
2016/*
2017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018%                                                                             %
2019%                                                                             %
2020%                                                                             %
2021%   M a g i c k C o n v o l v e I m a g e                                     %
2022%                                                                             %
2023%                                                                             %
2024%                                                                             %
2025%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2026%
2027%  MagickConvolveImage() applies a custom convolution kernel to the image.
2028%
2029%  The format of the MagickConvolveImage method is:
2030%
2031%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2032%        const KernelInfo *kernel)
2033%
2034%  A description of each parameter follows:
2035%
2036%    o wand: the magick wand.
2037%
2038%    o kernel: An array of doubles representing the convolution kernel.
2039%
2040*/
2041WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2042  const KernelInfo *kernel)
2043{
2044  Image
2045    *filter_image;
2046
2047  assert(wand != (MagickWand *) NULL);
2048  assert(wand->signature == WandSignature);
2049  if (IfMagickTrue(wand->debug))
2050    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2051  if (kernel == (const KernelInfo *) NULL)
2052    return(MagickFalse);
2053  if (wand->images == (Image *) NULL)
2054    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2055  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2056  if (filter_image == (Image *) NULL)
2057    return(MagickFalse);
2058  ReplaceImageInList(&wand->images,filter_image);
2059  return(MagickTrue);
2060}
2061
2062/*
2063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2064%                                                                             %
2065%                                                                             %
2066%                                                                             %
2067%   M a g i c k C r o p I m a g e                                             %
2068%                                                                             %
2069%                                                                             %
2070%                                                                             %
2071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2072%
2073%  MagickCropImage() extracts a region of the image.
2074%
2075%  The format of the MagickCropImage method is:
2076%
2077%      MagickBooleanType MagickCropImage(MagickWand *wand,
2078%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2079%
2080%  A description of each parameter follows:
2081%
2082%    o wand: the magick wand.
2083%
2084%    o width: the region width.
2085%
2086%    o height: the region height.
2087%
2088%    o x: the region x-offset.
2089%
2090%    o y: the region y-offset.
2091%
2092*/
2093WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2094  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2095{
2096  Image
2097    *crop_image;
2098
2099  RectangleInfo
2100    crop;
2101
2102  assert(wand != (MagickWand *) NULL);
2103  assert(wand->signature == WandSignature);
2104  if (IfMagickTrue(wand->debug))
2105    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2106  if (wand->images == (Image *) NULL)
2107    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2108  crop.width=width;
2109  crop.height=height;
2110  crop.x=x;
2111  crop.y=y;
2112  crop_image=CropImage(wand->images,&crop,wand->exception);
2113  if (crop_image == (Image *) NULL)
2114    return(MagickFalse);
2115  ReplaceImageInList(&wand->images,crop_image);
2116  return(MagickTrue);
2117}
2118
2119/*
2120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2121%                                                                             %
2122%                                                                             %
2123%                                                                             %
2124%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2125%                                                                             %
2126%                                                                             %
2127%                                                                             %
2128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2129%
2130%  MagickCycleColormapImage() displaces an image's colormap by a given number
2131%  of positions.  If you cycle the colormap a number of times you can produce
2132%  a psychodelic effect.
2133%
2134%  The format of the MagickCycleColormapImage method is:
2135%
2136%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2137%        const ssize_t displace)
2138%
2139%  A description of each parameter follows:
2140%
2141%    o wand: the magick wand.
2142%
2143%    o pixel_wand: the pixel wand.
2144%
2145*/
2146WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2147  const ssize_t displace)
2148{
2149  MagickBooleanType
2150    status;
2151
2152  assert(wand != (MagickWand *) NULL);
2153  assert(wand->signature == WandSignature);
2154  if (IfMagickTrue(wand->debug))
2155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2156  if (wand->images == (Image *) NULL)
2157    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2158  status=CycleColormapImage(wand->images,displace,wand->exception);
2159  return(status);
2160}
2161
2162/*
2163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2164%                                                                             %
2165%                                                                             %
2166%                                                                             %
2167%   M a g i c k C o n s t i t u t e I m a g e                                 %
2168%                                                                             %
2169%                                                                             %
2170%                                                                             %
2171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2172%
2173%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2174%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2175%  The data can be char, short int, int, float, or double.  Float and double
2176%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2177%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2178%  example, to create a 640x480 image from unsigned red-green-blue character
2179%  data, use
2180%
2181%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2182%
2183%  The format of the MagickConstituteImage method is:
2184%
2185%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2186%        const size_t columns,const size_t rows,const char *map,
2187%        const StorageType storage,void *pixels)
2188%
2189%  A description of each parameter follows:
2190%
2191%    o wand: the magick wand.
2192%
2193%    o columns: width in pixels of the image.
2194%
2195%    o rows: height in pixels of the image.
2196%
2197%    o map:  This string reflects the expected ordering of the pixel array.
2198%      It can be any combination or order of R = red, G = green, B = blue,
2199%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2200%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2201%      P = pad.
2202%
2203%    o storage: Define the data type of the pixels.  Float and double types are
2204%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2205%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2206%      LongPixel, QuantumPixel, or ShortPixel.
2207%
2208%    o pixels: This array of values contain the pixel components as defined by
2209%      map and type.  You must preallocate this array where the expected
2210%      length varies depending on the values of width, height, map, and type.
2211%
2212%
2213*/
2214WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2215  const size_t columns,const size_t rows,const char *map,
2216  const StorageType storage,const void *pixels)
2217{
2218  Image
2219    *images;
2220
2221  assert(wand != (MagickWand *) NULL);
2222  assert(wand->signature == WandSignature);
2223  if (IfMagickTrue(wand->debug))
2224    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2225  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2226  if (images == (Image *) NULL)
2227    return(MagickFalse);
2228  return(InsertImageInWand(wand,images));
2229}
2230
2231/*
2232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2233%                                                                             %
2234%                                                                             %
2235%                                                                             %
2236%   M a g i c k D e c i p h e r I m a g e                                     %
2237%                                                                             %
2238%                                                                             %
2239%                                                                             %
2240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2241%
2242%  MagickDecipherImage() converts cipher pixels to plain pixels.
2243%
2244%  The format of the MagickDecipherImage method is:
2245%
2246%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2247%        const char *passphrase)
2248%
2249%  A description of each parameter follows:
2250%
2251%    o wand: the magick wand.
2252%
2253%    o passphrase: the passphrase.
2254%
2255*/
2256WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2257  const char *passphrase)
2258{
2259  assert(wand != (MagickWand *) NULL);
2260  assert(wand->signature == WandSignature);
2261  if (IfMagickTrue(wand->debug))
2262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263  if (wand->images == (Image *) NULL)
2264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2265  return(DecipherImage(wand->images,passphrase,wand->exception));
2266}
2267
2268/*
2269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2270%                                                                             %
2271%                                                                             %
2272%                                                                             %
2273%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2274%                                                                             %
2275%                                                                             %
2276%                                                                             %
2277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2278%
2279%  MagickDeconstructImages() compares each image with the next in a sequence
2280%  and returns the maximum bounding region of any pixel differences it
2281%  discovers.
2282%
2283%  The format of the MagickDeconstructImages method is:
2284%
2285%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2286%
2287%  A description of each parameter follows:
2288%
2289%    o wand: the magick wand.
2290%
2291*/
2292WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2293{
2294  Image
2295    *deconstruct_image;
2296
2297  assert(wand != (MagickWand *) NULL);
2298  assert(wand->signature == WandSignature);
2299  if (IfMagickTrue(wand->debug))
2300    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2301  if (wand->images == (Image *) NULL)
2302    return((MagickWand *) NULL);
2303  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2304    wand->exception);
2305  if (deconstruct_image == (Image *) NULL)
2306    return((MagickWand *) NULL);
2307  return(CloneMagickWandFromImages(wand,deconstruct_image));
2308}
2309
2310/*
2311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2312%                                                                             %
2313%                                                                             %
2314%                                                                             %
2315%     M a g i c k D e s k e w I m a g e                                       %
2316%                                                                             %
2317%                                                                             %
2318%                                                                             %
2319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2320%
2321%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2322%  occurs in scanned images because of the camera being misaligned,
2323%  imperfections in the scanning or surface, or simply because the paper was
2324%  not placed completely flat when scanned.
2325%
2326%  The format of the MagickDeskewImage method is:
2327%
2328%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2329%        const double threshold)
2330%
2331%  A description of each parameter follows:
2332%
2333%    o wand: the magick wand.
2334%
2335%    o threshold: separate background from foreground.
2336%
2337*/
2338WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2339  const double threshold)
2340{
2341  Image
2342    *sepia_image;
2343
2344  assert(wand != (MagickWand *) NULL);
2345  assert(wand->signature == WandSignature);
2346  if (IfMagickTrue(wand->debug))
2347    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2348  if (wand->images == (Image *) NULL)
2349    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2350  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2351  if (sepia_image == (Image *) NULL)
2352    return(MagickFalse);
2353  ReplaceImageInList(&wand->images,sepia_image);
2354  return(MagickTrue);
2355}
2356
2357/*
2358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2359%                                                                             %
2360%                                                                             %
2361%                                                                             %
2362%     M a g i c k D e s p e c k l e I m a g e                                 %
2363%                                                                             %
2364%                                                                             %
2365%                                                                             %
2366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367%
2368%  MagickDespeckleImage() reduces the speckle noise in an image while
2369%  perserving the edges of the original image.
2370%
2371%  The format of the MagickDespeckleImage method is:
2372%
2373%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2374%
2375%  A description of each parameter follows:
2376%
2377%    o wand: the magick wand.
2378%
2379*/
2380WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2381{
2382  Image
2383    *despeckle_image;
2384
2385  assert(wand != (MagickWand *) NULL);
2386  assert(wand->signature == WandSignature);
2387  if (IfMagickTrue(wand->debug))
2388    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2389  if (wand->images == (Image *) NULL)
2390    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2391  despeckle_image=DespeckleImage(wand->images,wand->exception);
2392  if (despeckle_image == (Image *) NULL)
2393    return(MagickFalse);
2394  ReplaceImageInList(&wand->images,despeckle_image);
2395  return(MagickTrue);
2396}
2397
2398/*
2399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2400%                                                                             %
2401%                                                                             %
2402%                                                                             %
2403%   M a g i c k D e s t r o y I m a g e                                       %
2404%                                                                             %
2405%                                                                             %
2406%                                                                             %
2407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2408%
2409%  MagickDestroyImage() dereferences an image, deallocating memory associated
2410%  with the image if the reference count becomes zero.
2411%
2412%  The format of the MagickDestroyImage method is:
2413%
2414%      Image *MagickDestroyImage(Image *image)
2415%
2416%  A description of each parameter follows:
2417%
2418%    o image: the image.
2419%
2420*/
2421WandExport Image *MagickDestroyImage(Image *image)
2422{
2423  return(DestroyImage(image));
2424}
2425
2426/*
2427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2428%                                                                             %
2429%                                                                             %
2430%                                                                             %
2431%   M a g i c k D i s p l a y I m a g e                                       %
2432%                                                                             %
2433%                                                                             %
2434%                                                                             %
2435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2436%
2437%  MagickDisplayImage() displays an image.
2438%
2439%  The format of the MagickDisplayImage method is:
2440%
2441%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2442%        const char *server_name)
2443%
2444%  A description of each parameter follows:
2445%
2446%    o wand: the magick wand.
2447%
2448%    o server_name: the X server name.
2449%
2450*/
2451WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2452  const char *server_name)
2453{
2454  Image
2455    *image;
2456
2457  MagickBooleanType
2458    status;
2459
2460  assert(wand != (MagickWand *) NULL);
2461  assert(wand->signature == WandSignature);
2462  if (IfMagickTrue(wand->debug))
2463    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2464  if (wand->images == (Image *) NULL)
2465    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2466  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2467  if (image == (Image *) NULL)
2468    return(MagickFalse);
2469  (void) CloneString(&wand->image_info->server_name,server_name);
2470  status=DisplayImages(wand->image_info,image,wand->exception);
2471  image=DestroyImage(image);
2472  return(status);
2473}
2474
2475/*
2476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477%                                                                             %
2478%                                                                             %
2479%                                                                             %
2480%   M a g i c k D i s p l a y I m a g e s                                     %
2481%                                                                             %
2482%                                                                             %
2483%                                                                             %
2484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2485%
2486%  MagickDisplayImages() displays an image or image sequence.
2487%
2488%  The format of the MagickDisplayImages method is:
2489%
2490%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2491%        const char *server_name)
2492%
2493%  A description of each parameter follows:
2494%
2495%    o wand: the magick wand.
2496%
2497%    o server_name: the X server name.
2498%
2499*/
2500WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2501  const char *server_name)
2502{
2503  MagickBooleanType
2504    status;
2505
2506  assert(wand != (MagickWand *) NULL);
2507  assert(wand->signature == WandSignature);
2508  if (IfMagickTrue(wand->debug))
2509    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2510  (void) CloneString(&wand->image_info->server_name,server_name);
2511  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2512  return(status);
2513}
2514
2515/*
2516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2517%                                                                             %
2518%                                                                             %
2519%                                                                             %
2520%   M a g i c k D i s t o r t I m a g e                                       %
2521%                                                                             %
2522%                                                                             %
2523%                                                                             %
2524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2525%
2526%  MagickDistortImage() distorts an image using various distortion methods, by
2527%  mapping color lookups of the source image to a new destination image
2528%  usally of the same size as the source image, unless 'bestfit' is set to
2529%  true.
2530%
2531%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2532%  adjusted to ensure the whole source 'image' will just fit within the final
2533%  destination image, which will be sized and offset accordingly.  Also in
2534%  many cases the virtual offset of the source image will be taken into
2535%  account in the mapping.
2536%
2537%  The format of the MagickDistortImage method is:
2538%
2539%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2540%        const DistortImageMethod method,const size_t number_arguments,
2541%        const double *arguments,const MagickBooleanType bestfit)
2542%
2543%  A description of each parameter follows:
2544%
2545%    o image: the image to be distorted.
2546%
2547%    o method: the method of image distortion.
2548%
2549%        ArcDistortion always ignores the source image offset, and always
2550%        'bestfit' the destination image with the top left corner offset
2551%        relative to the polar mapping center.
2552%
2553%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2554%        style of image distortion.
2555%
2556%        Affine, Perspective, and Bilinear, do least squares fitting of the
2557%        distortion when more than the minimum number of control point pairs
2558%        are provided.
2559%
2560%        Perspective, and Bilinear, falls back to a Affine distortion when less
2561%        that 4 control point pairs are provided. While Affine distortions let
2562%        you use any number of control point pairs, that is Zero pairs is a
2563%        no-Op (viewport only) distrotion, one pair is a translation and two
2564%        pairs of control points do a scale-rotate-translate, without any
2565%        shearing.
2566%
2567%    o number_arguments: the number of arguments given for this distortion
2568%      method.
2569%
2570%    o arguments: the arguments for this distortion method.
2571%
2572%    o bestfit: Attempt to resize destination to fit distorted source.
2573%
2574*/
2575WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2576  const DistortImageMethod method,const size_t number_arguments,
2577  const double *arguments,const MagickBooleanType bestfit)
2578{
2579  Image
2580    *distort_image;
2581
2582  assert(wand != (MagickWand *) NULL);
2583  assert(wand->signature == WandSignature);
2584  if (IfMagickTrue(wand->debug))
2585    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2586  if (wand->images == (Image *) NULL)
2587    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2588  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2589    bestfit,wand->exception);
2590  if (distort_image == (Image *) NULL)
2591    return(MagickFalse);
2592  ReplaceImageInList(&wand->images,distort_image);
2593  return(MagickTrue);
2594}
2595
2596/*
2597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2598%                                                                             %
2599%                                                                             %
2600%                                                                             %
2601%   M a g i c k D r a w I m a g e                                             %
2602%                                                                             %
2603%                                                                             %
2604%                                                                             %
2605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2606%
2607%  MagickDrawImage() renders the drawing wand on the current image.
2608%
2609%  The format of the MagickDrawImage method is:
2610%
2611%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2612%        const DrawingWand *drawing_wand)
2613%
2614%  A description of each parameter follows:
2615%
2616%    o wand: the magick wand.
2617%
2618%    o drawing_wand: the draw wand.
2619%
2620*/
2621WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2622  const DrawingWand *drawing_wand)
2623{
2624  char
2625    *primitive;
2626
2627  DrawInfo
2628    *draw_info;
2629
2630  MagickBooleanType
2631    status;
2632
2633  assert(wand != (MagickWand *) NULL);
2634  assert(wand->signature == WandSignature);
2635  if (IfMagickTrue(wand->debug))
2636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2637  if (wand->images == (Image *) NULL)
2638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2639  draw_info=PeekDrawingWand(drawing_wand);
2640  if ((draw_info == (DrawInfo *) NULL) ||
2641      (draw_info->primitive == (char *) NULL))
2642    return(MagickFalse);
2643  primitive=AcquireString(draw_info->primitive);
2644  draw_info=DestroyDrawInfo(draw_info);
2645  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2646  draw_info->primitive=primitive;
2647  status=DrawImage(wand->images,draw_info,wand->exception);
2648  draw_info=DestroyDrawInfo(draw_info);
2649  return(status);
2650}
2651
2652/*
2653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2654%                                                                             %
2655%                                                                             %
2656%                                                                             %
2657%   M a g i c k E d g e I m a g e                                             %
2658%                                                                             %
2659%                                                                             %
2660%                                                                             %
2661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2662%
2663%  MagickEdgeImage() enhance edges within the image with a convolution filter
2664%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2665%  radius for you.
2666%
2667%  The format of the MagickEdgeImage method is:
2668%
2669%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2670%        const double sigma)
2671%
2672%  A description of each parameter follows:
2673%
2674%    o wand: the magick wand.
2675%
2676%    o radius: the radius of the pixel neighborhood.
2677%
2678%    o sigma: the standard deviation of the Gaussian, in pixels.
2679%
2680*/
2681WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2682  const double radius,const double sigma)
2683{
2684  Image
2685    *edge_image;
2686
2687  assert(wand != (MagickWand *) NULL);
2688  assert(wand->signature == WandSignature);
2689  if (IfMagickTrue(wand->debug))
2690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2691  if (wand->images == (Image *) NULL)
2692    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2693  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2694  if (edge_image == (Image *) NULL)
2695    return(MagickFalse);
2696  ReplaceImageInList(&wand->images,edge_image);
2697  return(MagickTrue);
2698}
2699
2700/*
2701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2702%                                                                             %
2703%                                                                             %
2704%                                                                             %
2705%   M a g i c k E m b o s s I m a g e                                         %
2706%                                                                             %
2707%                                                                             %
2708%                                                                             %
2709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710%
2711%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2712%  effect.  We convolve the image with a Gaussian operator of the given radius
2713%  and standard deviation (sigma).  For reasonable results, radius should be
2714%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2715%  radius for you.
2716%
2717%  The format of the MagickEmbossImage method is:
2718%
2719%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2720%        const double sigma)
2721%
2722%  A description of each parameter follows:
2723%
2724%    o wand: the magick wand.
2725%
2726%    o radius: the radius of the Gaussian, in pixels, not counting the center
2727%      pixel.
2728%
2729%    o sigma: the standard deviation of the Gaussian, in pixels.
2730%
2731*/
2732WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2733  const double radius,const double sigma)
2734{
2735  Image
2736    *emboss_image;
2737
2738  assert(wand != (MagickWand *) NULL);
2739  assert(wand->signature == WandSignature);
2740  if (IfMagickTrue(wand->debug))
2741    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2742  if (wand->images == (Image *) NULL)
2743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2744  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2745  if (emboss_image == (Image *) NULL)
2746    return(MagickFalse);
2747  ReplaceImageInList(&wand->images,emboss_image);
2748  return(MagickTrue);
2749}
2750
2751/*
2752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753%                                                                             %
2754%                                                                             %
2755%                                                                             %
2756%   M a g i c k E n c i p h e r I m a g e                                     %
2757%                                                                             %
2758%                                                                             %
2759%                                                                             %
2760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2761%
2762%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2763%
2764%  The format of the MagickEncipherImage method is:
2765%
2766%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2767%        const char *passphrase)
2768%
2769%  A description of each parameter follows:
2770%
2771%    o wand: the magick wand.
2772%
2773%    o passphrase: the passphrase.
2774%
2775*/
2776WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2777  const char *passphrase)
2778{
2779  assert(wand != (MagickWand *) NULL);
2780  assert(wand->signature == WandSignature);
2781  if (IfMagickTrue(wand->debug))
2782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2783  if (wand->images == (Image *) NULL)
2784    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2785  return(EncipherImage(wand->images,passphrase,wand->exception));
2786}
2787
2788/*
2789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2790%                                                                             %
2791%                                                                             %
2792%                                                                             %
2793%   M a g i c k E n h a n c e I m a g e                                       %
2794%                                                                             %
2795%                                                                             %
2796%                                                                             %
2797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2798%
2799%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2800%  noisy image.
2801%
2802%  The format of the MagickEnhanceImage method is:
2803%
2804%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2805%
2806%  A description of each parameter follows:
2807%
2808%    o wand: the magick wand.
2809%
2810*/
2811WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2812{
2813  Image
2814    *enhance_image;
2815
2816  assert(wand != (MagickWand *) NULL);
2817  assert(wand->signature == WandSignature);
2818  if (IfMagickTrue(wand->debug))
2819    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2820  if (wand->images == (Image *) NULL)
2821    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2822  enhance_image=EnhanceImage(wand->images,wand->exception);
2823  if (enhance_image == (Image *) NULL)
2824    return(MagickFalse);
2825  ReplaceImageInList(&wand->images,enhance_image);
2826  return(MagickTrue);
2827}
2828
2829/*
2830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2831%                                                                             %
2832%                                                                             %
2833%                                                                             %
2834%   M a g i c k E q u a l i z e I m a g e                                     %
2835%                                                                             %
2836%                                                                             %
2837%                                                                             %
2838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2839%
2840%  MagickEqualizeImage() equalizes the image histogram.
2841%
2842%  The format of the MagickEqualizeImage method is:
2843%
2844%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2845%
2846%  A description of each parameter follows:
2847%
2848%    o wand: the magick wand.
2849%
2850%    o channel: the image channel(s).
2851%
2852*/
2853WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2854{
2855  MagickBooleanType
2856    status;
2857
2858  assert(wand != (MagickWand *) NULL);
2859  assert(wand->signature == WandSignature);
2860  if (IfMagickTrue(wand->debug))
2861    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2862  if (wand->images == (Image *) NULL)
2863    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2864  status=EqualizeImage(wand->images,wand->exception);
2865  return(status);
2866}
2867
2868/*
2869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2870%                                                                             %
2871%                                                                             %
2872%                                                                             %
2873%   M a g i c k E v a l u a t e I m a g e                                     %
2874%                                                                             %
2875%                                                                             %
2876%                                                                             %
2877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2878%
2879%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2880%  expression to an image.  Use these operators to lighten or darken an image,
2881%  to increase or decrease contrast in an image, or to produce the "negative"
2882%  of an image.
2883%
2884%  The format of the MagickEvaluateImage method is:
2885%
2886%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2887%        const MagickEvaluateOperator operator,const double value)
2888%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2889%        const MagickEvaluateOperator operator)
2890%
2891%  A description of each parameter follows:
2892%
2893%    o wand: the magick wand.
2894%
2895%    o op: A channel operator.
2896%
2897%    o value: A value value.
2898%
2899*/
2900
2901WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2902  const MagickEvaluateOperator op)
2903{
2904  Image
2905    *evaluate_image;
2906
2907  assert(wand != (MagickWand *) NULL);
2908  assert(wand->signature == WandSignature);
2909  if (IfMagickTrue(wand->debug))
2910    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2911  if (wand->images == (Image *) NULL)
2912    return((MagickWand *) NULL);
2913  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2914  if (evaluate_image == (Image *) NULL)
2915    return((MagickWand *) NULL);
2916  return(CloneMagickWandFromImages(wand,evaluate_image));
2917}
2918
2919WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2920  const MagickEvaluateOperator op,const double value)
2921{
2922  MagickBooleanType
2923    status;
2924
2925  assert(wand != (MagickWand *) NULL);
2926  assert(wand->signature == WandSignature);
2927  if (IfMagickTrue(wand->debug))
2928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2929  if (wand->images == (Image *) NULL)
2930    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2931  status=EvaluateImage(wand->images,op,value,wand->exception);
2932  return(status);
2933}
2934
2935/*
2936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2937%                                                                             %
2938%                                                                             %
2939%                                                                             %
2940%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2941%                                                                             %
2942%                                                                             %
2943%                                                                             %
2944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2945%
2946%  MagickExportImagePixels() extracts pixel data from an image and returns it
2947%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2948%  an error is encountered.  The data is returned as char, short int, int,
2949%  ssize_t, float, or double in the order specified by map.
2950%
2951%  Suppose you want to extract the first scanline of a 640x480 image as
2952%  character data in red-green-blue order:
2953%
2954%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2955%
2956%  The format of the MagickExportImagePixels method is:
2957%
2958%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2959%        const ssize_t x,const ssize_t y,const size_t columns,
2960%        const size_t rows,const char *map,const StorageType storage,
2961%        void *pixels)
2962%
2963%  A description of each parameter follows:
2964%
2965%    o wand: the magick wand.
2966%
2967%    o x, y, columns, rows:  These values define the perimeter
2968%      of a region of pixels you want to extract.
2969%
2970%    o map:  This string reflects the expected ordering of the pixel array.
2971%      It can be any combination or order of R = red, G = green, B = blue,
2972%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2973%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2974%      P = pad.
2975%
2976%    o storage: Define the data type of the pixels.  Float and double types are
2977%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2978%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2979%      LongPixel, QuantumPixel, or ShortPixel.
2980%
2981%    o pixels: This array of values contain the pixel components as defined by
2982%      map and type.  You must preallocate this array where the expected
2983%      length varies depending on the values of width, height, map, and type.
2984%
2985*/
2986WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2987  const ssize_t x,const ssize_t y,const size_t columns,
2988  const size_t rows,const char *map,const StorageType storage,
2989  void *pixels)
2990{
2991  MagickBooleanType
2992    status;
2993
2994  assert(wand != (MagickWand *) NULL);
2995  assert(wand->signature == WandSignature);
2996  if (IfMagickTrue(wand->debug))
2997    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2998  if (wand->images == (Image *) NULL)
2999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3000  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3001    storage,pixels,wand->exception);
3002  return(status);
3003}
3004
3005/*
3006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3007%                                                                             %
3008%                                                                             %
3009%                                                                             %
3010%   M a g i c k E x t e n t I m a g e                                         %
3011%                                                                             %
3012%                                                                             %
3013%                                                                             %
3014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3015%
3016%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3017%  and wand background color.  Set the (x,y) offset of the geometry to move
3018%  the original wand relative to the extended wand.
3019%
3020%  The format of the MagickExtentImage method is:
3021%
3022%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3023%        const size_t height,const ssize_t x,const ssize_t y)
3024%
3025%  A description of each parameter follows:
3026%
3027%    o wand: the magick wand.
3028%
3029%    o width: the region width.
3030%
3031%    o height: the region height.
3032%
3033%    o x: the region x offset.
3034%
3035%    o y: the region y offset.
3036%
3037*/
3038WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3039  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3040{
3041  Image
3042    *extent_image;
3043
3044  RectangleInfo
3045    extent;
3046
3047  assert(wand != (MagickWand *) NULL);
3048  assert(wand->signature == WandSignature);
3049  if (IfMagickTrue(wand->debug))
3050    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3051  if (wand->images == (Image *) NULL)
3052    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3053  extent.width=width;
3054  extent.height=height;
3055  extent.x=x;
3056  extent.y=y;
3057  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3058  if (extent_image == (Image *) NULL)
3059    return(MagickFalse);
3060  ReplaceImageInList(&wand->images,extent_image);
3061  return(MagickTrue);
3062}
3063
3064/*
3065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3066%                                                                             %
3067%                                                                             %
3068%                                                                             %
3069%   M a g i c k F l i p I m a g e                                             %
3070%                                                                             %
3071%                                                                             %
3072%                                                                             %
3073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3074%
3075%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3076%  around the central x-axis.
3077%
3078%  The format of the MagickFlipImage method is:
3079%
3080%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3081%
3082%  A description of each parameter follows:
3083%
3084%    o wand: the magick wand.
3085%
3086*/
3087WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3088{
3089  Image
3090    *flip_image;
3091
3092  assert(wand != (MagickWand *) NULL);
3093  assert(wand->signature == WandSignature);
3094  if (IfMagickTrue(wand->debug))
3095    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3096  if (wand->images == (Image *) NULL)
3097    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3098  flip_image=FlipImage(wand->images,wand->exception);
3099  if (flip_image == (Image *) NULL)
3100    return(MagickFalse);
3101  ReplaceImageInList(&wand->images,flip_image);
3102  return(MagickTrue);
3103}
3104
3105/*
3106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3107%                                                                             %
3108%                                                                             %
3109%                                                                             %
3110%   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                         %
3111%                                                                             %
3112%                                                                             %
3113%                                                                             %
3114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115%
3116%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3117%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3118%  specified, the color value is changed for any neighbor pixel that does not
3119%  match the bordercolor member of image.
3120%
3121%  The format of the MagickFloodfillPaintImage method is:
3122%
3123%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3124%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3125%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3126%
3127%  A description of each parameter follows:
3128%
3129%    o wand: the magick wand.
3130%
3131%    o fill: the floodfill color pixel wand.
3132%
3133%    o fuzz: By default target must match a particular pixel color
3134%      exactly.  However, in many cases two colors may differ by a small amount.
3135%      The fuzz member of image defines how much tolerance is acceptable to
3136%      consider two colors as the same.  For example, set fuzz to 10 and the
3137%      color red at intensities of 100 and 102 respectively are now interpreted
3138%      as the same color for the purposes of the floodfill.
3139%
3140%    o bordercolor: the border color pixel wand.
3141%
3142%    o x,y: the starting location of the operation.
3143%
3144%    o invert: paint any pixel that does not match the target color.
3145%
3146*/
3147WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3148  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3149  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3150{
3151  DrawInfo
3152    *draw_info;
3153
3154  MagickBooleanType
3155    status;
3156
3157  PixelInfo
3158    target;
3159
3160  assert(wand != (MagickWand *) NULL);
3161  assert(wand->signature == WandSignature);
3162  if (IfMagickTrue(wand->debug))
3163    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3164  if (wand->images == (Image *) NULL)
3165    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3166  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3167  PixelGetQuantumPacket(fill,&draw_info->fill);
3168  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3169    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3170  if (bordercolor != (PixelWand *) NULL)
3171    PixelGetMagickColor(bordercolor,&target);
3172  wand->images->fuzz=fuzz;
3173  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3174    wand->exception);
3175  draw_info=DestroyDrawInfo(draw_info);
3176  return(status);
3177}
3178
3179/*
3180%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3181%                                                                             %
3182%                                                                             %
3183%                                                                             %
3184%   M a g i c k F l o p I m a g e                                             %
3185%                                                                             %
3186%                                                                             %
3187%                                                                             %
3188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3189%
3190%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3191%  around the central y-axis.
3192%
3193%  The format of the MagickFlopImage method is:
3194%
3195%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3196%
3197%  A description of each parameter follows:
3198%
3199%    o wand: the magick wand.
3200%
3201*/
3202WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3203{
3204  Image
3205    *flop_image;
3206
3207  assert(wand != (MagickWand *) NULL);
3208  assert(wand->signature == WandSignature);
3209  if (IfMagickTrue(wand->debug))
3210    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3211  if (wand->images == (Image *) NULL)
3212    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3213  flop_image=FlopImage(wand->images,wand->exception);
3214  if (flop_image == (Image *) NULL)
3215    return(MagickFalse);
3216  ReplaceImageInList(&wand->images,flop_image);
3217  return(MagickTrue);
3218}
3219
3220/*
3221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3222%                                                                             %
3223%                                                                             %
3224%                                                                             %
3225%   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                     %
3226%                                                                             %
3227%                                                                             %
3228%                                                                             %
3229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3230%
3231%  MagickForwardFourierTransformImage() implements the discrete Fourier
3232%  transform (DFT) of the image either as a magnitude / phase or real /
3233%  imaginary image pair.
3234%
3235%  The format of the MagickForwardFourierTransformImage method is:
3236%
3237%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3238%        const MagickBooleanType magnitude)
3239%
3240%  A description of each parameter follows:
3241%
3242%    o wand: the magick wand.
3243%
3244%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3245%      imaginary image pair.
3246%
3247*/
3248WandExport MagickBooleanType MagickForwardFourierTransformImage(
3249  MagickWand *wand,const MagickBooleanType magnitude)
3250{
3251  Image
3252    *forward_image;
3253
3254  assert(wand != (MagickWand *) NULL);
3255  assert(wand->signature == WandSignature);
3256  if (IfMagickTrue(wand->debug))
3257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3258  if (wand->images == (Image *) NULL)
3259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3260  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3261    wand->exception);
3262  if (forward_image == (Image *) NULL)
3263    return(MagickFalse);
3264  ReplaceImageInList(&wand->images,forward_image);
3265  return(MagickTrue);
3266}
3267
3268/*
3269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3270%                                                                             %
3271%                                                                             %
3272%                                                                             %
3273%   M a g i c k F r a m e I m a g e                                           %
3274%                                                                             %
3275%                                                                             %
3276%                                                                             %
3277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3278%
3279%  MagickFrameImage() adds a simulated three-dimensional border around the
3280%  image.  The width and height specify the border width of the vertical and
3281%  horizontal sides of the frame.  The inner and outer bevels indicate the
3282%  width of the inner and outer shadows of the frame.
3283%
3284%  The format of the MagickFrameImage method is:
3285%
3286%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3287%        const PixelWand *matte_color,const size_t width,
3288%        const size_t height,const ssize_t inner_bevel,
3289%        const ssize_t outer_bevel,const CompositeOperator compose)
3290%
3291%  A description of each parameter follows:
3292%
3293%    o wand: the magick wand.
3294%
3295%    o matte_color: the frame color pixel wand.
3296%
3297%    o width: the border width.
3298%
3299%    o height: the border height.
3300%
3301%    o inner_bevel: the inner bevel width.
3302%
3303%    o outer_bevel: the outer bevel width.
3304%
3305%    o compose: the composite operator.
3306%
3307*/
3308WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3309  const PixelWand *matte_color,const size_t width,const size_t height,
3310  const ssize_t inner_bevel,const ssize_t outer_bevel,
3311  const CompositeOperator compose)
3312{
3313  Image
3314    *frame_image;
3315
3316  FrameInfo
3317    frame_info;
3318
3319  assert(wand != (MagickWand *) NULL);
3320  assert(wand->signature == WandSignature);
3321  if (IfMagickTrue(wand->debug))
3322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3323  if (wand->images == (Image *) NULL)
3324    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3325  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3326  frame_info.width=wand->images->columns+2*width;
3327  frame_info.height=wand->images->rows+2*height;
3328  frame_info.x=(ssize_t) width;
3329  frame_info.y=(ssize_t) height;
3330  frame_info.inner_bevel=inner_bevel;
3331  frame_info.outer_bevel=outer_bevel;
3332  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3333  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3334  if (frame_image == (Image *) NULL)
3335    return(MagickFalse);
3336  ReplaceImageInList(&wand->images,frame_image);
3337  return(MagickTrue);
3338}
3339
3340/*
3341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3342%                                                                             %
3343%                                                                             %
3344%                                                                             %
3345%   M a g i c k F u n c t i o n I m a g e                                     %
3346%                                                                             %
3347%                                                                             %
3348%                                                                             %
3349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3350%
3351%  MagickFunctionImage() applys an arithmetic, relational, or logical
3352%  expression to an image.  Use these operators to lighten or darken an image,
3353%  to increase or decrease contrast in an image, or to produce the "negative"
3354%  of an image.
3355%
3356%  The format of the MagickFunctionImage method is:
3357%
3358%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3359%        const MagickFunction function,const size_t number_arguments,
3360%        const double *arguments)
3361%
3362%  A description of each parameter follows:
3363%
3364%    o wand: the magick wand.
3365%
3366%    o function: the image function.
3367%
3368%    o number_arguments: the number of function arguments.
3369%
3370%    o arguments: the function arguments.
3371%
3372*/
3373WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3374  const MagickFunction function,const size_t number_arguments,
3375  const double *arguments)
3376{
3377  MagickBooleanType
3378    status;
3379
3380  assert(wand != (MagickWand *) NULL);
3381  assert(wand->signature == WandSignature);
3382  if (IfMagickTrue(wand->debug))
3383    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3384  if (wand->images == (Image *) NULL)
3385    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3386  status=FunctionImage(wand->images,function,number_arguments,arguments,
3387    wand->exception);
3388  return(status);
3389}
3390
3391/*
3392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3393%                                                                             %
3394%                                                                             %
3395%                                                                             %
3396%   M a g i c k F x I m a g e                                                 %
3397%                                                                             %
3398%                                                                             %
3399%                                                                             %
3400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3401%
3402%  MagickFxImage() evaluate expression for each pixel in the image.
3403%
3404%  The format of the MagickFxImage method is:
3405%
3406%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3407%
3408%  A description of each parameter follows:
3409%
3410%    o wand: the magick wand.
3411%
3412%    o expression: the expression.
3413%
3414*/
3415WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3416{
3417  Image
3418    *fx_image;
3419
3420  assert(wand != (MagickWand *) NULL);
3421  assert(wand->signature == WandSignature);
3422  if (IfMagickTrue(wand->debug))
3423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3424  if (wand->images == (Image *) NULL)
3425    return((MagickWand *) NULL);
3426  fx_image=FxImage(wand->images,expression,wand->exception);
3427  if (fx_image == (Image *) NULL)
3428    return((MagickWand *) NULL);
3429  return(CloneMagickWandFromImages(wand,fx_image));
3430}
3431
3432/*
3433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3434%                                                                             %
3435%                                                                             %
3436%                                                                             %
3437%   M a g i c k G a m m a I m a g e                                           %
3438%                                                                             %
3439%                                                                             %
3440%                                                                             %
3441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3442%
3443%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3444%  different devices will have perceptual differences in the way the image's
3445%  intensities are represented on the screen.  Specify individual gamma levels
3446%  for the red, green, and blue channels, or adjust all three with the gamma
3447%  parameter.  Values typically range from 0.8 to 2.3.
3448%
3449%  You can also reduce the influence of a particular channel with a gamma
3450%  value of 0.
3451%
3452%  The format of the MagickGammaImage method is:
3453%
3454%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3455%
3456%  A description of each parameter follows:
3457%
3458%    o wand: the magick wand.
3459%
3460%    o level: Define the level of gamma correction.
3461%
3462*/
3463WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3464  const double gamma)
3465{
3466  MagickBooleanType
3467    status;
3468
3469  assert(wand != (MagickWand *) NULL);
3470  assert(wand->signature == WandSignature);
3471  if (IfMagickTrue(wand->debug))
3472    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3473  if (wand->images == (Image *) NULL)
3474    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3475  status=GammaImage(wand->images,gamma,wand->exception);
3476  return(status);
3477}
3478
3479/*
3480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3481%                                                                             %
3482%                                                                             %
3483%                                                                             %
3484%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3485%                                                                             %
3486%                                                                             %
3487%                                                                             %
3488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3489%
3490%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3491%  Gaussian operator of the given radius and standard deviation (sigma).
3492%  For reasonable results, the radius should be larger than sigma.  Use a
3493%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3494%
3495%  The format of the MagickGaussianBlurImage method is:
3496%
3497%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3498%        const double radius,const double sigma)
3499%
3500%  A description of each parameter follows:
3501%
3502%    o wand: the magick wand.
3503%
3504%    o radius: the radius of the Gaussian, in pixels, not counting the center
3505%      pixel.
3506%
3507%    o sigma: the standard deviation of the Gaussian, in pixels.
3508%
3509*/
3510WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3511  const double radius,const double sigma)
3512{
3513  Image
3514    *blur_image;
3515
3516  assert(wand != (MagickWand *) NULL);
3517  assert(wand->signature == WandSignature);
3518  if (IfMagickTrue(wand->debug))
3519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3520  if (wand->images == (Image *) NULL)
3521    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3522  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3523  if (blur_image == (Image *) NULL)
3524    return(MagickFalse);
3525  ReplaceImageInList(&wand->images,blur_image);
3526  return(MagickTrue);
3527}
3528
3529/*
3530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3531%                                                                             %
3532%                                                                             %
3533%                                                                             %
3534%   M a g i c k G e t I m a g e                                               %
3535%                                                                             %
3536%                                                                             %
3537%                                                                             %
3538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3539%
3540%  MagickGetImage() gets the image at the current image index.
3541%
3542%  The format of the MagickGetImage method is:
3543%
3544%      MagickWand *MagickGetImage(MagickWand *wand)
3545%
3546%  A description of each parameter follows:
3547%
3548%    o wand: the magick wand.
3549%
3550*/
3551WandExport MagickWand *MagickGetImage(MagickWand *wand)
3552{
3553  Image
3554    *image;
3555
3556  assert(wand != (MagickWand *) NULL);
3557  assert(wand->signature == WandSignature);
3558  if (IfMagickTrue(wand->debug))
3559    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3560  if (wand->images == (Image *) NULL)
3561    {
3562      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3563        "ContainsNoImages","`%s'",wand->name);
3564      return((MagickWand *) NULL);
3565    }
3566  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3567  if (image == (Image *) NULL)
3568    return((MagickWand *) NULL);
3569  return(CloneMagickWandFromImages(wand,image));
3570}
3571
3572/*
3573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3574%                                                                             %
3575%                                                                             %
3576%                                                                             %
3577%   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                       %
3578%                                                                             %
3579%                                                                             %
3580%                                                                             %
3581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3582%
3583%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3584%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3585%  than CMYKA.
3586%
3587%  The format of the MagickGetImageAlphaChannel method is:
3588%
3589%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3590%
3591%  A description of each parameter follows:
3592%
3593%    o wand: the magick wand.
3594%
3595*/
3596WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3597{
3598  assert(wand != (MagickWand *) NULL);
3599  assert(wand->signature == WandSignature);
3600  if (IfMagickTrue(wand->debug))
3601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3602  if (wand->images == (Image *) NULL)
3603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3604  return(GetImageAlphaChannel(wand->images));
3605}
3606
3607/*
3608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3609%                                                                             %
3610%                                                                             %
3611%                                                                             %
3612%   M a g i c k G e t I m a g e C l i p M a s k                               %
3613%                                                                             %
3614%                                                                             %
3615%                                                                             %
3616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3617%
3618%  MagickGetImageMask() gets the image clip mask at the current image index.
3619%
3620%  The format of the MagickGetImageMask method is:
3621%
3622%      MagickWand *MagickGetImageMask(MagickWand *wand)
3623%
3624%  A description of each parameter follows:
3625%
3626%    o wand: the magick wand.
3627%
3628*/
3629WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3630{
3631  Image
3632    *image;
3633
3634  assert(wand != (MagickWand *) NULL);
3635  assert(wand->signature == WandSignature);
3636  if (IfMagickTrue(wand->debug))
3637    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3638  if (wand->images == (Image *) NULL)
3639    {
3640      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3641        "ContainsNoImages","`%s'",wand->name);
3642      return((MagickWand *) NULL);
3643    }
3644  image=GetImageMask(wand->images,wand->exception);
3645  if (image == (Image *) NULL)
3646    return((MagickWand *) NULL);
3647  return(CloneMagickWandFromImages(wand,image));
3648}
3649
3650/*
3651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3652%                                                                             %
3653%                                                                             %
3654%                                                                             %
3655%   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                 %
3656%                                                                             %
3657%                                                                             %
3658%                                                                             %
3659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3660%
3661%  MagickGetImageBackgroundColor() returns the image background color.
3662%
3663%  The format of the MagickGetImageBackgroundColor method is:
3664%
3665%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3666%        PixelWand *background_color)
3667%
3668%  A description of each parameter follows:
3669%
3670%    o wand: the magick wand.
3671%
3672%    o background_color: Return the background color.
3673%
3674*/
3675WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3676  PixelWand *background_color)
3677{
3678  assert(wand != (MagickWand *) NULL);
3679  assert(wand->signature == WandSignature);
3680  if (IfMagickTrue(wand->debug))
3681    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3682  if (wand->images == (Image *) NULL)
3683    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3684  PixelSetPixelColor(background_color,&wand->images->background_color);
3685  return(MagickTrue);
3686}
3687
3688/*
3689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3690%                                                                             %
3691%                                                                             %
3692%                                                                             %
3693%   M a g i c k G e t I m a g e B l o b                                       %
3694%                                                                             %
3695%                                                                             %
3696%                                                                             %
3697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3698%
3699%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3700%  the image as a blob (a formatted "file" in memory) and its length, starting
3701%  from the current position in the image sequence.  Use MagickSetImageFormat()
3702%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3703%
3704%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3705%  the image sequence.
3706%
3707%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3708%
3709%  The format of the MagickGetImageBlob method is:
3710%
3711%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3712%
3713%  A description of each parameter follows:
3714%
3715%    o wand: the magick wand.
3716%
3717%    o length: the length of the blob.
3718%
3719*/
3720WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3721{
3722  assert(wand != (MagickWand *) NULL);
3723  assert(wand->signature == WandSignature);
3724  if (IfMagickTrue(wand->debug))
3725    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3726  if (wand->images == (Image *) NULL)
3727    {
3728      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3729        "ContainsNoImages","`%s'",wand->name);
3730      return((unsigned char *) NULL);
3731    }
3732  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3733}
3734
3735/*
3736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3737%                                                                             %
3738%                                                                             %
3739%                                                                             %
3740%   M a g i c k G e t I m a g e s B l o b                                     %
3741%                                                                             %
3742%                                                                             %
3743%                                                                             %
3744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3745%
3746%  MagickGetImageBlob() implements direct to memory image formats.  It
3747%  returns the image sequence as a blob and its length.  The format of the image
3748%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3749%  return a different image format, use MagickSetImageFormat().
3750%
3751%  Note, some image formats do not permit multiple images to the same image
3752%  stream (e.g. JPEG).  in this instance, just the first image of the
3753%  sequence is returned as a blob.
3754%
3755%  The format of the MagickGetImagesBlob method is:
3756%
3757%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3758%
3759%  A description of each parameter follows:
3760%
3761%    o wand: the magick wand.
3762%
3763%    o length: the length of the blob.
3764%
3765*/
3766WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3767{
3768  unsigned char
3769    *blob;
3770
3771  assert(wand != (MagickWand *) NULL);
3772  assert(wand->signature == WandSignature);
3773  if (IfMagickTrue(wand->debug))
3774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3775  if (wand->images == (Image *) NULL)
3776    {
3777      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3778        "ContainsNoImages","`%s'",wand->name);
3779      return((unsigned char *) NULL);
3780    }
3781  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3782    wand->exception);
3783  return(blob);
3784}
3785
3786/*
3787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3788%                                                                             %
3789%                                                                             %
3790%                                                                             %
3791%   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                         %
3792%                                                                             %
3793%                                                                             %
3794%                                                                             %
3795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3796%
3797%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3798%  image.
3799%
3800%  The format of the MagickGetImageBluePrimary method is:
3801%
3802%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3803%        double *y)
3804%
3805%  A description of each parameter follows:
3806%
3807%    o wand: the magick wand.
3808%
3809%    o x: the chromaticity blue primary x-point.
3810%
3811%    o y: the chromaticity blue primary y-point.
3812%
3813*/
3814WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3815  double *x,double *y)
3816{
3817  assert(wand != (MagickWand *) NULL);
3818  assert(wand->signature == WandSignature);
3819  if (IfMagickTrue(wand->debug))
3820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3821  if (wand->images == (Image *) NULL)
3822    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3823  *x=wand->images->chromaticity.blue_primary.x;
3824  *y=wand->images->chromaticity.blue_primary.y;
3825  return(MagickTrue);
3826}
3827
3828/*
3829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3830%                                                                             %
3831%                                                                             %
3832%                                                                             %
3833%   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                         %
3834%                                                                             %
3835%                                                                             %
3836%                                                                             %
3837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3838%
3839%  MagickGetImageBorderColor() returns the image border color.
3840%
3841%  The format of the MagickGetImageBorderColor method is:
3842%
3843%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3844%        PixelWand *border_color)
3845%
3846%  A description of each parameter follows:
3847%
3848%    o wand: the magick wand.
3849%
3850%    o border_color: Return the border color.
3851%
3852*/
3853WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3854  PixelWand *border_color)
3855{
3856  assert(wand != (MagickWand *) NULL);
3857  assert(wand->signature == WandSignature);
3858  if (IfMagickTrue(wand->debug))
3859    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3860  if (wand->images == (Image *) NULL)
3861    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3862  PixelSetPixelColor(border_color,&wand->images->border_color);
3863  return(MagickTrue);
3864}
3865
3866/*
3867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3868%                                                                             %
3869%                                                                             %
3870%                                                                             %
3871%   M a g i c k G e t I m a g e F e a t u r e s                               %
3872%                                                                             %
3873%                                                                             %
3874%                                                                             %
3875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3876%
3877%  MagickGetImageFeatures() returns features for each channel in the
3878%  image in each of four directions (horizontal, vertical, left and right
3879%  diagonals) for the specified distance.  The features include the angular
3880%  second moment, contrast, correlation, sum of squares: variance, inverse
3881%  difference moment, sum average, sum varience, sum entropy, entropy,
3882%  difference variance, difference entropy, information measures of
3883%  correlation 1, information measures of correlation 2, and maximum
3884%  correlation coefficient.  You can access the red channel contrast, for
3885%  example, like this:
3886%
3887%      channel_features=MagickGetImageFeatures(wand,1);
3888%      contrast=channel_features[RedPixelChannel].contrast[0];
3889%
3890%  Use MagickRelinquishMemory() to free the statistics buffer.
3891%
3892%  The format of the MagickGetImageFeatures method is:
3893%
3894%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3895%        const size_t distance)
3896%
3897%  A description of each parameter follows:
3898%
3899%    o wand: the magick wand.
3900%
3901%    o distance: the distance.
3902%
3903*/
3904WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3905  const size_t distance)
3906{
3907  assert(wand != (MagickWand *) NULL);
3908  assert(wand->signature == WandSignature);
3909  if (IfMagickTrue(wand->debug))
3910    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3911  if (wand->images == (Image *) NULL)
3912    {
3913      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3914        "ContainsNoImages","`%s'",wand->name);
3915      return((ChannelFeatures *) NULL);
3916    }
3917  return(GetImageFeatures(wand->images,distance,wand->exception));
3918}
3919
3920/*
3921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3922%                                                                             %
3923%                                                                             %
3924%                                                                             %
3925%   M a g i c k G e t I m a g e K u r t o s i s                               %
3926%                                                                             %
3927%                                                                             %
3928%                                                                             %
3929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3930%
3931%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3932%  more image channels.
3933%
3934%  The format of the MagickGetImageKurtosis method is:
3935%
3936%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3937%        double *kurtosis,double *skewness)
3938%
3939%  A description of each parameter follows:
3940%
3941%    o wand: the magick wand.
3942%
3943%    o kurtosis:  The kurtosis for the specified channel(s).
3944%
3945%    o skewness:  The skewness for the specified channel(s).
3946%
3947*/
3948WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3949  double *kurtosis,double *skewness)
3950{
3951  MagickBooleanType
3952    status;
3953
3954  assert(wand != (MagickWand *) NULL);
3955  assert(wand->signature == WandSignature);
3956  if (IfMagickTrue(wand->debug))
3957    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3958  if (wand->images == (Image *) NULL)
3959    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3960  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3961  return(status);
3962}
3963
3964/*
3965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3966%                                                                             %
3967%                                                                             %
3968%                                                                             %
3969%   M a g i c k G e t I m a g e M e a n                                       %
3970%                                                                             %
3971%                                                                             %
3972%                                                                             %
3973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3974%
3975%  MagickGetImageMean() gets the mean and standard deviation of one or more
3976%  image channels.
3977%
3978%  The format of the MagickGetImageMean method is:
3979%
3980%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3981%        double *standard_deviation)
3982%
3983%  A description of each parameter follows:
3984%
3985%    o wand: the magick wand.
3986%
3987%    o channel: the image channel(s).
3988%
3989%    o mean:  The mean pixel value for the specified channel(s).
3990%
3991%    o standard_deviation:  The standard deviation for the specified channel(s).
3992%
3993*/
3994WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3995  double *standard_deviation)
3996{
3997  MagickBooleanType
3998    status;
3999
4000  assert(wand != (MagickWand *) NULL);
4001  assert(wand->signature == WandSignature);
4002  if (IfMagickTrue(wand->debug))
4003    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4004  if (wand->images == (Image *) NULL)
4005    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4006  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4007  return(status);
4008}
4009
4010/*
4011%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4012%                                                                             %
4013%                                                                             %
4014%                                                                             %
4015%   M a g i c k G e t I m a g e R a n g e                                     %
4016%                                                                             %
4017%                                                                             %
4018%                                                                             %
4019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4020%
4021%  MagickGetImageRange() gets the range for one or more image channels.
4022%
4023%  The format of the MagickGetImageRange method is:
4024%
4025%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4026%        double *maxima)
4027%
4028%  A description of each parameter follows:
4029%
4030%    o wand: the magick wand.
4031%
4032%    o minima:  The minimum pixel value for the specified channel(s).
4033%
4034%    o maxima:  The maximum pixel value for the specified channel(s).
4035%
4036*/
4037WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4038  double *minima,double *maxima)
4039{
4040  MagickBooleanType
4041    status;
4042
4043  assert(wand != (MagickWand *) NULL);
4044  assert(wand->signature == WandSignature);
4045  if (IfMagickTrue(wand->debug))
4046    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4047  if (wand->images == (Image *) NULL)
4048    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4049  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4050  return(status);
4051}
4052
4053/*
4054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4055%                                                                             %
4056%                                                                             %
4057%                                                                             %
4058%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4059%                                                                             %
4060%                                                                             %
4061%                                                                             %
4062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4063%
4064%  MagickGetImageStatistics() returns statistics for each channel in the
4065%  image.  The statistics include the channel depth, its minima and
4066%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4067%  You can access the red channel mean, for example, like this:
4068%
4069%      channel_statistics=MagickGetImageStatistics(wand);
4070%      red_mean=channel_statistics[RedPixelChannel].mean;
4071%
4072%  Use MagickRelinquishMemory() to free the statistics buffer.
4073%
4074%  The format of the MagickGetImageStatistics method is:
4075%
4076%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4077%
4078%  A description of each parameter follows:
4079%
4080%    o wand: the magick wand.
4081%
4082*/
4083WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4084{
4085  assert(wand != (MagickWand *) NULL);
4086  assert(wand->signature == WandSignature);
4087  if (IfMagickTrue(wand->debug))
4088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4089  if (wand->images == (Image *) NULL)
4090    {
4091      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4092        "ContainsNoImages","`%s'",wand->name);
4093      return((ChannelStatistics *) NULL);
4094    }
4095  return(GetImageStatistics(wand->images,wand->exception));
4096}
4097
4098/*
4099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4100%                                                                             %
4101%                                                                             %
4102%                                                                             %
4103%   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                     %
4104%                                                                             %
4105%                                                                             %
4106%                                                                             %
4107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4108%
4109%  MagickGetImageColormapColor() returns the color of the specified colormap
4110%  index.
4111%
4112%  The format of the MagickGetImageColormapColor method is:
4113%
4114%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4115%        const size_t index,PixelWand *color)
4116%
4117%  A description of each parameter follows:
4118%
4119%    o wand: the magick wand.
4120%
4121%    o index: the offset into the image colormap.
4122%
4123%    o color: Return the colormap color in this wand.
4124%
4125*/
4126WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4127  const size_t index,PixelWand *color)
4128{
4129  assert(wand != (MagickWand *) NULL);
4130  assert(wand->signature == WandSignature);
4131  if (IfMagickTrue(wand->debug))
4132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4133  if (wand->images == (Image *) NULL)
4134    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4135  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4136      (index >= wand->images->colors))
4137    {
4138      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4139        "InvalidColormapIndex","`%s'",wand->name);
4140      return(MagickFalse);
4141    }
4142  PixelSetPixelColor(color,wand->images->colormap+index);
4143  return(MagickTrue);
4144}
4145
4146/*
4147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4148%                                                                             %
4149%                                                                             %
4150%                                                                             %
4151%   M a g i c k G e t I m a g e C o l o r s                                   %
4152%                                                                             %
4153%                                                                             %
4154%                                                                             %
4155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156%
4157%  MagickGetImageColors() gets the number of unique colors in the image.
4158%
4159%  The format of the MagickGetImageColors method is:
4160%
4161%      size_t MagickGetImageColors(MagickWand *wand)
4162%
4163%  A description of each parameter follows:
4164%
4165%    o wand: the magick wand.
4166%
4167*/
4168WandExport size_t MagickGetImageColors(MagickWand *wand)
4169{
4170  assert(wand != (MagickWand *) NULL);
4171  assert(wand->signature == WandSignature);
4172  if (IfMagickTrue(wand->debug))
4173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4174  if (wand->images == (Image *) NULL)
4175    {
4176      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4177        "ContainsNoImages","`%s'",wand->name);
4178      return(0);
4179    }
4180  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4181}
4182
4183/*
4184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4185%                                                                             %
4186%                                                                             %
4187%                                                                             %
4188%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4189%                                                                             %
4190%                                                                             %
4191%                                                                             %
4192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4193%
4194%  MagickGetImageColorspace() gets the image colorspace.
4195%
4196%  The format of the MagickGetImageColorspace method is:
4197%
4198%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4199%
4200%  A description of each parameter follows:
4201%
4202%    o wand: the magick wand.
4203%
4204*/
4205WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4206{
4207  assert(wand != (MagickWand *) NULL);
4208  assert(wand->signature == WandSignature);
4209  if (IfMagickTrue(wand->debug))
4210    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4211  if (wand->images == (Image *) NULL)
4212    {
4213      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4214        "ContainsNoImages","`%s'",wand->name);
4215      return(UndefinedColorspace);
4216    }
4217  return(wand->images->colorspace);
4218}
4219
4220/*
4221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4222%                                                                             %
4223%                                                                             %
4224%                                                                             %
4225%   M a g i c k G e t I m a g e C o m p o s e                                 %
4226%                                                                             %
4227%                                                                             %
4228%                                                                             %
4229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4230%
4231%  MagickGetImageCompose() returns the composite operator associated with the
4232%  image.
4233%
4234%  The format of the MagickGetImageCompose method is:
4235%
4236%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4237%
4238%  A description of each parameter follows:
4239%
4240%    o wand: the magick wand.
4241%
4242*/
4243WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4244{
4245  assert(wand != (MagickWand *) NULL);
4246  assert(wand->signature == WandSignature);
4247  if (IfMagickTrue(wand->debug))
4248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4249  if (wand->images == (Image *) NULL)
4250    {
4251      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4252        "ContainsNoImages","`%s'",wand->name);
4253      return(UndefinedCompositeOp);
4254    }
4255  return(wand->images->compose);
4256}
4257
4258/*
4259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4260%                                                                             %
4261%                                                                             %
4262%                                                                             %
4263%   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                         %
4264%                                                                             %
4265%                                                                             %
4266%                                                                             %
4267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4268%
4269%  MagickGetImageCompression() gets the image compression.
4270%
4271%  The format of the MagickGetImageCompression method is:
4272%
4273%      CompressionType MagickGetImageCompression(MagickWand *wand)
4274%
4275%  A description of each parameter follows:
4276%
4277%    o wand: the magick wand.
4278%
4279*/
4280WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4281{
4282  assert(wand != (MagickWand *) NULL);
4283  assert(wand->signature == WandSignature);
4284  if (IfMagickTrue(wand->debug))
4285    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4286  if (wand->images == (Image *) NULL)
4287    {
4288      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4289        "ContainsNoImages","`%s'",wand->name);
4290      return(UndefinedCompression);
4291    }
4292  return(wand->images->compression);
4293}
4294
4295/*
4296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4297%                                                                             %
4298%                                                                             %
4299%                                                                             %
4300%   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           %
4301%                                                                             %
4302%                                                                             %
4303%                                                                             %
4304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4305%
4306%  MagickGetImageCompressionQuality() gets the image compression quality.
4307%
4308%  The format of the MagickGetImageCompressionQuality method is:
4309%
4310%      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4311%
4312%  A description of each parameter follows:
4313%
4314%    o wand: the magick wand.
4315%
4316*/
4317WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4318{
4319  assert(wand != (MagickWand *) NULL);
4320  assert(wand->signature == WandSignature);
4321  if (IfMagickTrue(wand->debug))
4322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4323  if (wand->images == (Image *) NULL)
4324    {
4325      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4326        "ContainsNoImages","`%s'",wand->name);
4327      return(0UL);
4328    }
4329  return(wand->images->quality);
4330}
4331
4332/*
4333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4334%                                                                             %
4335%                                                                             %
4336%                                                                             %
4337%   M a g i c k G e t I m a g e D e l a y                                     %
4338%                                                                             %
4339%                                                                             %
4340%                                                                             %
4341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4342%
4343%  MagickGetImageDelay() gets the image delay.
4344%
4345%  The format of the MagickGetImageDelay method is:
4346%
4347%      size_t MagickGetImageDelay(MagickWand *wand)
4348%
4349%  A description of each parameter follows:
4350%
4351%    o wand: the magick wand.
4352%
4353*/
4354WandExport size_t MagickGetImageDelay(MagickWand *wand)
4355{
4356  assert(wand != (MagickWand *) NULL);
4357  assert(wand->signature == WandSignature);
4358  if (IfMagickTrue(wand->debug))
4359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4360  if (wand->images == (Image *) NULL)
4361    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4362  return(wand->images->delay);
4363}
4364
4365/*
4366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4367%                                                                             %
4368%                                                                             %
4369%                                                                             %
4370%   M a g i c k G e t I m a g e D e p t h                                     %
4371%                                                                             %
4372%                                                                             %
4373%                                                                             %
4374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4375%
4376%  MagickGetImageDepth() gets the image depth.
4377%
4378%  The format of the MagickGetImageDepth method is:
4379%
4380%      size_t MagickGetImageDepth(MagickWand *wand)
4381%
4382%  A description of each parameter follows:
4383%
4384%    o wand: the magick wand.
4385%
4386*/
4387WandExport size_t MagickGetImageDepth(MagickWand *wand)
4388{
4389  assert(wand != (MagickWand *) NULL);
4390  assert(wand->signature == WandSignature);
4391  if (IfMagickTrue(wand->debug))
4392    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4393  if (wand->images == (Image *) NULL)
4394    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4395  return(wand->images->depth);
4396}
4397
4398/*
4399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4400%                                                                             %
4401%                                                                             %
4402%                                                                             %
4403%   M a g i c k G e t I m a g e D i s p o s e                                 %
4404%                                                                             %
4405%                                                                             %
4406%                                                                             %
4407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4408%
4409%  MagickGetImageDispose() gets the image disposal method.
4410%
4411%  The format of the MagickGetImageDispose method is:
4412%
4413%      DisposeType MagickGetImageDispose(MagickWand *wand)
4414%
4415%  A description of each parameter follows:
4416%
4417%    o wand: the magick wand.
4418%
4419*/
4420WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4421{
4422  assert(wand != (MagickWand *) NULL);
4423  assert(wand->signature == WandSignature);
4424  if (IfMagickTrue(wand->debug))
4425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4426  if (wand->images == (Image *) NULL)
4427    {
4428      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4429        "ContainsNoImages","`%s'",wand->name);
4430      return(UndefinedDispose);
4431    }
4432  return((DisposeType) wand->images->dispose);
4433}
4434
4435/*
4436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4437%                                                                             %
4438%                                                                             %
4439%                                                                             %
4440%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4441%                                                                             %
4442%                                                                             %
4443%                                                                             %
4444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4445%
4446%  MagickGetImageDistortion() compares an image to a reconstructed image and
4447%  returns the specified distortion metric.
4448%
4449%  The format of the MagickGetImageDistortion method is:
4450%
4451%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4452%        const MagickWand *reference,const MetricType metric,
4453%        double *distortion)
4454%
4455%  A description of each parameter follows:
4456%
4457%    o wand: the magick wand.
4458%
4459%    o reference: the reference wand.
4460%
4461%    o metric: the metric.
4462%
4463%    o distortion: the computed distortion between the images.
4464%
4465*/
4466WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4467  const MagickWand *reference,const MetricType metric,double *distortion)
4468{
4469  MagickBooleanType
4470    status;
4471
4472  assert(wand != (MagickWand *) NULL);
4473  assert(wand->signature == WandSignature);
4474  if (IfMagickTrue(wand->debug))
4475    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4476  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4477    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4478  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4479    wand->exception);
4480  return(status);
4481}
4482
4483/*
4484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4485%                                                                             %
4486%                                                                             %
4487%                                                                             %
4488%   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                         %
4489%                                                                             %
4490%                                                                             %
4491%                                                                             %
4492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4493%
4494%  MagickGetImageDistortions() compares one or more pixel channels of an
4495%  image to a reconstructed image and returns the specified distortion metrics.
4496%
4497%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4498%
4499%  The format of the MagickGetImageDistortion method is:
4500%
4501%      double *MagickGetImageDistortion(MagickWand *wand,
4502%        const MagickWand *reference,const MetricType metric)
4503%
4504%  A description of each parameter follows:
4505%
4506%    o wand: the magick wand.
4507%
4508%    o reference: the reference wand.
4509%
4510%    o metric: the metric.
4511%
4512*/
4513WandExport double *MagickGetImageDistortions(MagickWand *wand,
4514  const MagickWand *reference,const MetricType metric)
4515{
4516  double
4517    *channel_distortion;
4518
4519  assert(wand != (MagickWand *) NULL);
4520  assert(wand->signature == WandSignature);
4521  if (IfMagickTrue(wand->debug))
4522    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523  assert(reference != (MagickWand *) NULL);
4524  assert(reference->signature == WandSignature);
4525  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4526    {
4527      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4528        "ContainsNoImages","`%s'",wand->name);
4529      return((double *) NULL);
4530    }
4531  channel_distortion=GetImageDistortions(wand->images,reference->images,
4532    metric,wand->exception);
4533  return(channel_distortion);
4534}
4535
4536/*
4537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538%                                                                             %
4539%                                                                             %
4540%                                                                             %
4541%   M a g i c k G e t I m a g e E n d i a n                                   %
4542%                                                                             %
4543%                                                                             %
4544%                                                                             %
4545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4546%
4547%  MagickGetImageEndian() gets the image endian.
4548%
4549%  The format of the MagickGetImageEndian method is:
4550%
4551%      EndianType MagickGetImageEndian(MagickWand *wand)
4552%
4553%  A description of each parameter follows:
4554%
4555%    o wand: the magick wand.
4556%
4557*/
4558WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4559{
4560  assert(wand != (MagickWand *) NULL);
4561  assert(wand->signature == WandSignature);
4562  if (IfMagickTrue(wand->debug))
4563    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4564  if (wand->images == (Image *) NULL)
4565    {
4566      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4567        "ContainsNoImages","`%s'",wand->name);
4568      return(UndefinedEndian);
4569    }
4570  return(wand->images->endian);
4571}
4572
4573/*
4574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4575%                                                                             %
4576%                                                                             %
4577%                                                                             %
4578%   M a g i c k G e t I m a g e F i l e n a m e                               %
4579%                                                                             %
4580%                                                                             %
4581%                                                                             %
4582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4583%
4584%  MagickGetImageFilename() returns the filename of a particular image in a
4585%  sequence.
4586%
4587%  The format of the MagickGetImageFilename method is:
4588%
4589%      char *MagickGetImageFilename(MagickWand *wand)
4590%
4591%  A description of each parameter follows:
4592%
4593%    o wand: the magick wand.
4594%
4595*/
4596WandExport char *MagickGetImageFilename(MagickWand *wand)
4597{
4598  assert(wand != (MagickWand *) NULL);
4599  assert(wand->signature == WandSignature);
4600  if (IfMagickTrue(wand->debug))
4601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4602  if (wand->images == (Image *) NULL)
4603    {
4604      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4605        "ContainsNoImages","`%s'",wand->name);
4606      return((char *) NULL);
4607    }
4608  return(AcquireString(wand->images->filename));
4609}
4610
4611/*
4612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4613%                                                                             %
4614%                                                                             %
4615%                                                                             %
4616%   M a g i c k G e t I m a g e F o r m a t                                   %
4617%                                                                             %
4618%                                                                             %
4619%                                                                             %
4620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4621%
4622%  MagickGetImageFormat() returns the format of a particular image in a
4623%  sequence.
4624%
4625%  The format of the MagickGetImageFormat method is:
4626%
4627%      char *MagickGetImageFormat(MagickWand *wand)
4628%
4629%  A description of each parameter follows:
4630%
4631%    o wand: the magick wand.
4632%
4633*/
4634WandExport char *MagickGetImageFormat(MagickWand *wand)
4635{
4636  assert(wand != (MagickWand *) NULL);
4637  assert(wand->signature == WandSignature);
4638  if (IfMagickTrue(wand->debug))
4639    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4640  if (wand->images == (Image *) NULL)
4641    {
4642      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4643        "ContainsNoImages","`%s'",wand->name);
4644      return((char *) NULL);
4645    }
4646  return(AcquireString(wand->images->magick));
4647}
4648
4649/*
4650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4651%                                                                             %
4652%                                                                             %
4653%                                                                             %
4654%   M a g i c k G e t I m a g e F u z z                                       %
4655%                                                                             %
4656%                                                                             %
4657%                                                                             %
4658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4659%
4660%  MagickGetImageFuzz() gets the image fuzz.
4661%
4662%  The format of the MagickGetImageFuzz method is:
4663%
4664%      double MagickGetImageFuzz(MagickWand *wand)
4665%
4666%  A description of each parameter follows:
4667%
4668%    o wand: the magick wand.
4669%
4670*/
4671WandExport double MagickGetImageFuzz(MagickWand *wand)
4672{
4673  assert(wand != (MagickWand *) NULL);
4674  assert(wand->signature == WandSignature);
4675  if (IfMagickTrue(wand->debug))
4676    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4677  if (wand->images == (Image *) NULL)
4678    {
4679      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4680        "ContainsNoImages","`%s'",wand->name);
4681      return(0.0);
4682    }
4683  return(wand->images->fuzz);
4684}
4685
4686/*
4687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688%                                                                             %
4689%                                                                             %
4690%                                                                             %
4691%   M a g i c k G e t I m a g e G a m m a                                     %
4692%                                                                             %
4693%                                                                             %
4694%                                                                             %
4695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4696%
4697%  MagickGetImageGamma() gets the image gamma.
4698%
4699%  The format of the MagickGetImageGamma method is:
4700%
4701%      double MagickGetImageGamma(MagickWand *wand)
4702%
4703%  A description of each parameter follows:
4704%
4705%    o wand: the magick wand.
4706%
4707*/
4708WandExport double MagickGetImageGamma(MagickWand *wand)
4709{
4710  assert(wand != (MagickWand *) NULL);
4711  assert(wand->signature == WandSignature);
4712  if (IfMagickTrue(wand->debug))
4713    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4714  if (wand->images == (Image *) NULL)
4715    {
4716      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4717        "ContainsNoImages","`%s'",wand->name);
4718      return(0.0);
4719    }
4720  return(wand->images->gamma);
4721}
4722
4723/*
4724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4725%                                                                             %
4726%                                                                             %
4727%                                                                             %
4728%   M a g i c k G e t I m a g e G r a v i t y                                 %
4729%                                                                             %
4730%                                                                             %
4731%                                                                             %
4732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4733%
4734%  MagickGetImageGravity() gets the image gravity.
4735%
4736%  The format of the MagickGetImageGravity method is:
4737%
4738%      GravityType MagickGetImageGravity(MagickWand *wand)
4739%
4740%  A description of each parameter follows:
4741%
4742%    o wand: the magick wand.
4743%
4744*/
4745WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4746{
4747  assert(wand != (MagickWand *) NULL);
4748  assert(wand->signature == WandSignature);
4749  if (IfMagickTrue(wand->debug))
4750    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4751  if (wand->images == (Image *) NULL)
4752    {
4753      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4754        "ContainsNoImages","`%s'",wand->name);
4755      return(UndefinedGravity);
4756    }
4757  return(wand->images->gravity);
4758}
4759
4760/*
4761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4762%                                                                             %
4763%                                                                             %
4764%                                                                             %
4765%   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                       %
4766%                                                                             %
4767%                                                                             %
4768%                                                                             %
4769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4770%
4771%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4772%
4773%  The format of the MagickGetImageGreenPrimary method is:
4774%
4775%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4776%        double *y)
4777%
4778%  A description of each parameter follows:
4779%
4780%    o wand: the magick wand.
4781%
4782%    o x: the chromaticity green primary x-point.
4783%
4784%    o y: the chromaticity green primary y-point.
4785%
4786*/
4787WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4788  double *x,double *y)
4789{
4790  assert(wand != (MagickWand *) NULL);
4791  assert(wand->signature == WandSignature);
4792  if (IfMagickTrue(wand->debug))
4793    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4794  if (wand->images == (Image *) NULL)
4795    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4796  *x=wand->images->chromaticity.green_primary.x;
4797  *y=wand->images->chromaticity.green_primary.y;
4798  return(MagickTrue);
4799}
4800
4801/*
4802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4803%                                                                             %
4804%                                                                             %
4805%                                                                             %
4806%   M a g i c k G e t I m a g e H e i g h t                                   %
4807%                                                                             %
4808%                                                                             %
4809%                                                                             %
4810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4811%
4812%  MagickGetImageHeight() returns the image height.
4813%
4814%  The format of the MagickGetImageHeight method is:
4815%
4816%      size_t MagickGetImageHeight(MagickWand *wand)
4817%
4818%  A description of each parameter follows:
4819%
4820%    o wand: the magick wand.
4821%
4822*/
4823WandExport size_t MagickGetImageHeight(MagickWand *wand)
4824{
4825  assert(wand != (MagickWand *) NULL);
4826  assert(wand->signature == WandSignature);
4827  if (IfMagickTrue(wand->debug))
4828    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4829  if (wand->images == (Image *) NULL)
4830    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4831  return(wand->images->rows);
4832}
4833
4834/*
4835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4836%                                                                             %
4837%                                                                             %
4838%                                                                             %
4839%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4840%                                                                             %
4841%                                                                             %
4842%                                                                             %
4843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4844%
4845%  MagickGetImageHistogram() returns the image histogram as an array of
4846%  PixelWand wands.
4847%
4848%  The format of the MagickGetImageHistogram method is:
4849%
4850%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4851%        size_t *number_colors)
4852%
4853%  A description of each parameter follows:
4854%
4855%    o wand: the magick wand.
4856%
4857%    o number_colors: the number of unique colors in the image and the number
4858%      of pixel wands returned.
4859%
4860*/
4861WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4862  size_t *number_colors)
4863{
4864  PixelInfo
4865    *histogram;
4866
4867  PixelWand
4868    **pixel_wands;
4869
4870  register ssize_t
4871    i;
4872
4873  assert(wand != (MagickWand *) NULL);
4874  assert(wand->signature == WandSignature);
4875  if (IfMagickTrue(wand->debug))
4876    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4877  if (wand->images == (Image *) NULL)
4878    {
4879      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4880        "ContainsNoImages","`%s'",wand->name);
4881      return((PixelWand **) NULL);
4882    }
4883  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4884  if (histogram == (PixelInfo *) NULL)
4885    return((PixelWand **) NULL);
4886  pixel_wands=NewPixelWands(*number_colors);
4887  for (i=0; i < (ssize_t) *number_colors; i++)
4888  {
4889    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4890    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4891  }
4892  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4893  return(pixel_wands);
4894}
4895
4896/*
4897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4898%                                                                             %
4899%                                                                             %
4900%                                                                             %
4901%   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                 %
4902%                                                                             %
4903%                                                                             %
4904%                                                                             %
4905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4906%
4907%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4908%
4909%  The format of the MagickGetImageInterlaceScheme method is:
4910%
4911%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4912%
4913%  A description of each parameter follows:
4914%
4915%    o wand: the magick wand.
4916%
4917*/
4918WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4919{
4920  assert(wand != (MagickWand *) NULL);
4921  assert(wand->signature == WandSignature);
4922  if (IfMagickTrue(wand->debug))
4923    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4924  if (wand->images == (Image *) NULL)
4925    {
4926      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4927        "ContainsNoImages","`%s'",wand->name);
4928      return(UndefinedInterlace);
4929    }
4930  return(wand->images->interlace);
4931}
4932
4933/*
4934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4935%                                                                             %
4936%                                                                             %
4937%                                                                             %
4938%   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             %
4939%                                                                             %
4940%                                                                             %
4941%                                                                             %
4942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4943%
4944%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4945%  sepcified image.
4946%
4947%  The format of the MagickGetImageInterpolateMethod method is:
4948%
4949%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4950%        MagickWand *wand)
4951%
4952%  A description of each parameter follows:
4953%
4954%    o wand: the magick wand.
4955%
4956*/
4957WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4958  MagickWand *wand)
4959{
4960  assert(wand != (MagickWand *) NULL);
4961  assert(wand->signature == WandSignature);
4962  if (IfMagickTrue(wand->debug))
4963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4964  if (wand->images == (Image *) NULL)
4965    {
4966      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4967        "ContainsNoImages","`%s'",wand->name);
4968      return(UndefinedInterpolatePixel);
4969    }
4970  return(wand->images->interpolate);
4971}
4972
4973/*
4974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975%                                                                             %
4976%                                                                             %
4977%                                                                             %
4978%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4979%                                                                             %
4980%                                                                             %
4981%                                                                             %
4982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4983%
4984%  MagickGetImageIterations() gets the image iterations.
4985%
4986%  The format of the MagickGetImageIterations method is:
4987%
4988%      size_t MagickGetImageIterations(MagickWand *wand)
4989%
4990%  A description of each parameter follows:
4991%
4992%    o wand: the magick wand.
4993%
4994*/
4995WandExport size_t MagickGetImageIterations(MagickWand *wand)
4996{
4997  assert(wand != (MagickWand *) NULL);
4998  assert(wand->signature == WandSignature);
4999  if (IfMagickTrue(wand->debug))
5000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5001  if (wand->images == (Image *) NULL)
5002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5003  return(wand->images->iterations);
5004}
5005
5006/*
5007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5008%                                                                             %
5009%                                                                             %
5010%                                                                             %
5011%   M a g i c k G e t I m a g e L e n g t h                                   %
5012%                                                                             %
5013%                                                                             %
5014%                                                                             %
5015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5016%
5017%  MagickGetImageLength() returns the image length in bytes.
5018%
5019%  The format of the MagickGetImageLength method is:
5020%
5021%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5022%        MagickSizeType *length)
5023%
5024%  A description of each parameter follows:
5025%
5026%    o wand: the magick wand.
5027%
5028%    o length: the image length in bytes.
5029%
5030*/
5031WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5032  MagickSizeType *length)
5033{
5034  assert(wand != (MagickWand *) NULL);
5035  assert(wand->signature == WandSignature);
5036  if (IfMagickTrue(wand->debug))
5037    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5038  if (wand->images == (Image *) NULL)
5039    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5040  *length=GetBlobSize(wand->images);
5041  return(MagickTrue);
5042}
5043
5044/*
5045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5046%                                                                             %
5047%                                                                             %
5048%                                                                             %
5049%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5050%                                                                             %
5051%                                                                             %
5052%                                                                             %
5053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5054%
5055%  MagickGetImageMatteColor() returns the image matte color.
5056%
5057%  The format of the MagickGetImageMatteColor method is:
5058%
5059%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5060%        PixelWand *matte_color)
5061%
5062%  A description of each parameter follows:
5063%
5064%    o wand: the magick wand.
5065%
5066%    o matte_color: Return the matte color.
5067%
5068*/
5069WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5070  PixelWand *matte_color)
5071{
5072  assert(wand != (MagickWand *) NULL);
5073  assert(wand->signature == WandSignature);
5074  if (IfMagickTrue(wand->debug))
5075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5076  if (wand->images == (Image *) NULL)
5077    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5078  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5079  return(MagickTrue);
5080}
5081
5082/*
5083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5084%                                                                             %
5085%                                                                             %
5086%                                                                             %
5087%   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                         %
5088%                                                                             %
5089%                                                                             %
5090%                                                                             %
5091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5092%
5093%  MagickGetImageOrientation() returns the image orientation.
5094%
5095%  The format of the MagickGetImageOrientation method is:
5096%
5097%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5098%
5099%  A description of each parameter follows:
5100%
5101%    o wand: the magick wand.
5102%
5103*/
5104WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5105{
5106  assert(wand != (MagickWand *) NULL);
5107  assert(wand->signature == WandSignature);
5108  if (IfMagickTrue(wand->debug))
5109    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5110  if (wand->images == (Image *) NULL)
5111    {
5112      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5113        "ContainsNoImages","`%s'",wand->name);
5114      return(UndefinedOrientation);
5115    }
5116  return(wand->images->orientation);
5117}
5118
5119/*
5120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5121%                                                                             %
5122%                                                                             %
5123%                                                                             %
5124%   M a g i c k G e t I m a g e P a g e                                       %
5125%                                                                             %
5126%                                                                             %
5127%                                                                             %
5128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5129%
5130%  MagickGetImagePage() returns the page geometry associated with the image.
5131%
5132%  The format of the MagickGetImagePage method is:
5133%
5134%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5135%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5136%
5137%  A description of each parameter follows:
5138%
5139%    o wand: the magick wand.
5140%
5141%    o width: the page width.
5142%
5143%    o height: the page height.
5144%
5145%    o x: the page x-offset.
5146%
5147%    o y: the page y-offset.
5148%
5149*/
5150WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5151  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5152{
5153  assert(wand != (const MagickWand *) NULL);
5154  assert(wand->signature == WandSignature);
5155  if (IfMagickTrue(wand->debug))
5156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5157  if (wand->images == (Image *) NULL)
5158    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5159  *width=wand->images->page.width;
5160  *height=wand->images->page.height;
5161  *x=wand->images->page.x;
5162  *y=wand->images->page.y;
5163  return(MagickTrue);
5164}
5165
5166/*
5167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5168%                                                                             %
5169%                                                                             %
5170%                                                                             %
5171%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5172%                                                                             %
5173%                                                                             %
5174%                                                                             %
5175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5176%
5177%  MagickGetImagePixelColor() returns the color of the specified pixel.
5178%
5179%  The format of the MagickGetImagePixelColor method is:
5180%
5181%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5182%        const ssize_t x,const ssize_t y,PixelWand *color)
5183%
5184%  A description of each parameter follows:
5185%
5186%    o wand: the magick wand.
5187%
5188%    o x,y: the pixel offset into the image.
5189%
5190%    o color: Return the colormap color in this wand.
5191%
5192*/
5193WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5194  const ssize_t x,const ssize_t y,PixelWand *color)
5195{
5196  register const Quantum
5197    *p;
5198
5199  CacheView
5200    *image_view;
5201
5202  assert(wand != (MagickWand *) NULL);
5203  assert(wand->signature == WandSignature);
5204  if (IfMagickTrue(wand->debug))
5205    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5206  if (wand->images == (Image *) NULL)
5207    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5208  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5209  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5210  if (p == (const Quantum *) NULL)
5211    {
5212      image_view=DestroyCacheView(image_view);
5213      return(MagickFalse);
5214    }
5215  PixelSetQuantumPixel(wand->images,p,color);
5216  image_view=DestroyCacheView(image_view);
5217  return(MagickTrue);
5218}
5219
5220/*
5221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5222%                                                                             %
5223%                                                                             %
5224%                                                                             %
5225%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5226%                                                                             %
5227%                                                                             %
5228%                                                                             %
5229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5230%
5231%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5232%
5233%  The format of the MagickGetImageRedPrimary method is:
5234%
5235%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5236%        double *y)
5237%
5238%  A description of each parameter follows:
5239%
5240%    o wand: the magick wand.
5241%
5242%    o x: the chromaticity red primary x-point.
5243%
5244%    o y: the chromaticity red primary y-point.
5245%
5246*/
5247WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5248  double *x,double *y)
5249{
5250  assert(wand != (MagickWand *) NULL);
5251  assert(wand->signature == WandSignature);
5252  if (IfMagickTrue(wand->debug))
5253    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5254  if (wand->images == (Image *) NULL)
5255    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5256  *x=wand->images->chromaticity.red_primary.x;
5257  *y=wand->images->chromaticity.red_primary.y;
5258  return(MagickTrue);
5259}
5260
5261/*
5262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5263%                                                                             %
5264%                                                                             %
5265%                                                                             %
5266%   M a g i c k G e t I m a g e R e g i o n                                   %
5267%                                                                             %
5268%                                                                             %
5269%                                                                             %
5270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5271%
5272%  MagickGetImageRegion() extracts a region of the image and returns it as a
5273%  a new wand.
5274%
5275%  The format of the MagickGetImageRegion method is:
5276%
5277%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5278%        const size_t width,const size_t height,const ssize_t x,
5279%        const ssize_t y)
5280%
5281%  A description of each parameter follows:
5282%
5283%    o wand: the magick wand.
5284%
5285%    o width: the region width.
5286%
5287%    o height: the region height.
5288%
5289%    o x: the region x offset.
5290%
5291%    o y: the region y offset.
5292%
5293*/
5294WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5295  const size_t width,const size_t height,const ssize_t x,
5296  const ssize_t y)
5297{
5298  Image
5299    *region_image;
5300
5301  RectangleInfo
5302    region;
5303
5304  assert(wand != (MagickWand *) NULL);
5305  assert(wand->signature == WandSignature);
5306  if (IfMagickTrue(wand->debug))
5307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5308  if (wand->images == (Image *) NULL)
5309    return((MagickWand *) NULL);
5310  region.width=width;
5311  region.height=height;
5312  region.x=x;
5313  region.y=y;
5314  region_image=CropImage(wand->images,&region,wand->exception);
5315  if (region_image == (Image *) NULL)
5316    return((MagickWand *) NULL);
5317  return(CloneMagickWandFromImages(wand,region_image));
5318}
5319
5320/*
5321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5322%                                                                             %
5323%                                                                             %
5324%                                                                             %
5325%   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                 %
5326%                                                                             %
5327%                                                                             %
5328%                                                                             %
5329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5330%
5331%  MagickGetImageRenderingIntent() gets the image rendering intent.
5332%
5333%  The format of the MagickGetImageRenderingIntent method is:
5334%
5335%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5336%
5337%  A description of each parameter follows:
5338%
5339%    o wand: the magick wand.
5340%
5341*/
5342WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5343{
5344  assert(wand != (MagickWand *) NULL);
5345  assert(wand->signature == WandSignature);
5346  if (IfMagickTrue(wand->debug))
5347    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5348  if (wand->images == (Image *) NULL)
5349    {
5350      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5351        "ContainsNoImages","`%s'",wand->name);
5352      return(UndefinedIntent);
5353    }
5354  return((RenderingIntent) wand->images->rendering_intent);
5355}
5356
5357/*
5358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5359%                                                                             %
5360%                                                                             %
5361%                                                                             %
5362%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5363%                                                                             %
5364%                                                                             %
5365%                                                                             %
5366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5367%
5368%  MagickGetImageResolution() gets the image X and Y resolution.
5369%
5370%  The format of the MagickGetImageResolution method is:
5371%
5372%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5373%        double *y)
5374%
5375%  A description of each parameter follows:
5376%
5377%    o wand: the magick wand.
5378%
5379%    o x: the image x-resolution.
5380%
5381%    o y: the image y-resolution.
5382%
5383*/
5384WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5385  double *x,double *y)
5386{
5387  assert(wand != (MagickWand *) NULL);
5388  assert(wand->signature == WandSignature);
5389  if (IfMagickTrue(wand->debug))
5390    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5391  if (wand->images == (Image *) NULL)
5392    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5393  *x=wand->images->resolution.x;
5394  *y=wand->images->resolution.y;
5395  return(MagickTrue);
5396}
5397
5398/*
5399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5400%                                                                             %
5401%                                                                             %
5402%                                                                             %
5403%   M a g i c k G e t I m a g e S c e n e                                     %
5404%                                                                             %
5405%                                                                             %
5406%                                                                             %
5407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5408%
5409%  MagickGetImageScene() gets the image scene.
5410%
5411%  The format of the MagickGetImageScene method is:
5412%
5413%      size_t MagickGetImageScene(MagickWand *wand)
5414%
5415%  A description of each parameter follows:
5416%
5417%    o wand: the magick wand.
5418%
5419*/
5420WandExport size_t MagickGetImageScene(MagickWand *wand)
5421{
5422  assert(wand != (MagickWand *) NULL);
5423  assert(wand->signature == WandSignature);
5424  if (IfMagickTrue(wand->debug))
5425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426  if (wand->images == (Image *) NULL)
5427    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5428  return(wand->images->scene);
5429}
5430
5431/*
5432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5433%                                                                             %
5434%                                                                             %
5435%                                                                             %
5436%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5437%                                                                             %
5438%                                                                             %
5439%                                                                             %
5440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5441%
5442%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5443%  pixel stream.
5444%
5445%  The format of the MagickGetImageSignature method is:
5446%
5447%      char *MagickGetImageSignature(MagickWand *wand)
5448%
5449%  A description of each parameter follows:
5450%
5451%    o wand: the magick wand.
5452%
5453*/
5454WandExport char *MagickGetImageSignature(MagickWand *wand)
5455{
5456  const char
5457    *value;
5458
5459  MagickBooleanType
5460    status;
5461
5462  assert(wand != (MagickWand *) NULL);
5463  assert(wand->signature == WandSignature);
5464  if (IfMagickTrue(wand->debug))
5465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5466  if (wand->images == (Image *) NULL)
5467    {
5468      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5469        "ContainsNoImages","`%s'",wand->name);
5470      return((char *) NULL);
5471    }
5472  status=SignatureImage(wand->images,wand->exception);
5473  if (IfMagickFalse(status))
5474    return((char *) NULL);
5475  value=GetImageProperty(wand->images,"signature",wand->exception);
5476  if (value == (const char *) NULL)
5477    return((char *) NULL);
5478  return(AcquireString(value));
5479}
5480
5481/*
5482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5483%                                                                             %
5484%                                                                             %
5485%                                                                             %
5486%   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                   %
5487%                                                                             %
5488%                                                                             %
5489%                                                                             %
5490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5491%
5492%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5493%
5494%  The format of the MagickGetImageTicksPerSecond method is:
5495%
5496%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5497%
5498%  A description of each parameter follows:
5499%
5500%    o wand: the magick wand.
5501%
5502*/
5503WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5504{
5505  assert(wand != (MagickWand *) NULL);
5506  assert(wand->signature == WandSignature);
5507  if (IfMagickTrue(wand->debug))
5508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5509  if (wand->images == (Image *) NULL)
5510    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5511  return((size_t) wand->images->ticks_per_second);
5512}
5513
5514/*
5515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5516%                                                                             %
5517%                                                                             %
5518%                                                                             %
5519%   M a g i c k G e t I m a g e T y p e                                       %
5520%                                                                             %
5521%                                                                             %
5522%                                                                             %
5523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5524%
5525%  MagickGetImageType() gets the potential image type:
5526%
5527%        Bilevel        Grayscale       GrayscaleMatte
5528%        Palette        PaletteMatte    TrueColor
5529%        TrueColorMatte ColorSeparation ColorSeparationMatte
5530%
5531%  To ensure the image type matches its potential, use MagickSetImageType():
5532%
5533%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5534%
5535%  The format of the MagickGetImageType method is:
5536%
5537%      ImageType MagickGetImageType(MagickWand *wand)
5538%
5539%  A description of each parameter follows:
5540%
5541%    o wand: the magick wand.
5542%
5543*/
5544WandExport ImageType MagickGetImageType(MagickWand *wand)
5545{
5546  assert(wand != (MagickWand *) NULL);
5547  assert(wand->signature == WandSignature);
5548  if (IfMagickTrue(wand->debug))
5549    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5550  if (wand->images == (Image *) NULL)
5551    {
5552      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5553        "ContainsNoImages","`%s'",wand->name);
5554      return(UndefinedType);
5555    }
5556  return(GetImageType(wand->images,wand->exception));
5557}
5558
5559/*
5560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5561%                                                                             %
5562%                                                                             %
5563%                                                                             %
5564%   M a g i c k G e t I m a g e U n i t s                                     %
5565%                                                                             %
5566%                                                                             %
5567%                                                                             %
5568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5569%
5570%  MagickGetImageUnits() gets the image units of resolution.
5571%
5572%  The format of the MagickGetImageUnits method is:
5573%
5574%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5575%
5576%  A description of each parameter follows:
5577%
5578%    o wand: the magick wand.
5579%
5580*/
5581WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5582{
5583  assert(wand != (MagickWand *) NULL);
5584  assert(wand->signature == WandSignature);
5585  if (IfMagickTrue(wand->debug))
5586    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5587  if (wand->images == (Image *) NULL)
5588    {
5589      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5590        "ContainsNoImages","`%s'",wand->name);
5591      return(UndefinedResolution);
5592    }
5593  return(wand->images->units);
5594}
5595
5596/*
5597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5598%                                                                             %
5599%                                                                             %
5600%                                                                             %
5601%   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           %
5602%                                                                             %
5603%                                                                             %
5604%                                                                             %
5605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5606%
5607%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5608%  sepcified image.
5609%
5610%  The format of the MagickGetImageVirtualPixelMethod method is:
5611%
5612%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5613%
5614%  A description of each parameter follows:
5615%
5616%    o wand: the magick wand.
5617%
5618*/
5619WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5620{
5621  assert(wand != (MagickWand *) NULL);
5622  assert(wand->signature == WandSignature);
5623  if (IfMagickTrue(wand->debug))
5624    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5625  if (wand->images == (Image *) NULL)
5626    {
5627      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5628        "ContainsNoImages","`%s'",wand->name);
5629      return(UndefinedVirtualPixelMethod);
5630    }
5631  return(GetImageVirtualPixelMethod(wand->images));
5632}
5633
5634/*
5635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5636%                                                                             %
5637%                                                                             %
5638%                                                                             %
5639%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5640%                                                                             %
5641%                                                                             %
5642%                                                                             %
5643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5644%
5645%  MagickGetImageWhitePoint() returns the chromaticy white point.
5646%
5647%  The format of the MagickGetImageWhitePoint method is:
5648%
5649%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5650%        double *y)
5651%
5652%  A description of each parameter follows:
5653%
5654%    o wand: the magick wand.
5655%
5656%    o x: the chromaticity white x-point.
5657%
5658%    o y: the chromaticity white y-point.
5659%
5660*/
5661WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5662  double *x,double *y)
5663{
5664  assert(wand != (MagickWand *) NULL);
5665  assert(wand->signature == WandSignature);
5666  if (IfMagickTrue(wand->debug))
5667    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5668  if (wand->images == (Image *) NULL)
5669    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5670  *x=wand->images->chromaticity.white_point.x;
5671  *y=wand->images->chromaticity.white_point.y;
5672  return(MagickTrue);
5673}
5674
5675/*
5676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5677%                                                                             %
5678%                                                                             %
5679%                                                                             %
5680%   M a g i c k G e t I m a g e W i d t h                                     %
5681%                                                                             %
5682%                                                                             %
5683%                                                                             %
5684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5685%
5686%  MagickGetImageWidth() returns the image width.
5687%
5688%  The format of the MagickGetImageWidth method is:
5689%
5690%      size_t MagickGetImageWidth(MagickWand *wand)
5691%
5692%  A description of each parameter follows:
5693%
5694%    o wand: the magick wand.
5695%
5696*/
5697WandExport size_t MagickGetImageWidth(MagickWand *wand)
5698{
5699  assert(wand != (MagickWand *) NULL);
5700  assert(wand->signature == WandSignature);
5701  if (IfMagickTrue(wand->debug))
5702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5703  if (wand->images == (Image *) NULL)
5704    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5705  return(wand->images->columns);
5706}
5707
5708/*
5709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5710%                                                                             %
5711%                                                                             %
5712%                                                                             %
5713%   M a g i c k G e t N u m b e r I m a g e s                                 %
5714%                                                                             %
5715%                                                                             %
5716%                                                                             %
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%
5719%  MagickGetNumberImages() returns the number of images associated with a
5720%  magick wand.
5721%
5722%  The format of the MagickGetNumberImages method is:
5723%
5724%      size_t MagickGetNumberImages(MagickWand *wand)
5725%
5726%  A description of each parameter follows:
5727%
5728%    o wand: the magick wand.
5729%
5730*/
5731WandExport size_t MagickGetNumberImages(MagickWand *wand)
5732{
5733  assert(wand != (MagickWand *) NULL);
5734  assert(wand->signature == WandSignature);
5735  if (IfMagickTrue(wand->debug))
5736    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5737  return(GetImageListLength(wand->images));
5738}
5739
5740/*
5741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742%                                                                             %
5743%                                                                             %
5744%                                                                             %
5745%   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                 %
5746%                                                                             %
5747%                                                                             %
5748%                                                                             %
5749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750%
5751%  MagickGetImageTotalInkDensity() gets the image total ink density.
5752%
5753%  The format of the MagickGetImageTotalInkDensity method is:
5754%
5755%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5756%
5757%  A description of each parameter follows:
5758%
5759%    o wand: the magick wand.
5760%
5761*/
5762WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5763{
5764  assert(wand != (MagickWand *) NULL);
5765  assert(wand->signature == WandSignature);
5766  if (IfMagickTrue(wand->debug))
5767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5768  if (wand->images == (Image *) NULL)
5769    {
5770      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5771        "ContainsNoImages","`%s'",wand->name);
5772      return(0.0);
5773    }
5774  return(GetImageTotalInkDensity(wand->images,wand->exception));
5775}
5776
5777/*
5778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5779%                                                                             %
5780%                                                                             %
5781%                                                                             %
5782%   M a g i c k H a l d C l u t I m a g e                                     %
5783%                                                                             %
5784%                                                                             %
5785%                                                                             %
5786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5787%
5788%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5789%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5790%  dimensions.  Create it with the HALD coder.  You can apply any color
5791%  transformation to the Hald image and then use this method to apply the
5792%  transform to the image.
5793%
5794%  The format of the MagickHaldClutImage method is:
5795%
5796%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5797%        const MagickWand *hald_wand)
5798%
5799%  A description of each parameter follows:
5800%
5801%    o wand: the magick wand.
5802%
5803%    o hald_image: the hald CLUT image.
5804%
5805*/
5806WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5807  const MagickWand *hald_wand)
5808{
5809  MagickBooleanType
5810    status;
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  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5817    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5818  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5819  return(status);
5820}
5821
5822/*
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824%                                                                             %
5825%                                                                             %
5826%                                                                             %
5827%   M a g i c k H a s N e x t I m a g e                                       %
5828%                                                                             %
5829%                                                                             %
5830%                                                                             %
5831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5832%
5833%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5834%  traversing the list in the forward direction
5835%
5836%  The format of the MagickHasNextImage method is:
5837%
5838%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5839%
5840%  A description of each parameter follows:
5841%
5842%    o wand: the magick wand.
5843%
5844*/
5845WandExport MagickBooleanType MagickHasNextImage(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  if (wand->images == (Image *) NULL)
5852    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5853  if (GetNextImageInList(wand->images) == (Image *) NULL)
5854    return(MagickFalse);
5855  return(MagickTrue);
5856}
5857
5858/*
5859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5860%                                                                             %
5861%                                                                             %
5862%                                                                             %
5863%   M a g i c k H a s P r e v i o u s I m a g e                               %
5864%                                                                             %
5865%                                                                             %
5866%                                                                             %
5867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5868%
5869%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5870%  traversing the list in the reverse direction
5871%
5872%  The format of the MagickHasPreviousImage method is:
5873%
5874%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5875%
5876%  A description of each parameter follows:
5877%
5878%    o wand: the magick wand.
5879%
5880*/
5881WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5882{
5883  assert(wand != (MagickWand *) NULL);
5884  assert(wand->signature == WandSignature);
5885  if (IfMagickTrue(wand->debug))
5886    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5887  if (wand->images == (Image *) NULL)
5888    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5889  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5890    return(MagickFalse);
5891  return(MagickTrue);
5892}
5893
5894/*
5895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5896%                                                                             %
5897%                                                                             %
5898%                                                                             %
5899%   M a g i c k I d e n t i f y I m a g e                                     %
5900%                                                                             %
5901%                                                                             %
5902%                                                                             %
5903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5904%
5905%  MagickIdentifyImage() identifies an image by printing its attributes to the
5906%  file.  Attributes include the image width, height, size, and others.
5907%
5908%  The format of the MagickIdentifyImage method is:
5909%
5910%      const char *MagickIdentifyImage(MagickWand *wand)
5911%
5912%  A description of each parameter follows:
5913%
5914%    o wand: the magick wand.
5915%
5916*/
5917WandExport char *MagickIdentifyImage(MagickWand *wand)
5918{
5919  char
5920    *description,
5921    filename[MaxTextExtent];
5922
5923  FILE
5924    *file;
5925
5926  int
5927    unique_file;
5928
5929  assert(wand != (MagickWand *) NULL);
5930  assert(wand->signature == WandSignature);
5931  if (IfMagickTrue(wand->debug))
5932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5933  if (wand->images == (Image *) NULL)
5934    {
5935      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5936        "ContainsNoImages","`%s'",wand->name);
5937      return((char *) NULL);
5938    }
5939  description=(char *) NULL;
5940  unique_file=AcquireUniqueFileResource(filename);
5941  file=(FILE *) NULL;
5942  if (unique_file != -1)
5943    file=fdopen(unique_file,"wb");
5944  if ((unique_file == -1) || (file == (FILE *) NULL))
5945    {
5946      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5947        "UnableToCreateTemporaryFile","`%s'",wand->name);
5948      return((char *) NULL);
5949    }
5950  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5951  (void) fclose(file);
5952  description=FileToString(filename,~0,wand->exception);
5953  (void) RelinquishUniqueFileResource(filename);
5954  return(description);
5955}
5956
5957/*
5958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959%                                                                             %
5960%                                                                             %
5961%                                                                             %
5962%   M a g i c k I m p l o d e I m a g e                                       %
5963%                                                                             %
5964%                                                                             %
5965%                                                                             %
5966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5967%
5968%  MagickImplodeImage() creates a new image that is a copy of an existing
5969%  one with the image pixels "implode" by the specified percentage.  It
5970%  allocates the memory necessary for the new Image structure and returns a
5971%  pointer to the new image.
5972%
5973%  The format of the MagickImplodeImage method is:
5974%
5975%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5976%        const double radius,const PixelInterpolateMethod method)
5977%
5978%  A description of each parameter follows:
5979%
5980%    o wand: the magick wand.
5981%
5982%    o amount: Define the extent of the implosion.
5983%
5984%    o method: the pixel interpolation method.
5985%
5986*/
5987WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5988  const double amount,const PixelInterpolateMethod method)
5989{
5990  Image
5991    *implode_image;
5992
5993  assert(wand != (MagickWand *) NULL);
5994  assert(wand->signature == WandSignature);
5995  if (IfMagickTrue(wand->debug))
5996    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5997  if (wand->images == (Image *) NULL)
5998    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5999  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6000  if (implode_image == (Image *) NULL)
6001    return(MagickFalse);
6002  ReplaceImageInList(&wand->images,implode_image);
6003  return(MagickTrue);
6004}
6005
6006/*
6007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6008%                                                                             %
6009%                                                                             %
6010%                                                                             %
6011%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6012%                                                                             %
6013%                                                                             %
6014%                                                                             %
6015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6016%
6017%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6018%  location you specify.  The method returns MagickFalse on success otherwise
6019%  MagickTrue if an error is encountered.  The pixel data can be either char,
6020%  short int, int, ssize_t, float, or double in the order specified by map.
6021%
6022%  Suppose your want to upload the first scanline of a 640x480 image from
6023%  character data in red-green-blue order:
6024%
6025%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6026%
6027%  The format of the MagickImportImagePixels method is:
6028%
6029%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6030%        const ssize_t x,const ssize_t y,const size_t columns,
6031%        const size_t rows,const char *map,const StorageType storage,
6032%        const void *pixels)
6033%
6034%  A description of each parameter follows:
6035%
6036%    o wand: the magick wand.
6037%
6038%    o x, y, columns, rows:  These values define the perimeter of a region
6039%      of pixels you want to define.
6040%
6041%    o map:  This string reflects the expected ordering of the pixel array.
6042%      It can be any combination or order of R = red, G = green, B = blue,
6043%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6044%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6045%      P = pad.
6046%
6047%    o storage: Define the data type of the pixels.  Float and double types are
6048%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6049%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6050%      or DoublePixel.
6051%
6052%    o pixels: This array of values contain the pixel components as defined by
6053%      map and type.  You must preallocate this array where the expected
6054%      length varies depending on the values of width, height, map, and type.
6055%
6056*/
6057WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6058  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6059  const char *map,const StorageType storage,const void *pixels)
6060{
6061  MagickBooleanType
6062    status;
6063
6064  assert(wand != (MagickWand *) NULL);
6065  assert(wand->signature == WandSignature);
6066  if (IfMagickTrue(wand->debug))
6067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6068  if (wand->images == (Image *) NULL)
6069    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6070  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6071    wand->exception);
6072  return(status);
6073}
6074
6075/*
6076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6077%                                                                             %
6078%                                                                             %
6079%                                                                             %
6080%   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               %
6081%                                                                             %
6082%                                                                             %
6083%                                                                             %
6084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6085%
6086%  MagickInterpolativeResizeImage() resize image using a interpolative
6087%  method.
6088%
6089%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6090%        const size_t columns,const size_t rows,
6091%        const PixelInterpolateMethod method)
6092%
6093%  A description of each parameter follows:
6094%
6095%    o wand: the magick wand.
6096%
6097%    o columns: the number of columns in the scaled image.
6098%
6099%    o rows: the number of rows in the scaled image.
6100%
6101%    o interpolate: the pixel interpolation method.
6102%
6103*/
6104WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6105  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6106{
6107  Image
6108    *resize_image;
6109
6110  assert(wand != (MagickWand *) NULL);
6111  assert(wand->signature == WandSignature);
6112  if (IfMagickTrue(wand->debug))
6113    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6114  if (wand->images == (Image *) NULL)
6115    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6116  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6117    wand->exception);
6118  if (resize_image == (Image *) NULL)
6119    return(MagickFalse);
6120  ReplaceImageInList(&wand->images,resize_image);
6121  return(MagickTrue);
6122}
6123
6124/*
6125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6126%                                                                             %
6127%                                                                             %
6128%                                                                             %
6129%   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       %
6130%                                                                             %
6131%                                                                             %
6132%                                                                             %
6133%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6134%
6135%  MagickInverseFourierTransformImage() implements the inverse discrete
6136%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6137%  imaginary image pair.
6138%
6139%  The format of the MagickInverseFourierTransformImage method is:
6140%
6141%      MagickBooleanType MagickInverseFourierTransformImage(
6142%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6143%        const MagickBooleanType magnitude)
6144%
6145%  A description of each parameter follows:
6146%
6147%    o magnitude_wand: the magnitude or real wand.
6148%
6149%    o phase_wand: the phase or imaginary wand.
6150%
6151%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6152%      imaginary image pair.
6153%
6154*/
6155WandExport MagickBooleanType MagickInverseFourierTransformImage(
6156  MagickWand *magnitude_wand,MagickWand *phase_wand,
6157  const MagickBooleanType magnitude)
6158{
6159  Image
6160    *inverse_image;
6161
6162  MagickWand
6163    *wand;
6164
6165  assert(magnitude_wand != (MagickWand *) NULL);
6166  assert(magnitude_wand->signature == WandSignature);
6167  if (IfMagickTrue(magnitude_wand->debug))
6168    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6169      magnitude_wand->name);
6170  wand=magnitude_wand;
6171  if (magnitude_wand->images == (Image *) NULL)
6172    ThrowWandException(WandError,"ContainsNoImages",
6173      magnitude_wand->name);
6174  assert(phase_wand != (MagickWand *) NULL);
6175  assert(phase_wand->signature == WandSignature);
6176  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6177    phase_wand->images,magnitude,wand->exception);
6178  if (inverse_image == (Image *) NULL)
6179    return(MagickFalse);
6180  ReplaceImageInList(&wand->images,inverse_image);
6181  return(MagickTrue);
6182}
6183
6184/*
6185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6186%                                                                             %
6187%                                                                             %
6188%                                                                             %
6189%   M a g i c k L a b e l I m a g e                                           %
6190%                                                                             %
6191%                                                                             %
6192%                                                                             %
6193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6194%
6195%  MagickLabelImage() adds a label to your image.
6196%
6197%  The format of the MagickLabelImage method is:
6198%
6199%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6200%
6201%  A description of each parameter follows:
6202%
6203%    o wand: the magick wand.
6204%
6205%    o label: the image label.
6206%
6207*/
6208WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6209  const char *label)
6210{
6211  MagickBooleanType
6212    status;
6213
6214  assert(wand != (MagickWand *) NULL);
6215  assert(wand->signature == WandSignature);
6216  if (IfMagickTrue(wand->debug))
6217    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6218  if (wand->images == (Image *) NULL)
6219    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6220  status=SetImageProperty(wand->images,"label",label,wand->exception);
6221  return(status);
6222}
6223
6224/*
6225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6226%                                                                             %
6227%                                                                             %
6228%                                                                             %
6229%   M a g i c k L e v e l I m a g e                                           %
6230%                                                                             %
6231%                                                                             %
6232%                                                                             %
6233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6234%
6235%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6236%  falling between specified white and black points to the full available
6237%  quantum range. The parameters provided represent the black, mid, and white
6238%  points. The black point specifies the darkest color in the image. Colors
6239%  darker than the black point are set to zero. Mid point specifies a gamma
6240%  correction to apply to the image.  White point specifies the lightest color
6241%  in the image. Colors brighter than the white point are set to the maximum
6242%  quantum value.
6243%
6244%  The format of the MagickLevelImage method is:
6245%
6246%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6247%        const double black_point,const double gamma,const double white_point)
6248%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6249%        const ChannelType channel,const double black_point,const double gamma,
6250%        const double white_point)
6251%
6252%  A description of each parameter follows:
6253%
6254%    o wand: the magick wand.
6255%
6256%    o channel: Identify which channel to level: RedPixelChannel,
6257%      GreenPixelChannel, etc.
6258%
6259%    o black_point: the black point.
6260%
6261%    o gamma: the gamma.
6262%
6263%    o white_point: the white point.
6264%
6265*/
6266WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6267  const double black_point,const double gamma,const double white_point)
6268{
6269  MagickBooleanType
6270    status;
6271
6272  assert(wand != (MagickWand *) NULL);
6273  assert(wand->signature == WandSignature);
6274  if (IfMagickTrue(wand->debug))
6275    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6276  if (wand->images == (Image *) NULL)
6277    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6278  status=LevelImage(wand->images,black_point,white_point,gamma,
6279    wand->exception);
6280  return(status);
6281}
6282
6283/*
6284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6285%                                                                             %
6286%                                                                             %
6287%                                                                             %
6288%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6289%                                                                             %
6290%                                                                             %
6291%                                                                             %
6292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6293%
6294%  MagickLinearStretchImage() stretches with saturation the image intensity.
6295%
6296%  You can also reduce the influence of a particular channel with a gamma
6297%  value of 0.
6298%
6299%  The format of the MagickLinearStretchImage method is:
6300%
6301%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6302%        const double black_point,const double white_point)
6303%
6304%  A description of each parameter follows:
6305%
6306%    o wand: the magick wand.
6307%
6308%    o black_point: the black point.
6309%
6310%    o white_point: the white point.
6311%
6312*/
6313WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6314  const double black_point,const double white_point)
6315{
6316  MagickBooleanType
6317    status;
6318
6319  assert(wand != (MagickWand *) NULL);
6320  assert(wand->signature == WandSignature);
6321  if (IfMagickTrue(wand->debug))
6322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6323  if (wand->images == (Image *) NULL)
6324    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6325  status=LinearStretchImage(wand->images,black_point,white_point,
6326    wand->exception);
6327  return(status);
6328}
6329
6330/*
6331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6332%                                                                             %
6333%                                                                             %
6334%                                                                             %
6335%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6336%                                                                             %
6337%                                                                             %
6338%                                                                             %
6339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6340%
6341%  MagickLiquidRescaleImage() rescales image with seam carving.
6342%
6343%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6344%        const size_t columns,const size_t rows,
6345%        const double delta_x,const double rigidity)
6346%
6347%  A description of each parameter follows:
6348%
6349%    o wand: the magick wand.
6350%
6351%    o columns: the number of columns in the scaled image.
6352%
6353%    o rows: the number of rows in the scaled image.
6354%
6355%    o delta_x: maximum seam transversal step (0 means straight seams).
6356%
6357%    o rigidity: introduce a bias for non-straight seams (typically 0).
6358%
6359*/
6360WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6361  const size_t columns,const size_t rows,const double delta_x,
6362  const double rigidity)
6363{
6364  Image
6365    *rescale_image;
6366
6367  assert(wand != (MagickWand *) NULL);
6368  assert(wand->signature == WandSignature);
6369  if (IfMagickTrue(wand->debug))
6370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6371  if (wand->images == (Image *) NULL)
6372    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6373  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6374    rigidity,wand->exception);
6375  if (rescale_image == (Image *) NULL)
6376    return(MagickFalse);
6377  ReplaceImageInList(&wand->images,rescale_image);
6378  return(MagickTrue);
6379}
6380
6381/*
6382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6383%                                                                             %
6384%                                                                             %
6385%                                                                             %
6386%   M a g i c k M a g n i f y I m a g e                                       %
6387%                                                                             %
6388%                                                                             %
6389%                                                                             %
6390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6391%
6392%  MagickMagnifyImage() is a convenience method that scales an image
6393%  proportionally to twice its original size.
6394%
6395%  The format of the MagickMagnifyImage method is:
6396%
6397%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6398%
6399%  A description of each parameter follows:
6400%
6401%    o wand: the magick wand.
6402%
6403*/
6404WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6405{
6406  Image
6407    *magnify_image;
6408
6409  assert(wand != (MagickWand *) NULL);
6410  assert(wand->signature == WandSignature);
6411  if (IfMagickTrue(wand->debug))
6412    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6413  if (wand->images == (Image *) NULL)
6414    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6415  magnify_image=MagnifyImage(wand->images,wand->exception);
6416  if (magnify_image == (Image *) NULL)
6417    return(MagickFalse);
6418  ReplaceImageInList(&wand->images,magnify_image);
6419  return(MagickTrue);
6420}
6421
6422/*
6423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6424%                                                                             %
6425%                                                                             %
6426%                                                                             %
6427%   M a g i c k M e r g e I m a g e L a y e r s                               %
6428%                                                                             %
6429%                                                                             %
6430%                                                                             %
6431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6432%
6433%  MagickMergeImageLayers() composes all the image layers from the current
6434%  given image onward to produce a single image of the merged layers.
6435%
6436%  The inital canvas's size depends on the given LayerMethod, and is
6437%  initialized using the first images background color.  The images
6438%  are then compositied onto that image in sequence using the given
6439%  composition that has been assigned to each individual image.
6440%
6441%  The format of the MagickMergeImageLayers method is:
6442%
6443%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6444%        const LayerMethod method)
6445%
6446%  A description of each parameter follows:
6447%
6448%    o wand: the magick wand.
6449%
6450%    o method: the method of selecting the size of the initial canvas.
6451%
6452%        MergeLayer: Merge all layers onto a canvas just large enough
6453%           to hold all the actual images. The virtual canvas of the
6454%           first image is preserved but otherwise ignored.
6455%
6456%        FlattenLayer: Use the virtual canvas size of first image.
6457%           Images which fall outside this canvas is clipped.
6458%           This can be used to 'fill out' a given virtual canvas.
6459%
6460%        MosaicLayer: Start with the virtual canvas of the first image,
6461%           enlarging left and right edges to contain all images.
6462%           Images with negative offsets will be clipped.
6463%
6464*/
6465WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6466  const LayerMethod method)
6467{
6468  Image
6469    *mosaic_image;
6470
6471  assert(wand != (MagickWand *) NULL);
6472  assert(wand->signature == WandSignature);
6473  if (IfMagickTrue(wand->debug))
6474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6475  if (wand->images == (Image *) NULL)
6476    return((MagickWand *) NULL);
6477  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6478  if (mosaic_image == (Image *) NULL)
6479    return((MagickWand *) NULL);
6480  return(CloneMagickWandFromImages(wand,mosaic_image));
6481}
6482
6483/*
6484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6485%                                                                             %
6486%                                                                             %
6487%                                                                             %
6488%   M a g i c k M i n i f y I m a g e                                         %
6489%                                                                             %
6490%                                                                             %
6491%                                                                             %
6492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6493%
6494%  MagickMinifyImage() is a convenience method that scales an image
6495%  proportionally to one-half its original size
6496%
6497%  The format of the MagickMinifyImage method is:
6498%
6499%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6500%
6501%  A description of each parameter follows:
6502%
6503%    o wand: the magick wand.
6504%
6505*/
6506WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6507{
6508  Image
6509    *minify_image;
6510
6511  assert(wand != (MagickWand *) NULL);
6512  assert(wand->signature == WandSignature);
6513  if (IfMagickTrue(wand->debug))
6514    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6515  if (wand->images == (Image *) NULL)
6516    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6517  minify_image=MinifyImage(wand->images,wand->exception);
6518  if (minify_image == (Image *) NULL)
6519    return(MagickFalse);
6520  ReplaceImageInList(&wand->images,minify_image);
6521  return(MagickTrue);
6522}
6523
6524/*
6525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6526%                                                                             %
6527%                                                                             %
6528%                                                                             %
6529%   M a g i c k M o d u l a t e I m a g e                                     %
6530%                                                                             %
6531%                                                                             %
6532%                                                                             %
6533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6534%
6535%  MagickModulateImage() lets you control the brightness, saturation, and hue
6536%  of an image.  Hue is the percentage of absolute rotation from the current
6537%  position.  For example 50 results in a counter-clockwise rotation of 90
6538%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6539%  both resulting in a rotation of 180 degrees.
6540%
6541%  To increase the color brightness by 20% and decrease the color saturation by
6542%  10% and leave the hue unchanged, use: 120,90,100.
6543%
6544%  The format of the MagickModulateImage method is:
6545%
6546%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6547%        const double brightness,const double saturation,const double hue)
6548%
6549%  A description of each parameter follows:
6550%
6551%    o wand: the magick wand.
6552%
6553%    o brightness: the percent change in brighness.
6554%
6555%    o saturation: the percent change in saturation.
6556%
6557%    o hue: the percent change in hue.
6558%
6559*/
6560WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6561  const double brightness,const double saturation,const double hue)
6562{
6563  char
6564    modulate[MaxTextExtent];
6565
6566  MagickBooleanType
6567    status;
6568
6569  assert(wand != (MagickWand *) NULL);
6570  assert(wand->signature == WandSignature);
6571  if (IfMagickTrue(wand->debug))
6572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6573  if (wand->images == (Image *) NULL)
6574    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6575  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6576    brightness,saturation,hue);
6577  status=ModulateImage(wand->images,modulate,wand->exception);
6578  return(status);
6579}
6580
6581/*
6582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6583%                                                                             %
6584%                                                                             %
6585%                                                                             %
6586%   M a g i c k M o n t a g e I m a g e                                       %
6587%                                                                             %
6588%                                                                             %
6589%                                                                             %
6590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591%
6592%  MagickMontageImage() creates a composite image by combining several
6593%  separate images. The images are tiled on the composite image with the name
6594%  of the image optionally appearing just below the individual tile.
6595%
6596%  The format of the MagickMontageImage method is:
6597%
6598%      MagickWand *MagickMontageImage(MagickWand *wand,
6599%        const DrawingWand drawing_wand,const char *tile_geometry,
6600%        const char *thumbnail_geometry,const MontageMode mode,
6601%        const char *frame)
6602%
6603%  A description of each parameter follows:
6604%
6605%    o wand: the magick wand.
6606%
6607%    o drawing_wand: the drawing wand.  The font name, size, and color are
6608%      obtained from this wand.
6609%
6610%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6611%
6612%    o thumbnail_geometry: Preferred image size and border size of each
6613%      thumbnail (e.g. 120x120+4+3>).
6614%
6615%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6616%
6617%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6618%      The frame color is that of the thumbnail's matte color.
6619%
6620*/
6621WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6622  const DrawingWand *drawing_wand,const char *tile_geometry,
6623  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6624{
6625  char
6626    *font;
6627
6628  Image
6629    *montage_image;
6630
6631  MontageInfo
6632    *montage_info;
6633
6634  PixelWand
6635    *pixel_wand;
6636
6637  assert(wand != (MagickWand *) NULL);
6638  assert(wand->signature == WandSignature);
6639  if (IfMagickTrue(wand->debug))
6640    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6641  if (wand->images == (Image *) NULL)
6642    return((MagickWand *) NULL);
6643  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6644  switch (mode)
6645  {
6646    case FrameMode:
6647    {
6648      (void) CloneString(&montage_info->frame,"15x15+3+3");
6649      montage_info->shadow=MagickTrue;
6650      break;
6651    }
6652    case UnframeMode:
6653    {
6654      montage_info->frame=(char *) NULL;
6655      montage_info->shadow=MagickFalse;
6656      montage_info->border_width=0;
6657      break;
6658    }
6659    case ConcatenateMode:
6660    {
6661      montage_info->frame=(char *) NULL;
6662      montage_info->shadow=MagickFalse;
6663      (void) CloneString(&montage_info->geometry,"+0+0");
6664      montage_info->border_width=0;
6665      break;
6666    }
6667    default:
6668      break;
6669  }
6670  font=DrawGetFont(drawing_wand);
6671  if (font != (char *) NULL)
6672    (void) CloneString(&montage_info->font,font);
6673  if (frame != (char *) NULL)
6674    (void) CloneString(&montage_info->frame,frame);
6675  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6676  pixel_wand=NewPixelWand();
6677  DrawGetFillColor(drawing_wand,pixel_wand);
6678  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6679  DrawGetStrokeColor(drawing_wand,pixel_wand);
6680  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6681  pixel_wand=DestroyPixelWand(pixel_wand);
6682  if (thumbnail_geometry != (char *) NULL)
6683    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6684  if (tile_geometry != (char *) NULL)
6685    (void) CloneString(&montage_info->tile,tile_geometry);
6686  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6687    wand->exception);
6688  montage_info=DestroyMontageInfo(montage_info);
6689  if (montage_image == (Image *) NULL)
6690    return((MagickWand *) NULL);
6691  return(CloneMagickWandFromImages(wand,montage_image));
6692}
6693
6694/*
6695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6696%                                                                             %
6697%                                                                             %
6698%                                                                             %
6699%   M a g i c k M o r p h I m a g e s                                         %
6700%                                                                             %
6701%                                                                             %
6702%                                                                             %
6703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6704%
6705%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6706%  and size are linearly interpolated to give the appearance of a
6707%  meta-morphosis from one image to the next.
6708%
6709%  The format of the MagickMorphImages method is:
6710%
6711%      MagickWand *MagickMorphImages(MagickWand *wand,
6712%        const size_t number_frames)
6713%
6714%  A description of each parameter follows:
6715%
6716%    o wand: the magick wand.
6717%
6718%    o number_frames: the number of in-between images to generate.
6719%
6720*/
6721WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6722  const size_t number_frames)
6723{
6724  Image
6725    *morph_image;
6726
6727  assert(wand != (MagickWand *) NULL);
6728  assert(wand->signature == WandSignature);
6729  if (IfMagickTrue(wand->debug))
6730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6731  if (wand->images == (Image *) NULL)
6732    return((MagickWand *) NULL);
6733  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6734  if (morph_image == (Image *) NULL)
6735    return((MagickWand *) NULL);
6736  return(CloneMagickWandFromImages(wand,morph_image));
6737}
6738
6739/*
6740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6741%                                                                             %
6742%                                                                             %
6743%                                                                             %
6744%   M a g i c k M o r p h o l o g y I m a g e                                 %
6745%                                                                             %
6746%                                                                             %
6747%                                                                             %
6748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6749%
6750%  MagickMorphologyImage() applies a user supplied kernel to the image
6751%  according to the given mophology method.
6752%
6753%  The format of the MagickMorphologyImage method is:
6754%
6755%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6756%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6757%
6758%  A description of each parameter follows:
6759%
6760%    o wand: the magick wand.
6761%
6762%    o method: the morphology method to be applied.
6763%
6764%    o iterations: apply the operation this many times (or no change).
6765%      A value of -1 means loop until no change found.  How this is applied
6766%      may depend on the morphology method.  Typically this is a value of 1.
6767%
6768%    o kernel: An array of doubles representing the morphology kernel.
6769%
6770*/
6771WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6772  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6773{
6774  Image
6775    *morphology_image;
6776
6777  assert(wand != (MagickWand *) NULL);
6778  assert(wand->signature == WandSignature);
6779  if (IfMagickTrue(wand->debug))
6780    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6781  if (kernel == (const KernelInfo *) NULL)
6782    return(MagickFalse);
6783  if (wand->images == (Image *) NULL)
6784    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6785  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6786    wand->exception);
6787  if (morphology_image == (Image *) NULL)
6788    return(MagickFalse);
6789  ReplaceImageInList(&wand->images,morphology_image);
6790  return(MagickTrue);
6791}
6792
6793/*
6794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6795%                                                                             %
6796%                                                                             %
6797%                                                                             %
6798%   M a g i c k M o t i o n B l u r I m a g e                                 %
6799%                                                                             %
6800%                                                                             %
6801%                                                                             %
6802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6803%
6804%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6805%  Gaussian operator of the given radius and standard deviation (sigma).
6806%  For reasonable results, radius should be larger than sigma.  Use a
6807%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6808%  Angle gives the angle of the blurring motion.
6809%
6810%  The format of the MagickMotionBlurImage method is:
6811%
6812%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6813%        const double radius,const double sigma,const double angle)
6814%
6815%  A description of each parameter follows:
6816%
6817%    o wand: the magick wand.
6818%
6819%    o radius: the radius of the Gaussian, in pixels, not counting
6820%      the center pixel.
6821%
6822%    o sigma: the standard deviation of the Gaussian, in pixels.
6823%
6824%    o angle: Apply the effect along this angle.
6825%
6826*/
6827WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6828  const double radius,const double sigma,const double angle)
6829{
6830  Image
6831    *blur_image;
6832
6833  assert(wand != (MagickWand *) NULL);
6834  assert(wand->signature == WandSignature);
6835  if (IfMagickTrue(wand->debug))
6836    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6837  if (wand->images == (Image *) NULL)
6838    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6839  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6840  if (blur_image == (Image *) NULL)
6841    return(MagickFalse);
6842  ReplaceImageInList(&wand->images,blur_image);
6843  return(MagickTrue);
6844}
6845
6846/*
6847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6848%                                                                             %
6849%                                                                             %
6850%                                                                             %
6851%   M a g i c k N e g a t e I m a g e                                         %
6852%                                                                             %
6853%                                                                             %
6854%                                                                             %
6855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6856%
6857%  MagickNegateImage() negates the colors in the reference image.  The
6858%  Grayscale option means that only grayscale values within the image are
6859%  negated.
6860%
6861%  You can also reduce the influence of a particular channel with a gamma
6862%  value of 0.
6863%
6864%  The format of the MagickNegateImage method is:
6865%
6866%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6867%        const MagickBooleanType gray)
6868%
6869%  A description of each parameter follows:
6870%
6871%    o wand: the magick wand.
6872%
6873%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6874%
6875*/
6876WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6877  const MagickBooleanType gray)
6878{
6879  MagickBooleanType
6880    status;
6881
6882  assert(wand != (MagickWand *) NULL);
6883  assert(wand->signature == WandSignature);
6884  if (IfMagickTrue(wand->debug))
6885    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6886  if (wand->images == (Image *) NULL)
6887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6888  status=NegateImage(wand->images,gray,wand->exception);
6889  return(status);
6890}
6891
6892/*
6893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6894%                                                                             %
6895%                                                                             %
6896%                                                                             %
6897%   M a g i c k N e w I m a g e                                               %
6898%                                                                             %
6899%                                                                             %
6900%                                                                             %
6901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6902%
6903%  MagickNewImage() adds a blank image canvas of the specified size and
6904%  background color to the wand.
6905%
6906%  The format of the MagickNewImage method is:
6907%
6908%      MagickBooleanType MagickNewImage(MagickWand *wand,
6909%        const size_t columns,const size_t rows,
6910%        const PixelWand *background)
6911%
6912%  A description of each parameter follows:
6913%
6914%    o wand: the magick wand.
6915%
6916%    o width: the image width.
6917%
6918%    o height: the image height.
6919%
6920%    o background: the image color.
6921%
6922*/
6923WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6924  const size_t height,const PixelWand *background)
6925{
6926  Image
6927    *images;
6928
6929  PixelInfo
6930    pixel;
6931
6932  assert(wand != (MagickWand *) NULL);
6933  assert(wand->signature == WandSignature);
6934  if (IfMagickTrue(wand->debug))
6935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6936  PixelGetMagickColor(background,&pixel);
6937  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6938  if (images == (Image *) NULL)
6939    return(MagickFalse);
6940  return(InsertImageInWand(wand,images));
6941}
6942
6943/*
6944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6945%                                                                             %
6946%                                                                             %
6947%                                                                             %
6948%   M a g i c k N e x t I m a g e                                             %
6949%                                                                             %
6950%                                                                             %
6951%                                                                             %
6952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6953%
6954%  MagickNextImage() sets the next image in the wand as the current image.
6955%
6956%  It is typically used after MagickResetIterator(), after which its first use
6957%  will set the first image as the current image (unless the wand is empty).
6958%
6959%  It will return MagickFalse when no more images are left to be returned
6960%  which happens when the wand is empty, or the current image is the last
6961%  image.
6962%
6963%  When the above condition (end of image list) is reached, the iterator is
6964%  automaticall set so that you can start using MagickPreviousImage() to
6965%  again iterate over the images in the reverse direction, starting with the
6966%  last image (again).  You can jump to this condition immeditally using
6967%  MagickSetLastIterator().
6968%
6969%  The format of the MagickNextImage method is:
6970%
6971%      MagickBooleanType MagickNextImage(MagickWand *wand)
6972%
6973%  A description of each parameter follows:
6974%
6975%    o wand: the magick wand.
6976%
6977*/
6978WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6979{
6980  assert(wand != (MagickWand *) NULL);
6981  assert(wand->signature == WandSignature);
6982  if (IfMagickTrue(wand->debug))
6983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6984  if (wand->images == (Image *) NULL)
6985    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6986  wand->insert_before=MagickFalse; /* Inserts is now appended */
6987  if (IfMagickTrue(wand->image_pending))
6988    {
6989      wand->image_pending=MagickFalse;
6990      return(MagickTrue);
6991    }
6992  if (GetNextImageInList(wand->images) == (Image *) NULL)
6993    {
6994      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
6995      return(MagickFalse);
6996    }
6997  wand->images=GetNextImageInList(wand->images);
6998  return(MagickTrue);
6999}
7000
7001/*
7002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7003%                                                                             %
7004%                                                                             %
7005%                                                                             %
7006%   M a g i c k N o r m a l i z e I m a g e                                   %
7007%                                                                             %
7008%                                                                             %
7009%                                                                             %
7010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7011%
7012%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7013%  the pixels color to span the entire range of colors available
7014%
7015%  You can also reduce the influence of a particular channel with a gamma
7016%  value of 0.
7017%
7018%  The format of the MagickNormalizeImage method is:
7019%
7020%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7021%
7022%  A description of each parameter follows:
7023%
7024%    o wand: the magick wand.
7025%
7026*/
7027WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7028{
7029  MagickBooleanType
7030    status;
7031
7032  assert(wand != (MagickWand *) NULL);
7033  assert(wand->signature == WandSignature);
7034  if (IfMagickTrue(wand->debug))
7035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7036  if (wand->images == (Image *) NULL)
7037    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7038  status=NormalizeImage(wand->images,wand->exception);
7039  return(status);
7040}
7041
7042/*
7043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7044%                                                                             %
7045%                                                                             %
7046%                                                                             %
7047%   M a g i c k O i l P a i n t I m a g e                                     %
7048%                                                                             %
7049%                                                                             %
7050%                                                                             %
7051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7052%
7053%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7054%  painting.  Each pixel is replaced by the most frequent color occurring
7055%  in a circular region defined by radius.
7056%
7057%  The format of the MagickOilPaintImage method is:
7058%
7059%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7060%        const double radius,const double sigma)
7061%
7062%  A description of each parameter follows:
7063%
7064%    o wand: the magick wand.
7065%
7066%    o radius: the radius of the circular neighborhood.
7067%
7068%    o sigma: the standard deviation of the Gaussian, in pixels.
7069%
7070*/
7071WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7072  const double radius,const double sigma)
7073{
7074  Image
7075    *paint_image;
7076
7077  assert(wand != (MagickWand *) NULL);
7078  assert(wand->signature == WandSignature);
7079  if (IfMagickTrue(wand->debug))
7080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7081  if (wand->images == (Image *) NULL)
7082    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7083  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7084  if (paint_image == (Image *) NULL)
7085    return(MagickFalse);
7086  ReplaceImageInList(&wand->images,paint_image);
7087  return(MagickTrue);
7088}
7089
7090/*
7091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092%                                                                             %
7093%                                                                             %
7094%                                                                             %
7095%   M a g i c k O p a q u e P a i n t I m a g e                               %
7096%                                                                             %
7097%                                                                             %
7098%                                                                             %
7099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7100%
7101%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7102%  defined by fill.
7103%
7104%  The format of the MagickOpaquePaintImage method is:
7105%
7106%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7107%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7108%        const MagickBooleanType invert)
7109%
7110%  A description of each parameter follows:
7111%
7112%    o wand: the magick wand.
7113%
7114%    o target: Change this target color to the fill color within the image.
7115%
7116%    o fill: the fill pixel wand.
7117%
7118%    o fuzz: By default target must match a particular pixel color
7119%      exactly.  However, in many cases two colors may differ by a small amount.
7120%      The fuzz member of image defines how much tolerance is acceptable to
7121%      consider two colors as the same.  For example, set fuzz to 10 and the
7122%      color red at intensities of 100 and 102 respectively are now interpreted
7123%      as the same color for the purposes of the floodfill.
7124%
7125%    o invert: paint any pixel that does not match the target color.
7126%
7127*/
7128WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7129  const PixelWand *target,const PixelWand *fill,const double fuzz,
7130  const MagickBooleanType invert)
7131{
7132  MagickBooleanType
7133    status;
7134
7135  PixelInfo
7136    fill_pixel,
7137    target_pixel;
7138
7139  assert(wand != (MagickWand *) NULL);
7140  assert(wand->signature == WandSignature);
7141  if (IfMagickTrue(wand->debug))
7142    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7143  if (wand->images == (Image *) NULL)
7144    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7145  PixelGetMagickColor(target,&target_pixel);
7146  PixelGetMagickColor(fill,&fill_pixel);
7147  wand->images->fuzz=fuzz;
7148  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7149    wand->exception);
7150  return(status);
7151}
7152
7153/*
7154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7155%                                                                             %
7156%                                                                             %
7157%                                                                             %
7158%   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                         %
7159%                                                                             %
7160%                                                                             %
7161%                                                                             %
7162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7163%
7164%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7165%  previous image in the sequence.  From this it attempts to select the
7166%  smallest cropped image to replace each frame, while preserving the results
7167%  of the animation.
7168%
7169%  The format of the MagickOptimizeImageLayers method is:
7170%
7171%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7172%
7173%  A description of each parameter follows:
7174%
7175%    o wand: the magick wand.
7176%
7177*/
7178WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7179{
7180  Image
7181    *optimize_image;
7182
7183  assert(wand != (MagickWand *) NULL);
7184  assert(wand->signature == WandSignature);
7185  if (IfMagickTrue(wand->debug))
7186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7187  if (wand->images == (Image *) NULL)
7188    return((MagickWand *) NULL);
7189  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7190  if (optimize_image == (Image *) NULL)
7191    return((MagickWand *) NULL);
7192  return(CloneMagickWandFromImages(wand,optimize_image));
7193}
7194
7195/*
7196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7197%                                                                             %
7198%                                                                             %
7199%                                                                             %
7200%   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             %
7201%                                                                             %
7202%                                                                             %
7203%                                                                             %
7204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7205%
7206%  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7207%  compares the overlayed pixels against the disposal image resulting from all
7208%  the previous frames in the animation.  Any pixel that does not change the
7209%  disposal image (and thus does not effect the outcome of an overlay) is made
7210%  transparent.
7211%
7212%  WARNING: This modifies the current images directly, rather than generate
7213%  a new image sequence.
7214%  The format of the MagickOptimizeImageTransparency method is:
7215%
7216%      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7217%
7218%  A description of each parameter follows:
7219%
7220%    o wand: the magick wand.
7221%
7222*/
7223WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7224{
7225  assert(wand != (MagickWand *) NULL);
7226  assert(wand->signature == WandSignature);
7227  if (IfMagickTrue(wand->debug))
7228    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7229  if (wand->images == (Image *) NULL)
7230    return(MagickFalse);
7231  OptimizeImageTransparency(wand->images,wand->exception);
7232  return(MagickTrue);
7233}
7234
7235/*
7236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7237%                                                                             %
7238%                                                                             %
7239%                                                                             %
7240%     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                   %
7241%                                                                             %
7242%                                                                             %
7243%                                                                             %
7244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7245%
7246%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7247%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7248%  which can be different for different channels, according to the input
7249%  arguments.
7250%
7251%  The format of the MagickOrderedPosterizeImage method is:
7252%
7253%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7254%        const char *threshold_map)
7255%
7256%  A description of each parameter follows:
7257%
7258%    o image: the image.
7259%
7260%    o threshold_map: A string containing the name of the threshold dither
7261%      map to use, followed by zero or more numbers representing the number of
7262%      color levels tho dither between.
7263%
7264%      Any level number less than 2 is equivalent to 2, and means only binary
7265%      dithering will be applied to each color channel.
7266%
7267%      No numbers also means a 2 level (bitmap) dither will be applied to all
7268%      channels, while a single number is the number of levels applied to each
7269%      channel in sequence.  More numbers will be applied in turn to each of
7270%      the color channels.
7271%
7272%      For example: "o3x3,6" generates a 6 level posterization of the image
7273%      with a ordered 3x3 diffused pixel dither being applied between each
7274%      level. While checker,8,8,4 will produce a 332 colormaped image with
7275%      only a single checkerboard hash pattern (50% grey) between each color
7276%      level, to basically double the number of color levels with a bare
7277%      minimim of dithering.
7278%
7279*/
7280WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7281  const char *threshold_map)
7282{
7283  MagickBooleanType
7284    status;
7285
7286  assert(wand != (MagickWand *) NULL);
7287  assert(wand->signature == WandSignature);
7288  if (IfMagickTrue(wand->debug))
7289    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7290  if (wand->images == (Image *) NULL)
7291    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7292  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7293  return(status);
7294}
7295
7296/*
7297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298%                                                                             %
7299%                                                                             %
7300%                                                                             %
7301%   M a g i c k P i n g I m a g e                                             %
7302%                                                                             %
7303%                                                                             %
7304%                                                                             %
7305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7306%
7307%  MagickPingImage() is the same as MagickReadImage() except the only valid
7308%  information returned is the image width, height, size, and format.  It
7309%  is designed to efficiently obtain this information from a file without
7310%  reading the entire image sequence into memory.
7311%
7312%  The format of the MagickPingImage method is:
7313%
7314%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7315%
7316%  A description of each parameter follows:
7317%
7318%    o wand: the magick wand.
7319%
7320%    o filename: the image filename.
7321%
7322*/
7323WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7324  const char *filename)
7325{
7326  Image
7327    *images;
7328
7329  ImageInfo
7330    *ping_info;
7331
7332  assert(wand != (MagickWand *) NULL);
7333  assert(wand->signature == WandSignature);
7334  if (IfMagickTrue(wand->debug))
7335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7336  ping_info=CloneImageInfo(wand->image_info);
7337  if (filename != (const char *) NULL)
7338    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7339  images=PingImage(ping_info,wand->exception);
7340  ping_info=DestroyImageInfo(ping_info);
7341  if (images == (Image *) NULL)
7342    return(MagickFalse);
7343  return(InsertImageInWand(wand,images));
7344}
7345
7346/*
7347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7348%                                                                             %
7349%                                                                             %
7350%                                                                             %
7351%   M a g i c k P i n g I m a g e B l o b                                     %
7352%                                                                             %
7353%                                                                             %
7354%                                                                             %
7355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7356%
7357%  MagickPingImageBlob() pings an image or image sequence from a blob.
7358%
7359%  The format of the MagickPingImageBlob method is:
7360%
7361%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7362%        const void *blob,const size_t length)
7363%
7364%  A description of each parameter follows:
7365%
7366%    o wand: the magick wand.
7367%
7368%    o blob: the blob.
7369%
7370%    o length: the blob length.
7371%
7372*/
7373WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7374  const void *blob,const size_t length)
7375{
7376  Image
7377    *images;
7378
7379  ImageInfo
7380    *read_info;
7381
7382  assert(wand != (MagickWand *) NULL);
7383  assert(wand->signature == WandSignature);
7384  if (IfMagickTrue(wand->debug))
7385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7386  read_info=CloneImageInfo(wand->image_info);
7387  SetImageInfoBlob(read_info,blob,length);
7388  images=PingImage(read_info,wand->exception);
7389  read_info=DestroyImageInfo(read_info);
7390  if (images == (Image *) NULL)
7391    return(MagickFalse);
7392  return(InsertImageInWand(wand,images));
7393}
7394
7395/*
7396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7397%                                                                             %
7398%                                                                             %
7399%                                                                             %
7400%   M a g i c k P i n g I m a g e F i l e                                     %
7401%                                                                             %
7402%                                                                             %
7403%                                                                             %
7404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7405%
7406%  MagickPingImageFile() pings an image or image sequence from an open file
7407%  descriptor.
7408%
7409%  The format of the MagickPingImageFile method is:
7410%
7411%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7412%
7413%  A description of each parameter follows:
7414%
7415%    o wand: the magick wand.
7416%
7417%    o file: the file descriptor.
7418%
7419*/
7420WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7421{
7422  Image
7423    *images;
7424
7425  ImageInfo
7426    *read_info;
7427
7428  assert(wand != (MagickWand *) NULL);
7429  assert(wand->signature == WandSignature);
7430  assert(file != (FILE *) NULL);
7431  if (IfMagickTrue(wand->debug))
7432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7433  read_info=CloneImageInfo(wand->image_info);
7434  SetImageInfoFile(read_info,file);
7435  images=PingImage(read_info,wand->exception);
7436  read_info=DestroyImageInfo(read_info);
7437  if (images == (Image *) NULL)
7438    return(MagickFalse);
7439  return(InsertImageInWand(wand,images));
7440}
7441
7442/*
7443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7444%                                                                             %
7445%                                                                             %
7446%                                                                             %
7447%   M a g i c k P o l a r o i d I m a g e                                     %
7448%                                                                             %
7449%                                                                             %
7450%                                                                             %
7451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7452%
7453%  MagickPolaroidImage() simulates a Polaroid picture.
7454%
7455%  The format of the MagickPolaroidImage method is:
7456%
7457%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7458%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7459%        const PixelInterpolateMethod method)
7460%
7461%  A description of each parameter follows:
7462%
7463%    o wand: the magick wand.
7464%
7465%    o drawing_wand: the draw wand.
7466%
7467%    o caption: the Polaroid caption.
7468%
7469%    o angle: Apply the effect along this angle.
7470%
7471%    o method: the pixel interpolation method.
7472%
7473*/
7474WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7475  const DrawingWand *drawing_wand,const char *caption,const double angle,
7476  const PixelInterpolateMethod method)
7477{
7478  DrawInfo
7479    *draw_info;
7480
7481  Image
7482    *polaroid_image;
7483
7484  assert(wand != (MagickWand *) NULL);
7485  assert(wand->signature == WandSignature);
7486  if (IfMagickTrue(wand->debug))
7487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7488  if (wand->images == (Image *) NULL)
7489    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7490  draw_info=PeekDrawingWand(drawing_wand);
7491  if (draw_info == (DrawInfo *) NULL)
7492    return(MagickFalse);
7493  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7494    wand->exception);
7495  if (polaroid_image == (Image *) NULL)
7496    return(MagickFalse);
7497  ReplaceImageInList(&wand->images,polaroid_image);
7498  return(MagickTrue);
7499}
7500
7501/*
7502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7503%                                                                             %
7504%                                                                             %
7505%                                                                             %
7506%   M a g i c k P o s t e r i z e I m a g e                                   %
7507%                                                                             %
7508%                                                                             %
7509%                                                                             %
7510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7511%
7512%  MagickPosterizeImage() reduces the image to a limited number of color level.
7513%
7514%  The format of the MagickPosterizeImage method is:
7515%
7516%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7517%        const size_t levels,const DitherMethod method)
7518%
7519%  A description of each parameter follows:
7520%
7521%    o wand: the magick wand.
7522%
7523%    o levels: Number of color levels allowed in each channel.  Very low values
7524%      (2, 3, or 4) have the most visible effect.
7525%
7526%    o method: choose the dither method: UndefinedDitherMethod,
7527%      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7528%
7529*/
7530WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7531  const size_t levels,const DitherMethod dither)
7532{
7533  MagickBooleanType
7534    status;
7535
7536  assert(wand != (MagickWand *) NULL);
7537  assert(wand->signature == WandSignature);
7538  if (IfMagickTrue(wand->debug))
7539    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7540  if (wand->images == (Image *) NULL)
7541    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7542  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7543  return(status);
7544}
7545
7546/*
7547%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7548%                                                                             %
7549%                                                                             %
7550%                                                                             %
7551%   M a g i c k P r e v i e w I m a g e s                                     %
7552%                                                                             %
7553%                                                                             %
7554%                                                                             %
7555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7556%
7557%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7558%  image processing operation applied at varying strengths.  This helpful
7559%  to quickly pin-point an appropriate parameter for an image processing
7560%  operation.
7561%
7562%  The format of the MagickPreviewImages method is:
7563%
7564%      MagickWand *MagickPreviewImages(MagickWand *wand,
7565%        const PreviewType preview)
7566%
7567%  A description of each parameter follows:
7568%
7569%    o wand: the magick wand.
7570%
7571%    o preview: the preview type.
7572%
7573*/
7574WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7575  const PreviewType preview)
7576{
7577  Image
7578    *preview_image;
7579
7580  assert(wand != (MagickWand *) NULL);
7581  assert(wand->signature == WandSignature);
7582  if (IfMagickTrue(wand->debug))
7583    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7584  if (wand->images == (Image *) NULL)
7585    return((MagickWand *) NULL);
7586  preview_image=PreviewImage(wand->images,preview,wand->exception);
7587  if (preview_image == (Image *) NULL)
7588    return((MagickWand *) NULL);
7589  return(CloneMagickWandFromImages(wand,preview_image));
7590}
7591
7592/*
7593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7594%                                                                             %
7595%                                                                             %
7596%                                                                             %
7597%   M a g i c k P r e v i o u s I m a g e                                     %
7598%                                                                             %
7599%                                                                             %
7600%                                                                             %
7601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7602%
7603%  MagickPreviousImage() sets the previous image in the wand as the current
7604%  image.
7605%
7606%  It is typically used after MagickSetLastIterator(), after which its first
7607%  use will set the last image as the current image (unless the wand is empty).
7608%
7609%  It will return MagickFalse when no more images are left to be returned
7610%  which happens when the wand is empty, or the current image is the first
7611%  image.  At that point the iterator is than reset to again process images in
7612%  the forward direction, again starting with the first image in list. Images
7613%  added at this point are prepended.
7614%
7615%  Also at that point any images added to the wand using MagickAddImages() or
7616%  MagickReadImages() will be prepended before the first image. In this sense
7617%  the condition is not quite exactly the same as MagickResetIterator().
7618%
7619%  The format of the MagickPreviousImage method is:
7620%
7621%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7622%
7623%  A description of each parameter follows:
7624%
7625%    o wand: the magick wand.
7626%
7627*/
7628WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7629{
7630  assert(wand != (MagickWand *) NULL);
7631  assert(wand->signature == WandSignature);
7632  if (IfMagickTrue(wand->debug))
7633    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7634  if (wand->images == (Image *) NULL)
7635    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7636  if (IfMagickTrue(wand->image_pending))
7637    {
7638      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7639      return(MagickTrue);
7640    }
7641  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7642    {
7643      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7644      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7645      return(MagickFalse);
7646    }
7647  wand->images=GetPreviousImageInList(wand->images);
7648  return(MagickTrue);
7649}
7650
7651/*
7652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7653%                                                                             %
7654%                                                                             %
7655%                                                                             %
7656%   M a g i c k Q u a n t i z e I m a g e                                     %
7657%                                                                             %
7658%                                                                             %
7659%                                                                             %
7660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7661%
7662%  MagickQuantizeImage() analyzes the colors within a reference image and
7663%  chooses a fixed number of colors to represent the image.  The goal of the
7664%  algorithm is to minimize the color difference between the input and output
7665%  image while minimizing the processing time.
7666%
7667%  The format of the MagickQuantizeImage method is:
7668%
7669%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7670%        const size_t number_colors,const ColorspaceType colorspace,
7671%        const size_t treedepth,const DitherMethod dither_method,
7672%        const MagickBooleanType measure_error)
7673%
7674%  A description of each parameter follows:
7675%
7676%    o wand: the magick wand.
7677%
7678%    o number_colors: the number of colors.
7679%
7680%    o colorspace: Perform color reduction in this colorspace, typically
7681%      RGBColorspace.
7682%
7683%    o treedepth: Normally, this integer value is zero or one.  A zero or
7684%      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
7685%      reference image with the least amount of memory and the fastest
7686%      computational speed.  In some cases, such as an image with low color
7687%      dispersion (a few number of colors), a value other than
7688%      Log4(number_colors) is required.  To expand the color tree completely,
7689%      use a value of 8.
7690%
7691%    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7692%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7693%
7694%    o measure_error: A value other than zero measures the difference between
7695%      the original and quantized images.  This difference is the total
7696%      quantization error.  The error is computed by summing over all pixels
7697%      in an image the distance squared in RGB space between each reference
7698%      pixel value and its quantized value.
7699%
7700*/
7701WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7702  const size_t number_colors,const ColorspaceType colorspace,
7703  const size_t treedepth,const DitherMethod dither_method,
7704  const MagickBooleanType measure_error)
7705{
7706  MagickBooleanType
7707    status;
7708
7709  QuantizeInfo
7710    *quantize_info;
7711
7712  assert(wand != (MagickWand *) NULL);
7713  assert(wand->signature == WandSignature);
7714  if (IfMagickTrue(wand->debug))
7715    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7716  if (wand->images == (Image *) NULL)
7717    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7718  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7719  quantize_info->number_colors=number_colors;
7720  quantize_info->dither_method=dither_method;
7721  quantize_info->tree_depth=treedepth;
7722  quantize_info->colorspace=colorspace;
7723  quantize_info->measure_error=measure_error;
7724  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7725  quantize_info=DestroyQuantizeInfo(quantize_info);
7726  return(status);
7727}
7728
7729/*
7730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7731%                                                                             %
7732%                                                                             %
7733%                                                                             %
7734%   M a g i c k Q u a n t i z e I m a g e s                                   %
7735%                                                                             %
7736%                                                                             %
7737%                                                                             %
7738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7739%
7740%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7741%  chooses a fixed number of colors to represent the image.  The goal of the
7742%  algorithm is to minimize the color difference between the input and output
7743%  image while minimizing the processing time.
7744%
7745%  The format of the MagickQuantizeImages method is:
7746%
7747%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7748%        const size_t number_colors,const ColorspaceType colorspace,
7749%        const size_t treedepth,const DitherMethod dither_method,
7750%        const MagickBooleanType measure_error)
7751%
7752%  A description of each parameter follows:
7753%
7754%    o wand: the magick wand.
7755%
7756%    o number_colors: the number of colors.
7757%
7758%    o colorspace: Perform color reduction in this colorspace, typically
7759%      RGBColorspace.
7760%
7761%    o treedepth: Normally, this integer value is zero or one.  A zero or
7762%      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
7763%      reference image with the least amount of memory and the fastest
7764%      computational speed.  In some cases, such as an image with low color
7765%      dispersion (a few number of colors), a value other than
7766%      Log4(number_colors) is required.  To expand the color tree completely,
7767%      use a value of 8.
7768%
7769%    o dither_method: choose from these dither methods: NoDitherMethod,
7770%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7771%
7772%    o measure_error: A value other than zero measures the difference between
7773%      the original and quantized images.  This difference is the total
7774%      quantization error.  The error is computed by summing over all pixels
7775%      in an image the distance squared in RGB space between each reference
7776%      pixel value and its quantized value.
7777%
7778*/
7779WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7780  const size_t number_colors,const ColorspaceType colorspace,
7781  const size_t treedepth,const DitherMethod dither_method,
7782  const MagickBooleanType measure_error)
7783{
7784  MagickBooleanType
7785    status;
7786
7787  QuantizeInfo
7788    *quantize_info;
7789
7790  assert(wand != (MagickWand *) NULL);
7791  assert(wand->signature == WandSignature);
7792  if (IfMagickTrue(wand->debug))
7793    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7794  if (wand->images == (Image *) NULL)
7795    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7796  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7797  quantize_info->number_colors=number_colors;
7798  quantize_info->dither_method=dither_method;
7799  quantize_info->tree_depth=treedepth;
7800  quantize_info->colorspace=colorspace;
7801  quantize_info->measure_error=measure_error;
7802  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7803  quantize_info=DestroyQuantizeInfo(quantize_info);
7804  return(status);
7805}
7806
7807/*
7808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7809%                                                                             %
7810%                                                                             %
7811%                                                                             %
7812%   M a g i c k R a d i a l B l u r I m a g e                                 %
7813%                                                                             %
7814%                                                                             %
7815%                                                                             %
7816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7817%
7818%  MagickRadialBlurImage() radial blurs an image.
7819%
7820%  The format of the MagickRadialBlurImage method is:
7821%
7822%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7823%        const double angle)
7824%
7825%  A description of each parameter follows:
7826%
7827%    o wand: the magick wand.
7828%
7829%    o angle: the angle of the blur in degrees.
7830%
7831*/
7832WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7833  const double angle)
7834{
7835  Image
7836    *blur_image;
7837
7838  assert(wand != (MagickWand *) NULL);
7839  assert(wand->signature == WandSignature);
7840  if (IfMagickTrue(wand->debug))
7841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7842  if (wand->images == (Image *) NULL)
7843    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7844  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7845  if (blur_image == (Image *) NULL)
7846    return(MagickFalse);
7847  ReplaceImageInList(&wand->images,blur_image);
7848  return(MagickTrue);
7849}
7850
7851/*
7852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7853%                                                                             %
7854%                                                                             %
7855%                                                                             %
7856%   M a g i c k R a i s e I m a g e                                           %
7857%                                                                             %
7858%                                                                             %
7859%                                                                             %
7860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7861%
7862%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7863%  by lightening and darkening the edges of the image.  Members width and
7864%  height of raise_info define the width of the vertical and horizontal
7865%  edge of the effect.
7866%
7867%  The format of the MagickRaiseImage method is:
7868%
7869%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7870%        const size_t width,const size_t height,const ssize_t x,
7871%        const ssize_t y,const MagickBooleanType raise)
7872%
7873%  A description of each parameter follows:
7874%
7875%    o wand: the magick wand.
7876%
7877%    o width,height,x,y:  Define the dimensions of the area to raise.
7878%
7879%    o raise: A value other than zero creates a 3-D raise effect,
7880%      otherwise it has a lowered effect.
7881%
7882*/
7883WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7884  const size_t width,const size_t height,const ssize_t x,
7885  const ssize_t y,const MagickBooleanType raise)
7886{
7887  MagickBooleanType
7888    status;
7889
7890  RectangleInfo
7891    raise_info;
7892
7893  assert(wand != (MagickWand *) NULL);
7894  assert(wand->signature == WandSignature);
7895  if (IfMagickTrue(wand->debug))
7896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7897  if (wand->images == (Image *) NULL)
7898    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7899  raise_info.width=width;
7900  raise_info.height=height;
7901  raise_info.x=x;
7902  raise_info.y=y;
7903  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7904  return(status);
7905}
7906
7907/*
7908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7909%                                                                             %
7910%                                                                             %
7911%                                                                             %
7912%   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                       %
7913%                                                                             %
7914%                                                                             %
7915%                                                                             %
7916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7917%
7918%  MagickRandomThresholdImage() changes the value of individual pixels based on
7919%  the intensity of each pixel compared to threshold.  The result is a
7920%  high-contrast, two color image.
7921%
7922%  The format of the MagickRandomThresholdImage method is:
7923%
7924%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7925%        const double low,const double high)
7926%
7927%  A description of each parameter follows:
7928%
7929%    o wand: the magick wand.
7930%
7931%    o low,high: Specify the high and low thresholds.  These values range from
7932%      0 to QuantumRange.
7933%
7934*/
7935WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7936  const double low,const double high)
7937{
7938  char
7939    threshold[MaxTextExtent];
7940
7941  assert(wand != (MagickWand *) NULL);
7942  assert(wand->signature == WandSignature);
7943  if (IfMagickTrue(wand->debug))
7944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7945  if (wand->images == (Image *) NULL)
7946    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7947  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7948  return(RandomThresholdImage(wand->images,threshold,wand->exception));
7949}
7950
7951/*
7952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7953%                                                                             %
7954%                                                                             %
7955%                                                                             %
7956%   M a g i c k R e a d I m a g e                                             %
7957%                                                                             %
7958%                                                                             %
7959%                                                                             %
7960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7961%
7962%  MagickReadImage() reads an image or image sequence.  The images are inserted
7963%  jjust before the current image pointer position.
7964%
7965%  Use MagickSetFirstIterator(), to insert new images before all the current
7966%  images in the wand, MagickSetLastIterator() to append add to the end,
7967%  MagickSetImageIndex() to place images just after the given index.
7968%
7969%  The format of the MagickReadImage method is:
7970%
7971%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7972%
7973%  A description of each parameter follows:
7974%
7975%    o wand: the magick wand.
7976%
7977%    o filename: the image filename.
7978%
7979*/
7980WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7981  const char *filename)
7982{
7983  Image
7984    *images;
7985
7986  ImageInfo
7987    *read_info;
7988
7989  assert(wand != (MagickWand *) NULL);
7990  assert(wand->signature == WandSignature);
7991  if (IfMagickTrue(wand->debug))
7992    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7993  read_info=CloneImageInfo(wand->image_info);
7994  if (filename != (const char *) NULL)
7995    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7996  images=ReadImage(read_info,wand->exception);
7997  read_info=DestroyImageInfo(read_info);
7998  if (images == (Image *) NULL)
7999    return(MagickFalse);
8000  return(InsertImageInWand(wand,images));
8001}
8002
8003/*
8004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8005%                                                                             %
8006%                                                                             %
8007%                                                                             %
8008%   M a g i c k R e a d I m a g e B l o b                                     %
8009%                                                                             %
8010%                                                                             %
8011%                                                                             %
8012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8013%
8014%  MagickReadImageBlob() reads an image or image sequence from a blob.
8015%  In all other respects it is like MagickReadImage().
8016%
8017%  The format of the MagickReadImageBlob method is:
8018%
8019%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8020%        const void *blob,const size_t length)
8021%
8022%  A description of each parameter follows:
8023%
8024%    o wand: the magick wand.
8025%
8026%    o blob: the blob.
8027%
8028%    o length: the blob length.
8029%
8030*/
8031WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8032  const void *blob,const size_t length)
8033{
8034  Image
8035    *images;
8036
8037  assert(wand != (MagickWand *) NULL);
8038  assert(wand->signature == WandSignature);
8039  if (IfMagickTrue(wand->debug))
8040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8041  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8042  if (images == (Image *) NULL)
8043    return(MagickFalse);
8044  return(InsertImageInWand(wand,images));
8045}
8046
8047/*
8048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8049%                                                                             %
8050%                                                                             %
8051%                                                                             %
8052%   M a g i c k R e a d I m a g e F i l e                                     %
8053%                                                                             %
8054%                                                                             %
8055%                                                                             %
8056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8057%
8058%  MagickReadImageFile() reads an image or image sequence from an already
8059%  opened file descriptor.  Otherwise it is like MagickReadImage().
8060%
8061%  The format of the MagickReadImageFile method is:
8062%
8063%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8064%
8065%  A description of each parameter follows:
8066%
8067%    o wand: the magick wand.
8068%
8069%    o file: the file descriptor.
8070%
8071*/
8072WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8073{
8074  Image
8075    *images;
8076
8077  ImageInfo
8078    *read_info;
8079
8080  assert(wand != (MagickWand *) NULL);
8081  assert(wand->signature == WandSignature);
8082  assert(file != (FILE *) NULL);
8083  if (IfMagickTrue(wand->debug))
8084    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8085  read_info=CloneImageInfo(wand->image_info);
8086  SetImageInfoFile(read_info,file);
8087  images=ReadImage(read_info,wand->exception);
8088  read_info=DestroyImageInfo(read_info);
8089  if (images == (Image *) NULL)
8090    return(MagickFalse);
8091  return(InsertImageInWand(wand,images));
8092}
8093
8094/*
8095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8096%                                                                             %
8097%                                                                             %
8098%                                                                             %
8099%   M a g i c k R e m a p I m a g e                                           %
8100%                                                                             %
8101%                                                                             %
8102%                                                                             %
8103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8104%
8105%  MagickRemapImage() replaces the colors of an image with the closest color
8106%  from a reference image.
8107%
8108%  The format of the MagickRemapImage method is:
8109%
8110%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8111%        const MagickWand *remap_wand,const DitherMethod method)
8112%
8113%  A description of each parameter follows:
8114%
8115%    o wand: the magick wand.
8116%
8117%    o affinity: the affinity wand.
8118%
8119%    o method: choose from these dither methods: NoDitherMethod,
8120%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8121%
8122*/
8123WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8124  const MagickWand *remap_wand,const DitherMethod dither_method)
8125{
8126  MagickBooleanType
8127    status;
8128
8129  QuantizeInfo
8130    *quantize_info;
8131
8132  assert(wand != (MagickWand *) NULL);
8133  assert(wand->signature == WandSignature);
8134  if (IfMagickTrue(wand->debug))
8135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8136  if ((wand->images == (Image *) NULL) ||
8137      (remap_wand->images == (Image *) NULL))
8138    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8139  quantize_info=AcquireQuantizeInfo(wand->image_info);
8140  quantize_info->dither_method=dither_method;
8141  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8142    wand->exception);
8143  quantize_info=DestroyQuantizeInfo(quantize_info);
8144  return(status);
8145}
8146
8147/*
8148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8149%                                                                             %
8150%                                                                             %
8151%                                                                             %
8152%   M a g i c k R e m o v e I m a g e                                         %
8153%                                                                             %
8154%                                                                             %
8155%                                                                             %
8156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8157%
8158%  MagickRemoveImage() removes an image from the image list.
8159%
8160%  The format of the MagickRemoveImage method is:
8161%
8162%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8163%
8164%  A description of each parameter follows:
8165%
8166%    o wand: the magick wand.
8167%
8168%    o insert: the splice wand.
8169%
8170*/
8171WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8172{
8173  assert(wand != (MagickWand *) NULL);
8174  assert(wand->signature == WandSignature);
8175  if (IfMagickTrue(wand->debug))
8176    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8177  if (wand->images == (Image *) NULL)
8178    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8179  DeleteImageFromList(&wand->images);
8180  return(MagickTrue);
8181}
8182
8183/*
8184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185%                                                                             %
8186%                                                                             %
8187%                                                                             %
8188%   M a g i c k R e s a m p l e I m a g e                                     %
8189%                                                                             %
8190%                                                                             %
8191%                                                                             %
8192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8193%
8194%  MagickResampleImage() resample image to desired resolution.
8195%
8196%    Bessel   Blackman   Box
8197%    Catrom   Cubic      Gaussian
8198%    Hanning  Hermite    Lanczos
8199%    Mitchell Point      Quandratic
8200%    Sinc     Triangle
8201%
8202%  Most of the filters are FIR (finite impulse response), however, Bessel,
8203%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8204%  are windowed (brought down to zero) with the Blackman filter.
8205%
8206%  The format of the MagickResampleImage method is:
8207%
8208%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8209%        const double x_resolution,const double y_resolution,
8210%        const FilterTypes filter)
8211%
8212%  A description of each parameter follows:
8213%
8214%    o wand: the magick wand.
8215%
8216%    o x_resolution: the new image x resolution.
8217%
8218%    o y_resolution: the new image y resolution.
8219%
8220%    o filter: Image filter to use.
8221%
8222*/
8223WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8224  const double x_resolution,const double y_resolution,const FilterTypes filter)
8225{
8226  Image
8227    *resample_image;
8228
8229  assert(wand != (MagickWand *) NULL);
8230  assert(wand->signature == WandSignature);
8231  if (IfMagickTrue(wand->debug))
8232    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8233  if (wand->images == (Image *) NULL)
8234    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8235  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8236    wand->exception);
8237  if (resample_image == (Image *) NULL)
8238    return(MagickFalse);
8239  ReplaceImageInList(&wand->images,resample_image);
8240  return(MagickTrue);
8241}
8242
8243/*
8244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8245%                                                                             %
8246%                                                                             %
8247%                                                                             %
8248%   M a g i c k R e s e t I m a g e P a g e                                   %
8249%                                                                             %
8250%                                                                             %
8251%                                                                             %
8252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8253%
8254%  MagickResetImagePage() resets the Wand page canvas and position.
8255%
8256%  The format of the MagickResetImagePage method is:
8257%
8258%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8259%        const char *page)
8260%
8261%  A description of each parameter follows:
8262%
8263%    o wand: the magick wand.
8264%
8265%    o page: the relative page specification.
8266%
8267*/
8268WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8269  const char *page)
8270{
8271  assert(wand != (MagickWand *) NULL);
8272  assert(wand->signature == WandSignature);
8273  if (IfMagickTrue(wand->debug))
8274    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8275  if (wand->images == (Image *) NULL)
8276    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8277  if ((page == (char *) NULL) || (*page == '\0'))
8278    {
8279      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8280      return(MagickTrue);
8281    }
8282  return(ResetImagePage(wand->images,page));
8283}
8284
8285/*
8286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8287%                                                                             %
8288%                                                                             %
8289%                                                                             %
8290%   M a g i c k R e s i z e I m a g e                                         %
8291%                                                                             %
8292%                                                                             %
8293%                                                                             %
8294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8295%
8296%  MagickResizeImage() scales an image to the desired dimensions with one of
8297%  these filters:
8298%
8299%    Bessel   Blackman   Box
8300%    Catrom   Cubic      Gaussian
8301%    Hanning  Hermite    Lanczos
8302%    Mitchell Point      Quandratic
8303%    Sinc     Triangle
8304%
8305%  Most of the filters are FIR (finite impulse response), however, Bessel,
8306%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8307%  are windowed (brought down to zero) with the Blackman filter.
8308%
8309%  The format of the MagickResizeImage method is:
8310%
8311%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8312%        const size_t columns,const size_t rows,const FilterTypes filter)
8313%
8314%  A description of each parameter follows:
8315%
8316%    o wand: the magick wand.
8317%
8318%    o columns: the number of columns in the scaled image.
8319%
8320%    o rows: the number of rows in the scaled image.
8321%
8322%    o filter: Image filter to use.
8323%
8324*/
8325WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8326  const size_t columns,const size_t rows,const FilterTypes filter)
8327{
8328  Image
8329    *resize_image;
8330
8331  assert(wand != (MagickWand *) NULL);
8332  assert(wand->signature == WandSignature);
8333  if (IfMagickTrue(wand->debug))
8334    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8335  if (wand->images == (Image *) NULL)
8336    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8337  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8338  if (resize_image == (Image *) NULL)
8339    return(MagickFalse);
8340  ReplaceImageInList(&wand->images,resize_image);
8341  return(MagickTrue);
8342}
8343
8344/*
8345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8346%                                                                             %
8347%                                                                             %
8348%                                                                             %
8349%   M a g i c k R o l l I m a g e                                             %
8350%                                                                             %
8351%                                                                             %
8352%                                                                             %
8353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8354%
8355%  MagickRollImage() offsets an image as defined by x and y.
8356%
8357%  The format of the MagickRollImage method is:
8358%
8359%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8360%        const size_t y)
8361%
8362%  A description of each parameter follows:
8363%
8364%    o wand: the magick wand.
8365%
8366%    o x: the x offset.
8367%
8368%    o y: the y offset.
8369%
8370%
8371*/
8372WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8373  const ssize_t x,const ssize_t y)
8374{
8375  Image
8376    *roll_image;
8377
8378  assert(wand != (MagickWand *) NULL);
8379  assert(wand->signature == WandSignature);
8380  if (IfMagickTrue(wand->debug))
8381    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8382  if (wand->images == (Image *) NULL)
8383    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8384  roll_image=RollImage(wand->images,x,y,wand->exception);
8385  if (roll_image == (Image *) NULL)
8386    return(MagickFalse);
8387  ReplaceImageInList(&wand->images,roll_image);
8388  return(MagickTrue);
8389}
8390
8391/*
8392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8393%                                                                             %
8394%                                                                             %
8395%                                                                             %
8396%   M a g i c k R o t a t e I m a g e                                         %
8397%                                                                             %
8398%                                                                             %
8399%                                                                             %
8400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8401%
8402%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8403%  triangles left over from rotating the image are filled with the
8404%  background color.
8405%
8406%  The format of the MagickRotateImage method is:
8407%
8408%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8409%        const PixelWand *background,const double degrees)
8410%
8411%  A description of each parameter follows:
8412%
8413%    o wand: the magick wand.
8414%
8415%    o background: the background pixel wand.
8416%
8417%    o degrees: the number of degrees to rotate the image.
8418%
8419%
8420*/
8421WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8422  const PixelWand *background,const double degrees)
8423{
8424  Image
8425    *rotate_image;
8426
8427  assert(wand != (MagickWand *) NULL);
8428  assert(wand->signature == WandSignature);
8429  if (IfMagickTrue(wand->debug))
8430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8431  if (wand->images == (Image *) NULL)
8432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8433  PixelGetQuantumPacket(background,&wand->images->background_color);
8434  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8435  if (rotate_image == (Image *) NULL)
8436    return(MagickFalse);
8437  ReplaceImageInList(&wand->images,rotate_image);
8438  return(MagickTrue);
8439}
8440
8441/*
8442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8443%                                                                             %
8444%                                                                             %
8445%                                                                             %
8446%   M a g i c k S a m p l e I m a g e                                         %
8447%                                                                             %
8448%                                                                             %
8449%                                                                             %
8450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8451%
8452%  MagickSampleImage() scales an image to the desired dimensions with pixel
8453%  sampling.  Unlike other scaling methods, this method does not introduce
8454%  any additional color into the scaled image.
8455%
8456%  The format of the MagickSampleImage method is:
8457%
8458%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8459%        const size_t columns,const size_t rows)
8460%
8461%  A description of each parameter follows:
8462%
8463%    o wand: the magick wand.
8464%
8465%    o columns: the number of columns in the scaled image.
8466%
8467%    o rows: the number of rows in the scaled image.
8468%
8469%
8470*/
8471WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8472  const size_t columns,const size_t rows)
8473{
8474  Image
8475    *sample_image;
8476
8477  assert(wand != (MagickWand *) NULL);
8478  assert(wand->signature == WandSignature);
8479  if (IfMagickTrue(wand->debug))
8480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8481  if (wand->images == (Image *) NULL)
8482    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8483  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8484  if (sample_image == (Image *) NULL)
8485    return(MagickFalse);
8486  ReplaceImageInList(&wand->images,sample_image);
8487  return(MagickTrue);
8488}
8489
8490/*
8491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8492%                                                                             %
8493%                                                                             %
8494%                                                                             %
8495%   M a g i c k S c a l e I m a g e                                           %
8496%                                                                             %
8497%                                                                             %
8498%                                                                             %
8499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8500%
8501%  MagickScaleImage() scales the size of an image to the given dimensions.
8502%
8503%  The format of the MagickScaleImage method is:
8504%
8505%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8506%        const size_t columns,const size_t rows)
8507%
8508%  A description of each parameter follows:
8509%
8510%    o wand: the magick wand.
8511%
8512%    o columns: the number of columns in the scaled image.
8513%
8514%    o rows: the number of rows in the scaled image.
8515%
8516%
8517*/
8518WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8519  const size_t columns,const size_t rows)
8520{
8521  Image
8522    *scale_image;
8523
8524  assert(wand != (MagickWand *) NULL);
8525  assert(wand->signature == WandSignature);
8526  if (IfMagickTrue(wand->debug))
8527    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8528  if (wand->images == (Image *) NULL)
8529    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8530  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8531  if (scale_image == (Image *) NULL)
8532    return(MagickFalse);
8533  ReplaceImageInList(&wand->images,scale_image);
8534  return(MagickTrue);
8535}
8536
8537/*
8538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8539%                                                                             %
8540%                                                                             %
8541%                                                                             %
8542%   M a g i c k S e g m e n t I m a g e                                       %
8543%                                                                             %
8544%                                                                             %
8545%                                                                             %
8546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8547%
8548%  MagickSegmentImage() segments an image by analyzing the histograms of the
8549%  color components and identifying units that are homogeneous with the fuzzy
8550%  C-means technique.
8551%
8552%  The format of the SegmentImage method is:
8553%
8554%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8555%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8556%        const double cluster_threshold,const double smooth_threshold)
8557%
8558%  A description of each parameter follows.
8559%
8560%    o wand: the wand.
8561%
8562%    o colorspace: the image colorspace.
8563%
8564%    o verbose:  Set to MagickTrue to print detailed information about the
8565%      identified classes.
8566%
8567%    o cluster_threshold:  This represents the minimum number of pixels
8568%      contained in a hexahedra before it can be considered valid (expressed as
8569%      a percentage).
8570%
8571%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8572%      derivative of the histogram.  As the value is increased, you can expect a
8573%      smoother second derivative.
8574%
8575*/
8576MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8577  const ColorspaceType colorspace,const MagickBooleanType verbose,
8578  const double cluster_threshold,const double smooth_threshold)
8579{
8580  MagickBooleanType
8581    status;
8582
8583  assert(wand != (MagickWand *) NULL);
8584  assert(wand->signature == WandSignature);
8585  if (IfMagickTrue(wand->debug))
8586    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8587  if (wand->images == (Image *) NULL)
8588    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8589  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8590    smooth_threshold,wand->exception);
8591  return(status);
8592}
8593
8594/*
8595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596%                                                                             %
8597%                                                                             %
8598%                                                                             %
8599%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8600%                                                                             %
8601%                                                                             %
8602%                                                                             %
8603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8604%
8605%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8606%  threshold. It is similar to the unsharpen mask that sharpens everything with
8607%  contrast above a certain threshold.
8608%
8609%  The format of the MagickSelectiveBlurImage method is:
8610%
8611%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8612%        const double radius,const double sigma,const double threshold)
8613%
8614%  A description of each parameter follows:
8615%
8616%    o wand: the magick wand.
8617%
8618%    o radius: the radius of the gaussian, in pixels, not counting the center
8619%      pixel.
8620%
8621%    o sigma: the standard deviation of the gaussian, in pixels.
8622%
8623%    o threshold: only pixels within this contrast threshold are included
8624%      in the blur operation.
8625%
8626*/
8627WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8628  const double radius,const double sigma,const double threshold)
8629{
8630  Image
8631    *blur_image;
8632
8633  assert(wand != (MagickWand *) NULL);
8634  assert(wand->signature == WandSignature);
8635  if (IfMagickTrue(wand->debug))
8636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8637  if (wand->images == (Image *) NULL)
8638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8639  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8640    wand->exception);
8641  if (blur_image == (Image *) NULL)
8642    return(MagickFalse);
8643  ReplaceImageInList(&wand->images,blur_image);
8644  return(MagickTrue);
8645}
8646
8647/*
8648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8649%                                                                             %
8650%                                                                             %
8651%                                                                             %
8652%   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                       %
8653%                                                                             %
8654%                                                                             %
8655%                                                                             %
8656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8657%
8658%  MagickSeparateImage() separates a channel from the image and returns a
8659%  grayscale image.  A channel is a particular color component of each pixel
8660%  in the image.
8661%
8662%  The format of the MagickSeparateImage method is:
8663%
8664%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8665%        const ChannelType channel)
8666%
8667%  A description of each parameter follows:
8668%
8669%    o wand: the magick wand.
8670%
8671%    o channel: the channel.
8672%
8673*/
8674WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8675  const ChannelType channel)
8676{
8677  Image
8678    *separate_image;
8679
8680  assert(wand != (MagickWand *) NULL);
8681  assert(wand->signature == WandSignature);
8682  if (IfMagickTrue(wand->debug))
8683    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8684  if (wand->images == (Image *) NULL)
8685    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8686  separate_image=SeparateImage(wand->images,channel,wand->exception);
8687  if (separate_image == (Image *) NULL)
8688    return(MagickFalse);
8689  ReplaceImageInList(&wand->images,separate_image);
8690  return(MagickTrue);
8691}
8692
8693/*
8694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8695%                                                                             %
8696%                                                                             %
8697%                                                                             %
8698%     M a g i c k S e p i a T o n e I m a g e                                 %
8699%                                                                             %
8700%                                                                             %
8701%                                                                             %
8702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8703%
8704%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8705%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8706%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8707%  threshold of 80% is a good starting point for a reasonable tone.
8708%
8709%  The format of the MagickSepiaToneImage method is:
8710%
8711%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8712%        const double threshold)
8713%
8714%  A description of each parameter follows:
8715%
8716%    o wand: the magick wand.
8717%
8718%    o threshold:  Define the extent of the sepia toning.
8719%
8720*/
8721WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8722  const double threshold)
8723{
8724  Image
8725    *sepia_image;
8726
8727  assert(wand != (MagickWand *) NULL);
8728  assert(wand->signature == WandSignature);
8729  if (IfMagickTrue(wand->debug))
8730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8731  if (wand->images == (Image *) NULL)
8732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8733  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8734  if (sepia_image == (Image *) NULL)
8735    return(MagickFalse);
8736  ReplaceImageInList(&wand->images,sepia_image);
8737  return(MagickTrue);
8738}
8739
8740/*
8741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8742%                                                                             %
8743%                                                                             %
8744%                                                                             %
8745%   M a g i c k S e t I m a g e                                               %
8746%                                                                             %
8747%                                                                             %
8748%                                                                             %
8749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8750%
8751%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8752%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8753%  wand.
8754%
8755%  The format of the MagickSetImage method is:
8756%
8757%      MagickBooleanType MagickSetImage(MagickWand *wand,
8758%        const MagickWand *set_wand)
8759%
8760%  A description of each parameter follows:
8761%
8762%    o wand: the magick wand.
8763%
8764%    o set_wand: the set_wand wand.
8765%
8766*/
8767WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8768  const MagickWand *set_wand)
8769{
8770  Image
8771    *images;
8772
8773  assert(wand != (MagickWand *) NULL);
8774  assert(wand->signature == WandSignature);
8775  if (IfMagickTrue(wand->debug))
8776    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8777  assert(set_wand != (MagickWand *) NULL);
8778  assert(set_wand->signature == WandSignature);
8779  if (IfMagickTrue(wand->debug))
8780    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8781  if (set_wand->images == (Image *) NULL)
8782    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8783  images=CloneImageList(set_wand->images,wand->exception);
8784  if (images == (Image *) NULL)
8785    return(MagickFalse);
8786  ReplaceImageInList(&wand->images,images);
8787  return(MagickTrue);
8788}
8789
8790/*
8791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8792%                                                                             %
8793%                                                                             %
8794%                                                                             %
8795%   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                       %
8796%                                                                             %
8797%                                                                             %
8798%                                                                             %
8799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8800%
8801%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8802%  alpha channel.
8803%
8804%  The format of the MagickSetImageAlphaChannel method is:
8805%
8806%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8807%        const AlphaChannelOption alpha_type)
8808%
8809%  A description of each parameter follows:
8810%
8811%    o wand: the magick wand.
8812%
8813%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8814%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8815%
8816*/
8817WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8818  const AlphaChannelOption alpha_type)
8819{
8820  assert(wand != (MagickWand *) NULL);
8821  assert(wand->signature == WandSignature);
8822  if (IfMagickTrue(wand->debug))
8823    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8824  if (wand->images == (Image *) NULL)
8825    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8826  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8827}
8828
8829/*
8830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8831%                                                                             %
8832%                                                                             %
8833%                                                                             %
8834%   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                 %
8835%                                                                             %
8836%                                                                             %
8837%                                                                             %
8838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8839%
8840%  MagickSetImageBackgroundColor() sets the image background color.
8841%
8842%  The format of the MagickSetImageBackgroundColor method is:
8843%
8844%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8845%        const PixelWand *background)
8846%
8847%  A description of each parameter follows:
8848%
8849%    o wand: the magick wand.
8850%
8851%    o background: the background pixel wand.
8852%
8853*/
8854WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8855  const PixelWand *background)
8856{
8857  assert(wand != (MagickWand *) NULL);
8858  assert(wand->signature == WandSignature);
8859  if (IfMagickTrue(wand->debug))
8860    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8861  if (wand->images == (Image *) NULL)
8862    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8863  PixelGetQuantumPacket(background,&wand->images->background_color);
8864  return(MagickTrue);
8865}
8866
8867/*
8868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8869%                                                                             %
8870%                                                                             %
8871%                                                                             %
8872%   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                         %
8873%                                                                             %
8874%                                                                             %
8875%                                                                             %
8876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8877%
8878%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8879%
8880%  The format of the MagickSetImageBluePrimary method is:
8881%
8882%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8883%        const double x,const double y)
8884%
8885%  A description of each parameter follows:
8886%
8887%    o wand: the magick wand.
8888%
8889%    o x: the blue primary x-point.
8890%
8891%    o y: the blue primary y-point.
8892%
8893*/
8894WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8895  const double x,const double y)
8896{
8897  assert(wand != (MagickWand *) NULL);
8898  assert(wand->signature == WandSignature);
8899  if (IfMagickTrue(wand->debug))
8900    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8901  if (wand->images == (Image *) NULL)
8902    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8903  wand->images->chromaticity.blue_primary.x=x;
8904  wand->images->chromaticity.blue_primary.y=y;
8905  return(MagickTrue);
8906}
8907
8908/*
8909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8910%                                                                             %
8911%                                                                             %
8912%                                                                             %
8913%   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                         %
8914%                                                                             %
8915%                                                                             %
8916%                                                                             %
8917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8918%
8919%  MagickSetImageBorderColor() sets the image border color.
8920%
8921%  The format of the MagickSetImageBorderColor method is:
8922%
8923%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8924%        const PixelWand *border)
8925%
8926%  A description of each parameter follows:
8927%
8928%    o wand: the magick wand.
8929%
8930%    o border: the border pixel wand.
8931%
8932*/
8933WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8934  const PixelWand *border)
8935{
8936  assert(wand != (MagickWand *) NULL);
8937  assert(wand->signature == WandSignature);
8938  if (IfMagickTrue(wand->debug))
8939    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8940  if (wand->images == (Image *) NULL)
8941    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8942  PixelGetQuantumPacket(border,&wand->images->border_color);
8943  return(MagickTrue);
8944}
8945
8946/*
8947%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8948%                                                                             %
8949%                                                                             %
8950%                                                                             %
8951%   M a g i c k S e t I m a g e C l i p M a s k                               %
8952%                                                                             %
8953%                                                                             %
8954%                                                                             %
8955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8956%
8957%  MagickSetImageMask() sets image clip mask.
8958%
8959%  The format of the MagickSetImageMask method is:
8960%
8961%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
8962%        const MagickWand *clip_mask)
8963%
8964%  A description of each parameter follows:
8965%
8966%    o wand: the magick wand.
8967%
8968%    o clip_mask: the clip_mask wand.
8969%
8970*/
8971WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
8972  const MagickWand *clip_mask)
8973{
8974  assert(wand != (MagickWand *) NULL);
8975  assert(wand->signature == WandSignature);
8976  if (IfMagickTrue(wand->debug))
8977    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8978  assert(clip_mask != (MagickWand *) NULL);
8979  assert(clip_mask->signature == WandSignature);
8980  if (IfMagickTrue(clip_mask->debug))
8981    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8982  if (clip_mask->images == (Image *) NULL)
8983    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8984  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
8985}
8986
8987/*
8988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8989%                                                                             %
8990%                                                                             %
8991%                                                                             %
8992%   M a g i c k S e t I m a g e C o l o r                                     %
8993%                                                                             %
8994%                                                                             %
8995%                                                                             %
8996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8997%
8998%  MagickSetImageColor() set the entire wand canvas to the specified color.
8999%
9000%  The format of the MagickSetImageColor method is:
9001%
9002%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9003%        const PixelWand *color)
9004%
9005%  A description of each parameter follows:
9006%
9007%    o wand: the magick wand.
9008%
9009%    o background: the image color.
9010%
9011*/
9012WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9013  const PixelWand *color)
9014{
9015  PixelInfo
9016    pixel;
9017
9018  assert(wand != (MagickWand *) NULL);
9019  assert(wand->signature == WandSignature);
9020  if (IfMagickTrue(wand->debug))
9021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9022  PixelGetMagickColor(color,&pixel);
9023  return(SetImageColor(wand->images,&pixel,wand->exception));
9024}
9025
9026/*
9027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9028%                                                                             %
9029%                                                                             %
9030%                                                                             %
9031%   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                     %
9032%                                                                             %
9033%                                                                             %
9034%                                                                             %
9035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9036%
9037%  MagickSetImageColormapColor() sets the color of the specified colormap
9038%  index.
9039%
9040%  The format of the MagickSetImageColormapColor method is:
9041%
9042%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9043%        const size_t index,const PixelWand *color)
9044%
9045%  A description of each parameter follows:
9046%
9047%    o wand: the magick wand.
9048%
9049%    o index: the offset into the image colormap.
9050%
9051%    o color: Return the colormap color in this wand.
9052%
9053*/
9054WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9055  const size_t index,const PixelWand *color)
9056{
9057  assert(wand != (MagickWand *) NULL);
9058  assert(wand->signature == WandSignature);
9059  if (IfMagickTrue(wand->debug))
9060    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9061  if (wand->images == (Image *) NULL)
9062    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9063  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9064      (index >= wand->images->colors))
9065    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9066  PixelGetQuantumPacket(color,wand->images->colormap+index);
9067  return(SyncImage(wand->images,wand->exception));
9068}
9069
9070/*
9071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9072%                                                                             %
9073%                                                                             %
9074%                                                                             %
9075%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9076%                                                                             %
9077%                                                                             %
9078%                                                                             %
9079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9080%
9081%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9082%  the image data.
9083%
9084%  The format of the MagickSetImageColorspace method is:
9085%
9086%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9087%        const ColorspaceType colorspace)
9088%
9089%  A description of each parameter follows:
9090%
9091%    o wand: the magick wand.
9092%
9093%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9094%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9095%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9096%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9097%      HSLColorspace, or HWBColorspace.
9098%
9099*/
9100WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9101  const ColorspaceType colorspace)
9102{
9103  assert(wand != (MagickWand *) NULL);
9104  assert(wand->signature == WandSignature);
9105  if (IfMagickTrue(wand->debug))
9106    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9107  if (wand->images == (Image *) NULL)
9108    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9109  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9110}
9111
9112/*
9113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114%                                                                             %
9115%                                                                             %
9116%                                                                             %
9117%   M a g i c k S e t I m a g e C o m p o s e                                 %
9118%                                                                             %
9119%                                                                             %
9120%                                                                             %
9121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9122%
9123%  MagickSetImageCompose() sets the image composite operator, useful for
9124%  specifying how to composite the image thumbnail when using the
9125%  MagickMontageImage() method.
9126%
9127%  The format of the MagickSetImageCompose method is:
9128%
9129%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9130%        const CompositeOperator compose)
9131%
9132%  A description of each parameter follows:
9133%
9134%    o wand: the magick wand.
9135%
9136%    o compose: the image composite operator.
9137%
9138*/
9139WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9140  const CompositeOperator compose)
9141{
9142  assert(wand != (MagickWand *) NULL);
9143  assert(wand->signature == WandSignature);
9144  if (IfMagickTrue(wand->debug))
9145    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9146  if (wand->images == (Image *) NULL)
9147    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9148  wand->images->compose=compose;
9149  return(MagickTrue);
9150}
9151
9152/*
9153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9154%                                                                             %
9155%                                                                             %
9156%                                                                             %
9157%   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                         %
9158%                                                                             %
9159%                                                                             %
9160%                                                                             %
9161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9162%
9163%  MagickSetImageCompression() sets the image compression.
9164%
9165%  The format of the MagickSetImageCompression method is:
9166%
9167%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9168%        const CompressionType compression)
9169%
9170%  A description of each parameter follows:
9171%
9172%    o wand: the magick wand.
9173%
9174%    o compression: the image compression type.
9175%
9176*/
9177WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9178  const CompressionType compression)
9179{
9180  assert(wand != (MagickWand *) NULL);
9181  assert(wand->signature == WandSignature);
9182  if (IfMagickTrue(wand->debug))
9183    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9184  if (wand->images == (Image *) NULL)
9185    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9186  wand->images->compression=compression;
9187  return(MagickTrue);
9188}
9189
9190/*
9191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9192%                                                                             %
9193%                                                                             %
9194%                                                                             %
9195%   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           %
9196%                                                                             %
9197%                                                                             %
9198%                                                                             %
9199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9200%
9201%  MagickSetImageCompressionQuality() sets the image compression quality.
9202%
9203%  The format of the MagickSetImageCompressionQuality method is:
9204%
9205%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9206%        const size_t quality)
9207%
9208%  A description of each parameter follows:
9209%
9210%    o wand: the magick wand.
9211%
9212%    o quality: the image compression tlityype.
9213%
9214*/
9215WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9216  const size_t quality)
9217{
9218  assert(wand != (MagickWand *) NULL);
9219  assert(wand->signature == WandSignature);
9220  if (IfMagickTrue(wand->debug))
9221    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9222  if (wand->images == (Image *) NULL)
9223    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9224  wand->images->quality=quality;
9225  return(MagickTrue);
9226}
9227
9228/*
9229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9230%                                                                             %
9231%                                                                             %
9232%                                                                             %
9233%   M a g i c k S e t I m a g e D e l a y                                     %
9234%                                                                             %
9235%                                                                             %
9236%                                                                             %
9237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9238%
9239%  MagickSetImageDelay() sets the image delay.
9240%
9241%  The format of the MagickSetImageDelay method is:
9242%
9243%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9244%        const size_t delay)
9245%
9246%  A description of each parameter follows:
9247%
9248%    o wand: the magick wand.
9249%
9250%    o delay: the image delay in ticks-per-second units.
9251%
9252*/
9253WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9254  const size_t delay)
9255{
9256  assert(wand != (MagickWand *) NULL);
9257  assert(wand->signature == WandSignature);
9258  if (IfMagickTrue(wand->debug))
9259    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9260  if (wand->images == (Image *) NULL)
9261    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9262  wand->images->delay=delay;
9263  return(MagickTrue);
9264}
9265
9266/*
9267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9268%                                                                             %
9269%                                                                             %
9270%                                                                             %
9271%   M a g i c k S e t I m a g e D e p t h                                     %
9272%                                                                             %
9273%                                                                             %
9274%                                                                             %
9275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9276%
9277%  MagickSetImageDepth() sets the image depth.
9278%
9279%  The format of the MagickSetImageDepth method is:
9280%
9281%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9282%        const size_t depth)
9283%
9284%  A description of each parameter follows:
9285%
9286%    o wand: the magick wand.
9287%
9288%    o depth: the image depth in bits: 8, 16, or 32.
9289%
9290*/
9291WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9292  const size_t depth)
9293{
9294  assert(wand != (MagickWand *) NULL);
9295  assert(wand->signature == WandSignature);
9296  if (IfMagickTrue(wand->debug))
9297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9298  if (wand->images == (Image *) NULL)
9299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9300  return(SetImageDepth(wand->images,depth,wand->exception));
9301}
9302
9303/*
9304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9305%                                                                             %
9306%                                                                             %
9307%                                                                             %
9308%   M a g i c k S e t I m a g e D i s p o s e                                 %
9309%                                                                             %
9310%                                                                             %
9311%                                                                             %
9312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9313%
9314%  MagickSetImageDispose() sets the image disposal method.
9315%
9316%  The format of the MagickSetImageDispose method is:
9317%
9318%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9319%        const DisposeType dispose)
9320%
9321%  A description of each parameter follows:
9322%
9323%    o wand: the magick wand.
9324%
9325%    o dispose: the image disposeal type.
9326%
9327*/
9328WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9329  const DisposeType dispose)
9330{
9331  assert(wand != (MagickWand *) NULL);
9332  assert(wand->signature == WandSignature);
9333  if (IfMagickTrue(wand->debug))
9334    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9335  if (wand->images == (Image *) NULL)
9336    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9337  wand->images->dispose=dispose;
9338  return(MagickTrue);
9339}
9340
9341/*
9342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9343%                                                                             %
9344%                                                                             %
9345%                                                                             %
9346%   M a g i c k S e t I m a g e E n d i a n                                   %
9347%                                                                             %
9348%                                                                             %
9349%                                                                             %
9350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9351%
9352%  MagickSetImageEndian() sets the image endian method.
9353%
9354%  The format of the MagickSetImageEndian method is:
9355%
9356%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9357%        const EndianType endian)
9358%
9359%  A description of each parameter follows:
9360%
9361%    o wand: the magick wand.
9362%
9363%    o endian: the image endian type.
9364%
9365*/
9366WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9367  const EndianType endian)
9368{
9369  assert(wand != (MagickWand *) NULL);
9370  assert(wand->signature == WandSignature);
9371  if (wand->debug != MagickFalse)
9372    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9373  if (wand->images == (Image *) NULL)
9374    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9375  wand->images->endian=endian;
9376  return(MagickTrue);
9377}
9378
9379/*
9380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9381%                                                                             %
9382%                                                                             %
9383%                                                                             %
9384%   M a g i c k S e t I m a g e E x t e n t                                   %
9385%                                                                             %
9386%                                                                             %
9387%                                                                             %
9388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9389%
9390%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9391%
9392%  The format of the MagickSetImageExtent method is:
9393%
9394%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9395%        const size_t columns,const unsigned rows)
9396%
9397%  A description of each parameter follows:
9398%
9399%    o wand: the magick wand.
9400%
9401%    o columns:  The image width in pixels.
9402%
9403%    o rows:  The image height in pixels.
9404%
9405*/
9406WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9407  const size_t columns,const size_t rows)
9408{
9409  assert(wand != (MagickWand *) NULL);
9410  assert(wand->signature == WandSignature);
9411  if (IfMagickTrue(wand->debug))
9412    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9413  if (wand->images == (Image *) NULL)
9414    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9415  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9416}
9417
9418/*
9419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420%                                                                             %
9421%                                                                             %
9422%                                                                             %
9423%   M a g i c k S e t I m a g e F i l e n a m e                               %
9424%                                                                             %
9425%                                                                             %
9426%                                                                             %
9427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9428%
9429%  MagickSetImageFilename() sets the filename of a particular image in a
9430%  sequence.
9431%
9432%  The format of the MagickSetImageFilename method is:
9433%
9434%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9435%        const char *filename)
9436%
9437%  A description of each parameter follows:
9438%
9439%    o wand: the magick wand.
9440%
9441%    o filename: the image filename.
9442%
9443*/
9444WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9445  const char *filename)
9446{
9447  assert(wand != (MagickWand *) NULL);
9448  assert(wand->signature == WandSignature);
9449  if (IfMagickTrue(wand->debug))
9450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9451  if (wand->images == (Image *) NULL)
9452    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9453  if (filename != (const char *) NULL)
9454    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9455  return(MagickTrue);
9456}
9457
9458/*
9459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9460%                                                                             %
9461%                                                                             %
9462%                                                                             %
9463%   M a g i c k S e t I m a g e F o r m a t                                   %
9464%                                                                             %
9465%                                                                             %
9466%                                                                             %
9467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9468%
9469%  MagickSetImageFormat() sets the format of a particular image in a
9470%  sequence.
9471%
9472%  The format of the MagickSetImageFormat method is:
9473%
9474%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9475%        const char *format)
9476%
9477%  A description of each parameter follows:
9478%
9479%    o wand: the magick wand.
9480%
9481%    o format: the image format.
9482%
9483*/
9484WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9485  const char *format)
9486{
9487  const MagickInfo
9488    *magick_info;
9489
9490  assert(wand != (MagickWand *) NULL);
9491  assert(wand->signature == WandSignature);
9492  if (IfMagickTrue(wand->debug))
9493    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9494  if (wand->images == (Image *) NULL)
9495    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9496  if ((format == (char *) NULL) || (*format == '\0'))
9497    {
9498      *wand->images->magick='\0';
9499      return(MagickTrue);
9500    }
9501  magick_info=GetMagickInfo(format,wand->exception);
9502  if (magick_info == (const MagickInfo *) NULL)
9503    return(MagickFalse);
9504  ClearMagickException(wand->exception);
9505  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9506  return(MagickTrue);
9507}
9508
9509/*
9510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9511%                                                                             %
9512%                                                                             %
9513%                                                                             %
9514%   M a g i c k S e t I m a g e F u z z                                       %
9515%                                                                             %
9516%                                                                             %
9517%                                                                             %
9518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9519%
9520%  MagickSetImageFuzz() sets the image fuzz.
9521%
9522%  The format of the MagickSetImageFuzz method is:
9523%
9524%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9525%        const double fuzz)
9526%
9527%  A description of each parameter follows:
9528%
9529%    o wand: the magick wand.
9530%
9531%    o fuzz: the image fuzz.
9532%
9533*/
9534WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9535  const double fuzz)
9536{
9537  assert(wand != (MagickWand *) NULL);
9538  assert(wand->signature == WandSignature);
9539  if (IfMagickTrue(wand->debug))
9540    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9541  if (wand->images == (Image *) NULL)
9542    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9543  wand->images->fuzz=fuzz;
9544  return(MagickTrue);
9545}
9546
9547/*
9548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9549%                                                                             %
9550%                                                                             %
9551%                                                                             %
9552%   M a g i c k S e t I m a g e G a m m a                                     %
9553%                                                                             %
9554%                                                                             %
9555%                                                                             %
9556%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9557%
9558%  MagickSetImageGamma() sets the image gamma.
9559%
9560%  The format of the MagickSetImageGamma method is:
9561%
9562%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9563%        const double gamma)
9564%
9565%  A description of each parameter follows:
9566%
9567%    o wand: the magick wand.
9568%
9569%    o gamma: the image gamma.
9570%
9571*/
9572WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9573  const double gamma)
9574{
9575  assert(wand != (MagickWand *) NULL);
9576  assert(wand->signature == WandSignature);
9577  if (IfMagickTrue(wand->debug))
9578    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9579  if (wand->images == (Image *) NULL)
9580    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9581  wand->images->gamma=gamma;
9582  return(MagickTrue);
9583}
9584
9585/*
9586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9587%                                                                             %
9588%                                                                             %
9589%                                                                             %
9590%   M a g i c k S e t I m a g e G r a v i t y                                 %
9591%                                                                             %
9592%                                                                             %
9593%                                                                             %
9594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9595%
9596%  MagickSetImageGravity() sets the image gravity type.
9597%
9598%  The format of the MagickSetImageGravity method is:
9599%
9600%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9601%        const GravityType gravity)
9602%
9603%  A description of each parameter follows:
9604%
9605%    o wand: the magick wand.
9606%
9607%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9608%      PlaneInterlace, PartitionInterlace.
9609%
9610*/
9611WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9612  const GravityType gravity)
9613{
9614  assert(wand != (MagickWand *) NULL);
9615  assert(wand->signature == WandSignature);
9616  if (IfMagickTrue(wand->debug))
9617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9618  if (wand->images == (Image *) NULL)
9619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9620  wand->images->gravity=gravity;
9621  return(MagickTrue);
9622}
9623
9624/*
9625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626%                                                                             %
9627%                                                                             %
9628%                                                                             %
9629%   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                       %
9630%                                                                             %
9631%                                                                             %
9632%                                                                             %
9633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9634%
9635%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9636%  point.
9637%
9638%  The format of the MagickSetImageGreenPrimary method is:
9639%
9640%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9641%        const double x,const double y)
9642%
9643%  A description of each parameter follows:
9644%
9645%    o wand: the magick wand.
9646%
9647%    o x: the green primary x-point.
9648%
9649%    o y: the green primary y-point.
9650%
9651%
9652*/
9653WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9654  const double x,const double y)
9655{
9656  assert(wand != (MagickWand *) NULL);
9657  assert(wand->signature == WandSignature);
9658  if (IfMagickTrue(wand->debug))
9659    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9660  if (wand->images == (Image *) NULL)
9661    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9662  wand->images->chromaticity.green_primary.x=x;
9663  wand->images->chromaticity.green_primary.y=y;
9664  return(MagickTrue);
9665}
9666
9667/*
9668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9669%                                                                             %
9670%                                                                             %
9671%                                                                             %
9672%   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                 %
9673%                                                                             %
9674%                                                                             %
9675%                                                                             %
9676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9677%
9678%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9679%
9680%  The format of the MagickSetImageInterlaceScheme method is:
9681%
9682%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9683%        const InterlaceType interlace)
9684%
9685%  A description of each parameter follows:
9686%
9687%    o wand: the magick wand.
9688%
9689%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9690%      PlaneInterlace, PartitionInterlace.
9691%
9692*/
9693WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9694  const InterlaceType interlace)
9695{
9696  assert(wand != (MagickWand *) NULL);
9697  assert(wand->signature == WandSignature);
9698  if (IfMagickTrue(wand->debug))
9699    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9700  if (wand->images == (Image *) NULL)
9701    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9702  wand->images->interlace=interlace;
9703  return(MagickTrue);
9704}
9705
9706/*
9707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9708%                                                                             %
9709%                                                                             %
9710%                                                                             %
9711%   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             %
9712%                                                                             %
9713%                                                                             %
9714%                                                                             %
9715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9716%
9717%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9718%  method.
9719%
9720%  The format of the MagickSetImagePixelInterpolateMethod method is:
9721%
9722%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9723%        const PixelInterpolateMethod method)
9724%
9725%  A description of each parameter follows:
9726%
9727%    o wand: the magick wand.
9728%
9729%    o method: the image interpole pixel methods: choose from Undefined,
9730%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9731%
9732*/
9733WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9734  MagickWand *wand,const PixelInterpolateMethod method)
9735{
9736  assert(wand != (MagickWand *) NULL);
9737  assert(wand->signature == WandSignature);
9738  if (IfMagickTrue(wand->debug))
9739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9740  if (wand->images == (Image *) NULL)
9741    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9742  wand->images->interpolate=method;
9743  return(MagickTrue);
9744}
9745
9746/*
9747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748%                                                                             %
9749%                                                                             %
9750%                                                                             %
9751%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9752%                                                                             %
9753%                                                                             %
9754%                                                                             %
9755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9756%
9757%  MagickSetImageIterations() sets the image iterations.
9758%
9759%  The format of the MagickSetImageIterations method is:
9760%
9761%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9762%        const size_t iterations)
9763%
9764%  A description of each parameter follows:
9765%
9766%    o wand: the magick wand.
9767%
9768%    o delay: the image delay in 1/100th of a second.
9769%
9770*/
9771WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9772  const size_t iterations)
9773{
9774  assert(wand != (MagickWand *) NULL);
9775  assert(wand->signature == WandSignature);
9776  if (IfMagickTrue(wand->debug))
9777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9778  if (wand->images == (Image *) NULL)
9779    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9780  wand->images->iterations=iterations;
9781  return(MagickTrue);
9782}
9783
9784/*
9785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786%                                                                             %
9787%                                                                             %
9788%                                                                             %
9789%   M a g i c k S e t I m a g e M a t t e                                     %
9790%                                                                             %
9791%                                                                             %
9792%                                                                             %
9793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9794%
9795%  MagickSetImageMatte() sets the image matte channel.
9796%
9797%  The format of the MagickSetImageMatteColor method is:
9798%
9799%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9800%        const MagickBooleanType *matte)
9801%
9802%  A description of each parameter follows:
9803%
9804%    o wand: the magick wand.
9805%
9806%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9807%      MagickFalse.
9808%
9809*/
9810WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9811  const MagickBooleanType matte)
9812{
9813  assert(wand != (MagickWand *) NULL);
9814  assert(wand->signature == WandSignature);
9815  if (IfMagickTrue(wand->debug))
9816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9817  if (wand->images == (Image *) NULL)
9818    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9819  if ((wand->images->alpha_trait != BlendPixelTrait) && IsMagickTrue(matte))
9820    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9821  wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
9822    UndefinedPixelTrait;
9823  return(MagickTrue);
9824}
9825
9826/*
9827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9828%                                                                             %
9829%                                                                             %
9830%                                                                             %
9831%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9832%                                                                             %
9833%                                                                             %
9834%                                                                             %
9835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9836%
9837%  MagickSetImageMatteColor() sets the image matte color.
9838%
9839%  The format of the MagickSetImageMatteColor method is:
9840%
9841%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9842%        const PixelWand *matte)
9843%
9844%  A description of each parameter follows:
9845%
9846%    o wand: the magick wand.
9847%
9848%    o matte: the matte pixel wand.
9849%
9850*/
9851WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9852  const PixelWand *matte)
9853{
9854  assert(wand != (MagickWand *) NULL);
9855  assert(wand->signature == WandSignature);
9856  if (IfMagickTrue(wand->debug))
9857    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9858  if (wand->images == (Image *) NULL)
9859    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9860  PixelGetQuantumPacket(matte,&wand->images->matte_color);
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 O p a c i t y                                 %
9870%                                                                             %
9871%                                                                             %
9872%                                                                             %
9873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9874%
9875%  MagickSetImageAlpha() sets the image to the specified alpha level.
9876%
9877%  The format of the MagickSetImageAlpha method is:
9878%
9879%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9880%        const double alpha)
9881%
9882%  A description of each parameter follows:
9883%
9884%    o wand: the magick wand.
9885%
9886%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9887%      transparent.
9888%
9889*/
9890WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9891  const double alpha)
9892{
9893  MagickBooleanType
9894    status;
9895
9896  assert(wand != (MagickWand *) NULL);
9897  assert(wand->signature == WandSignature);
9898  if (IfMagickTrue(wand->debug))
9899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9900  if (wand->images == (Image *) NULL)
9901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9902  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9903    wand->exception);
9904  return(status);
9905}
9906
9907/*
9908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9909%                                                                             %
9910%                                                                             %
9911%                                                                             %
9912%   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                         %
9913%                                                                             %
9914%                                                                             %
9915%                                                                             %
9916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9917%
9918%  MagickSetImageOrientation() sets the image orientation.
9919%
9920%  The format of the MagickSetImageOrientation method is:
9921%
9922%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9923%        const OrientationType orientation)
9924%
9925%  A description of each parameter follows:
9926%
9927%    o wand: the magick wand.
9928%
9929%    o orientation: the image orientation type.
9930%
9931*/
9932WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9933  const OrientationType orientation)
9934{
9935  assert(wand != (MagickWand *) NULL);
9936  assert(wand->signature == WandSignature);
9937  if (IfMagickTrue(wand->debug))
9938    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9939  if (wand->images == (Image *) NULL)
9940    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9941  wand->images->orientation=orientation;
9942  return(MagickTrue);
9943}
9944
9945/*
9946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947%                                                                             %
9948%                                                                             %
9949%                                                                             %
9950%   M a g i c k S e t I m a g e P a g e                                       %
9951%                                                                             %
9952%                                                                             %
9953%                                                                             %
9954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955%
9956%  MagickSetImagePage() sets the page geometry of the image.
9957%
9958%  The format of the MagickSetImagePage method is:
9959%
9960%      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
9961%
9962%  A description of each parameter follows:
9963%
9964%    o wand: the magick wand.
9965%
9966%    o width: the page width.
9967%
9968%    o height: the page height.
9969%
9970%    o x: the page x-offset.
9971%
9972%    o y: the page y-offset.
9973%
9974*/
9975WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9976  const size_t width,const size_t height,const ssize_t x,
9977  const ssize_t y)
9978{
9979  assert(wand != (MagickWand *) NULL);
9980  assert(wand->signature == WandSignature);
9981  if (IfMagickTrue(wand->debug))
9982    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9983  if (wand->images == (Image *) NULL)
9984    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9985  wand->images->page.width=width;
9986  wand->images->page.height=height;
9987  wand->images->page.x=x;
9988  wand->images->page.y=y;
9989  return(MagickTrue);
9990}
9991
9992/*
9993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9994%                                                                             %
9995%                                                                             %
9996%                                                                             %
9997%   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                 %
9998%                                                                             %
9999%                                                                             %
10000%                                                                             %
10001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10002%
10003%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10004%  specified method and returns the previous progress monitor if any.  The
10005%  progress monitor method looks like this:
10006%
10007%    MagickBooleanType MagickProgressMonitor(const char *text,
10008%      const MagickOffsetType offset,const MagickSizeType span,
10009%      void *client_data)
10010%
10011%  If the progress monitor returns MagickFalse, the current operation is
10012%  interrupted.
10013%
10014%  The format of the MagickSetImageProgressMonitor method is:
10015%
10016%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10017%        const MagickProgressMonitor progress_monitor,void *client_data)
10018%
10019%  A description of each parameter follows:
10020%
10021%    o wand: the magick wand.
10022%
10023%    o progress_monitor: Specifies a pointer to a method to monitor progress
10024%      of an image operation.
10025%
10026%    o client_data: Specifies a pointer to any client data.
10027%
10028*/
10029WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10030  const MagickProgressMonitor progress_monitor,void *client_data)
10031{
10032  MagickProgressMonitor
10033    previous_monitor;
10034
10035  assert(wand != (MagickWand *) NULL);
10036  assert(wand->signature == WandSignature);
10037  if (IfMagickTrue(wand->debug))
10038    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10039  if (wand->images == (Image *) NULL)
10040    {
10041      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10042        "ContainsNoImages","`%s'",wand->name);
10043      return((MagickProgressMonitor) NULL);
10044    }
10045  previous_monitor=SetImageProgressMonitor(wand->images,
10046    progress_monitor,client_data);
10047  return(previous_monitor);
10048}
10049
10050/*
10051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10052%                                                                             %
10053%                                                                             %
10054%                                                                             %
10055%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10056%                                                                             %
10057%                                                                             %
10058%                                                                             %
10059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10060%
10061%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10062%
10063%  The format of the MagickSetImageRedPrimary method is:
10064%
10065%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10066%        const double x,const double y)
10067%
10068%  A description of each parameter follows:
10069%
10070%    o wand: the magick wand.
10071%
10072%    o x: the red primary x-point.
10073%
10074%    o y: the red primary y-point.
10075%
10076*/
10077WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10078  const double x,const double y)
10079{
10080  assert(wand != (MagickWand *) NULL);
10081  assert(wand->signature == WandSignature);
10082  if (IfMagickTrue(wand->debug))
10083    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10084  if (wand->images == (Image *) NULL)
10085    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10086  wand->images->chromaticity.red_primary.x=x;
10087  wand->images->chromaticity.red_primary.y=y;
10088  return(MagickTrue);
10089}
10090
10091/*
10092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093%                                                                             %
10094%                                                                             %
10095%                                                                             %
10096%   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                 %
10097%                                                                             %
10098%                                                                             %
10099%                                                                             %
10100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101%
10102%  MagickSetImageRenderingIntent() sets the image rendering intent.
10103%
10104%  The format of the MagickSetImageRenderingIntent method is:
10105%
10106%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10107%        const RenderingIntent rendering_intent)
10108%
10109%  A description of each parameter follows:
10110%
10111%    o wand: the magick wand.
10112%
10113%    o rendering_intent: the image rendering intent: UndefinedIntent,
10114%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10115%
10116*/
10117WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10118  const RenderingIntent rendering_intent)
10119{
10120  assert(wand != (MagickWand *) NULL);
10121  assert(wand->signature == WandSignature);
10122  if (IfMagickTrue(wand->debug))
10123    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10124  if (wand->images == (Image *) NULL)
10125    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10126  wand->images->rendering_intent=rendering_intent;
10127  return(MagickTrue);
10128}
10129
10130/*
10131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10132%                                                                             %
10133%                                                                             %
10134%                                                                             %
10135%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10136%                                                                             %
10137%                                                                             %
10138%                                                                             %
10139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10140%
10141%  MagickSetImageResolution() sets the image resolution.
10142%
10143%  The format of the MagickSetImageResolution method is:
10144%
10145%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10146%        const double x_resolution,const double y_resolution)
10147%
10148%  A description of each parameter follows:
10149%
10150%    o wand: the magick wand.
10151%
10152%    o x_resolution: the image x resolution.
10153%
10154%    o y_resolution: the image y resolution.
10155%
10156*/
10157WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10158  const double x_resolution,const double y_resolution)
10159{
10160  assert(wand != (MagickWand *) NULL);
10161  assert(wand->signature == WandSignature);
10162  if (IfMagickTrue(wand->debug))
10163    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10164  if (wand->images == (Image *) NULL)
10165    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10166  wand->images->resolution.x=x_resolution;
10167  wand->images->resolution.y=y_resolution;
10168  return(MagickTrue);
10169}
10170
10171/*
10172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10173%                                                                             %
10174%                                                                             %
10175%                                                                             %
10176%   M a g i c k S e t I m a g e S c e n e                                     %
10177%                                                                             %
10178%                                                                             %
10179%                                                                             %
10180%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10181%
10182%  MagickSetImageScene() sets the image scene.
10183%
10184%  The format of the MagickSetImageScene method is:
10185%
10186%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10187%        const size_t scene)
10188%
10189%  A description of each parameter follows:
10190%
10191%    o wand: the magick wand.
10192%
10193%    o delay: the image scene number.
10194%
10195*/
10196WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10197  const size_t scene)
10198{
10199  assert(wand != (MagickWand *) NULL);
10200  assert(wand->signature == WandSignature);
10201  if (IfMagickTrue(wand->debug))
10202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10203  if (wand->images == (Image *) NULL)
10204    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10205  wand->images->scene=scene;
10206  return(MagickTrue);
10207}
10208
10209/*
10210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10211%                                                                             %
10212%                                                                             %
10213%                                                                             %
10214%   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                   %
10215%                                                                             %
10216%                                                                             %
10217%                                                                             %
10218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10219%
10220%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10221%
10222%  The format of the MagickSetImageTicksPerSecond method is:
10223%
10224%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10225%        const ssize_t ticks_per-second)
10226%
10227%  A description of each parameter follows:
10228%
10229%    o wand: the magick wand.
10230%
10231%    o ticks_per_second: the units to use for the image delay.
10232%
10233*/
10234WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10235  const ssize_t ticks_per_second)
10236{
10237  assert(wand != (MagickWand *) NULL);
10238  assert(wand->signature == WandSignature);
10239  if (IfMagickTrue(wand->debug))
10240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10241  if (wand->images == (Image *) NULL)
10242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10243  wand->images->ticks_per_second=ticks_per_second;
10244  return(MagickTrue);
10245}
10246
10247/*
10248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10249%                                                                             %
10250%                                                                             %
10251%                                                                             %
10252%   M a g i c k S e t I m a g e T y p e                                       %
10253%                                                                             %
10254%                                                                             %
10255%                                                                             %
10256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10257%
10258%  MagickSetImageType() sets the image type.
10259%
10260%  The format of the MagickSetImageType method is:
10261%
10262%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10263%        const ImageType image_type)
10264%
10265%  A description of each parameter follows:
10266%
10267%    o wand: the magick wand.
10268%
10269%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10270%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10271%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10272%      or OptimizeType.
10273%
10274*/
10275WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10276  const ImageType image_type)
10277{
10278  assert(wand != (MagickWand *) NULL);
10279  assert(wand->signature == WandSignature);
10280  if (IfMagickTrue(wand->debug))
10281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10282  if (wand->images == (Image *) NULL)
10283    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10284  return(SetImageType(wand->images,image_type,wand->exception));
10285}
10286
10287/*
10288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10289%                                                                             %
10290%                                                                             %
10291%                                                                             %
10292%   M a g i c k S e t I m a g e U n i t s                                     %
10293%                                                                             %
10294%                                                                             %
10295%                                                                             %
10296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10297%
10298%  MagickSetImageUnits() sets the image units of resolution.
10299%
10300%  The format of the MagickSetImageUnits method is:
10301%
10302%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10303%        const ResolutionType units)
10304%
10305%  A description of each parameter follows:
10306%
10307%    o wand: the magick wand.
10308%
10309%    o units: the image units of resolution : UndefinedResolution,
10310%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10311%
10312*/
10313WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10314  const ResolutionType units)
10315{
10316  assert(wand != (MagickWand *) NULL);
10317  assert(wand->signature == WandSignature);
10318  if (IfMagickTrue(wand->debug))
10319    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10320  if (wand->images == (Image *) NULL)
10321    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10322  wand->images->units=units;
10323  return(MagickTrue);
10324}
10325
10326/*
10327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10328%                                                                             %
10329%                                                                             %
10330%                                                                             %
10331%   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           %
10332%                                                                             %
10333%                                                                             %
10334%                                                                             %
10335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10336%
10337%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10338%
10339%  The format of the MagickSetImageVirtualPixelMethod method is:
10340%
10341%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10342%        const VirtualPixelMethod method)
10343%
10344%  A description of each parameter follows:
10345%
10346%    o wand: the magick wand.
10347%
10348%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10349%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10350%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10351%
10352*/
10353WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10354  const VirtualPixelMethod method)
10355{
10356  assert(wand != (MagickWand *) NULL);
10357  assert(wand->signature == WandSignature);
10358  if (IfMagickTrue(wand->debug))
10359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10360  if (wand->images == (Image *) NULL)
10361    return(UndefinedVirtualPixelMethod);
10362  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10363}
10364
10365/*
10366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10367%                                                                             %
10368%                                                                             %
10369%                                                                             %
10370%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10371%                                                                             %
10372%                                                                             %
10373%                                                                             %
10374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10375%
10376%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10377%
10378%  The format of the MagickSetImageWhitePoint method is:
10379%
10380%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10381%        const double x,const double y)
10382%
10383%  A description of each parameter follows:
10384%
10385%    o wand: the magick wand.
10386%
10387%    o x: the white x-point.
10388%
10389%    o y: the white y-point.
10390%
10391*/
10392WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10393  const double x,const double y)
10394{
10395  assert(wand != (MagickWand *) NULL);
10396  assert(wand->signature == WandSignature);
10397  if (IfMagickTrue(wand->debug))
10398    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10399  if (wand->images == (Image *) NULL)
10400    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10401  wand->images->chromaticity.white_point.x=x;
10402  wand->images->chromaticity.white_point.y=y;
10403  return(MagickTrue);
10404}
10405
10406/*
10407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10408%                                                                             %
10409%                                                                             %
10410%                                                                             %
10411%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10412%                                                                             %
10413%                                                                             %
10414%                                                                             %
10415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10416%
10417%  MagickShadeImage() shines a distant light on an image to create a
10418%  three-dimensional effect. You control the positioning of the light with
10419%  azimuth and elevation; azimuth is measured in degrees off the x axis
10420%  and elevation is measured in pixels above the Z axis.
10421%
10422%  The format of the MagickShadeImage method is:
10423%
10424%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10425%        const MagickBooleanType gray,const double azimuth,
10426%        const double elevation)
10427%
10428%  A description of each parameter follows:
10429%
10430%    o wand: the magick wand.
10431%
10432%    o gray: A value other than zero shades the intensity of each pixel.
10433%
10434%    o azimuth, elevation:  Define the light source direction.
10435%
10436*/
10437WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10438  const MagickBooleanType gray,const double asimuth,const double elevation)
10439{
10440  Image
10441    *shade_image;
10442
10443  assert(wand != (MagickWand *) NULL);
10444  assert(wand->signature == WandSignature);
10445  if (IfMagickTrue(wand->debug))
10446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10447  if (wand->images == (Image *) NULL)
10448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10449  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10450  if (shade_image == (Image *) NULL)
10451    return(MagickFalse);
10452  ReplaceImageInList(&wand->images,shade_image);
10453  return(MagickTrue);
10454}
10455
10456/*
10457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10458%                                                                             %
10459%                                                                             %
10460%                                                                             %
10461%   M a g i c k S h a d o w I m a g e                                         %
10462%                                                                             %
10463%                                                                             %
10464%                                                                             %
10465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10466%
10467%  MagickShadowImage() simulates an image shadow.
10468%
10469%  The format of the MagickShadowImage method is:
10470%
10471%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10472%        const double sigma,const ssize_t x,const ssize_t y)
10473%
10474%  A description of each parameter follows:
10475%
10476%    o wand: the magick wand.
10477%
10478%    o alpha: percentage transparency.
10479%
10480%    o sigma: the standard deviation of the Gaussian, in pixels.
10481%
10482%    o x: the shadow x-offset.
10483%
10484%    o y: the shadow y-offset.
10485%
10486*/
10487WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10488  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10489{
10490  Image
10491    *shadow_image;
10492
10493  assert(wand != (MagickWand *) NULL);
10494  assert(wand->signature == WandSignature);
10495  if (IfMagickTrue(wand->debug))
10496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10497  if (wand->images == (Image *) NULL)
10498    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10499  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10500  if (shadow_image == (Image *) NULL)
10501    return(MagickFalse);
10502  ReplaceImageInList(&wand->images,shadow_image);
10503  return(MagickTrue);
10504}
10505
10506/*
10507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10508%                                                                             %
10509%                                                                             %
10510%                                                                             %
10511%   M a g i c k S h a r p e n I m a g e                                       %
10512%                                                                             %
10513%                                                                             %
10514%                                                                             %
10515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10516%
10517%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10518%  Gaussian operator of the given radius and standard deviation (sigma).
10519%  For reasonable results, the radius should be larger than sigma.  Use a
10520%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10521%
10522%  The format of the MagickSharpenImage method is:
10523%
10524%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10525%        const double radius,const double sigma)
10526%
10527%  A description of each parameter follows:
10528%
10529%    o wand: the magick wand.
10530%
10531%    o radius: the radius of the Gaussian, in pixels, not counting the center
10532%      pixel.
10533%
10534%    o sigma: the standard deviation of the Gaussian, in pixels.
10535%
10536*/
10537WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10538  const double radius,const double sigma)
10539{
10540  Image
10541    *sharp_image;
10542
10543  assert(wand != (MagickWand *) NULL);
10544  assert(wand->signature == WandSignature);
10545  if (IfMagickTrue(wand->debug))
10546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10547  if (wand->images == (Image *) NULL)
10548    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10549  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10550  if (sharp_image == (Image *) NULL)
10551    return(MagickFalse);
10552  ReplaceImageInList(&wand->images,sharp_image);
10553  return(MagickTrue);
10554}
10555
10556/*
10557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10558%                                                                             %
10559%                                                                             %
10560%                                                                             %
10561%   M a g i c k S h a v e I m a g e                                           %
10562%                                                                             %
10563%                                                                             %
10564%                                                                             %
10565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10566%
10567%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10568%  memory necessary for the new Image structure and returns a pointer to the
10569%  new image.
10570%
10571%  The format of the MagickShaveImage method is:
10572%
10573%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10574%        const size_t columns,const size_t rows)
10575%
10576%  A description of each parameter follows:
10577%
10578%    o wand: the magick wand.
10579%
10580%    o columns: the number of columns in the scaled image.
10581%
10582%    o rows: the number of rows in the scaled image.
10583%
10584%
10585*/
10586WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10587  const size_t columns,const size_t rows)
10588{
10589  Image
10590    *shave_image;
10591
10592  RectangleInfo
10593    shave_info;
10594
10595  assert(wand != (MagickWand *) NULL);
10596  assert(wand->signature == WandSignature);
10597  if (IfMagickTrue(wand->debug))
10598    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10599  if (wand->images == (Image *) NULL)
10600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10601  shave_info.width=columns;
10602  shave_info.height=rows;
10603  shave_info.x=0;
10604  shave_info.y=0;
10605  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10606  if (shave_image == (Image *) NULL)
10607    return(MagickFalse);
10608  ReplaceImageInList(&wand->images,shave_image);
10609  return(MagickTrue);
10610}
10611
10612/*
10613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10614%                                                                             %
10615%                                                                             %
10616%                                                                             %
10617%   M a g i c k S h e a r I m a g e                                           %
10618%                                                                             %
10619%                                                                             %
10620%                                                                             %
10621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10622%
10623%  MagickShearImage() slides one edge of an image along the X or Y axis,
10624%  creating a parallelogram.  An X direction shear slides an edge along the X
10625%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10626%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10627%  is measured relative to the Y axis, and similarly, for Y direction shears
10628%  y_shear is measured relative to the X axis.  Empty triangles left over from
10629%  shearing the image are filled with the background color.
10630%
10631%  The format of the MagickShearImage method is:
10632%
10633%      MagickBooleanType MagickShearImage(MagickWand *wand,
10634%        const PixelWand *background,const double x_shear,const double y_shear)
10635%
10636%  A description of each parameter follows:
10637%
10638%    o wand: the magick wand.
10639%
10640%    o background: the background pixel wand.
10641%
10642%    o x_shear: the number of degrees to shear the image.
10643%
10644%    o y_shear: the number of degrees to shear the image.
10645%
10646*/
10647WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10648  const PixelWand *background,const double x_shear,const double y_shear)
10649{
10650  Image
10651    *shear_image;
10652
10653  assert(wand != (MagickWand *) NULL);
10654  assert(wand->signature == WandSignature);
10655  if (IfMagickTrue(wand->debug))
10656    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10657  if (wand->images == (Image *) NULL)
10658    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10659  PixelGetQuantumPacket(background,&wand->images->background_color);
10660  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10661  if (shear_image == (Image *) NULL)
10662    return(MagickFalse);
10663  ReplaceImageInList(&wand->images,shear_image);
10664  return(MagickTrue);
10665}
10666
10667/*
10668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10669%                                                                             %
10670%                                                                             %
10671%                                                                             %
10672%   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                   %
10673%                                                                             %
10674%                                                                             %
10675%                                                                             %
10676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10677%
10678%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10679%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10680%  image using a sigmoidal transfer function without saturating highlights or
10681%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10682%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10683%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10684%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10685%  is reduced.
10686%
10687%  The format of the MagickSigmoidalContrastImage method is:
10688%
10689%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10690%        const MagickBooleanType sharpen,const double alpha,const double beta)
10691%
10692%  A description of each parameter follows:
10693%
10694%    o wand: the magick wand.
10695%
10696%    o sharpen: Increase or decrease image contrast.
10697%
10698%    o alpha: strength of the contrast, the larger the number the more
10699%      'threshold-like' it becomes.
10700%
10701%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10702%
10703*/
10704WandExport MagickBooleanType MagickSigmoidalContrastImage(
10705  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10706  const double beta)
10707{
10708  MagickBooleanType
10709    status;
10710
10711  assert(wand != (MagickWand *) NULL);
10712  assert(wand->signature == WandSignature);
10713  if (IfMagickTrue(wand->debug))
10714    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10715  if (wand->images == (Image *) NULL)
10716    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10717  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10718    wand->exception);
10719  return(status);
10720}
10721
10722/*
10723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10724%                                                                             %
10725%                                                                             %
10726%                                                                             %
10727%   M a g i c k S i m i l a r i t y I m a g e                                 %
10728%                                                                             %
10729%                                                                             %
10730%                                                                             %
10731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10732%
10733%  MagickSimilarityImage() compares the reference image of the image and
10734%  returns the best match offset.  In addition, it returns a similarity image
10735%  such that an exact match location is completely white and if none of the
10736%  pixels match, black, otherwise some gray level in-between.
10737%
10738%  The format of the MagickSimilarityImage method is:
10739%
10740%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10741%        const MagickWand *reference,const MetricType metric,
10742%        RectangeInfo *offset,double *similarity)
10743%
10744%  A description of each parameter follows:
10745%
10746%    o wand: the magick wand.
10747%
10748%    o reference: the reference wand.
10749%
10750%    o metric: the metric.
10751%
10752%    o offset: the best match offset of the reference image within the image.
10753%
10754%    o similarity: the computed similarity between the images.
10755%
10756*/
10757WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10758  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10759  double *similarity)
10760{
10761  Image
10762    *similarity_image;
10763
10764  assert(wand != (MagickWand *) NULL);
10765  assert(wand->signature == WandSignature);
10766  if (IfMagickTrue(wand->debug))
10767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10768  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10769    {
10770      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10771        "ContainsNoImages","`%s'",wand->name);
10772      return((MagickWand *) NULL);
10773    }
10774  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10775    similarity,wand->exception);
10776  if (similarity_image == (Image *) NULL)
10777    return((MagickWand *) NULL);
10778  return(CloneMagickWandFromImages(wand,similarity_image));
10779}
10780
10781/*
10782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10783%                                                                             %
10784%                                                                             %
10785%                                                                             %
10786%   M a g i c k S k e t c h I m a g e                                         %
10787%                                                                             %
10788%                                                                             %
10789%                                                                             %
10790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10791%
10792%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10793%  a Gaussian operator of the given radius and standard deviation (sigma).
10794%  For reasonable results, radius should be larger than sigma.  Use a
10795%  radius of 0 and SketchImage() selects a suitable radius for you.
10796%  Angle gives the angle of the blurring motion.
10797%
10798%  The format of the MagickSketchImage method is:
10799%
10800%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10801%        const double radius,const double sigma,const double angle)
10802%
10803%  A description of each parameter follows:
10804%
10805%    o wand: the magick wand.
10806%
10807%    o radius: the radius of the Gaussian, in pixels, not counting
10808%      the center pixel.
10809%
10810%    o sigma: the standard deviation of the Gaussian, in pixels.
10811%
10812%    o angle: apply the effect along this angle.
10813%
10814*/
10815WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10816  const double radius,const double sigma,const double angle)
10817{
10818  Image
10819    *sketch_image;
10820
10821  assert(wand != (MagickWand *) NULL);
10822  assert(wand->signature == WandSignature);
10823  if (IfMagickTrue(wand->debug))
10824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10825  if (wand->images == (Image *) NULL)
10826    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10827  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10828  if (sketch_image == (Image *) NULL)
10829    return(MagickFalse);
10830  ReplaceImageInList(&wand->images,sketch_image);
10831  return(MagickTrue);
10832}
10833
10834/*
10835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10836%                                                                             %
10837%                                                                             %
10838%                                                                             %
10839%   M a g i c k S m u s h I m a g e s                                         %
10840%                                                                             %
10841%                                                                             %
10842%                                                                             %
10843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10844%
10845%  MagickSmushImages() takes all images from the current image pointer to the
10846%  end of the image list and smushs them to each other top-to-bottom if the
10847%  stack parameter is true, otherwise left-to-right.
10848%
10849%  The format of the MagickSmushImages method is:
10850%
10851%      MagickWand *MagickSmushImages(MagickWand *wand,
10852%        const MagickBooleanType stack,const ssize_t offset)
10853%
10854%  A description of each parameter follows:
10855%
10856%    o wand: the magick wand.
10857%
10858%    o stack: By default, images are stacked left-to-right. Set stack to
10859%      MagickTrue to stack them top-to-bottom.
10860%
10861%    o offset: minimum distance in pixels between images.
10862%
10863*/
10864WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10865  const MagickBooleanType stack,const ssize_t offset)
10866{
10867  Image
10868    *smush_image;
10869
10870  assert(wand != (MagickWand *) NULL);
10871  assert(wand->signature == WandSignature);
10872  if (IfMagickTrue(wand->debug))
10873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10874  if (wand->images == (Image *) NULL)
10875    return((MagickWand *) NULL);
10876  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10877  if (smush_image == (Image *) NULL)
10878    return((MagickWand *) NULL);
10879  return(CloneMagickWandFromImages(wand,smush_image));
10880}
10881
10882/*
10883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10884%                                                                             %
10885%                                                                             %
10886%                                                                             %
10887%     M a g i c k S o l a r i z e I m a g e                                   %
10888%                                                                             %
10889%                                                                             %
10890%                                                                             %
10891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10892%
10893%  MagickSolarizeImage() applies a special effect to the image, similar to the
10894%  effect achieved in a photo darkroom by selectively exposing areas of photo
10895%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10896%  measure of the extent of the solarization.
10897%
10898%  The format of the MagickSolarizeImage method is:
10899%
10900%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10901%        const double threshold)
10902%
10903%  A description of each parameter follows:
10904%
10905%    o wand: the magick wand.
10906%
10907%    o threshold:  Define the extent of the solarization.
10908%
10909*/
10910WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10911  const double threshold)
10912{
10913  MagickBooleanType
10914    status;
10915
10916  assert(wand != (MagickWand *) NULL);
10917  assert(wand->signature == WandSignature);
10918  if (IfMagickTrue(wand->debug))
10919    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10920  if (wand->images == (Image *) NULL)
10921    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10922  status=SolarizeImage(wand->images,threshold,wand->exception);
10923  return(status);
10924}
10925
10926/*
10927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10928%                                                                             %
10929%                                                                             %
10930%                                                                             %
10931%   M a g i c k S p a r s e C o l o r I m a g e                               %
10932%                                                                             %
10933%                                                                             %
10934%                                                                             %
10935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10936%
10937%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10938%  colors found at those coordinates, across the whole image, using various
10939%  methods.
10940%
10941%  The format of the MagickSparseColorImage method is:
10942%
10943%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10944%        const SparseColorMethod method,const size_t number_arguments,
10945%        const double *arguments)
10946%
10947%  A description of each parameter follows:
10948%
10949%    o image: the image to be sparseed.
10950%
10951%    o method: the method of image sparseion.
10952%
10953%        ArcSparseColorion will always ignore source image offset, and always
10954%        'bestfit' the destination image with the top left corner offset
10955%        relative to the polar mapping center.
10956%
10957%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10958%        style of image sparseion.
10959%
10960%        Affine, Perspective, and Bilinear, will do least squares fitting of
10961%        the distrotion when more than the minimum number of control point
10962%        pairs are provided.
10963%
10964%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10965%        less than 4 control point pairs are provided. While Affine sparseions
10966%        will let you use any number of control point pairs, that is Zero pairs
10967%        is a No-Op (viewport only) distrotion, one pair is a translation and
10968%        two pairs of control points will do a scale-rotate-translate, without
10969%        any shearing.
10970%
10971%    o number_arguments: the number of arguments given for this sparseion
10972%      method.
10973%
10974%    o arguments: the arguments for this sparseion method.
10975%
10976*/
10977WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10978  const SparseColorMethod method,const size_t number_arguments,
10979  const double *arguments)
10980{
10981  Image
10982    *sparse_image;
10983
10984  assert(wand != (MagickWand *) NULL);
10985  assert(wand->signature == WandSignature);
10986  if (IfMagickTrue(wand->debug))
10987    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10988  if (wand->images == (Image *) NULL)
10989    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10990  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10991    wand->exception);
10992  if (sparse_image == (Image *) NULL)
10993    return(MagickFalse);
10994  ReplaceImageInList(&wand->images,sparse_image);
10995  return(MagickTrue);
10996}
10997
10998/*
10999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11000%                                                                             %
11001%                                                                             %
11002%                                                                             %
11003%   M a g i c k S p l i c e I m a g e                                         %
11004%                                                                             %
11005%                                                                             %
11006%                                                                             %
11007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11008%
11009%  MagickSpliceImage() splices a solid color into the image.
11010%
11011%  The format of the MagickSpliceImage method is:
11012%
11013%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11014%        const size_t width,const size_t height,const ssize_t x,
11015%        const ssize_t y)
11016%
11017%  A description of each parameter follows:
11018%
11019%    o wand: the magick wand.
11020%
11021%    o width: the region width.
11022%
11023%    o height: the region height.
11024%
11025%    o x: the region x offset.
11026%
11027%    o y: the region y offset.
11028%
11029*/
11030WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11031  const size_t width,const size_t height,const ssize_t x,
11032  const ssize_t y)
11033{
11034  Image
11035    *splice_image;
11036
11037  RectangleInfo
11038    splice;
11039
11040  assert(wand != (MagickWand *) NULL);
11041  assert(wand->signature == WandSignature);
11042  if (IfMagickTrue(wand->debug))
11043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11044  if (wand->images == (Image *) NULL)
11045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11046  splice.width=width;
11047  splice.height=height;
11048  splice.x=x;
11049  splice.y=y;
11050  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11051  if (splice_image == (Image *) NULL)
11052    return(MagickFalse);
11053  ReplaceImageInList(&wand->images,splice_image);
11054  return(MagickTrue);
11055}
11056
11057/*
11058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11059%                                                                             %
11060%                                                                             %
11061%                                                                             %
11062%   M a g i c k S p r e a d I m a g e                                         %
11063%                                                                             %
11064%                                                                             %
11065%                                                                             %
11066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11067%
11068%  MagickSpreadImage() is a special effects method that randomly displaces each
11069%  pixel in a block defined by the radius parameter.
11070%
11071%  The format of the MagickSpreadImage method is:
11072%
11073%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11074%        const PixelInterpolateMethod method)
11075%
11076%  A description of each parameter follows:
11077%
11078%    o wand: the magick wand.
11079%
11080%    o radius:  Choose a random pixel in a neighborhood of this extent.
11081%
11082%    o method: the pixel interpolation method.
11083%
11084*/
11085WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11086  const double radius,const PixelInterpolateMethod method)
11087{
11088  Image
11089    *spread_image;
11090
11091  assert(wand != (MagickWand *) NULL);
11092  assert(wand->signature == WandSignature);
11093  if (IfMagickTrue(wand->debug))
11094    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11095  if (wand->images == (Image *) NULL)
11096    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11097  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11098  if (spread_image == (Image *) NULL)
11099    return(MagickFalse);
11100  ReplaceImageInList(&wand->images,spread_image);
11101  return(MagickTrue);
11102}
11103
11104/*
11105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106%                                                                             %
11107%                                                                             %
11108%                                                                             %
11109%   M a g i c k S t a t i s t i c I m a g e                                   %
11110%                                                                             %
11111%                                                                             %
11112%                                                                             %
11113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11114%
11115%  MagickStatisticImage() replace each pixel with corresponding statistic from
11116%  the neighborhood of the specified width and height.
11117%
11118%  The format of the MagickStatisticImage method is:
11119%
11120%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11121%        const StatisticType type,const double width,const size_t height)
11122%
11123%  A description of each parameter follows:
11124%
11125%    o wand: the magick wand.
11126%
11127%    o type: the statistic type (e.g. median, mode, etc.).
11128%
11129%    o width: the width of the pixel neighborhood.
11130%
11131%    o height: the height of the pixel neighborhood.
11132%
11133*/
11134WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11135  const StatisticType type,const size_t width,const size_t height)
11136{
11137  Image
11138    *statistic_image;
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  if (wand->images == (Image *) NULL)
11145    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11146  statistic_image=StatisticImage(wand->images,type,width,height,
11147    wand->exception);
11148  if (statistic_image == (Image *) NULL)
11149    return(MagickFalse);
11150  ReplaceImageInList(&wand->images,statistic_image);
11151  return(MagickTrue);
11152}
11153
11154/*
11155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11156%                                                                             %
11157%                                                                             %
11158%                                                                             %
11159%   M a g i c k S t e g a n o I m a g e                                       %
11160%                                                                             %
11161%                                                                             %
11162%                                                                             %
11163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11164%
11165%  MagickSteganoImage() hides a digital watermark within the image.
11166%  Recover the hidden watermark later to prove that the authenticity of
11167%  an image.  Offset defines the start position within the image to hide
11168%  the watermark.
11169%
11170%  The format of the MagickSteganoImage method is:
11171%
11172%      MagickWand *MagickSteganoImage(MagickWand *wand,
11173%        const MagickWand *watermark_wand,const ssize_t offset)
11174%
11175%  A description of each parameter follows:
11176%
11177%    o wand: the magick wand.
11178%
11179%    o watermark_wand: the watermark wand.
11180%
11181%    o offset: Start hiding at this offset into the image.
11182%
11183*/
11184WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11185  const MagickWand *watermark_wand,const ssize_t offset)
11186{
11187  Image
11188    *stegano_image;
11189
11190  assert(wand != (MagickWand *) NULL);
11191  assert(wand->signature == WandSignature);
11192  if (IfMagickTrue(wand->debug))
11193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11194  if ((wand->images == (Image *) NULL) ||
11195      (watermark_wand->images == (Image *) NULL))
11196    {
11197      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11198        "ContainsNoImages","`%s'",wand->name);
11199      return((MagickWand *) NULL);
11200    }
11201  wand->images->offset=offset;
11202  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11203    wand->exception);
11204  if (stegano_image == (Image *) NULL)
11205    return((MagickWand *) NULL);
11206  return(CloneMagickWandFromImages(wand,stegano_image));
11207}
11208
11209/*
11210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11211%                                                                             %
11212%                                                                             %
11213%                                                                             %
11214%   M a g i c k S t e r e o I m a g e                                         %
11215%                                                                             %
11216%                                                                             %
11217%                                                                             %
11218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11219%
11220%  MagickStereoImage() composites two images and produces a single image that
11221%  is the composite of a left and right image of a stereo pair
11222%
11223%  The format of the MagickStereoImage method is:
11224%
11225%      MagickWand *MagickStereoImage(MagickWand *wand,
11226%        const MagickWand *offset_wand)
11227%
11228%  A description of each parameter follows:
11229%
11230%    o wand: the magick wand.
11231%
11232%    o offset_wand: Another image wand.
11233%
11234*/
11235WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11236  const MagickWand *offset_wand)
11237{
11238  Image
11239    *stereo_image;
11240
11241  assert(wand != (MagickWand *) NULL);
11242  assert(wand->signature == WandSignature);
11243  if (IfMagickTrue(wand->debug))
11244    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245  if ((wand->images == (Image *) NULL) ||
11246      (offset_wand->images == (Image *) NULL))
11247    {
11248      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11249        "ContainsNoImages","`%s'",wand->name);
11250      return((MagickWand *) NULL);
11251    }
11252  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11253  if (stereo_image == (Image *) NULL)
11254    return((MagickWand *) NULL);
11255  return(CloneMagickWandFromImages(wand,stereo_image));
11256}
11257
11258/*
11259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11260%                                                                             %
11261%                                                                             %
11262%                                                                             %
11263%   M a g i c k S t r i p I m a g e                                           %
11264%                                                                             %
11265%                                                                             %
11266%                                                                             %
11267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11268%
11269%  MagickStripImage() strips an image of all profiles and comments.
11270%
11271%  The format of the MagickStripImage method is:
11272%
11273%      MagickBooleanType MagickStripImage(MagickWand *wand)
11274%
11275%  A description of each parameter follows:
11276%
11277%    o wand: the magick wand.
11278%
11279*/
11280WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11281{
11282  assert(wand != (MagickWand *) NULL);
11283  assert(wand->signature == WandSignature);
11284  if (IfMagickTrue(wand->debug))
11285    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11286  if (wand->images == (Image *) NULL)
11287    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11288  return(StripImage(wand->images,wand->exception));
11289}
11290
11291/*
11292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11293%                                                                             %
11294%                                                                             %
11295%                                                                             %
11296%   M a g i c k S w i r l I m a g e                                           %
11297%                                                                             %
11298%                                                                             %
11299%                                                                             %
11300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11301%
11302%  MagickSwirlImage() swirls the pixels about the center of the image, where
11303%  degrees indicates the sweep of the arc through which each pixel is moved.
11304%  You get a more dramatic effect as the degrees move from 1 to 360.
11305%
11306%  The format of the MagickSwirlImage method is:
11307%
11308%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11309%        const PixelInterpolateMethod method)
11310%
11311%  A description of each parameter follows:
11312%
11313%    o wand: the magick wand.
11314%
11315%    o degrees: Define the tightness of the swirling effect.
11316%
11317%    o method: the pixel interpolation method.
11318%
11319*/
11320WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11321  const double degrees,const PixelInterpolateMethod method)
11322{
11323  Image
11324    *swirl_image;
11325
11326  assert(wand != (MagickWand *) NULL);
11327  assert(wand->signature == WandSignature);
11328  if (IfMagickTrue(wand->debug))
11329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11330  if (wand->images == (Image *) NULL)
11331    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11332  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11333  if (swirl_image == (Image *) NULL)
11334    return(MagickFalse);
11335  ReplaceImageInList(&wand->images,swirl_image);
11336  return(MagickTrue);
11337}
11338
11339/*
11340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11341%                                                                             %
11342%                                                                             %
11343%                                                                             %
11344%   M a g i c k T e x t u r e I m a g e                                       %
11345%                                                                             %
11346%                                                                             %
11347%                                                                             %
11348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11349%
11350%  MagickTextureImage() repeatedly tiles the texture image across and down the
11351%  image canvas.
11352%
11353%  The format of the MagickTextureImage method is:
11354%
11355%      MagickWand *MagickTextureImage(MagickWand *wand,
11356%        const MagickWand *texture_wand)
11357%
11358%  A description of each parameter follows:
11359%
11360%    o wand: the magick wand.
11361%
11362%    o texture_wand: the texture wand
11363%
11364*/
11365WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11366  const MagickWand *texture_wand)
11367{
11368  Image
11369    *texture_image;
11370
11371  MagickBooleanType
11372    status;
11373
11374  assert(wand != (MagickWand *) NULL);
11375  assert(wand->signature == WandSignature);
11376  if (IfMagickTrue(wand->debug))
11377    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11378  if ((wand->images == (Image *) NULL) ||
11379      (texture_wand->images == (Image *) NULL))
11380    {
11381      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11382        "ContainsNoImages","`%s'",wand->name);
11383      return((MagickWand *) NULL);
11384    }
11385  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11386  if (texture_image == (Image *) NULL)
11387    return((MagickWand *) NULL);
11388  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11389  if (IfMagickFalse(status))
11390    {
11391      texture_image=DestroyImage(texture_image);
11392      return((MagickWand *) NULL);
11393    }
11394  return(CloneMagickWandFromImages(wand,texture_image));
11395}
11396
11397/*
11398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11399%                                                                             %
11400%                                                                             %
11401%                                                                             %
11402%   M a g i c k T h r e s h o l d I m a g e                                   %
11403%                                                                             %
11404%                                                                             %
11405%                                                                             %
11406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11407%
11408%  MagickThresholdImage() changes the value of individual pixels based on
11409%  the intensity of each pixel compared to threshold.  The result is a
11410%  high-contrast, two color image.
11411%
11412%  The format of the MagickThresholdImage method is:
11413%
11414%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11415%        const double threshold)
11416%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11417%        const ChannelType channel,const double threshold)
11418%
11419%  A description of each parameter follows:
11420%
11421%    o wand: the magick wand.
11422%
11423%    o channel: the image channel(s).
11424%
11425%    o threshold: Define the threshold value.
11426%
11427*/
11428WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11429  const double threshold)
11430{
11431  MagickBooleanType
11432    status;
11433
11434  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11435  return(status);
11436}
11437
11438WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11439  const ChannelType channel,const double threshold)
11440{
11441  MagickBooleanType
11442    status;
11443
11444  assert(wand != (MagickWand *) NULL);
11445  assert(wand->signature == WandSignature);
11446  if (IfMagickTrue(wand->debug))
11447    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11448  if (wand->images == (Image *) NULL)
11449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11450  status=BilevelImage(wand->images,threshold,wand->exception);
11451  return(status);
11452}
11453
11454/*
11455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11456%                                                                             %
11457%                                                                             %
11458%                                                                             %
11459%   M a g i c k T h u m b n a i l I m a g e                                   %
11460%                                                                             %
11461%                                                                             %
11462%                                                                             %
11463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11464%
11465%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11466%  and removes any associated profiles.  The goal is to produce small low cost
11467%  thumbnail images suited for display on the Web.
11468%
11469%  The format of the MagickThumbnailImage method is:
11470%
11471%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11472%        const size_t columns,const size_t rows)
11473%
11474%  A description of each parameter follows:
11475%
11476%    o wand: the magick wand.
11477%
11478%    o columns: the number of columns in the scaled image.
11479%
11480%    o rows: the number of rows in the scaled image.
11481%
11482*/
11483WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11484  const size_t columns,const size_t rows)
11485{
11486  Image
11487    *thumbnail_image;
11488
11489  assert(wand != (MagickWand *) NULL);
11490  assert(wand->signature == WandSignature);
11491  if (IfMagickTrue(wand->debug))
11492    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11493  if (wand->images == (Image *) NULL)
11494    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11495  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11496  if (thumbnail_image == (Image *) NULL)
11497    return(MagickFalse);
11498  ReplaceImageInList(&wand->images,thumbnail_image);
11499  return(MagickTrue);
11500}
11501
11502/*
11503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11504%                                                                             %
11505%                                                                             %
11506%                                                                             %
11507%   M a g i c k T i n t I m a g e                                             %
11508%                                                                             %
11509%                                                                             %
11510%                                                                             %
11511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11512%
11513%  MagickTintImage() applies a color vector to each pixel in the image.  The
11514%  length of the vector is 0 for black and white and at its maximum for the
11515%  midtones.  The vector weighting function is
11516%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11517%
11518%  The format of the MagickTintImage method is:
11519%
11520%      MagickBooleanType MagickTintImage(MagickWand *wand,
11521%        const PixelWand *tint,const PixelWand *blend)
11522%
11523%  A description of each parameter follows:
11524%
11525%    o wand: the magick wand.
11526%
11527%    o tint: the tint pixel wand.
11528%
11529%    o alpha: the alpha pixel wand.
11530%
11531*/
11532WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11533  const PixelWand *tint,const PixelWand *blend)
11534{
11535  char
11536    percent_blend[MaxTextExtent];
11537
11538  Image
11539    *tint_image;
11540
11541  PixelInfo
11542    target;
11543
11544  assert(wand != (MagickWand *) NULL);
11545  assert(wand->signature == WandSignature);
11546  if (IfMagickTrue(wand->debug))
11547    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11548  if (wand->images == (Image *) NULL)
11549    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11550  if (wand->images->colorspace != CMYKColorspace)
11551    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11552      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11553      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11554      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11555      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11556      PixelGetAlphaQuantum(blend)));
11557  else
11558    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11559      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11560      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11561      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11562      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11563      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11564      PixelGetAlphaQuantum(blend)));
11565  target=PixelGetPixel(tint);
11566  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11567  if (tint_image == (Image *) NULL)
11568    return(MagickFalse);
11569  ReplaceImageInList(&wand->images,tint_image);
11570  return(MagickTrue);
11571}
11572
11573/*
11574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11575%                                                                             %
11576%                                                                             %
11577%                                                                             %
11578%   M a g i c k T r a n s f o r m I m a g e                                   %
11579%                                                                             %
11580%                                                                             %
11581%                                                                             %
11582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11583%
11584%  MagickTransformImage() is a convenience method that behaves like
11585%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11586%  information as a region geometry specification.  If the operation fails,
11587%  a NULL image handle is returned.
11588%
11589%  The format of the MagickTransformImage method is:
11590%
11591%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11592%        const char *geometry)
11593%
11594%  A description of each parameter follows:
11595%
11596%    o wand: the magick wand.
11597%
11598%    o crop: A crop geometry string.  This geometry defines a subregion of the
11599%      image to crop.
11600%
11601%    o geometry: An image geometry string.  This geometry defines the final
11602%      size of the image.
11603%
11604*/
11605WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11606  const char *crop,const char *geometry)
11607{
11608  Image
11609    *transform_image;
11610
11611  MagickBooleanType
11612    status;
11613
11614  assert(wand != (MagickWand *) NULL);
11615  assert(wand->signature == WandSignature);
11616  if (IfMagickTrue(wand->debug))
11617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11618  if (wand->images == (Image *) NULL)
11619    return((MagickWand *) NULL);
11620  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11621  if (transform_image == (Image *) NULL)
11622    return((MagickWand *) NULL);
11623  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11624  if (IfMagickFalse(status))
11625    {
11626      transform_image=DestroyImage(transform_image);
11627      return((MagickWand *) NULL);
11628    }
11629  return(CloneMagickWandFromImages(wand,transform_image));
11630}
11631
11632/*
11633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11634%                                                                             %
11635%                                                                             %
11636%                                                                             %
11637%   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               %
11638%                                                                             %
11639%                                                                             %
11640%                                                                             %
11641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642%
11643%  MagickTransformImageColorspace() transform the image colorspace, setting
11644%  the images colorspace while transforming the images data to that
11645%  colorspace.
11646%
11647%  The format of the MagickTransformImageColorspace method is:
11648%
11649%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11650%        const ColorspaceType colorspace)
11651%
11652%  A description of each parameter follows:
11653%
11654%    o wand: the magick wand.
11655%
11656%    o colorspace: the image colorspace:   UndefinedColorspace,
11657%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11658%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11659%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11660%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11661%      HSLColorspace, HWBColorspace.
11662%
11663*/
11664WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11665  const ColorspaceType colorspace)
11666{
11667  assert(wand != (MagickWand *) NULL);
11668  assert(wand->signature == WandSignature);
11669  if (IfMagickTrue(wand->debug))
11670    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11671  if (wand->images == (Image *) NULL)
11672    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11673  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11674}
11675
11676/*
11677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11678%                                                                             %
11679%                                                                             %
11680%                                                                             %
11681%   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                     %
11682%                                                                             %
11683%                                                                             %
11684%                                                                             %
11685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11686%
11687%  MagickTransparentPaintImage() changes any pixel that matches color with the
11688%  color defined by fill.
11689%
11690%  The format of the MagickTransparentPaintImage method is:
11691%
11692%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11693%        const PixelWand *target,const double alpha,const double fuzz,
11694%        const MagickBooleanType invert)
11695%
11696%  A description of each parameter follows:
11697%
11698%    o wand: the magick wand.
11699%
11700%    o target: Change this target color to specified alpha value within
11701%      the image.
11702%
11703%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11704%      transparent.
11705%
11706%    o fuzz: By default target must match a particular pixel color
11707%      exactly.  However, in many cases two colors may differ by a small amount.
11708%      The fuzz member of image defines how much tolerance is acceptable to
11709%      consider two colors as the same.  For example, set fuzz to 10 and the
11710%      color red at intensities of 100 and 102 respectively are now interpreted
11711%      as the same color for the purposes of the floodfill.
11712%
11713%    o invert: paint any pixel that does not match the target color.
11714%
11715*/
11716WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11717  const PixelWand *target,const double alpha,const double fuzz,
11718  const MagickBooleanType invert)
11719{
11720  MagickBooleanType
11721    status;
11722
11723  PixelInfo
11724    target_pixel;
11725
11726  assert(wand != (MagickWand *) NULL);
11727  assert(wand->signature == WandSignature);
11728  if (IfMagickTrue(wand->debug))
11729    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11730  if (wand->images == (Image *) NULL)
11731    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11732  PixelGetMagickColor(target,&target_pixel);
11733  wand->images->fuzz=fuzz;
11734  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11735    QuantumRange*alpha),invert,wand->exception);
11736  return(status);
11737}
11738
11739/*
11740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11741%                                                                             %
11742%                                                                             %
11743%                                                                             %
11744%   M a g i c k T r a n s p o s e I m a g e                                   %
11745%                                                                             %
11746%                                                                             %
11747%                                                                             %
11748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11749%
11750%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11751%  pixels around the central x-axis while rotating them 90-degrees.
11752%
11753%  The format of the MagickTransposeImage method is:
11754%
11755%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11756%
11757%  A description of each parameter follows:
11758%
11759%    o wand: the magick wand.
11760%
11761*/
11762WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11763{
11764  Image
11765    *transpose_image;
11766
11767  assert(wand != (MagickWand *) NULL);
11768  assert(wand->signature == WandSignature);
11769  if (IfMagickTrue(wand->debug))
11770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11771  if (wand->images == (Image *) NULL)
11772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11773  transpose_image=TransposeImage(wand->images,wand->exception);
11774  if (transpose_image == (Image *) NULL)
11775    return(MagickFalse);
11776  ReplaceImageInList(&wand->images,transpose_image);
11777  return(MagickTrue);
11778}
11779
11780/*
11781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11782%                                                                             %
11783%                                                                             %
11784%                                                                             %
11785%   M a g i c k T r a n s v e r s e I m a g e                                 %
11786%                                                                             %
11787%                                                                             %
11788%                                                                             %
11789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11790%
11791%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11792%  pixels around the central y-axis while rotating them 270-degrees.
11793%
11794%  The format of the MagickTransverseImage method is:
11795%
11796%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11797%
11798%  A description of each parameter follows:
11799%
11800%    o wand: the magick wand.
11801%
11802*/
11803WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11804{
11805  Image
11806    *transverse_image;
11807
11808  assert(wand != (MagickWand *) NULL);
11809  assert(wand->signature == WandSignature);
11810  if (IfMagickTrue(wand->debug))
11811    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11812  if (wand->images == (Image *) NULL)
11813    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11814  transverse_image=TransverseImage(wand->images,wand->exception);
11815  if (transverse_image == (Image *) NULL)
11816    return(MagickFalse);
11817  ReplaceImageInList(&wand->images,transverse_image);
11818  return(MagickTrue);
11819}
11820
11821/*
11822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11823%                                                                             %
11824%                                                                             %
11825%                                                                             %
11826%   M a g i c k T r i m I m a g e                                             %
11827%                                                                             %
11828%                                                                             %
11829%                                                                             %
11830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11831%
11832%  MagickTrimImage() remove edges that are the background color from the image.
11833%
11834%  The format of the MagickTrimImage method is:
11835%
11836%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11837%
11838%  A description of each parameter follows:
11839%
11840%    o wand: the magick wand.
11841%
11842%    o fuzz: By default target must match a particular pixel color
11843%      exactly.  However, in many cases two colors may differ by a small amount.
11844%      The fuzz member of image defines how much tolerance is acceptable to
11845%      consider two colors as the same.  For example, set fuzz to 10 and the
11846%      color red at intensities of 100 and 102 respectively are now interpreted
11847%      as the same color for the purposes of the floodfill.
11848%
11849*/
11850WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11851{
11852  Image
11853    *trim_image;
11854
11855  assert(wand != (MagickWand *) NULL);
11856  assert(wand->signature == WandSignature);
11857  if (IfMagickTrue(wand->debug))
11858    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11859  if (wand->images == (Image *) NULL)
11860    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11861  wand->images->fuzz=fuzz;
11862  trim_image=TrimImage(wand->images,wand->exception);
11863  if (trim_image == (Image *) NULL)
11864    return(MagickFalse);
11865  ReplaceImageInList(&wand->images,trim_image);
11866  return(MagickTrue);
11867}
11868
11869/*
11870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11871%                                                                             %
11872%                                                                             %
11873%                                                                             %
11874%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11875%                                                                             %
11876%                                                                             %
11877%                                                                             %
11878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11879%
11880%  MagickUniqueImageColors() discards all but one of any pixel color.
11881%
11882%  The format of the MagickUniqueImageColors method is:
11883%
11884%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11885%
11886%  A description of each parameter follows:
11887%
11888%    o wand: the magick wand.
11889%
11890*/
11891WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11892{
11893  Image
11894    *unique_image;
11895
11896  assert(wand != (MagickWand *) NULL);
11897  assert(wand->signature == WandSignature);
11898  if (IfMagickTrue(wand->debug))
11899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11900  if (wand->images == (Image *) NULL)
11901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11902  unique_image=UniqueImageColors(wand->images,wand->exception);
11903  if (unique_image == (Image *) NULL)
11904    return(MagickFalse);
11905  ReplaceImageInList(&wand->images,unique_image);
11906  return(MagickTrue);
11907}
11908
11909/*
11910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11911%                                                                             %
11912%                                                                             %
11913%                                                                             %
11914%   M a g i c k U n s h a r p M a s k I m a g e                               %
11915%                                                                             %
11916%                                                                             %
11917%                                                                             %
11918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11919%
11920%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11921%  Gaussian operator of the given radius and standard deviation (sigma).
11922%  For reasonable results, radius should be larger than sigma.  Use a radius
11923%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11924%
11925%  The format of the MagickUnsharpMaskImage method is:
11926%
11927%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11928%        const double radius,const double sigma,const double amount,
11929%        const double threshold)
11930%
11931%  A description of each parameter follows:
11932%
11933%    o wand: the magick wand.
11934%
11935%    o radius: the radius of the Gaussian, in pixels, not counting the center
11936%      pixel.
11937%
11938%    o sigma: the standard deviation of the Gaussian, in pixels.
11939%
11940%    o amount: the percentage of the difference between the original and the
11941%      blur image that is added back into the original.
11942%
11943%    o threshold: the threshold in pixels needed to apply the diffence amount.
11944%
11945*/
11946WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11947  const double radius,const double sigma,const double amount,
11948  const double threshold)
11949{
11950  Image
11951    *unsharp_image;
11952
11953  assert(wand != (MagickWand *) NULL);
11954  assert(wand->signature == WandSignature);
11955  if (IfMagickTrue(wand->debug))
11956    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11957  if (wand->images == (Image *) NULL)
11958    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11959  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11960    wand->exception);
11961  if (unsharp_image == (Image *) NULL)
11962    return(MagickFalse);
11963  ReplaceImageInList(&wand->images,unsharp_image);
11964  return(MagickTrue);
11965}
11966
11967/*
11968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11969%                                                                             %
11970%                                                                             %
11971%                                                                             %
11972%   M a g i c k V i g n e t t e I m a g e                                     %
11973%                                                                             %
11974%                                                                             %
11975%                                                                             %
11976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11977%
11978%  MagickVignetteImage() softens the edges of the image in vignette style.
11979%
11980%  The format of the MagickVignetteImage method is:
11981%
11982%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11983%        const double radius,const double sigma,const ssize_t x,
11984%        const ssize_t y)
11985%
11986%  A description of each parameter follows:
11987%
11988%    o wand: the magick wand.
11989%
11990%    o radius: the radius.
11991%
11992%    o sigma: the sigma.
11993%
11994%    o x, y:  Define the x and y ellipse offset.
11995%
11996*/
11997WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11998  const double radius,const double sigma,const ssize_t x,const ssize_t y)
11999{
12000  Image
12001    *vignette_image;
12002
12003  assert(wand != (MagickWand *) NULL);
12004  assert(wand->signature == WandSignature);
12005  if (IfMagickTrue(wand->debug))
12006    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12007  if (wand->images == (Image *) NULL)
12008    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12009  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12010  if (vignette_image == (Image *) NULL)
12011    return(MagickFalse);
12012  ReplaceImageInList(&wand->images,vignette_image);
12013  return(MagickTrue);
12014}
12015
12016/*
12017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12018%                                                                             %
12019%                                                                             %
12020%                                                                             %
12021%   M a g i c k W a v e I m a g e                                             %
12022%                                                                             %
12023%                                                                             %
12024%                                                                             %
12025%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12026%
12027%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12028%  the pixels vertically along a sine wave whose amplitude and wavelength
12029%  is specified by the given parameters.
12030%
12031%  The format of the MagickWaveImage method is:
12032%
12033%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12034%        const double amplitude,const double wave_length,
12035%        const PixelInterpolateMethod method)
12036%
12037%  A description of each parameter follows:
12038%
12039%    o wand: the magick wand.
12040%
12041%    o amplitude, wave_length:  Define the amplitude and wave length of the
12042%      sine wave.
12043%
12044%    o method: the pixel interpolation method.
12045%
12046*/
12047WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12048  const double amplitude,const double wave_length,
12049  const PixelInterpolateMethod method)
12050{
12051  Image
12052    *wave_image;
12053
12054  assert(wand != (MagickWand *) NULL);
12055  assert(wand->signature == WandSignature);
12056  if (IfMagickTrue(wand->debug))
12057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12058  if (wand->images == (Image *) NULL)
12059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12060  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12061    wand->exception);
12062  if (wave_image == (Image *) NULL)
12063    return(MagickFalse);
12064  ReplaceImageInList(&wand->images,wave_image);
12065  return(MagickTrue);
12066}
12067
12068/*
12069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12070%                                                                             %
12071%                                                                             %
12072%                                                                             %
12073%   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                         %
12074%                                                                             %
12075%                                                                             %
12076%                                                                             %
12077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12078%
12079%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12080%  above the threshold into white while leaving all pixels below the threshold
12081%  unchanged.
12082%
12083%  The format of the MagickWhiteThresholdImage method is:
12084%
12085%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12086%        const PixelWand *threshold)
12087%
12088%  A description of each parameter follows:
12089%
12090%    o wand: the magick wand.
12091%
12092%    o threshold: the pixel wand.
12093%
12094*/
12095WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12096  const PixelWand *threshold)
12097{
12098  char
12099    thresholds[MaxTextExtent];
12100
12101  assert(wand != (MagickWand *) NULL);
12102  assert(wand->signature == WandSignature);
12103  if (IfMagickTrue(wand->debug))
12104    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12105  if (wand->images == (Image *) NULL)
12106    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12107  (void) FormatLocaleString(thresholds,MaxTextExtent,
12108    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12109    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12110    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12111  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12112}
12113
12114/*
12115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12116%                                                                             %
12117%                                                                             %
12118%                                                                             %
12119%   M a g i c k W r i t e I m a g e                                           %
12120%                                                                             %
12121%                                                                             %
12122%                                                                             %
12123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12124%
12125%  MagickWriteImage() writes an image to the specified filename.  If the
12126%  filename parameter is NULL, the image is written to the filename set
12127%  by MagickReadImage() or MagickSetImageFilename().
12128%
12129%  The format of the MagickWriteImage method is:
12130%
12131%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12132%        const char *filename)
12133%
12134%  A description of each parameter follows:
12135%
12136%    o wand: the magick wand.
12137%
12138%    o filename: the image filename.
12139%
12140%
12141*/
12142WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12143  const char *filename)
12144{
12145  Image
12146    *image;
12147
12148  ImageInfo
12149    *write_info;
12150
12151  MagickBooleanType
12152    status;
12153
12154  assert(wand != (MagickWand *) NULL);
12155  assert(wand->signature == WandSignature);
12156  if (IfMagickTrue(wand->debug))
12157    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12158  if (wand->images == (Image *) NULL)
12159    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12160  if (filename != (const char *) NULL)
12161    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12162  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12163  if (image == (Image *) NULL)
12164    return(MagickFalse);
12165  write_info=CloneImageInfo(wand->image_info);
12166  write_info->adjoin=MagickTrue;
12167  status=WriteImage(write_info,image,wand->exception);
12168  image=DestroyImage(image);
12169  write_info=DestroyImageInfo(write_info);
12170  return(status);
12171}
12172
12173/*
12174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12175%                                                                             %
12176%                                                                             %
12177%                                                                             %
12178%   M a g i c k W r i t e I m a g e F i l e                                   %
12179%                                                                             %
12180%                                                                             %
12181%                                                                             %
12182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12183%
12184%  MagickWriteImageFile() writes an image to an open file descriptor.
12185%
12186%  The format of the MagickWriteImageFile method is:
12187%
12188%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12189%
12190%  A description of each parameter follows:
12191%
12192%    o wand: the magick wand.
12193%
12194%    o file: the file descriptor.
12195%
12196*/
12197WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12198{
12199  Image
12200    *image;
12201
12202  ImageInfo
12203    *write_info;
12204
12205  MagickBooleanType
12206    status;
12207
12208  assert(wand != (MagickWand *) NULL);
12209  assert(wand->signature == WandSignature);
12210  assert(file != (FILE *) NULL);
12211  if (IfMagickTrue(wand->debug))
12212    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12213  if (wand->images == (Image *) NULL)
12214    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12215  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12216  if (image == (Image *) NULL)
12217    return(MagickFalse);
12218  write_info=CloneImageInfo(wand->image_info);
12219  SetImageInfoFile(write_info,file);
12220  write_info->adjoin=MagickTrue;
12221  status=WriteImage(write_info,image,wand->exception);
12222  write_info=DestroyImageInfo(write_info);
12223  image=DestroyImage(image);
12224  return(status);
12225}
12226
12227/*
12228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12229%                                                                             %
12230%                                                                             %
12231%                                                                             %
12232%   M a g i c k W r i t e I m a g e s                                         %
12233%                                                                             %
12234%                                                                             %
12235%                                                                             %
12236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12237%
12238%  MagickWriteImages() writes an image or image sequence.
12239%
12240%  The format of the MagickWriteImages method is:
12241%
12242%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12243%        const char *filename,const MagickBooleanType adjoin)
12244%
12245%  A description of each parameter follows:
12246%
12247%    o wand: the magick wand.
12248%
12249%    o filename: the image filename.
12250%
12251%    o adjoin: join images into a single multi-image file.
12252%
12253*/
12254WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12255  const char *filename,const MagickBooleanType adjoin)
12256{
12257  ImageInfo
12258    *write_info;
12259
12260  MagickBooleanType
12261    status;
12262
12263  assert(wand != (MagickWand *) NULL);
12264  assert(wand->signature == WandSignature);
12265  if (IfMagickTrue(wand->debug))
12266    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12267  if (wand->images == (Image *) NULL)
12268    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12269  write_info=CloneImageInfo(wand->image_info);
12270  write_info->adjoin=adjoin;
12271  status=WriteImages(write_info,wand->images,filename,wand->exception);
12272  write_info=DestroyImageInfo(write_info);
12273  return(status);
12274}
12275
12276/*
12277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12278%                                                                             %
12279%                                                                             %
12280%                                                                             %
12281%   M a g i c k W r i t e I m a g e s F i l e                                 %
12282%                                                                             %
12283%                                                                             %
12284%                                                                             %
12285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12286%
12287%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12288%
12289%  The format of the MagickWriteImagesFile method is:
12290%
12291%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12292%
12293%  A description of each parameter follows:
12294%
12295%    o wand: the magick wand.
12296%
12297%    o file: the file descriptor.
12298%
12299*/
12300WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12301{
12302  ImageInfo
12303    *write_info;
12304
12305  MagickBooleanType
12306    status;
12307
12308  assert(wand != (MagickWand *) NULL);
12309  assert(wand->signature == WandSignature);
12310  if (IfMagickTrue(wand->debug))
12311    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12312  if (wand->images == (Image *) NULL)
12313    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12314  write_info=CloneImageInfo(wand->image_info);
12315  SetImageInfoFile(write_info,file);
12316  write_info->adjoin=MagickTrue;
12317  status=WriteImages(write_info,wand->images,(const char *) NULL,
12318    wand->exception);
12319  write_info=DestroyImageInfo(write_info);
12320  return(status);
12321}
12322