magick-image.c revision 6539b7942ac1739d21d25d6d85e2a10df4fda1d8
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7%                 MM MM  A   A  G        I    C      K  K                     %
8%                 M M M  AAAAA  G GGG    I    C      KKK                      %
9%                 M   M  A   A  G   G    I    C      K  K                     %
10%                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11%                                                                             %
12%                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13%                       I    MM MM  A   A  G      E                           %
14%                       I    M M M  AAAAA  G  GG  EEE                         %
15%                       I    M   M  A   A  G   G  E                           %
16%                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17%                                                                             %
18%                                                                             %
19%                          MagickWand Image Methods                           %
20%                                                                             %
21%                               Software Design                               %
22%                                 John Cristy                                 %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
27%  dedicated to making software imaging solutions freely available.           %
28%                                                                             %
29%  You may not use this file except in compliance with the License.  You may  %
30%  obtain a copy of the License at                                            %
31%                                                                             %
32%    http://www.imagemagick.org/script/license.php                            %
33%                                                                             %
34%  Unless required by applicable law or agreed to in writing, software        %
35%  distributed under the License is distributed on an "AS IS" BASIS,          %
36%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37%  See the License for the specific language governing permissions and        %
38%  limitations under the License.                                             %
39%                                                                             %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47  Include declarations.
48*/
49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
54
55/*
56  Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61    tag,"'%s'",context); \
62  return(MagickFalse); \
63}
64#define MagickWandId  "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68%                                                                             %
69%                                                                             %
70%                                                                             %
71+   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72%                                                                             %
73%                                                                             %
74%                                                                             %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78%  list.
79%
80%  The format of the CloneMagickWandFromImages method is:
81%
82%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83%        Image *images)
84%
85%  A description of each parameter follows:
86%
87%    o wand: the magick wand.
88%
89%    o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93  Image *images)
94{
95  MagickWand
96    *clone_wand;
97
98  assert(wand != (MagickWand *) NULL);
99  assert(wand->signature == WandSignature);
100  if( IfMagickTrue(wand->debug) )
101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102
103  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
104  if (clone_wand == (MagickWand *) NULL)
105    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
106      images->filename);
107  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
108  clone_wand->id=AcquireWandId();
109  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
110    MagickWandId,(double) clone_wand->id);
111  clone_wand->exception=AcquireExceptionInfo();
112  InheritException(clone_wand->exception,wand->exception);
113  clone_wand->image_info=CloneImageInfo(wand->image_info);
114  clone_wand->images=images;
115  clone_wand->debug=IsEventLogging();
116  clone_wand->signature=WandSignature;
117
118  if( IfMagickTrue(clone_wand->debug) )
119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
120  return(clone_wand);
121}
122
123/*
124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125%                                                                             %
126%                                                                             %
127%                                                                             %
128%   G e t I m a g e F r o m M a g i c k W a n d                               %
129%                                                                             %
130%                                                                             %
131%                                                                             %
132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133%
134%  GetImageFromMagickWand() returns the current image from the magick wand.
135%
136%  The format of the GetImageFromMagickWand method is:
137%
138%      Image *GetImageFromMagickWand(const MagickWand *wand)
139%
140%  A description of each parameter follows:
141%
142%    o wand: the magick wand.
143%
144*/
145WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
146{
147  assert(wand != (MagickWand *) NULL);
148  assert(wand->signature == WandSignature);
149  if( IfMagickTrue(wand->debug) )
150    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
151  if (wand->images == (Image *) NULL)
152    {
153      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
154        "ContainsNoImages","'%s'",wand->name);
155      return((Image *) NULL);
156    }
157  return(wand->images);
158}
159
160/*
161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162%                                                                             %
163%                                                                             %
164%                                                                             %
165%   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
166%                                                                             %
167%                                                                             %
168%                                                                             %
169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170%
171%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
172%  less intensely near image edges and more intensely far from edges. We
173%  blur the image with a Gaussian operator of the given radius and standard
174%  deviation (sigma).  For reasonable results, radius should be larger than
175%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
176%  suitable radius for you.
177%
178%  The format of the MagickAdaptiveBlurImage method is:
179%
180%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
181%        const double radius,const double sigma)
182%
183%  A description of each parameter follows:
184%
185%    o wand: the magick wand.
186%
187%    o radius: the radius of the Gaussian, in pixels, not counting the center
188%      pixel.
189%
190%    o sigma: the standard deviation of the Gaussian, in pixels.
191%
192*/
193WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
194  const double radius,const double sigma)
195{
196  Image
197    *sharp_image;
198
199  assert(wand != (MagickWand *) NULL);
200  assert(wand->signature == WandSignature);
201  if( IfMagickTrue(wand->debug) )
202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
203
204  if (wand->images == (Image *) NULL)
205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
206  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
207  if (sharp_image == (Image *) NULL)
208    return(MagickFalse);
209  ReplaceImageInList(&wand->images,sharp_image);
210  return(MagickTrue);
211}
212
213/*
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%                                                                             %
216%                                                                             %
217%                                                                             %
218%   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
219%                                                                             %
220%                                                                             %
221%                                                                             %
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223%
224%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225%  triangulation.
226%
227%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228%        const size_t columns,const size_t rows)
229%
230%  A description of each parameter follows:
231%
232%    o wand: the magick wand.
233%
234%    o columns: the number of columns in the scaled image.
235%
236%    o rows: the number of rows in the scaled image.
237%
238*/
239WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
240  const size_t columns,const size_t rows)
241{
242  Image
243    *resize_image;
244
245  assert(wand != (MagickWand *) NULL);
246  assert(wand->signature == WandSignature);
247  if( IfMagickTrue(wand->debug) )
248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
249
250  if (wand->images == (Image *) NULL)
251    ThrowWandException(WandError,"ContainsNoImages",wand->name);
252  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
253  if (resize_image == (Image *) NULL)
254    return(MagickFalse);
255  ReplaceImageInList(&wand->images,resize_image);
256  return(MagickTrue);
257}
258
259/*
260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261%                                                                             %
262%                                                                             %
263%                                                                             %
264%   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
265%                                                                             %
266%                                                                             %
267%                                                                             %
268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
269%
270%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
271%  more intensely near image edges and less intensely far from edges. We
272%  sharpen the image with a Gaussian operator of the given radius and standard
273%  deviation (sigma).  For reasonable results, radius should be larger than
274%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
275%  suitable radius for you.
276%
277%  The format of the MagickAdaptiveSharpenImage method is:
278%
279%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
280%        const double radius,const double sigma)
281%
282%  A description of each parameter follows:
283%
284%    o wand: the magick wand.
285%
286%    o radius: the radius of the Gaussian, in pixels, not counting the center
287%      pixel.
288%
289%    o sigma: the standard deviation of the Gaussian, in pixels.
290%
291*/
292WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293  const double radius,const double sigma)
294{
295  Image
296    *sharp_image;
297
298  assert(wand != (MagickWand *) NULL);
299  assert(wand->signature == WandSignature);
300  if( IfMagickTrue(wand->debug) )
301    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
302
303  if (wand->images == (Image *) NULL)
304    ThrowWandException(WandError,"ContainsNoImages",wand->name);
305  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
306  if (sharp_image == (Image *) NULL)
307    return(MagickFalse);
308  ReplaceImageInList(&wand->images,sharp_image);
309  return(MagickTrue);
310}
311
312/*
313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314%                                                                             %
315%                                                                             %
316%                                                                             %
317%   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
318%                                                                             %
319%                                                                             %
320%                                                                             %
321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322%
323%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
324%  based on the range of intensity values in its local neighborhood.  This
325%  allows for thresholding of an image whose global intensity histogram
326%  doesn't contain distinctive peaks.
327%
328%  The format of the AdaptiveThresholdImage method is:
329%
330%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
331%        const size_t width,const size_t height,const double bias)
332%
333%  A description of each parameter follows:
334%
335%    o wand: the magick wand.
336%
337%    o width: the width of the local neighborhood.
338%
339%    o height: the height of the local neighborhood.
340%
341%    o offset: the mean bias.
342%
343*/
344WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
345  const size_t width,const size_t height,const double bias)
346{
347  Image
348    *threshold_image;
349
350  assert(wand != (MagickWand *) NULL);
351  assert(wand->signature == WandSignature);
352  if( IfMagickTrue(wand->debug) )
353    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
354
355  if (wand->images == (Image *) NULL)
356    ThrowWandException(WandError,"ContainsNoImages",wand->name);
357  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
358    wand->exception);
359  if (threshold_image == (Image *) NULL)
360    return(MagickFalse);
361  ReplaceImageInList(&wand->images,threshold_image);
362  return(MagickTrue);
363}
364
365/*
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367%                                                                             %
368%                                                                             %
369%                                                                             %
370%   M a g i c k A d d I m a g e                                               %
371%                                                                             %
372%                                                                             %
373%                                                                             %
374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375%
376%  MagickAddImage() adds a clone of the images from the second wand and
377%  inserts them into the first wand.
378%
379%  Use MagickSetLastIterator(), to append new images into an existing wand,
380%  current image will be set to last image so later adds with also be
381%  appened to end of wand.
382%
383%  Use MagickSetFirstIterator() to prepend new images into wand, any more
384%  images added will also be prepended before other images in the wand.
385%  However the order of a list of new images will not change.
386%
387%  Otherwise the new images will be inserted just after the current image,
388%  and any later image will also be added after this current image but
389%  before the previously added images.  Caution is advised when multiple
390%  image adds are inserted into the middle of the wand image list.
391%
392%  The format of the MagickAddImage method is:
393%
394%      MagickBooleanType MagickAddImage(MagickWand *wand,
395%        const MagickWand *add_wand)
396%
397%  A description of each parameter follows:
398%
399%    o wand: the magick wand.
400%
401%    o add_wand: A wand that contains the image list to be added
402%
403*/
404static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
405  Image *images)
406{
407  /* if no images in wand, just add them, set current as appropriate */
408  if (wand->images == (Image *) NULL)
409    {
410      if( IfMagickTrue(wand->insert_before) )
411        wand->images=GetFirstImageInList(images);
412      else
413        wand->images=GetLastImageInList(images);
414      return(MagickTrue);
415    }
416
417  /* user jumped to first image, so prepend new images - remain active */
418  if( IfMagickTrue((wand->insert_before) ) &&
419       (wand->images->previous == (Image *) NULL) )
420    {
421      PrependImageToList(&wand->images,images);
422      wand->images=GetFirstImageInList(images);
423      return(MagickTrue);
424    }
425  /* Note you should never have 'insert_before' true when current image
426     is not the first image in the wand!  That is no insert before
427     current image, only after current image */
428
429  /* if at last image append new images */
430  if (wand->images->next == (Image *) NULL)
431    {
432      InsertImageInList(&wand->images,images);
433      wand->images=GetLastImageInList(images);
434      return(MagickTrue);
435    }
436  /* otherwise insert new images, just after the current image */
437  InsertImageInList(&wand->images,images);
438  return(MagickTrue);
439}
440
441WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
442  const MagickWand *add_wand)
443{
444  Image
445    *images;
446
447  assert(wand != (MagickWand *) NULL);
448  assert(wand->signature == WandSignature);
449  if( IfMagickTrue(wand->debug) )
450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
451
452  assert(add_wand != (MagickWand *) NULL);
453  assert(add_wand->signature == WandSignature);
454  if (add_wand->images == (Image *) NULL)
455    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
456
457  /* clone images in second wand, and insert into first */
458  images=CloneImageList(add_wand->images,wand->exception);
459  if (images == (Image *) NULL)
460    return(MagickFalse);
461  return(InsertImageInWand(wand,images));
462}
463
464/*
465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466%                                                                             %
467%                                                                             %
468%                                                                             %
469%     M a g i c k A d d N o i s e I m a g e                                   %
470%                                                                             %
471%                                                                             %
472%                                                                             %
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474%
475%  MagickAddNoiseImage() adds random noise to the image.
476%
477%  The format of the MagickAddNoiseImage method is:
478%
479%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
480%        const NoiseType noise_type,const double attenuate)
481%
482%  A description of each parameter follows:
483%
484%    o wand: the magick wand.
485%
486%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
487%      Impulse, Laplacian, or Poisson.
488%
489%    o attenuate:  attenuate the random distribution.
490%
491*/
492WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
493  const NoiseType noise_type,const double attenuate)
494{
495  Image
496    *noise_image;
497
498  assert(wand != (MagickWand *) NULL);
499  assert(wand->signature == WandSignature);
500  if( IfMagickTrue(wand->debug) )
501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
502
503  if (wand->images == (Image *) NULL)
504    ThrowWandException(WandError,"ContainsNoImages",wand->name);
505  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
506  if (noise_image == (Image *) NULL)
507    return(MagickFalse);
508  ReplaceImageInList(&wand->images,noise_image);
509  return(MagickTrue);
510}
511
512/*
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514%                                                                             %
515%                                                                             %
516%                                                                             %
517%   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
518%                                                                             %
519%                                                                             %
520%                                                                             %
521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
522%
523%  MagickAffineTransformImage() transforms an image as dictated by the affine
524%  matrix of the drawing wand.
525%
526%  The format of the MagickAffineTransformImage method is:
527%
528%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
529%        const DrawingWand *drawing_wand)
530%
531%  A description of each parameter follows:
532%
533%    o wand: the magick wand.
534%
535%    o drawing_wand: the draw wand.
536%
537*/
538WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
539  const DrawingWand *drawing_wand)
540{
541  DrawInfo
542    *draw_info;
543
544  Image
545    *affine_image;
546
547  assert(wand != (MagickWand *) NULL);
548  assert(wand->signature == WandSignature);
549  if( IfMagickTrue(wand->debug) )
550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
551
552  if (wand->images == (Image *) NULL)
553    ThrowWandException(WandError,"ContainsNoImages",wand->name);
554  draw_info=PeekDrawingWand(drawing_wand);
555  if (draw_info == (DrawInfo *) NULL)
556    return(MagickFalse);
557  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
558    wand->exception);
559  draw_info=DestroyDrawInfo(draw_info);
560  if (affine_image == (Image *) NULL)
561    return(MagickFalse);
562  ReplaceImageInList(&wand->images,affine_image);
563  return(MagickTrue);
564}
565
566/*
567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568%                                                                             %
569%                                                                             %
570%                                                                             %
571%   M a g i c k A n n o t a t e I m a g e                                     %
572%                                                                             %
573%                                                                             %
574%                                                                             %
575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
576%
577%  MagickAnnotateImage() annotates an image with text.
578%
579%  The format of the MagickAnnotateImage method is:
580%
581%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
582%        const DrawingWand *drawing_wand,const double x,const double y,
583%        const double angle,const char *text)
584%
585%  A description of each parameter follows:
586%
587%    o wand: the magick wand.
588%
589%    o drawing_wand: the draw wand.
590%
591%    o x: x ordinate to left of text
592%
593%    o y: y ordinate to text baseline
594%
595%    o angle: rotate text relative to this angle.
596%
597%    o text: text to draw
598%
599*/
600WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
601  const DrawingWand *drawing_wand,const double x,const double y,
602  const double angle,const char *text)
603{
604  char
605    geometry[MaxTextExtent];
606
607  DrawInfo
608    *draw_info;
609
610  MagickBooleanType
611    status;
612
613  assert(wand != (MagickWand *) NULL);
614  assert(wand->signature == WandSignature);
615  if( IfMagickTrue(wand->debug) )
616    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
617
618  if (wand->images == (Image *) NULL)
619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
620  draw_info=PeekDrawingWand(drawing_wand);
621  if (draw_info == (DrawInfo *) NULL)
622    return(MagickFalse);
623  (void) CloneString(&draw_info->text,text);
624  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
625  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
626  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
627  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
628  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
629  (void) CloneString(&draw_info->geometry,geometry);
630  status=AnnotateImage(wand->images,draw_info,wand->exception);
631  draw_info=DestroyDrawInfo(draw_info);
632  return(status);
633}
634
635/*
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%                                                                             %
638%                                                                             %
639%                                                                             %
640%   M a g i c k A n i m a t e I m a g e s                                     %
641%                                                                             %
642%                                                                             %
643%                                                                             %
644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
645%
646%  MagickAnimateImages() animates an image or image sequence.
647%
648%  The format of the MagickAnimateImages method is:
649%
650%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
651%        const char *server_name)
652%
653%  A description of each parameter follows:
654%
655%    o wand: the magick wand.
656%
657%    o server_name: the X server name.
658%
659*/
660WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
661  const char *server_name)
662{
663  MagickBooleanType
664    status;
665
666  assert(wand != (MagickWand *) NULL);
667  assert(wand->signature == WandSignature);
668  if( IfMagickTrue(wand->debug) )
669    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
670
671  (void) CloneString(&wand->image_info->server_name,server_name);
672  status=AnimateImages(wand->image_info,wand->images,wand->exception);
673  return(status);
674}
675
676/*
677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678%                                                                             %
679%                                                                             %
680%                                                                             %
681%   M a g i c k A p p e n d I m a g e s                                       %
682%                                                                             %
683%                                                                             %
684%                                                                             %
685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
686%
687%  MagickAppendImages() append the images in a wand from the current image
688%  onwards, creating a new wand with the single image result.  This is
689%  affected by the gravity and background settings of the first image.
690%
691%  Typically you would call either MagickResetIterator() or
692%  MagickSetFirstImage() before calling this function to ensure that all
693%  the images in the wand's image list will be appended together.
694%
695%  The format of the MagickAppendImages method is:
696%
697%      MagickWand *MagickAppendImages(MagickWand *wand,
698%        const MagickBooleanType stack)
699%
700%  A description of each parameter follows:
701%
702%    o wand: the magick wand.
703%
704%    o stack: By default, images are stacked left-to-right. Set stack to
705%      MagickTrue to stack them top-to-bottom.
706%
707*/
708WandExport MagickWand *MagickAppendImages(MagickWand *wand,
709  const MagickBooleanType stack)
710{
711  Image
712    *append_image;
713
714  assert(wand != (MagickWand *) NULL);
715  assert(wand->signature == WandSignature);
716  if( IfMagickTrue(wand->debug) )
717    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
718
719  if (wand->images == (Image *) NULL)
720    return((MagickWand *) NULL);
721  append_image=AppendImages(wand->images,stack,wand->exception);
722  if (append_image == (Image *) NULL)
723    return((MagickWand *) NULL);
724  return(CloneMagickWandFromImages(wand,append_image));
725}
726
727/*
728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
729%                                                                             %
730%                                                                             %
731%                                                                             %
732%   M a g i c k A u t o G a m m a I m a g e                                   %
733%                                                                             %
734%                                                                             %
735%                                                                             %
736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
737%
738%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
739%  image to try make set its gamma appropriatally.
740%
741%  The format of the MagickAutoGammaImage method is:
742%
743%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
744%
745%  A description of each parameter follows:
746%
747%    o wand: the magick wand.
748%
749*/
750WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
751{
752  MagickBooleanType
753    status;
754
755  assert(wand != (MagickWand *) NULL);
756  assert(wand->signature == WandSignature);
757  if( IfMagickTrue(wand->debug) )
758    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
759
760  if (wand->images == (Image *) NULL)
761    ThrowWandException(WandError,"ContainsNoImages",wand->name);
762  status=AutoGammaImage(wand->images,wand->exception);
763  return(status);
764}
765
766/*
767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
768%                                                                             %
769%                                                                             %
770%                                                                             %
771%   M a g i c k A u t o L e v e l I m a g e                                   %
772%                                                                             %
773%                                                                             %
774%                                                                             %
775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776%
777%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
778%  scaling the minimum and maximum values to the full quantum range.
779%
780%  The format of the MagickAutoLevelImage method is:
781%
782%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
783%
784%  A description of each parameter follows:
785%
786%    o wand: the magick wand.
787%
788*/
789WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
790{
791  MagickBooleanType
792    status;
793
794  assert(wand != (MagickWand *) NULL);
795  assert(wand->signature == WandSignature);
796  if( IfMagickTrue(wand->debug) )
797    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
798
799  if (wand->images == (Image *) NULL)
800    ThrowWandException(WandError,"ContainsNoImages",wand->name);
801  status=AutoLevelImage(wand->images,wand->exception);
802  return(status);
803}
804
805/*
806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
807%                                                                             %
808%                                                                             %
809%                                                                             %
810%   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
811%                                                                             %
812%                                                                             %
813%                                                                             %
814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
815%
816%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
817%  pixels below the threshold into black while leaving all pixels above the
818%  threshold unchanged.
819%
820%  The format of the MagickBlackThresholdImage method is:
821%
822%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
823%        const PixelWand *threshold)
824%
825%  A description of each parameter follows:
826%
827%    o wand: the magick wand.
828%
829%    o threshold: the pixel wand.
830%
831*/
832WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
833  const PixelWand *threshold)
834{
835  char
836    thresholds[MaxTextExtent];
837
838  MagickBooleanType
839    status;
840
841  assert(wand != (MagickWand *) NULL);
842  assert(wand->signature == WandSignature);
843  if( IfMagickTrue(wand->debug) )
844    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
845
846  if (wand->images == (Image *) NULL)
847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
848  (void) FormatLocaleString(thresholds,MaxTextExtent,
849    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
850    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
851    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
852  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
853  return(status);
854}
855
856/*
857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858%                                                                             %
859%                                                                             %
860%                                                                             %
861%   M a g i c k B l u e S h i f t I m a g e                                   %
862%                                                                             %
863%                                                                             %
864%                                                                             %
865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
866%
867%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
868%  nighttime in the moonlight.
869%
870%  The format of the MagickBlueShiftImage method is:
871%
872%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
873%        const double factor)
874%
875%  A description of each parameter follows:
876%
877%    o wand: the magick wand.
878%
879%    o factor: the blue shift factor (default 1.5)
880%
881*/
882WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
883  const double factor)
884{
885  Image
886    *shift_image;
887
888  assert(wand != (MagickWand *) NULL);
889  assert(wand->signature == WandSignature);
890  if( IfMagickTrue(wand->debug) )
891    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
892
893  if (wand->images == (Image *) NULL)
894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
895  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
896  if (shift_image == (Image *) NULL)
897    return(MagickFalse);
898  ReplaceImageInList(&wand->images,shift_image);
899  return(MagickTrue);
900}
901
902/*
903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904%                                                                             %
905%                                                                             %
906%                                                                             %
907%   M a g i c k B l u r I m a g e                                             %
908%                                                                             %
909%                                                                             %
910%                                                                             %
911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912%
913%  MagickBlurImage() blurs an image.  We convolve the image with a
914%  gaussian operator of the given radius and standard deviation (sigma).
915%  For reasonable results, the radius should be larger than sigma.  Use a
916%  radius of 0 and BlurImage() selects a suitable radius for you.
917%
918%  The format of the MagickBlurImage method is:
919%
920%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
921%        const double sigma)
922%
923%  A description of each parameter follows:
924%
925%    o wand: the magick wand.
926%
927%    o radius: the radius of the , in pixels, not counting the center
928%      pixel.
929%
930%    o sigma: the standard deviation of the , in pixels.
931%
932*/
933WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
934  const double radius,const double sigma)
935{
936  Image
937    *blur_image;
938
939  assert(wand != (MagickWand *) NULL);
940  assert(wand->signature == WandSignature);
941  if( IfMagickTrue(wand->debug) )
942    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
943
944  if (wand->images == (Image *) NULL)
945    ThrowWandException(WandError,"ContainsNoImages",wand->name);
946  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
947  if (blur_image == (Image *) NULL)
948    return(MagickFalse);
949  ReplaceImageInList(&wand->images,blur_image);
950  return(MagickTrue);
951}
952
953/*
954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
955%                                                                             %
956%                                                                             %
957%                                                                             %
958%   M a g i c k B o r d e r I m a g e                                         %
959%                                                                             %
960%                                                                             %
961%                                                                             %
962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963%
964%  MagickBorderImage() surrounds the image with a border of the color defined
965%  by the bordercolor pixel wand.
966%
967%  The format of the MagickBorderImage method is:
968%
969%      MagickBooleanType MagickBorderImage(MagickWand *wand,
970%        const PixelWand *bordercolor,const size_t width,
971%        const size_t height,const CompositeOperator compose)
972%
973%  A description of each parameter follows:
974%
975%    o wand: the magick wand.
976%
977%    o bordercolor: the border color pixel wand.
978%
979%    o width: the border width.
980%
981%    o height: the border height.
982%
983%    o compose: the composite operator.
984%
985*/
986WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
987  const PixelWand *bordercolor,const size_t width,const size_t height,
988  const CompositeOperator compose)
989{
990  Image
991    *border_image;
992
993  RectangleInfo
994    border_info;
995
996  assert(wand != (MagickWand *) NULL);
997  assert(wand->signature == WandSignature);
998  if( IfMagickTrue(wand->debug) )
999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1000
1001  if (wand->images == (Image *) NULL)
1002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1003  border_info.width=width;
1004  border_info.height=height;
1005  border_info.x=0;
1006  border_info.y=0;
1007  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1008  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1009  if (border_image == (Image *) NULL)
1010    return(MagickFalse);
1011  ReplaceImageInList(&wand->images,border_image);
1012  return(MagickTrue);
1013}
1014
1015/*
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017%                                                                             %
1018%                                                                             %
1019%                                                                             %
1020%   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
1021%                                                                             %
1022%                                                                             %
1023%                                                                             %
1024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025%
1026%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1027%  of an image.  It converts the brightness and contrast parameters into slope
1028%  and intercept and calls a polynomical function to apply to the image.
1029
1030%
1031%  The format of the MagickBrightnessContrastImage method is:
1032%
1033%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1034%        const double brightness,const double contrast)
1035%
1036%  A description of each parameter follows:
1037%
1038%    o wand: the magick wand.
1039%
1040%    o brightness: the brightness percent (-100 .. 100).
1041%
1042%    o contrast: the contrast percent (-100 .. 100).
1043%
1044*/
1045WandExport MagickBooleanType MagickBrightnessContrastImage(
1046  MagickWand *wand,const double brightness,const double contrast)
1047{
1048  MagickBooleanType
1049    status;
1050
1051  assert(wand != (MagickWand *) NULL);
1052  assert(wand->signature == WandSignature);
1053  if( IfMagickTrue(wand->debug) )
1054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1055
1056  if (wand->images == (Image *) NULL)
1057    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1058  status=BrightnessContrastImage(wand->images,brightness,contrast,
1059    wand->exception);
1060  return(status);
1061}
1062
1063/*
1064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1065%                                                                             %
1066%                                                                             %
1067%                                                                             %
1068%   M a g i c k C h a n n e l F x I m a g e                                   %
1069%                                                                             %
1070%                                                                             %
1071%                                                                             %
1072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073%
1074%  MagickChannelFxImage() applies a channel expression to the specified image.
1075%  The expression consists of one or more channels, either mnemonic or numeric
1076%  (e.g. red, 1), separated by actions as follows:
1077%
1078%    <=>     exchange two channels (e.g. red<=>blue)
1079%    =>      transfer a channel to another (e.g. red=>green)
1080%    ,       separate channel operations (e.g. red, green)
1081%    |       read channels from next input image (e.g. red | green)
1082%    ;       write channels to next output image (e.g. red; green; blue)
1083%
1084%  A channel without a operation symbol implies extract. For example, to create
1085%  3 grayscale images from the red, green, and blue channels of an image, use:
1086%
1087%    -channel-fx "red; green; blue"
1088%
1089%  The format of the MagickChannelFxImage method is:
1090%
1091%      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1092%
1093%  A description of each parameter follows:
1094%
1095%    o wand: the magick wand.
1096%
1097%    o expression: the expression.
1098%
1099*/
1100WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1101  const char *expression)
1102{
1103  Image
1104    *fx_image;
1105
1106  assert(wand != (MagickWand *) NULL);
1107  assert(wand->signature == WandSignature);
1108  if( IfMagickTrue(wand->debug) )
1109    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1110
1111  if (wand->images == (Image *) NULL)
1112    return((MagickWand *) NULL);
1113  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1114  if (fx_image == (Image *) NULL)
1115    return((MagickWand *) NULL);
1116  return(CloneMagickWandFromImages(wand,fx_image));
1117}
1118
1119/*
1120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121%                                                                             %
1122%                                                                             %
1123%                                                                             %
1124%   M a g i c k C h a r c o a l I m a g e                                     %
1125%                                                                             %
1126%                                                                             %
1127%                                                                             %
1128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1129%
1130%  MagickCharcoalImage() simulates a charcoal drawing.
1131%
1132%  The format of the MagickCharcoalImage method is:
1133%
1134%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1135%        const double radius,const double sigma)
1136%
1137%  A description of each parameter follows:
1138%
1139%    o wand: the magick wand.
1140%
1141%    o radius: the radius of the Gaussian, in pixels, not counting the center
1142%      pixel.
1143%
1144%    o sigma: the standard deviation of the Gaussian, in pixels.
1145%
1146*/
1147WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1148  const double radius,const double sigma)
1149{
1150  Image
1151    *charcoal_image;
1152
1153  assert(wand != (MagickWand *) NULL);
1154  assert(wand->signature == WandSignature);
1155  if( IfMagickTrue(wand->debug) )
1156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1157
1158  if (wand->images == (Image *) NULL)
1159    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1160  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1161  if (charcoal_image == (Image *) NULL)
1162    return(MagickFalse);
1163  ReplaceImageInList(&wand->images,charcoal_image);
1164  return(MagickTrue);
1165}
1166
1167/*
1168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1169%                                                                             %
1170%                                                                             %
1171%                                                                             %
1172%   M a g i c k C h o p I m a g e                                             %
1173%                                                                             %
1174%                                                                             %
1175%                                                                             %
1176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1177%
1178%  MagickChopImage() removes a region of an image and collapses the image to
1179%  occupy the removed portion
1180%
1181%  The format of the MagickChopImage method is:
1182%
1183%      MagickBooleanType MagickChopImage(MagickWand *wand,
1184%        const size_t width,const size_t height,const ssize_t x,
1185%        const ssize_t y)
1186%
1187%  A description of each parameter follows:
1188%
1189%    o wand: the magick wand.
1190%
1191%    o width: the region width.
1192%
1193%    o height: the region height.
1194%
1195%    o x: the region x offset.
1196%
1197%    o y: the region y offset.
1198%
1199%
1200*/
1201WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1202  const size_t width,const size_t height,const ssize_t x,
1203  const ssize_t y)
1204{
1205  Image
1206    *chop_image;
1207
1208  RectangleInfo
1209    chop;
1210
1211  assert(wand != (MagickWand *) NULL);
1212  assert(wand->signature == WandSignature);
1213  if( IfMagickTrue(wand->debug) )
1214    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1215
1216  if (wand->images == (Image *) NULL)
1217    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1218  chop.width=width;
1219  chop.height=height;
1220  chop.x=x;
1221  chop.y=y;
1222  chop_image=ChopImage(wand->images,&chop,wand->exception);
1223  if (chop_image == (Image *) NULL)
1224    return(MagickFalse);
1225  ReplaceImageInList(&wand->images,chop_image);
1226  return(MagickTrue);
1227}
1228
1229/*
1230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1231%                                                                             %
1232%                                                                             %
1233%                                                                             %
1234%   M a g i c k C l a m p I m a g e                                           %
1235%                                                                             %
1236%                                                                             %
1237%                                                                             %
1238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1239%
1240%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1241%
1242%  The format of the MagickClampImage method is:
1243%
1244%      MagickBooleanType MagickClampImage(MagickWand *wand)
1245%
1246%  A description of each parameter follows:
1247%
1248%    o wand: the magick wand.
1249%
1250%    o channel: the channel.
1251%
1252*/
1253WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1254{
1255  assert(wand != (MagickWand *) NULL);
1256  assert(wand->signature == WandSignature);
1257  if( IfMagickTrue(wand->debug) )
1258    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1259
1260  if (wand->images == (Image *) NULL)
1261    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1262  return(ClampImage(wand->images,wand->exception));
1263}
1264
1265/*
1266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1267%                                                                             %
1268%                                                                             %
1269%                                                                             %
1270%   M a g i c k C l i p I m a g e                                             %
1271%                                                                             %
1272%                                                                             %
1273%                                                                             %
1274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1275%
1276%  MagickClipImage() clips along the first path from the 8BIM profile, if
1277%  present.
1278%
1279%  The format of the MagickClipImage method is:
1280%
1281%      MagickBooleanType MagickClipImage(MagickWand *wand)
1282%
1283%  A description of each parameter follows:
1284%
1285%    o wand: the magick wand.
1286%
1287*/
1288WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1289{
1290  MagickBooleanType
1291    status;
1292
1293  assert(wand != (MagickWand *) NULL);
1294  assert(wand->signature == WandSignature);
1295  if( IfMagickTrue(wand->debug) )
1296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1297
1298  if (wand->images == (Image *) NULL)
1299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1300  status=ClipImage(wand->images,wand->exception);
1301  return(status);
1302}
1303
1304/*
1305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1306%                                                                             %
1307%                                                                             %
1308%                                                                             %
1309%   M a g i c k C l i p I m a g e P a t h                                     %
1310%                                                                             %
1311%                                                                             %
1312%                                                                             %
1313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1314%
1315%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1316%  present. Later operations take effect inside the path.  Id may be a number
1317%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1318%  path.
1319%
1320%  The format of the MagickClipImagePath method is:
1321%
1322%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1323%        const char *pathname,const MagickBooleanType inside)
1324%
1325%  A description of each parameter follows:
1326%
1327%    o wand: the magick wand.
1328%
1329%    o pathname: name of clipping path resource. If name is preceded by #, use
1330%      clipping path numbered by name.
1331%
1332%    o inside: if non-zero, later operations take effect inside clipping path.
1333%      Otherwise later operations take effect outside clipping path.
1334%
1335*/
1336WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1337  const char *pathname,const MagickBooleanType inside)
1338{
1339  MagickBooleanType
1340    status;
1341
1342  assert(wand != (MagickWand *) NULL);
1343  assert(wand->signature == WandSignature);
1344  if( IfMagickTrue(wand->debug) )
1345    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1346
1347  if (wand->images == (Image *) NULL)
1348    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1349  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1350  return(status);
1351}
1352
1353/*
1354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355%                                                                             %
1356%                                                                             %
1357%                                                                             %
1358%   M a g i c k C l u t I m a g e                                             %
1359%                                                                             %
1360%                                                                             %
1361%                                                                             %
1362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363%
1364%  MagickClutImage() replaces colors in the image from a color lookup table.
1365%
1366%  The format of the MagickClutImage method is:
1367%
1368%      MagickBooleanType MagickClutImage(MagickWand *wand,
1369%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1370%
1371%  A description of each parameter follows:
1372%
1373%    o wand: the magick wand.
1374%
1375%    o clut_image: the clut image.
1376%
1377%    o method: the pixel interpolation method.
1378%
1379*/
1380WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1381  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1382{
1383  MagickBooleanType
1384    status;
1385
1386  assert(wand != (MagickWand *) NULL);
1387  assert(wand->signature == WandSignature);
1388  if( IfMagickTrue(wand->debug) )
1389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1390
1391  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1392    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1393  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1394  return(status);
1395}
1396
1397/*
1398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1399%                                                                             %
1400%                                                                             %
1401%                                                                             %
1402%   M a g i c k C o a l e s c e I m a g e s                                   %
1403%                                                                             %
1404%                                                                             %
1405%                                                                             %
1406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1407%
1408%  MagickCoalesceImages() composites a set of images while respecting any page
1409%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1410%  typically start with an image background and each subsequent image
1411%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1412%  where each image in the sequence is the same size as the first and
1413%  composited with the next image in the sequence.
1414%
1415%  The format of the MagickCoalesceImages method is:
1416%
1417%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1418%
1419%  A description of each parameter follows:
1420%
1421%    o wand: the magick wand.
1422%
1423*/
1424WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1425{
1426  Image
1427    *coalesce_image;
1428
1429  assert(wand != (MagickWand *) NULL);
1430  assert(wand->signature == WandSignature);
1431  if( IfMagickTrue(wand->debug) )
1432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1433
1434  if (wand->images == (Image *) NULL)
1435    return((MagickWand *) NULL);
1436  coalesce_image=CoalesceImages(wand->images,wand->exception);
1437  if (coalesce_image == (Image *) NULL)
1438    return((MagickWand *) NULL);
1439  return(CloneMagickWandFromImages(wand,coalesce_image));
1440}
1441
1442/*
1443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1444%                                                                             %
1445%                                                                             %
1446%                                                                             %
1447%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1448%                                                                             %
1449%                                                                             %
1450%                                                                             %
1451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1452%
1453%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1454%  Collection (CCC) file which solely contains one or more color corrections
1455%  and applies the color correction to the image.  Here is a sample CCC file:
1456%
1457%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1458%          <ColorCorrection id="cc03345">
1459%                <SOPNode>
1460%                     <Slope> 0.9 1.2 0.5 </Slope>
1461%                     <Offset> 0.4 -0.5 0.6 </Offset>
1462%                     <Power> 1.0 0.8 1.5 </Power>
1463%                </SOPNode>
1464%                <SATNode>
1465%                     <Saturation> 0.85 </Saturation>
1466%                </SATNode>
1467%          </ColorCorrection>
1468%    </ColorCorrectionCollection>
1469%
1470%  which includes the offset, slope, and power for each of the RGB channels
1471%  as well as the saturation.
1472%
1473%  The format of the MagickColorDecisionListImage method is:
1474%
1475%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1476%        const char *color_correction_collection)
1477%
1478%  A description of each parameter follows:
1479%
1480%    o wand: the magick wand.
1481%
1482%    o color_correction_collection: the color correction collection in XML.
1483%
1484*/
1485WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1486  const char *color_correction_collection)
1487{
1488  MagickBooleanType
1489    status;
1490
1491  assert(wand != (MagickWand *) NULL);
1492  assert(wand->signature == WandSignature);
1493  if( IfMagickTrue(wand->debug) )
1494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1495
1496  if (wand->images == (Image *) NULL)
1497    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1498  status=ColorDecisionListImage(wand->images,color_correction_collection,
1499    wand->exception);
1500  return(status);
1501}
1502
1503/*
1504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1505%                                                                             %
1506%                                                                             %
1507%                                                                             %
1508%   M a g i c k C o l o r i z e I m a g e                                     %
1509%                                                                             %
1510%                                                                             %
1511%                                                                             %
1512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1513%
1514%  MagickColorizeImage() blends the fill color with each pixel in the image.
1515%
1516%  The format of the MagickColorizeImage method is:
1517%
1518%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1519%        const PixelWand *colorize,const PixelWand *blend)
1520%
1521%  A description of each parameter follows:
1522%
1523%    o wand: the magick wand.
1524%
1525%    o colorize: the colorize pixel wand.
1526%
1527%    o alpha: the alpha pixel wand.
1528%
1529*/
1530WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1531  const PixelWand *colorize,const PixelWand *blend)
1532{
1533  char
1534    percent_blend[MaxTextExtent];
1535
1536  Image
1537    *colorize_image;
1538
1539  PixelInfo
1540    target;
1541
1542  assert(wand != (MagickWand *) NULL);
1543  assert(wand->signature == WandSignature);
1544  if( IfMagickTrue(wand->debug) )
1545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1546
1547  if (wand->images == (Image *) NULL)
1548    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1549  GetPixelInfo(wand->images,&target);
1550  if (target.colorspace != CMYKColorspace)
1551    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1552      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1553      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1554      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1555      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1556      PixelGetAlphaQuantum(blend)));
1557  else
1558    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1559      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1560      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1561      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1562      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1563      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1564      PixelGetAlphaQuantum(blend)));
1565  target=PixelGetPixel(colorize);
1566  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1567    wand->exception);
1568  if (colorize_image == (Image *) NULL)
1569    return(MagickFalse);
1570  ReplaceImageInList(&wand->images,colorize_image);
1571  return(MagickTrue);
1572}
1573
1574/*
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%                                                                             %
1577%                                                                             %
1578%                                                                             %
1579%   M a g i c k C o l o r M a t r i x I m a g e                               %
1580%                                                                             %
1581%                                                                             %
1582%                                                                             %
1583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1584%
1585%  MagickColorMatrixImage() apply color transformation to an image. The method
1586%  permits saturation changes, hue rotation, luminance to alpha, and various
1587%  other effects.  Although variable-sized transformation matrices can be used,
1588%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1589%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1590%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1591%  and offsets are normalized (divide Flash offset by 255).
1592%
1593%  The format of the MagickColorMatrixImage method is:
1594%
1595%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1596%        const KernelInfo *color_matrix)
1597%
1598%  A description of each parameter follows:
1599%
1600%    o wand: the magick wand.
1601%
1602%    o color_matrix:  the color matrix.
1603%
1604*/
1605WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1606  const KernelInfo *color_matrix)
1607{
1608  Image
1609    *color_image;
1610
1611  assert(wand != (MagickWand *) NULL);
1612  assert(wand->signature == WandSignature);
1613  if( IfMagickTrue(wand->debug) )
1614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1615
1616  if (color_matrix == (const KernelInfo *) NULL)
1617    return(MagickFalse);
1618  if (wand->images == (Image *) NULL)
1619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1620  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1621  if (color_image == (Image *) NULL)
1622    return(MagickFalse);
1623  ReplaceImageInList(&wand->images,color_image);
1624  return(MagickTrue);
1625}
1626
1627/*
1628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1629%                                                                             %
1630%                                                                             %
1631%                                                                             %
1632%   M a g i c k C o m b i n e I m a g e s                                     %
1633%                                                                             %
1634%                                                                             %
1635%                                                                             %
1636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1637%
1638%  MagickCombineImages() combines one or more images into a single image.  The
1639%  grayscale value of the pixels of each image in the sequence is assigned in
1640%  order to the specified  hannels of the combined image.   The typical
1641%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1642%
1643%  The format of the MagickCombineImages method is:
1644%
1645%      MagickWand *MagickCombineImages(MagickWand *wand)
1646%
1647%  A description of each parameter follows:
1648%
1649%    o wand: the magick wand.
1650%
1651*/
1652WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1653{
1654  Image
1655    *combine_image;
1656
1657  assert(wand != (MagickWand *) NULL);
1658  assert(wand->signature == WandSignature);
1659  if( IfMagickTrue(wand->debug) )
1660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1661
1662  if (wand->images == (Image *) NULL)
1663    return((MagickWand *) NULL);
1664  combine_image=CombineImages(wand->images,wand->exception);
1665  if (combine_image == (Image *) NULL)
1666    return((MagickWand *) NULL);
1667  return(CloneMagickWandFromImages(wand,combine_image));
1668}
1669
1670/*
1671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1672%                                                                             %
1673%                                                                             %
1674%                                                                             %
1675%   M a g i c k C o m m e n t I m a g e                                       %
1676%                                                                             %
1677%                                                                             %
1678%                                                                             %
1679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1680%
1681%  MagickCommentImage() adds a comment to your image.
1682%
1683%  The format of the MagickCommentImage method is:
1684%
1685%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1686%        const char *comment)
1687%
1688%  A description of each parameter follows:
1689%
1690%    o wand: the magick wand.
1691%
1692%    o comment: the image comment.
1693%
1694*/
1695WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1696  const char *comment)
1697{
1698  MagickBooleanType
1699    status;
1700
1701  assert(wand != (MagickWand *) NULL);
1702  assert(wand->signature == WandSignature);
1703  if( IfMagickTrue(wand->debug) )
1704    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1705
1706  if (wand->images == (Image *) NULL)
1707    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1708  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1709  return(status);
1710}
1711
1712/*
1713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1714%                                                                             %
1715%                                                                             %
1716%                                                                             %
1717%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1718%                                                                             %
1719%                                                                             %
1720%                                                                             %
1721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1722%
1723%  MagickCompareImagesLayers() compares each image with the next in a sequence
1724%  and returns the maximum bounding region of any pixel differences it
1725%  discovers.
1726%
1727%  The format of the MagickCompareImagesLayers method is:
1728%
1729%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1730%        const ImageLayerMethod method)
1731%
1732%  A description of each parameter follows:
1733%
1734%    o wand: the magick wand.
1735%
1736%    o method: the compare method.
1737%
1738*/
1739WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1740  const ImageLayerMethod method)
1741{
1742  Image
1743    *layers_image;
1744
1745  assert(wand != (MagickWand *) NULL);
1746  assert(wand->signature == WandSignature);
1747  if( IfMagickTrue(wand->debug) )
1748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1749
1750  if (wand->images == (Image *) NULL)
1751    return((MagickWand *) NULL);
1752  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1753  if (layers_image == (Image *) NULL)
1754    return((MagickWand *) NULL);
1755  return(CloneMagickWandFromImages(wand,layers_image));
1756}
1757
1758/*
1759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1760%                                                                             %
1761%                                                                             %
1762%                                                                             %
1763%   M a g i c k C o m p a r e I m a g e s                                     %
1764%                                                                             %
1765%                                                                             %
1766%                                                                             %
1767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768%
1769%  MagickCompareImages() compares an image to a reconstructed image and returns
1770%  the specified difference image.
1771%
1772%  The format of the MagickCompareImages method is:
1773%
1774%      MagickWand *MagickCompareImages(MagickWand *wand,
1775%        const MagickWand *reference,const MetricType metric,
1776%        double *distortion)
1777%
1778%  A description of each parameter follows:
1779%
1780%    o wand: the magick wand.
1781%
1782%    o reference: the reference wand.
1783%
1784%    o metric: the metric.
1785%
1786%    o distortion: the computed distortion between the images.
1787%
1788*/
1789WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1790  const MagickWand *reference,const MetricType metric,double *distortion)
1791{
1792  Image
1793    *compare_image;
1794
1795
1796  assert(wand != (MagickWand *) NULL);
1797  assert(wand->signature == WandSignature);
1798  if( IfMagickTrue(wand->debug) )
1799    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1800
1801  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1802    {
1803      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1804        "ContainsNoImages","'%s'",wand->name);
1805      return((MagickWand *) NULL);
1806    }
1807  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1808    wand->exception);
1809  if (compare_image == (Image *) NULL)
1810    return((MagickWand *) NULL);
1811  return(CloneMagickWandFromImages(wand,compare_image));
1812}
1813
1814/*
1815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1816%                                                                             %
1817%                                                                             %
1818%                                                                             %
1819%   M a g i c k C o m p o s i t e I m a g e                                   %
1820%                                                                             %
1821%                                                                             %
1822%                                                                             %
1823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1824%
1825%  MagickCompositeImage() composite one image onto another at the specified
1826%  offset.
1827%
1828%  The format of the MagickCompositeImage method is:
1829%
1830%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1831%        const MagickWand *source_wand,const CompositeOperator compose,
1832%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1833%
1834%  A description of each parameter follows:
1835%
1836%    o wand: the magick wand holding the destination images
1837%
1838%    o source_image: the magick wand holding source image.
1839%
1840%    o compose: This operator affects how the composite is applied to the
1841%      image.  The default is Over.  These are some of the compose methods
1842%      availble.
1843%
1844%        OverCompositeOp       InCompositeOp         OutCompositeOp
1845%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1846%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1847%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1848%        DisplaceCompositeOp
1849%
1850%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1851%
1852%    o x: the column offset of the composited image.
1853%
1854%    o y: the row offset of the composited image.
1855%
1856*/
1857WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1858  const MagickWand *source_wand,const CompositeOperator compose,
1859  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1860{
1861  MagickBooleanType
1862    status;
1863
1864  assert(wand != (MagickWand *) NULL);
1865  assert(wand->signature == WandSignature);
1866  if( IfMagickTrue(wand->debug) )
1867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1868
1869  if ((wand->images == (Image *) NULL) ||
1870      (source_wand->images == (Image *) NULL))
1871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1872  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1873    x,y,wand->exception);
1874  return(status);
1875}
1876
1877/*
1878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1879%                                                                             %
1880%                                                                             %
1881%                                                                             %
1882%   M a g i c k C o m p o s i t e L a y e r s                                 %
1883%                                                                             %
1884%                                                                             %
1885%                                                                             %
1886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1887%
1888%  MagickCompositeLayers() composite the images in the source wand over the
1889%  images in the destination wand in sequence, starting with the current
1890%  image in both lists.
1891%
1892%  Each layer from the two image lists are composted together until the end of
1893%  one of the image lists is reached.  The offset of each composition is also
1894%  adjusted to match the virtual canvas offsets of each layer. As such the
1895%  given offset is relative to the virtual canvas, and not the actual image.
1896%
1897%  Composition uses given x and y offsets, as the 'origin' location of the
1898%  source images virtual canvas (not the real image) allowing you to compose a
1899%  list of 'layer images' into the destiantioni images.  This makes it well
1900%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1901%  Animations' onto a static or other 'Coaleased Animation' destination image
1902%  list.  GIF disposal handling is not looked at.
1903%
1904%  Special case:- If one of the image sequences is the last image (just a
1905%  single image remaining), that image is repeatally composed with all the
1906%  images in the other image list.  Either the source or destination lists may
1907%  be the single image, for this situation.
1908%
1909%  In the case of a single destination image (or last image given), that image
1910%  will ve cloned to match the number of images remaining in the source image
1911%  list.
1912%
1913%  This is equivelent to the "-layer Composite" Shell API operator.
1914%
1915%  The format of the MagickCompositeLayers method is:
1916%
1917%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1918%        const MagickWand *source_wand, const CompositeOperator compose,
1919%        const ssize_t x,const ssize_t y)
1920%
1921%  A description of each parameter follows:
1922%
1923%    o wand: the magick wand holding destaintion images
1924%
1925%    o source_wand: the wand holding the source images
1926%
1927%    o compose, x, y:  composition arguments
1928%
1929*/
1930WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1931  const MagickWand *source_wand,const CompositeOperator compose,
1932  const ssize_t x,const ssize_t y)
1933{
1934  MagickBooleanType
1935    status;
1936
1937  assert(wand != (MagickWand *) NULL);
1938  assert(wand->signature == WandSignature);
1939  if( IfMagickTrue(wand->debug) )
1940    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1941
1942  if ((wand->images == (Image *) NULL) ||
1943      (source_wand->images == (Image *) NULL))
1944    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1945  CompositeLayers(wand->images,compose,source_wand->images,x,y,
1946        wand->exception);
1947  status=MagickTrue;  /* FUTURE: determine status from exceptions */
1948  return(status);
1949}
1950
1951/*
1952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1953%                                                                             %
1954%                                                                             %
1955%                                                                             %
1956%   M a g i c k C o n t r a s t I m a g e                                     %
1957%                                                                             %
1958%                                                                             %
1959%                                                                             %
1960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961%
1962%  MagickContrastImage() enhances the intensity differences between the lighter
1963%  and darker elements of the image.  Set sharpen to a value other than 0 to
1964%  increase the image contrast otherwise the contrast is reduced.
1965%
1966%  The format of the MagickContrastImage method is:
1967%
1968%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1969%        const MagickBooleanType sharpen)
1970%
1971%  A description of each parameter follows:
1972%
1973%    o wand: the magick wand.
1974%
1975%    o sharpen: Increase or decrease image contrast.
1976%
1977%
1978*/
1979WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1980  const MagickBooleanType sharpen)
1981{
1982  MagickBooleanType
1983    status;
1984
1985  assert(wand != (MagickWand *) NULL);
1986  assert(wand->signature == WandSignature);
1987  if( IfMagickTrue(wand->debug) )
1988    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1989
1990  if (wand->images == (Image *) NULL)
1991    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1992  status=ContrastImage(wand->images,sharpen,wand->exception);
1993  return(status);
1994}
1995
1996/*
1997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1998%                                                                             %
1999%                                                                             %
2000%                                                                             %
2001%   M a g i c k C o n t r a s t S t r e t c h I m a g e                       %
2002%                                                                             %
2003%                                                                             %
2004%                                                                             %
2005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2006%
2007%  MagickContrastStretchImage() enhances the contrast of a color image by
2008%  adjusting the pixels color to span the entire range of colors available.
2009%  You can also reduce the influence of a particular channel with a gamma
2010%  value of 0.
2011%
2012%  The format of the MagickContrastStretchImage method is:
2013%
2014%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2015%        const double black_point,const double white_point)
2016%
2017%  A description of each parameter follows:
2018%
2019%    o wand: the magick wand.
2020%
2021%    o black_point: the black point.
2022%
2023%    o white_point: the white point.
2024%
2025*/
2026WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2027  const double black_point,const double white_point)
2028{
2029  MagickBooleanType
2030    status;
2031
2032  assert(wand != (MagickWand *) NULL);
2033  assert(wand->signature == WandSignature);
2034  if( IfMagickTrue(wand->debug) )
2035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2036
2037  if (wand->images == (Image *) NULL)
2038    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2039  status=ContrastStretchImage(wand->images,black_point,white_point,
2040    wand->exception);
2041  return(status);
2042}
2043
2044/*
2045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2046%                                                                             %
2047%                                                                             %
2048%                                                                             %
2049%   M a g i c k C o n v o l v e I m a g e                                     %
2050%                                                                             %
2051%                                                                             %
2052%                                                                             %
2053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054%
2055%  MagickConvolveImage() applies a custom convolution kernel to the image.
2056%
2057%  The format of the MagickConvolveImage method is:
2058%
2059%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2060%        const KernelInfo *kernel)
2061%
2062%  A description of each parameter follows:
2063%
2064%    o wand: the magick wand.
2065%
2066%    o kernel: An array of doubles representing the convolution kernel.
2067%
2068*/
2069WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2070  const KernelInfo *kernel)
2071{
2072  Image
2073    *filter_image;
2074
2075  assert(wand != (MagickWand *) NULL);
2076  assert(wand->signature == WandSignature);
2077  if( IfMagickTrue(wand->debug) )
2078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2079
2080  if (kernel == (const KernelInfo *) NULL)
2081    return(MagickFalse);
2082  if (wand->images == (Image *) NULL)
2083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2084  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2085  if (filter_image == (Image *) NULL)
2086    return(MagickFalse);
2087  ReplaceImageInList(&wand->images,filter_image);
2088  return(MagickTrue);
2089}
2090
2091/*
2092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2093%                                                                             %
2094%                                                                             %
2095%                                                                             %
2096%   M a g i c k C r o p I m a g e                                             %
2097%                                                                             %
2098%                                                                             %
2099%                                                                             %
2100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2101%
2102%  MagickCropImage() extracts a region of the image.
2103%
2104%  The format of the MagickCropImage method is:
2105%
2106%      MagickBooleanType MagickCropImage(MagickWand *wand,
2107%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2108%
2109%  A description of each parameter follows:
2110%
2111%    o wand: the magick wand.
2112%
2113%    o width: the region width.
2114%
2115%    o height: the region height.
2116%
2117%    o x: the region x-offset.
2118%
2119%    o y: the region y-offset.
2120%
2121*/
2122WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2123  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2124{
2125  Image
2126    *crop_image;
2127
2128  RectangleInfo
2129    crop;
2130
2131  assert(wand != (MagickWand *) NULL);
2132  assert(wand->signature == WandSignature);
2133  if( IfMagickTrue(wand->debug) )
2134    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2135
2136  if (wand->images == (Image *) NULL)
2137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2138  crop.width=width;
2139  crop.height=height;
2140  crop.x=x;
2141  crop.y=y;
2142  crop_image=CropImage(wand->images,&crop,wand->exception);
2143  if (crop_image == (Image *) NULL)
2144    return(MagickFalse);
2145  ReplaceImageInList(&wand->images,crop_image);
2146  return(MagickTrue);
2147}
2148
2149/*
2150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2151%                                                                             %
2152%                                                                             %
2153%                                                                             %
2154%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2155%                                                                             %
2156%                                                                             %
2157%                                                                             %
2158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2159%
2160%  MagickCycleColormapImage() displaces an image's colormap by a given number
2161%  of positions.  If you cycle the colormap a number of times you can produce
2162%  a psychodelic effect.
2163%
2164%  The format of the MagickCycleColormapImage method is:
2165%
2166%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2167%        const ssize_t displace)
2168%
2169%  A description of each parameter follows:
2170%
2171%    o wand: the magick wand.
2172%
2173%    o pixel_wand: the pixel wand.
2174%
2175*/
2176WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2177  const ssize_t displace)
2178{
2179  MagickBooleanType
2180    status;
2181
2182  assert(wand != (MagickWand *) NULL);
2183  assert(wand->signature == WandSignature);
2184  if( IfMagickTrue(wand->debug) )
2185    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2186
2187  if (wand->images == (Image *) NULL)
2188    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2189  status=CycleColormapImage(wand->images,displace,wand->exception);
2190  return(status);
2191}
2192
2193/*
2194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2195%                                                                             %
2196%                                                                             %
2197%                                                                             %
2198%   M a g i c k C o n s t i t u t e I m a g e                                 %
2199%                                                                             %
2200%                                                                             %
2201%                                                                             %
2202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2203%
2204%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2205%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2206%  The data can be char, short int, int, float, or double.  Float and double
2207%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2208%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2209%  example, to create a 640x480 image from unsigned red-green-blue character
2210%  data, use
2211%
2212%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2213%
2214%  The format of the MagickConstituteImage method is:
2215%
2216%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2217%        const size_t columns,const size_t rows,const char *map,
2218%        const StorageType storage,void *pixels)
2219%
2220%  A description of each parameter follows:
2221%
2222%    o wand: the magick wand.
2223%
2224%    o columns: width in pixels of the image.
2225%
2226%    o rows: height in pixels of the image.
2227%
2228%    o map:  This string reflects the expected ordering of the pixel array.
2229%      It can be any combination or order of R = red, G = green, B = blue,
2230%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2231%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2232%      P = pad.
2233%
2234%    o storage: Define the data type of the pixels.  Float and double types are
2235%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2236%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2237%      LongPixel, QuantumPixel, or ShortPixel.
2238%
2239%    o pixels: This array of values contain the pixel components as defined by
2240%      map and type.  You must preallocate this array where the expected
2241%      length varies depending on the values of width, height, map, and type.
2242%
2243%
2244*/
2245WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2246  const size_t columns,const size_t rows,const char *map,
2247  const StorageType storage,const void *pixels)
2248{
2249  Image
2250    *images;
2251
2252  assert(wand != (MagickWand *) NULL);
2253  assert(wand->signature == WandSignature);
2254  if( IfMagickTrue(wand->debug) )
2255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2256
2257  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2258  if (images == (Image *) NULL)
2259    return(MagickFalse);
2260  return(InsertImageInWand(wand,images));
2261}
2262
2263/*
2264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265%                                                                             %
2266%                                                                             %
2267%                                                                             %
2268%   M a g i c k D e c i p h e r I m a g e                                     %
2269%                                                                             %
2270%                                                                             %
2271%                                                                             %
2272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273%
2274%  MagickDecipherImage() converts cipher pixels to plain pixels.
2275%
2276%  The format of the MagickDecipherImage method is:
2277%
2278%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2279%        const char *passphrase)
2280%
2281%  A description of each parameter follows:
2282%
2283%    o wand: the magick wand.
2284%
2285%    o passphrase: the passphrase.
2286%
2287*/
2288WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2289  const char *passphrase)
2290{
2291  assert(wand != (MagickWand *) NULL);
2292  assert(wand->signature == WandSignature);
2293  if( IfMagickTrue(wand->debug) )
2294    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2295
2296  if (wand->images == (Image *) NULL)
2297    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2298  return(DecipherImage(wand->images,passphrase,wand->exception));
2299}
2300
2301/*
2302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2303%                                                                             %
2304%                                                                             %
2305%                                                                             %
2306%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2307%                                                                             %
2308%                                                                             %
2309%                                                                             %
2310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2311%
2312%  MagickDeconstructImages() compares each image with the next in a sequence
2313%  and returns the maximum bounding region of any pixel differences it
2314%  discovers.
2315%
2316%  The format of the MagickDeconstructImages method is:
2317%
2318%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2319%
2320%  A description of each parameter follows:
2321%
2322%    o wand: the magick wand.
2323%
2324*/
2325WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2326{
2327  Image
2328    *deconstruct_image;
2329
2330  assert(wand != (MagickWand *) NULL);
2331  assert(wand->signature == WandSignature);
2332  if( IfMagickTrue(wand->debug) )
2333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2334
2335  if (wand->images == (Image *) NULL)
2336    return((MagickWand *) NULL);
2337  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2338    wand->exception);
2339  if (deconstruct_image == (Image *) NULL)
2340    return((MagickWand *) NULL);
2341  return(CloneMagickWandFromImages(wand,deconstruct_image));
2342}
2343
2344/*
2345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346%                                                                             %
2347%                                                                             %
2348%                                                                             %
2349%     M a g i c k D e s k e w I m a g e                                       %
2350%                                                                             %
2351%                                                                             %
2352%                                                                             %
2353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2354%
2355%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2356%  occurs in scanned images because of the camera being misaligned,
2357%  imperfections in the scanning or surface, or simply because the paper was
2358%  not placed completely flat when scanned.
2359%
2360%  The format of the MagickDeskewImage method is:
2361%
2362%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2363%        const double threshold)
2364%
2365%  A description of each parameter follows:
2366%
2367%    o wand: the magick wand.
2368%
2369%    o threshold: separate background from foreground.
2370%
2371*/
2372WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2373  const double threshold)
2374{
2375  Image
2376    *sepia_image;
2377
2378  assert(wand != (MagickWand *) NULL);
2379  assert(wand->signature == WandSignature);
2380  if( IfMagickTrue(wand->debug) )
2381    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2382
2383  if (wand->images == (Image *) NULL)
2384    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2385  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2386  if (sepia_image == (Image *) NULL)
2387    return(MagickFalse);
2388  ReplaceImageInList(&wand->images,sepia_image);
2389  return(MagickTrue);
2390}
2391
2392/*
2393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2394%                                                                             %
2395%                                                                             %
2396%                                                                             %
2397%     M a g i c k D e s p e c k l e I m a g e                                 %
2398%                                                                             %
2399%                                                                             %
2400%                                                                             %
2401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2402%
2403%  MagickDespeckleImage() reduces the speckle noise in an image while
2404%  perserving the edges of the original image.
2405%
2406%  The format of the MagickDespeckleImage method is:
2407%
2408%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2409%
2410%  A description of each parameter follows:
2411%
2412%    o wand: the magick wand.
2413%
2414*/
2415WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2416{
2417  Image
2418    *despeckle_image;
2419
2420  assert(wand != (MagickWand *) NULL);
2421  assert(wand->signature == WandSignature);
2422  if( IfMagickTrue(wand->debug) )
2423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2424
2425  if (wand->images == (Image *) NULL)
2426    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2427  despeckle_image=DespeckleImage(wand->images,wand->exception);
2428  if (despeckle_image == (Image *) NULL)
2429    return(MagickFalse);
2430  ReplaceImageInList(&wand->images,despeckle_image);
2431  return(MagickTrue);
2432}
2433
2434/*
2435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2436%                                                                             %
2437%                                                                             %
2438%                                                                             %
2439%   M a g i c k D e s t r o y I m a g e                                       %
2440%                                                                             %
2441%                                                                             %
2442%                                                                             %
2443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2444%
2445%  MagickDestroyImage() dereferences an image, deallocating memory associated
2446%  with the image if the reference count becomes zero.
2447%
2448%  The format of the MagickDestroyImage method is:
2449%
2450%      Image *MagickDestroyImage(Image *image)
2451%
2452%  A description of each parameter follows:
2453%
2454%    o image: the image.
2455%
2456*/
2457WandExport Image *MagickDestroyImage(Image *image)
2458{
2459  return(DestroyImage(image));
2460}
2461
2462/*
2463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464%                                                                             %
2465%                                                                             %
2466%                                                                             %
2467%   M a g i c k D i s p l a y I m a g e                                       %
2468%                                                                             %
2469%                                                                             %
2470%                                                                             %
2471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472%
2473%  MagickDisplayImage() displays an image.
2474%
2475%  The format of the MagickDisplayImage method is:
2476%
2477%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2478%        const char *server_name)
2479%
2480%  A description of each parameter follows:
2481%
2482%    o wand: the magick wand.
2483%
2484%    o server_name: the X server name.
2485%
2486*/
2487WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2488  const char *server_name)
2489{
2490  Image
2491    *image;
2492
2493  MagickBooleanType
2494    status;
2495
2496  assert(wand != (MagickWand *) NULL);
2497  assert(wand->signature == WandSignature);
2498  if( IfMagickTrue(wand->debug) )
2499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2500
2501  if (wand->images == (Image *) NULL)
2502    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2503  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2504  if (image == (Image *) NULL)
2505    return(MagickFalse);
2506  (void) CloneString(&wand->image_info->server_name,server_name);
2507  status=DisplayImages(wand->image_info,image,wand->exception);
2508  image=DestroyImage(image);
2509  return(status);
2510}
2511
2512/*
2513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514%                                                                             %
2515%                                                                             %
2516%                                                                             %
2517%   M a g i c k D i s p l a y I m a g e s                                     %
2518%                                                                             %
2519%                                                                             %
2520%                                                                             %
2521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522%
2523%  MagickDisplayImages() displays an image or image sequence.
2524%
2525%  The format of the MagickDisplayImages method is:
2526%
2527%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2528%        const char *server_name)
2529%
2530%  A description of each parameter follows:
2531%
2532%    o wand: the magick wand.
2533%
2534%    o server_name: the X server name.
2535%
2536*/
2537WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2538  const char *server_name)
2539{
2540  MagickBooleanType
2541    status;
2542
2543  assert(wand != (MagickWand *) NULL);
2544  assert(wand->signature == WandSignature);
2545  if( IfMagickTrue(wand->debug) )
2546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2547
2548  (void) CloneString(&wand->image_info->server_name,server_name);
2549  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2550  return(status);
2551}
2552
2553/*
2554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555%                                                                             %
2556%                                                                             %
2557%                                                                             %
2558%   M a g i c k D i s t o r t I m a g e                                       %
2559%                                                                             %
2560%                                                                             %
2561%                                                                             %
2562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563%
2564%  MagickDistortImage() distorts an image using various distortion methods, by
2565%  mapping color lookups of the source image to a new destination image
2566%  usally of the same size as the source image, unless 'bestfit' is set to
2567%  true.
2568%
2569%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2570%  adjusted to ensure the whole source 'image' will just fit within the final
2571%  destination image, which will be sized and offset accordingly.  Also in
2572%  many cases the virtual offset of the source image will be taken into
2573%  account in the mapping.
2574%
2575%  The format of the MagickDistortImage method is:
2576%
2577%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2578%        const DistortImageMethod method,const size_t number_arguments,
2579%        const double *arguments,const MagickBooleanType bestfit)
2580%
2581%  A description of each parameter follows:
2582%
2583%    o image: the image to be distorted.
2584%
2585%    o method: the method of image distortion.
2586%
2587%        ArcDistortion always ignores the source image offset, and always
2588%        'bestfit' the destination image with the top left corner offset
2589%        relative to the polar mapping center.
2590%
2591%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2592%        style of image distortion.
2593%
2594%        Affine, Perspective, and Bilinear, do least squares fitting of the
2595%        distortion when more than the minimum number of control point pairs
2596%        are provided.
2597%
2598%        Perspective, and Bilinear, falls back to a Affine distortion when less
2599%        that 4 control point pairs are provided. While Affine distortions let
2600%        you use any number of control point pairs, that is Zero pairs is a
2601%        no-Op (viewport only) distrotion, one pair is a translation and two
2602%        pairs of control points do a scale-rotate-translate, without any
2603%        shearing.
2604%
2605%    o number_arguments: the number of arguments given for this distortion
2606%      method.
2607%
2608%    o arguments: the arguments for this distortion method.
2609%
2610%    o bestfit: Attempt to resize destination to fit distorted source.
2611%
2612*/
2613WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2614  const DistortImageMethod method,const size_t number_arguments,
2615  const double *arguments,const MagickBooleanType bestfit)
2616{
2617  Image
2618    *distort_image;
2619
2620  assert(wand != (MagickWand *) NULL);
2621  assert(wand->signature == WandSignature);
2622  if( IfMagickTrue(wand->debug) )
2623    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2624
2625  if (wand->images == (Image *) NULL)
2626    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2627  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2628    bestfit,wand->exception);
2629  if (distort_image == (Image *) NULL)
2630    return(MagickFalse);
2631  ReplaceImageInList(&wand->images,distort_image);
2632  return(MagickTrue);
2633}
2634
2635/*
2636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2637%                                                                             %
2638%                                                                             %
2639%                                                                             %
2640%   M a g i c k D r a w I m a g e                                             %
2641%                                                                             %
2642%                                                                             %
2643%                                                                             %
2644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2645%
2646%  MagickDrawImage() renders the drawing wand on the current image.
2647%
2648%  The format of the MagickDrawImage method is:
2649%
2650%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2651%        const DrawingWand *drawing_wand)
2652%
2653%  A description of each parameter follows:
2654%
2655%    o wand: the magick wand.
2656%
2657%    o drawing_wand: the draw wand.
2658%
2659*/
2660WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2661  const DrawingWand *drawing_wand)
2662{
2663  char
2664    *primitive;
2665
2666  DrawInfo
2667    *draw_info;
2668
2669  MagickBooleanType
2670    status;
2671
2672  assert(wand != (MagickWand *) NULL);
2673  assert(wand->signature == WandSignature);
2674  if( IfMagickTrue(wand->debug) )
2675    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2676
2677  if (wand->images == (Image *) NULL)
2678    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2679  draw_info=PeekDrawingWand(drawing_wand);
2680  if ((draw_info == (DrawInfo *) NULL) ||
2681      (draw_info->primitive == (char *) NULL))
2682    return(MagickFalse);
2683  primitive=AcquireString(draw_info->primitive);
2684  draw_info=DestroyDrawInfo(draw_info);
2685  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2686  draw_info->primitive=primitive;
2687  status=DrawImage(wand->images,draw_info,wand->exception);
2688  draw_info=DestroyDrawInfo(draw_info);
2689  return(status);
2690}
2691
2692/*
2693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2694%                                                                             %
2695%                                                                             %
2696%                                                                             %
2697%   M a g i c k E d g e I m a g e                                             %
2698%                                                                             %
2699%                                                                             %
2700%                                                                             %
2701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2702%
2703%  MagickEdgeImage() enhance edges within the image with a convolution filter
2704%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2705%  radius for you.
2706%
2707%  The format of the MagickEdgeImage method is:
2708%
2709%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2710%        const double sigma)
2711%
2712%  A description of each parameter follows:
2713%
2714%    o wand: the magick wand.
2715%
2716%    o radius: the radius of the pixel neighborhood.
2717%
2718%    o sigma: the standard deviation of the Gaussian, in pixels.
2719%
2720*/
2721WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2722  const double radius,const double sigma)
2723{
2724  Image
2725    *edge_image;
2726
2727  assert(wand != (MagickWand *) NULL);
2728  assert(wand->signature == WandSignature);
2729  if( IfMagickTrue(wand->debug) )
2730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2731
2732  if (wand->images == (Image *) NULL)
2733    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2734  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2735  if (edge_image == (Image *) NULL)
2736    return(MagickFalse);
2737  ReplaceImageInList(&wand->images,edge_image);
2738  return(MagickTrue);
2739}
2740
2741/*
2742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2743%                                                                             %
2744%                                                                             %
2745%                                                                             %
2746%   M a g i c k E m b o s s I m a g e                                         %
2747%                                                                             %
2748%                                                                             %
2749%                                                                             %
2750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2751%
2752%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2753%  effect.  We convolve the image with a Gaussian operator of the given radius
2754%  and standard deviation (sigma).  For reasonable results, radius should be
2755%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2756%  radius for you.
2757%
2758%  The format of the MagickEmbossImage method is:
2759%
2760%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2761%        const double sigma)
2762%
2763%  A description of each parameter follows:
2764%
2765%    o wand: the magick wand.
2766%
2767%    o radius: the radius of the Gaussian, in pixels, not counting the center
2768%      pixel.
2769%
2770%    o sigma: the standard deviation of the Gaussian, in pixels.
2771%
2772*/
2773WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2774  const double radius,const double sigma)
2775{
2776  Image
2777    *emboss_image;
2778
2779  assert(wand != (MagickWand *) NULL);
2780  assert(wand->signature == WandSignature);
2781  if( IfMagickTrue(wand->debug) )
2782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2783
2784  if (wand->images == (Image *) NULL)
2785    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2786  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2787  if (emboss_image == (Image *) NULL)
2788    return(MagickFalse);
2789  ReplaceImageInList(&wand->images,emboss_image);
2790  return(MagickTrue);
2791}
2792
2793/*
2794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2795%                                                                             %
2796%                                                                             %
2797%                                                                             %
2798%   M a g i c k E n c i p h e r I m a g e                                     %
2799%                                                                             %
2800%                                                                             %
2801%                                                                             %
2802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2803%
2804%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2805%
2806%  The format of the MagickEncipherImage method is:
2807%
2808%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2809%        const char *passphrase)
2810%
2811%  A description of each parameter follows:
2812%
2813%    o wand: the magick wand.
2814%
2815%    o passphrase: the passphrase.
2816%
2817*/
2818WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2819  const char *passphrase)
2820{
2821  assert(wand != (MagickWand *) NULL);
2822  assert(wand->signature == WandSignature);
2823  if( IfMagickTrue(wand->debug) )
2824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2825
2826  if (wand->images == (Image *) NULL)
2827    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2828  return(EncipherImage(wand->images,passphrase,wand->exception));
2829}
2830
2831/*
2832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833%                                                                             %
2834%                                                                             %
2835%                                                                             %
2836%   M a g i c k E n h a n c e I m a g e                                       %
2837%                                                                             %
2838%                                                                             %
2839%                                                                             %
2840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2841%
2842%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2843%  noisy image.
2844%
2845%  The format of the MagickEnhanceImage method is:
2846%
2847%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2848%
2849%  A description of each parameter follows:
2850%
2851%    o wand: the magick wand.
2852%
2853*/
2854WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2855{
2856  Image
2857    *enhance_image;
2858
2859  assert(wand != (MagickWand *) NULL);
2860  assert(wand->signature == WandSignature);
2861  if( IfMagickTrue(wand->debug) )
2862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2863
2864  if (wand->images == (Image *) NULL)
2865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2866  enhance_image=EnhanceImage(wand->images,wand->exception);
2867  if (enhance_image == (Image *) NULL)
2868    return(MagickFalse);
2869  ReplaceImageInList(&wand->images,enhance_image);
2870  return(MagickTrue);
2871}
2872
2873/*
2874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2875%                                                                             %
2876%                                                                             %
2877%                                                                             %
2878%   M a g i c k E q u a l i z e I m a g e                                     %
2879%                                                                             %
2880%                                                                             %
2881%                                                                             %
2882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2883%
2884%  MagickEqualizeImage() equalizes the image histogram.
2885%
2886%  The format of the MagickEqualizeImage method is:
2887%
2888%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2889%
2890%  A description of each parameter follows:
2891%
2892%    o wand: the magick wand.
2893%
2894%    o channel: the image channel(s).
2895%
2896*/
2897WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2898{
2899  MagickBooleanType
2900    status;
2901
2902  assert(wand != (MagickWand *) NULL);
2903  assert(wand->signature == WandSignature);
2904  if( IfMagickTrue(wand->debug) )
2905    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2906
2907  if (wand->images == (Image *) NULL)
2908    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2909  status=EqualizeImage(wand->images,wand->exception);
2910  return(status);
2911}
2912
2913/*
2914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2915%                                                                             %
2916%                                                                             %
2917%                                                                             %
2918%   M a g i c k E v a l u a t e I m a g e                                     %
2919%                                                                             %
2920%                                                                             %
2921%                                                                             %
2922%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2923%
2924%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2925%  expression to an image.  Use these operators to lighten or darken an image,
2926%  to increase or decrease contrast in an image, or to produce the "negative"
2927%  of an image.
2928%
2929%  The format of the MagickEvaluateImage method is:
2930%
2931%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2932%        const MagickEvaluateOperator operator,const double value)
2933%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2934%        const MagickEvaluateOperator operator)
2935%
2936%  A description of each parameter follows:
2937%
2938%    o wand: the magick wand.
2939%
2940%    o op: A channel operator.
2941%
2942%    o value: A value value.
2943%
2944*/
2945
2946WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2947  const MagickEvaluateOperator op)
2948{
2949  Image
2950    *evaluate_image;
2951
2952  assert(wand != (MagickWand *) NULL);
2953  assert(wand->signature == WandSignature);
2954  if( IfMagickTrue(wand->debug) )
2955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2956
2957  if (wand->images == (Image *) NULL)
2958    return((MagickWand *) NULL);
2959  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2960  if (evaluate_image == (Image *) NULL)
2961    return((MagickWand *) NULL);
2962  return(CloneMagickWandFromImages(wand,evaluate_image));
2963}
2964
2965WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2966  const MagickEvaluateOperator op,const double value)
2967{
2968  MagickBooleanType
2969    status;
2970
2971  assert(wand != (MagickWand *) NULL);
2972  assert(wand->signature == WandSignature);
2973  if( IfMagickTrue(wand->debug) )
2974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2975
2976  if (wand->images == (Image *) NULL)
2977    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2978  status=EvaluateImage(wand->images,op,value,wand->exception);
2979  return(status);
2980}
2981
2982/*
2983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2984%                                                                             %
2985%                                                                             %
2986%                                                                             %
2987%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2988%                                                                             %
2989%                                                                             %
2990%                                                                             %
2991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2992%
2993%  MagickExportImagePixels() extracts pixel data from an image and returns it
2994%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2995%  an error is encountered.  The data is returned as char, short int, int,
2996%  ssize_t, float, or double in the order specified by map.
2997%
2998%  Suppose you want to extract the first scanline of a 640x480 image as
2999%  character data in red-green-blue order:
3000%
3001%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3002%
3003%  The format of the MagickExportImagePixels method is:
3004%
3005%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3006%        const ssize_t x,const ssize_t y,const size_t columns,
3007%        const size_t rows,const char *map,const StorageType storage,
3008%        void *pixels)
3009%
3010%  A description of each parameter follows:
3011%
3012%    o wand: the magick wand.
3013%
3014%    o x, y, columns, rows:  These values define the perimeter
3015%      of a region of pixels you want to extract.
3016%
3017%    o map:  This string reflects the expected ordering of the pixel array.
3018%      It can be any combination or order of R = red, G = green, B = blue,
3019%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3020%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3021%      P = pad.
3022%
3023%    o storage: Define the data type of the pixels.  Float and double types are
3024%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3025%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3026%      LongPixel, QuantumPixel, or ShortPixel.
3027%
3028%    o pixels: This array of values contain the pixel components as defined by
3029%      map and type.  You must preallocate this array where the expected
3030%      length varies depending on the values of width, height, map, and type.
3031%
3032*/
3033WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3034  const ssize_t x,const ssize_t y,const size_t columns,
3035  const size_t rows,const char *map,const StorageType storage,
3036  void *pixels)
3037{
3038  MagickBooleanType
3039    status;
3040
3041  assert(wand != (MagickWand *) NULL);
3042  assert(wand->signature == WandSignature);
3043  if( IfMagickTrue(wand->debug) )
3044    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3045
3046  if (wand->images == (Image *) NULL)
3047    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3048  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3049    storage,pixels,wand->exception);
3050  return(status);
3051}
3052
3053/*
3054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3055%                                                                             %
3056%                                                                             %
3057%                                                                             %
3058%   M a g i c k E x t e n t I m a g e                                         %
3059%                                                                             %
3060%                                                                             %
3061%                                                                             %
3062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3063%
3064%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3065%  and wand background color.  Set the (x,y) offset of the geometry to move
3066%  the original wand relative to the extended wand.
3067%
3068%  The format of the MagickExtentImage method is:
3069%
3070%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3071%        const size_t height,const ssize_t x,const ssize_t y)
3072%
3073%  A description of each parameter follows:
3074%
3075%    o wand: the magick wand.
3076%
3077%    o width: the region width.
3078%
3079%    o height: the region height.
3080%
3081%    o x: the region x offset.
3082%
3083%    o y: the region y offset.
3084%
3085*/
3086WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3087  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3088{
3089  Image
3090    *extent_image;
3091
3092  RectangleInfo
3093    extent;
3094
3095  assert(wand != (MagickWand *) NULL);
3096  assert(wand->signature == WandSignature);
3097  if( IfMagickTrue(wand->debug) )
3098    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3099
3100  if (wand->images == (Image *) NULL)
3101    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102  extent.width=width;
3103  extent.height=height;
3104  extent.x=x;
3105  extent.y=y;
3106  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3107  if (extent_image == (Image *) NULL)
3108    return(MagickFalse);
3109  ReplaceImageInList(&wand->images,extent_image);
3110  return(MagickTrue);
3111}
3112
3113/*
3114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115%                                                                             %
3116%                                                                             %
3117%                                                                             %
3118%   M a g i c k F l i p I m a g e                                             %
3119%                                                                             %
3120%                                                                             %
3121%                                                                             %
3122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3123%
3124%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3125%  around the central x-axis.
3126%
3127%  The format of the MagickFlipImage method is:
3128%
3129%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3130%
3131%  A description of each parameter follows:
3132%
3133%    o wand: the magick wand.
3134%
3135*/
3136WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3137{
3138  Image
3139    *flip_image;
3140
3141  assert(wand != (MagickWand *) NULL);
3142  assert(wand->signature == WandSignature);
3143  if( IfMagickTrue(wand->debug) )
3144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3145
3146  if (wand->images == (Image *) NULL)
3147    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3148  flip_image=FlipImage(wand->images,wand->exception);
3149  if (flip_image == (Image *) NULL)
3150    return(MagickFalse);
3151  ReplaceImageInList(&wand->images,flip_image);
3152  return(MagickTrue);
3153}
3154
3155/*
3156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3157%                                                                             %
3158%                                                                             %
3159%                                                                             %
3160%   M a g i c k F l o o d f i l l P a i n t I m a g e                         %
3161%                                                                             %
3162%                                                                             %
3163%                                                                             %
3164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3165%
3166%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3167%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3168%  specified, the color value is changed for any neighbor pixel that does not
3169%  match the bordercolor member of image.
3170%
3171%  The format of the MagickFloodfillPaintImage method is:
3172%
3173%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3174%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3175%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3176%
3177%  A description of each parameter follows:
3178%
3179%    o wand: the magick wand.
3180%
3181%    o fill: the floodfill color pixel wand.
3182%
3183%    o fuzz: By default target must match a particular pixel color
3184%      exactly.  However, in many cases two colors may differ by a small amount.
3185%      The fuzz member of image defines how much tolerance is acceptable to
3186%      consider two colors as the same.  For example, set fuzz to 10 and the
3187%      color red at intensities of 100 and 102 respectively are now interpreted
3188%      as the same color for the purposes of the floodfill.
3189%
3190%    o bordercolor: the border color pixel wand.
3191%
3192%    o x,y: the starting location of the operation.
3193%
3194%    o invert: paint any pixel that does not match the target color.
3195%
3196*/
3197WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3198  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3199  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3200{
3201  DrawInfo
3202    *draw_info;
3203
3204  MagickBooleanType
3205    status;
3206
3207  PixelInfo
3208    target;
3209
3210  assert(wand != (MagickWand *) NULL);
3211  assert(wand->signature == WandSignature);
3212  if( IfMagickTrue(wand->debug) )
3213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3214
3215  if (wand->images == (Image *) NULL)
3216    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3217  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3218  PixelGetQuantumPacket(fill,&draw_info->fill);
3219  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3220    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3221  if (bordercolor != (PixelWand *) NULL)
3222    PixelGetMagickColor(bordercolor,&target);
3223  wand->images->fuzz=fuzz;
3224  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3225    wand->exception);
3226  draw_info=DestroyDrawInfo(draw_info);
3227  return(status);
3228}
3229
3230/*
3231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3232%                                                                             %
3233%                                                                             %
3234%                                                                             %
3235%   M a g i c k F l o p I m a g e                                             %
3236%                                                                             %
3237%                                                                             %
3238%                                                                             %
3239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3240%
3241%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3242%  around the central y-axis.
3243%
3244%  The format of the MagickFlopImage method is:
3245%
3246%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3247%
3248%  A description of each parameter follows:
3249%
3250%    o wand: the magick wand.
3251%
3252*/
3253WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3254{
3255  Image
3256    *flop_image;
3257
3258  assert(wand != (MagickWand *) NULL);
3259  assert(wand->signature == WandSignature);
3260  if( IfMagickTrue(wand->debug) )
3261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3262
3263  if (wand->images == (Image *) NULL)
3264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3265  flop_image=FlopImage(wand->images,wand->exception);
3266  if (flop_image == (Image *) NULL)
3267    return(MagickFalse);
3268  ReplaceImageInList(&wand->images,flop_image);
3269  return(MagickTrue);
3270}
3271
3272/*
3273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3274%                                                                             %
3275%                                                                             %
3276%                                                                             %
3277%   M a g i c k F o u r i e r T r a n s f o r m I m a g e                     %
3278%                                                                             %
3279%                                                                             %
3280%                                                                             %
3281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282%
3283%  MagickForwardFourierTransformImage() implements the discrete Fourier
3284%  transform (DFT) of the image either as a magnitude / phase or real /
3285%  imaginary image pair.
3286%
3287%  The format of the MagickForwardFourierTransformImage method is:
3288%
3289%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3290%        const MagickBooleanType magnitude)
3291%
3292%  A description of each parameter follows:
3293%
3294%    o wand: the magick wand.
3295%
3296%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3297%      imaginary image pair.
3298%
3299*/
3300WandExport MagickBooleanType MagickForwardFourierTransformImage(
3301  MagickWand *wand,const MagickBooleanType magnitude)
3302{
3303  Image
3304    *forward_image;
3305
3306  assert(wand != (MagickWand *) NULL);
3307  assert(wand->signature == WandSignature);
3308  if( IfMagickTrue(wand->debug) )
3309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3310
3311  if (wand->images == (Image *) NULL)
3312    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3313  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3314    wand->exception);
3315  if (forward_image == (Image *) NULL)
3316    return(MagickFalse);
3317  ReplaceImageInList(&wand->images,forward_image);
3318  return(MagickTrue);
3319}
3320
3321/*
3322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323%                                                                             %
3324%                                                                             %
3325%                                                                             %
3326%   M a g i c k F r a m e I m a g e                                           %
3327%                                                                             %
3328%                                                                             %
3329%                                                                             %
3330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3331%
3332%  MagickFrameImage() adds a simulated three-dimensional border around the
3333%  image.  The width and height specify the border width of the vertical and
3334%  horizontal sides of the frame.  The inner and outer bevels indicate the
3335%  width of the inner and outer shadows of the frame.
3336%
3337%  The format of the MagickFrameImage method is:
3338%
3339%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3340%        const PixelWand *matte_color,const size_t width,
3341%        const size_t height,const ssize_t inner_bevel,
3342%        const ssize_t outer_bevel,const CompositeOperator compose)
3343%
3344%  A description of each parameter follows:
3345%
3346%    o wand: the magick wand.
3347%
3348%    o matte_color: the frame color pixel wand.
3349%
3350%    o width: the border width.
3351%
3352%    o height: the border height.
3353%
3354%    o inner_bevel: the inner bevel width.
3355%
3356%    o outer_bevel: the outer bevel width.
3357%
3358%    o compose: the composite operator.
3359%
3360*/
3361WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3362  const PixelWand *matte_color,const size_t width,const size_t height,
3363  const ssize_t inner_bevel,const ssize_t outer_bevel,
3364  const CompositeOperator compose)
3365{
3366  Image
3367    *frame_image;
3368
3369  FrameInfo
3370    frame_info;
3371
3372  assert(wand != (MagickWand *) NULL);
3373  assert(wand->signature == WandSignature);
3374  if( IfMagickTrue(wand->debug) )
3375    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3376
3377  if (wand->images == (Image *) NULL)
3378    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3379  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3380  frame_info.width=wand->images->columns+2*width;
3381  frame_info.height=wand->images->rows+2*height;
3382  frame_info.x=(ssize_t) width;
3383  frame_info.y=(ssize_t) height;
3384  frame_info.inner_bevel=inner_bevel;
3385  frame_info.outer_bevel=outer_bevel;
3386  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3387  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3388  if (frame_image == (Image *) NULL)
3389    return(MagickFalse);
3390  ReplaceImageInList(&wand->images,frame_image);
3391  return(MagickTrue);
3392}
3393
3394/*
3395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3396%                                                                             %
3397%                                                                             %
3398%                                                                             %
3399%   M a g i c k F u n c t i o n I m a g e                                     %
3400%                                                                             %
3401%                                                                             %
3402%                                                                             %
3403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3404%
3405%  MagickFunctionImage() applys an arithmetic, relational, or logical
3406%  expression to an image.  Use these operators to lighten or darken an image,
3407%  to increase or decrease contrast in an image, or to produce the "negative"
3408%  of an image.
3409%
3410%  The format of the MagickFunctionImage method is:
3411%
3412%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3413%        const MagickFunction function,const size_t number_arguments,
3414%        const double *arguments)
3415%
3416%  A description of each parameter follows:
3417%
3418%    o wand: the magick wand.
3419%
3420%    o function: the image function.
3421%
3422%    o number_arguments: the number of function arguments.
3423%
3424%    o arguments: the function arguments.
3425%
3426*/
3427WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3428  const MagickFunction function,const size_t number_arguments,
3429  const double *arguments)
3430{
3431  MagickBooleanType
3432    status;
3433
3434  assert(wand != (MagickWand *) NULL);
3435  assert(wand->signature == WandSignature);
3436  if( IfMagickTrue(wand->debug) )
3437    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3438
3439  if (wand->images == (Image *) NULL)
3440    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3441  status=FunctionImage(wand->images,function,number_arguments,arguments,
3442    wand->exception);
3443  return(status);
3444}
3445
3446/*
3447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3448%                                                                             %
3449%                                                                             %
3450%                                                                             %
3451%   M a g i c k F x I m a g e                                                 %
3452%                                                                             %
3453%                                                                             %
3454%                                                                             %
3455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3456%
3457%  MagickFxImage() evaluate expression for each pixel in the image.
3458%
3459%  The format of the MagickFxImage method is:
3460%
3461%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3462%
3463%  A description of each parameter follows:
3464%
3465%    o wand: the magick wand.
3466%
3467%    o expression: the expression.
3468%
3469*/
3470WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3471{
3472  Image
3473    *fx_image;
3474
3475  assert(wand != (MagickWand *) NULL);
3476  assert(wand->signature == WandSignature);
3477  if( IfMagickTrue(wand->debug) )
3478    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3479
3480  if (wand->images == (Image *) NULL)
3481    return((MagickWand *) NULL);
3482  fx_image=FxImage(wand->images,expression,wand->exception);
3483  if (fx_image == (Image *) NULL)
3484    return((MagickWand *) NULL);
3485  return(CloneMagickWandFromImages(wand,fx_image));
3486}
3487
3488/*
3489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3490%                                                                             %
3491%                                                                             %
3492%                                                                             %
3493%   M a g i c k G a m m a I m a g e                                           %
3494%                                                                             %
3495%                                                                             %
3496%                                                                             %
3497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3498%
3499%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3500%  different devices will have perceptual differences in the way the image's
3501%  intensities are represented on the screen.  Specify individual gamma levels
3502%  for the red, green, and blue channels, or adjust all three with the gamma
3503%  parameter.  Values typically range from 0.8 to 2.3.
3504%
3505%  You can also reduce the influence of a particular channel with a gamma
3506%  value of 0.
3507%
3508%  The format of the MagickGammaImage method is:
3509%
3510%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3511%
3512%  A description of each parameter follows:
3513%
3514%    o wand: the magick wand.
3515%
3516%    o level: Define the level of gamma correction.
3517%
3518*/
3519WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3520  const double gamma)
3521{
3522  MagickBooleanType
3523    status;
3524
3525  assert(wand != (MagickWand *) NULL);
3526  assert(wand->signature == WandSignature);
3527  if( IfMagickTrue(wand->debug) )
3528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3529
3530  if (wand->images == (Image *) NULL)
3531    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3532  status=GammaImage(wand->images,gamma,wand->exception);
3533  return(status);
3534}
3535
3536/*
3537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3538%                                                                             %
3539%                                                                             %
3540%                                                                             %
3541%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3542%                                                                             %
3543%                                                                             %
3544%                                                                             %
3545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3546%
3547%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3548%  Gaussian operator of the given radius and standard deviation (sigma).
3549%  For reasonable results, the radius should be larger than sigma.  Use a
3550%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3551%
3552%  The format of the MagickGaussianBlurImage method is:
3553%
3554%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3555%        const double radius,const double sigma)
3556%
3557%  A description of each parameter follows:
3558%
3559%    o wand: the magick wand.
3560%
3561%    o radius: the radius of the Gaussian, in pixels, not counting the center
3562%      pixel.
3563%
3564%    o sigma: the standard deviation of the Gaussian, in pixels.
3565%
3566*/
3567WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3568  const double radius,const double sigma)
3569{
3570  Image
3571    *blur_image;
3572
3573  assert(wand != (MagickWand *) NULL);
3574  assert(wand->signature == WandSignature);
3575  if( IfMagickTrue(wand->debug) )
3576    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3577
3578  if (wand->images == (Image *) NULL)
3579    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3580  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3581  if (blur_image == (Image *) NULL)
3582    return(MagickFalse);
3583  ReplaceImageInList(&wand->images,blur_image);
3584  return(MagickTrue);
3585}
3586
3587/*
3588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3589%                                                                             %
3590%                                                                             %
3591%                                                                             %
3592%   M a g i c k G e t I m a g e                                               %
3593%                                                                             %
3594%                                                                             %
3595%                                                                             %
3596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3597%
3598%  MagickGetImage() gets the image at the current image index.
3599%
3600%  The format of the MagickGetImage method is:
3601%
3602%      MagickWand *MagickGetImage(MagickWand *wand)
3603%
3604%  A description of each parameter follows:
3605%
3606%    o wand: the magick wand.
3607%
3608*/
3609WandExport MagickWand *MagickGetImage(MagickWand *wand)
3610{
3611  Image
3612    *image;
3613
3614  assert(wand != (MagickWand *) NULL);
3615  assert(wand->signature == WandSignature);
3616  if( IfMagickTrue(wand->debug) )
3617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3618
3619  if (wand->images == (Image *) NULL)
3620    {
3621      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3622        "ContainsNoImages","'%s'",wand->name);
3623      return((MagickWand *) NULL);
3624    }
3625  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3626  if (image == (Image *) NULL)
3627    return((MagickWand *) NULL);
3628  return(CloneMagickWandFromImages(wand,image));
3629}
3630
3631/*
3632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633%                                                                             %
3634%                                                                             %
3635%                                                                             %
3636%   M a g i c k G e t I m a g e A l p h a C h a n n e l                       %
3637%                                                                             %
3638%                                                                             %
3639%                                                                             %
3640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641%
3642%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3643%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3644%  than CMYKA.
3645%
3646%  The format of the MagickGetImageAlphaChannel method is:
3647%
3648%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3649%
3650%  A description of each parameter follows:
3651%
3652%    o wand: the magick wand.
3653%
3654*/
3655WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3656{
3657  assert(wand != (MagickWand *) NULL);
3658  assert(wand->signature == WandSignature);
3659  if( IfMagickTrue(wand->debug) )
3660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3661
3662  if (wand->images == (Image *) NULL)
3663    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3664  return(GetImageAlphaChannel(wand->images));
3665}
3666
3667/*
3668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3669%                                                                             %
3670%                                                                             %
3671%                                                                             %
3672%   M a g i c k G e t I m a g e C l i p M a s k                               %
3673%                                                                             %
3674%                                                                             %
3675%                                                                             %
3676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3677%
3678%  MagickGetImageMask() gets the image clip mask at the current image index.
3679%
3680%  The format of the MagickGetImageMask method is:
3681%
3682%      MagickWand *MagickGetImageMask(MagickWand *wand)
3683%
3684%  A description of each parameter follows:
3685%
3686%    o wand: the magick wand.
3687%
3688*/
3689WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3690{
3691  Image
3692    *image;
3693
3694  assert(wand != (MagickWand *) NULL);
3695  assert(wand->signature == WandSignature);
3696  if( IfMagickTrue(wand->debug) )
3697    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3698
3699  if (wand->images == (Image *) NULL)
3700    {
3701      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3702        "ContainsNoImages","'%s'",wand->name);
3703      return((MagickWand *) NULL);
3704    }
3705  image=GetImageMask(wand->images,wand->exception);
3706  if (image == (Image *) NULL)
3707    return((MagickWand *) NULL);
3708  return(CloneMagickWandFromImages(wand,image));
3709}
3710
3711/*
3712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3713%                                                                             %
3714%                                                                             %
3715%                                                                             %
3716%   M a g i c k G e t I m a g e B a c k g r o u n d C o l o r                 %
3717%                                                                             %
3718%                                                                             %
3719%                                                                             %
3720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3721%
3722%  MagickGetImageBackgroundColor() returns the image background color.
3723%
3724%  The format of the MagickGetImageBackgroundColor method is:
3725%
3726%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3727%        PixelWand *background_color)
3728%
3729%  A description of each parameter follows:
3730%
3731%    o wand: the magick wand.
3732%
3733%    o background_color: Return the background color.
3734%
3735*/
3736WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3737  PixelWand *background_color)
3738{
3739  assert(wand != (MagickWand *) NULL);
3740  assert(wand->signature == WandSignature);
3741  if( IfMagickTrue(wand->debug) )
3742    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743
3744  if (wand->images == (Image *) NULL)
3745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3746  PixelSetPixelColor(background_color,&wand->images->background_color);
3747  return(MagickTrue);
3748}
3749
3750/*
3751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3752%                                                                             %
3753%                                                                             %
3754%                                                                             %
3755%   M a g i c k G e t I m a g e B l o b                                       %
3756%                                                                             %
3757%                                                                             %
3758%                                                                             %
3759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3760%
3761%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3762%  the image as a blob (a formatted "file" in memory) and its length, starting
3763%  from the current position in the image sequence.  Use MagickSetImageFormat()
3764%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3765%
3766%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3767%  the image sequence.
3768%
3769%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3770%
3771%  The format of the MagickGetImageBlob method is:
3772%
3773%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3774%
3775%  A description of each parameter follows:
3776%
3777%    o wand: the magick wand.
3778%
3779%    o length: the length of the blob.
3780%
3781*/
3782WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3783{
3784  assert(wand != (MagickWand *) NULL);
3785  assert(wand->signature == WandSignature);
3786  if( IfMagickTrue(wand->debug) )
3787    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3788
3789  if (wand->images == (Image *) NULL)
3790    {
3791      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3792        "ContainsNoImages","'%s'",wand->name);
3793      return((unsigned char *) NULL);
3794    }
3795  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3796}
3797
3798/*
3799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3800%                                                                             %
3801%                                                                             %
3802%                                                                             %
3803%   M a g i c k G e t I m a g e s B l o b                                     %
3804%                                                                             %
3805%                                                                             %
3806%                                                                             %
3807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3808%
3809%  MagickGetImageBlob() implements direct to memory image formats.  It
3810%  returns the image sequence as a blob and its length.  The format of the image
3811%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3812%  return a different image format, use MagickSetImageFormat().
3813%
3814%  Note, some image formats do not permit multiple images to the same image
3815%  stream (e.g. JPEG).  in this instance, just the first image of the
3816%  sequence is returned as a blob.
3817%
3818%  The format of the MagickGetImagesBlob method is:
3819%
3820%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3821%
3822%  A description of each parameter follows:
3823%
3824%    o wand: the magick wand.
3825%
3826%    o length: the length of the blob.
3827%
3828*/
3829WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3830{
3831  unsigned char
3832    *blob;
3833
3834  assert(wand != (MagickWand *) NULL);
3835  assert(wand->signature == WandSignature);
3836  if( IfMagickTrue(wand->debug) )
3837    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3838
3839  if (wand->images == (Image *) NULL)
3840    {
3841      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3842        "ContainsNoImages","'%s'",wand->name);
3843      return((unsigned char *) NULL);
3844    }
3845  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3846    wand->exception);
3847  return(blob);
3848}
3849
3850/*
3851%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3852%                                                                             %
3853%                                                                             %
3854%                                                                             %
3855%   M a g i c k G e t I m a g e B l u e P r i m a r y                         %
3856%                                                                             %
3857%                                                                             %
3858%                                                                             %
3859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3860%
3861%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3862%  image.
3863%
3864%  The format of the MagickGetImageBluePrimary method is:
3865%
3866%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3867%        double *y)
3868%
3869%  A description of each parameter follows:
3870%
3871%    o wand: the magick wand.
3872%
3873%    o x: the chromaticity blue primary x-point.
3874%
3875%    o y: the chromaticity blue primary y-point.
3876%
3877*/
3878WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3879  double *x,double *y)
3880{
3881  assert(wand != (MagickWand *) NULL);
3882  assert(wand->signature == WandSignature);
3883  if( IfMagickTrue(wand->debug) )
3884    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3885
3886  if (wand->images == (Image *) NULL)
3887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3888  *x=wand->images->chromaticity.blue_primary.x;
3889  *y=wand->images->chromaticity.blue_primary.y;
3890  return(MagickTrue);
3891}
3892
3893/*
3894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895%                                                                             %
3896%                                                                             %
3897%                                                                             %
3898%   M a g i c k G e t I m a g e B o r d e r C o l o r                         %
3899%                                                                             %
3900%                                                                             %
3901%                                                                             %
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903%
3904%  MagickGetImageBorderColor() returns the image border color.
3905%
3906%  The format of the MagickGetImageBorderColor method is:
3907%
3908%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3909%        PixelWand *border_color)
3910%
3911%  A description of each parameter follows:
3912%
3913%    o wand: the magick wand.
3914%
3915%    o border_color: Return the border color.
3916%
3917*/
3918WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3919  PixelWand *border_color)
3920{
3921  assert(wand != (MagickWand *) NULL);
3922  assert(wand->signature == WandSignature);
3923  if( IfMagickTrue(wand->debug) )
3924    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3925
3926  if (wand->images == (Image *) NULL)
3927    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3928  PixelSetPixelColor(border_color,&wand->images->border_color);
3929  return(MagickTrue);
3930}
3931
3932/*
3933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3934%                                                                             %
3935%                                                                             %
3936%                                                                             %
3937%   M a g i c k G e t I m a g e F e a t u r e s                               %
3938%                                                                             %
3939%                                                                             %
3940%                                                                             %
3941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3942%
3943%  MagickGetImageFeatures() returns features for each channel in the
3944%  image in each of four directions (horizontal, vertical, left and right
3945%  diagonals) for the specified distance.  The features include the angular
3946%  second moment, contrast, correlation, sum of squares: variance, inverse
3947%  difference moment, sum average, sum varience, sum entropy, entropy,
3948%  difference variance, difference entropy, information measures of
3949%  correlation 1, information measures of correlation 2, and maximum
3950%  correlation coefficient.  You can access the red channel contrast, for
3951%  example, like this:
3952%
3953%      channel_features=MagickGetImageFeatures(wand,1);
3954%      contrast=channel_features[RedPixelChannel].contrast[0];
3955%
3956%  Use MagickRelinquishMemory() to free the statistics buffer.
3957%
3958%  The format of the MagickGetImageFeatures method is:
3959%
3960%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3961%        const size_t distance)
3962%
3963%  A description of each parameter follows:
3964%
3965%    o wand: the magick wand.
3966%
3967%    o distance: the distance.
3968%
3969*/
3970WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3971  const size_t distance)
3972{
3973  assert(wand != (MagickWand *) NULL);
3974  assert(wand->signature == WandSignature);
3975  if( IfMagickTrue(wand->debug) )
3976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3977
3978  if (wand->images == (Image *) NULL)
3979    {
3980      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3981        "ContainsNoImages","'%s'",wand->name);
3982      return((ChannelFeatures *) NULL);
3983    }
3984  return(GetImageFeatures(wand->images,distance,wand->exception));
3985}
3986
3987/*
3988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3989%                                                                             %
3990%                                                                             %
3991%                                                                             %
3992%   M a g i c k G e t I m a g e K u r t o s i s                               %
3993%                                                                             %
3994%                                                                             %
3995%                                                                             %
3996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3997%
3998%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3999%  more image channels.
4000%
4001%  The format of the MagickGetImageKurtosis method is:
4002%
4003%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4004%        double *kurtosis,double *skewness)
4005%
4006%  A description of each parameter follows:
4007%
4008%    o wand: the magick wand.
4009%
4010%    o kurtosis:  The kurtosis for the specified channel(s).
4011%
4012%    o skewness:  The skewness for the specified channel(s).
4013%
4014*/
4015WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4016  double *kurtosis,double *skewness)
4017{
4018  MagickBooleanType
4019    status;
4020
4021  assert(wand != (MagickWand *) NULL);
4022  assert(wand->signature == WandSignature);
4023  if( IfMagickTrue(wand->debug) )
4024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4025
4026  if (wand->images == (Image *) NULL)
4027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4028  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4029  return(status);
4030}
4031
4032/*
4033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4034%                                                                             %
4035%                                                                             %
4036%                                                                             %
4037%   M a g i c k G e t I m a g e M e a n                                       %
4038%                                                                             %
4039%                                                                             %
4040%                                                                             %
4041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4042%
4043%  MagickGetImageMean() gets the mean and standard deviation of one or more
4044%  image channels.
4045%
4046%  The format of the MagickGetImageMean method is:
4047%
4048%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4049%        double *standard_deviation)
4050%
4051%  A description of each parameter follows:
4052%
4053%    o wand: the magick wand.
4054%
4055%    o channel: the image channel(s).
4056%
4057%    o mean:  The mean pixel value for the specified channel(s).
4058%
4059%    o standard_deviation:  The standard deviation for the specified channel(s).
4060%
4061*/
4062WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4063  double *standard_deviation)
4064{
4065  MagickBooleanType
4066    status;
4067
4068  assert(wand != (MagickWand *) NULL);
4069  assert(wand->signature == WandSignature);
4070  if( IfMagickTrue(wand->debug) )
4071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4072
4073  if (wand->images == (Image *) NULL)
4074    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4075  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4076  return(status);
4077}
4078
4079/*
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%                                                                             %
4082%                                                                             %
4083%                                                                             %
4084%   M a g i c k G e t I m a g e R a n g e                                     %
4085%                                                                             %
4086%                                                                             %
4087%                                                                             %
4088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4089%
4090%  MagickGetImageRange() gets the range for one or more image channels.
4091%
4092%  The format of the MagickGetImageRange method is:
4093%
4094%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4095%        double *maxima)
4096%
4097%  A description of each parameter follows:
4098%
4099%    o wand: the magick wand.
4100%
4101%    o minima:  The minimum pixel value for the specified channel(s).
4102%
4103%    o maxima:  The maximum pixel value for the specified channel(s).
4104%
4105*/
4106WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4107  double *minima,double *maxima)
4108{
4109  MagickBooleanType
4110    status;
4111
4112  assert(wand != (MagickWand *) NULL);
4113  assert(wand->signature == WandSignature);
4114  if( IfMagickTrue(wand->debug) )
4115    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4116
4117  if (wand->images == (Image *) NULL)
4118    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4119  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4120  return(status);
4121}
4122
4123/*
4124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4125%                                                                             %
4126%                                                                             %
4127%                                                                             %
4128%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4129%                                                                             %
4130%                                                                             %
4131%                                                                             %
4132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4133%
4134%  MagickGetImageStatistics() returns statistics for each channel in the
4135%  image.  The statistics include the channel depth, its minima and
4136%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4137%  You can access the red channel mean, for example, like this:
4138%
4139%      channel_statistics=MagickGetImageStatistics(wand);
4140%      red_mean=channel_statistics[RedPixelChannel].mean;
4141%
4142%  Use MagickRelinquishMemory() to free the statistics buffer.
4143%
4144%  The format of the MagickGetImageStatistics method is:
4145%
4146%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4147%
4148%  A description of each parameter follows:
4149%
4150%    o wand: the magick wand.
4151%
4152*/
4153WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4154{
4155  assert(wand != (MagickWand *) NULL);
4156  assert(wand->signature == WandSignature);
4157  if( IfMagickTrue(wand->debug) )
4158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4159
4160  if (wand->images == (Image *) NULL)
4161    {
4162      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4163        "ContainsNoImages","'%s'",wand->name);
4164      return((ChannelStatistics *) NULL);
4165    }
4166  return(GetImageStatistics(wand->images,wand->exception));
4167}
4168
4169/*
4170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4171%                                                                             %
4172%                                                                             %
4173%                                                                             %
4174%   M a g i c k G e t I m a g e C o l o r m a p C o l o r                     %
4175%                                                                             %
4176%                                                                             %
4177%                                                                             %
4178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4179%
4180%  MagickGetImageColormapColor() returns the color of the specified colormap
4181%  index.
4182%
4183%  The format of the MagickGetImageColormapColor method is:
4184%
4185%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4186%        const size_t index,PixelWand *color)
4187%
4188%  A description of each parameter follows:
4189%
4190%    o wand: the magick wand.
4191%
4192%    o index: the offset into the image colormap.
4193%
4194%    o color: Return the colormap color in this wand.
4195%
4196*/
4197WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4198  const size_t index,PixelWand *color)
4199{
4200  assert(wand != (MagickWand *) NULL);
4201  assert(wand->signature == WandSignature);
4202  if( IfMagickTrue(wand->debug) )
4203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4204
4205  if (wand->images == (Image *) NULL)
4206    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4207  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4208      (index >= wand->images->colors))
4209    {
4210      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4211        "InvalidColormapIndex","'%s'",wand->name);
4212      return(MagickFalse);
4213    }
4214  PixelSetPixelColor(color,wand->images->colormap+index);
4215  return(MagickTrue);
4216}
4217
4218/*
4219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4220%                                                                             %
4221%                                                                             %
4222%                                                                             %
4223%   M a g i c k G e t I m a g e C o l o r s                                   %
4224%                                                                             %
4225%                                                                             %
4226%                                                                             %
4227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4228%
4229%  MagickGetImageColors() gets the number of unique colors in the image.
4230%
4231%  The format of the MagickGetImageColors method is:
4232%
4233%      size_t MagickGetImageColors(MagickWand *wand)
4234%
4235%  A description of each parameter follows:
4236%
4237%    o wand: the magick wand.
4238%
4239*/
4240WandExport size_t MagickGetImageColors(MagickWand *wand)
4241{
4242  assert(wand != (MagickWand *) NULL);
4243  assert(wand->signature == WandSignature);
4244  if( IfMagickTrue(wand->debug) )
4245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246
4247  if (wand->images == (Image *) NULL)
4248    {
4249      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4250        "ContainsNoImages","'%s'",wand->name);
4251      return(0);
4252    }
4253  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4254}
4255
4256/*
4257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258%                                                                             %
4259%                                                                             %
4260%                                                                             %
4261%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4262%                                                                             %
4263%                                                                             %
4264%                                                                             %
4265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4266%
4267%  MagickGetImageColorspace() gets the image colorspace.
4268%
4269%  The format of the MagickGetImageColorspace method is:
4270%
4271%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4272%
4273%  A description of each parameter follows:
4274%
4275%    o wand: the magick wand.
4276%
4277*/
4278WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4279{
4280  assert(wand != (MagickWand *) NULL);
4281  assert(wand->signature == WandSignature);
4282  if( IfMagickTrue(wand->debug) )
4283    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284
4285  if (wand->images == (Image *) NULL)
4286    {
4287      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4288        "ContainsNoImages","'%s'",wand->name);
4289      return(UndefinedColorspace);
4290    }
4291  return(wand->images->colorspace);
4292}
4293
4294/*
4295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296%                                                                             %
4297%                                                                             %
4298%                                                                             %
4299%   M a g i c k G e t I m a g e C o m p o s e                                 %
4300%                                                                             %
4301%                                                                             %
4302%                                                                             %
4303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304%
4305%  MagickGetImageCompose() returns the composite operator associated with the
4306%  image.
4307%
4308%  The format of the MagickGetImageCompose method is:
4309%
4310%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4311%
4312%  A description of each parameter follows:
4313%
4314%    o wand: the magick wand.
4315%
4316*/
4317WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4318{
4319  assert(wand != (MagickWand *) NULL);
4320  assert(wand->signature == WandSignature);
4321  if( IfMagickTrue(wand->debug) )
4322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4323
4324  if (wand->images == (Image *) NULL)
4325    {
4326      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4327        "ContainsNoImages","'%s'",wand->name);
4328      return(UndefinedCompositeOp);
4329    }
4330  return(wand->images->compose);
4331}
4332
4333/*
4334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335%                                                                             %
4336%                                                                             %
4337%                                                                             %
4338%   M a g i c k G e t I m a g e C o m p r e s s i o n                         %
4339%                                                                             %
4340%                                                                             %
4341%                                                                             %
4342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4343%
4344%  MagickGetImageCompression() gets the image compression.
4345%
4346%  The format of the MagickGetImageCompression method is:
4347%
4348%      CompressionType MagickGetImageCompression(MagickWand *wand)
4349%
4350%  A description of each parameter follows:
4351%
4352%    o wand: the magick wand.
4353%
4354*/
4355WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4356{
4357  assert(wand != (MagickWand *) NULL);
4358  assert(wand->signature == WandSignature);
4359  if( IfMagickTrue(wand->debug) )
4360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4361
4362  if (wand->images == (Image *) NULL)
4363    {
4364      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4365        "ContainsNoImages","'%s'",wand->name);
4366      return(UndefinedCompression);
4367    }
4368  return(wand->images->compression);
4369}
4370
4371/*
4372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4373%                                                                             %
4374%                                                                             %
4375%                                                                             %
4376%   M a g i c k G e t I m a g e C o m p r e s s i o n Q u a l i t y           %
4377%                                                                             %
4378%                                                                             %
4379%                                                                             %
4380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381%
4382%  MagickGetImageCompressionQuality() gets the image compression quality.
4383%
4384%  The format of the MagickGetImageCompressionQuality method is:
4385%
4386%      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4387%
4388%  A description of each parameter follows:
4389%
4390%    o wand: the magick wand.
4391%
4392*/
4393WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4394{
4395  assert(wand != (MagickWand *) NULL);
4396  assert(wand->signature == WandSignature);
4397  if( IfMagickTrue(wand->debug) )
4398    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4399
4400  if (wand->images == (Image *) NULL)
4401    {
4402      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4403        "ContainsNoImages","'%s'",wand->name);
4404      return(0UL);
4405    }
4406  return(wand->images->quality);
4407}
4408
4409/*
4410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4411%                                                                             %
4412%                                                                             %
4413%                                                                             %
4414%   M a g i c k G e t I m a g e D e l a y                                     %
4415%                                                                             %
4416%                                                                             %
4417%                                                                             %
4418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4419%
4420%  MagickGetImageDelay() gets the image delay.
4421%
4422%  The format of the MagickGetImageDelay method is:
4423%
4424%      size_t MagickGetImageDelay(MagickWand *wand)
4425%
4426%  A description of each parameter follows:
4427%
4428%    o wand: the magick wand.
4429%
4430*/
4431WandExport size_t MagickGetImageDelay(MagickWand *wand)
4432{
4433  assert(wand != (MagickWand *) NULL);
4434  assert(wand->signature == WandSignature);
4435  if( IfMagickTrue(wand->debug) )
4436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4437
4438  if (wand->images == (Image *) NULL)
4439    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4440  return(wand->images->delay);
4441}
4442
4443/*
4444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4445%                                                                             %
4446%                                                                             %
4447%                                                                             %
4448%   M a g i c k G e t I m a g e D e p t h                                     %
4449%                                                                             %
4450%                                                                             %
4451%                                                                             %
4452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4453%
4454%  MagickGetImageDepth() gets the image depth.
4455%
4456%  The format of the MagickGetImageDepth method is:
4457%
4458%      size_t MagickGetImageDepth(MagickWand *wand)
4459%
4460%  A description of each parameter follows:
4461%
4462%    o wand: the magick wand.
4463%
4464*/
4465WandExport size_t MagickGetImageDepth(MagickWand *wand)
4466{
4467  assert(wand != (MagickWand *) NULL);
4468  assert(wand->signature == WandSignature);
4469  if( IfMagickTrue(wand->debug) )
4470    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4471
4472  if (wand->images == (Image *) NULL)
4473    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4474  return(wand->images->depth);
4475}
4476
4477/*
4478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4479%                                                                             %
4480%                                                                             %
4481%                                                                             %
4482%   M a g i c k G e t I m a g e D i s p o s e                                 %
4483%                                                                             %
4484%                                                                             %
4485%                                                                             %
4486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4487%
4488%  MagickGetImageDispose() gets the image disposal method.
4489%
4490%  The format of the MagickGetImageDispose method is:
4491%
4492%      DisposeType MagickGetImageDispose(MagickWand *wand)
4493%
4494%  A description of each parameter follows:
4495%
4496%    o wand: the magick wand.
4497%
4498*/
4499WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4500{
4501  assert(wand != (MagickWand *) NULL);
4502  assert(wand->signature == WandSignature);
4503  if( IfMagickTrue(wand->debug) )
4504    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4505
4506  if (wand->images == (Image *) NULL)
4507    {
4508      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4509        "ContainsNoImages","'%s'",wand->name);
4510      return(UndefinedDispose);
4511    }
4512  return((DisposeType) wand->images->dispose);
4513}
4514
4515/*
4516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4517%                                                                             %
4518%                                                                             %
4519%                                                                             %
4520%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4521%                                                                             %
4522%                                                                             %
4523%                                                                             %
4524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4525%
4526%  MagickGetImageDistortion() compares an image to a reconstructed image and
4527%  returns the specified distortion metric.
4528%
4529%  The format of the MagickGetImageDistortion method is:
4530%
4531%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4532%        const MagickWand *reference,const MetricType metric,
4533%        double *distortion)
4534%
4535%  A description of each parameter follows:
4536%
4537%    o wand: the magick wand.
4538%
4539%    o reference: the reference wand.
4540%
4541%    o metric: the metric.
4542%
4543%    o distortion: the computed distortion between the images.
4544%
4545*/
4546WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4547  const MagickWand *reference,const MetricType metric,double *distortion)
4548{
4549  MagickBooleanType
4550    status;
4551
4552  assert(wand != (MagickWand *) NULL);
4553  assert(wand->signature == WandSignature);
4554  if( IfMagickTrue(wand->debug) )
4555    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556
4557  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4558    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4559  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4560    wand->exception);
4561  return(status);
4562}
4563
4564/*
4565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4566%                                                                             %
4567%                                                                             %
4568%                                                                             %
4569%   M a g i c k G e t I m a g e D i s t o r t i o n s                         %
4570%                                                                             %
4571%                                                                             %
4572%                                                                             %
4573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4574%
4575%  MagickGetImageDistortions() compares one or more pixel channels of an
4576%  image to a reconstructed image and returns the specified distortion metrics.
4577%
4578%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4579%
4580%  The format of the MagickGetImageDistortion method is:
4581%
4582%      double *MagickGetImageDistortion(MagickWand *wand,
4583%        const MagickWand *reference,const MetricType metric)
4584%
4585%  A description of each parameter follows:
4586%
4587%    o wand: the magick wand.
4588%
4589%    o reference: the reference wand.
4590%
4591%    o metric: the metric.
4592%
4593*/
4594WandExport double *MagickGetImageDistortions(MagickWand *wand,
4595  const MagickWand *reference,const MetricType metric)
4596{
4597  double
4598    *channel_distortion;
4599
4600  assert(wand != (MagickWand *) NULL);
4601  assert(wand->signature == WandSignature);
4602  if( IfMagickTrue(wand->debug) )
4603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4604
4605  assert(reference != (MagickWand *) NULL);
4606  assert(reference->signature == WandSignature);
4607  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4608    {
4609      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4610        "ContainsNoImages","'%s'",wand->name);
4611      return((double *) NULL);
4612    }
4613  channel_distortion=GetImageDistortions(wand->images,reference->images,
4614    metric,wand->exception);
4615  return(channel_distortion);
4616}
4617
4618/*
4619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4620%                                                                             %
4621%                                                                             %
4622%                                                                             %
4623%   M a g i c k G e t I m a g e F i l e n a m e                               %
4624%                                                                             %
4625%                                                                             %
4626%                                                                             %
4627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4628%
4629%  MagickGetImageFilename() returns the filename of a particular image in a
4630%  sequence.
4631%
4632%  The format of the MagickGetImageFilename method is:
4633%
4634%      char *MagickGetImageFilename(MagickWand *wand)
4635%
4636%  A description of each parameter follows:
4637%
4638%    o wand: the magick wand.
4639%
4640*/
4641WandExport char *MagickGetImageFilename(MagickWand *wand)
4642{
4643  assert(wand != (MagickWand *) NULL);
4644  assert(wand->signature == WandSignature);
4645  if( IfMagickTrue(wand->debug) )
4646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4647
4648  if (wand->images == (Image *) NULL)
4649    {
4650      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4651        "ContainsNoImages","'%s'",wand->name);
4652      return((char *) NULL);
4653    }
4654  return(AcquireString(wand->images->filename));
4655}
4656
4657/*
4658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4659%                                                                             %
4660%                                                                             %
4661%                                                                             %
4662%   M a g i c k G e t I m a g e F o r m a t                                   %
4663%                                                                             %
4664%                                                                             %
4665%                                                                             %
4666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4667%
4668%  MagickGetImageFormat() returns the format of a particular image in a
4669%  sequence.
4670%
4671%  The format of the MagickGetImageFormat method is:
4672%
4673%      const char *MagickGetImageFormat(MagickWand *wand)
4674%
4675%  A description of each parameter follows:
4676%
4677%    o wand: the magick wand.
4678%
4679*/
4680WandExport char *MagickGetImageFormat(MagickWand *wand)
4681{
4682  assert(wand != (MagickWand *) NULL);
4683  assert(wand->signature == WandSignature);
4684  if( IfMagickTrue(wand->debug) )
4685    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4686
4687  if (wand->images == (Image *) NULL)
4688    {
4689      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4690        "ContainsNoImages","'%s'",wand->name);
4691      return((char *) NULL);
4692    }
4693  return(AcquireString(wand->images->magick));
4694}
4695
4696/*
4697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4698%                                                                             %
4699%                                                                             %
4700%                                                                             %
4701%   M a g i c k G e t I m a g e F u z z                                       %
4702%                                                                             %
4703%                                                                             %
4704%                                                                             %
4705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4706%
4707%  MagickGetImageFuzz() gets the image fuzz.
4708%
4709%  The format of the MagickGetImageFuzz method is:
4710%
4711%      double MagickGetImageFuzz(MagickWand *wand)
4712%
4713%  A description of each parameter follows:
4714%
4715%    o wand: the magick wand.
4716%
4717*/
4718WandExport double MagickGetImageFuzz(MagickWand *wand)
4719{
4720  assert(wand != (MagickWand *) NULL);
4721  assert(wand->signature == WandSignature);
4722  if( IfMagickTrue(wand->debug) )
4723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4724
4725  if (wand->images == (Image *) NULL)
4726    {
4727      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4728        "ContainsNoImages","'%s'",wand->name);
4729      return(0.0);
4730    }
4731  return(wand->images->fuzz);
4732}
4733
4734/*
4735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4736%                                                                             %
4737%                                                                             %
4738%                                                                             %
4739%   M a g i c k G e t I m a g e G a m m a                                     %
4740%                                                                             %
4741%                                                                             %
4742%                                                                             %
4743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4744%
4745%  MagickGetImageGamma() gets the image gamma.
4746%
4747%  The format of the MagickGetImageGamma method is:
4748%
4749%      double MagickGetImageGamma(MagickWand *wand)
4750%
4751%  A description of each parameter follows:
4752%
4753%    o wand: the magick wand.
4754%
4755*/
4756WandExport double MagickGetImageGamma(MagickWand *wand)
4757{
4758  assert(wand != (MagickWand *) NULL);
4759  assert(wand->signature == WandSignature);
4760  if( IfMagickTrue(wand->debug) )
4761    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4762
4763  if (wand->images == (Image *) NULL)
4764    {
4765      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4766        "ContainsNoImages","'%s'",wand->name);
4767      return(0.0);
4768    }
4769  return(wand->images->gamma);
4770}
4771
4772/*
4773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4774%                                                                             %
4775%                                                                             %
4776%                                                                             %
4777%   M a g i c k G e t I m a g e I n t e r l a c e S c h e m e                 %
4778%                                                                             %
4779%                                                                             %
4780%                                                                             %
4781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4782%
4783%  MagickGetImageGravity() gets the image gravity.
4784%
4785%  The format of the MagickGetImageGravity method is:
4786%
4787%      GravityType MagickGetImageGravity(MagickWand *wand)
4788%
4789%  A description of each parameter follows:
4790%
4791%    o wand: the magick wand.
4792%
4793*/
4794WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4795{
4796  assert(wand != (MagickWand *) NULL);
4797  assert(wand->signature == WandSignature);
4798  if( IfMagickTrue(wand->debug) )
4799    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4800
4801  if (wand->images == (Image *) NULL)
4802    {
4803      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4804        "ContainsNoImages","'%s'",wand->name);
4805      return(UndefinedGravity);
4806    }
4807  return(wand->images->gravity);
4808}
4809
4810/*
4811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4812%                                                                             %
4813%                                                                             %
4814%                                                                             %
4815%   M a g i c k G e t I m a g e G r e e n P r i m a r y                       %
4816%                                                                             %
4817%                                                                             %
4818%                                                                             %
4819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820%
4821%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4822%
4823%  The format of the MagickGetImageGreenPrimary method is:
4824%
4825%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4826%        double *y)
4827%
4828%  A description of each parameter follows:
4829%
4830%    o wand: the magick wand.
4831%
4832%    o x: the chromaticity green primary x-point.
4833%
4834%    o y: the chromaticity green primary y-point.
4835%
4836*/
4837WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4838  double *x,double *y)
4839{
4840  assert(wand != (MagickWand *) NULL);
4841  assert(wand->signature == WandSignature);
4842  if( IfMagickTrue(wand->debug) )
4843    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4844
4845  if (wand->images == (Image *) NULL)
4846    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4847  *x=wand->images->chromaticity.green_primary.x;
4848  *y=wand->images->chromaticity.green_primary.y;
4849  return(MagickTrue);
4850}
4851
4852/*
4853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854%                                                                             %
4855%                                                                             %
4856%                                                                             %
4857%   M a g i c k G e t I m a g e H e i g h t                                   %
4858%                                                                             %
4859%                                                                             %
4860%                                                                             %
4861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862%
4863%  MagickGetImageHeight() returns the image height.
4864%
4865%  The format of the MagickGetImageHeight method is:
4866%
4867%      size_t MagickGetImageHeight(MagickWand *wand)
4868%
4869%  A description of each parameter follows:
4870%
4871%    o wand: the magick wand.
4872%
4873*/
4874WandExport size_t MagickGetImageHeight(MagickWand *wand)
4875{
4876  assert(wand != (MagickWand *) NULL);
4877  assert(wand->signature == WandSignature);
4878  if( IfMagickTrue(wand->debug) )
4879    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4880
4881  if (wand->images == (Image *) NULL)
4882    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4883  return(wand->images->rows);
4884}
4885
4886/*
4887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4888%                                                                             %
4889%                                                                             %
4890%                                                                             %
4891%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4892%                                                                             %
4893%                                                                             %
4894%                                                                             %
4895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896%
4897%  MagickGetImageHistogram() returns the image histogram as an array of
4898%  PixelWand wands.
4899%
4900%  The format of the MagickGetImageHistogram method is:
4901%
4902%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4903%        size_t *number_colors)
4904%
4905%  A description of each parameter follows:
4906%
4907%    o wand: the magick wand.
4908%
4909%    o number_colors: the number of unique colors in the image and the number
4910%      of pixel wands returned.
4911%
4912*/
4913WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4914  size_t *number_colors)
4915{
4916  PixelInfo
4917    *histogram;
4918
4919  PixelWand
4920    **pixel_wands;
4921
4922  register ssize_t
4923    i;
4924
4925  assert(wand != (MagickWand *) NULL);
4926  assert(wand->signature == WandSignature);
4927  if( IfMagickTrue(wand->debug) )
4928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4929
4930  if (wand->images == (Image *) NULL)
4931    {
4932      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4933        "ContainsNoImages","'%s'",wand->name);
4934      return((PixelWand **) NULL);
4935    }
4936  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4937  if (histogram == (PixelInfo *) NULL)
4938    return((PixelWand **) NULL);
4939  pixel_wands=NewPixelWands(*number_colors);
4940  for (i=0; i < (ssize_t) *number_colors; i++)
4941  {
4942    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4943    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4944  }
4945  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4946  return(pixel_wands);
4947}
4948
4949/*
4950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951%                                                                             %
4952%                                                                             %
4953%                                                                             %
4954%   M a g i c k G e t I m a g e I n t e r l a c e S c h e m e                 %
4955%                                                                             %
4956%                                                                             %
4957%                                                                             %
4958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4959%
4960%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4961%
4962%  The format of the MagickGetImageInterlaceScheme method is:
4963%
4964%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4965%
4966%  A description of each parameter follows:
4967%
4968%    o wand: the magick wand.
4969%
4970*/
4971WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4972{
4973  assert(wand != (MagickWand *) NULL);
4974  assert(wand->signature == WandSignature);
4975  if( IfMagickTrue(wand->debug) )
4976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4977
4978  if (wand->images == (Image *) NULL)
4979    {
4980      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4981        "ContainsNoImages","'%s'",wand->name);
4982      return(UndefinedInterlace);
4983    }
4984  return(wand->images->interlace);
4985}
4986
4987/*
4988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4989%                                                                             %
4990%                                                                             %
4991%                                                                             %
4992%   M a g i c k G e t I m a g e I n t e r p o l a t e M e t h o d             %
4993%                                                                             %
4994%                                                                             %
4995%                                                                             %
4996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4997%
4998%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4999%  sepcified image.
5000%
5001%  The format of the MagickGetImageInterpolateMethod method is:
5002%
5003%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5004%        MagickWand *wand)
5005%
5006%  A description of each parameter follows:
5007%
5008%    o wand: the magick wand.
5009%
5010*/
5011WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5012  MagickWand *wand)
5013{
5014  assert(wand != (MagickWand *) NULL);
5015  assert(wand->signature == WandSignature);
5016  if( IfMagickTrue(wand->debug) )
5017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5018
5019  if (wand->images == (Image *) NULL)
5020    {
5021      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5022        "ContainsNoImages","'%s'",wand->name);
5023      return(UndefinedInterpolatePixel);
5024    }
5025  return(wand->images->interpolate);
5026}
5027
5028/*
5029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5030%                                                                             %
5031%                                                                             %
5032%                                                                             %
5033%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5034%                                                                             %
5035%                                                                             %
5036%                                                                             %
5037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5038%
5039%  MagickGetImageIterations() gets the image iterations.
5040%
5041%  The format of the MagickGetImageIterations method is:
5042%
5043%      size_t MagickGetImageIterations(MagickWand *wand)
5044%
5045%  A description of each parameter follows:
5046%
5047%    o wand: the magick wand.
5048%
5049*/
5050WandExport size_t MagickGetImageIterations(MagickWand *wand)
5051{
5052  assert(wand != (MagickWand *) NULL);
5053  assert(wand->signature == WandSignature);
5054  if( IfMagickTrue(wand->debug) )
5055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5056
5057  if (wand->images == (Image *) NULL)
5058    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5059  return(wand->images->iterations);
5060}
5061
5062/*
5063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5064%                                                                             %
5065%                                                                             %
5066%                                                                             %
5067%   M a g i c k G e t I m a g e L e n g t h                                   %
5068%                                                                             %
5069%                                                                             %
5070%                                                                             %
5071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5072%
5073%  MagickGetImageLength() returns the image length in bytes.
5074%
5075%  The format of the MagickGetImageLength method is:
5076%
5077%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5078%        MagickSizeType *length)
5079%
5080%  A description of each parameter follows:
5081%
5082%    o wand: the magick wand.
5083%
5084%    o length: the image length in bytes.
5085%
5086*/
5087WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5088  MagickSizeType *length)
5089{
5090  assert(wand != (MagickWand *) NULL);
5091  assert(wand->signature == WandSignature);
5092  if( IfMagickTrue(wand->debug) )
5093    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5094
5095  if (wand->images == (Image *) NULL)
5096    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5097  *length=GetBlobSize(wand->images);
5098  return(MagickTrue);
5099}
5100
5101/*
5102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5103%                                                                             %
5104%                                                                             %
5105%                                                                             %
5106%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5107%                                                                             %
5108%                                                                             %
5109%                                                                             %
5110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5111%
5112%  MagickGetImageMatteColor() returns the image matte color.
5113%
5114%  The format of the MagickGetImageMatteColor method is:
5115%
5116%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5117%        PixelWand *matte_color)
5118%
5119%  A description of each parameter follows:
5120%
5121%    o wand: the magick wand.
5122%
5123%    o matte_color: Return the matte color.
5124%
5125*/
5126WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5127  PixelWand *matte_color)
5128{
5129  assert(wand != (MagickWand *) NULL);
5130  assert(wand->signature == WandSignature);
5131  if( IfMagickTrue(wand->debug) )
5132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5133
5134  if (wand->images == (Image *) NULL)
5135    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5136  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5137  return(MagickTrue);
5138}
5139
5140/*
5141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5142%                                                                             %
5143%                                                                             %
5144%                                                                             %
5145%   M a g i c k G e t I m a g e O r i e n t a t i o n                         %
5146%                                                                             %
5147%                                                                             %
5148%                                                                             %
5149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5150%
5151%  MagickGetImageOrientation() returns the image orientation.
5152%
5153%  The format of the MagickGetImageOrientation method is:
5154%
5155%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5156%
5157%  A description of each parameter follows:
5158%
5159%    o wand: the magick wand.
5160%
5161*/
5162WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5163{
5164  assert(wand != (MagickWand *) NULL);
5165  assert(wand->signature == WandSignature);
5166  if( IfMagickTrue(wand->debug) )
5167    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5168
5169  if (wand->images == (Image *) NULL)
5170    {
5171      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5172        "ContainsNoImages","'%s'",wand->name);
5173      return(UndefinedOrientation);
5174    }
5175  return(wand->images->orientation);
5176}
5177
5178/*
5179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5180%                                                                             %
5181%                                                                             %
5182%                                                                             %
5183%   M a g i c k G e t I m a g e P a g e                                       %
5184%                                                                             %
5185%                                                                             %
5186%                                                                             %
5187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5188%
5189%  MagickGetImagePage() returns the page geometry associated with the image.
5190%
5191%  The format of the MagickGetImagePage method is:
5192%
5193%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5194%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5195%
5196%  A description of each parameter follows:
5197%
5198%    o wand: the magick wand.
5199%
5200%    o width: the page width.
5201%
5202%    o height: the page height.
5203%
5204%    o x: the page x-offset.
5205%
5206%    o y: the page y-offset.
5207%
5208*/
5209WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5210  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5211{
5212  assert(wand != (const MagickWand *) NULL);
5213  assert(wand->signature == WandSignature);
5214  if( IfMagickTrue(wand->debug) )
5215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5216
5217  if (wand->images == (Image *) NULL)
5218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5219  *width=wand->images->page.width;
5220  *height=wand->images->page.height;
5221  *x=wand->images->page.x;
5222  *y=wand->images->page.y;
5223  return(MagickTrue);
5224}
5225
5226/*
5227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5228%                                                                             %
5229%                                                                             %
5230%                                                                             %
5231%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5232%                                                                             %
5233%                                                                             %
5234%                                                                             %
5235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236%
5237%  MagickGetImagePixelColor() returns the color of the specified pixel.
5238%
5239%  The format of the MagickGetImagePixelColor method is:
5240%
5241%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5242%        const ssize_t x,const ssize_t y,PixelWand *color)
5243%
5244%  A description of each parameter follows:
5245%
5246%    o wand: the magick wand.
5247%
5248%    o x,y: the pixel offset into the image.
5249%
5250%    o color: Return the colormap color in this wand.
5251%
5252*/
5253WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5254  const ssize_t x,const ssize_t y,PixelWand *color)
5255{
5256  register const Quantum
5257    *p;
5258
5259  CacheView
5260    *image_view;
5261
5262  assert(wand != (MagickWand *) NULL);
5263  assert(wand->signature == WandSignature);
5264  if( IfMagickTrue(wand->debug) )
5265    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5266
5267  if (wand->images == (Image *) NULL)
5268    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5269  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5270  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5271  if (p == (const Quantum *) NULL)
5272    {
5273      image_view=DestroyCacheView(image_view);
5274      return(MagickFalse);
5275    }
5276  PixelSetQuantumPixel(wand->images,p,color);
5277  image_view=DestroyCacheView(image_view);
5278  return(MagickTrue);
5279}
5280
5281/*
5282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283%                                                                             %
5284%                                                                             %
5285%                                                                             %
5286%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5287%                                                                             %
5288%                                                                             %
5289%                                                                             %
5290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5291%
5292%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5293%
5294%  The format of the MagickGetImageRedPrimary method is:
5295%
5296%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5297%        double *y)
5298%
5299%  A description of each parameter follows:
5300%
5301%    o wand: the magick wand.
5302%
5303%    o x: the chromaticity red primary x-point.
5304%
5305%    o y: the chromaticity red primary y-point.
5306%
5307*/
5308WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5309  double *x,double *y)
5310{
5311  assert(wand != (MagickWand *) NULL);
5312  assert(wand->signature == WandSignature);
5313  if( IfMagickTrue(wand->debug) )
5314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5315
5316  if (wand->images == (Image *) NULL)
5317    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5318  *x=wand->images->chromaticity.red_primary.x;
5319  *y=wand->images->chromaticity.red_primary.y;
5320  return(MagickTrue);
5321}
5322
5323/*
5324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5325%                                                                             %
5326%                                                                             %
5327%                                                                             %
5328%   M a g i c k G e t I m a g e R e g i o n                                   %
5329%                                                                             %
5330%                                                                             %
5331%                                                                             %
5332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5333%
5334%  MagickGetImageRegion() extracts a region of the image and returns it as a
5335%  a new wand.
5336%
5337%  The format of the MagickGetImageRegion method is:
5338%
5339%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5340%        const size_t width,const size_t height,const ssize_t x,
5341%        const ssize_t y)
5342%
5343%  A description of each parameter follows:
5344%
5345%    o wand: the magick wand.
5346%
5347%    o width: the region width.
5348%
5349%    o height: the region height.
5350%
5351%    o x: the region x offset.
5352%
5353%    o y: the region y offset.
5354%
5355*/
5356WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5357  const size_t width,const size_t height,const ssize_t x,
5358  const ssize_t y)
5359{
5360  Image
5361    *region_image;
5362
5363  RectangleInfo
5364    region;
5365
5366  assert(wand != (MagickWand *) NULL);
5367  assert(wand->signature == WandSignature);
5368  if( IfMagickTrue(wand->debug) )
5369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5370
5371  if (wand->images == (Image *) NULL)
5372    return((MagickWand *) NULL);
5373  region.width=width;
5374  region.height=height;
5375  region.x=x;
5376  region.y=y;
5377  region_image=CropImage(wand->images,&region,wand->exception);
5378  if (region_image == (Image *) NULL)
5379    return((MagickWand *) NULL);
5380  return(CloneMagickWandFromImages(wand,region_image));
5381}
5382
5383/*
5384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5385%                                                                             %
5386%                                                                             %
5387%                                                                             %
5388%   M a g i c k G e t I m a g e R e n d e r i n g I n t e n t                 %
5389%                                                                             %
5390%                                                                             %
5391%                                                                             %
5392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5393%
5394%  MagickGetImageRenderingIntent() gets the image rendering intent.
5395%
5396%  The format of the MagickGetImageRenderingIntent method is:
5397%
5398%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5399%
5400%  A description of each parameter follows:
5401%
5402%    o wand: the magick wand.
5403%
5404*/
5405WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5406{
5407  assert(wand != (MagickWand *) NULL);
5408  assert(wand->signature == WandSignature);
5409  if( IfMagickTrue(wand->debug) )
5410    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5411
5412  if (wand->images == (Image *) NULL)
5413    {
5414      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5415        "ContainsNoImages","'%s'",wand->name);
5416      return(UndefinedIntent);
5417    }
5418  return((RenderingIntent) wand->images->rendering_intent);
5419}
5420
5421/*
5422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5423%                                                                             %
5424%                                                                             %
5425%                                                                             %
5426%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5427%                                                                             %
5428%                                                                             %
5429%                                                                             %
5430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5431%
5432%  MagickGetImageResolution() gets the image X and Y resolution.
5433%
5434%  The format of the MagickGetImageResolution method is:
5435%
5436%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5437%        double *y)
5438%
5439%  A description of each parameter follows:
5440%
5441%    o wand: the magick wand.
5442%
5443%    o x: the image x-resolution.
5444%
5445%    o y: the image y-resolution.
5446%
5447*/
5448WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5449  double *x,double *y)
5450{
5451  assert(wand != (MagickWand *) NULL);
5452  assert(wand->signature == WandSignature);
5453  if( IfMagickTrue(wand->debug) )
5454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5455
5456  if (wand->images == (Image *) NULL)
5457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5458  *x=wand->images->resolution.x;
5459  *y=wand->images->resolution.y;
5460  return(MagickTrue);
5461}
5462
5463/*
5464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5465%                                                                             %
5466%                                                                             %
5467%                                                                             %
5468%   M a g i c k G e t I m a g e S c e n e                                     %
5469%                                                                             %
5470%                                                                             %
5471%                                                                             %
5472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5473%
5474%  MagickGetImageScene() gets the image scene.
5475%
5476%  The format of the MagickGetImageScene method is:
5477%
5478%      size_t MagickGetImageScene(MagickWand *wand)
5479%
5480%  A description of each parameter follows:
5481%
5482%    o wand: the magick wand.
5483%
5484*/
5485WandExport size_t MagickGetImageScene(MagickWand *wand)
5486{
5487  assert(wand != (MagickWand *) NULL);
5488  assert(wand->signature == WandSignature);
5489  if( IfMagickTrue(wand->debug) )
5490    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5491
5492  if (wand->images == (Image *) NULL)
5493    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5494  return(wand->images->scene);
5495}
5496
5497/*
5498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5499%                                                                             %
5500%                                                                             %
5501%                                                                             %
5502%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5503%                                                                             %
5504%                                                                             %
5505%                                                                             %
5506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5507%
5508%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5509%  pixel stream.
5510%
5511%  The format of the MagickGetImageSignature method is:
5512%
5513%      char MagickGetImageSignature(MagickWand *wand)
5514%
5515%  A description of each parameter follows:
5516%
5517%    o wand: the magick wand.
5518%
5519*/
5520WandExport char *MagickGetImageSignature(MagickWand *wand)
5521{
5522  const char
5523    *value;
5524
5525  MagickBooleanType
5526    status;
5527
5528  assert(wand != (MagickWand *) NULL);
5529  assert(wand->signature == WandSignature);
5530  if( IfMagickTrue(wand->debug) )
5531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5532
5533  if (wand->images == (Image *) NULL)
5534    {
5535      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5536        "ContainsNoImages","'%s'",wand->name);
5537      return((char *) NULL);
5538    }
5539  status=SignatureImage(wand->images,wand->exception);
5540  if( IfMagickFalse(status) )
5541    return((char *) NULL);
5542  value=GetImageProperty(wand->images,"signature",wand->exception);
5543  if (value == (const char *) NULL)
5544    return((char *) NULL);
5545  return(AcquireString(value));
5546}
5547
5548/*
5549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5550%                                                                             %
5551%                                                                             %
5552%                                                                             %
5553%   M a g i c k G e t I m a g e T i c k s P e r S e c o n d                   %
5554%                                                                             %
5555%                                                                             %
5556%                                                                             %
5557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5558%
5559%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5560%
5561%  The format of the MagickGetImageTicksPerSecond method is:
5562%
5563%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5564%
5565%  A description of each parameter follows:
5566%
5567%    o wand: the magick wand.
5568%
5569*/
5570WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5571{
5572  assert(wand != (MagickWand *) NULL);
5573  assert(wand->signature == WandSignature);
5574  if( IfMagickTrue(wand->debug) )
5575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5576
5577  if (wand->images == (Image *) NULL)
5578    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5579  return((size_t) wand->images->ticks_per_second);
5580}
5581
5582/*
5583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584%                                                                             %
5585%                                                                             %
5586%                                                                             %
5587%   M a g i c k G e t I m a g e T y p e                                       %
5588%                                                                             %
5589%                                                                             %
5590%                                                                             %
5591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592%
5593%  MagickGetImageType() gets the potential image type:
5594%
5595%        Bilevel        Grayscale       GrayscaleMatte
5596%        Palette        PaletteMatte    TrueColor
5597%        TrueColorMatte ColorSeparation ColorSeparationMatte
5598%
5599%  To ensure the image type matches its potential, use MagickSetImageType():
5600%
5601%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5602%
5603%  The format of the MagickGetImageType method is:
5604%
5605%      ImageType MagickGetImageType(MagickWand *wand)
5606%
5607%  A description of each parameter follows:
5608%
5609%    o wand: the magick wand.
5610%
5611*/
5612WandExport ImageType MagickGetImageType(MagickWand *wand)
5613{
5614  assert(wand != (MagickWand *) NULL);
5615  assert(wand->signature == WandSignature);
5616  if( IfMagickTrue(wand->debug) )
5617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5618
5619  if (wand->images == (Image *) NULL)
5620    {
5621      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5622        "ContainsNoImages","'%s'",wand->name);
5623      return(UndefinedType);
5624    }
5625  return(GetImageType(wand->images,wand->exception));
5626}
5627
5628/*
5629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5630%                                                                             %
5631%                                                                             %
5632%                                                                             %
5633%   M a g i c k G e t I m a g e U n i t s                                     %
5634%                                                                             %
5635%                                                                             %
5636%                                                                             %
5637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638%
5639%  MagickGetImageUnits() gets the image units of resolution.
5640%
5641%  The format of the MagickGetImageUnits method is:
5642%
5643%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5644%
5645%  A description of each parameter follows:
5646%
5647%    o wand: the magick wand.
5648%
5649*/
5650WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5651{
5652  assert(wand != (MagickWand *) NULL);
5653  assert(wand->signature == WandSignature);
5654  if( IfMagickTrue(wand->debug) )
5655    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5656
5657  if (wand->images == (Image *) NULL)
5658    {
5659      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5660        "ContainsNoImages","'%s'",wand->name);
5661      return(UndefinedResolution);
5662    }
5663  return(wand->images->units);
5664}
5665
5666/*
5667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5668%                                                                             %
5669%                                                                             %
5670%                                                                             %
5671%   M a g i c k G e t I m a g e V i r t u a l P i x e l M e t h o d           %
5672%                                                                             %
5673%                                                                             %
5674%                                                                             %
5675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5676%
5677%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5678%  sepcified image.
5679%
5680%  The format of the MagickGetImageVirtualPixelMethod method is:
5681%
5682%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5683%
5684%  A description of each parameter follows:
5685%
5686%    o wand: the magick wand.
5687%
5688*/
5689WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5690{
5691  assert(wand != (MagickWand *) NULL);
5692  assert(wand->signature == WandSignature);
5693  if( IfMagickTrue(wand->debug) )
5694    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5695
5696  if (wand->images == (Image *) NULL)
5697    {
5698      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5699        "ContainsNoImages","'%s'",wand->name);
5700      return(UndefinedVirtualPixelMethod);
5701    }
5702  return(GetImageVirtualPixelMethod(wand->images));
5703}
5704
5705/*
5706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5707%                                                                             %
5708%                                                                             %
5709%                                                                             %
5710%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5711%                                                                             %
5712%                                                                             %
5713%                                                                             %
5714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5715%
5716%  MagickGetImageWhitePoint() returns the chromaticy white point.
5717%
5718%  The format of the MagickGetImageWhitePoint method is:
5719%
5720%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5721%        double *y)
5722%
5723%  A description of each parameter follows:
5724%
5725%    o wand: the magick wand.
5726%
5727%    o x: the chromaticity white x-point.
5728%
5729%    o y: the chromaticity white y-point.
5730%
5731*/
5732WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5733  double *x,double *y)
5734{
5735  assert(wand != (MagickWand *) NULL);
5736  assert(wand->signature == WandSignature);
5737  if( IfMagickTrue(wand->debug) )
5738    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5739
5740  if (wand->images == (Image *) NULL)
5741    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5742  *x=wand->images->chromaticity.white_point.x;
5743  *y=wand->images->chromaticity.white_point.y;
5744  return(MagickTrue);
5745}
5746
5747/*
5748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5749%                                                                             %
5750%                                                                             %
5751%                                                                             %
5752%   M a g i c k G e t I m a g e W i d t h                                     %
5753%                                                                             %
5754%                                                                             %
5755%                                                                             %
5756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5757%
5758%  MagickGetImageWidth() returns the image width.
5759%
5760%  The format of the MagickGetImageWidth method is:
5761%
5762%      size_t MagickGetImageWidth(MagickWand *wand)
5763%
5764%  A description of each parameter follows:
5765%
5766%    o wand: the magick wand.
5767%
5768*/
5769WandExport size_t MagickGetImageWidth(MagickWand *wand)
5770{
5771  assert(wand != (MagickWand *) NULL);
5772  assert(wand->signature == WandSignature);
5773  if( IfMagickTrue(wand->debug) )
5774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5775
5776  if (wand->images == (Image *) NULL)
5777    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5778  return(wand->images->columns);
5779}
5780
5781/*
5782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5783%                                                                             %
5784%                                                                             %
5785%                                                                             %
5786%   M a g i c k G e t N u m b e r I m a g e s                                 %
5787%                                                                             %
5788%                                                                             %
5789%                                                                             %
5790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5791%
5792%  MagickGetNumberImages() returns the number of images associated with a
5793%  magick wand.
5794%
5795%  The format of the MagickGetNumberImages method is:
5796%
5797%      size_t MagickGetNumberImages(MagickWand *wand)
5798%
5799%  A description of each parameter follows:
5800%
5801%    o wand: the magick wand.
5802%
5803*/
5804WandExport size_t MagickGetNumberImages(MagickWand *wand)
5805{
5806  assert(wand != (MagickWand *) NULL);
5807  assert(wand->signature == WandSignature);
5808  if( IfMagickTrue(wand->debug) )
5809    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5810
5811  return(GetImageListLength(wand->images));
5812}
5813
5814/*
5815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5816%                                                                             %
5817%                                                                             %
5818%                                                                             %
5819%   M a g i c k I m a g e G e t T o t a l I n k D e n s i t y                 %
5820%                                                                             %
5821%                                                                             %
5822%                                                                             %
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824%
5825%  MagickGetImageTotalInkDensity() gets the image total ink density.
5826%
5827%  The format of the MagickGetImageTotalInkDensity method is:
5828%
5829%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5830%
5831%  A description of each parameter follows:
5832%
5833%    o wand: the magick wand.
5834%
5835*/
5836WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5837{
5838  assert(wand != (MagickWand *) NULL);
5839  assert(wand->signature == WandSignature);
5840  if( IfMagickTrue(wand->debug) )
5841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5842
5843  if (wand->images == (Image *) NULL)
5844    {
5845      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5846        "ContainsNoImages","'%s'",wand->name);
5847      return(0.0);
5848    }
5849  return(GetImageTotalInkDensity(wand->images,wand->exception));
5850}
5851
5852/*
5853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854%                                                                             %
5855%                                                                             %
5856%                                                                             %
5857%   M a g i c k H a l d C l u t I m a g e                                     %
5858%                                                                             %
5859%                                                                             %
5860%                                                                             %
5861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5862%
5863%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5864%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5865%  dimensions.  Create it with the HALD coder.  You can apply any color
5866%  transformation to the Hald image and then use this method to apply the
5867%  transform to the image.
5868%
5869%  The format of the MagickHaldClutImage method is:
5870%
5871%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5872%        const MagickWand *hald_wand)
5873%
5874%  A description of each parameter follows:
5875%
5876%    o wand: the magick wand.
5877%
5878%    o hald_image: the hald CLUT image.
5879%
5880*/
5881WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5882  const MagickWand *hald_wand)
5883{
5884  MagickBooleanType
5885    status;
5886
5887  assert(wand != (MagickWand *) NULL);
5888  assert(wand->signature == WandSignature);
5889  if( IfMagickTrue(wand->debug) )
5890    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5891
5892  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5893    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5894  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5895  return(status);
5896}
5897
5898/*
5899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5900%                                                                             %
5901%                                                                             %
5902%                                                                             %
5903%   M a g i c k H a s N e x t I m a g e                                       %
5904%                                                                             %
5905%                                                                             %
5906%                                                                             %
5907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5908%
5909%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5910%  traversing the list in the forward direction
5911%
5912%  The format of the MagickHasNextImage method is:
5913%
5914%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5915%
5916%  A description of each parameter follows:
5917%
5918%    o wand: the magick wand.
5919%
5920*/
5921WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5922{
5923  assert(wand != (MagickWand *) NULL);
5924  assert(wand->signature == WandSignature);
5925  if( IfMagickTrue(wand->debug) )
5926    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5927
5928  if (wand->images == (Image *) NULL)
5929    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5930  if (GetNextImageInList(wand->images) == (Image *) NULL)
5931    return(MagickFalse);
5932  return(MagickTrue);
5933}
5934
5935/*
5936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5937%                                                                             %
5938%                                                                             %
5939%                                                                             %
5940%   M a g i c k H a s P r e v i o u s I m a g e                               %
5941%                                                                             %
5942%                                                                             %
5943%                                                                             %
5944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5945%
5946%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5947%  traversing the list in the reverse direction
5948%
5949%  The format of the MagickHasPreviousImage method is:
5950%
5951%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5952%
5953%  A description of each parameter follows:
5954%
5955%    o wand: the magick wand.
5956%
5957*/
5958WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5959{
5960  assert(wand != (MagickWand *) NULL);
5961  assert(wand->signature == WandSignature);
5962  if( IfMagickTrue(wand->debug) )
5963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5964
5965  if (wand->images == (Image *) NULL)
5966    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5967  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5968    return(MagickFalse);
5969  return(MagickTrue);
5970}
5971
5972/*
5973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5974%                                                                             %
5975%                                                                             %
5976%                                                                             %
5977%   M a g i c k I d e n t i f y I m a g e                                     %
5978%                                                                             %
5979%                                                                             %
5980%                                                                             %
5981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982%
5983%  MagickIdentifyImage() identifies an image by printing its attributes to the
5984%  file.  Attributes include the image width, height, size, and others.
5985%
5986%  The format of the MagickIdentifyImage method is:
5987%
5988%      const char *MagickIdentifyImage(MagickWand *wand)
5989%
5990%  A description of each parameter follows:
5991%
5992%    o wand: the magick wand.
5993%
5994*/
5995WandExport char *MagickIdentifyImage(MagickWand *wand)
5996{
5997  char
5998    *description,
5999    filename[MaxTextExtent];
6000
6001  FILE
6002    *file;
6003
6004  int
6005    unique_file;
6006
6007  assert(wand != (MagickWand *) NULL);
6008  assert(wand->signature == WandSignature);
6009  if( IfMagickTrue(wand->debug) )
6010    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6011
6012  if (wand->images == (Image *) NULL)
6013    {
6014      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6015        "ContainsNoImages","'%s'",wand->name);
6016      return((char *) NULL);
6017    }
6018  description=(char *) NULL;
6019  unique_file=AcquireUniqueFileResource(filename);
6020  file=(FILE *) NULL;
6021  if (unique_file != -1)
6022    file=fdopen(unique_file,"wb");
6023  if ((unique_file == -1) || (file == (FILE *) NULL))
6024    {
6025      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6026        "UnableToCreateTemporaryFile","'%s'",wand->name);
6027      return((char *) NULL);
6028    }
6029  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6030  (void) fclose(file);
6031  description=FileToString(filename,~0,wand->exception);
6032  (void) RelinquishUniqueFileResource(filename);
6033  return(description);
6034}
6035
6036/*
6037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6038%                                                                             %
6039%                                                                             %
6040%                                                                             %
6041%   M a g i c k I m p l o d e I m a g e                                       %
6042%                                                                             %
6043%                                                                             %
6044%                                                                             %
6045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6046%
6047%  MagickImplodeImage() creates a new image that is a copy of an existing
6048%  one with the image pixels "implode" by the specified percentage.  It
6049%  allocates the memory necessary for the new Image structure and returns a
6050%  pointer to the new image.
6051%
6052%  The format of the MagickImplodeImage method is:
6053%
6054%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6055%        const double radius,const PixelInterpolateMethod method)
6056%
6057%  A description of each parameter follows:
6058%
6059%    o wand: the magick wand.
6060%
6061%    o amount: Define the extent of the implosion.
6062%
6063%    o method: the pixel interpolation method.
6064%
6065*/
6066WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6067  const double amount,const PixelInterpolateMethod method)
6068{
6069  Image
6070    *implode_image;
6071
6072  assert(wand != (MagickWand *) NULL);
6073  assert(wand->signature == WandSignature);
6074  if( IfMagickTrue(wand->debug) )
6075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6076
6077  if (wand->images == (Image *) NULL)
6078    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6079  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6080  if (implode_image == (Image *) NULL)
6081    return(MagickFalse);
6082  ReplaceImageInList(&wand->images,implode_image);
6083  return(MagickTrue);
6084}
6085
6086/*
6087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6088%                                                                             %
6089%                                                                             %
6090%                                                                             %
6091%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6092%                                                                             %
6093%                                                                             %
6094%                                                                             %
6095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6096%
6097%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6098%  location you specify.  The method returns MagickFalse on success otherwise
6099%  MagickTrue if an error is encountered.  The pixel data can be either char,
6100%  short int, int, ssize_t, float, or double in the order specified by map.
6101%
6102%  Suppose your want to upload the first scanline of a 640x480 image from
6103%  character data in red-green-blue order:
6104%
6105%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6106%
6107%  The format of the MagickImportImagePixels method is:
6108%
6109%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6110%        const ssize_t x,const ssize_t y,const size_t columns,
6111%        const size_t rows,const char *map,const StorageType storage,
6112%        const void *pixels)
6113%
6114%  A description of each parameter follows:
6115%
6116%    o wand: the magick wand.
6117%
6118%    o x, y, columns, rows:  These values define the perimeter of a region
6119%      of pixels you want to define.
6120%
6121%    o map:  This string reflects the expected ordering of the pixel array.
6122%      It can be any combination or order of R = red, G = green, B = blue,
6123%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6124%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6125%      P = pad.
6126%
6127%    o storage: Define the data type of the pixels.  Float and double types are
6128%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6129%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6130%      or DoublePixel.
6131%
6132%    o pixels: This array of values contain the pixel components as defined by
6133%      map and type.  You must preallocate this array where the expected
6134%      length varies depending on the values of width, height, map, and type.
6135%
6136*/
6137WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6138  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6139  const char *map,const StorageType storage,const void *pixels)
6140{
6141  MagickBooleanType
6142    status;
6143
6144  assert(wand != (MagickWand *) NULL);
6145  assert(wand->signature == WandSignature);
6146  if( IfMagickTrue(wand->debug) )
6147    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6148
6149  if (wand->images == (Image *) NULL)
6150    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6151  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6152    wand->exception);
6153  return(status);
6154}
6155
6156/*
6157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6158%                                                                             %
6159%                                                                             %
6160%                                                                             %
6161%   M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e               %
6162%                                                                             %
6163%                                                                             %
6164%                                                                             %
6165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6166%
6167%  MagickInterpolativeResizeImage() resize image using a interpolative
6168%  method.
6169%
6170%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6171%        const size_t columns,const size_t rows,
6172%        const PixelInterpolateMethod method)
6173%
6174%  A description of each parameter follows:
6175%
6176%    o wand: the magick wand.
6177%
6178%    o columns: the number of columns in the scaled image.
6179%
6180%    o rows: the number of rows in the scaled image.
6181%
6182%    o interpolate: the pixel interpolation method.
6183%
6184*/
6185WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6186  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6187{
6188  Image
6189    *resize_image;
6190
6191  assert(wand != (MagickWand *) NULL);
6192  assert(wand->signature == WandSignature);
6193  if( IfMagickTrue(wand->debug) )
6194    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6195
6196  if (wand->images == (Image *) NULL)
6197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6198  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6199    wand->exception);
6200  if (resize_image == (Image *) NULL)
6201    return(MagickFalse);
6202  ReplaceImageInList(&wand->images,resize_image);
6203  return(MagickTrue);
6204}
6205
6206/*
6207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6208%                                                                             %
6209%                                                                             %
6210%                                                                             %
6211%   M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e       %
6212%                                                                             %
6213%                                                                             %
6214%                                                                             %
6215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6216%
6217%  MagickInverseFourierTransformImage() implements the inverse discrete
6218%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6219%  imaginary image pair.
6220%
6221%  The format of the MagickInverseFourierTransformImage method is:
6222%
6223%      MagickBooleanType MagickInverseFourierTransformImage(
6224%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6225%        const MagickBooleanType magnitude)
6226%
6227%  A description of each parameter follows:
6228%
6229%    o magnitude_wand: the magnitude or real wand.
6230%
6231%    o phase_wand: the phase or imaginary wand.
6232%
6233%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6234%      imaginary image pair.
6235%
6236*/
6237WandExport MagickBooleanType MagickInverseFourierTransformImage(
6238  MagickWand *magnitude_wand,MagickWand *phase_wand,
6239  const MagickBooleanType magnitude)
6240{
6241  Image
6242    *inverse_image;
6243
6244  MagickWand
6245    *wand;
6246
6247  assert(magnitude_wand != (MagickWand *) NULL);
6248  assert(magnitude_wand->signature == WandSignature);
6249  if( IfMagickTrue(magnitude_wand->debug) )
6250    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6251
6252      magnitude_wand->name);
6253  wand=magnitude_wand;
6254  if (magnitude_wand->images == (Image *) NULL)
6255    ThrowWandException(WandError,"ContainsNoImages",
6256      magnitude_wand->name);
6257  assert(phase_wand != (MagickWand *) NULL);
6258  assert(phase_wand->signature == WandSignature);
6259  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6260    phase_wand->images,magnitude,wand->exception);
6261  if (inverse_image == (Image *) NULL)
6262    return(MagickFalse);
6263  ReplaceImageInList(&wand->images,inverse_image);
6264  return(MagickTrue);
6265}
6266
6267/*
6268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6269%                                                                             %
6270%                                                                             %
6271%                                                                             %
6272%   M a g i c k L a b e l I m a g e                                           %
6273%                                                                             %
6274%                                                                             %
6275%                                                                             %
6276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6277%
6278%  MagickLabelImage() adds a label to your image.
6279%
6280%  The format of the MagickLabelImage method is:
6281%
6282%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6283%
6284%  A description of each parameter follows:
6285%
6286%    o wand: the magick wand.
6287%
6288%    o label: the image label.
6289%
6290*/
6291WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6292  const char *label)
6293{
6294  MagickBooleanType
6295    status;
6296
6297  assert(wand != (MagickWand *) NULL);
6298  assert(wand->signature == WandSignature);
6299  if( IfMagickTrue(wand->debug) )
6300    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6301
6302  if (wand->images == (Image *) NULL)
6303    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6304  status=SetImageProperty(wand->images,"label",label,wand->exception);
6305  return(status);
6306}
6307
6308/*
6309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6310%                                                                             %
6311%                                                                             %
6312%                                                                             %
6313%   M a g i c k L e v e l I m a g e                                           %
6314%                                                                             %
6315%                                                                             %
6316%                                                                             %
6317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6318%
6319%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6320%  falling between specified white and black points to the full available
6321%  quantum range. The parameters provided represent the black, mid, and white
6322%  points. The black point specifies the darkest color in the image. Colors
6323%  darker than the black point are set to zero. Mid point specifies a gamma
6324%  correction to apply to the image.  White point specifies the lightest color
6325%  in the image. Colors brighter than the white point are set to the maximum
6326%  quantum value.
6327%
6328%  The format of the MagickLevelImage method is:
6329%
6330%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6331%        const double black_point,const double gamma,const double white_point)
6332%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6333%        const ChannelType channel,const double black_point,const double gamma,
6334%        const double white_point)
6335%
6336%  A description of each parameter follows:
6337%
6338%    o wand: the magick wand.
6339%
6340%    o channel: Identify which channel to level: RedPixelChannel,
6341%      GreenPixelChannel, etc.
6342%
6343%    o black_point: the black point.
6344%
6345%    o gamma: the gamma.
6346%
6347%    o white_point: the white point.
6348%
6349*/
6350WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6351  const double black_point,const double gamma,const double white_point)
6352{
6353  MagickBooleanType
6354    status;
6355
6356  assert(wand != (MagickWand *) NULL);
6357  assert(wand->signature == WandSignature);
6358  if( IfMagickTrue(wand->debug) )
6359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6360
6361  if (wand->images == (Image *) NULL)
6362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6363  status=LevelImage(wand->images,black_point,white_point,gamma,
6364    wand->exception);
6365  return(status);
6366}
6367
6368/*
6369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6370%                                                                             %
6371%                                                                             %
6372%                                                                             %
6373%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6374%                                                                             %
6375%                                                                             %
6376%                                                                             %
6377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6378%
6379%  MagickLinearStretchImage() stretches with saturation the image intensity.
6380%
6381%  You can also reduce the influence of a particular channel with a gamma
6382%  value of 0.
6383%
6384%  The format of the MagickLinearStretchImage method is:
6385%
6386%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6387%        const double black_point,const double white_point)
6388%
6389%  A description of each parameter follows:
6390%
6391%    o wand: the magick wand.
6392%
6393%    o black_point: the black point.
6394%
6395%    o white_point: the white point.
6396%
6397*/
6398WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6399  const double black_point,const double white_point)
6400{
6401  MagickBooleanType
6402    status;
6403
6404  assert(wand != (MagickWand *) NULL);
6405  assert(wand->signature == WandSignature);
6406  if( IfMagickTrue(wand->debug) )
6407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6408
6409  if (wand->images == (Image *) NULL)
6410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6411  status=LinearStretchImage(wand->images,black_point,white_point,
6412    wand->exception);
6413  return(status);
6414}
6415
6416/*
6417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418%                                                                             %
6419%                                                                             %
6420%                                                                             %
6421%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6422%                                                                             %
6423%                                                                             %
6424%                                                                             %
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%
6427%  MagickLiquidRescaleImage() rescales image with seam carving.
6428%
6429%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6430%        const size_t columns,const size_t rows,
6431%        const double delta_x,const double rigidity)
6432%
6433%  A description of each parameter follows:
6434%
6435%    o wand: the magick wand.
6436%
6437%    o columns: the number of columns in the scaled image.
6438%
6439%    o rows: the number of rows in the scaled image.
6440%
6441%    o delta_x: maximum seam transversal step (0 means straight seams).
6442%
6443%    o rigidity: introduce a bias for non-straight seams (typically 0).
6444%
6445*/
6446WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6447  const size_t columns,const size_t rows,const double delta_x,
6448  const double rigidity)
6449{
6450  Image
6451    *rescale_image;
6452
6453  assert(wand != (MagickWand *) NULL);
6454  assert(wand->signature == WandSignature);
6455  if( IfMagickTrue(wand->debug) )
6456    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6457
6458  if (wand->images == (Image *) NULL)
6459    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6460  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6461    rigidity,wand->exception);
6462  if (rescale_image == (Image *) NULL)
6463    return(MagickFalse);
6464  ReplaceImageInList(&wand->images,rescale_image);
6465  return(MagickTrue);
6466}
6467
6468/*
6469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6470%                                                                             %
6471%                                                                             %
6472%                                                                             %
6473%   M a g i c k M a g n i f y I m a g e                                       %
6474%                                                                             %
6475%                                                                             %
6476%                                                                             %
6477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6478%
6479%  MagickMagnifyImage() is a convenience method that scales an image
6480%  proportionally to twice its original size.
6481%
6482%  The format of the MagickMagnifyImage method is:
6483%
6484%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6485%
6486%  A description of each parameter follows:
6487%
6488%    o wand: the magick wand.
6489%
6490*/
6491WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6492{
6493  Image
6494    *magnify_image;
6495
6496  assert(wand != (MagickWand *) NULL);
6497  assert(wand->signature == WandSignature);
6498  if( IfMagickTrue(wand->debug) )
6499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6500
6501  if (wand->images == (Image *) NULL)
6502    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6503  magnify_image=MagnifyImage(wand->images,wand->exception);
6504  if (magnify_image == (Image *) NULL)
6505    return(MagickFalse);
6506  ReplaceImageInList(&wand->images,magnify_image);
6507  return(MagickTrue);
6508}
6509
6510/*
6511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6512%                                                                             %
6513%                                                                             %
6514%                                                                             %
6515%   M a g i c k M e r g e I m a g e L a y e r s                               %
6516%                                                                             %
6517%                                                                             %
6518%                                                                             %
6519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520%
6521%  MagickMergeImageLayers() composes all the image layers from the current
6522%  given image onward to produce a single image of the merged layers.
6523%
6524%  The inital canvas's size depends on the given ImageLayerMethod, and is
6525%  initialized using the first images background color.  The images
6526%  are then compositied onto that image in sequence using the given
6527%  composition that has been assigned to each individual image.
6528%
6529%  The format of the MagickMergeImageLayers method is:
6530%
6531%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6532%        const ImageLayerMethod method)
6533%
6534%  A description of each parameter follows:
6535%
6536%    o wand: the magick wand.
6537%
6538%    o method: the method of selecting the size of the initial canvas.
6539%
6540%        MergeLayer: Merge all layers onto a canvas just large enough
6541%           to hold all the actual images. The virtual canvas of the
6542%           first image is preserved but otherwise ignored.
6543%
6544%        FlattenLayer: Use the virtual canvas size of first image.
6545%           Images which fall outside this canvas is clipped.
6546%           This can be used to 'fill out' a given virtual canvas.
6547%
6548%        MosaicLayer: Start with the virtual canvas of the first image,
6549%           enlarging left and right edges to contain all images.
6550%           Images with negative offsets will be clipped.
6551%
6552*/
6553WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6554  const ImageLayerMethod method)
6555{
6556  Image
6557    *mosaic_image;
6558
6559  assert(wand != (MagickWand *) NULL);
6560  assert(wand->signature == WandSignature);
6561  if( IfMagickTrue(wand->debug) )
6562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6563
6564  if (wand->images == (Image *) NULL)
6565    return((MagickWand *) NULL);
6566  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6567  if (mosaic_image == (Image *) NULL)
6568    return((MagickWand *) NULL);
6569  return(CloneMagickWandFromImages(wand,mosaic_image));
6570}
6571
6572/*
6573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6574%                                                                             %
6575%                                                                             %
6576%                                                                             %
6577%   M a g i c k M i n i f y I m a g e                                         %
6578%                                                                             %
6579%                                                                             %
6580%                                                                             %
6581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6582%
6583%  MagickMinifyImage() is a convenience method that scales an image
6584%  proportionally to one-half its original size
6585%
6586%  The format of the MagickMinifyImage method is:
6587%
6588%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6589%
6590%  A description of each parameter follows:
6591%
6592%    o wand: the magick wand.
6593%
6594*/
6595WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6596{
6597  Image
6598    *minify_image;
6599
6600  assert(wand != (MagickWand *) NULL);
6601  assert(wand->signature == WandSignature);
6602  if( IfMagickTrue(wand->debug) )
6603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6604
6605  if (wand->images == (Image *) NULL)
6606    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6607  minify_image=MinifyImage(wand->images,wand->exception);
6608  if (minify_image == (Image *) NULL)
6609    return(MagickFalse);
6610  ReplaceImageInList(&wand->images,minify_image);
6611  return(MagickTrue);
6612}
6613
6614/*
6615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6616%                                                                             %
6617%                                                                             %
6618%                                                                             %
6619%   M a g i c k M o d u l a t e I m a g e                                     %
6620%                                                                             %
6621%                                                                             %
6622%                                                                             %
6623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6624%
6625%  MagickModulateImage() lets you control the brightness, saturation, and hue
6626%  of an image.  Hue is the percentage of absolute rotation from the current
6627%  position.  For example 50 results in a counter-clockwise rotation of 90
6628%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6629%  both resulting in a rotation of 180 degrees.
6630%
6631%  To increase the color brightness by 20% and decrease the color saturation by
6632%  10% and leave the hue unchanged, use: 120,90,100.
6633%
6634%  The format of the MagickModulateImage method is:
6635%
6636%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6637%        const double brightness,const double saturation,const double hue)
6638%
6639%  A description of each parameter follows:
6640%
6641%    o wand: the magick wand.
6642%
6643%    o brightness: the percent change in brighness.
6644%
6645%    o saturation: the percent change in saturation.
6646%
6647%    o hue: the percent change in hue.
6648%
6649*/
6650WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6651  const double brightness,const double saturation,const double hue)
6652{
6653  char
6654    modulate[MaxTextExtent];
6655
6656  MagickBooleanType
6657    status;
6658
6659  assert(wand != (MagickWand *) NULL);
6660  assert(wand->signature == WandSignature);
6661  if( IfMagickTrue(wand->debug) )
6662    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6663
6664  if (wand->images == (Image *) NULL)
6665    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6666  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6667    brightness,saturation,hue);
6668  status=ModulateImage(wand->images,modulate,wand->exception);
6669  return(status);
6670}
6671
6672/*
6673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6674%                                                                             %
6675%                                                                             %
6676%                                                                             %
6677%   M a g i c k M o n t a g e I m a g e                                       %
6678%                                                                             %
6679%                                                                             %
6680%                                                                             %
6681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6682%
6683%  MagickMontageImage() creates a composite image by combining several
6684%  separate images. The images are tiled on the composite image with the name
6685%  of the image optionally appearing just below the individual tile.
6686%
6687%  The format of the MagickMontageImage method is:
6688%
6689%      MagickWand *MagickMontageImage(MagickWand *wand,
6690%        const DrawingWand drawing_wand,const char *tile_geometry,
6691%        const char *thumbnail_geometry,const MontageMode mode,
6692%        const char *frame)
6693%
6694%  A description of each parameter follows:
6695%
6696%    o wand: the magick wand.
6697%
6698%    o drawing_wand: the drawing wand.  The font name, size, and color are
6699%      obtained from this wand.
6700%
6701%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6702%
6703%    o thumbnail_geometry: Preferred image size and border size of each
6704%      thumbnail (e.g. 120x120+4+3>).
6705%
6706%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6707%
6708%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6709%      The frame color is that of the thumbnail's matte color.
6710%
6711*/
6712WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6713  const DrawingWand *drawing_wand,const char *tile_geometry,
6714  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6715{
6716  char
6717    *font;
6718
6719  Image
6720    *montage_image;
6721
6722  MontageInfo
6723    *montage_info;
6724
6725  PixelWand
6726    *pixel_wand;
6727
6728  assert(wand != (MagickWand *) NULL);
6729  assert(wand->signature == WandSignature);
6730  if( IfMagickTrue(wand->debug) )
6731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6732
6733  if (wand->images == (Image *) NULL)
6734    return((MagickWand *) NULL);
6735  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6736  switch (mode)
6737  {
6738    case FrameMode:
6739    {
6740      (void) CloneString(&montage_info->frame,"15x15+3+3");
6741      montage_info->shadow=MagickTrue;
6742      break;
6743    }
6744    case UnframeMode:
6745    {
6746      montage_info->frame=(char *) NULL;
6747      montage_info->shadow=MagickFalse;
6748      montage_info->border_width=0;
6749      break;
6750    }
6751    case ConcatenateMode:
6752    {
6753      montage_info->frame=(char *) NULL;
6754      montage_info->shadow=MagickFalse;
6755      (void) CloneString(&montage_info->geometry,"+0+0");
6756      montage_info->border_width=0;
6757      break;
6758    }
6759    default:
6760      break;
6761  }
6762  font=DrawGetFont(drawing_wand);
6763  if (font != (char *) NULL)
6764    (void) CloneString(&montage_info->font,font);
6765  if (frame != (char *) NULL)
6766    (void) CloneString(&montage_info->frame,frame);
6767  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6768  pixel_wand=NewPixelWand();
6769  DrawGetFillColor(drawing_wand,pixel_wand);
6770  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6771  DrawGetStrokeColor(drawing_wand,pixel_wand);
6772  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6773  pixel_wand=DestroyPixelWand(pixel_wand);
6774  if (thumbnail_geometry != (char *) NULL)
6775    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6776  if (tile_geometry != (char *) NULL)
6777    (void) CloneString(&montage_info->tile,tile_geometry);
6778  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6779    wand->exception);
6780  montage_info=DestroyMontageInfo(montage_info);
6781  if (montage_image == (Image *) NULL)
6782    return((MagickWand *) NULL);
6783  return(CloneMagickWandFromImages(wand,montage_image));
6784}
6785
6786/*
6787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6788%                                                                             %
6789%                                                                             %
6790%                                                                             %
6791%   M a g i c k M o r p h I m a g e s                                         %
6792%                                                                             %
6793%                                                                             %
6794%                                                                             %
6795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6796%
6797%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6798%  and size are linearly interpolated to give the appearance of a
6799%  meta-morphosis from one image to the next.
6800%
6801%  The format of the MagickMorphImages method is:
6802%
6803%      MagickWand *MagickMorphImages(MagickWand *wand,
6804%        const size_t number_frames)
6805%
6806%  A description of each parameter follows:
6807%
6808%    o wand: the magick wand.
6809%
6810%    o number_frames: the number of in-between images to generate.
6811%
6812*/
6813WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6814  const size_t number_frames)
6815{
6816  Image
6817    *morph_image;
6818
6819  assert(wand != (MagickWand *) NULL);
6820  assert(wand->signature == WandSignature);
6821  if( IfMagickTrue(wand->debug) )
6822    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6823
6824  if (wand->images == (Image *) NULL)
6825    return((MagickWand *) NULL);
6826  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6827  if (morph_image == (Image *) NULL)
6828    return((MagickWand *) NULL);
6829  return(CloneMagickWandFromImages(wand,morph_image));
6830}
6831
6832/*
6833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6834%                                                                             %
6835%                                                                             %
6836%                                                                             %
6837%   M a g i c k M o r p h o l o g y I m a g e                                 %
6838%                                                                             %
6839%                                                                             %
6840%                                                                             %
6841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6842%
6843%  MagickMorphologyImage() applies a user supplied kernel to the image
6844%  according to the given mophology method.
6845%
6846%  The format of the MagickMorphologyImage method is:
6847%
6848%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6849%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6850%
6851%  A description of each parameter follows:
6852%
6853%    o wand: the magick wand.
6854%
6855%    o method: the morphology method to be applied.
6856%
6857%    o iterations: apply the operation this many times (or no change).
6858%      A value of -1 means loop until no change found.  How this is applied
6859%      may depend on the morphology method.  Typically this is a value of 1.
6860%
6861%    o kernel: An array of doubles representing the morphology kernel.
6862%
6863*/
6864WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6865  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6866{
6867  Image
6868    *morphology_image;
6869
6870  assert(wand != (MagickWand *) NULL);
6871  assert(wand->signature == WandSignature);
6872  if( IfMagickTrue(wand->debug) )
6873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6874
6875  if (kernel == (const KernelInfo *) NULL)
6876    return(MagickFalse);
6877  if (wand->images == (Image *) NULL)
6878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6879  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6880    wand->exception);
6881  if (morphology_image == (Image *) NULL)
6882    return(MagickFalse);
6883  ReplaceImageInList(&wand->images,morphology_image);
6884  return(MagickTrue);
6885}
6886
6887/*
6888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6889%                                                                             %
6890%                                                                             %
6891%                                                                             %
6892%   M a g i c k M o t i o n B l u r I m a g e                                 %
6893%                                                                             %
6894%                                                                             %
6895%                                                                             %
6896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6897%
6898%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6899%  Gaussian operator of the given radius and standard deviation (sigma).
6900%  For reasonable results, radius should be larger than sigma.  Use a
6901%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6902%  Angle gives the angle of the blurring motion.
6903%
6904%  The format of the MagickMotionBlurImage method is:
6905%
6906%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6907%        const double radius,const double sigma,const double angle)
6908%
6909%  A description of each parameter follows:
6910%
6911%    o wand: the magick wand.
6912%
6913%    o radius: the radius of the Gaussian, in pixels, not counting
6914%      the center pixel.
6915%
6916%    o sigma: the standard deviation of the Gaussian, in pixels.
6917%
6918%    o angle: Apply the effect along this angle.
6919%
6920*/
6921WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6922  const double radius,const double sigma,const double angle)
6923{
6924  Image
6925    *blur_image;
6926
6927  assert(wand != (MagickWand *) NULL);
6928  assert(wand->signature == WandSignature);
6929  if( IfMagickTrue(wand->debug) )
6930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6931
6932  if (wand->images == (Image *) NULL)
6933    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6934  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6935  if (blur_image == (Image *) NULL)
6936    return(MagickFalse);
6937  ReplaceImageInList(&wand->images,blur_image);
6938  return(MagickTrue);
6939}
6940
6941/*
6942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6943%                                                                             %
6944%                                                                             %
6945%                                                                             %
6946%   M a g i c k N e g a t e I m a g e                                         %
6947%                                                                             %
6948%                                                                             %
6949%                                                                             %
6950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6951%
6952%  MagickNegateImage() negates the colors in the reference image.  The
6953%  Grayscale option means that only grayscale values within the image are
6954%  negated.
6955%
6956%  You can also reduce the influence of a particular channel with a gamma
6957%  value of 0.
6958%
6959%  The format of the MagickNegateImage method is:
6960%
6961%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6962%        const MagickBooleanType gray)
6963%
6964%  A description of each parameter follows:
6965%
6966%    o wand: the magick wand.
6967%
6968%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6969%
6970*/
6971WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6972  const MagickBooleanType gray)
6973{
6974  MagickBooleanType
6975    status;
6976
6977  assert(wand != (MagickWand *) NULL);
6978  assert(wand->signature == WandSignature);
6979  if( IfMagickTrue(wand->debug) )
6980    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6981
6982  if (wand->images == (Image *) NULL)
6983    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6984  status=NegateImage(wand->images,gray,wand->exception);
6985  return(status);
6986}
6987
6988/*
6989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6990%                                                                             %
6991%                                                                             %
6992%                                                                             %
6993%   M a g i c k N e w I m a g e                                               %
6994%                                                                             %
6995%                                                                             %
6996%                                                                             %
6997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6998%
6999%  MagickNewImage() adds a blank image canvas of the specified size and
7000%  background color to the wand.
7001%
7002%  The format of the MagickNewImage method is:
7003%
7004%      MagickBooleanType MagickNewImage(MagickWand *wand,
7005%        const size_t columns,const size_t rows,
7006%        const PixelWand *background)
7007%
7008%  A description of each parameter follows:
7009%
7010%    o wand: the magick wand.
7011%
7012%    o width: the image width.
7013%
7014%    o height: the image height.
7015%
7016%    o background: the image color.
7017%
7018*/
7019WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7020  const size_t height,const PixelWand *background)
7021{
7022  Image
7023    *images;
7024
7025  PixelInfo
7026    pixel;
7027
7028  assert(wand != (MagickWand *) NULL);
7029  assert(wand->signature == WandSignature);
7030  if( IfMagickTrue(wand->debug) )
7031    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7032
7033  PixelGetMagickColor(background,&pixel);
7034  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7035  if (images == (Image *) NULL)
7036    return(MagickFalse);
7037  return(InsertImageInWand(wand,images));
7038}
7039
7040/*
7041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7042%                                                                             %
7043%                                                                             %
7044%                                                                             %
7045%   M a g i c k N e x t I m a g e                                             %
7046%                                                                             %
7047%                                                                             %
7048%                                                                             %
7049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7050%
7051%  MagickNextImage() sets the next image in the wand as the current image.
7052%
7053%  It is typically used after MagickResetIterator(), after which its first use
7054%  will set the first image as the current image (unless the wand is empty).
7055%
7056%  It will return MagickFalse when no more images are left to be returned
7057%  which happens when the wand is empty, or the current image is the last
7058%  image.
7059%
7060%  When the above condition (end of image list) is reached, the iterator is
7061%  automaticall set so that you can start using MagickPreviousImage() to
7062%  again iterate over the images in the reverse direction, starting with the
7063%  last image (again).  You can jump to this condition immeditally using
7064%  MagickSetLastIterator().
7065%
7066%  The format of the MagickNextImage method is:
7067%
7068%      MagickBooleanType MagickNextImage(MagickWand *wand)
7069%
7070%  A description of each parameter follows:
7071%
7072%    o wand: the magick wand.
7073%
7074*/
7075WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7076{
7077  assert(wand != (MagickWand *) NULL);
7078  assert(wand->signature == WandSignature);
7079  if( IfMagickTrue(wand->debug) )
7080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7081
7082  if (wand->images == (Image *) NULL)
7083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7084  wand->insert_before=MagickFalse; /* Inserts is now appended */
7085  if( IfMagickTrue(wand->image_pending) )
7086    {
7087      wand->image_pending=MagickFalse;
7088      return(MagickTrue);
7089    }
7090  if (GetNextImageInList(wand->images) == (Image *) NULL)
7091    {
7092      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7093      return(MagickFalse);
7094    }
7095  wand->images=GetNextImageInList(wand->images);
7096  return(MagickTrue);
7097}
7098
7099/*
7100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7101%                                                                             %
7102%                                                                             %
7103%                                                                             %
7104%   M a g i c k N o r m a l i z e I m a g e                                   %
7105%                                                                             %
7106%                                                                             %
7107%                                                                             %
7108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7109%
7110%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7111%  the pixels color to span the entire range of colors available
7112%
7113%  You can also reduce the influence of a particular channel with a gamma
7114%  value of 0.
7115%
7116%  The format of the MagickNormalizeImage method is:
7117%
7118%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7119%
7120%  A description of each parameter follows:
7121%
7122%    o wand: the magick wand.
7123%
7124*/
7125WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7126{
7127  MagickBooleanType
7128    status;
7129
7130  assert(wand != (MagickWand *) NULL);
7131  assert(wand->signature == WandSignature);
7132  if( IfMagickTrue(wand->debug) )
7133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7134
7135  if (wand->images == (Image *) NULL)
7136    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7137  status=NormalizeImage(wand->images,wand->exception);
7138  return(status);
7139}
7140
7141/*
7142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143%                                                                             %
7144%                                                                             %
7145%                                                                             %
7146%   M a g i c k O i l P a i n t I m a g e                                     %
7147%                                                                             %
7148%                                                                             %
7149%                                                                             %
7150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151%
7152%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7153%  painting.  Each pixel is replaced by the most frequent color occurring
7154%  in a circular region defined by radius.
7155%
7156%  The format of the MagickOilPaintImage method is:
7157%
7158%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7159%        const double radius,const double sigma)
7160%
7161%  A description of each parameter follows:
7162%
7163%    o wand: the magick wand.
7164%
7165%    o radius: the radius of the circular neighborhood.
7166%
7167%    o sigma: the standard deviation of the Gaussian, in pixels.
7168%
7169*/
7170WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7171  const double radius,const double sigma)
7172{
7173  Image
7174    *paint_image;
7175
7176  assert(wand != (MagickWand *) NULL);
7177  assert(wand->signature == WandSignature);
7178  if( IfMagickTrue(wand->debug) )
7179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7180
7181  if (wand->images == (Image *) NULL)
7182    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7183  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7184  if (paint_image == (Image *) NULL)
7185    return(MagickFalse);
7186  ReplaceImageInList(&wand->images,paint_image);
7187  return(MagickTrue);
7188}
7189
7190/*
7191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7192%                                                                             %
7193%                                                                             %
7194%                                                                             %
7195%   M a g i c k O p a q u e P a i n t I m a g e                               %
7196%                                                                             %
7197%                                                                             %
7198%                                                                             %
7199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7200%
7201%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7202%  defined by fill.
7203%
7204%  The format of the MagickOpaquePaintImage method is:
7205%
7206%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7207%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7208%        const MagickBooleanType invert)
7209%
7210%  A description of each parameter follows:
7211%
7212%    o wand: the magick wand.
7213%
7214%    o target: Change this target color to the fill color within the image.
7215%
7216%    o fill: the fill pixel wand.
7217%
7218%    o fuzz: By default target must match a particular pixel color
7219%      exactly.  However, in many cases two colors may differ by a small amount.
7220%      The fuzz member of image defines how much tolerance is acceptable to
7221%      consider two colors as the same.  For example, set fuzz to 10 and the
7222%      color red at intensities of 100 and 102 respectively are now interpreted
7223%      as the same color for the purposes of the floodfill.
7224%
7225%    o invert: paint any pixel that does not match the target color.
7226%
7227*/
7228WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7229  const PixelWand *target,const PixelWand *fill,const double fuzz,
7230  const MagickBooleanType invert)
7231{
7232  MagickBooleanType
7233    status;
7234
7235  PixelInfo
7236    fill_pixel,
7237    target_pixel;
7238
7239  assert(wand != (MagickWand *) NULL);
7240  assert(wand->signature == WandSignature);
7241  if( IfMagickTrue(wand->debug) )
7242    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7243
7244  if (wand->images == (Image *) NULL)
7245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7246  PixelGetMagickColor(target,&target_pixel);
7247  PixelGetMagickColor(fill,&fill_pixel);
7248  wand->images->fuzz=fuzz;
7249  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7250    wand->exception);
7251  return(status);
7252}
7253
7254/*
7255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7256%                                                                             %
7257%                                                                             %
7258%                                                                             %
7259%   M a g i c k O p t i m i z e I m a g e L a y e r s                         %
7260%                                                                             %
7261%                                                                             %
7262%                                                                             %
7263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7264%
7265%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7266%  previous image in the sequence.  From this it attempts to select the
7267%  smallest cropped image to replace each frame, while preserving the results
7268%  of the animation.
7269%
7270%  The format of the MagickOptimizeImageLayers method is:
7271%
7272%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7273%
7274%  A description of each parameter follows:
7275%
7276%    o wand: the magick wand.
7277%
7278*/
7279WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7280{
7281  Image
7282    *optimize_image;
7283
7284  assert(wand != (MagickWand *) NULL);
7285  assert(wand->signature == WandSignature);
7286  if( IfMagickTrue(wand->debug) )
7287    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7288
7289  if (wand->images == (Image *) NULL)
7290    return((MagickWand *) NULL);
7291  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7292  if (optimize_image == (Image *) NULL)
7293    return((MagickWand *) NULL);
7294  return(CloneMagickWandFromImages(wand,optimize_image));
7295}
7296
7297/*
7298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7299%                                                                             %
7300%                                                                             %
7301%                                                                             %
7302%     M a g i c k O r d e r e d P o s t e r i z e I m a g e                   %
7303%                                                                             %
7304%                                                                             %
7305%                                                                             %
7306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7307%
7308%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7309%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7310%  which can be different for different channels, according to the input
7311%  arguments.
7312%
7313%  The format of the MagickOrderedPosterizeImage method is:
7314%
7315%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7316%        const char *threshold_map)
7317%
7318%  A description of each parameter follows:
7319%
7320%    o image: the image.
7321%
7322%    o threshold_map: A string containing the name of the threshold dither
7323%      map to use, followed by zero or more numbers representing the number of
7324%      color levels tho dither between.
7325%
7326%      Any level number less than 2 is equivalent to 2, and means only binary
7327%      dithering will be applied to each color channel.
7328%
7329%      No numbers also means a 2 level (bitmap) dither will be applied to all
7330%      channels, while a single number is the number of levels applied to each
7331%      channel in sequence.  More numbers will be applied in turn to each of
7332%      the color channels.
7333%
7334%      For example: "o3x3,6" generates a 6 level posterization of the image
7335%      with a ordered 3x3 diffused pixel dither being applied between each
7336%      level. While checker,8,8,4 will produce a 332 colormaped image with
7337%      only a single checkerboard hash pattern (50% grey) between each color
7338%      level, to basically double the number of color levels with a bare
7339%      minimim of dithering.
7340%
7341*/
7342WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7343  const char *threshold_map)
7344{
7345  MagickBooleanType
7346    status;
7347
7348  assert(wand != (MagickWand *) NULL);
7349  assert(wand->signature == WandSignature);
7350  if( IfMagickTrue(wand->debug) )
7351    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7352
7353  if (wand->images == (Image *) NULL)
7354    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7355  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7356  return(status);
7357}
7358
7359/*
7360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7361%                                                                             %
7362%                                                                             %
7363%                                                                             %
7364%   M a g i c k P i n g I m a g e                                             %
7365%                                                                             %
7366%                                                                             %
7367%                                                                             %
7368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7369%
7370%  MagickPingImage() is the same as MagickReadImage() except the only valid
7371%  information returned is the image width, height, size, and format.  It
7372%  is designed to efficiently obtain this information from a file without
7373%  reading the entire image sequence into memory.
7374%
7375%  The format of the MagickPingImage method is:
7376%
7377%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7378%
7379%  A description of each parameter follows:
7380%
7381%    o wand: the magick wand.
7382%
7383%    o filename: the image filename.
7384%
7385*/
7386WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7387  const char *filename)
7388{
7389  Image
7390    *images;
7391
7392  ImageInfo
7393    *ping_info;
7394
7395  assert(wand != (MagickWand *) NULL);
7396  assert(wand->signature == WandSignature);
7397  if( IfMagickTrue(wand->debug) )
7398    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7399
7400  ping_info=CloneImageInfo(wand->image_info);
7401  if (filename != (const char *) NULL)
7402    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7403  images=PingImage(ping_info,wand->exception);
7404  ping_info=DestroyImageInfo(ping_info);
7405  if (images == (Image *) NULL)
7406    return(MagickFalse);
7407  return(InsertImageInWand(wand,images));
7408}
7409
7410/*
7411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7412%                                                                             %
7413%                                                                             %
7414%                                                                             %
7415%   M a g i c k P i n g I m a g e B l o b                                     %
7416%                                                                             %
7417%                                                                             %
7418%                                                                             %
7419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7420%
7421%  MagickPingImageBlob() pings an image or image sequence from a blob.
7422%
7423%  The format of the MagickPingImageBlob method is:
7424%
7425%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7426%        const void *blob,const size_t length)
7427%
7428%  A description of each parameter follows:
7429%
7430%    o wand: the magick wand.
7431%
7432%    o blob: the blob.
7433%
7434%    o length: the blob length.
7435%
7436*/
7437WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7438  const void *blob,const size_t length)
7439{
7440  Image
7441    *images;
7442
7443  ImageInfo
7444    *read_info;
7445
7446  assert(wand != (MagickWand *) NULL);
7447  assert(wand->signature == WandSignature);
7448  if( IfMagickTrue(wand->debug) )
7449    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7450
7451  read_info=CloneImageInfo(wand->image_info);
7452  SetImageInfoBlob(read_info,blob,length);
7453  images=PingImage(read_info,wand->exception);
7454  read_info=DestroyImageInfo(read_info);
7455  if (images == (Image *) NULL)
7456    return(MagickFalse);
7457  return(InsertImageInWand(wand,images));
7458}
7459
7460/*
7461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7462%                                                                             %
7463%                                                                             %
7464%                                                                             %
7465%   M a g i c k P i n g I m a g e F i l e                                     %
7466%                                                                             %
7467%                                                                             %
7468%                                                                             %
7469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7470%
7471%  MagickPingImageFile() pings an image or image sequence from an open file
7472%  descriptor.
7473%
7474%  The format of the MagickPingImageFile method is:
7475%
7476%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7477%
7478%  A description of each parameter follows:
7479%
7480%    o wand: the magick wand.
7481%
7482%    o file: the file descriptor.
7483%
7484*/
7485WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7486{
7487  Image
7488    *images;
7489
7490  ImageInfo
7491    *read_info;
7492
7493  assert(wand != (MagickWand *) NULL);
7494  assert(wand->signature == WandSignature);
7495  assert(file != (FILE *) NULL);
7496  if( IfMagickTrue(wand->debug) )
7497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7498
7499  read_info=CloneImageInfo(wand->image_info);
7500  SetImageInfoFile(read_info,file);
7501  images=PingImage(read_info,wand->exception);
7502  read_info=DestroyImageInfo(read_info);
7503  if (images == (Image *) NULL)
7504    return(MagickFalse);
7505  return(InsertImageInWand(wand,images));
7506}
7507
7508/*
7509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7510%                                                                             %
7511%                                                                             %
7512%                                                                             %
7513%   M a g i c k P o l a r o i d I m a g e                                     %
7514%                                                                             %
7515%                                                                             %
7516%                                                                             %
7517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7518%
7519%  MagickPolaroidImage() simulates a Polaroid picture.
7520%
7521%  The format of the MagickPolaroidImage method is:
7522%
7523%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7524%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7525%        const PixelInterpolateMethod method)
7526%
7527%  A description of each parameter follows:
7528%
7529%    o wand: the magick wand.
7530%
7531%    o drawing_wand: the draw wand.
7532%
7533%    o caption: the Polaroid caption.
7534%
7535%    o angle: Apply the effect along this angle.
7536%
7537%    o method: the pixel interpolation method.
7538%
7539*/
7540WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7541  const DrawingWand *drawing_wand,const char *caption,const double angle,
7542  const PixelInterpolateMethod method)
7543{
7544  DrawInfo
7545    *draw_info;
7546
7547  Image
7548    *polaroid_image;
7549
7550  assert(wand != (MagickWand *) NULL);
7551  assert(wand->signature == WandSignature);
7552  if( IfMagickTrue(wand->debug) )
7553    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7554
7555  if (wand->images == (Image *) NULL)
7556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7557  draw_info=PeekDrawingWand(drawing_wand);
7558  if (draw_info == (DrawInfo *) NULL)
7559    return(MagickFalse);
7560  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7561    wand->exception);
7562  if (polaroid_image == (Image *) NULL)
7563    return(MagickFalse);
7564  ReplaceImageInList(&wand->images,polaroid_image);
7565  return(MagickTrue);
7566}
7567
7568/*
7569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7570%                                                                             %
7571%                                                                             %
7572%                                                                             %
7573%   M a g i c k P o s t e r i z e I m a g e                                   %
7574%                                                                             %
7575%                                                                             %
7576%                                                                             %
7577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7578%
7579%  MagickPosterizeImage() reduces the image to a limited number of color level.
7580%
7581%  The format of the MagickPosterizeImage method is:
7582%
7583%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7584%        const unsigned levels,const MagickBooleanType dither)
7585%
7586%  A description of each parameter follows:
7587%
7588%    o wand: the magick wand.
7589%
7590%    o levels: Number of color levels allowed in each channel.  Very low values
7591%      (2, 3, or 4) have the most visible effect.
7592%
7593%    o dither: Set this integer value to something other than zero to dither
7594%      the mapped image.
7595%
7596*/
7597WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7598  const size_t levels,const MagickBooleanType dither)
7599{
7600  MagickBooleanType
7601    status;
7602
7603  assert(wand != (MagickWand *) NULL);
7604  assert(wand->signature == WandSignature);
7605  if( IfMagickTrue(wand->debug) )
7606    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7607
7608  if (wand->images == (Image *) NULL)
7609    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7610  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7611  return(status);
7612}
7613
7614/*
7615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7616%                                                                             %
7617%                                                                             %
7618%                                                                             %
7619%   M a g i c k P r e v i e w I m a g e s                                     %
7620%                                                                             %
7621%                                                                             %
7622%                                                                             %
7623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7624%
7625%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7626%  image processing operation applied at varying strengths.  This helpful
7627%  to quickly pin-point an appropriate parameter for an image processing
7628%  operation.
7629%
7630%  The format of the MagickPreviewImages method is:
7631%
7632%      MagickWand *MagickPreviewImages(MagickWand *wand,
7633%        const PreviewType preview)
7634%
7635%  A description of each parameter follows:
7636%
7637%    o wand: the magick wand.
7638%
7639%    o preview: the preview type.
7640%
7641*/
7642WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7643  const PreviewType preview)
7644{
7645  Image
7646    *preview_image;
7647
7648  assert(wand != (MagickWand *) NULL);
7649  assert(wand->signature == WandSignature);
7650  if( IfMagickTrue(wand->debug) )
7651    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7652
7653  if (wand->images == (Image *) NULL)
7654    return((MagickWand *) NULL);
7655  preview_image=PreviewImage(wand->images,preview,wand->exception);
7656  if (preview_image == (Image *) NULL)
7657    return((MagickWand *) NULL);
7658  return(CloneMagickWandFromImages(wand,preview_image));
7659}
7660
7661/*
7662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7663%                                                                             %
7664%                                                                             %
7665%                                                                             %
7666%   M a g i c k P r e v i o u s I m a g e                                     %
7667%                                                                             %
7668%                                                                             %
7669%                                                                             %
7670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7671%
7672%  MagickPreviousImage() sets the previous image in the wand as the current
7673%  image.
7674%
7675%  It is typically used after MagickSetLastIterator(), after which its first
7676%  use will set the last image as the current image (unless the wand is empty).
7677%
7678%  It will return MagickFalse when no more images are left to be returned
7679%  which happens when the wand is empty, or the current image is the first
7680%  image.  At that point the iterator is than reset to again process images in
7681%  the forward direction, again starting with the first image in list. Images
7682%  added at this point are prepended.
7683%
7684%  Also at that point any images added to the wand using MagickAddImages() or
7685%  MagickReadImages() will be prepended before the first image. In this sense
7686%  the condition is not quite exactly the same as MagickResetIterator().
7687%
7688%  The format of the MagickPreviousImage method is:
7689%
7690%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7691%
7692%  A description of each parameter follows:
7693%
7694%    o wand: the magick wand.
7695%
7696*/
7697WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7698{
7699  assert(wand != (MagickWand *) NULL);
7700  assert(wand->signature == WandSignature);
7701  if( IfMagickTrue(wand->debug) )
7702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7703
7704  if (wand->images == (Image *) NULL)
7705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7706
7707  if( IfMagickTrue(wand->image_pending) )
7708    {
7709      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7710      return(MagickTrue);
7711    }
7712  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7713    {
7714      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7715      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7716      return(MagickFalse);
7717    }
7718  wand->images=GetPreviousImageInList(wand->images);
7719  return(MagickTrue);
7720}
7721
7722/*
7723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7724%                                                                             %
7725%                                                                             %
7726%                                                                             %
7727%   M a g i c k Q u a n t i z e I m a g e                                     %
7728%                                                                             %
7729%                                                                             %
7730%                                                                             %
7731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7732%
7733%  MagickQuantizeImage() analyzes the colors within a reference image and
7734%  chooses a fixed number of colors to represent the image.  The goal of the
7735%  algorithm is to minimize the color difference between the input and output
7736%  image while minimizing the processing time.
7737%
7738%  The format of the MagickQuantizeImage method is:
7739%
7740%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7741%        const size_t number_colors,const ColorspaceType colorspace,
7742%        const size_t treedepth,const MagickBooleanType dither,
7743%        const MagickBooleanType measure_error)
7744%
7745%  A description of each parameter follows:
7746%
7747%    o wand: the magick wand.
7748%
7749%    o number_colors: the number of colors.
7750%
7751%    o colorspace: Perform color reduction in this colorspace, typically
7752%      RGBColorspace.
7753%
7754%    o treedepth: Normally, this integer value is zero or one.  A zero or
7755%      one tells Quantize to choose a optimal tree depth of Log4(number_colors).%      A tree of this depth generally allows the best representation of the
7756%      reference image with the least amount of memory and the fastest
7757%      computational speed.  In some cases, such as an image with low color
7758%      dispersion (a few number of colors), a value other than
7759%      Log4(number_colors) is required.  To expand the color tree completely,
7760%      use a value of 8.
7761%
7762%    o dither: A value other than zero distributes the difference between an
7763%      original image and the corresponding color reduced image to
7764%      neighboring pixels along a Hilbert curve.
7765%
7766%    o measure_error: A value other than zero measures the difference between
7767%      the original and quantized images.  This difference is the total
7768%      quantization error.  The error is computed by summing over all pixels
7769%      in an image the distance squared in RGB space between each reference
7770%      pixel value and its quantized value.
7771%
7772*/
7773WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7774  const size_t number_colors,const ColorspaceType colorspace,
7775  const size_t treedepth,const MagickBooleanType dither,
7776  const MagickBooleanType measure_error)
7777{
7778  MagickBooleanType
7779    status;
7780
7781  QuantizeInfo
7782    *quantize_info;
7783
7784  assert(wand != (MagickWand *) NULL);
7785  assert(wand->signature == WandSignature);
7786  if( IfMagickTrue(wand->debug) )
7787    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7788
7789  if (wand->images == (Image *) NULL)
7790    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7791  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7792  quantize_info->number_colors=number_colors;
7793  quantize_info->dither=dither;
7794  quantize_info->tree_depth=treedepth;
7795  quantize_info->colorspace=colorspace;
7796  quantize_info->measure_error=measure_error;
7797  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7798  quantize_info=DestroyQuantizeInfo(quantize_info);
7799  return(status);
7800}
7801
7802/*
7803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7804%                                                                             %
7805%                                                                             %
7806%                                                                             %
7807%   M a g i c k Q u a n t i z e I m a g e s                                   %
7808%                                                                             %
7809%                                                                             %
7810%                                                                             %
7811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7812%
7813%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7814%  chooses a fixed number of colors to represent the image.  The goal of the
7815%  algorithm is to minimize the color difference between the input and output
7816%  image while minimizing the processing time.
7817%
7818%  The format of the MagickQuantizeImages method is:
7819%
7820%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7821%        const size_t number_colors,const ColorspaceType colorspace,
7822%        const size_t treedepth,const MagickBooleanType dither,
7823%        const MagickBooleanType measure_error)
7824%
7825%  A description of each parameter follows:
7826%
7827%    o wand: the magick wand.
7828%
7829%    o number_colors: the number of colors.
7830%
7831%    o colorspace: Perform color reduction in this colorspace, typically
7832%      RGBColorspace.
7833%
7834%    o treedepth: Normally, this integer value is zero or one.  A zero or
7835%      one tells Quantize to choose a optimal tree depth of Log4(number_colors).%      A tree of this depth generally allows the best representation of the
7836%      reference image with the least amount of memory and the fastest
7837%      computational speed.  In some cases, such as an image with low color
7838%      dispersion (a few number of colors), a value other than
7839%      Log4(number_colors) is required.  To expand the color tree completely,
7840%      use a value of 8.
7841%
7842%    o dither: A value other than zero distributes the difference between an
7843%      original image and the corresponding color reduced algorithm to
7844%      neighboring pixels along a Hilbert curve.
7845%
7846%    o measure_error: A value other than zero measures the difference between
7847%      the original and quantized images.  This difference is the total
7848%      quantization error.  The error is computed by summing over all pixels
7849%      in an image the distance squared in RGB space between each reference
7850%      pixel value and its quantized value.
7851%
7852*/
7853WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7854  const size_t number_colors,const ColorspaceType colorspace,
7855  const size_t treedepth,const MagickBooleanType dither,
7856  const MagickBooleanType measure_error)
7857{
7858  MagickBooleanType
7859    status;
7860
7861  QuantizeInfo
7862    *quantize_info;
7863
7864  assert(wand != (MagickWand *) NULL);
7865  assert(wand->signature == WandSignature);
7866  if( IfMagickTrue(wand->debug) )
7867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868
7869  if (wand->images == (Image *) NULL)
7870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7871  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7872  quantize_info->number_colors=number_colors;
7873  quantize_info->dither=dither;
7874  quantize_info->tree_depth=treedepth;
7875  quantize_info->colorspace=colorspace;
7876  quantize_info->measure_error=measure_error;
7877  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7878  quantize_info=DestroyQuantizeInfo(quantize_info);
7879  return(status);
7880}
7881
7882/*
7883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7884%                                                                             %
7885%                                                                             %
7886%                                                                             %
7887%   M a g i c k R a d i a l B l u r I m a g e                                 %
7888%                                                                             %
7889%                                                                             %
7890%                                                                             %
7891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7892%
7893%  MagickRadialBlurImage() radial blurs an image.
7894%
7895%  The format of the MagickRadialBlurImage method is:
7896%
7897%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7898%        const double angle)
7899%
7900%  A description of each parameter follows:
7901%
7902%    o wand: the magick wand.
7903%
7904%    o angle: the angle of the blur in degrees.
7905%
7906*/
7907WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7908  const double angle)
7909{
7910  Image
7911    *blur_image;
7912
7913  assert(wand != (MagickWand *) NULL);
7914  assert(wand->signature == WandSignature);
7915  if( IfMagickTrue(wand->debug) )
7916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7917
7918  if (wand->images == (Image *) NULL)
7919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7920  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7921  if (blur_image == (Image *) NULL)
7922    return(MagickFalse);
7923  ReplaceImageInList(&wand->images,blur_image);
7924  return(MagickTrue);
7925}
7926
7927/*
7928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7929%                                                                             %
7930%                                                                             %
7931%                                                                             %
7932%   M a g i c k R a i s e I m a g e                                           %
7933%                                                                             %
7934%                                                                             %
7935%                                                                             %
7936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7937%
7938%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7939%  by lightening and darkening the edges of the image.  Members width and
7940%  height of raise_info define the width of the vertical and horizontal
7941%  edge of the effect.
7942%
7943%  The format of the MagickRaiseImage method is:
7944%
7945%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7946%        const size_t width,const size_t height,const ssize_t x,
7947%        const ssize_t y,const MagickBooleanType raise)
7948%
7949%  A description of each parameter follows:
7950%
7951%    o wand: the magick wand.
7952%
7953%    o width,height,x,y:  Define the dimensions of the area to raise.
7954%
7955%    o raise: A value other than zero creates a 3-D raise effect,
7956%      otherwise it has a lowered effect.
7957%
7958*/
7959WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7960  const size_t width,const size_t height,const ssize_t x,
7961  const ssize_t y,const MagickBooleanType raise)
7962{
7963  MagickBooleanType
7964    status;
7965
7966  RectangleInfo
7967    raise_info;
7968
7969  assert(wand != (MagickWand *) NULL);
7970  assert(wand->signature == WandSignature);
7971  if( IfMagickTrue(wand->debug) )
7972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7973
7974  if (wand->images == (Image *) NULL)
7975    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7976  raise_info.width=width;
7977  raise_info.height=height;
7978  raise_info.x=x;
7979  raise_info.y=y;
7980  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7981  return(status);
7982}
7983
7984/*
7985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7986%                                                                             %
7987%                                                                             %
7988%                                                                             %
7989%   M a g i c k R a n d o m T h r e s h o l d I m a g e                       %
7990%                                                                             %
7991%                                                                             %
7992%                                                                             %
7993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7994%
7995%  MagickRandomThresholdImage() changes the value of individual pixels based on
7996%  the intensity of each pixel compared to threshold.  The result is a
7997%  high-contrast, two color image.
7998%
7999%  The format of the MagickRandomThresholdImage method is:
8000%
8001%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8002%        const double low,const double high)
8003%
8004%  A description of each parameter follows:
8005%
8006%    o wand: the magick wand.
8007%
8008%    o low,high: Specify the high and low thresholds.  These values range from
8009%      0 to QuantumRange.
8010%
8011*/
8012WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8013  const double low,const double high)
8014{
8015  char
8016    threshold[MaxTextExtent];
8017
8018  assert(wand != (MagickWand *) NULL);
8019  assert(wand->signature == WandSignature);
8020  if( IfMagickTrue(wand->debug) )
8021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8022
8023  if (wand->images == (Image *) NULL)
8024    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8025  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8026  return(RandomThresholdImage(wand->images,threshold,wand->exception));
8027}
8028
8029/*
8030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8031%                                                                             %
8032%                                                                             %
8033%                                                                             %
8034%   M a g i c k R e a d I m a g e                                             %
8035%                                                                             %
8036%                                                                             %
8037%                                                                             %
8038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8039%
8040%  MagickReadImage() reads an image or image sequence.  The images are inserted
8041%  jjust before the current image pointer position.
8042%
8043%  Use MagickSetFirstIterator(), to insert new images before all the current
8044%  images in the wand, MagickSetLastIterator() to append add to the end,
8045%  MagickSetImageIndex() to place images just after the given index.
8046%
8047%  The format of the MagickReadImage method is:
8048%
8049%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8050%
8051%  A description of each parameter follows:
8052%
8053%    o wand: the magick wand.
8054%
8055%    o filename: the image filename.
8056%
8057*/
8058WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8059  const char *filename)
8060{
8061  Image
8062    *images;
8063
8064  ImageInfo
8065    *read_info;
8066
8067  assert(wand != (MagickWand *) NULL);
8068  assert(wand->signature == WandSignature);
8069  if( IfMagickTrue(wand->debug) )
8070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8071
8072  read_info=CloneImageInfo(wand->image_info);
8073  if (filename != (const char *) NULL)
8074    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8075  images=ReadImage(read_info,wand->exception);
8076  read_info=DestroyImageInfo(read_info);
8077  if (images == (Image *) NULL)
8078    return(MagickFalse);
8079  return(InsertImageInWand(wand,images));
8080}
8081
8082/*
8083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8084%                                                                             %
8085%                                                                             %
8086%                                                                             %
8087%   M a g i c k R e a d I m a g e B l o b                                     %
8088%                                                                             %
8089%                                                                             %
8090%                                                                             %
8091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8092%
8093%  MagickReadImageBlob() reads an image or image sequence from a blob.
8094%  In all other respects it is like MagickReadImage().
8095%
8096%  The format of the MagickReadImageBlob method is:
8097%
8098%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8099%        const void *blob,const size_t length)
8100%
8101%  A description of each parameter follows:
8102%
8103%    o wand: the magick wand.
8104%
8105%    o blob: the blob.
8106%
8107%    o length: the blob length.
8108%
8109*/
8110WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8111  const void *blob,const size_t length)
8112{
8113  Image
8114    *images;
8115
8116  assert(wand != (MagickWand *) NULL);
8117  assert(wand->signature == WandSignature);
8118  if( IfMagickTrue(wand->debug) )
8119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8120
8121  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8122  if (images == (Image *) NULL)
8123    return(MagickFalse);
8124  return(InsertImageInWand(wand,images));
8125}
8126
8127/*
8128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8129%                                                                             %
8130%                                                                             %
8131%                                                                             %
8132%   M a g i c k R e a d I m a g e F i l e                                     %
8133%                                                                             %
8134%                                                                             %
8135%                                                                             %
8136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8137%
8138%  MagickReadImageFile() reads an image or image sequence from an already
8139%  opened file descriptor.  Otherwise it is like MagickReadImage().
8140%
8141%  The format of the MagickReadImageFile method is:
8142%
8143%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8144%
8145%  A description of each parameter follows:
8146%
8147%    o wand: the magick wand.
8148%
8149%    o file: the file descriptor.
8150%
8151*/
8152WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8153{
8154  Image
8155    *images;
8156
8157  ImageInfo
8158    *read_info;
8159
8160  assert(wand != (MagickWand *) NULL);
8161  assert(wand->signature == WandSignature);
8162  assert(file != (FILE *) NULL);
8163  if( IfMagickTrue(wand->debug) )
8164    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8165
8166  read_info=CloneImageInfo(wand->image_info);
8167  SetImageInfoFile(read_info,file);
8168  images=ReadImage(read_info,wand->exception);
8169  read_info=DestroyImageInfo(read_info);
8170  if (images == (Image *) NULL)
8171    return(MagickFalse);
8172  return(InsertImageInWand(wand,images));
8173}
8174
8175/*
8176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8177%                                                                             %
8178%                                                                             %
8179%                                                                             %
8180%   M a g i c k R e m a p I m a g e                                           %
8181%                                                                             %
8182%                                                                             %
8183%                                                                             %
8184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185%
8186%  MagickRemapImage() replaces the colors of an image with the closest color
8187%  from a reference image.
8188%
8189%  The format of the MagickRemapImage method is:
8190%
8191%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8192%        const MagickWand *remap_wand,const DitherMethod method)
8193%
8194%  A description of each parameter follows:
8195%
8196%    o wand: the magick wand.
8197%
8198%    o affinity: the affinity wand.
8199%
8200%    o method: choose from these dither methods: NoDitherMethod,
8201%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8202%
8203*/
8204WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8205  const MagickWand *remap_wand,const DitherMethod method)
8206{
8207  MagickBooleanType
8208    status;
8209
8210  QuantizeInfo
8211    *quantize_info;
8212
8213  assert(wand != (MagickWand *) NULL);
8214  assert(wand->signature == WandSignature);
8215  if( IfMagickTrue(wand->debug) )
8216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8217
8218  if ((wand->images == (Image *) NULL) ||
8219      (remap_wand->images == (Image *) NULL))
8220    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8221  quantize_info=AcquireQuantizeInfo(wand->image_info);
8222  quantize_info->dither_method=method;
8223  if (method == NoDitherMethod)
8224    quantize_info->dither=MagickFalse;
8225  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8226    wand->exception);
8227  quantize_info=DestroyQuantizeInfo(quantize_info);
8228  return(status);
8229}
8230
8231/*
8232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8233%                                                                             %
8234%                                                                             %
8235%                                                                             %
8236%   M a g i c k R e m o v e I m a g e                                         %
8237%                                                                             %
8238%                                                                             %
8239%                                                                             %
8240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8241%
8242%  MagickRemoveImage() removes an image from the image list.
8243%
8244%  The format of the MagickRemoveImage method is:
8245%
8246%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8247%
8248%  A description of each parameter follows:
8249%
8250%    o wand: the magick wand.
8251%
8252%    o insert: the splice wand.
8253%
8254*/
8255WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8256{
8257  assert(wand != (MagickWand *) NULL);
8258  assert(wand->signature == WandSignature);
8259  if( IfMagickTrue(wand->debug) )
8260    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8261
8262  if (wand->images == (Image *) NULL)
8263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8264  DeleteImageFromList(&wand->images);
8265  return(MagickTrue);
8266}
8267
8268/*
8269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8270%                                                                             %
8271%                                                                             %
8272%                                                                             %
8273%   M a g i c k R e s a m p l e I m a g e                                     %
8274%                                                                             %
8275%                                                                             %
8276%                                                                             %
8277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8278%
8279%  MagickResampleImage() resample image to desired resolution.
8280%
8281%    Bessel   Blackman   Box
8282%    Catrom   Cubic      Gaussian
8283%    Hanning  Hermite    Lanczos
8284%    Mitchell Point      Quandratic
8285%    Sinc     Triangle
8286%
8287%  Most of the filters are FIR (finite impulse response), however, Bessel,
8288%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8289%  are windowed (brought down to zero) with the Blackman filter.
8290%
8291%  The format of the MagickResampleImage method is:
8292%
8293%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8294%        const double x_resolution,const double y_resolution,
8295%        const FilterTypes filter)
8296%
8297%  A description of each parameter follows:
8298%
8299%    o wand: the magick wand.
8300%
8301%    o x_resolution: the new image x resolution.
8302%
8303%    o y_resolution: the new image y resolution.
8304%
8305%    o filter: Image filter to use.
8306%
8307*/
8308WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8309  const double x_resolution,const double y_resolution,const FilterTypes filter)
8310{
8311  Image
8312    *resample_image;
8313
8314  assert(wand != (MagickWand *) NULL);
8315  assert(wand->signature == WandSignature);
8316  if( IfMagickTrue(wand->debug) )
8317    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8318
8319  if (wand->images == (Image *) NULL)
8320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8321  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8322    wand->exception);
8323  if (resample_image == (Image *) NULL)
8324    return(MagickFalse);
8325  ReplaceImageInList(&wand->images,resample_image);
8326  return(MagickTrue);
8327}
8328
8329/*
8330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8331%                                                                             %
8332%                                                                             %
8333%                                                                             %
8334%   M a g i c k R e s e t I m a g e P a g e                                   %
8335%                                                                             %
8336%                                                                             %
8337%                                                                             %
8338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8339%
8340%  MagickResetImagePage() resets the Wand page canvas and position.
8341%
8342%  The format of the MagickResetImagePage method is:
8343%
8344%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8345%        const char *page)
8346%
8347%  A description of each parameter follows:
8348%
8349%    o wand: the magick wand.
8350%
8351%    o page: the relative page specification.
8352%
8353*/
8354WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8355  const char *page)
8356{
8357  assert(wand != (MagickWand *) NULL);
8358  assert(wand->signature == WandSignature);
8359  if( IfMagickTrue(wand->debug) )
8360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8361
8362  if (wand->images == (Image *) NULL)
8363    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8364  if ((page == (char *) NULL) || (*page == '\0'))
8365    {
8366      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8367      return(MagickTrue);
8368    }
8369  return(ResetImagePage(wand->images,page));
8370}
8371
8372/*
8373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8374%                                                                             %
8375%                                                                             %
8376%                                                                             %
8377%   M a g i c k R e s i z e I m a g e                                         %
8378%                                                                             %
8379%                                                                             %
8380%                                                                             %
8381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8382%
8383%  MagickResizeImage() scales an image to the desired dimensions with one of
8384%  these filters:
8385%
8386%    Bessel   Blackman   Box
8387%    Catrom   Cubic      Gaussian
8388%    Hanning  Hermite    Lanczos
8389%    Mitchell Point      Quandratic
8390%    Sinc     Triangle
8391%
8392%  Most of the filters are FIR (finite impulse response), however, Bessel,
8393%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8394%  are windowed (brought down to zero) with the Blackman filter.
8395%
8396%  The format of the MagickResizeImage method is:
8397%
8398%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8399%        const size_t columns,const size_t rows,const FilterTypes filter)
8400%
8401%  A description of each parameter follows:
8402%
8403%    o wand: the magick wand.
8404%
8405%    o columns: the number of columns in the scaled image.
8406%
8407%    o rows: the number of rows in the scaled image.
8408%
8409%    o filter: Image filter to use.
8410%
8411*/
8412WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8413  const size_t columns,const size_t rows,const FilterTypes filter)
8414{
8415  Image
8416    *resize_image;
8417
8418  assert(wand != (MagickWand *) NULL);
8419  assert(wand->signature == WandSignature);
8420  if( IfMagickTrue(wand->debug) )
8421    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8422
8423  if (wand->images == (Image *) NULL)
8424    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8425  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8426  if (resize_image == (Image *) NULL)
8427    return(MagickFalse);
8428  ReplaceImageInList(&wand->images,resize_image);
8429  return(MagickTrue);
8430}
8431
8432/*
8433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8434%                                                                             %
8435%                                                                             %
8436%                                                                             %
8437%   M a g i c k R o l l I m a g e                                             %
8438%                                                                             %
8439%                                                                             %
8440%                                                                             %
8441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8442%
8443%  MagickRollImage() offsets an image as defined by x and y.
8444%
8445%  The format of the MagickRollImage method is:
8446%
8447%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8448%        const size_t y)
8449%
8450%  A description of each parameter follows:
8451%
8452%    o wand: the magick wand.
8453%
8454%    o x: the x offset.
8455%
8456%    o y: the y offset.
8457%
8458%
8459*/
8460WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8461  const ssize_t x,const ssize_t y)
8462{
8463  Image
8464    *roll_image;
8465
8466  assert(wand != (MagickWand *) NULL);
8467  assert(wand->signature == WandSignature);
8468  if( IfMagickTrue(wand->debug) )
8469    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8470
8471  if (wand->images == (Image *) NULL)
8472    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8473  roll_image=RollImage(wand->images,x,y,wand->exception);
8474  if (roll_image == (Image *) NULL)
8475    return(MagickFalse);
8476  ReplaceImageInList(&wand->images,roll_image);
8477  return(MagickTrue);
8478}
8479
8480/*
8481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8482%                                                                             %
8483%                                                                             %
8484%                                                                             %
8485%   M a g i c k R o t a t e I m a g e                                         %
8486%                                                                             %
8487%                                                                             %
8488%                                                                             %
8489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8490%
8491%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8492%  triangles left over from rotating the image are filled with the
8493%  background color.
8494%
8495%  The format of the MagickRotateImage method is:
8496%
8497%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8498%        const PixelWand *background,const double degrees)
8499%
8500%  A description of each parameter follows:
8501%
8502%    o wand: the magick wand.
8503%
8504%    o background: the background pixel wand.
8505%
8506%    o degrees: the number of degrees to rotate the image.
8507%
8508%
8509*/
8510WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8511  const PixelWand *background,const double degrees)
8512{
8513  Image
8514    *rotate_image;
8515
8516  assert(wand != (MagickWand *) NULL);
8517  assert(wand->signature == WandSignature);
8518  if( IfMagickTrue(wand->debug) )
8519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8520
8521  if (wand->images == (Image *) NULL)
8522    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8523  PixelGetQuantumPacket(background,&wand->images->background_color);
8524  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8525  if (rotate_image == (Image *) NULL)
8526    return(MagickFalse);
8527  ReplaceImageInList(&wand->images,rotate_image);
8528  return(MagickTrue);
8529}
8530
8531/*
8532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8533%                                                                             %
8534%                                                                             %
8535%                                                                             %
8536%   M a g i c k S a m p l e I m a g e                                         %
8537%                                                                             %
8538%                                                                             %
8539%                                                                             %
8540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8541%
8542%  MagickSampleImage() scales an image to the desired dimensions with pixel
8543%  sampling.  Unlike other scaling methods, this method does not introduce
8544%  any additional color into the scaled image.
8545%
8546%  The format of the MagickSampleImage method is:
8547%
8548%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8549%        const size_t columns,const size_t rows)
8550%
8551%  A description of each parameter follows:
8552%
8553%    o wand: the magick wand.
8554%
8555%    o columns: the number of columns in the scaled image.
8556%
8557%    o rows: the number of rows in the scaled image.
8558%
8559%
8560*/
8561WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8562  const size_t columns,const size_t rows)
8563{
8564  Image
8565    *sample_image;
8566
8567  assert(wand != (MagickWand *) NULL);
8568  assert(wand->signature == WandSignature);
8569  if( IfMagickTrue(wand->debug) )
8570    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8571
8572  if (wand->images == (Image *) NULL)
8573    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8574  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8575  if (sample_image == (Image *) NULL)
8576    return(MagickFalse);
8577  ReplaceImageInList(&wand->images,sample_image);
8578  return(MagickTrue);
8579}
8580
8581/*
8582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8583%                                                                             %
8584%                                                                             %
8585%                                                                             %
8586%   M a g i c k S c a l e I m a g e                                           %
8587%                                                                             %
8588%                                                                             %
8589%                                                                             %
8590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8591%
8592%  MagickScaleImage() scales the size of an image to the given dimensions.
8593%
8594%  The format of the MagickScaleImage method is:
8595%
8596%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8597%        const size_t columns,const size_t rows)
8598%
8599%  A description of each parameter follows:
8600%
8601%    o wand: the magick wand.
8602%
8603%    o columns: the number of columns in the scaled image.
8604%
8605%    o rows: the number of rows in the scaled image.
8606%
8607%
8608*/
8609WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8610  const size_t columns,const size_t rows)
8611{
8612  Image
8613    *scale_image;
8614
8615  assert(wand != (MagickWand *) NULL);
8616  assert(wand->signature == WandSignature);
8617  if( IfMagickTrue(wand->debug) )
8618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8619
8620  if (wand->images == (Image *) NULL)
8621    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8622  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8623  if (scale_image == (Image *) NULL)
8624    return(MagickFalse);
8625  ReplaceImageInList(&wand->images,scale_image);
8626  return(MagickTrue);
8627}
8628
8629/*
8630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8631%                                                                             %
8632%                                                                             %
8633%                                                                             %
8634%   M a g i c k S e g m e n t I m a g e                                       %
8635%                                                                             %
8636%                                                                             %
8637%                                                                             %
8638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8639%
8640%  MagickSegmentImage() segments an image by analyzing the histograms of the
8641%  color components and identifying units that are homogeneous with the fuzzy
8642%  C-means technique.
8643%
8644%  The format of the SegmentImage method is:
8645%
8646%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8647%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8648%        const double cluster_threshold,const double smooth_threshold)
8649%
8650%  A description of each parameter follows.
8651%
8652%    o wand: the wand.
8653%
8654%    o colorspace: the image colorspace.
8655%
8656%    o verbose:  Set to MagickTrue to print detailed information about the
8657%      identified classes.
8658%
8659%    o cluster_threshold:  This represents the minimum number of pixels
8660%      contained in a hexahedra before it can be considered valid (expressed as
8661%      a percentage).
8662%
8663%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8664%      derivative of the histogram.  As the value is increased, you can expect a
8665%      smoother second derivative.
8666%
8667*/
8668MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8669  const ColorspaceType colorspace,const MagickBooleanType verbose,
8670  const double cluster_threshold,const double smooth_threshold)
8671{
8672  MagickBooleanType
8673    status;
8674
8675  assert(wand != (MagickWand *) NULL);
8676  assert(wand->signature == WandSignature);
8677  if( IfMagickTrue(wand->debug) )
8678    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8679
8680  if (wand->images == (Image *) NULL)
8681    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8682  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8683    smooth_threshold,wand->exception);
8684  return(status);
8685}
8686
8687/*
8688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8693%                                                                             %
8694%                                                                             %
8695%                                                                             %
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%
8698%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8699%  threshold. It is similar to the unsharpen mask that sharpens everything with
8700%  contrast above a certain threshold.
8701%
8702%  The format of the MagickSelectiveBlurImage method is:
8703%
8704%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8705%        const double radius,const double sigma,const double threshold)
8706%
8707%  A description of each parameter follows:
8708%
8709%    o wand: the magick wand.
8710%
8711%    o radius: the radius of the gaussian, in pixels, not counting the center
8712%      pixel.
8713%
8714%    o sigma: the standard deviation of the gaussian, in pixels.
8715%
8716%    o threshold: only pixels within this contrast threshold are included
8717%      in the blur operation.
8718%
8719*/
8720WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8721  const double radius,const double sigma,const double threshold)
8722{
8723  Image
8724    *blur_image;
8725
8726  assert(wand != (MagickWand *) NULL);
8727  assert(wand->signature == WandSignature);
8728  if( IfMagickTrue(wand->debug) )
8729    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8730
8731  if (wand->images == (Image *) NULL)
8732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8733  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8734    wand->exception);
8735  if (blur_image == (Image *) NULL)
8736    return(MagickFalse);
8737  ReplaceImageInList(&wand->images,blur_image);
8738  return(MagickTrue);
8739}
8740
8741/*
8742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8743%                                                                             %
8744%                                                                             %
8745%                                                                             %
8746%   M a g i c k S e p a r a t e I m a g e C h a n n e l                       %
8747%                                                                             %
8748%                                                                             %
8749%                                                                             %
8750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8751%
8752%  MagickSeparateImage() separates a channel from the image and returns a
8753%  grayscale image.  A channel is a particular color component of each pixel
8754%  in the image.
8755%
8756%  The format of the MagickSeparateImage method is:
8757%
8758%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8759%        const ChannelType channel)
8760%
8761%  A description of each parameter follows:
8762%
8763%    o wand: the magick wand.
8764%
8765%    o channel: the channel.
8766%
8767*/
8768WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8769  const ChannelType channel)
8770{
8771  Image
8772    *separate_image;
8773
8774  assert(wand != (MagickWand *) NULL);
8775  assert(wand->signature == WandSignature);
8776  if( IfMagickTrue(wand->debug) )
8777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8778
8779  if (wand->images == (Image *) NULL)
8780    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8781  separate_image=SeparateImage(wand->images,channel,wand->exception);
8782  if (separate_image == (Image *) NULL)
8783    return(MagickFalse);
8784  ReplaceImageInList(&wand->images,separate_image);
8785  return(MagickTrue);
8786}
8787
8788/*
8789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8790%                                                                             %
8791%                                                                             %
8792%                                                                             %
8793%     M a g i c k S e p i a T o n e I m a g e                                 %
8794%                                                                             %
8795%                                                                             %
8796%                                                                             %
8797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8798%
8799%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8800%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8801%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8802%  threshold of 80% is a good starting point for a reasonable tone.
8803%
8804%  The format of the MagickSepiaToneImage method is:
8805%
8806%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8807%        const double threshold)
8808%
8809%  A description of each parameter follows:
8810%
8811%    o wand: the magick wand.
8812%
8813%    o threshold:  Define the extent of the sepia toning.
8814%
8815*/
8816WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8817  const double threshold)
8818{
8819  Image
8820    *sepia_image;
8821
8822  assert(wand != (MagickWand *) NULL);
8823  assert(wand->signature == WandSignature);
8824  if( IfMagickTrue(wand->debug) )
8825    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8826
8827  if (wand->images == (Image *) NULL)
8828    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8829  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8830  if (sepia_image == (Image *) NULL)
8831    return(MagickFalse);
8832  ReplaceImageInList(&wand->images,sepia_image);
8833  return(MagickTrue);
8834}
8835
8836/*
8837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8838%                                                                             %
8839%                                                                             %
8840%                                                                             %
8841%   M a g i c k S e t I m a g e                                               %
8842%                                                                             %
8843%                                                                             %
8844%                                                                             %
8845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8846%
8847%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8848%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8849%  wand.
8850%
8851%  The format of the MagickSetImage method is:
8852%
8853%      MagickBooleanType MagickSetImage(MagickWand *wand,
8854%        const MagickWand *set_wand)
8855%
8856%  A description of each parameter follows:
8857%
8858%    o wand: the magick wand.
8859%
8860%    o set_wand: the set_wand wand.
8861%
8862*/
8863WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8864  const MagickWand *set_wand)
8865{
8866  Image
8867    *images;
8868
8869  assert(wand != (MagickWand *) NULL);
8870  assert(wand->signature == WandSignature);
8871  if( IfMagickTrue(wand->debug) )
8872    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8873
8874  assert(set_wand != (MagickWand *) NULL);
8875  assert(set_wand->signature == WandSignature);
8876  if( IfMagickTrue(wand->debug) )
8877    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8878
8879  if (set_wand->images == (Image *) NULL)
8880    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8881  images=CloneImageList(set_wand->images,wand->exception);
8882  if (images == (Image *) NULL)
8883    return(MagickFalse);
8884  ReplaceImageInList(&wand->images,images);
8885  return(MagickTrue);
8886}
8887
8888/*
8889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8890%                                                                             %
8891%                                                                             %
8892%                                                                             %
8893%   M a g i c k S e t I m a g e A l p h a C h a n n e l                       %
8894%                                                                             %
8895%                                                                             %
8896%                                                                             %
8897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8898%
8899%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8900%  alpha channel.
8901%
8902%  The format of the MagickSetImageAlphaChannel method is:
8903%
8904%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8905%        const AlphaChannelType alpha_type)
8906%
8907%  A description of each parameter follows:
8908%
8909%    o wand: the magick wand.
8910%
8911%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8912%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8913%
8914*/
8915WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8916  const AlphaChannelType alpha_type)
8917{
8918  assert(wand != (MagickWand *) NULL);
8919  assert(wand->signature == WandSignature);
8920  if( IfMagickTrue(wand->debug) )
8921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8922
8923  if (wand->images == (Image *) NULL)
8924    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8925  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8926}
8927
8928/*
8929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8930%                                                                             %
8931%                                                                             %
8932%                                                                             %
8933%   M a g i c k S e t I m a g e B a c k g r o u n d C o l o r                 %
8934%                                                                             %
8935%                                                                             %
8936%                                                                             %
8937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8938%
8939%  MagickSetImageBackgroundColor() sets the image background color.
8940%
8941%  The format of the MagickSetImageBackgroundColor method is:
8942%
8943%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8944%        const PixelWand *background)
8945%
8946%  A description of each parameter follows:
8947%
8948%    o wand: the magick wand.
8949%
8950%    o background: the background pixel wand.
8951%
8952*/
8953WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8954  const PixelWand *background)
8955{
8956  assert(wand != (MagickWand *) NULL);
8957  assert(wand->signature == WandSignature);
8958  if( IfMagickTrue(wand->debug) )
8959    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8960
8961  if (wand->images == (Image *) NULL)
8962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8963  PixelGetQuantumPacket(background,&wand->images->background_color);
8964  return(MagickTrue);
8965}
8966
8967/*
8968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8969%                                                                             %
8970%                                                                             %
8971%                                                                             %
8972%   M a g i c k S e t I m a g e B l u e P r i m a r y                         %
8973%                                                                             %
8974%                                                                             %
8975%                                                                             %
8976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8977%
8978%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8979%
8980%  The format of the MagickSetImageBluePrimary method is:
8981%
8982%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8983%        const double x,const double y)
8984%
8985%  A description of each parameter follows:
8986%
8987%    o wand: the magick wand.
8988%
8989%    o x: the blue primary x-point.
8990%
8991%    o y: the blue primary y-point.
8992%
8993*/
8994WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8995  const double x,const double y)
8996{
8997  assert(wand != (MagickWand *) NULL);
8998  assert(wand->signature == WandSignature);
8999  if( IfMagickTrue(wand->debug) )
9000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9001
9002  if (wand->images == (Image *) NULL)
9003    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9004  wand->images->chromaticity.blue_primary.x=x;
9005  wand->images->chromaticity.blue_primary.y=y;
9006  return(MagickTrue);
9007}
9008
9009/*
9010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9011%                                                                             %
9012%                                                                             %
9013%                                                                             %
9014%   M a g i c k S e t I m a g e B o r d e r C o l o r                         %
9015%                                                                             %
9016%                                                                             %
9017%                                                                             %
9018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9019%
9020%  MagickSetImageBorderColor() sets the image border color.
9021%
9022%  The format of the MagickSetImageBorderColor method is:
9023%
9024%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9025%        const PixelWand *border)
9026%
9027%  A description of each parameter follows:
9028%
9029%    o wand: the magick wand.
9030%
9031%    o border: the border pixel wand.
9032%
9033*/
9034WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9035  const PixelWand *border)
9036{
9037  assert(wand != (MagickWand *) NULL);
9038  assert(wand->signature == WandSignature);
9039  if( IfMagickTrue(wand->debug) )
9040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9041
9042  if (wand->images == (Image *) NULL)
9043    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9044  PixelGetQuantumPacket(border,&wand->images->border_color);
9045  return(MagickTrue);
9046}
9047
9048/*
9049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9050%                                                                             %
9051%                                                                             %
9052%                                                                             %
9053%   M a g i c k S e t I m a g e C l i p M a s k                               %
9054%                                                                             %
9055%                                                                             %
9056%                                                                             %
9057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9058%
9059%  MagickSetImageMask() sets image clip mask.
9060%
9061%  The format of the MagickSetImageMask method is:
9062%
9063%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9064%        const MagickWand *clip_mask)
9065%
9066%  A description of each parameter follows:
9067%
9068%    o wand: the magick wand.
9069%
9070%    o clip_mask: the clip_mask wand.
9071%
9072*/
9073WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9074  const MagickWand *clip_mask)
9075{
9076  assert(wand != (MagickWand *) NULL);
9077  assert(wand->signature == WandSignature);
9078  if( IfMagickTrue(wand->debug) )
9079    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9080
9081  assert(clip_mask != (MagickWand *) NULL);
9082  assert(clip_mask->signature == WandSignature);
9083  if( IfMagickTrue(clip_mask->debug) )
9084    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9085
9086  if (clip_mask->images == (Image *) NULL)
9087    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9088  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9089}
9090
9091/*
9092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%   M a g i c k S e t I m a g e C o l o r                                     %
9097%                                                                             %
9098%                                                                             %
9099%                                                                             %
9100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9101%
9102%  MagickSetImageColor() set the entire wand canvas to the specified color.
9103%
9104%  The format of the MagickSetImageColor method is:
9105%
9106%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9107%        const PixelWand *color)
9108%
9109%  A description of each parameter follows:
9110%
9111%    o wand: the magick wand.
9112%
9113%    o background: the image color.
9114%
9115*/
9116WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9117  const PixelWand *color)
9118{
9119  PixelInfo
9120    pixel;
9121
9122  assert(wand != (MagickWand *) NULL);
9123  assert(wand->signature == WandSignature);
9124  if( IfMagickTrue(wand->debug) )
9125    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9126
9127  PixelGetMagickColor(color,&pixel);
9128  return(SetImageColor(wand->images,&pixel,wand->exception));
9129}
9130
9131/*
9132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9133%                                                                             %
9134%                                                                             %
9135%                                                                             %
9136%   M a g i c k S e t I m a g e C o l o r m a p C o l o r                     %
9137%                                                                             %
9138%                                                                             %
9139%                                                                             %
9140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9141%
9142%  MagickSetImageColormapColor() sets the color of the specified colormap
9143%  index.
9144%
9145%  The format of the MagickSetImageColormapColor method is:
9146%
9147%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9148%        const size_t index,const PixelWand *color)
9149%
9150%  A description of each parameter follows:
9151%
9152%    o wand: the magick wand.
9153%
9154%    o index: the offset into the image colormap.
9155%
9156%    o color: Return the colormap color in this wand.
9157%
9158*/
9159WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9160  const size_t index,const PixelWand *color)
9161{
9162  assert(wand != (MagickWand *) NULL);
9163  assert(wand->signature == WandSignature);
9164  if( IfMagickTrue(wand->debug) )
9165    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9166
9167  if (wand->images == (Image *) NULL)
9168    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9169  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9170      (index >= wand->images->colors))
9171    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9172  PixelGetQuantumPacket(color,wand->images->colormap+index);
9173  return(SyncImage(wand->images,wand->exception));
9174}
9175
9176/*
9177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9178%                                                                             %
9179%                                                                             %
9180%                                                                             %
9181%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9182%                                                                             %
9183%                                                                             %
9184%                                                                             %
9185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9186%
9187%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9188%  the image data.
9189%
9190%  The format of the MagickSetImageColorspace method is:
9191%
9192%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9193%        const ColorspaceType colorspace)
9194%
9195%  A description of each parameter follows:
9196%
9197%    o wand: the magick wand.
9198%
9199%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9200%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9201%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9202%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9203%      HSLColorspace, or HWBColorspace.
9204%
9205*/
9206WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9207  const ColorspaceType colorspace)
9208{
9209  assert(wand != (MagickWand *) NULL);
9210  assert(wand->signature == WandSignature);
9211  if( IfMagickTrue(wand->debug) )
9212    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9213
9214  if (wand->images == (Image *) NULL)
9215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9216  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9217}
9218
9219/*
9220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9221%                                                                             %
9222%                                                                             %
9223%                                                                             %
9224%   M a g i c k S e t I m a g e C o m p o s e                                 %
9225%                                                                             %
9226%                                                                             %
9227%                                                                             %
9228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9229%
9230%  MagickSetImageCompose() sets the image composite operator, useful for
9231%  specifying how to composite the image thumbnail when using the
9232%  MagickMontageImage() method.
9233%
9234%  The format of the MagickSetImageCompose method is:
9235%
9236%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9237%        const CompositeOperator compose)
9238%
9239%  A description of each parameter follows:
9240%
9241%    o wand: the magick wand.
9242%
9243%    o compose: the image composite operator.
9244%
9245*/
9246WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9247  const CompositeOperator compose)
9248{
9249  assert(wand != (MagickWand *) NULL);
9250  assert(wand->signature == WandSignature);
9251  if( IfMagickTrue(wand->debug) )
9252    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9253
9254  if (wand->images == (Image *) NULL)
9255    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9256  wand->images->compose=compose;
9257  return(MagickTrue);
9258}
9259
9260/*
9261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9262%                                                                             %
9263%                                                                             %
9264%                                                                             %
9265%   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                         %
9266%                                                                             %
9267%                                                                             %
9268%                                                                             %
9269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9270%
9271%  MagickSetImageCompression() sets the image compression.
9272%
9273%  The format of the MagickSetImageCompression method is:
9274%
9275%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9276%        const CompressionType compression)
9277%
9278%  A description of each parameter follows:
9279%
9280%    o wand: the magick wand.
9281%
9282%    o compression: the image compression type.
9283%
9284*/
9285WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9286  const CompressionType compression)
9287{
9288  assert(wand != (MagickWand *) NULL);
9289  assert(wand->signature == WandSignature);
9290  if( IfMagickTrue(wand->debug) )
9291    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9292
9293  if (wand->images == (Image *) NULL)
9294    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9295  wand->images->compression=compression;
9296  return(MagickTrue);
9297}
9298
9299/*
9300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9301%                                                                             %
9302%                                                                             %
9303%                                                                             %
9304%   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           %
9305%                                                                             %
9306%                                                                             %
9307%                                                                             %
9308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9309%
9310%  MagickSetImageCompressionQuality() sets the image compression quality.
9311%
9312%  The format of the MagickSetImageCompressionQuality method is:
9313%
9314%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9315%        const size_t quality)
9316%
9317%  A description of each parameter follows:
9318%
9319%    o wand: the magick wand.
9320%
9321%    o quality: the image compression tlityype.
9322%
9323*/
9324WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9325  const size_t quality)
9326{
9327  assert(wand != (MagickWand *) NULL);
9328  assert(wand->signature == WandSignature);
9329  if( IfMagickTrue(wand->debug) )
9330    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9331
9332  if (wand->images == (Image *) NULL)
9333    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9334  wand->images->quality=quality;
9335  return(MagickTrue);
9336}
9337
9338/*
9339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9340%                                                                             %
9341%                                                                             %
9342%                                                                             %
9343%   M a g i c k S e t I m a g e D e l a y                                     %
9344%                                                                             %
9345%                                                                             %
9346%                                                                             %
9347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9348%
9349%  MagickSetImageDelay() sets the image delay.
9350%
9351%  The format of the MagickSetImageDelay method is:
9352%
9353%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9354%        const size_t delay)
9355%
9356%  A description of each parameter follows:
9357%
9358%    o wand: the magick wand.
9359%
9360%    o delay: the image delay in ticks-per-second units.
9361%
9362*/
9363WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9364  const size_t delay)
9365{
9366  assert(wand != (MagickWand *) NULL);
9367  assert(wand->signature == WandSignature);
9368  if( IfMagickTrue(wand->debug) )
9369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9370
9371  if (wand->images == (Image *) NULL)
9372    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9373  wand->images->delay=delay;
9374  return(MagickTrue);
9375}
9376
9377/*
9378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9379%                                                                             %
9380%                                                                             %
9381%                                                                             %
9382%   M a g i c k S e t I m a g e D e p t h                                     %
9383%                                                                             %
9384%                                                                             %
9385%                                                                             %
9386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9387%
9388%  MagickSetImageDepth() sets the image depth.
9389%
9390%  The format of the MagickSetImageDepth method is:
9391%
9392%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9393%        const size_t depth)
9394%
9395%  A description of each parameter follows:
9396%
9397%    o wand: the magick wand.
9398%
9399%    o depth: the image depth in bits: 8, 16, or 32.
9400%
9401*/
9402WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9403  const size_t depth)
9404{
9405  assert(wand != (MagickWand *) NULL);
9406  assert(wand->signature == WandSignature);
9407  if( IfMagickTrue(wand->debug) )
9408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9409
9410  if (wand->images == (Image *) NULL)
9411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9412  return(SetImageDepth(wand->images,depth,wand->exception));
9413}
9414
9415/*
9416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9417%                                                                             %
9418%                                                                             %
9419%                                                                             %
9420%   M a g i c k S e t I m a g e D i s p o s e                                 %
9421%                                                                             %
9422%                                                                             %
9423%                                                                             %
9424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9425%
9426%  MagickSetImageDispose() sets the image disposal method.
9427%
9428%  The format of the MagickSetImageDispose method is:
9429%
9430%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9431%        const DisposeType dispose)
9432%
9433%  A description of each parameter follows:
9434%
9435%    o wand: the magick wand.
9436%
9437%    o dispose: the image disposeal type.
9438%
9439*/
9440WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9441  const DisposeType dispose)
9442{
9443  assert(wand != (MagickWand *) NULL);
9444  assert(wand->signature == WandSignature);
9445  if( IfMagickTrue(wand->debug) )
9446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9447
9448  if (wand->images == (Image *) NULL)
9449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450  wand->images->dispose=dispose;
9451  return(MagickTrue);
9452}
9453
9454/*
9455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9456%                                                                             %
9457%                                                                             %
9458%                                                                             %
9459%   M a g i c k S e t I m a g e E x t e n t                                   %
9460%                                                                             %
9461%                                                                             %
9462%                                                                             %
9463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464%
9465%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9466%
9467%  The format of the MagickSetImageExtent method is:
9468%
9469%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9470%        const size_t columns,const unsigned rows)
9471%
9472%  A description of each parameter follows:
9473%
9474%    o wand: the magick wand.
9475%
9476%    o columns:  The image width in pixels.
9477%
9478%    o rows:  The image height in pixels.
9479%
9480*/
9481WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9482  const size_t columns,const size_t rows)
9483{
9484  assert(wand != (MagickWand *) NULL);
9485  assert(wand->signature == WandSignature);
9486  if( IfMagickTrue(wand->debug) )
9487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9488
9489  if (wand->images == (Image *) NULL)
9490    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9491  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9492}
9493
9494/*
9495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9496%                                                                             %
9497%                                                                             %
9498%                                                                             %
9499%   M a g i c k S e t I m a g e F i l e n a m e                               %
9500%                                                                             %
9501%                                                                             %
9502%                                                                             %
9503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9504%
9505%  MagickSetImageFilename() sets the filename of a particular image in a
9506%  sequence.
9507%
9508%  The format of the MagickSetImageFilename method is:
9509%
9510%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9511%        const char *filename)
9512%
9513%  A description of each parameter follows:
9514%
9515%    o wand: the magick wand.
9516%
9517%    o filename: the image filename.
9518%
9519*/
9520WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9521  const char *filename)
9522{
9523  assert(wand != (MagickWand *) NULL);
9524  assert(wand->signature == WandSignature);
9525  if( IfMagickTrue(wand->debug) )
9526    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9527
9528  if (wand->images == (Image *) NULL)
9529    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9530  if (filename != (const char *) NULL)
9531    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9532  return(MagickTrue);
9533}
9534
9535/*
9536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9537%                                                                             %
9538%                                                                             %
9539%                                                                             %
9540%   M a g i c k S e t I m a g e F o r m a t                                   %
9541%                                                                             %
9542%                                                                             %
9543%                                                                             %
9544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9545%
9546%  MagickSetImageFormat() sets the format of a particular image in a
9547%  sequence.
9548%
9549%  The format of the MagickSetImageFormat method is:
9550%
9551%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9552%        const char *format)
9553%
9554%  A description of each parameter follows:
9555%
9556%    o wand: the magick wand.
9557%
9558%    o format: the image format.
9559%
9560*/
9561WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9562  const char *format)
9563{
9564  const MagickInfo
9565    *magick_info;
9566
9567  assert(wand != (MagickWand *) NULL);
9568  assert(wand->signature == WandSignature);
9569  if( IfMagickTrue(wand->debug) )
9570    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9571
9572  if (wand->images == (Image *) NULL)
9573    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9574  if ((format == (char *) NULL) || (*format == '\0'))
9575    {
9576      *wand->images->magick='\0';
9577      return(MagickTrue);
9578    }
9579  magick_info=GetMagickInfo(format,wand->exception);
9580  if (magick_info == (const MagickInfo *) NULL)
9581    return(MagickFalse);
9582  ClearMagickException(wand->exception);
9583  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9584  return(MagickTrue);
9585}
9586
9587/*
9588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9589%                                                                             %
9590%                                                                             %
9591%                                                                             %
9592%   M a g i c k S e t I m a g e F u z z                                       %
9593%                                                                             %
9594%                                                                             %
9595%                                                                             %
9596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9597%
9598%  MagickSetImageFuzz() sets the image fuzz.
9599%
9600%  The format of the MagickSetImageFuzz method is:
9601%
9602%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9603%        const double fuzz)
9604%
9605%  A description of each parameter follows:
9606%
9607%    o wand: the magick wand.
9608%
9609%    o fuzz: the image fuzz.
9610%
9611*/
9612WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9613  const double fuzz)
9614{
9615  assert(wand != (MagickWand *) NULL);
9616  assert(wand->signature == WandSignature);
9617  if( IfMagickTrue(wand->debug) )
9618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9619
9620  if (wand->images == (Image *) NULL)
9621    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9622  wand->images->fuzz=fuzz;
9623  return(MagickTrue);
9624}
9625
9626/*
9627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9628%                                                                             %
9629%                                                                             %
9630%                                                                             %
9631%   M a g i c k S e t I m a g e G a m m a                                     %
9632%                                                                             %
9633%                                                                             %
9634%                                                                             %
9635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9636%
9637%  MagickSetImageGamma() sets the image gamma.
9638%
9639%  The format of the MagickSetImageGamma method is:
9640%
9641%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9642%        const double gamma)
9643%
9644%  A description of each parameter follows:
9645%
9646%    o wand: the magick wand.
9647%
9648%    o gamma: the image gamma.
9649%
9650*/
9651WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9652  const double gamma)
9653{
9654  assert(wand != (MagickWand *) NULL);
9655  assert(wand->signature == WandSignature);
9656  if( IfMagickTrue(wand->debug) )
9657    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9658
9659  if (wand->images == (Image *) NULL)
9660    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9661  wand->images->gamma=gamma;
9662  return(MagickTrue);
9663}
9664
9665/*
9666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9667%                                                                             %
9668%                                                                             %
9669%                                                                             %
9670%   M a g i c k S e t I m a g e G r a v i t y                                 %
9671%                                                                             %
9672%                                                                             %
9673%                                                                             %
9674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9675%
9676%  MagickSetImageGravity() sets the image gravity type.
9677%
9678%  The format of the MagickSetImageGravity method is:
9679%
9680%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9681%        const GravityType gravity)
9682%
9683%  A description of each parameter follows:
9684%
9685%    o wand: the magick wand.
9686%
9687%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9688%      PlaneInterlace, PartitionInterlace.
9689%
9690*/
9691WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9692  const GravityType gravity)
9693{
9694  assert(wand != (MagickWand *) NULL);
9695  assert(wand->signature == WandSignature);
9696  if( IfMagickTrue(wand->debug) )
9697    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9698
9699  if (wand->images == (Image *) NULL)
9700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9701  wand->images->gravity=gravity;
9702  return(MagickTrue);
9703}
9704
9705/*
9706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9707%                                                                             %
9708%                                                                             %
9709%                                                                             %
9710%   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                       %
9711%                                                                             %
9712%                                                                             %
9713%                                                                             %
9714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9715%
9716%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9717%  point.
9718%
9719%  The format of the MagickSetImageGreenPrimary method is:
9720%
9721%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9722%        const double x,const double y)
9723%
9724%  A description of each parameter follows:
9725%
9726%    o wand: the magick wand.
9727%
9728%    o x: the green primary x-point.
9729%
9730%    o y: the green primary y-point.
9731%
9732%
9733*/
9734WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9735  const double x,const double y)
9736{
9737  assert(wand != (MagickWand *) NULL);
9738  assert(wand->signature == WandSignature);
9739  if( IfMagickTrue(wand->debug) )
9740    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9741
9742  if (wand->images == (Image *) NULL)
9743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9744  wand->images->chromaticity.green_primary.x=x;
9745  wand->images->chromaticity.green_primary.y=y;
9746  return(MagickTrue);
9747}
9748
9749/*
9750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9751%                                                                             %
9752%                                                                             %
9753%                                                                             %
9754%   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                 %
9755%                                                                             %
9756%                                                                             %
9757%                                                                             %
9758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9759%
9760%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9761%
9762%  The format of the MagickSetImageInterlaceScheme method is:
9763%
9764%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9765%        const InterlaceType interlace)
9766%
9767%  A description of each parameter follows:
9768%
9769%    o wand: the magick wand.
9770%
9771%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9772%      PlaneInterlace, PartitionInterlace.
9773%
9774*/
9775WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9776  const InterlaceType interlace)
9777{
9778  assert(wand != (MagickWand *) NULL);
9779  assert(wand->signature == WandSignature);
9780  if( IfMagickTrue(wand->debug) )
9781    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9782
9783  if (wand->images == (Image *) NULL)
9784    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9785  wand->images->interlace=interlace;
9786  return(MagickTrue);
9787}
9788
9789/*
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%                                                                             %
9792%                                                                             %
9793%                                                                             %
9794%   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             %
9795%                                                                             %
9796%                                                                             %
9797%                                                                             %
9798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9799%
9800%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9801%
9802%  The format of the MagickSetImagePixelInterpolateMethod method is:
9803%
9804%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9805%        const PixelInterpolateMethod method)
9806%
9807%  A description of each parameter follows:
9808%
9809%    o wand: the magick wand.
9810%
9811%    o method: the image interpole pixel methods: choose from Undefined,
9812%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9813%
9814*/
9815WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9816  const PixelInterpolateMethod method)
9817{
9818  assert(wand != (MagickWand *) NULL);
9819  assert(wand->signature == WandSignature);
9820  if( IfMagickTrue(wand->debug) )
9821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9822
9823  if (wand->images == (Image *) NULL)
9824    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9825  wand->images->interpolate=method;
9826  return(MagickTrue);
9827}
9828
9829/*
9830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9831%                                                                             %
9832%                                                                             %
9833%                                                                             %
9834%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9835%                                                                             %
9836%                                                                             %
9837%                                                                             %
9838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9839%
9840%  MagickSetImageIterations() sets the image iterations.
9841%
9842%  The format of the MagickSetImageIterations method is:
9843%
9844%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9845%        const size_t iterations)
9846%
9847%  A description of each parameter follows:
9848%
9849%    o wand: the magick wand.
9850%
9851%    o delay: the image delay in 1/100th of a second.
9852%
9853*/
9854WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9855  const size_t iterations)
9856{
9857  assert(wand != (MagickWand *) NULL);
9858  assert(wand->signature == WandSignature);
9859  if( IfMagickTrue(wand->debug) )
9860    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9861
9862  if (wand->images == (Image *) NULL)
9863    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9864  wand->images->iterations=iterations;
9865  return(MagickTrue);
9866}
9867
9868/*
9869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9870%                                                                             %
9871%                                                                             %
9872%                                                                             %
9873%   M a g i c k S e t I m a g e M a t t e                                     %
9874%                                                                             %
9875%                                                                             %
9876%                                                                             %
9877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9878%
9879%  MagickSetImageMatte() sets the image matte channel.
9880%
9881%  The format of the MagickSetImageMatteColor method is:
9882%
9883%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9884%        const MagickBooleanType *matte)
9885%
9886%  A description of each parameter follows:
9887%
9888%    o wand: the magick wand.
9889%
9890%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9891%      MagickFalse.
9892%
9893*/
9894WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9895  const MagickBooleanType matte)
9896{
9897  assert(wand != (MagickWand *) NULL);
9898  assert(wand->signature == WandSignature);
9899  if( IfMagickTrue(wand->debug) )
9900    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9901
9902  if (wand->images == (Image *) NULL)
9903    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9904  if( IfMagickFalse(wand->images->matte) && IsMagickTrue(matte))
9905    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9906  wand->images->matte=matte;
9907  return(MagickTrue);
9908}
9909
9910/*
9911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9912%                                                                             %
9913%                                                                             %
9914%                                                                             %
9915%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9916%                                                                             %
9917%                                                                             %
9918%                                                                             %
9919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9920%
9921%  MagickSetImageMatteColor() sets the image matte color.
9922%
9923%  The format of the MagickSetImageMatteColor method is:
9924%
9925%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9926%        const PixelWand *matte)
9927%
9928%  A description of each parameter follows:
9929%
9930%    o wand: the magick wand.
9931%
9932%    o matte: the matte pixel wand.
9933%
9934*/
9935WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9936  const PixelWand *matte)
9937{
9938  assert(wand != (MagickWand *) NULL);
9939  assert(wand->signature == WandSignature);
9940  if( IfMagickTrue(wand->debug) )
9941    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9942
9943  if (wand->images == (Image *) NULL)
9944    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9945  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9946  return(MagickTrue);
9947}
9948
9949/*
9950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9951%                                                                             %
9952%                                                                             %
9953%                                                                             %
9954%   M a g i c k S e t I m a g e O p a c i t y                                 %
9955%                                                                             %
9956%                                                                             %
9957%                                                                             %
9958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9959%
9960%  MagickSetImageAlpha() sets the image to the specified alpha level.
9961%
9962%  The format of the MagickSetImageAlpha method is:
9963%
9964%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9965%        const double alpha)
9966%
9967%  A description of each parameter follows:
9968%
9969%    o wand: the magick wand.
9970%
9971%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9972%      transparent.
9973%
9974*/
9975WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9976  const double alpha)
9977{
9978  MagickBooleanType
9979    status;
9980
9981  assert(wand != (MagickWand *) NULL);
9982  assert(wand->signature == WandSignature);
9983  if( IfMagickTrue(wand->debug) )
9984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9985
9986  if (wand->images == (Image *) NULL)
9987    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9988  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9989    wand->exception);
9990  return(status);
9991}
9992
9993/*
9994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9995%                                                                             %
9996%                                                                             %
9997%                                                                             %
9998%   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                         %
9999%                                                                             %
10000%                                                                             %
10001%                                                                             %
10002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10003%
10004%  MagickSetImageOrientation() sets the image orientation.
10005%
10006%  The format of the MagickSetImageOrientation method is:
10007%
10008%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10009%        const OrientationType orientation)
10010%
10011%  A description of each parameter follows:
10012%
10013%    o wand: the magick wand.
10014%
10015%    o orientation: the image orientation type.
10016%
10017*/
10018WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10019  const OrientationType orientation)
10020{
10021  assert(wand != (MagickWand *) NULL);
10022  assert(wand->signature == WandSignature);
10023  if( IfMagickTrue(wand->debug) )
10024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10025
10026  if (wand->images == (Image *) NULL)
10027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10028  wand->images->orientation=orientation;
10029  return(MagickTrue);
10030}
10031
10032/*
10033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10034%                                                                             %
10035%                                                                             %
10036%                                                                             %
10037%   M a g i c k S e t I m a g e P a g e                                       %
10038%                                                                             %
10039%                                                                             %
10040%                                                                             %
10041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10042%
10043%  MagickSetImagePage() sets the page geometry of the image.
10044%
10045%  The format of the MagickSetImagePage method is:
10046%
10047%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10048%        const size_t width,const size_t height,const ssize_t x,
10049%        const ssize_t y)
10050%
10051%  A description of each parameter follows:
10052%
10053%    o wand: the magick wand.
10054%
10055%    o width: the page width.
10056%
10057%    o height: the page height.
10058%
10059%    o x: the page x-offset.
10060%
10061%    o y: the page y-offset.
10062%
10063*/
10064WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10065  const size_t width,const size_t height,const ssize_t x,
10066  const ssize_t y)
10067{
10068  assert(wand != (MagickWand *) NULL);
10069  assert(wand->signature == WandSignature);
10070  if( IfMagickTrue(wand->debug) )
10071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10072
10073  if (wand->images == (Image *) NULL)
10074    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10075  wand->images->page.width=width;
10076  wand->images->page.height=height;
10077  wand->images->page.x=x;
10078  wand->images->page.y=y;
10079  return(MagickTrue);
10080}
10081
10082/*
10083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10084%                                                                             %
10085%                                                                             %
10086%                                                                             %
10087%   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                 %
10088%                                                                             %
10089%                                                                             %
10090%                                                                             %
10091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10092%
10093%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10094%  specified method and returns the previous progress monitor if any.  The
10095%  progress monitor method looks like this:
10096%
10097%    MagickBooleanType MagickProgressMonitor(const char *text,
10098%      const MagickOffsetType offset,const MagickSizeType span,
10099%      void *client_data)
10100%
10101%  If the progress monitor returns MagickFalse, the current operation is
10102%  interrupted.
10103%
10104%  The format of the MagickSetImageProgressMonitor method is:
10105%
10106%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10107%        const MagickProgressMonitor progress_monitor,void *client_data)
10108%
10109%  A description of each parameter follows:
10110%
10111%    o wand: the magick wand.
10112%
10113%    o progress_monitor: Specifies a pointer to a method to monitor progress
10114%      of an image operation.
10115%
10116%    o client_data: Specifies a pointer to any client data.
10117%
10118*/
10119WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10120  const MagickProgressMonitor progress_monitor,void *client_data)
10121{
10122  MagickProgressMonitor
10123    previous_monitor;
10124
10125  assert(wand != (MagickWand *) NULL);
10126  assert(wand->signature == WandSignature);
10127  if( IfMagickTrue(wand->debug) )
10128    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10129
10130  if (wand->images == (Image *) NULL)
10131    {
10132      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10133        "ContainsNoImages","'%s'",wand->name);
10134      return((MagickProgressMonitor) NULL);
10135    }
10136  previous_monitor=SetImageProgressMonitor(wand->images,
10137    progress_monitor,client_data);
10138  return(previous_monitor);
10139}
10140
10141/*
10142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10143%                                                                             %
10144%                                                                             %
10145%                                                                             %
10146%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10147%                                                                             %
10148%                                                                             %
10149%                                                                             %
10150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10151%
10152%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10153%
10154%  The format of the MagickSetImageRedPrimary method is:
10155%
10156%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10157%        const double x,const double y)
10158%
10159%  A description of each parameter follows:
10160%
10161%    o wand: the magick wand.
10162%
10163%    o x: the red primary x-point.
10164%
10165%    o y: the red primary y-point.
10166%
10167*/
10168WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10169  const double x,const double y)
10170{
10171  assert(wand != (MagickWand *) NULL);
10172  assert(wand->signature == WandSignature);
10173  if( IfMagickTrue(wand->debug) )
10174    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10175
10176  if (wand->images == (Image *) NULL)
10177    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10178  wand->images->chromaticity.red_primary.x=x;
10179  wand->images->chromaticity.red_primary.y=y;
10180  return(MagickTrue);
10181}
10182
10183/*
10184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10185%                                                                             %
10186%                                                                             %
10187%                                                                             %
10188%   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                 %
10189%                                                                             %
10190%                                                                             %
10191%                                                                             %
10192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10193%
10194%  MagickSetImageRenderingIntent() sets the image rendering intent.
10195%
10196%  The format of the MagickSetImageRenderingIntent method is:
10197%
10198%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10199%        const RenderingIntent rendering_intent)
10200%
10201%  A description of each parameter follows:
10202%
10203%    o wand: the magick wand.
10204%
10205%    o rendering_intent: the image rendering intent: UndefinedIntent,
10206%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10207%
10208*/
10209WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10210  const RenderingIntent rendering_intent)
10211{
10212  assert(wand != (MagickWand *) NULL);
10213  assert(wand->signature == WandSignature);
10214  if( IfMagickTrue(wand->debug) )
10215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10216
10217  if (wand->images == (Image *) NULL)
10218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10219  wand->images->rendering_intent=rendering_intent;
10220  return(MagickTrue);
10221}
10222
10223/*
10224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10225%                                                                             %
10226%                                                                             %
10227%                                                                             %
10228%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10229%                                                                             %
10230%                                                                             %
10231%                                                                             %
10232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10233%
10234%  MagickSetImageResolution() sets the image resolution.
10235%
10236%  The format of the MagickSetImageResolution method is:
10237%
10238%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10239%        const double x_resolution,const doubtl y_resolution)
10240%
10241%  A description of each parameter follows:
10242%
10243%    o wand: the magick wand.
10244%
10245%    o x_resolution: the image x resolution.
10246%
10247%    o y_resolution: the image y resolution.
10248%
10249*/
10250WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10251  const double x_resolution,const double y_resolution)
10252{
10253  assert(wand != (MagickWand *) NULL);
10254  assert(wand->signature == WandSignature);
10255  if( IfMagickTrue(wand->debug) )
10256    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10257
10258  if (wand->images == (Image *) NULL)
10259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10260  wand->images->resolution.x=x_resolution;
10261  wand->images->resolution.y=y_resolution;
10262  return(MagickTrue);
10263}
10264
10265/*
10266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10267%                                                                             %
10268%                                                                             %
10269%                                                                             %
10270%   M a g i c k S e t I m a g e S c e n e                                     %
10271%                                                                             %
10272%                                                                             %
10273%                                                                             %
10274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10275%
10276%  MagickSetImageScene() sets the image scene.
10277%
10278%  The format of the MagickSetImageScene method is:
10279%
10280%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10281%        const size_t scene)
10282%
10283%  A description of each parameter follows:
10284%
10285%    o wand: the magick wand.
10286%
10287%    o delay: the image scene number.
10288%
10289*/
10290WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10291  const size_t scene)
10292{
10293  assert(wand != (MagickWand *) NULL);
10294  assert(wand->signature == WandSignature);
10295  if( IfMagickTrue(wand->debug) )
10296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10297
10298  if (wand->images == (Image *) NULL)
10299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10300  wand->images->scene=scene;
10301  return(MagickTrue);
10302}
10303
10304/*
10305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10306%                                                                             %
10307%                                                                             %
10308%                                                                             %
10309%   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                   %
10310%                                                                             %
10311%                                                                             %
10312%                                                                             %
10313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10314%
10315%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10316%
10317%  The format of the MagickSetImageTicksPerSecond method is:
10318%
10319%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10320%        const ssize_t ticks_per-second)
10321%
10322%  A description of each parameter follows:
10323%
10324%    o wand: the magick wand.
10325%
10326%    o ticks_per_second: the units to use for the image delay.
10327%
10328*/
10329WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10330  const ssize_t ticks_per_second)
10331{
10332  assert(wand != (MagickWand *) NULL);
10333  assert(wand->signature == WandSignature);
10334  if( IfMagickTrue(wand->debug) )
10335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10336
10337  if (wand->images == (Image *) NULL)
10338    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10339  wand->images->ticks_per_second=ticks_per_second;
10340  return(MagickTrue);
10341}
10342
10343/*
10344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10345%                                                                             %
10346%                                                                             %
10347%                                                                             %
10348%   M a g i c k S e t I m a g e T y p e                                       %
10349%                                                                             %
10350%                                                                             %
10351%                                                                             %
10352%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10353%
10354%  MagickSetImageType() sets the image type.
10355%
10356%  The format of the MagickSetImageType method is:
10357%
10358%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10359%        const ImageType image_type)
10360%
10361%  A description of each parameter follows:
10362%
10363%    o wand: the magick wand.
10364%
10365%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10366%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10367%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10368%      or OptimizeType.
10369%
10370*/
10371WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10372  const ImageType image_type)
10373{
10374  assert(wand != (MagickWand *) NULL);
10375  assert(wand->signature == WandSignature);
10376  if( IfMagickTrue(wand->debug) )
10377    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10378
10379  if (wand->images == (Image *) NULL)
10380    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10381  return(SetImageType(wand->images,image_type,wand->exception));
10382}
10383
10384/*
10385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10386%                                                                             %
10387%                                                                             %
10388%                                                                             %
10389%   M a g i c k S e t I m a g e U n i t s                                     %
10390%                                                                             %
10391%                                                                             %
10392%                                                                             %
10393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10394%
10395%  MagickSetImageUnits() sets the image units of resolution.
10396%
10397%  The format of the MagickSetImageUnits method is:
10398%
10399%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10400%        const ResolutionType units)
10401%
10402%  A description of each parameter follows:
10403%
10404%    o wand: the magick wand.
10405%
10406%    o units: the image units of resolution : UndefinedResolution,
10407%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10408%
10409*/
10410WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10411  const ResolutionType units)
10412{
10413  assert(wand != (MagickWand *) NULL);
10414  assert(wand->signature == WandSignature);
10415  if( IfMagickTrue(wand->debug) )
10416    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10417
10418  if (wand->images == (Image *) NULL)
10419    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10420  wand->images->units=units;
10421  return(MagickTrue);
10422}
10423
10424/*
10425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10426%                                                                             %
10427%                                                                             %
10428%                                                                             %
10429%   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           %
10430%                                                                             %
10431%                                                                             %
10432%                                                                             %
10433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10434%
10435%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10436%
10437%  The format of the MagickSetImageVirtualPixelMethod method is:
10438%
10439%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10440%        const VirtualPixelMethod method)
10441%
10442%  A description of each parameter follows:
10443%
10444%    o wand: the magick wand.
10445%
10446%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10447%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10448%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10449%
10450*/
10451WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10452  const VirtualPixelMethod method)
10453{
10454  assert(wand != (MagickWand *) NULL);
10455  assert(wand->signature == WandSignature);
10456  if( IfMagickTrue(wand->debug) )
10457    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10458
10459  if (wand->images == (Image *) NULL)
10460    return(UndefinedVirtualPixelMethod);
10461  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10462}
10463
10464/*
10465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10466%                                                                             %
10467%                                                                             %
10468%                                                                             %
10469%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10470%                                                                             %
10471%                                                                             %
10472%                                                                             %
10473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10474%
10475%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10476%
10477%  The format of the MagickSetImageWhitePoint method is:
10478%
10479%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10480%        const double x,const double y)
10481%
10482%  A description of each parameter follows:
10483%
10484%    o wand: the magick wand.
10485%
10486%    o x: the white x-point.
10487%
10488%    o y: the white y-point.
10489%
10490*/
10491WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10492  const double x,const double y)
10493{
10494  assert(wand != (MagickWand *) NULL);
10495  assert(wand->signature == WandSignature);
10496  if( IfMagickTrue(wand->debug) )
10497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10498
10499  if (wand->images == (Image *) NULL)
10500    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10501  wand->images->chromaticity.white_point.x=x;
10502  wand->images->chromaticity.white_point.y=y;
10503  return(MagickTrue);
10504}
10505
10506/*
10507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10508%                                                                             %
10509%                                                                             %
10510%                                                                             %
10511%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10512%                                                                             %
10513%                                                                             %
10514%                                                                             %
10515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10516%
10517%  MagickShadeImage() shines a distant light on an image to create a
10518%  three-dimensional effect. You control the positioning of the light with
10519%  azimuth and elevation; azimuth is measured in degrees off the x axis
10520%  and elevation is measured in pixels above the Z axis.
10521%
10522%  The format of the MagickShadeImage method is:
10523%
10524%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10525%        const MagickBooleanType gray,const double azimuth,
10526%        const double elevation)
10527%
10528%  A description of each parameter follows:
10529%
10530%    o wand: the magick wand.
10531%
10532%    o gray: A value other than zero shades the intensity of each pixel.
10533%
10534%    o azimuth, elevation:  Define the light source direction.
10535%
10536*/
10537WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10538  const MagickBooleanType gray,const double asimuth,const double elevation)
10539{
10540  Image
10541    *shade_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
10548  if (wand->images == (Image *) NULL)
10549    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10550  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10551  if (shade_image == (Image *) NULL)
10552    return(MagickFalse);
10553  ReplaceImageInList(&wand->images,shade_image);
10554  return(MagickTrue);
10555}
10556
10557/*
10558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10559%                                                                             %
10560%                                                                             %
10561%                                                                             %
10562%   M a g i c k S h a d o w I m a g e                                         %
10563%                                                                             %
10564%                                                                             %
10565%                                                                             %
10566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10567%
10568%  MagickShadowImage() simulates an image shadow.
10569%
10570%  The format of the MagickShadowImage method is:
10571%
10572%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10573%        const double sigma,const ssize_t x,const ssize_t y)
10574%
10575%  A description of each parameter follows:
10576%
10577%    o wand: the magick wand.
10578%
10579%    o alpha: percentage transparency.
10580%
10581%    o sigma: the standard deviation of the Gaussian, in pixels.
10582%
10583%    o x: the shadow x-offset.
10584%
10585%    o y: the shadow y-offset.
10586%
10587*/
10588WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10589  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10590{
10591  Image
10592    *shadow_image;
10593
10594  assert(wand != (MagickWand *) NULL);
10595  assert(wand->signature == WandSignature);
10596  if( IfMagickTrue(wand->debug) )
10597    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10598
10599  if (wand->images == (Image *) NULL)
10600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10601  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10602  if (shadow_image == (Image *) NULL)
10603    return(MagickFalse);
10604  ReplaceImageInList(&wand->images,shadow_image);
10605  return(MagickTrue);
10606}
10607
10608/*
10609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10610%                                                                             %
10611%                                                                             %
10612%                                                                             %
10613%   M a g i c k S h a r p e n I m a g e                                       %
10614%                                                                             %
10615%                                                                             %
10616%                                                                             %
10617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10618%
10619%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10620%  Gaussian operator of the given radius and standard deviation (sigma).
10621%  For reasonable results, the radius should be larger than sigma.  Use a
10622%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10623%
10624%  The format of the MagickSharpenImage method is:
10625%
10626%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10627%        const double radius,const double sigma)
10628%
10629%  A description of each parameter follows:
10630%
10631%    o wand: the magick wand.
10632%
10633%    o radius: the radius of the Gaussian, in pixels, not counting the center
10634%      pixel.
10635%
10636%    o sigma: the standard deviation of the Gaussian, in pixels.
10637%
10638*/
10639WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10640  const double radius,const double sigma)
10641{
10642  Image
10643    *sharp_image;
10644
10645  assert(wand != (MagickWand *) NULL);
10646  assert(wand->signature == WandSignature);
10647  if( IfMagickTrue(wand->debug) )
10648    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10649
10650  if (wand->images == (Image *) NULL)
10651    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10652  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10653  if (sharp_image == (Image *) NULL)
10654    return(MagickFalse);
10655  ReplaceImageInList(&wand->images,sharp_image);
10656  return(MagickTrue);
10657}
10658
10659/*
10660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10661%                                                                             %
10662%                                                                             %
10663%                                                                             %
10664%   M a g i c k S h a v e I m a g e                                           %
10665%                                                                             %
10666%                                                                             %
10667%                                                                             %
10668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10669%
10670%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10671%  memory necessary for the new Image structure and returns a pointer to the
10672%  new image.
10673%
10674%  The format of the MagickShaveImage method is:
10675%
10676%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10677%        const size_t columns,const size_t rows)
10678%
10679%  A description of each parameter follows:
10680%
10681%    o wand: the magick wand.
10682%
10683%    o columns: the number of columns in the scaled image.
10684%
10685%    o rows: the number of rows in the scaled image.
10686%
10687%
10688*/
10689WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10690  const size_t columns,const size_t rows)
10691{
10692  Image
10693    *shave_image;
10694
10695  RectangleInfo
10696    shave_info;
10697
10698  assert(wand != (MagickWand *) NULL);
10699  assert(wand->signature == WandSignature);
10700  if( IfMagickTrue(wand->debug) )
10701    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10702
10703  if (wand->images == (Image *) NULL)
10704    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10705  shave_info.width=columns;
10706  shave_info.height=rows;
10707  shave_info.x=0;
10708  shave_info.y=0;
10709  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10710  if (shave_image == (Image *) NULL)
10711    return(MagickFalse);
10712  ReplaceImageInList(&wand->images,shave_image);
10713  return(MagickTrue);
10714}
10715
10716/*
10717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10718%                                                                             %
10719%                                                                             %
10720%                                                                             %
10721%   M a g i c k S h e a r I m a g e                                           %
10722%                                                                             %
10723%                                                                             %
10724%                                                                             %
10725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10726%
10727%  MagickShearImage() slides one edge of an image along the X or Y axis,
10728%  creating a parallelogram.  An X direction shear slides an edge along the X
10729%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10730%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10731%  is measured relative to the Y axis, and similarly, for Y direction shears
10732%  y_shear is measured relative to the X axis.  Empty triangles left over from
10733%  shearing the image are filled with the background color.
10734%
10735%  The format of the MagickShearImage method is:
10736%
10737%      MagickBooleanType MagickShearImage(MagickWand *wand,
10738%        const PixelWand *background,const double x_shear,onst double y_shear)
10739%
10740%  A description of each parameter follows:
10741%
10742%    o wand: the magick wand.
10743%
10744%    o background: the background pixel wand.
10745%
10746%    o x_shear: the number of degrees to shear the image.
10747%
10748%    o y_shear: the number of degrees to shear the image.
10749%
10750*/
10751WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10752  const PixelWand *background,const double x_shear,const double y_shear)
10753{
10754  Image
10755    *shear_image;
10756
10757  assert(wand != (MagickWand *) NULL);
10758  assert(wand->signature == WandSignature);
10759  if( IfMagickTrue(wand->debug) )
10760    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10761
10762  if (wand->images == (Image *) NULL)
10763    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10764  PixelGetQuantumPacket(background,&wand->images->background_color);
10765  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10766  if (shear_image == (Image *) NULL)
10767    return(MagickFalse);
10768  ReplaceImageInList(&wand->images,shear_image);
10769  return(MagickTrue);
10770}
10771
10772/*
10773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10774%                                                                             %
10775%                                                                             %
10776%                                                                             %
10777%   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                   %
10778%                                                                             %
10779%                                                                             %
10780%                                                                             %
10781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10782%
10783%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10784%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10785%  image using a sigmoidal transfer function without saturating highlights or
10786%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10787%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10788%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10789%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10790%  is reduced.
10791%
10792%  The format of the MagickSigmoidalContrastImage method is:
10793%
10794%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10795%        const MagickBooleanType sharpen,const double alpha,const double beta)
10796%
10797%  A description of each parameter follows:
10798%
10799%    o wand: the magick wand.
10800%
10801%    o sharpen: Increase or decrease image contrast.
10802%
10803%    o alpha: strength of the contrast, the larger the number the more
10804%      'threshold-like' it becomes.
10805%
10806%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10807%
10808*/
10809WandExport MagickBooleanType MagickSigmoidalContrastImage(
10810  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10811  const double beta)
10812{
10813  MagickBooleanType
10814    status;
10815
10816  assert(wand != (MagickWand *) NULL);
10817  assert(wand->signature == WandSignature);
10818  if( IfMagickTrue(wand->debug) )
10819    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10820
10821  if (wand->images == (Image *) NULL)
10822    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10823  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10824    wand->exception);
10825  return(status);
10826}
10827
10828/*
10829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10830%                                                                             %
10831%                                                                             %
10832%                                                                             %
10833%   M a g i c k S i m i l a r i t y I m a g e                                 %
10834%                                                                             %
10835%                                                                             %
10836%                                                                             %
10837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10838%
10839%  MagickSimilarityImage() compares the reference image of the image and
10840%  returns the best match offset.  In addition, it returns a similarity image
10841%  such that an exact match location is completely white and if none of the
10842%  pixels match, black, otherwise some gray level in-between.
10843%
10844%  The format of the MagickSimilarityImage method is:
10845%
10846%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10847%        const MagickWand *reference,const MetricType metric,
10848%        RectangeInfo *offset,double *similarity)
10849%
10850%  A description of each parameter follows:
10851%
10852%    o wand: the magick wand.
10853%
10854%    o reference: the reference wand.
10855%
10856%    o metric: the metric.
10857%
10858%    o offset: the best match offset of the reference image within the image.
10859%
10860%    o similarity: the computed similarity between the images.
10861%
10862*/
10863WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10864  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10865  double *similarity)
10866{
10867  Image
10868    *similarity_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
10875  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10876    {
10877      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10878        "ContainsNoImages","'%s'",wand->name);
10879      return((MagickWand *) NULL);
10880    }
10881  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10882    similarity,wand->exception);
10883  if (similarity_image == (Image *) NULL)
10884    return((MagickWand *) NULL);
10885  return(CloneMagickWandFromImages(wand,similarity_image));
10886}
10887
10888/*
10889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10890%                                                                             %
10891%                                                                             %
10892%                                                                             %
10893%   M a g i c k S k e t c h I m a g e                                         %
10894%                                                                             %
10895%                                                                             %
10896%                                                                             %
10897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10898%
10899%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10900%  a Gaussian operator of the given radius and standard deviation (sigma).
10901%  For reasonable results, radius should be larger than sigma.  Use a
10902%  radius of 0 and SketchImage() selects a suitable radius for you.
10903%  Angle gives the angle of the blurring motion.
10904%
10905%  The format of the MagickSketchImage method is:
10906%
10907%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10908%        const double radius,const double sigma,const double angle)
10909%
10910%  A description of each parameter follows:
10911%
10912%    o wand: the magick wand.
10913%
10914%    o radius: the radius of the Gaussian, in pixels, not counting
10915%      the center pixel.
10916%
10917%    o sigma: the standard deviation of the Gaussian, in pixels.
10918%
10919%    o angle: apply the effect along this angle.
10920%
10921*/
10922WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10923  const double radius,const double sigma,const double angle)
10924{
10925  Image
10926    *sketch_image;
10927
10928  assert(wand != (MagickWand *) NULL);
10929  assert(wand->signature == WandSignature);
10930  if( IfMagickTrue(wand->debug) )
10931    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10932
10933  if (wand->images == (Image *) NULL)
10934    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10935  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10936  if (sketch_image == (Image *) NULL)
10937    return(MagickFalse);
10938  ReplaceImageInList(&wand->images,sketch_image);
10939  return(MagickTrue);
10940}
10941
10942/*
10943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10944%                                                                             %
10945%                                                                             %
10946%                                                                             %
10947%   M a g i c k S m u s h I m a g e s                                         %
10948%                                                                             %
10949%                                                                             %
10950%                                                                             %
10951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10952%
10953%  MagickSmushImages() takes all images from the current image pointer to the
10954%  end of the image list and smushs them to each other top-to-bottom if the
10955%  stack parameter is true, otherwise left-to-right.
10956%
10957%  The format of the MagickSmushImages method is:
10958%
10959%      MagickWand *MagickSmushImages(MagickWand *wand,
10960%        const MagickBooleanType stack,const ssize_t offset)
10961%
10962%  A description of each parameter follows:
10963%
10964%    o wand: the magick wand.
10965%
10966%    o stack: By default, images are stacked left-to-right. Set stack to
10967%      MagickTrue to stack them top-to-bottom.
10968%
10969%    o offset: minimum distance in pixels between images.
10970%
10971*/
10972WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10973  const MagickBooleanType stack,const ssize_t offset)
10974{
10975  Image
10976    *smush_image;
10977
10978  assert(wand != (MagickWand *) NULL);
10979  assert(wand->signature == WandSignature);
10980  if( IfMagickTrue(wand->debug) )
10981    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10982
10983  if (wand->images == (Image *) NULL)
10984    return((MagickWand *) NULL);
10985  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10986  if (smush_image == (Image *) NULL)
10987    return((MagickWand *) NULL);
10988  return(CloneMagickWandFromImages(wand,smush_image));
10989}
10990
10991/*
10992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10993%                                                                             %
10994%                                                                             %
10995%                                                                             %
10996%     M a g i c k S o l a r i z e I m a g e                                   %
10997%                                                                             %
10998%                                                                             %
10999%                                                                             %
11000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11001%
11002%  MagickSolarizeImage() applies a special effect to the image, similar to the
11003%  effect achieved in a photo darkroom by selectively exposing areas of photo
11004%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11005%  measure of the extent of the solarization.
11006%
11007%  The format of the MagickSolarizeImage method is:
11008%
11009%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11010%        const double threshold)
11011%
11012%  A description of each parameter follows:
11013%
11014%    o wand: the magick wand.
11015%
11016%    o threshold:  Define the extent of the solarization.
11017%
11018*/
11019WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11020  const double threshold)
11021{
11022  MagickBooleanType
11023    status;
11024
11025  assert(wand != (MagickWand *) NULL);
11026  assert(wand->signature == WandSignature);
11027  if( IfMagickTrue(wand->debug) )
11028    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11029
11030  if (wand->images == (Image *) NULL)
11031    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11032  status=SolarizeImage(wand->images,threshold,wand->exception);
11033  return(status);
11034}
11035
11036/*
11037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11038%                                                                             %
11039%                                                                             %
11040%                                                                             %
11041%   M a g i c k S p a r s e C o l o r I m a g e                               %
11042%                                                                             %
11043%                                                                             %
11044%                                                                             %
11045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11046%
11047%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11048%  colors found at those coordinates, across the whole image, using various
11049%  methods.
11050%
11051%  The format of the MagickSparseColorImage method is:
11052%
11053%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11054%        const SparseColorMethod method,const size_t number_arguments,
11055%        const double *arguments)
11056%
11057%  A description of each parameter follows:
11058%
11059%    o image: the image to be sparseed.
11060%
11061%    o method: the method of image sparseion.
11062%
11063%        ArcSparseColorion will always ignore source image offset, and always
11064%        'bestfit' the destination image with the top left corner offset
11065%        relative to the polar mapping center.
11066%
11067%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11068%        style of image sparseion.
11069%
11070%        Affine, Perspective, and Bilinear, will do least squares fitting of
11071%        the distrotion when more than the minimum number of control point
11072%        pairs are provided.
11073%
11074%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11075%        less than 4 control point pairs are provided. While Affine sparseions
11076%        will let you use any number of control point pairs, that is Zero pairs
11077%        is a No-Op (viewport only) distrotion, one pair is a translation and
11078%        two pairs of control points will do a scale-rotate-translate, without
11079%        any shearing.
11080%
11081%    o number_arguments: the number of arguments given for this sparseion
11082%      method.
11083%
11084%    o arguments: the arguments for this sparseion method.
11085%
11086*/
11087WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11088  const SparseColorMethod method,const size_t number_arguments,
11089  const double *arguments)
11090{
11091  Image
11092    *sparse_image;
11093
11094  assert(wand != (MagickWand *) NULL);
11095  assert(wand->signature == WandSignature);
11096  if( IfMagickTrue(wand->debug) )
11097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11098
11099  if (wand->images == (Image *) NULL)
11100    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11101  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11102    wand->exception);
11103  if (sparse_image == (Image *) NULL)
11104    return(MagickFalse);
11105  ReplaceImageInList(&wand->images,sparse_image);
11106  return(MagickTrue);
11107}
11108
11109/*
11110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11111%                                                                             %
11112%                                                                             %
11113%                                                                             %
11114%   M a g i c k S p l i c e I m a g e                                         %
11115%                                                                             %
11116%                                                                             %
11117%                                                                             %
11118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11119%
11120%  MagickSpliceImage() splices a solid color into the image.
11121%
11122%  The format of the MagickSpliceImage method is:
11123%
11124%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11125%        const size_t width,const size_t height,const ssize_t x,
11126%        const ssize_t y)
11127%
11128%  A description of each parameter follows:
11129%
11130%    o wand: the magick wand.
11131%
11132%    o width: the region width.
11133%
11134%    o height: the region height.
11135%
11136%    o x: the region x offset.
11137%
11138%    o y: the region y offset.
11139%
11140*/
11141WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11142  const size_t width,const size_t height,const ssize_t x,
11143  const ssize_t y)
11144{
11145  Image
11146    *splice_image;
11147
11148  RectangleInfo
11149    splice;
11150
11151  assert(wand != (MagickWand *) NULL);
11152  assert(wand->signature == WandSignature);
11153  if( IfMagickTrue(wand->debug) )
11154    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11155
11156  if (wand->images == (Image *) NULL)
11157    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11158  splice.width=width;
11159  splice.height=height;
11160  splice.x=x;
11161  splice.y=y;
11162  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11163  if (splice_image == (Image *) NULL)
11164    return(MagickFalse);
11165  ReplaceImageInList(&wand->images,splice_image);
11166  return(MagickTrue);
11167}
11168
11169/*
11170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11171%                                                                             %
11172%                                                                             %
11173%                                                                             %
11174%   M a g i c k S p r e a d I m a g e                                         %
11175%                                                                             %
11176%                                                                             %
11177%                                                                             %
11178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11179%
11180%  MagickSpreadImage() is a special effects method that randomly displaces each
11181%  pixel in a block defined by the radius parameter.
11182%
11183%  The format of the MagickSpreadImage method is:
11184%
11185%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11186%        const PixelInterpolateMethod method)
11187%
11188%  A description of each parameter follows:
11189%
11190%    o wand: the magick wand.
11191%
11192%    o radius:  Choose a random pixel in a neighborhood of this extent.
11193%
11194%    o method: the pixel interpolation method.
11195%
11196*/
11197WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11198  const double radius,const PixelInterpolateMethod method)
11199{
11200  Image
11201    *spread_image;
11202
11203  assert(wand != (MagickWand *) NULL);
11204  assert(wand->signature == WandSignature);
11205  if( IfMagickTrue(wand->debug) )
11206    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11207
11208  if (wand->images == (Image *) NULL)
11209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11210  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11211  if (spread_image == (Image *) NULL)
11212    return(MagickFalse);
11213  ReplaceImageInList(&wand->images,spread_image);
11214  return(MagickTrue);
11215}
11216
11217/*
11218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11219%                                                                             %
11220%                                                                             %
11221%                                                                             %
11222%   M a g i c k S t a t i s t i c I m a g e                                   %
11223%                                                                             %
11224%                                                                             %
11225%                                                                             %
11226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11227%
11228%  MagickStatisticImage() replace each pixel with corresponding statistic from
11229%  the neighborhood of the specified width and height.
11230%
11231%  The format of the MagickStatisticImage method is:
11232%
11233%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11234%        const StatisticType type,const double width,const size_t height)
11235%
11236%  A description of each parameter follows:
11237%
11238%    o wand: the magick wand.
11239%
11240%    o type: the statistic type (e.g. median, mode, etc.).
11241%
11242%    o width: the width of the pixel neighborhood.
11243%
11244%    o height: the height of the pixel neighborhood.
11245%
11246*/
11247WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11248  const StatisticType type,const size_t width,const size_t height)
11249{
11250  Image
11251    *statistic_image;
11252
11253  assert(wand != (MagickWand *) NULL);
11254  assert(wand->signature == WandSignature);
11255  if( IfMagickTrue(wand->debug) )
11256    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11257
11258  if (wand->images == (Image *) NULL)
11259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11260  statistic_image=StatisticImage(wand->images,type,width,height,
11261    wand->exception);
11262  if (statistic_image == (Image *) NULL)
11263    return(MagickFalse);
11264  ReplaceImageInList(&wand->images,statistic_image);
11265  return(MagickTrue);
11266}
11267
11268/*
11269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11270%                                                                             %
11271%                                                                             %
11272%                                                                             %
11273%   M a g i c k S t e g a n o I m a g e                                       %
11274%                                                                             %
11275%                                                                             %
11276%                                                                             %
11277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11278%
11279%  MagickSteganoImage() hides a digital watermark within the image.
11280%  Recover the hidden watermark later to prove that the authenticity of
11281%  an image.  Offset defines the start position within the image to hide
11282%  the watermark.
11283%
11284%  The format of the MagickSteganoImage method is:
11285%
11286%      MagickWand *MagickSteganoImage(MagickWand *wand,
11287%        const MagickWand *watermark_wand,const ssize_t offset)
11288%
11289%  A description of each parameter follows:
11290%
11291%    o wand: the magick wand.
11292%
11293%    o watermark_wand: the watermark wand.
11294%
11295%    o offset: Start hiding at this offset into the image.
11296%
11297*/
11298WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11299  const MagickWand *watermark_wand,const ssize_t offset)
11300{
11301  Image
11302    *stegano_image;
11303
11304  assert(wand != (MagickWand *) NULL);
11305  assert(wand->signature == WandSignature);
11306  if( IfMagickTrue(wand->debug) )
11307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11308
11309  if ((wand->images == (Image *) NULL) ||
11310      (watermark_wand->images == (Image *) NULL))
11311    {
11312      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11313        "ContainsNoImages","'%s'",wand->name);
11314      return((MagickWand *) NULL);
11315    }
11316  wand->images->offset=offset;
11317  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11318    wand->exception);
11319  if (stegano_image == (Image *) NULL)
11320    return((MagickWand *) NULL);
11321  return(CloneMagickWandFromImages(wand,stegano_image));
11322}
11323
11324/*
11325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11326%                                                                             %
11327%                                                                             %
11328%                                                                             %
11329%   M a g i c k S t e r e o I m a g e                                         %
11330%                                                                             %
11331%                                                                             %
11332%                                                                             %
11333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334%
11335%  MagickStereoImage() composites two images and produces a single image that
11336%  is the composite of a left and right image of a stereo pair
11337%
11338%  The format of the MagickStereoImage method is:
11339%
11340%      MagickWand *MagickStereoImage(MagickWand *wand,
11341%        const MagickWand *offset_wand)
11342%
11343%  A description of each parameter follows:
11344%
11345%    o wand: the magick wand.
11346%
11347%    o offset_wand: Another image wand.
11348%
11349*/
11350WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11351  const MagickWand *offset_wand)
11352{
11353  Image
11354    *stereo_image;
11355
11356  assert(wand != (MagickWand *) NULL);
11357  assert(wand->signature == WandSignature);
11358  if( IfMagickTrue(wand->debug) )
11359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11360
11361  if ((wand->images == (Image *) NULL) ||
11362      (offset_wand->images == (Image *) NULL))
11363    {
11364      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11365        "ContainsNoImages","'%s'",wand->name);
11366      return((MagickWand *) NULL);
11367    }
11368  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11369  if (stereo_image == (Image *) NULL)
11370    return((MagickWand *) NULL);
11371  return(CloneMagickWandFromImages(wand,stereo_image));
11372}
11373
11374/*
11375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11376%                                                                             %
11377%                                                                             %
11378%                                                                             %
11379%   M a g i c k S t r i p I m a g e                                           %
11380%                                                                             %
11381%                                                                             %
11382%                                                                             %
11383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11384%
11385%  MagickStripImage() strips an image of all profiles and comments.
11386%
11387%  The format of the MagickStripImage method is:
11388%
11389%      MagickBooleanType MagickStripImage(MagickWand *wand)
11390%
11391%  A description of each parameter follows:
11392%
11393%    o wand: the magick wand.
11394%
11395*/
11396WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11397{
11398  assert(wand != (MagickWand *) NULL);
11399  assert(wand->signature == WandSignature);
11400  if( IfMagickTrue(wand->debug) )
11401    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11402
11403  if (wand->images == (Image *) NULL)
11404    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11405  return(StripImage(wand->images,wand->exception));
11406}
11407
11408/*
11409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11410%                                                                             %
11411%                                                                             %
11412%                                                                             %
11413%   M a g i c k S w i r l I m a g e                                           %
11414%                                                                             %
11415%                                                                             %
11416%                                                                             %
11417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11418%
11419%  MagickSwirlImage() swirls the pixels about the center of the image, where
11420%  degrees indicates the sweep of the arc through which each pixel is moved.
11421%  You get a more dramatic effect as the degrees move from 1 to 360.
11422%
11423%  The format of the MagickSwirlImage method is:
11424%
11425%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11426%        const PixelInterpolateMethod method)
11427%
11428%  A description of each parameter follows:
11429%
11430%    o wand: the magick wand.
11431%
11432%    o degrees: Define the tightness of the swirling effect.
11433%
11434%    o method: the pixel interpolation method.
11435%
11436*/
11437WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11438  const double degrees,const PixelInterpolateMethod method)
11439{
11440  Image
11441    *swirl_image;
11442
11443  assert(wand != (MagickWand *) NULL);
11444  assert(wand->signature == WandSignature);
11445  if( IfMagickTrue(wand->debug) )
11446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11447
11448  if (wand->images == (Image *) NULL)
11449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11450  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11451  if (swirl_image == (Image *) NULL)
11452    return(MagickFalse);
11453  ReplaceImageInList(&wand->images,swirl_image);
11454  return(MagickTrue);
11455}
11456
11457/*
11458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11459%                                                                             %
11460%                                                                             %
11461%                                                                             %
11462%   M a g i c k T e x t u r e I m a g e                                       %
11463%                                                                             %
11464%                                                                             %
11465%                                                                             %
11466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11467%
11468%  MagickTextureImage() repeatedly tiles the texture image across and down the
11469%  image canvas.
11470%
11471%  The format of the MagickTextureImage method is:
11472%
11473%      MagickWand *MagickTextureImage(MagickWand *wand,
11474%        const MagickWand *texture_wand)
11475%
11476%  A description of each parameter follows:
11477%
11478%    o wand: the magick wand.
11479%
11480%    o texture_wand: the texture wand
11481%
11482*/
11483WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11484  const MagickWand *texture_wand)
11485{
11486  Image
11487    *texture_image;
11488
11489  MagickBooleanType
11490    status;
11491
11492  assert(wand != (MagickWand *) NULL);
11493  assert(wand->signature == WandSignature);
11494  if( IfMagickTrue(wand->debug) )
11495    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11496
11497  if ((wand->images == (Image *) NULL) ||
11498      (texture_wand->images == (Image *) NULL))
11499    {
11500      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11501        "ContainsNoImages","'%s'",wand->name);
11502      return((MagickWand *) NULL);
11503    }
11504  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11505  if (texture_image == (Image *) NULL)
11506    return((MagickWand *) NULL);
11507  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11508  if( IfMagickFalse(status) )
11509    {
11510      texture_image=DestroyImage(texture_image);
11511      return((MagickWand *) NULL);
11512    }
11513  return(CloneMagickWandFromImages(wand,texture_image));
11514}
11515
11516/*
11517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11518%                                                                             %
11519%                                                                             %
11520%                                                                             %
11521%   M a g i c k T h r e s h o l d I m a g e                                   %
11522%                                                                             %
11523%                                                                             %
11524%                                                                             %
11525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11526%
11527%  MagickThresholdImage() changes the value of individual pixels based on
11528%  the intensity of each pixel compared to threshold.  The result is a
11529%  high-contrast, two color image.
11530%
11531%  The format of the MagickThresholdImage method is:
11532%
11533%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11534%        const double threshold)
11535%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11536%        const ChannelType channel,const double threshold)
11537%
11538%  A description of each parameter follows:
11539%
11540%    o wand: the magick wand.
11541%
11542%    o channel: the image channel(s).
11543%
11544%    o threshold: Define the threshold value.
11545%
11546*/
11547WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11548  const double threshold)
11549{
11550  MagickBooleanType
11551    status;
11552
11553  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11554  return(status);
11555}
11556
11557WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11558  const ChannelType channel,const double threshold)
11559{
11560  MagickBooleanType
11561    status;
11562
11563  assert(wand != (MagickWand *) NULL);
11564  assert(wand->signature == WandSignature);
11565  if( IfMagickTrue(wand->debug) )
11566    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11567
11568  if (wand->images == (Image *) NULL)
11569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11570  status=BilevelImage(wand->images,threshold,wand->exception);
11571  return(status);
11572}
11573
11574/*
11575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11576%                                                                             %
11577%                                                                             %
11578%                                                                             %
11579%   M a g i c k T h u m b n a i l I m a g e                                   %
11580%                                                                             %
11581%                                                                             %
11582%                                                                             %
11583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11584%
11585%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11586%  and removes any associated profiles.  The goal is to produce small low cost
11587%  thumbnail images suited for display on the Web.
11588%
11589%  The format of the MagickThumbnailImage method is:
11590%
11591%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11592%        const size_t columns,const size_t rows)
11593%
11594%  A description of each parameter follows:
11595%
11596%    o wand: the magick wand.
11597%
11598%    o columns: the number of columns in the scaled image.
11599%
11600%    o rows: the number of rows in the scaled image.
11601%
11602*/
11603WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11604  const size_t columns,const size_t rows)
11605{
11606  Image
11607    *thumbnail_image;
11608
11609  assert(wand != (MagickWand *) NULL);
11610  assert(wand->signature == WandSignature);
11611  if( IfMagickTrue(wand->debug) )
11612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11613
11614  if (wand->images == (Image *) NULL)
11615    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11616  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11617  if (thumbnail_image == (Image *) NULL)
11618    return(MagickFalse);
11619  ReplaceImageInList(&wand->images,thumbnail_image);
11620  return(MagickTrue);
11621}
11622
11623/*
11624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11625%                                                                             %
11626%                                                                             %
11627%                                                                             %
11628%   M a g i c k T i n t I m a g e                                             %
11629%                                                                             %
11630%                                                                             %
11631%                                                                             %
11632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11633%
11634%  MagickTintImage() applies a color vector to each pixel in the image.  The
11635%  length of the vector is 0 for black and white and at its maximum for the
11636%  midtones.  The vector weighting function is
11637%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11638%
11639%  The format of the MagickTintImage method is:
11640%
11641%      MagickBooleanType MagickTintImage(MagickWand *wand,
11642%        const PixelWand *tint,const PixelWand *blend)
11643%
11644%  A description of each parameter follows:
11645%
11646%    o wand: the magick wand.
11647%
11648%    o tint: the tint pixel wand.
11649%
11650%    o alpha: the alpha pixel wand.
11651%
11652*/
11653WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11654  const PixelWand *tint,const PixelWand *blend)
11655{
11656  char
11657    percent_blend[MaxTextExtent];
11658
11659  Image
11660    *tint_image;
11661
11662  PixelInfo
11663    target;
11664
11665  assert(wand != (MagickWand *) NULL);
11666  assert(wand->signature == WandSignature);
11667  if( IfMagickTrue(wand->debug) )
11668    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11669
11670  if (wand->images == (Image *) NULL)
11671    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11672  if (wand->images->colorspace != CMYKColorspace)
11673    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11674      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11675      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11676      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11677      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11678      PixelGetAlphaQuantum(blend)));
11679  else
11680    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11681      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11682      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11683      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11684      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11685      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11686      PixelGetAlphaQuantum(blend)));
11687  target=PixelGetPixel(tint);
11688  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11689  if (tint_image == (Image *) NULL)
11690    return(MagickFalse);
11691  ReplaceImageInList(&wand->images,tint_image);
11692  return(MagickTrue);
11693}
11694
11695/*
11696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11697%                                                                             %
11698%                                                                             %
11699%                                                                             %
11700%   M a g i c k T r a n s f o r m I m a g e                                   %
11701%                                                                             %
11702%                                                                             %
11703%                                                                             %
11704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11705%
11706%  MagickTransformImage() is a convenience method that behaves like
11707%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11708%  information as a region geometry specification.  If the operation fails,
11709%  a NULL image handle is returned.
11710%
11711%  The format of the MagickTransformImage method is:
11712%
11713%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11714%        const char *geometry)
11715%
11716%  A description of each parameter follows:
11717%
11718%    o wand: the magick wand.
11719%
11720%    o crop: A crop geometry string.  This geometry defines a subregion of the
11721%      image to crop.
11722%
11723%    o geometry: An image geometry string.  This geometry defines the final
11724%      size of the image.
11725%
11726*/
11727WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11728  const char *crop,const char *geometry)
11729{
11730  Image
11731    *transform_image;
11732
11733  MagickBooleanType
11734    status;
11735
11736  assert(wand != (MagickWand *) NULL);
11737  assert(wand->signature == WandSignature);
11738  if( IfMagickTrue(wand->debug) )
11739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11740
11741
11742  if (wand->images == (Image *) NULL)
11743    return((MagickWand *) NULL);
11744  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11745  if (transform_image == (Image *) NULL)
11746    return((MagickWand *) NULL);
11747  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11748  if( IfMagickFalse(status) )
11749    {
11750      transform_image=DestroyImage(transform_image);
11751      return((MagickWand *) NULL);
11752    }
11753  return(CloneMagickWandFromImages(wand,transform_image));
11754}
11755
11756/*
11757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11758%                                                                             %
11759%                                                                             %
11760%                                                                             %
11761%   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               %
11762%                                                                             %
11763%                                                                             %
11764%                                                                             %
11765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11766%
11767%  MagickTransformImageColorspace() transform the image colorspace, setting
11768%  the images colorspace while transforming the images data to that
11769%  colorspace.
11770%
11771%  The format of the MagickTransformImageColorspace method is:
11772%
11773%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11774%        const ColorspaceType colorspace)
11775%
11776%  A description of each parameter follows:
11777%
11778%    o wand: the magick wand.
11779%
11780%    o colorspace: the image colorspace:   UndefinedColorspace,
11781%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11782%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11783%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11784%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11785%      HSLColorspace, HWBColorspace.
11786%
11787*/
11788WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11789  const ColorspaceType colorspace)
11790{
11791  assert(wand != (MagickWand *) NULL);
11792  assert(wand->signature == WandSignature);
11793  if( IfMagickTrue(wand->debug) )
11794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11795
11796
11797  if (wand->images == (Image *) NULL)
11798    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11799  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11800}
11801
11802/*
11803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11804%                                                                             %
11805%                                                                             %
11806%                                                                             %
11807%   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                     %
11808%                                                                             %
11809%                                                                             %
11810%                                                                             %
11811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11812%
11813%  MagickTransparentPaintImage() changes any pixel that matches color with the
11814%  color defined by fill.
11815%
11816%  The format of the MagickTransparentPaintImage method is:
11817%
11818%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11819%        const PixelWand *target,const double alpha,const double fuzz,
11820%        const MagickBooleanType invert)
11821%
11822%  A description of each parameter follows:
11823%
11824%    o wand: the magick wand.
11825%
11826%    o target: Change this target color to specified alpha value within
11827%      the image.
11828%
11829%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11830%      transparent.
11831%
11832%    o fuzz: By default target must match a particular pixel color
11833%      exactly.  However, in many cases two colors may differ by a small amount.
11834%      The fuzz member of image defines how much tolerance is acceptable to
11835%      consider two colors as the same.  For example, set fuzz to 10 and the
11836%      color red at intensities of 100 and 102 respectively are now interpreted
11837%      as the same color for the purposes of the floodfill.
11838%
11839%    o invert: paint any pixel that does not match the target color.
11840%
11841*/
11842WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11843  const PixelWand *target,const double alpha,const double fuzz,
11844  const MagickBooleanType invert)
11845{
11846  MagickBooleanType
11847    status;
11848
11849  PixelInfo
11850    target_pixel;
11851
11852  assert(wand != (MagickWand *) NULL);
11853  assert(wand->signature == WandSignature);
11854  if( IfMagickTrue(wand->debug) )
11855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11856
11857
11858  if (wand->images == (Image *) NULL)
11859    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11860  PixelGetMagickColor(target,&target_pixel);
11861  wand->images->fuzz=fuzz;
11862  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11863    QuantumRange*alpha),invert,wand->exception);
11864  return(status);
11865}
11866
11867/*
11868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11869%                                                                             %
11870%                                                                             %
11871%                                                                             %
11872%   M a g i c k T r a n s p o s e I m a g e                                   %
11873%                                                                             %
11874%                                                                             %
11875%                                                                             %
11876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11877%
11878%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11879%  pixels around the central x-axis while rotating them 90-degrees.
11880%
11881%  The format of the MagickTransposeImage method is:
11882%
11883%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11884%
11885%  A description of each parameter follows:
11886%
11887%    o wand: the magick wand.
11888%
11889*/
11890WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11891{
11892  Image
11893    *transpose_image;
11894
11895  assert(wand != (MagickWand *) NULL);
11896  assert(wand->signature == WandSignature);
11897  if( IfMagickTrue(wand->debug) )
11898    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11899
11900  if (wand->images == (Image *) NULL)
11901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11902  transpose_image=TransposeImage(wand->images,wand->exception);
11903  if (transpose_image == (Image *) NULL)
11904    return(MagickFalse);
11905  ReplaceImageInList(&wand->images,transpose_image);
11906  return(MagickTrue);
11907}
11908
11909/*
11910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11911%                                                                             %
11912%                                                                             %
11913%                                                                             %
11914%   M a g i c k T r a n s v e r s e I m a g e                                 %
11915%                                                                             %
11916%                                                                             %
11917%                                                                             %
11918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11919%
11920%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11921%  pixels around the central y-axis while rotating them 270-degrees.
11922%
11923%  The format of the MagickTransverseImage method is:
11924%
11925%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11926%
11927%  A description of each parameter follows:
11928%
11929%    o wand: the magick wand.
11930%
11931*/
11932WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11933{
11934  Image
11935    *transverse_image;
11936
11937  assert(wand != (MagickWand *) NULL);
11938  assert(wand->signature == WandSignature);
11939  if( IfMagickTrue(wand->debug) )
11940    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11941
11942  if (wand->images == (Image *) NULL)
11943    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11944  transverse_image=TransverseImage(wand->images,wand->exception);
11945  if (transverse_image == (Image *) NULL)
11946    return(MagickFalse);
11947  ReplaceImageInList(&wand->images,transverse_image);
11948  return(MagickTrue);
11949}
11950
11951/*
11952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11953%                                                                             %
11954%                                                                             %
11955%                                                                             %
11956%   M a g i c k T r i m I m a g e                                             %
11957%                                                                             %
11958%                                                                             %
11959%                                                                             %
11960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11961%
11962%  MagickTrimImage() remove edges that are the background color from the image.
11963%
11964%  The format of the MagickTrimImage method is:
11965%
11966%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11967%
11968%  A description of each parameter follows:
11969%
11970%    o wand: the magick wand.
11971%
11972%    o fuzz: By default target must match a particular pixel color
11973%      exactly.  However, in many cases two colors may differ by a small amount.
11974%      The fuzz member of image defines how much tolerance is acceptable to
11975%      consider two colors as the same.  For example, set fuzz to 10 and the
11976%      color red at intensities of 100 and 102 respectively are now interpreted
11977%      as the same color for the purposes of the floodfill.
11978%
11979*/
11980WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11981{
11982  Image
11983    *trim_image;
11984
11985  assert(wand != (MagickWand *) NULL);
11986  assert(wand->signature == WandSignature);
11987  if( IfMagickTrue(wand->debug) )
11988    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11989
11990  if (wand->images == (Image *) NULL)
11991    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11992  wand->images->fuzz=fuzz;
11993  trim_image=TrimImage(wand->images,wand->exception);
11994  if (trim_image == (Image *) NULL)
11995    return(MagickFalse);
11996  ReplaceImageInList(&wand->images,trim_image);
11997  return(MagickTrue);
11998}
11999
12000/*
12001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12002%                                                                             %
12003%                                                                             %
12004%                                                                             %
12005%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12006%                                                                             %
12007%                                                                             %
12008%                                                                             %
12009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12010%
12011%  MagickUniqueImageColors() discards all but one of any pixel color.
12012%
12013%  The format of the MagickUniqueImageColors method is:
12014%
12015%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12016%
12017%  A description of each parameter follows:
12018%
12019%    o wand: the magick wand.
12020%
12021*/
12022WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12023{
12024  Image
12025    *unique_image;
12026
12027  assert(wand != (MagickWand *) NULL);
12028  assert(wand->signature == WandSignature);
12029  if( IfMagickTrue(wand->debug) )
12030    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12031
12032  if (wand->images == (Image *) NULL)
12033    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12034  unique_image=UniqueImageColors(wand->images,wand->exception);
12035  if (unique_image == (Image *) NULL)
12036    return(MagickFalse);
12037  ReplaceImageInList(&wand->images,unique_image);
12038  return(MagickTrue);
12039}
12040
12041/*
12042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12043%                                                                             %
12044%                                                                             %
12045%                                                                             %
12046%   M a g i c k U n s h a r p M a s k I m a g e                               %
12047%                                                                             %
12048%                                                                             %
12049%                                                                             %
12050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12051%
12052%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12053%  Gaussian operator of the given radius and standard deviation (sigma).
12054%  For reasonable results, radius should be larger than sigma.  Use a radius
12055%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12056%
12057%  The format of the MagickUnsharpMaskImage method is:
12058%
12059%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12060%        const double radius,const double sigma,const double amount,
12061%        const double threshold)
12062%
12063%  A description of each parameter follows:
12064%
12065%    o wand: the magick wand.
12066%
12067%    o radius: the radius of the Gaussian, in pixels, not counting the center
12068%      pixel.
12069%
12070%    o sigma: the standard deviation of the Gaussian, in pixels.
12071%
12072%    o amount: the percentage of the difference between the original and the
12073%      blur image that is added back into the original.
12074%
12075%    o threshold: the threshold in pixels needed to apply the diffence amount.
12076%
12077*/
12078WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12079  const double radius,const double sigma,const double amount,
12080  const double threshold)
12081{
12082  Image
12083    *unsharp_image;
12084
12085  assert(wand != (MagickWand *) NULL);
12086  assert(wand->signature == WandSignature);
12087  if( IfMagickTrue(wand->debug) )
12088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12089
12090  if (wand->images == (Image *) NULL)
12091    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12092  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
12093    wand->exception);
12094  if (unsharp_image == (Image *) NULL)
12095    return(MagickFalse);
12096  ReplaceImageInList(&wand->images,unsharp_image);
12097  return(MagickTrue);
12098}
12099
12100/*
12101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12102%                                                                             %
12103%                                                                             %
12104%                                                                             %
12105%   M a g i c k V i g n e t t e I m a g e                                     %
12106%                                                                             %
12107%                                                                             %
12108%                                                                             %
12109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12110%
12111%  MagickVignetteImage() softens the edges of the image in vignette style.
12112%
12113%  The format of the MagickVignetteImage method is:
12114%
12115%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12116%        const double radius,const double sigma,const ssize_t x,
12117%        const ssize_t y)
12118%
12119%  A description of each parameter follows:
12120%
12121%    o wand: the magick wand.
12122%
12123%    o radius: the radius.
12124%
12125%    o sigma: the sigma.
12126%
12127%    o x, y:  Define the x and y ellipse offset.
12128%
12129*/
12130WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12131  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12132{
12133  Image
12134    *vignette_image;
12135
12136  assert(wand != (MagickWand *) NULL);
12137  assert(wand->signature == WandSignature);
12138  if( IfMagickTrue(wand->debug) )
12139    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12140
12141  if (wand->images == (Image *) NULL)
12142    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12143  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12144  if (vignette_image == (Image *) NULL)
12145    return(MagickFalse);
12146  ReplaceImageInList(&wand->images,vignette_image);
12147  return(MagickTrue);
12148}
12149
12150/*
12151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12152%                                                                             %
12153%                                                                             %
12154%                                                                             %
12155%   M a g i c k W a v e I m a g e                                             %
12156%                                                                             %
12157%                                                                             %
12158%                                                                             %
12159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12160%
12161%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12162%  the pixels vertically along a sine wave whose amplitude and wavelength
12163%  is specified by the given parameters.
12164%
12165%  The format of the MagickWaveImage method is:
12166%
12167%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12168%        const double amplitude,const double wave_length,
12169%        const PixelInterpolateMethod method)
12170%
12171%  A description of each parameter follows:
12172%
12173%    o wand: the magick wand.
12174%
12175%    o amplitude, wave_length:  Define the amplitude and wave length of the
12176%      sine wave.
12177%
12178%    o method: the pixel interpolation method.
12179%
12180*/
12181WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12182  const double amplitude,const double wave_length,
12183  const PixelInterpolateMethod method)
12184{
12185  Image
12186    *wave_image;
12187
12188  assert(wand != (MagickWand *) NULL);
12189  assert(wand->signature == WandSignature);
12190  if( IfMagickTrue(wand->debug) )
12191    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12192
12193  if (wand->images == (Image *) NULL)
12194    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12195  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12196    wand->exception);
12197  if (wave_image == (Image *) NULL)
12198    return(MagickFalse);
12199  ReplaceImageInList(&wand->images,wave_image);
12200  return(MagickTrue);
12201}
12202
12203/*
12204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12205%                                                                             %
12206%                                                                             %
12207%                                                                             %
12208%   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                         %
12209%                                                                             %
12210%                                                                             %
12211%                                                                             %
12212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12213%
12214%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12215%  above the threshold into white while leaving all pixels below the threshold
12216%  unchanged.
12217%
12218%  The format of the MagickWhiteThresholdImage method is:
12219%
12220%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12221%        const PixelWand *threshold)
12222%
12223%  A description of each parameter follows:
12224%
12225%    o wand: the magick wand.
12226%
12227%    o threshold: the pixel wand.
12228%
12229*/
12230WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12231  const PixelWand *threshold)
12232{
12233  char
12234    thresholds[MaxTextExtent];
12235
12236  assert(wand != (MagickWand *) NULL);
12237  assert(wand->signature == WandSignature);
12238  if( IfMagickTrue(wand->debug) )
12239    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12240
12241  if (wand->images == (Image *) NULL)
12242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12243  (void) FormatLocaleString(thresholds,MaxTextExtent,
12244    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12245    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12246    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12247  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12248}
12249
12250/*
12251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12252%                                                                             %
12253%                                                                             %
12254%                                                                             %
12255%   M a g i c k W r i t e I m a g e                                           %
12256%                                                                             %
12257%                                                                             %
12258%                                                                             %
12259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12260%
12261%  MagickWriteImage() writes an image to the specified filename.  If the
12262%  filename parameter is NULL, the image is written to the filename set
12263%  by MagickReadImage() or MagickSetImageFilename().
12264%
12265%  The format of the MagickWriteImage method is:
12266%
12267%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12268%        const char *filename)
12269%
12270%  A description of each parameter follows:
12271%
12272%    o wand: the magick wand.
12273%
12274%    o filename: the image filename.
12275%
12276%
12277*/
12278WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12279  const char *filename)
12280{
12281  Image
12282    *image;
12283
12284  ImageInfo
12285    *write_info;
12286
12287  MagickBooleanType
12288    status;
12289
12290  assert(wand != (MagickWand *) NULL);
12291  assert(wand->signature == WandSignature);
12292  if( IfMagickTrue(wand->debug) )
12293    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12294
12295  if (wand->images == (Image *) NULL)
12296    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12297  if (filename != (const char *) NULL)
12298    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12299  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12300  if (image == (Image *) NULL)
12301    return(MagickFalse);
12302  write_info=CloneImageInfo(wand->image_info);
12303  write_info->adjoin=MagickTrue;
12304  status=WriteImage(write_info,image,wand->exception);
12305  image=DestroyImage(image);
12306  write_info=DestroyImageInfo(write_info);
12307  return(status);
12308}
12309
12310/*
12311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12312%                                                                             %
12313%                                                                             %
12314%                                                                             %
12315%   M a g i c k W r i t e I m a g e F i l e                                   %
12316%                                                                             %
12317%                                                                             %
12318%                                                                             %
12319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12320%
12321%  MagickWriteImageFile() writes an image to an open file descriptor.
12322%
12323%  The format of the MagickWriteImageFile method is:
12324%
12325%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12326%
12327%  A description of each parameter follows:
12328%
12329%    o wand: the magick wand.
12330%
12331%    o file: the file descriptor.
12332%
12333*/
12334WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12335{
12336  Image
12337    *image;
12338
12339  ImageInfo
12340    *write_info;
12341
12342  MagickBooleanType
12343    status;
12344
12345  assert(wand != (MagickWand *) NULL);
12346  assert(wand->signature == WandSignature);
12347  assert(file != (FILE *) NULL);
12348  if( IfMagickTrue(wand->debug) )
12349    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12350
12351  if (wand->images == (Image *) NULL)
12352    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12353  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12354  if (image == (Image *) NULL)
12355    return(MagickFalse);
12356  write_info=CloneImageInfo(wand->image_info);
12357  SetImageInfoFile(write_info,file);
12358  write_info->adjoin=MagickTrue;
12359  status=WriteImage(write_info,image,wand->exception);
12360  write_info=DestroyImageInfo(write_info);
12361  image=DestroyImage(image);
12362  return(status);
12363}
12364
12365/*
12366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12367%                                                                             %
12368%                                                                             %
12369%                                                                             %
12370%   M a g i c k W r i t e I m a g e s                                         %
12371%                                                                             %
12372%                                                                             %
12373%                                                                             %
12374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12375%
12376%  MagickWriteImages() writes an image or image sequence.
12377%
12378%  The format of the MagickWriteImages method is:
12379%
12380%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12381%        const char *filename,const MagickBooleanType adjoin)
12382%
12383%  A description of each parameter follows:
12384%
12385%    o wand: the magick wand.
12386%
12387%    o filename: the image filename.
12388%
12389%    o adjoin: join images into a single multi-image file.
12390%
12391*/
12392WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12393  const char *filename,const MagickBooleanType adjoin)
12394{
12395  ImageInfo
12396    *write_info;
12397
12398  MagickBooleanType
12399    status;
12400
12401  assert(wand != (MagickWand *) NULL);
12402  assert(wand->signature == WandSignature);
12403  if( IfMagickTrue(wand->debug) )
12404    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12405
12406  if (wand->images == (Image *) NULL)
12407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12408  write_info=CloneImageInfo(wand->image_info);
12409  write_info->adjoin=adjoin;
12410  status=WriteImages(write_info,wand->images,filename,wand->exception);
12411  write_info=DestroyImageInfo(write_info);
12412  return(status);
12413}
12414
12415/*
12416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12417%                                                                             %
12418%                                                                             %
12419%                                                                             %
12420%   M a g i c k W r i t e I m a g e s F i l e                                 %
12421%                                                                             %
12422%                                                                             %
12423%                                                                             %
12424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12425%
12426%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12427%
12428%  The format of the MagickWriteImagesFile method is:
12429%
12430%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12431%
12432%  A description of each parameter follows:
12433%
12434%    o wand: the magick wand.
12435%
12436%    o file: the file descriptor.
12437%
12438*/
12439WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12440{
12441  ImageInfo
12442    *write_info;
12443
12444  MagickBooleanType
12445    status;
12446
12447  assert(wand != (MagickWand *) NULL);
12448  assert(wand->signature == WandSignature);
12449  if( IfMagickTrue(wand->debug) )
12450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12451
12452  if (wand->images == (Image *) NULL)
12453    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12454  write_info=CloneImageInfo(wand->image_info);
12455  SetImageInfoFile(write_info,file);
12456  write_info->adjoin=MagickTrue;
12457  status=WriteImages(write_info,wand->images,(const char *) NULL,
12458    wand->exception);
12459  write_info=DestroyImageInfo(write_info);
12460  return(status);
12461}
12462