magick-image.c revision 3884f69ac6f82e16fc379fb6c6521960c19045a2
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-2011 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 (wand->debug != MagickFalse)
101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103  if (clone_wand == (MagickWand *) NULL)
104    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105      images->filename);
106  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107  clone_wand->id=AcquireWandId();
108  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109    MagickWandId,(double) clone_wand->id);
110  clone_wand->exception=AcquireExceptionInfo();
111  InheritException(clone_wand->exception,wand->exception);
112  clone_wand->image_info=CloneImageInfo(wand->image_info);
113  clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114  clone_wand->images=images;
115  clone_wand->debug=IsEventLogging();
116  if (clone_wand->debug != MagickFalse)
117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118  clone_wand->signature=WandSignature;
119  return(clone_wand);
120}
121
122/*
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124%                                                                             %
125%                                                                             %
126%                                                                             %
127%   G e t I m a g e F r o m M a g i c k W a n d                               %
128%                                                                             %
129%                                                                             %
130%                                                                             %
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132%
133%  GetImageFromMagickWand() returns the current image from the magick wand.
134%
135%  The format of the GetImageFromMagickWand method is:
136%
137%      Image *GetImageFromMagickWand(const MagickWand *wand)
138%
139%  A description of each parameter follows:
140%
141%    o wand: the magick wand.
142%
143*/
144WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145{
146  assert(wand != (MagickWand *) NULL);
147  assert(wand->signature == WandSignature);
148  if (wand->debug != MagickFalse)
149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150  if (wand->images == (Image *) NULL)
151    {
152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153        "ContainsNoImages","`%s'",wand->name);
154      return((Image *) NULL);
155    }
156  return(wand->images);
157}
158
159/*
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161%                                                                             %
162%                                                                             %
163%                                                                             %
164%   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                       %
165%                                                                             %
166%                                                                             %
167%                                                                             %
168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169%
170%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171%  less intensely near image edges and more intensely far from edges. We
172%  blur the image with a Gaussian operator of the given radius and standard
173%  deviation (sigma).  For reasonable results, radius should be larger than
174%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175%  suitable radius for you.
176%
177%  The format of the MagickAdaptiveBlurImage method is:
178%
179%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180%        const double radius,const double sigma)
181%
182%  A description of each parameter follows:
183%
184%    o wand: the magick wand.
185%
186%    o radius: the radius of the Gaussian, in pixels, not counting the center
187%      pixel.
188%
189%    o sigma: the standard deviation of the Gaussian, in pixels.
190%
191*/
192WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
193  const double radius,const double sigma)
194{
195  Image
196    *sharp_image;
197
198  assert(wand != (MagickWand *) NULL);
199  assert(wand->signature == WandSignature);
200  if (wand->debug != MagickFalse)
201    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
202  if (wand->images == (Image *) NULL)
203    ThrowWandException(WandError,"ContainsNoImages",wand->name);
204  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
205  if (sharp_image == (Image *) NULL)
206    return(MagickFalse);
207  ReplaceImageInList(&wand->images,sharp_image);
208  return(MagickTrue);
209}
210
211/*
212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213%                                                                             %
214%                                                                             %
215%                                                                             %
216%   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                         %
217%                                                                             %
218%                                                                             %
219%                                                                             %
220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221%
222%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
223%  triangulation.
224%
225%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
226%        const size_t columns,const size_t rows)
227%
228%  A description of each parameter follows:
229%
230%    o wand: the magick wand.
231%
232%    o columns: the number of columns in the scaled image.
233%
234%    o rows: the number of rows in the scaled image.
235%
236*/
237WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
238  const size_t columns,const size_t rows)
239{
240  Image
241    *resize_image;
242
243  assert(wand != (MagickWand *) NULL);
244  assert(wand->signature == WandSignature);
245  if (wand->debug != MagickFalse)
246    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
247  if (wand->images == (Image *) NULL)
248    ThrowWandException(WandError,"ContainsNoImages",wand->name);
249  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
250  if (resize_image == (Image *) NULL)
251    return(MagickFalse);
252  ReplaceImageInList(&wand->images,resize_image);
253  return(MagickTrue);
254}
255
256/*
257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258%                                                                             %
259%                                                                             %
260%                                                                             %
261%   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                       %
262%                                                                             %
263%                                                                             %
264%                                                                             %
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266%
267%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
268%  more intensely near image edges and less intensely far from edges. We
269%  sharpen the image with a Gaussian operator of the given radius and standard
270%  deviation (sigma).  For reasonable results, radius should be larger than
271%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
272%  suitable radius for you.
273%
274%  The format of the MagickAdaptiveSharpenImage method is:
275%
276%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
277%        const double radius,const double sigma)
278%
279%  A description of each parameter follows:
280%
281%    o wand: the magick wand.
282%
283%    o radius: the radius of the Gaussian, in pixels, not counting the center
284%      pixel.
285%
286%    o sigma: the standard deviation of the Gaussian, in pixels.
287%
288*/
289WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
290  const double radius,const double sigma)
291{
292  Image
293    *sharp_image;
294
295  assert(wand != (MagickWand *) NULL);
296  assert(wand->signature == WandSignature);
297  if (wand->debug != MagickFalse)
298    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
299  if (wand->images == (Image *) NULL)
300    ThrowWandException(WandError,"ContainsNoImages",wand->name);
301  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
302  if (sharp_image == (Image *) NULL)
303    return(MagickFalse);
304  ReplaceImageInList(&wand->images,sharp_image);
305  return(MagickTrue);
306}
307
308/*
309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310%                                                                             %
311%                                                                             %
312%                                                                             %
313%   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                   %
314%                                                                             %
315%                                                                             %
316%                                                                             %
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318%
319%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
320%  based on the range of intensity values in its local neighborhood.  This
321%  allows for thresholding of an image whose global intensity histogram
322%  doesn't contain distinctive peaks.
323%
324%  The format of the AdaptiveThresholdImage method is:
325%
326%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
327%        const size_t width,const size_t height,const ssize_t offset)
328%
329%  A description of each parameter follows:
330%
331%    o wand: the magick wand.
332%
333%    o width: the width of the local neighborhood.
334%
335%    o height: the height of the local neighborhood.
336%
337%    o offset: the mean offset.
338%
339*/
340WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
341  const size_t width,const size_t height,const ssize_t offset)
342{
343  Image
344    *threshold_image;
345
346  assert(wand != (MagickWand *) NULL);
347  assert(wand->signature == WandSignature);
348  if (wand->debug != MagickFalse)
349    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
350  if (wand->images == (Image *) NULL)
351    ThrowWandException(WandError,"ContainsNoImages",wand->name);
352  threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
353    wand->exception);
354  if (threshold_image == (Image *) NULL)
355    return(MagickFalse);
356  ReplaceImageInList(&wand->images,threshold_image);
357  return(MagickTrue);
358}
359
360/*
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%                                                                             %
363%                                                                             %
364%                                                                             %
365%   M a g i c k A d d I m a g e                                               %
366%                                                                             %
367%                                                                             %
368%                                                                             %
369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370%
371%  MagickAddImage() adds the specified images at the current image location.
372%
373%  The format of the MagickAddImage method is:
374%
375%      MagickBooleanType MagickAddImage(MagickWand *wand,
376%        const MagickWand *add_wand)
377%
378%  A description of each parameter follows:
379%
380%    o wand: the magick wand.
381%
382%    o add_wand: A wand that contains images to add at the current image
383%      location.
384%
385*/
386
387static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
388  Image *images)
389{
390  Image
391    *sentinel;
392
393  sentinel=wand->images;
394  if (sentinel == (Image *) NULL)
395    {
396      wand->images=GetFirstImageInList(images);
397      return(MagickTrue);
398    }
399  if (wand->active == MagickFalse)
400    {
401      if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
402        {
403          AppendImageToList(&sentinel,images);
404          wand->images=GetLastImageInList(images);
405          return(MagickTrue);
406        }
407      if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
408        {
409          PrependImageToList(&sentinel,images);
410          wand->images=GetFirstImageInList(images);
411          return(MagickTrue);
412        }
413    }
414  if (sentinel->next == (Image *) NULL)
415    {
416      InsertImageInList(&sentinel,images);
417      wand->images=GetLastImageInList(images);
418      return(MagickTrue);
419    }
420  InsertImageInList(&sentinel,images);
421  wand->images=GetFirstImageInList(images);
422  return(MagickTrue);
423}
424
425WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
426  const MagickWand *add_wand)
427{
428  Image
429    *images;
430
431  assert(wand != (MagickWand *) NULL);
432  assert(wand->signature == WandSignature);
433  if (wand->debug != MagickFalse)
434    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
435  assert(add_wand != (MagickWand *) NULL);
436  assert(add_wand->signature == WandSignature);
437  if (add_wand->images == (Image *) NULL)
438    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
439  images=CloneImageList(add_wand->images,wand->exception);
440  if (images == (Image *) NULL)
441    return(MagickFalse);
442  return(InsertImageInWand(wand,images));
443}
444
445/*
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447%                                                                             %
448%                                                                             %
449%                                                                             %
450%     M a g i c k A d d N o i s e I m a g e                                   %
451%                                                                             %
452%                                                                             %
453%                                                                             %
454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455%
456%  MagickAddNoiseImage() adds random noise to the image.
457%
458%  The format of the MagickAddNoiseImage method is:
459%
460%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
461%        const NoiseType noise_type)
462%
463%  A description of each parameter follows:
464%
465%    o wand: the magick wand.
466%
467%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
468%      Impulse, Laplacian, or Poisson.
469%
470*/
471WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
472  const NoiseType noise_type)
473{
474  Image
475    *noise_image;
476
477  assert(wand != (MagickWand *) NULL);
478  assert(wand->signature == WandSignature);
479  if (wand->debug != MagickFalse)
480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
481  if (wand->images == (Image *) NULL)
482    ThrowWandException(WandError,"ContainsNoImages",wand->name);
483  noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
484  if (noise_image == (Image *) NULL)
485    return(MagickFalse);
486  ReplaceImageInList(&wand->images,noise_image);
487  return(MagickTrue);
488}
489
490/*
491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492%                                                                             %
493%                                                                             %
494%                                                                             %
495%   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                       %
496%                                                                             %
497%                                                                             %
498%                                                                             %
499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500%
501%  MagickAffineTransformImage() transforms an image as dictated by the affine
502%  matrix of the drawing wand.
503%
504%  The format of the MagickAffineTransformImage method is:
505%
506%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
507%        const DrawingWand *drawing_wand)
508%
509%  A description of each parameter follows:
510%
511%    o wand: the magick wand.
512%
513%    o drawing_wand: the draw wand.
514%
515*/
516WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
517  const DrawingWand *drawing_wand)
518{
519  DrawInfo
520    *draw_info;
521
522  Image
523    *affine_image;
524
525  assert(wand != (MagickWand *) NULL);
526  assert(wand->signature == WandSignature);
527  if (wand->debug != MagickFalse)
528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
529  if (wand->images == (Image *) NULL)
530    ThrowWandException(WandError,"ContainsNoImages",wand->name);
531  draw_info=PeekDrawingWand(drawing_wand);
532  if (draw_info == (DrawInfo *) NULL)
533    return(MagickFalse);
534  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
535    wand->exception);
536  draw_info=DestroyDrawInfo(draw_info);
537  if (affine_image == (Image *) NULL)
538    return(MagickFalse);
539  ReplaceImageInList(&wand->images,affine_image);
540  return(MagickTrue);
541}
542
543/*
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545%                                                                             %
546%                                                                             %
547%                                                                             %
548%   M a g i c k A n n o t a t e I m a g e                                     %
549%                                                                             %
550%                                                                             %
551%                                                                             %
552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553%
554%  MagickAnnotateImage() annotates an image with text.
555%
556%  The format of the MagickAnnotateImage method is:
557%
558%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
559%        const DrawingWand *drawing_wand,const double x,const double y,
560%        const double angle,const char *text)
561%
562%  A description of each parameter follows:
563%
564%    o wand: the magick wand.
565%
566%    o drawing_wand: the draw wand.
567%
568%    o x: x ordinate to left of text
569%
570%    o y: y ordinate to text baseline
571%
572%    o angle: rotate text relative to this angle.
573%
574%    o text: text to draw
575%
576*/
577WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
578  const DrawingWand *drawing_wand,const double x,const double y,
579  const double angle,const char *text)
580{
581  char
582    geometry[MaxTextExtent];
583
584  DrawInfo
585    *draw_info;
586
587  MagickBooleanType
588    status;
589
590  assert(wand != (MagickWand *) NULL);
591  assert(wand->signature == WandSignature);
592  if (wand->debug != MagickFalse)
593    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
594  if (wand->images == (Image *) NULL)
595    ThrowWandException(WandError,"ContainsNoImages",wand->name);
596  draw_info=PeekDrawingWand(drawing_wand);
597  if (draw_info == (DrawInfo *) NULL)
598    return(MagickFalse);
599  (void) CloneString(&draw_info->text,text);
600  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
601  draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
602  draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
603  draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
604  draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
605  (void) CloneString(&draw_info->geometry,geometry);
606  status=AnnotateImage(wand->images,draw_info);
607  draw_info=DestroyDrawInfo(draw_info);
608  if (status == MagickFalse)
609    InheritException(wand->exception,&wand->images->exception);
610  return(status);
611}
612
613/*
614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615%                                                                             %
616%                                                                             %
617%                                                                             %
618%   M a g i c k A n i m a t e I m a g e s                                     %
619%                                                                             %
620%                                                                             %
621%                                                                             %
622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623%
624%  MagickAnimateImages() animates an image or image sequence.
625%
626%  The format of the MagickAnimateImages method is:
627%
628%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
629%        const char *server_name)
630%
631%  A description of each parameter follows:
632%
633%    o wand: the magick wand.
634%
635%    o server_name: the X server name.
636%
637*/
638WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
639  const char *server_name)
640{
641  MagickBooleanType
642    status;
643
644  assert(wand != (MagickWand *) NULL);
645  assert(wand->signature == WandSignature);
646  if (wand->debug != MagickFalse)
647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
648  (void) CloneString(&wand->image_info->server_name,server_name);
649  status=AnimateImages(wand->image_info,wand->images);
650  if (status == MagickFalse)
651    InheritException(wand->exception,&wand->images->exception);
652  return(status);
653}
654
655/*
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657%                                                                             %
658%                                                                             %
659%                                                                             %
660%   M a g i c k A p p e n d I m a g e s                                       %
661%                                                                             %
662%                                                                             %
663%                                                                             %
664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665%
666%  MagickAppendImages() append a set of images.
667%
668%  The format of the MagickAppendImages method is:
669%
670%      MagickWand *MagickAppendImages(MagickWand *wand,
671%        const MagickBooleanType stack)
672%
673%  A description of each parameter follows:
674%
675%    o wand: the magick wand.
676%
677%    o stack: By default, images are stacked left-to-right. Set stack to
678%      MagickTrue to stack them top-to-bottom.
679%
680*/
681WandExport MagickWand *MagickAppendImages(MagickWand *wand,
682  const MagickBooleanType stack)
683{
684  Image
685    *append_image;
686
687  assert(wand != (MagickWand *) NULL);
688  assert(wand->signature == WandSignature);
689  if (wand->debug != MagickFalse)
690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
691  if (wand->images == (Image *) NULL)
692    return((MagickWand *) NULL);
693  append_image=AppendImages(wand->images,stack,wand->exception);
694  if (append_image == (Image *) NULL)
695    return((MagickWand *) NULL);
696  return(CloneMagickWandFromImages(wand,append_image));
697}
698
699/*
700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701%                                                                             %
702%                                                                             %
703%                                                                             %
704%   M a g i c k A u t o G a m m a I m a g e                                   %
705%                                                                             %
706%                                                                             %
707%                                                                             %
708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709%
710%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
711%  image to try make set its gamma appropriatally.
712%
713%  The format of the MagickAutoGammaImage method is:
714%
715%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
716%
717%  A description of each parameter follows:
718%
719%    o wand: the magick wand.
720%
721*/
722WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
723{
724  MagickBooleanType
725    status;
726
727  assert(wand != (MagickWand *) NULL);
728  assert(wand->signature == WandSignature);
729  if (wand->debug != MagickFalse)
730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
731  if (wand->images == (Image *) NULL)
732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
733  status=AutoGammaImage(wand->images);
734  if (status == MagickFalse)
735    InheritException(wand->exception,&wand->images->exception);
736  return(status);
737}
738
739/*
740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741%                                                                             %
742%                                                                             %
743%                                                                             %
744%   M a g i c k A u t o L e v e l I m a g e                                   %
745%                                                                             %
746%                                                                             %
747%                                                                             %
748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749%
750%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
751%  scaling the minimum and maximum values to the full quantum range.
752%
753%  The format of the MagickAutoLevelImage method is:
754%
755%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
756%
757%  A description of each parameter follows:
758%
759%    o wand: the magick wand.
760%
761*/
762WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
763{
764  MagickBooleanType
765    status;
766
767  assert(wand != (MagickWand *) NULL);
768  assert(wand->signature == WandSignature);
769  if (wand->debug != MagickFalse)
770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
771  if (wand->images == (Image *) NULL)
772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
773  status=AutoLevelImage(wand->images);
774  if (status == MagickFalse)
775    InheritException(wand->exception,&wand->images->exception);
776  return(status);
777}
778
779/*
780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
781%                                                                             %
782%                                                                             %
783%                                                                             %
784%   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                         %
785%                                                                             %
786%                                                                             %
787%                                                                             %
788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
789%
790%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
791%  pixels below the threshold into black while leaving all pixels above the
792%  threshold unchanged.
793%
794%  The format of the MagickBlackThresholdImage method is:
795%
796%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
797%        const PixelWand *threshold)
798%
799%  A description of each parameter follows:
800%
801%    o wand: the magick wand.
802%
803%    o threshold: the pixel wand.
804%
805*/
806WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
807  const PixelWand *threshold)
808{
809  char
810    thresholds[MaxTextExtent];
811
812  MagickBooleanType
813    status;
814
815  assert(wand != (MagickWand *) NULL);
816  assert(wand->signature == WandSignature);
817  if (wand->debug != MagickFalse)
818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
819  if (wand->images == (Image *) NULL)
820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
821  (void) FormatLocaleString(thresholds,MaxTextExtent,
822    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
823    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
824    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
825  status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
826  if (status == MagickFalse)
827    InheritException(wand->exception,&wand->images->exception);
828  return(status);
829}
830
831/*
832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833%                                                                             %
834%                                                                             %
835%                                                                             %
836%   M a g i c k B l u e S h i f t I m a g e                                   %
837%                                                                             %
838%                                                                             %
839%                                                                             %
840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
841%
842%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
843%  nighttime in the moonlight.
844%
845%  The format of the MagickBlueShiftImage method is:
846%
847%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
848%        const double factor)
849%
850%  A description of each parameter follows:
851%
852%    o wand: the magick wand.
853%
854%    o factor: the blue shift factor (default 1.5)
855%
856*/
857WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
858  const double factor)
859{
860  Image
861    *shift_image;
862
863  assert(wand != (MagickWand *) NULL);
864  assert(wand->signature == WandSignature);
865  if (wand->debug != MagickFalse)
866    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
867  if (wand->images == (Image *) NULL)
868    ThrowWandException(WandError,"ContainsNoImages",wand->name);
869  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
870  if (shift_image == (Image *) NULL)
871    return(MagickFalse);
872  ReplaceImageInList(&wand->images,shift_image);
873  return(MagickTrue);
874}
875
876/*
877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
878%                                                                             %
879%                                                                             %
880%                                                                             %
881%   M a g i c k B l u r I m a g e                                             %
882%                                                                             %
883%                                                                             %
884%                                                                             %
885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
886%
887%  MagickBlurImage() blurs an image.  We convolve the image with a
888%  gaussian operator of the given radius and standard deviation (sigma).
889%  For reasonable results, the radius should be larger than sigma.  Use a
890%  radius of 0 and BlurImage() selects a suitable radius for you.
891%
892%  The format of the MagickBlurImage method is:
893%
894%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
895%        const double sigma)
896%
897%  A description of each parameter follows:
898%
899%    o wand: the magick wand.
900%
901%    o radius: the radius of the , in pixels, not counting the center
902%      pixel.
903%
904%    o sigma: the standard deviation of the , in pixels.
905%
906*/
907WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
908  const double radius,const double sigma)
909{
910  Image
911    *blur_image;
912
913  assert(wand != (MagickWand *) NULL);
914  assert(wand->signature == WandSignature);
915  if (wand->debug != MagickFalse)
916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
917  if (wand->images == (Image *) NULL)
918    ThrowWandException(WandError,"ContainsNoImages",wand->name);
919  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
920  if (blur_image == (Image *) NULL)
921    return(MagickFalse);
922  ReplaceImageInList(&wand->images,blur_image);
923  return(MagickTrue);
924}
925
926/*
927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928%                                                                             %
929%                                                                             %
930%                                                                             %
931%   M a g i c k B o r d e r I m a g e                                         %
932%                                                                             %
933%                                                                             %
934%                                                                             %
935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
936%
937%  MagickBorderImage() surrounds the image with a border of the color defined
938%  by the bordercolor pixel wand.
939%
940%  The format of the MagickBorderImage method is:
941%
942%      MagickBooleanType MagickBorderImage(MagickWand *wand,
943%        const PixelWand *bordercolor,const size_t width,
944%        const size_t height)
945%
946%  A description of each parameter follows:
947%
948%    o wand: the magick wand.
949%
950%    o bordercolor: the border color pixel wand.
951%
952%    o width: the border width.
953%
954%    o height: the border height.
955%
956*/
957WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
958  const PixelWand *bordercolor,const size_t width,
959  const size_t height)
960{
961  Image
962    *border_image;
963
964  RectangleInfo
965    border_info;
966
967  assert(wand != (MagickWand *) NULL);
968  assert(wand->signature == WandSignature);
969  if (wand->debug != MagickFalse)
970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
971  if (wand->images == (Image *) NULL)
972    ThrowWandException(WandError,"ContainsNoImages",wand->name);
973  border_info.width=width;
974  border_info.height=height;
975  border_info.x=0;
976  border_info.y=0;
977  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
978  border_image=BorderImage(wand->images,&border_info,wand->exception);
979  if (border_image == (Image *) NULL)
980    return(MagickFalse);
981  ReplaceImageInList(&wand->images,border_image);
982  return(MagickTrue);
983}
984
985/*
986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987%                                                                             %
988%                                                                             %
989%                                                                             %
990%   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   %
991%                                                                             %
992%                                                                             %
993%                                                                             %
994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995%
996%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
997%  of an image.  It converts the brightness and contrast parameters into slope
998%  and intercept and calls a polynomical function to apply to the image.
999
1000%
1001%  The format of the MagickBrightnessContrastImage method is:
1002%
1003%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1004%        const double brightness,const double contrast)
1005%
1006%  A description of each parameter follows:
1007%
1008%    o wand: the magick wand.
1009%
1010%    o brightness: the brightness percent (-100 .. 100).
1011%
1012%    o contrast: the contrast percent (-100 .. 100).
1013%
1014*/
1015WandExport MagickBooleanType MagickBrightnessContrastImage(
1016  MagickWand *wand,const double brightness,const double contrast)
1017{
1018  MagickBooleanType
1019    status;
1020
1021  assert(wand != (MagickWand *) NULL);
1022  assert(wand->signature == WandSignature);
1023  if (wand->debug != MagickFalse)
1024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1025  if (wand->images == (Image *) NULL)
1026    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1027  status=BrightnessContrastImage(wand->images,brightness,contrast);
1028  if (status == MagickFalse)
1029    InheritException(wand->exception,&wand->images->exception);
1030  return(status);
1031}
1032
1033/*
1034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1035%                                                                             %
1036%                                                                             %
1037%                                                                             %
1038%   M a g i c k C h a r c o a l I m a g e                                     %
1039%                                                                             %
1040%                                                                             %
1041%                                                                             %
1042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1043%
1044%  MagickCharcoalImage() simulates a charcoal drawing.
1045%
1046%  The format of the MagickCharcoalImage method is:
1047%
1048%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1049%        const double radius,const double sigma)
1050%
1051%  A description of each parameter follows:
1052%
1053%    o wand: the magick wand.
1054%
1055%    o radius: the radius of the Gaussian, in pixels, not counting the center
1056%      pixel.
1057%
1058%    o sigma: the standard deviation of the Gaussian, in pixels.
1059%
1060*/
1061WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1062  const double radius,const double sigma)
1063{
1064  Image
1065    *charcoal_image;
1066
1067  assert(wand != (MagickWand *) NULL);
1068  assert(wand->signature == WandSignature);
1069  if (wand->debug != MagickFalse)
1070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1071  if (wand->images == (Image *) NULL)
1072    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1073  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1074  if (charcoal_image == (Image *) NULL)
1075    return(MagickFalse);
1076  ReplaceImageInList(&wand->images,charcoal_image);
1077  return(MagickTrue);
1078}
1079
1080/*
1081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082%                                                                             %
1083%                                                                             %
1084%                                                                             %
1085%   M a g i c k C h o p I m a g e                                             %
1086%                                                                             %
1087%                                                                             %
1088%                                                                             %
1089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090%
1091%  MagickChopImage() removes a region of an image and collapses the image to
1092%  occupy the removed portion
1093%
1094%  The format of the MagickChopImage method is:
1095%
1096%      MagickBooleanType MagickChopImage(MagickWand *wand,
1097%        const size_t width,const size_t height,const ssize_t x,
1098%        const ssize_t y)
1099%
1100%  A description of each parameter follows:
1101%
1102%    o wand: the magick wand.
1103%
1104%    o width: the region width.
1105%
1106%    o height: the region height.
1107%
1108%    o x: the region x offset.
1109%
1110%    o y: the region y offset.
1111%
1112%
1113*/
1114WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1115  const size_t width,const size_t height,const ssize_t x,
1116  const ssize_t y)
1117{
1118  Image
1119    *chop_image;
1120
1121  RectangleInfo
1122    chop;
1123
1124  assert(wand != (MagickWand *) NULL);
1125  assert(wand->signature == WandSignature);
1126  if (wand->debug != MagickFalse)
1127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1128  if (wand->images == (Image *) NULL)
1129    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1130  chop.width=width;
1131  chop.height=height;
1132  chop.x=x;
1133  chop.y=y;
1134  chop_image=ChopImage(wand->images,&chop,wand->exception);
1135  if (chop_image == (Image *) NULL)
1136    return(MagickFalse);
1137  ReplaceImageInList(&wand->images,chop_image);
1138  return(MagickTrue);
1139}
1140
1141/*
1142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143%                                                                             %
1144%                                                                             %
1145%                                                                             %
1146%   M a g i c k C l a m p I m a g e                                           %
1147%                                                                             %
1148%                                                                             %
1149%                                                                             %
1150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1151%
1152%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1153%
1154%  The format of the MagickClampImage method is:
1155%
1156%      MagickBooleanType MagickClampImage(MagickWand *wand)
1157%
1158%  A description of each parameter follows:
1159%
1160%    o wand: the magick wand.
1161%
1162%    o channel: the channel.
1163%
1164*/
1165WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1166{
1167  MagickBooleanType
1168    status;
1169
1170  assert(wand != (MagickWand *) NULL);
1171  assert(wand->signature == WandSignature);
1172  if (wand->debug != MagickFalse)
1173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1174  if (wand->images == (Image *) NULL)
1175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1176  status=ClampImage(wand->images);
1177  if (status == MagickFalse)
1178    InheritException(wand->exception,&wand->images->exception);
1179  return(status);
1180}
1181
1182/*
1183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184%                                                                             %
1185%                                                                             %
1186%                                                                             %
1187%   M a g i c k C l i p I m a g e                                             %
1188%                                                                             %
1189%                                                                             %
1190%                                                                             %
1191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1192%
1193%  MagickClipImage() clips along the first path from the 8BIM profile, if
1194%  present.
1195%
1196%  The format of the MagickClipImage method is:
1197%
1198%      MagickBooleanType MagickClipImage(MagickWand *wand)
1199%
1200%  A description of each parameter follows:
1201%
1202%    o wand: the magick wand.
1203%
1204*/
1205WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1206{
1207  MagickBooleanType
1208    status;
1209
1210  assert(wand != (MagickWand *) NULL);
1211  assert(wand->signature == WandSignature);
1212  if (wand->debug != MagickFalse)
1213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1214  if (wand->images == (Image *) NULL)
1215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1216  status=ClipImage(wand->images);
1217  if (status == MagickFalse)
1218    InheritException(wand->exception,&wand->images->exception);
1219  return(status);
1220}
1221
1222/*
1223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1224%                                                                             %
1225%                                                                             %
1226%                                                                             %
1227%   M a g i c k C l i p I m a g e P a t h                                     %
1228%                                                                             %
1229%                                                                             %
1230%                                                                             %
1231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232%
1233%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1234%  present. Later operations take effect inside the path.  Id may be a number
1235%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1236%  path.
1237%
1238%  The format of the MagickClipImagePath method is:
1239%
1240%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1241%        const char *pathname,const MagickBooleanType inside)
1242%
1243%  A description of each parameter follows:
1244%
1245%    o wand: the magick wand.
1246%
1247%    o pathname: name of clipping path resource. If name is preceded by #, use
1248%      clipping path numbered by name.
1249%
1250%    o inside: if non-zero, later operations take effect inside clipping path.
1251%      Otherwise later operations take effect outside clipping path.
1252%
1253*/
1254WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1255  const char *pathname,const MagickBooleanType inside)
1256{
1257  MagickBooleanType
1258    status;
1259
1260  assert(wand != (MagickWand *) NULL);
1261  assert(wand->signature == WandSignature);
1262  if (wand->debug != MagickFalse)
1263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1264  if (wand->images == (Image *) NULL)
1265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1266  status=ClipImagePath(wand->images,pathname,inside);
1267  if (status == MagickFalse)
1268    InheritException(wand->exception,&wand->images->exception);
1269  return(status);
1270}
1271
1272/*
1273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1274%                                                                             %
1275%                                                                             %
1276%                                                                             %
1277%   M a g i c k C l u t I m a g e                                             %
1278%                                                                             %
1279%                                                                             %
1280%                                                                             %
1281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1282%
1283%  MagickClutImage() replaces colors in the image from a color lookup table.
1284%
1285%  The format of the MagickClutImage method is:
1286%
1287%      MagickBooleanType MagickClutImage(MagickWand *wand,
1288%        const MagickWand *clut_wand)
1289%
1290%  A description of each parameter follows:
1291%
1292%    o wand: the magick wand.
1293%
1294%    o clut_image: the clut image.
1295%
1296*/
1297WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1298  const MagickWand *clut_wand)
1299{
1300  MagickBooleanType
1301    status;
1302
1303  assert(wand != (MagickWand *) NULL);
1304  assert(wand->signature == WandSignature);
1305  if (wand->debug != MagickFalse)
1306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1307  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1308    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1309  status=ClutImage(wand->images,clut_wand->images);
1310  if (status == MagickFalse)
1311    InheritException(wand->exception,&wand->images->exception);
1312  return(status);
1313}
1314
1315/*
1316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1317%                                                                             %
1318%                                                                             %
1319%                                                                             %
1320%   M a g i c k C o a l e s c e I m a g e s                                   %
1321%                                                                             %
1322%                                                                             %
1323%                                                                             %
1324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1325%
1326%  MagickCoalesceImages() composites a set of images while respecting any page
1327%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1328%  typically start with an image background and each subsequent image
1329%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1330%  where each image in the sequence is the same size as the first and
1331%  composited with the next image in the sequence.
1332%
1333%  The format of the MagickCoalesceImages method is:
1334%
1335%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1336%
1337%  A description of each parameter follows:
1338%
1339%    o wand: the magick wand.
1340%
1341*/
1342WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1343{
1344  Image
1345    *coalesce_image;
1346
1347  assert(wand != (MagickWand *) NULL);
1348  assert(wand->signature == WandSignature);
1349  if (wand->debug != MagickFalse)
1350    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1351  if (wand->images == (Image *) NULL)
1352    return((MagickWand *) NULL);
1353  coalesce_image=CoalesceImages(wand->images,wand->exception);
1354  if (coalesce_image == (Image *) NULL)
1355    return((MagickWand *) NULL);
1356  return(CloneMagickWandFromImages(wand,coalesce_image));
1357}
1358
1359/*
1360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1361%                                                                             %
1362%                                                                             %
1363%                                                                             %
1364%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1365%                                                                             %
1366%                                                                             %
1367%                                                                             %
1368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369%
1370%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1371%  Collection (CCC) file which solely contains one or more color corrections
1372%  and applies the color correction to the image.  Here is a sample CCC file:
1373%
1374%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1375%          <ColorCorrection id="cc03345">
1376%                <SOPNode>
1377%                     <Slope> 0.9 1.2 0.5 </Slope>
1378%                     <Offset> 0.4 -0.5 0.6 </Offset>
1379%                     <Power> 1.0 0.8 1.5 </Power>
1380%                </SOPNode>
1381%                <SATNode>
1382%                     <Saturation> 0.85 </Saturation>
1383%                </SATNode>
1384%          </ColorCorrection>
1385%    </ColorCorrectionCollection>
1386%
1387%  which includes the offset, slope, and power for each of the RGB channels
1388%  as well as the saturation.
1389%
1390%  The format of the MagickColorDecisionListImage method is:
1391%
1392%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1393%        const double gamma)
1394%
1395%  A description of each parameter follows:
1396%
1397%    o wand: the magick wand.
1398%
1399%    o color_correction_collection: the color correction collection in XML.
1400%
1401*/
1402WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1403  const char *color_correction_collection)
1404{
1405  MagickBooleanType
1406    status;
1407
1408  assert(wand != (MagickWand *) NULL);
1409  assert(wand->signature == WandSignature);
1410  if (wand->debug != MagickFalse)
1411    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1412  if (wand->images == (Image *) NULL)
1413    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1414  status=ColorDecisionListImage(wand->images,color_correction_collection);
1415  if (status == MagickFalse)
1416    InheritException(wand->exception,&wand->images->exception);
1417  return(status);
1418}
1419
1420/*
1421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422%                                                                             %
1423%                                                                             %
1424%                                                                             %
1425%   M a g i c k C o l o r i z e I m a g e                                     %
1426%                                                                             %
1427%                                                                             %
1428%                                                                             %
1429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1430%
1431%  MagickColorizeImage() blends the fill color with each pixel in the image.
1432%
1433%  The format of the MagickColorizeImage method is:
1434%
1435%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1436%        const PixelWand *colorize,const PixelWand *opacity)
1437%
1438%  A description of each parameter follows:
1439%
1440%    o wand: the magick wand.
1441%
1442%    o colorize: the colorize pixel wand.
1443%
1444%    o opacity: the opacity pixel wand.
1445%
1446*/
1447WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1448  const PixelWand *colorize,const PixelWand *opacity)
1449{
1450  char
1451    percent_opaque[MaxTextExtent];
1452
1453  Image
1454    *colorize_image;
1455
1456  PixelPacket
1457    target;
1458
1459  assert(wand != (MagickWand *) NULL);
1460  assert(wand->signature == WandSignature);
1461  if (wand->debug != MagickFalse)
1462    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1463  if (wand->images == (Image *) NULL)
1464    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1465  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1466    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1467    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1468    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1469    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1470    PixelGetOpacityQuantum(opacity)));
1471  PixelGetQuantumPacket(colorize,&target);
1472  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1473    wand->exception);
1474  if (colorize_image == (Image *) NULL)
1475    return(MagickFalse);
1476  ReplaceImageInList(&wand->images,colorize_image);
1477  return(MagickTrue);
1478}
1479
1480/*
1481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1482%                                                                             %
1483%                                                                             %
1484%                                                                             %
1485%   M a g i c k C o l o r M a t r i x I m a g e                               %
1486%                                                                             %
1487%                                                                             %
1488%                                                                             %
1489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1490%
1491%  MagickColorMatrixImage() apply color transformation to an image. The method
1492%  permits saturation changes, hue rotation, luminance to alpha, and various
1493%  other effects.  Although variable-sized transformation matrices can be used,
1494%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1495%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1496%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1497%  and offsets are normalized (divide Flash offset by 255).
1498%
1499%  The format of the MagickColorMatrixImage method is:
1500%
1501%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1502%        const KernelInfo *color_matrix)
1503%
1504%  A description of each parameter follows:
1505%
1506%    o wand: the magick wand.
1507%
1508%    o color_matrix:  the color matrix.
1509%
1510*/
1511WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1512  const KernelInfo *color_matrix)
1513{
1514  Image
1515    *color_image;
1516
1517  assert(wand != (MagickWand *) NULL);
1518  assert(wand->signature == WandSignature);
1519  if (wand->debug != MagickFalse)
1520    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1521  if (color_matrix == (const KernelInfo *) NULL)
1522    return(MagickFalse);
1523  if (wand->images == (Image *) NULL)
1524    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1525  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1526  if (color_image == (Image *) NULL)
1527    return(MagickFalse);
1528  ReplaceImageInList(&wand->images,color_image);
1529  return(MagickTrue);
1530}
1531
1532/*
1533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1534%                                                                             %
1535%                                                                             %
1536%                                                                             %
1537%   M a g i c k C o m b i n e I m a g e s                                     %
1538%                                                                             %
1539%                                                                             %
1540%                                                                             %
1541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1542%
1543%  MagickCombineImages() combines one or more images into a single image.  The
1544%  grayscale value of the pixels of each image in the sequence is assigned in
1545%  order to the specified  hannels of the combined image.   The typical
1546%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1547%
1548%  The format of the MagickCombineImages method is:
1549%
1550%      MagickWand *MagickCombineImages(MagickWand *wand)
1551%
1552%  A description of each parameter follows:
1553%
1554%    o wand: the magick wand.
1555%
1556*/
1557WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1558{
1559  Image
1560    *combine_image;
1561
1562  assert(wand != (MagickWand *) NULL);
1563  assert(wand->signature == WandSignature);
1564  if (wand->debug != MagickFalse)
1565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1566  if (wand->images == (Image *) NULL)
1567    return((MagickWand *) NULL);
1568  combine_image=CombineImages(wand->images,wand->exception);
1569  if (combine_image == (Image *) NULL)
1570    return((MagickWand *) NULL);
1571  return(CloneMagickWandFromImages(wand,combine_image));
1572}
1573
1574/*
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%                                                                             %
1577%                                                                             %
1578%                                                                             %
1579%   M a g i c k C o m m e n t I m a g e                                       %
1580%                                                                             %
1581%                                                                             %
1582%                                                                             %
1583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1584%
1585%  MagickCommentImage() adds a comment to your image.
1586%
1587%  The format of the MagickCommentImage method is:
1588%
1589%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1590%        const char *comment)
1591%
1592%  A description of each parameter follows:
1593%
1594%    o wand: the magick wand.
1595%
1596%    o comment: the image comment.
1597%
1598*/
1599WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1600  const char *comment)
1601{
1602  MagickBooleanType
1603    status;
1604
1605  assert(wand != (MagickWand *) NULL);
1606  assert(wand->signature == WandSignature);
1607  if (wand->debug != MagickFalse)
1608    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1609  if (wand->images == (Image *) NULL)
1610    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1611  status=SetImageProperty(wand->images,"comment",comment);
1612  if (status == MagickFalse)
1613    InheritException(wand->exception,&wand->images->exception);
1614  return(status);
1615}
1616
1617/*
1618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619%                                                                             %
1620%                                                                             %
1621%                                                                             %
1622%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1623%                                                                             %
1624%                                                                             %
1625%                                                                             %
1626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1627%
1628%  MagickCompareImagesLayers() compares each image with the next in a sequence
1629%  and returns the maximum bounding region of any pixel differences it
1630%  discovers.
1631%
1632%  The format of the MagickCompareImagesLayers method is:
1633%
1634%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1635%        const ImageLayerMethod method)
1636%
1637%  A description of each parameter follows:
1638%
1639%    o wand: the magick wand.
1640%
1641%    o method: the compare method.
1642%
1643*/
1644WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1645  const ImageLayerMethod method)
1646{
1647  Image
1648    *layers_image;
1649
1650  assert(wand != (MagickWand *) NULL);
1651  assert(wand->signature == WandSignature);
1652  if (wand->debug != MagickFalse)
1653    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1654  if (wand->images == (Image *) NULL)
1655    return((MagickWand *) NULL);
1656  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1657  if (layers_image == (Image *) NULL)
1658    return((MagickWand *) NULL);
1659  return(CloneMagickWandFromImages(wand,layers_image));
1660}
1661
1662/*
1663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664%                                                                             %
1665%                                                                             %
1666%                                                                             %
1667%   M a g i c k C o m p a r e I m a g e s                                     %
1668%                                                                             %
1669%                                                                             %
1670%                                                                             %
1671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1672%
1673%  MagickCompareImages() compares an image to a reconstructed image and returns
1674%  the specified difference image.
1675%
1676%  The format of the MagickCompareImages method is:
1677%
1678%      MagickWand *MagickCompareImages(MagickWand *wand,
1679%        const MagickWand *reference,const MetricType metric,
1680%        double *distortion)
1681%
1682%  A description of each parameter follows:
1683%
1684%    o wand: the magick wand.
1685%
1686%    o reference: the reference wand.
1687%
1688%    o metric: the metric.
1689%
1690%    o distortion: the computed distortion between the images.
1691%
1692*/
1693WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1694  const MagickWand *reference,const MetricType metric,double *distortion)
1695{
1696  Image
1697    *compare_image;
1698
1699
1700  assert(wand != (MagickWand *) NULL);
1701  assert(wand->signature == WandSignature);
1702  if (wand->debug != MagickFalse)
1703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1704  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1705    {
1706      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1707        "ContainsNoImages","`%s'",wand->name);
1708      return((MagickWand *) NULL);
1709    }
1710  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1711    &wand->images->exception);
1712  if (compare_image == (Image *) NULL)
1713    return((MagickWand *) NULL);
1714  return(CloneMagickWandFromImages(wand,compare_image));
1715}
1716
1717/*
1718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719%                                                                             %
1720%                                                                             %
1721%                                                                             %
1722%   M a g i c k C o m p o s i t e I m a g e                                   %
1723%                                                                             %
1724%                                                                             %
1725%                                                                             %
1726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1727%
1728%  MagickCompositeImage() composite one image onto another at the specified
1729%  offset.
1730%
1731%  The format of the MagickCompositeImage method is:
1732%
1733%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1734%        const MagickWand *composite_wand,const CompositeOperator compose,
1735%        const ssize_t x,const ssize_t y)
1736%
1737%  A description of each parameter follows:
1738%
1739%    o wand: the magick wand.
1740%
1741%    o composite_image: the composite image.
1742%
1743%    o compose: This operator affects how the composite is applied to the
1744%      image.  The default is Over.  Choose from these operators:
1745%
1746%        OverCompositeOp       InCompositeOp         OutCompositeOp
1747%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1748%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1749%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1750%        DisplaceCompositeOp
1751%
1752%    o x: the column offset of the composited image.
1753%
1754%    o y: the row offset of the composited image.
1755%
1756*/
1757WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1758  const MagickWand *composite_wand,const CompositeOperator compose,
1759  const ssize_t x,const ssize_t y)
1760{
1761  MagickBooleanType
1762    status;
1763
1764  assert(wand != (MagickWand *) NULL);
1765  assert(wand->signature == WandSignature);
1766  if (wand->debug != MagickFalse)
1767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1768  if ((wand->images == (Image *) NULL) ||
1769      (composite_wand->images == (Image *) NULL))
1770    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1771  status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1772  if (status == MagickFalse)
1773    InheritException(wand->exception,&wand->images->exception);
1774  return(status);
1775}
1776
1777/*
1778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1779%                                                                             %
1780%                                                                             %
1781%                                                                             %
1782%   M a g i c k C o n t r a s t I m a g e                                     %
1783%                                                                             %
1784%                                                                             %
1785%                                                                             %
1786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1787%
1788%  MagickContrastImage() enhances the intensity differences between the lighter
1789%  and darker elements of the image.  Set sharpen to a value other than 0 to
1790%  increase the image contrast otherwise the contrast is reduced.
1791%
1792%  The format of the MagickContrastImage method is:
1793%
1794%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1795%        const MagickBooleanType sharpen)
1796%
1797%  A description of each parameter follows:
1798%
1799%    o wand: the magick wand.
1800%
1801%    o sharpen: Increase or decrease image contrast.
1802%
1803%
1804*/
1805WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1806  const MagickBooleanType sharpen)
1807{
1808  MagickBooleanType
1809    status;
1810
1811  assert(wand != (MagickWand *) NULL);
1812  assert(wand->signature == WandSignature);
1813  if (wand->debug != MagickFalse)
1814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1815  if (wand->images == (Image *) NULL)
1816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1817  status=ContrastImage(wand->images,sharpen);
1818  if (status == MagickFalse)
1819    InheritException(wand->exception,&wand->images->exception);
1820  return(status);
1821}
1822
1823/*
1824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825%                                                                             %
1826%                                                                             %
1827%                                                                             %
1828%   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                       %
1829%                                                                             %
1830%                                                                             %
1831%                                                                             %
1832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1833%
1834%  MagickContrastStretchImage() enhances the contrast of a color image by
1835%  adjusting the pixels color to span the entire range of colors available.
1836%  You can also reduce the influence of a particular channel with a gamma
1837%  value of 0.
1838%
1839%  The format of the MagickContrastStretchImage method is:
1840%
1841%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1842%        const double black_point,const double white_point)
1843%
1844%  A description of each parameter follows:
1845%
1846%    o wand: the magick wand.
1847%
1848%    o black_point: the black point.
1849%
1850%    o white_point: the white point.
1851%
1852*/
1853WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1854  const double black_point,const double white_point)
1855{
1856  MagickBooleanType
1857    status;
1858
1859  assert(wand != (MagickWand *) NULL);
1860  assert(wand->signature == WandSignature);
1861  if (wand->debug != MagickFalse)
1862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1863  if (wand->images == (Image *) NULL)
1864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1865  status=ContrastStretchImage(wand->images,black_point,white_point);
1866  if (status == MagickFalse)
1867    InheritException(wand->exception,&wand->images->exception);
1868  return(status);
1869}
1870
1871/*
1872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1873%                                                                             %
1874%                                                                             %
1875%                                                                             %
1876%   M a g i c k C o n v o l v e I m a g e                                     %
1877%                                                                             %
1878%                                                                             %
1879%                                                                             %
1880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1881%
1882%  MagickConvolveImage() applies a custom convolution kernel to the image.
1883%
1884%  The format of the MagickConvolveImage method is:
1885%
1886%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1887%        const size_t order,const double *kernel)
1888%
1889%  A description of each parameter follows:
1890%
1891%    o wand: the magick wand.
1892%
1893%    o order: the number of columns and rows in the filter kernel.
1894%
1895%    o kernel: An array of doubles representing the convolution kernel.
1896%
1897*/
1898WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1899  const size_t order,const double *kernel)
1900{
1901  Image
1902    *convolve_image;
1903
1904  assert(wand != (MagickWand *) NULL);
1905  assert(wand->signature == WandSignature);
1906  if (wand->debug != MagickFalse)
1907    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1908  if (kernel == (const double *) NULL)
1909    return(MagickFalse);
1910  if (wand->images == (Image *) NULL)
1911    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1912  convolve_image=ConvolveImage(wand->images,order,kernel,wand->exception);
1913  if (convolve_image == (Image *) NULL)
1914    return(MagickFalse);
1915  ReplaceImageInList(&wand->images,convolve_image);
1916  return(MagickTrue);
1917}
1918
1919/*
1920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1921%                                                                             %
1922%                                                                             %
1923%                                                                             %
1924%   M a g i c k C r o p I m a g e                                             %
1925%                                                                             %
1926%                                                                             %
1927%                                                                             %
1928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1929%
1930%  MagickCropImage() extracts a region of the image.
1931%
1932%  The format of the MagickCropImage method is:
1933%
1934%      MagickBooleanType MagickCropImage(MagickWand *wand,
1935%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1936%
1937%  A description of each parameter follows:
1938%
1939%    o wand: the magick wand.
1940%
1941%    o width: the region width.
1942%
1943%    o height: the region height.
1944%
1945%    o x: the region x-offset.
1946%
1947%    o y: the region y-offset.
1948%
1949*/
1950WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1951  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1952{
1953  Image
1954    *crop_image;
1955
1956  RectangleInfo
1957    crop;
1958
1959  assert(wand != (MagickWand *) NULL);
1960  assert(wand->signature == WandSignature);
1961  if (wand->debug != MagickFalse)
1962    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1963  if (wand->images == (Image *) NULL)
1964    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1965  crop.width=width;
1966  crop.height=height;
1967  crop.x=x;
1968  crop.y=y;
1969  crop_image=CropImage(wand->images,&crop,wand->exception);
1970  if (crop_image == (Image *) NULL)
1971    return(MagickFalse);
1972  ReplaceImageInList(&wand->images,crop_image);
1973  return(MagickTrue);
1974}
1975
1976/*
1977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1978%                                                                             %
1979%                                                                             %
1980%                                                                             %
1981%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1982%                                                                             %
1983%                                                                             %
1984%                                                                             %
1985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1986%
1987%  MagickCycleColormapImage() displaces an image's colormap by a given number
1988%  of positions.  If you cycle the colormap a number of times you can produce
1989%  a psychodelic effect.
1990%
1991%  The format of the MagickCycleColormapImage method is:
1992%
1993%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1994%        const ssize_t displace)
1995%
1996%  A description of each parameter follows:
1997%
1998%    o wand: the magick wand.
1999%
2000%    o pixel_wand: the pixel wand.
2001%
2002*/
2003WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2004  const ssize_t displace)
2005{
2006  MagickBooleanType
2007    status;
2008
2009  assert(wand != (MagickWand *) NULL);
2010  assert(wand->signature == WandSignature);
2011  if (wand->debug != MagickFalse)
2012    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2013  if (wand->images == (Image *) NULL)
2014    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2015  status=CycleColormapImage(wand->images,displace);
2016  if (status == MagickFalse)
2017    InheritException(wand->exception,&wand->images->exception);
2018  return(status);
2019}
2020
2021/*
2022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023%                                                                             %
2024%                                                                             %
2025%                                                                             %
2026%   M a g i c k C o n s t i t u t e I m a g e                                 %
2027%                                                                             %
2028%                                                                             %
2029%                                                                             %
2030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2031%
2032%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2033%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2034%  The data can be char, short int, int, float, or double.  Float and double
2035%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2036%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2037%  example, to create a 640x480 image from unsigned red-green-blue character
2038%  data, use
2039%
2040%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2041%
2042%  The format of the MagickConstituteImage method is:
2043%
2044%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2045%        const size_t columns,const size_t rows,const char *map,
2046%        const StorageType storage,void *pixels)
2047%
2048%  A description of each parameter follows:
2049%
2050%    o wand: the magick wand.
2051%
2052%    o columns: width in pixels of the image.
2053%
2054%    o rows: height in pixels of the image.
2055%
2056%    o map:  This string reflects the expected ordering of the pixel array.
2057%      It can be any combination or order of R = red, G = green, B = blue,
2058%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2059%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2060%      P = pad.
2061%
2062%    o storage: Define the data type of the pixels.  Float and double types are
2063%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2064%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2065%      LongPixel, QuantumPixel, or ShortPixel.
2066%
2067%    o pixels: This array of values contain the pixel components as defined by
2068%      map and type.  You must preallocate this array where the expected
2069%      length varies depending on the values of width, height, map, and type.
2070%
2071%
2072*/
2073WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2074  const size_t columns,const size_t rows,const char *map,
2075  const StorageType storage,const void *pixels)
2076{
2077  Image
2078    *images;
2079
2080  assert(wand != (MagickWand *) NULL);
2081  assert(wand->signature == WandSignature);
2082  if (wand->debug != MagickFalse)
2083    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2084  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2085  if (images == (Image *) NULL)
2086    return(MagickFalse);
2087  return(InsertImageInWand(wand,images));
2088}
2089
2090/*
2091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2092%                                                                             %
2093%                                                                             %
2094%                                                                             %
2095%   M a g i c k D e c i p h e r I m a g e                                     %
2096%                                                                             %
2097%                                                                             %
2098%                                                                             %
2099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2100%
2101%  MagickDecipherImage() converts cipher pixels to plain pixels.
2102%
2103%  The format of the MagickDecipherImage method is:
2104%
2105%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2106%        const char *passphrase)
2107%
2108%  A description of each parameter follows:
2109%
2110%    o wand: the magick wand.
2111%
2112%    o passphrase: the passphrase.
2113%
2114*/
2115WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2116  const char *passphrase)
2117{
2118  assert(wand != (MagickWand *) NULL);
2119  assert(wand->signature == WandSignature);
2120  if (wand->debug != MagickFalse)
2121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2122  if (wand->images == (Image *) NULL)
2123    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2124  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2125}
2126
2127/*
2128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2129%                                                                             %
2130%                                                                             %
2131%                                                                             %
2132%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2133%                                                                             %
2134%                                                                             %
2135%                                                                             %
2136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2137%
2138%  MagickDeconstructImages() compares each image with the next in a sequence
2139%  and returns the maximum bounding region of any pixel differences it
2140%  discovers.
2141%
2142%  The format of the MagickDeconstructImages method is:
2143%
2144%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2145%
2146%  A description of each parameter follows:
2147%
2148%    o wand: the magick wand.
2149%
2150*/
2151WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2152{
2153  Image
2154    *deconstruct_image;
2155
2156  assert(wand != (MagickWand *) NULL);
2157  assert(wand->signature == WandSignature);
2158  if (wand->debug != MagickFalse)
2159    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2160  if (wand->images == (Image *) NULL)
2161    return((MagickWand *) NULL);
2162  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2163    wand->exception);
2164  if (deconstruct_image == (Image *) NULL)
2165    return((MagickWand *) NULL);
2166  return(CloneMagickWandFromImages(wand,deconstruct_image));
2167}
2168
2169/*
2170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2171%                                                                             %
2172%                                                                             %
2173%                                                                             %
2174%     M a g i c k D e s k e w I m a g e                                       %
2175%                                                                             %
2176%                                                                             %
2177%                                                                             %
2178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2179%
2180%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2181%  occurs in scanned images because of the camera being misaligned,
2182%  imperfections in the scanning or surface, or simply because the paper was
2183%  not placed completely flat when scanned.
2184%
2185%  The format of the MagickDeskewImage method is:
2186%
2187%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2188%        const double threshold)
2189%
2190%  A description of each parameter follows:
2191%
2192%    o wand: the magick wand.
2193%
2194%    o threshold: separate background from foreground.
2195%
2196*/
2197WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2198  const double threshold)
2199{
2200  Image
2201    *sepia_image;
2202
2203  assert(wand != (MagickWand *) NULL);
2204  assert(wand->signature == WandSignature);
2205  if (wand->debug != MagickFalse)
2206    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2207  if (wand->images == (Image *) NULL)
2208    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2209  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2210  if (sepia_image == (Image *) NULL)
2211    return(MagickFalse);
2212  ReplaceImageInList(&wand->images,sepia_image);
2213  return(MagickTrue);
2214}
2215
2216/*
2217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2218%                                                                             %
2219%                                                                             %
2220%                                                                             %
2221%     M a g i c k D e s p e c k l e I m a g e                                 %
2222%                                                                             %
2223%                                                                             %
2224%                                                                             %
2225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2226%
2227%  MagickDespeckleImage() reduces the speckle noise in an image while
2228%  perserving the edges of the original image.
2229%
2230%  The format of the MagickDespeckleImage method is:
2231%
2232%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2233%
2234%  A description of each parameter follows:
2235%
2236%    o wand: the magick wand.
2237%
2238*/
2239WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2240{
2241  Image
2242    *despeckle_image;
2243
2244  assert(wand != (MagickWand *) NULL);
2245  assert(wand->signature == WandSignature);
2246  if (wand->debug != MagickFalse)
2247    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2248  if (wand->images == (Image *) NULL)
2249    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2250  despeckle_image=DespeckleImage(wand->images,wand->exception);
2251  if (despeckle_image == (Image *) NULL)
2252    return(MagickFalse);
2253  ReplaceImageInList(&wand->images,despeckle_image);
2254  return(MagickTrue);
2255}
2256
2257/*
2258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2259%                                                                             %
2260%                                                                             %
2261%                                                                             %
2262%   M a g i c k D e s t r o y I m a g e                                       %
2263%                                                                             %
2264%                                                                             %
2265%                                                                             %
2266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2267%
2268%  MagickDestroyImage() dereferences an image, deallocating memory associated
2269%  with the image if the reference count becomes zero.
2270%
2271%  The format of the MagickDestroyImage method is:
2272%
2273%      Image *MagickDestroyImage(Image *image)
2274%
2275%  A description of each parameter follows:
2276%
2277%    o image: the image.
2278%
2279*/
2280WandExport Image *MagickDestroyImage(Image *image)
2281{
2282  return(DestroyImage(image));
2283}
2284
2285/*
2286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2287%                                                                             %
2288%                                                                             %
2289%                                                                             %
2290%   M a g i c k D i s p l a y I m a g e                                       %
2291%                                                                             %
2292%                                                                             %
2293%                                                                             %
2294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2295%
2296%  MagickDisplayImage() displays an image.
2297%
2298%  The format of the MagickDisplayImage method is:
2299%
2300%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2301%        const char *server_name)
2302%
2303%  A description of each parameter follows:
2304%
2305%    o wand: the magick wand.
2306%
2307%    o server_name: the X server name.
2308%
2309*/
2310WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2311  const char *server_name)
2312{
2313  Image
2314    *image;
2315
2316  MagickBooleanType
2317    status;
2318
2319  assert(wand != (MagickWand *) NULL);
2320  assert(wand->signature == WandSignature);
2321  if (wand->debug != MagickFalse)
2322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2323  if (wand->images == (Image *) NULL)
2324    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2325  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2326  if (image == (Image *) NULL)
2327    return(MagickFalse);
2328  (void) CloneString(&wand->image_info->server_name,server_name);
2329  status=DisplayImages(wand->image_info,image);
2330  if (status == MagickFalse)
2331    InheritException(wand->exception,&image->exception);
2332  image=DestroyImage(image);
2333  return(status);
2334}
2335
2336/*
2337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338%                                                                             %
2339%                                                                             %
2340%                                                                             %
2341%   M a g i c k D i s p l a y I m a g e s                                     %
2342%                                                                             %
2343%                                                                             %
2344%                                                                             %
2345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346%
2347%  MagickDisplayImages() displays an image or image sequence.
2348%
2349%  The format of the MagickDisplayImages method is:
2350%
2351%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2352%        const char *server_name)
2353%
2354%  A description of each parameter follows:
2355%
2356%    o wand: the magick wand.
2357%
2358%    o server_name: the X server name.
2359%
2360*/
2361WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2362  const char *server_name)
2363{
2364  MagickBooleanType
2365    status;
2366
2367  assert(wand != (MagickWand *) NULL);
2368  assert(wand->signature == WandSignature);
2369  if (wand->debug != MagickFalse)
2370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2371  (void) CloneString(&wand->image_info->server_name,server_name);
2372  status=DisplayImages(wand->image_info,wand->images);
2373  if (status == MagickFalse)
2374    InheritException(wand->exception,&wand->images->exception);
2375  return(status);
2376}
2377
2378/*
2379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2380%                                                                             %
2381%                                                                             %
2382%                                                                             %
2383%   M a g i c k D i s t o r t I m a g e                                       %
2384%                                                                             %
2385%                                                                             %
2386%                                                                             %
2387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2388%
2389%  MagickDistortImage() distorts an image using various distortion methods, by
2390%  mapping color lookups of the source image to a new destination image
2391%  usally of the same size as the source image, unless 'bestfit' is set to
2392%  true.
2393%
2394%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2395%  adjusted to ensure the whole source 'image' will just fit within the final
2396%  destination image, which will be sized and offset accordingly.  Also in
2397%  many cases the virtual offset of the source image will be taken into
2398%  account in the mapping.
2399%
2400%  The format of the MagickDistortImage method is:
2401%
2402%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2403%        const DistortImageMethod method,const size_t number_arguments,
2404%        const double *arguments,const MagickBooleanType bestfit)
2405%
2406%  A description of each parameter follows:
2407%
2408%    o image: the image to be distorted.
2409%
2410%    o method: the method of image distortion.
2411%
2412%        ArcDistortion always ignores the source image offset, and always
2413%        'bestfit' the destination image with the top left corner offset
2414%        relative to the polar mapping center.
2415%
2416%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2417%        style of image distortion.
2418%
2419%        Affine, Perspective, and Bilinear, do least squares fitting of the
2420%        distortion when more than the minimum number of control point pairs
2421%        are provided.
2422%
2423%        Perspective, and Bilinear, falls back to a Affine distortion when less
2424%        that 4 control point pairs are provided. While Affine distortions let
2425%        you use any number of control point pairs, that is Zero pairs is a
2426%        no-Op (viewport only) distrotion, one pair is a translation and two
2427%        pairs of control points do a scale-rotate-translate, without any
2428%        shearing.
2429%
2430%    o number_arguments: the number of arguments given for this distortion
2431%      method.
2432%
2433%    o arguments: the arguments for this distortion method.
2434%
2435%    o bestfit: Attempt to resize destination to fit distorted source.
2436%
2437*/
2438WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2439  const DistortImageMethod method,const size_t number_arguments,
2440  const double *arguments,const MagickBooleanType bestfit)
2441{
2442  Image
2443    *distort_image;
2444
2445  assert(wand != (MagickWand *) NULL);
2446  assert(wand->signature == WandSignature);
2447  if (wand->debug != MagickFalse)
2448    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2449  if (wand->images == (Image *) NULL)
2450    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2451  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2452    bestfit,wand->exception);
2453  if (distort_image == (Image *) NULL)
2454    return(MagickFalse);
2455  ReplaceImageInList(&wand->images,distort_image);
2456  return(MagickTrue);
2457}
2458
2459/*
2460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2461%                                                                             %
2462%                                                                             %
2463%                                                                             %
2464%   M a g i c k D r a w I m a g e                                             %
2465%                                                                             %
2466%                                                                             %
2467%                                                                             %
2468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2469%
2470%  MagickDrawImage() renders the drawing wand on the current image.
2471%
2472%  The format of the MagickDrawImage method is:
2473%
2474%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2475%        const DrawingWand *drawing_wand)
2476%
2477%  A description of each parameter follows:
2478%
2479%    o wand: the magick wand.
2480%
2481%    o drawing_wand: the draw wand.
2482%
2483*/
2484WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2485  const DrawingWand *drawing_wand)
2486{
2487  char
2488    *primitive;
2489
2490  DrawInfo
2491    *draw_info;
2492
2493  MagickBooleanType
2494    status;
2495
2496  assert(wand != (MagickWand *) NULL);
2497  assert(wand->signature == WandSignature);
2498  if (wand->debug != MagickFalse)
2499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2500  if (wand->images == (Image *) NULL)
2501    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2502  draw_info=PeekDrawingWand(drawing_wand);
2503  if ((draw_info == (DrawInfo *) NULL) ||
2504      (draw_info->primitive == (char *) NULL))
2505    return(MagickFalse);
2506  primitive=AcquireString(draw_info->primitive);
2507  draw_info=DestroyDrawInfo(draw_info);
2508  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2509  draw_info->primitive=primitive;
2510  status=DrawImage(wand->images,draw_info);
2511  if (status == MagickFalse)
2512    InheritException(wand->exception,&wand->images->exception);
2513  draw_info=DestroyDrawInfo(draw_info);
2514  return(status);
2515}
2516
2517/*
2518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2519%                                                                             %
2520%                                                                             %
2521%                                                                             %
2522%   M a g i c k E d g e I m a g e                                             %
2523%                                                                             %
2524%                                                                             %
2525%                                                                             %
2526%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2527%
2528%  MagickEdgeImage() enhance edges within the image with a convolution filter
2529%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2530%  radius for you.
2531%
2532%  The format of the MagickEdgeImage method is:
2533%
2534%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2535%
2536%  A description of each parameter follows:
2537%
2538%    o wand: the magick wand.
2539%
2540%    o radius: the radius of the pixel neighborhood.
2541%
2542*/
2543WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2544  const double radius)
2545{
2546  Image
2547    *edge_image;
2548
2549  assert(wand != (MagickWand *) NULL);
2550  assert(wand->signature == WandSignature);
2551  if (wand->debug != MagickFalse)
2552    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2553  if (wand->images == (Image *) NULL)
2554    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2555  edge_image=EdgeImage(wand->images,radius,wand->exception);
2556  if (edge_image == (Image *) NULL)
2557    return(MagickFalse);
2558  ReplaceImageInList(&wand->images,edge_image);
2559  return(MagickTrue);
2560}
2561
2562/*
2563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2564%                                                                             %
2565%                                                                             %
2566%                                                                             %
2567%   M a g i c k E m b o s s I m a g e                                         %
2568%                                                                             %
2569%                                                                             %
2570%                                                                             %
2571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2572%
2573%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2574%  effect.  We convolve the image with a Gaussian operator of the given radius
2575%  and standard deviation (sigma).  For reasonable results, radius should be
2576%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2577%  radius for you.
2578%
2579%  The format of the MagickEmbossImage method is:
2580%
2581%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2582%        const double sigma)
2583%
2584%  A description of each parameter follows:
2585%
2586%    o wand: the magick wand.
2587%
2588%    o radius: the radius of the Gaussian, in pixels, not counting the center
2589%      pixel.
2590%
2591%    o sigma: the standard deviation of the Gaussian, in pixels.
2592%
2593*/
2594WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2595  const double radius,const double sigma)
2596{
2597  Image
2598    *emboss_image;
2599
2600  assert(wand != (MagickWand *) NULL);
2601  assert(wand->signature == WandSignature);
2602  if (wand->debug != MagickFalse)
2603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2604  if (wand->images == (Image *) NULL)
2605    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2606  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2607  if (emboss_image == (Image *) NULL)
2608    return(MagickFalse);
2609  ReplaceImageInList(&wand->images,emboss_image);
2610  return(MagickTrue);
2611}
2612
2613/*
2614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2615%                                                                             %
2616%                                                                             %
2617%                                                                             %
2618%   M a g i c k E n c i p h e r I m a g e                                     %
2619%                                                                             %
2620%                                                                             %
2621%                                                                             %
2622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2623%
2624%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2625%
2626%  The format of the MagickEncipherImage method is:
2627%
2628%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2629%        const char *passphrase)
2630%
2631%  A description of each parameter follows:
2632%
2633%    o wand: the magick wand.
2634%
2635%    o passphrase: the passphrase.
2636%
2637*/
2638WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2639  const char *passphrase)
2640{
2641  assert(wand != (MagickWand *) NULL);
2642  assert(wand->signature == WandSignature);
2643  if (wand->debug != MagickFalse)
2644    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2645  if (wand->images == (Image *) NULL)
2646    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2647  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2648}
2649
2650/*
2651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2652%                                                                             %
2653%                                                                             %
2654%                                                                             %
2655%   M a g i c k E n h a n c e I m a g e                                       %
2656%                                                                             %
2657%                                                                             %
2658%                                                                             %
2659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2660%
2661%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2662%  noisy image.
2663%
2664%  The format of the MagickEnhanceImage method is:
2665%
2666%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2667%
2668%  A description of each parameter follows:
2669%
2670%    o wand: the magick wand.
2671%
2672*/
2673WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2674{
2675  Image
2676    *enhance_image;
2677
2678  assert(wand != (MagickWand *) NULL);
2679  assert(wand->signature == WandSignature);
2680  if (wand->debug != MagickFalse)
2681    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2682  if (wand->images == (Image *) NULL)
2683    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2684  enhance_image=EnhanceImage(wand->images,wand->exception);
2685  if (enhance_image == (Image *) NULL)
2686    return(MagickFalse);
2687  ReplaceImageInList(&wand->images,enhance_image);
2688  return(MagickTrue);
2689}
2690
2691/*
2692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2693%                                                                             %
2694%                                                                             %
2695%                                                                             %
2696%   M a g i c k E q u a l i z e I m a g e                                     %
2697%                                                                             %
2698%                                                                             %
2699%                                                                             %
2700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2701%
2702%  MagickEqualizeImage() equalizes the image histogram.
2703%
2704%  The format of the MagickEqualizeImage method is:
2705%
2706%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2707%
2708%  A description of each parameter follows:
2709%
2710%    o wand: the magick wand.
2711%
2712%    o channel: the image channel(s).
2713%
2714*/
2715WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2716{
2717  MagickBooleanType
2718    status;
2719
2720  assert(wand != (MagickWand *) NULL);
2721  assert(wand->signature == WandSignature);
2722  if (wand->debug != MagickFalse)
2723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2724  if (wand->images == (Image *) NULL)
2725    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2726  status=EqualizeImage(wand->images);
2727  if (status == MagickFalse)
2728    InheritException(wand->exception,&wand->images->exception);
2729  return(status);
2730}
2731
2732/*
2733%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2734%                                                                             %
2735%                                                                             %
2736%                                                                             %
2737%   M a g i c k E v a l u a t e I m a g e                                     %
2738%                                                                             %
2739%                                                                             %
2740%                                                                             %
2741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2742%
2743%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2744%  expression to an image.  Use these operators to lighten or darken an image,
2745%  to increase or decrease contrast in an image, or to produce the "negative"
2746%  of an image.
2747%
2748%  The format of the MagickEvaluateImage method is:
2749%
2750%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2751%        const MagickEvaluateOperator operator,const double value)
2752%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2753%        const MagickEvaluateOperator operator)
2754%
2755%  A description of each parameter follows:
2756%
2757%    o wand: the magick wand.
2758%
2759%    o op: A channel operator.
2760%
2761%    o value: A value value.
2762%
2763*/
2764
2765WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2766  const MagickEvaluateOperator op)
2767{
2768  Image
2769    *evaluate_image;
2770
2771  assert(wand != (MagickWand *) NULL);
2772  assert(wand->signature == WandSignature);
2773  if (wand->debug != MagickFalse)
2774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2775  if (wand->images == (Image *) NULL)
2776    return((MagickWand *) NULL);
2777  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2778  if (evaluate_image == (Image *) NULL)
2779    return((MagickWand *) NULL);
2780  return(CloneMagickWandFromImages(wand,evaluate_image));
2781}
2782
2783WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2784  const MagickEvaluateOperator op,const double value)
2785{
2786  MagickBooleanType
2787    status;
2788
2789  assert(wand != (MagickWand *) NULL);
2790  assert(wand->signature == WandSignature);
2791  if (wand->debug != MagickFalse)
2792    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2793  if (wand->images == (Image *) NULL)
2794    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2795  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2796  return(status);
2797}
2798
2799/*
2800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2801%                                                                             %
2802%                                                                             %
2803%                                                                             %
2804%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2805%                                                                             %
2806%                                                                             %
2807%                                                                             %
2808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2809%
2810%  MagickExportImagePixels() extracts pixel data from an image and returns it
2811%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2812%  an error is encountered.  The data is returned as char, short int, int,
2813%  ssize_t, float, or double in the order specified by map.
2814%
2815%  Suppose you want to extract the first scanline of a 640x480 image as
2816%  character data in red-green-blue order:
2817%
2818%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2819%
2820%  The format of the MagickExportImagePixels method is:
2821%
2822%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2823%        const ssize_t x,const ssize_t y,const size_t columns,
2824%        const size_t rows,const char *map,const StorageType storage,
2825%        void *pixels)
2826%
2827%  A description of each parameter follows:
2828%
2829%    o wand: the magick wand.
2830%
2831%    o x, y, columns, rows:  These values define the perimeter
2832%      of a region of pixels you want to extract.
2833%
2834%    o map:  This string reflects the expected ordering of the pixel array.
2835%      It can be any combination or order of R = red, G = green, B = blue,
2836%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2837%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2838%      P = pad.
2839%
2840%    o storage: Define the data type of the pixels.  Float and double types are
2841%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2842%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2843%      LongPixel, QuantumPixel, or ShortPixel.
2844%
2845%    o pixels: This array of values contain the pixel components as defined by
2846%      map and type.  You must preallocate this array where the expected
2847%      length varies depending on the values of width, height, map, and type.
2848%
2849*/
2850WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2851  const ssize_t x,const ssize_t y,const size_t columns,
2852  const size_t rows,const char *map,const StorageType storage,
2853  void *pixels)
2854{
2855  MagickBooleanType
2856    status;
2857
2858  assert(wand != (MagickWand *) NULL);
2859  assert(wand->signature == WandSignature);
2860  if (wand->debug != MagickFalse)
2861    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2862  if (wand->images == (Image *) NULL)
2863    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2864  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2865    storage,pixels,wand->exception);
2866  if (status == MagickFalse)
2867    InheritException(wand->exception,&wand->images->exception);
2868  return(status);
2869}
2870
2871/*
2872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2873%                                                                             %
2874%                                                                             %
2875%                                                                             %
2876%   M a g i c k E x t e n t I m a g e                                         %
2877%                                                                             %
2878%                                                                             %
2879%                                                                             %
2880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2881%
2882%  MagickExtentImage() extends the image as defined by the geometry, gravity,
2883%  and wand background color.  Set the (x,y) offset of the geometry to move
2884%  the original wand relative to the extended wand.
2885%
2886%  The format of the MagickExtentImage method is:
2887%
2888%      MagickBooleanType MagickExtentImage(MagickWand *wand,
2889%        const size_t width,const size_t height,const ssize_t x,
2890%        const ssize_t y)
2891%
2892%  A description of each parameter follows:
2893%
2894%    o wand: the magick wand.
2895%
2896%    o width: the region width.
2897%
2898%    o height: the region height.
2899%
2900%    o x: the region x offset.
2901%
2902%    o y: the region y offset.
2903%
2904*/
2905WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2906  const size_t width,const size_t height,const ssize_t x,
2907  const ssize_t y)
2908{
2909  Image
2910    *extent_image;
2911
2912  RectangleInfo
2913    extent;
2914
2915  assert(wand != (MagickWand *) NULL);
2916  assert(wand->signature == WandSignature);
2917  if (wand->debug != MagickFalse)
2918    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2919  if (wand->images == (Image *) NULL)
2920    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2921  extent.width=width;
2922  extent.height=height;
2923  extent.x=x;
2924  extent.y=y;
2925  extent_image=ExtentImage(wand->images,&extent,wand->exception);
2926  if (extent_image == (Image *) NULL)
2927    return(MagickFalse);
2928  ReplaceImageInList(&wand->images,extent_image);
2929  return(MagickTrue);
2930}
2931
2932/*
2933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2934%                                                                             %
2935%                                                                             %
2936%                                                                             %
2937%   M a g i c k F i l t e r I m a g e                                         %
2938%                                                                             %
2939%                                                                             %
2940%                                                                             %
2941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942%
2943%  MagickFilterImage() applies a custom convolution kernel to the image.
2944%
2945%  The format of the MagickFilterImage method is:
2946%
2947%      MagickBooleanType MagickFilterImage(MagickWand *wand,
2948%        const KernelInfo *kernel)
2949%
2950%  A description of each parameter follows:
2951%
2952%    o wand: the magick wand.
2953%
2954%    o kernel: An array of doubles representing the convolution kernel.
2955%
2956*/
2957WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
2958  const KernelInfo *kernel)
2959{
2960  Image
2961    *filter_image;
2962
2963  assert(wand != (MagickWand *) NULL);
2964  assert(wand->signature == WandSignature);
2965  if (wand->debug != MagickFalse)
2966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2967  if (kernel == (const KernelInfo *) NULL)
2968    return(MagickFalse);
2969  if (wand->images == (Image *) NULL)
2970    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2971  filter_image=FilterImage(wand->images,kernel,wand->exception);
2972  if (filter_image == (Image *) NULL)
2973    return(MagickFalse);
2974  ReplaceImageInList(&wand->images,filter_image);
2975  return(MagickTrue);
2976}
2977
2978/*
2979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980%                                                                             %
2981%                                                                             %
2982%                                                                             %
2983%   M a g i c k F l i p I m a g e                                             %
2984%                                                                             %
2985%                                                                             %
2986%                                                                             %
2987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2988%
2989%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2990%  around the central x-axis.
2991%
2992%  The format of the MagickFlipImage method is:
2993%
2994%      MagickBooleanType MagickFlipImage(MagickWand *wand)
2995%
2996%  A description of each parameter follows:
2997%
2998%    o wand: the magick wand.
2999%
3000*/
3001WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3002{
3003  Image
3004    *flip_image;
3005
3006  assert(wand != (MagickWand *) NULL);
3007  assert(wand->signature == WandSignature);
3008  if (wand->debug != MagickFalse)
3009    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3010  if (wand->images == (Image *) NULL)
3011    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3012  flip_image=FlipImage(wand->images,wand->exception);
3013  if (flip_image == (Image *) NULL)
3014    return(MagickFalse);
3015  ReplaceImageInList(&wand->images,flip_image);
3016  return(MagickTrue);
3017}
3018
3019/*
3020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3021%                                                                             %
3022%                                                                             %
3023%                                                                             %
3024%   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                         %
3025%                                                                             %
3026%                                                                             %
3027%                                                                             %
3028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3029%
3030%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3031%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3032%  specified, the color value is changed for any neighbor pixel that does not
3033%  match the bordercolor member of image.
3034%
3035%  The format of the MagickFloodfillPaintImage method is:
3036%
3037%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3038%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3039%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3040%
3041%  A description of each parameter follows:
3042%
3043%    o wand: the magick wand.
3044%
3045%    o fill: the floodfill color pixel wand.
3046%
3047%    o fuzz: By default target must match a particular pixel color
3048%      exactly.  However, in many cases two colors may differ by a small amount.
3049%      The fuzz member of image defines how much tolerance is acceptable to
3050%      consider two colors as the same.  For example, set fuzz to 10 and the
3051%      color red at intensities of 100 and 102 respectively are now interpreted
3052%      as the same color for the purposes of the floodfill.
3053%
3054%    o bordercolor: the border color pixel wand.
3055%
3056%    o x,y: the starting location of the operation.
3057%
3058%    o invert: paint any pixel that does not match the target color.
3059%
3060*/
3061WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3062  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3063  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3064{
3065  DrawInfo
3066    *draw_info;
3067
3068  MagickBooleanType
3069    status;
3070
3071  PixelInfo
3072    target;
3073
3074  assert(wand != (MagickWand *) NULL);
3075  assert(wand->signature == WandSignature);
3076  if (wand->debug != MagickFalse)
3077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3078  if (wand->images == (Image *) NULL)
3079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3080  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3081  PixelGetQuantumPacket(fill,&draw_info->fill);
3082  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3083    y % wand->images->rows,&target,wand->exception);
3084  if (bordercolor != (PixelWand *) NULL)
3085    PixelGetMagickColor(bordercolor,&target);
3086  wand->images->fuzz=fuzz;
3087  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert);
3088  if (status == MagickFalse)
3089    InheritException(wand->exception,&wand->images->exception);
3090  draw_info=DestroyDrawInfo(draw_info);
3091  return(status);
3092}
3093
3094/*
3095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3096%                                                                             %
3097%                                                                             %
3098%                                                                             %
3099%   M a g i c k F l o p I m a g e                                             %
3100%                                                                             %
3101%                                                                             %
3102%                                                                             %
3103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3104%
3105%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3106%  around the central y-axis.
3107%
3108%  The format of the MagickFlopImage method is:
3109%
3110%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3111%
3112%  A description of each parameter follows:
3113%
3114%    o wand: the magick wand.
3115%
3116*/
3117WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3118{
3119  Image
3120    *flop_image;
3121
3122  assert(wand != (MagickWand *) NULL);
3123  assert(wand->signature == WandSignature);
3124  if (wand->debug != MagickFalse)
3125    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3126  if (wand->images == (Image *) NULL)
3127    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3128  flop_image=FlopImage(wand->images,wand->exception);
3129  if (flop_image == (Image *) NULL)
3130    return(MagickFalse);
3131  ReplaceImageInList(&wand->images,flop_image);
3132  return(MagickTrue);
3133}
3134
3135/*
3136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3137%                                                                             %
3138%                                                                             %
3139%                                                                             %
3140%   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                     %
3141%                                                                             %
3142%                                                                             %
3143%                                                                             %
3144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3145%
3146%  MagickForwardFourierTransformImage() implements the discrete Fourier
3147%  transform (DFT) of the image either as a magnitude / phase or real /
3148%  imaginary image pair.
3149%
3150%  The format of the MagickForwardFourierTransformImage method is:
3151%
3152%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3153%        const MagickBooleanType magnitude)
3154%
3155%  A description of each parameter follows:
3156%
3157%    o wand: the magick wand.
3158%
3159%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3160%      imaginary image pair.
3161%
3162*/
3163WandExport MagickBooleanType MagickForwardFourierTransformImage(
3164  MagickWand *wand,const MagickBooleanType magnitude)
3165{
3166  Image
3167    *forward_image;
3168
3169  assert(wand != (MagickWand *) NULL);
3170  assert(wand->signature == WandSignature);
3171  if (wand->debug != MagickFalse)
3172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3173  if (wand->images == (Image *) NULL)
3174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3175  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3176    wand->exception);
3177  if (forward_image == (Image *) NULL)
3178    return(MagickFalse);
3179  ReplaceImageInList(&wand->images,forward_image);
3180  return(MagickTrue);
3181}
3182
3183/*
3184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3185%                                                                             %
3186%                                                                             %
3187%                                                                             %
3188%   M a g i c k F r a m e I m a g e                                           %
3189%                                                                             %
3190%                                                                             %
3191%                                                                             %
3192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3193%
3194%  MagickFrameImage() adds a simulated three-dimensional border around the
3195%  image.  The width and height specify the border width of the vertical and
3196%  horizontal sides of the frame.  The inner and outer bevels indicate the
3197%  width of the inner and outer shadows of the frame.
3198%
3199%  The format of the MagickFrameImage method is:
3200%
3201%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3202%        const PixelWand *matte_color,const size_t width,
3203%        const size_t height,const ssize_t inner_bevel,
3204%        const ssize_t outer_bevel)
3205%
3206%  A description of each parameter follows:
3207%
3208%    o wand: the magick wand.
3209%
3210%    o matte_color: the frame color pixel wand.
3211%
3212%    o width: the border width.
3213%
3214%    o height: the border height.
3215%
3216%    o inner_bevel: the inner bevel width.
3217%
3218%    o outer_bevel: the outer bevel width.
3219%
3220*/
3221WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3222  const PixelWand *matte_color,const size_t width,
3223  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3224{
3225  Image
3226    *frame_image;
3227
3228  FrameInfo
3229    frame_info;
3230
3231  assert(wand != (MagickWand *) NULL);
3232  assert(wand->signature == WandSignature);
3233  if (wand->debug != MagickFalse)
3234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3235  if (wand->images == (Image *) NULL)
3236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3237  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3238  frame_info.width=wand->images->columns+2*width;
3239  frame_info.height=wand->images->rows+2*height;
3240  frame_info.x=(ssize_t) width;
3241  frame_info.y=(ssize_t) height;
3242  frame_info.inner_bevel=inner_bevel;
3243  frame_info.outer_bevel=outer_bevel;
3244  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3245  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3246  if (frame_image == (Image *) NULL)
3247    return(MagickFalse);
3248  ReplaceImageInList(&wand->images,frame_image);
3249  return(MagickTrue);
3250}
3251
3252/*
3253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3254%                                                                             %
3255%                                                                             %
3256%                                                                             %
3257%   M a g i c k F u n c t i o n I m a g e                                     %
3258%                                                                             %
3259%                                                                             %
3260%                                                                             %
3261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3262%
3263%  MagickFunctionImage() applys an arithmetic, relational, or logical
3264%  expression to an image.  Use these operators to lighten or darken an image,
3265%  to increase or decrease contrast in an image, or to produce the "negative"
3266%  of an image.
3267%
3268%  The format of the MagickFunctionImage method is:
3269%
3270%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3271%        const MagickFunction function,const size_t number_arguments,
3272%        const double *arguments)
3273%
3274%  A description of each parameter follows:
3275%
3276%    o wand: the magick wand.
3277%
3278%    o function: the image function.
3279%
3280%    o number_arguments: the number of function arguments.
3281%
3282%    o arguments: the function arguments.
3283%
3284*/
3285WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3286  const MagickFunction function,const size_t number_arguments,
3287  const double *arguments)
3288{
3289  MagickBooleanType
3290    status;
3291
3292  assert(wand != (MagickWand *) NULL);
3293  assert(wand->signature == WandSignature);
3294  if (wand->debug != MagickFalse)
3295    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3296  if (wand->images == (Image *) NULL)
3297    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3298  status=FunctionImage(wand->images,function,number_arguments,arguments,
3299    &wand->images->exception);
3300  return(status);
3301}
3302
3303/*
3304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3305%                                                                             %
3306%                                                                             %
3307%                                                                             %
3308%   M a g i c k F x I m a g e                                                 %
3309%                                                                             %
3310%                                                                             %
3311%                                                                             %
3312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3313%
3314%  MagickFxImage() evaluate expression for each pixel in the image.
3315%
3316%  The format of the MagickFxImage method is:
3317%
3318%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3319%
3320%  A description of each parameter follows:
3321%
3322%    o wand: the magick wand.
3323%
3324%    o expression: the expression.
3325%
3326*/
3327WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3328{
3329  Image
3330    *fx_image;
3331
3332  assert(wand != (MagickWand *) NULL);
3333  assert(wand->signature == WandSignature);
3334  if (wand->debug != MagickFalse)
3335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3336  if (wand->images == (Image *) NULL)
3337    return((MagickWand *) NULL);
3338  fx_image=FxImage(wand->images,expression,wand->exception);
3339  if (fx_image == (Image *) NULL)
3340    return((MagickWand *) NULL);
3341  return(CloneMagickWandFromImages(wand,fx_image));
3342}
3343
3344/*
3345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3346%                                                                             %
3347%                                                                             %
3348%                                                                             %
3349%   M a g i c k G a m m a I m a g e                                           %
3350%                                                                             %
3351%                                                                             %
3352%                                                                             %
3353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3354%
3355%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3356%  different devices will have perceptual differences in the way the image's
3357%  intensities are represented on the screen.  Specify individual gamma levels
3358%  for the red, green, and blue channels, or adjust all three with the gamma
3359%  parameter.  Values typically range from 0.8 to 2.3.
3360%
3361%  You can also reduce the influence of a particular channel with a gamma
3362%  value of 0.
3363%
3364%  The format of the MagickGammaImage method is:
3365%
3366%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3367%
3368%  A description of each parameter follows:
3369%
3370%    o wand: the magick wand.
3371%
3372%    o level: Define the level of gamma correction.
3373%
3374*/
3375WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3376  const double gamma)
3377{
3378  MagickBooleanType
3379    status;
3380
3381  assert(wand != (MagickWand *) NULL);
3382  assert(wand->signature == WandSignature);
3383  if (wand->debug != MagickFalse)
3384    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3385  if (wand->images == (Image *) NULL)
3386    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3387  status=GammaImage(wand->images,gamma);
3388  if (status == MagickFalse)
3389    InheritException(wand->exception,&wand->images->exception);
3390  return(status);
3391}
3392
3393/*
3394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3395%                                                                             %
3396%                                                                             %
3397%                                                                             %
3398%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3399%                                                                             %
3400%                                                                             %
3401%                                                                             %
3402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3403%
3404%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3405%  Gaussian operator of the given radius and standard deviation (sigma).
3406%  For reasonable results, the radius should be larger than sigma.  Use a
3407%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3408%
3409%  The format of the MagickGaussianBlurImage method is:
3410%
3411%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3412%        const double radius,const double sigma)
3413%
3414%  A description of each parameter follows:
3415%
3416%    o wand: the magick wand.
3417%
3418%    o radius: the radius of the Gaussian, in pixels, not counting the center
3419%      pixel.
3420%
3421%    o sigma: the standard deviation of the Gaussian, in pixels.
3422%
3423*/
3424WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3425  const double radius,const double sigma)
3426{
3427  Image
3428    *blur_image;
3429
3430  assert(wand != (MagickWand *) NULL);
3431  assert(wand->signature == WandSignature);
3432  if (wand->debug != MagickFalse)
3433    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3434  if (wand->images == (Image *) NULL)
3435    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3436  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3437  if (blur_image == (Image *) NULL)
3438    return(MagickFalse);
3439  ReplaceImageInList(&wand->images,blur_image);
3440  return(MagickTrue);
3441}
3442
3443/*
3444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3445%                                                                             %
3446%                                                                             %
3447%                                                                             %
3448%   M a g i c k G e t I m a g e                                               %
3449%                                                                             %
3450%                                                                             %
3451%                                                                             %
3452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3453%
3454%  MagickGetImage() gets the image at the current image index.
3455%
3456%  The format of the MagickGetImage method is:
3457%
3458%      MagickWand *MagickGetImage(MagickWand *wand)
3459%
3460%  A description of each parameter follows:
3461%
3462%    o wand: the magick wand.
3463%
3464*/
3465WandExport MagickWand *MagickGetImage(MagickWand *wand)
3466{
3467  Image
3468    *image;
3469
3470  assert(wand != (MagickWand *) NULL);
3471  assert(wand->signature == WandSignature);
3472  if (wand->debug != MagickFalse)
3473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3474  if (wand->images == (Image *) NULL)
3475    {
3476      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3477        "ContainsNoImages","`%s'",wand->name);
3478      return((MagickWand *) NULL);
3479    }
3480  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3481  if (image == (Image *) NULL)
3482    return((MagickWand *) NULL);
3483  return(CloneMagickWandFromImages(wand,image));
3484}
3485
3486/*
3487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3488%                                                                             %
3489%                                                                             %
3490%                                                                             %
3491%   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                       %
3492%                                                                             %
3493%                                                                             %
3494%                                                                             %
3495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3496%
3497%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3498%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3499%  than CMYKA.
3500%
3501%  The format of the MagickGetImageAlphaChannel method is:
3502%
3503%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3504%
3505%  A description of each parameter follows:
3506%
3507%    o wand: the magick wand.
3508%
3509*/
3510WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3511{
3512  assert(wand != (MagickWand *) NULL);
3513  assert(wand->signature == WandSignature);
3514  if (wand->debug != MagickFalse)
3515    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3516  if (wand->images == (Image *) NULL)
3517    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3518  return(GetImageAlphaChannel(wand->images));
3519}
3520
3521/*
3522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3523%                                                                             %
3524%                                                                             %
3525%                                                                             %
3526%   M a g i c k G e t I m a g e C l i p M a s k                               %
3527%                                                                             %
3528%                                                                             %
3529%                                                                             %
3530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3531%
3532%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3533%
3534%  The format of the MagickGetImageClipMask method is:
3535%
3536%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3537%
3538%  A description of each parameter follows:
3539%
3540%    o wand: the magick wand.
3541%
3542*/
3543WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3544{
3545  Image
3546    *image;
3547
3548  assert(wand != (MagickWand *) NULL);
3549  assert(wand->signature == WandSignature);
3550  if (wand->debug != MagickFalse)
3551    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3552  if (wand->images == (Image *) NULL)
3553    {
3554      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3555        "ContainsNoImages","`%s'",wand->name);
3556      return((MagickWand *) NULL);
3557    }
3558  image=GetImageClipMask(wand->images,wand->exception);
3559  if (image == (Image *) NULL)
3560    return((MagickWand *) NULL);
3561  return(CloneMagickWandFromImages(wand,image));
3562}
3563
3564/*
3565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3566%                                                                             %
3567%                                                                             %
3568%                                                                             %
3569%   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                 %
3570%                                                                             %
3571%                                                                             %
3572%                                                                             %
3573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3574%
3575%  MagickGetImageBackgroundColor() returns the image background color.
3576%
3577%  The format of the MagickGetImageBackgroundColor method is:
3578%
3579%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3580%        PixelWand *background_color)
3581%
3582%  A description of each parameter follows:
3583%
3584%    o wand: the magick wand.
3585%
3586%    o background_color: Return the background color.
3587%
3588*/
3589WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3590  PixelWand *background_color)
3591{
3592  assert(wand != (MagickWand *) NULL);
3593  assert(wand->signature == WandSignature);
3594  if (wand->debug != MagickFalse)
3595    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3596  if (wand->images == (Image *) NULL)
3597    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3598  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3599  return(MagickTrue);
3600}
3601
3602/*
3603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3604%                                                                             %
3605%                                                                             %
3606%                                                                             %
3607%   M a g i c k G e t I m a g e B l o b                                       %
3608%                                                                             %
3609%                                                                             %
3610%                                                                             %
3611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3612%
3613%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3614%  the image as a blob (a formatted "file" in memory) and its length, starting
3615%  from the current position in the image sequence.  Use MagickSetImageFormat()
3616%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3617%
3618%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3619%  the image sequence.
3620%
3621%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3622%
3623%  The format of the MagickGetImageBlob method is:
3624%
3625%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3626%
3627%  A description of each parameter follows:
3628%
3629%    o wand: the magick wand.
3630%
3631%    o length: the length of the blob.
3632%
3633*/
3634WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3635{
3636  assert(wand != (MagickWand *) NULL);
3637  assert(wand->signature == WandSignature);
3638  if (wand->debug != MagickFalse)
3639    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3640  if (wand->images == (Image *) NULL)
3641    {
3642      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3643        "ContainsNoImages","`%s'",wand->name);
3644      return((unsigned char *) NULL);
3645    }
3646  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3647}
3648
3649/*
3650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3651%                                                                             %
3652%                                                                             %
3653%                                                                             %
3654%   M a g i c k G e t I m a g e s B l o b                                     %
3655%                                                                             %
3656%                                                                             %
3657%                                                                             %
3658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3659%
3660%  MagickGetImageBlob() implements direct to memory image formats.  It
3661%  returns the image sequence as a blob and its length.  The format of the image
3662%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3663%  return a different image format, use MagickSetImageFormat().
3664%
3665%  Note, some image formats do not permit multiple images to the same image
3666%  stream (e.g. JPEG).  in this instance, just the first image of the
3667%  sequence is returned as a blob.
3668%
3669%  The format of the MagickGetImagesBlob method is:
3670%
3671%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3672%
3673%  A description of each parameter follows:
3674%
3675%    o wand: the magick wand.
3676%
3677%    o length: the length of the blob.
3678%
3679*/
3680WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3681{
3682  unsigned char
3683    *blob;
3684
3685  assert(wand != (MagickWand *) NULL);
3686  assert(wand->signature == WandSignature);
3687  if (wand->debug != MagickFalse)
3688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3689  if (wand->images == (Image *) NULL)
3690    {
3691      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3692        "ContainsNoImages","`%s'",wand->name);
3693      return((unsigned char *) NULL);
3694    }
3695  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3696    wand->exception);
3697  return(blob);
3698}
3699
3700/*
3701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3702%                                                                             %
3703%                                                                             %
3704%                                                                             %
3705%   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                         %
3706%                                                                             %
3707%                                                                             %
3708%                                                                             %
3709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3710%
3711%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3712%  image.
3713%
3714%  The format of the MagickGetImageBluePrimary method is:
3715%
3716%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3717%        double *y)
3718%
3719%  A description of each parameter follows:
3720%
3721%    o wand: the magick wand.
3722%
3723%    o x: the chromaticity blue primary x-point.
3724%
3725%    o y: the chromaticity blue primary y-point.
3726%
3727*/
3728WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3729  double *x,double *y)
3730{
3731  assert(wand != (MagickWand *) NULL);
3732  assert(wand->signature == WandSignature);
3733  if (wand->debug != MagickFalse)
3734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3735  if (wand->images == (Image *) NULL)
3736    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3737  *x=wand->images->chromaticity.blue_primary.x;
3738  *y=wand->images->chromaticity.blue_primary.y;
3739  return(MagickTrue);
3740}
3741
3742/*
3743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3744%                                                                             %
3745%                                                                             %
3746%                                                                             %
3747%   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                         %
3748%                                                                             %
3749%                                                                             %
3750%                                                                             %
3751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3752%
3753%  MagickGetImageBorderColor() returns the image border color.
3754%
3755%  The format of the MagickGetImageBorderColor method is:
3756%
3757%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3758%        PixelWand *border_color)
3759%
3760%  A description of each parameter follows:
3761%
3762%    o wand: the magick wand.
3763%
3764%    o border_color: Return the border color.
3765%
3766*/
3767WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3768  PixelWand *border_color)
3769{
3770  assert(wand != (MagickWand *) NULL);
3771  assert(wand->signature == WandSignature);
3772  if (wand->debug != MagickFalse)
3773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3774  if (wand->images == (Image *) NULL)
3775    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3776  PixelSetQuantumPacket(border_color,&wand->images->border_color);
3777  return(MagickTrue);
3778}
3779
3780/*
3781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3782%                                                                             %
3783%                                                                             %
3784%                                                                             %
3785%   M a g i c k G e t I m a g e F e a t u r e s                               %
3786%                                                                             %
3787%                                                                             %
3788%                                                                             %
3789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3790%
3791%  MagickGetImageFeatures() returns features for each channel in the
3792%  image in each of four directions (horizontal, vertical, left and right
3793%  diagonals) for the specified distance.  The features include the angular
3794%  second moment, contrast, correlation, sum of squares: variance, inverse
3795%  difference moment, sum average, sum varience, sum entropy, entropy,
3796%  difference variance, difference entropy, information measures of
3797%  correlation 1, information measures of correlation 2, and maximum
3798%  correlation coefficient.  You can access the red channel contrast, for
3799%  example, like this:
3800%
3801%      channel_features=MagickGetImageFeatures(wand,1);
3802%      contrast=channel_features[RedChannel].contrast[0];
3803%
3804%  Use MagickRelinquishMemory() to free the statistics buffer.
3805%
3806%  The format of the MagickGetImageFeatures method is:
3807%
3808%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3809%        const size_t distance)
3810%
3811%  A description of each parameter follows:
3812%
3813%    o wand: the magick wand.
3814%
3815%    o distance: the distance.
3816%
3817*/
3818WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3819  const size_t distance)
3820{
3821  assert(wand != (MagickWand *) NULL);
3822  assert(wand->signature == WandSignature);
3823  if (wand->debug != MagickFalse)
3824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3825  if (wand->images == (Image *) NULL)
3826    {
3827      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3828        "ContainsNoImages","`%s'",wand->name);
3829      return((ChannelFeatures *) NULL);
3830    }
3831  return(GetImageFeatures(wand->images,distance,wand->exception));
3832}
3833
3834/*
3835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3836%                                                                             %
3837%                                                                             %
3838%                                                                             %
3839%   M a g i c k G e t I m a g e K u r t o s i s                               %
3840%                                                                             %
3841%                                                                             %
3842%                                                                             %
3843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3844%
3845%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3846%  more image channels.
3847%
3848%  The format of the MagickGetImageKurtosis method is:
3849%
3850%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3851%        double *kurtosis,double *skewness)
3852%
3853%  A description of each parameter follows:
3854%
3855%    o wand: the magick wand.
3856%
3857%    o kurtosis:  The kurtosis for the specified channel(s).
3858%
3859%    o skewness:  The skewness for the specified channel(s).
3860%
3861*/
3862WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3863  double *kurtosis,double *skewness)
3864{
3865  MagickBooleanType
3866    status;
3867
3868  assert(wand != (MagickWand *) NULL);
3869  assert(wand->signature == WandSignature);
3870  if (wand->debug != MagickFalse)
3871    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3872  if (wand->images == (Image *) NULL)
3873    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3874  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3875  return(status);
3876}
3877
3878/*
3879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3880%                                                                             %
3881%                                                                             %
3882%                                                                             %
3883%   M a g i c k G e t I m a g e M e a n                                       %
3884%                                                                             %
3885%                                                                             %
3886%                                                                             %
3887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3888%
3889%  MagickGetImageMean() gets the mean and standard deviation of one or more
3890%  image channels.
3891%
3892%  The format of the MagickGetImageMean method is:
3893%
3894%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3895%        double *standard_deviation)
3896%
3897%  A description of each parameter follows:
3898%
3899%    o wand: the magick wand.
3900%
3901%    o channel: the image channel(s).
3902%
3903%    o mean:  The mean pixel value for the specified channel(s).
3904%
3905%    o standard_deviation:  The standard deviation for the specified channel(s).
3906%
3907*/
3908WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3909  double *standard_deviation)
3910{
3911  MagickBooleanType
3912    status;
3913
3914  assert(wand != (MagickWand *) NULL);
3915  assert(wand->signature == WandSignature);
3916  if (wand->debug != MagickFalse)
3917    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3918  if (wand->images == (Image *) NULL)
3919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3920  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3921  return(status);
3922}
3923
3924/*
3925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3926%                                                                             %
3927%                                                                             %
3928%                                                                             %
3929%   M a g i c k G e t I m a g e R a n g e                                     %
3930%                                                                             %
3931%                                                                             %
3932%                                                                             %
3933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3934%
3935%  MagickGetImageRange() gets the range for one or more image channels.
3936%
3937%  The format of the MagickGetImageRange method is:
3938%
3939%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3940%        double *maxima)
3941%
3942%  A description of each parameter follows:
3943%
3944%    o wand: the magick wand.
3945%
3946%    o minima:  The minimum pixel value for the specified channel(s).
3947%
3948%    o maxima:  The maximum pixel value for the specified channel(s).
3949%
3950*/
3951WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3952  double *minima,double *maxima)
3953{
3954  MagickBooleanType
3955    status;
3956
3957  assert(wand != (MagickWand *) NULL);
3958  assert(wand->signature == WandSignature);
3959  if (wand->debug != MagickFalse)
3960    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3961  if (wand->images == (Image *) NULL)
3962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3963  status=GetImageRange(wand->images,minima,maxima,wand->exception);
3964  return(status);
3965}
3966
3967/*
3968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3969%                                                                             %
3970%                                                                             %
3971%                                                                             %
3972%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3973%                                                                             %
3974%                                                                             %
3975%                                                                             %
3976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3977%
3978%  MagickGetImageStatistics() returns statistics for each channel in the
3979%  image.  The statistics include the channel depth, its minima and
3980%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3981%  You can access the red channel mean, for example, like this:
3982%
3983%      channel_statistics=MagickGetImageStatistics(wand);
3984%      red_mean=channel_statistics[RedChannel].mean;
3985%
3986%  Use MagickRelinquishMemory() to free the statistics buffer.
3987%
3988%  The format of the MagickGetImageStatistics method is:
3989%
3990%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3991%
3992%  A description of each parameter follows:
3993%
3994%    o wand: the magick wand.
3995%
3996*/
3997WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3998{
3999  assert(wand != (MagickWand *) NULL);
4000  assert(wand->signature == WandSignature);
4001  if (wand->debug != MagickFalse)
4002    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4003  if (wand->images == (Image *) NULL)
4004    {
4005      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4006        "ContainsNoImages","`%s'",wand->name);
4007      return((ChannelStatistics *) NULL);
4008    }
4009  return(GetImageStatistics(wand->images,wand->exception));
4010}
4011
4012/*
4013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4014%                                                                             %
4015%                                                                             %
4016%                                                                             %
4017%   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                     %
4018%                                                                             %
4019%                                                                             %
4020%                                                                             %
4021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4022%
4023%  MagickGetImageColormapColor() returns the color of the specified colormap
4024%  index.
4025%
4026%  The format of the MagickGetImageColormapColor method is:
4027%
4028%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4029%        const size_t index,PixelWand *color)
4030%
4031%  A description of each parameter follows:
4032%
4033%    o wand: the magick wand.
4034%
4035%    o index: the offset into the image colormap.
4036%
4037%    o color: Return the colormap color in this wand.
4038%
4039*/
4040WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4041  const size_t index,PixelWand *color)
4042{
4043  assert(wand != (MagickWand *) NULL);
4044  assert(wand->signature == WandSignature);
4045  if (wand->debug != MagickFalse)
4046    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4047  if (wand->images == (Image *) NULL)
4048    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4049  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4050      (index >= wand->images->colors))
4051    {
4052      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4053        "InvalidColormapIndex","`%s'",wand->name);
4054      return(MagickFalse);
4055    }
4056  PixelSetQuantumPacket(color,wand->images->colormap+index);
4057  return(MagickTrue);
4058}
4059
4060/*
4061%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4062%                                                                             %
4063%                                                                             %
4064%                                                                             %
4065%   M a g i c k G e t I m a g e C o l o r s                                   %
4066%                                                                             %
4067%                                                                             %
4068%                                                                             %
4069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4070%
4071%  MagickGetImageColors() gets the number of unique colors in the image.
4072%
4073%  The format of the MagickGetImageColors method is:
4074%
4075%      size_t MagickGetImageColors(MagickWand *wand)
4076%
4077%  A description of each parameter follows:
4078%
4079%    o wand: the magick wand.
4080%
4081*/
4082WandExport size_t MagickGetImageColors(MagickWand *wand)
4083{
4084  assert(wand != (MagickWand *) NULL);
4085  assert(wand->signature == WandSignature);
4086  if (wand->debug != MagickFalse)
4087    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4088  if (wand->images == (Image *) NULL)
4089    {
4090      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4091        "ContainsNoImages","`%s'",wand->name);
4092      return(0);
4093    }
4094  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4095}
4096
4097/*
4098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4099%                                                                             %
4100%                                                                             %
4101%                                                                             %
4102%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4103%                                                                             %
4104%                                                                             %
4105%                                                                             %
4106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4107%
4108%  MagickGetImageColorspace() gets the image colorspace.
4109%
4110%  The format of the MagickGetImageColorspace method is:
4111%
4112%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4113%
4114%  A description of each parameter follows:
4115%
4116%    o wand: the magick wand.
4117%
4118*/
4119WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4120{
4121  assert(wand != (MagickWand *) NULL);
4122  assert(wand->signature == WandSignature);
4123  if (wand->debug != MagickFalse)
4124    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4125  if (wand->images == (Image *) NULL)
4126    {
4127      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4128        "ContainsNoImages","`%s'",wand->name);
4129      return(UndefinedColorspace);
4130    }
4131  return(wand->images->colorspace);
4132}
4133
4134/*
4135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4136%                                                                             %
4137%                                                                             %
4138%                                                                             %
4139%   M a g i c k G e t I m a g e C o m p o s e                                 %
4140%                                                                             %
4141%                                                                             %
4142%                                                                             %
4143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4144%
4145%  MagickGetImageCompose() returns the composite operator associated with the
4146%  image.
4147%
4148%  The format of the MagickGetImageCompose method is:
4149%
4150%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4151%
4152%  A description of each parameter follows:
4153%
4154%    o wand: the magick wand.
4155%
4156*/
4157WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4158{
4159  assert(wand != (MagickWand *) NULL);
4160  assert(wand->signature == WandSignature);
4161  if (wand->debug != MagickFalse)
4162    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4163  if (wand->images == (Image *) NULL)
4164    {
4165      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4166        "ContainsNoImages","`%s'",wand->name);
4167      return(UndefinedCompositeOp);
4168    }
4169  return(wand->images->compose);
4170}
4171
4172/*
4173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4174%                                                                             %
4175%                                                                             %
4176%                                                                             %
4177%   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                         %
4178%                                                                             %
4179%                                                                             %
4180%                                                                             %
4181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4182%
4183%  MagickGetImageCompression() gets the image compression.
4184%
4185%  The format of the MagickGetImageCompression method is:
4186%
4187%      CompressionType MagickGetImageCompression(MagickWand *wand)
4188%
4189%  A description of each parameter follows:
4190%
4191%    o wand: the magick wand.
4192%
4193*/
4194WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4195{
4196  assert(wand != (MagickWand *) NULL);
4197  assert(wand->signature == WandSignature);
4198  if (wand->debug != MagickFalse)
4199    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4200  if (wand->images == (Image *) NULL)
4201    {
4202      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4203        "ContainsNoImages","`%s'",wand->name);
4204      return(UndefinedCompression);
4205    }
4206  return(wand->images->compression);
4207}
4208
4209/*
4210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4211%                                                                             %
4212%                                                                             %
4213%                                                                             %
4214%   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           %
4215%                                                                             %
4216%                                                                             %
4217%                                                                             %
4218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4219%
4220%  MagickGetImageCompression() gets the image compression quality.
4221%
4222%  The format of the MagickGetImageCompression method is:
4223%
4224%      size_t MagickGetImageCompression(MagickWand *wand)
4225%
4226%  A description of each parameter follows:
4227%
4228%    o wand: the magick wand.
4229%
4230*/
4231WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4232{
4233  assert(wand != (MagickWand *) NULL);
4234  assert(wand->signature == WandSignature);
4235  if (wand->debug != MagickFalse)
4236    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4237  if (wand->images == (Image *) NULL)
4238    {
4239      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4240        "ContainsNoImages","`%s'",wand->name);
4241      return(0UL);
4242    }
4243  return(wand->images->quality);
4244}
4245
4246/*
4247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4248%                                                                             %
4249%                                                                             %
4250%                                                                             %
4251%   M a g i c k G e t I m a g e D e l a y                                     %
4252%                                                                             %
4253%                                                                             %
4254%                                                                             %
4255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4256%
4257%  MagickGetImageDelay() gets the image delay.
4258%
4259%  The format of the MagickGetImageDelay method is:
4260%
4261%      size_t MagickGetImageDelay(MagickWand *wand)
4262%
4263%  A description of each parameter follows:
4264%
4265%    o wand: the magick wand.
4266%
4267*/
4268WandExport size_t MagickGetImageDelay(MagickWand *wand)
4269{
4270  assert(wand != (MagickWand *) NULL);
4271  assert(wand->signature == WandSignature);
4272  if (wand->debug != MagickFalse)
4273    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4274  if (wand->images == (Image *) NULL)
4275    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4276  return(wand->images->delay);
4277}
4278
4279/*
4280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4281%                                                                             %
4282%                                                                             %
4283%                                                                             %
4284%   M a g i c k G e t I m a g e D e p t h                                     %
4285%                                                                             %
4286%                                                                             %
4287%                                                                             %
4288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4289%
4290%  MagickGetImageDepth() gets the image depth.
4291%
4292%  The format of the MagickGetImageDepth method is:
4293%
4294%      size_t MagickGetImageDepth(MagickWand *wand)
4295%
4296%  A description of each parameter follows:
4297%
4298%    o wand: the magick wand.
4299%
4300*/
4301WandExport size_t MagickGetImageDepth(MagickWand *wand)
4302{
4303  assert(wand != (MagickWand *) NULL);
4304  assert(wand->signature == WandSignature);
4305  if (wand->debug != MagickFalse)
4306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4307  if (wand->images == (Image *) NULL)
4308    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4309  return(GetImageDepth(wand->images,wand->exception));
4310}
4311
4312/*
4313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4314%                                                                             %
4315%                                                                             %
4316%                                                                             %
4317%   M a g i c k G e t I m a g e D i s p o s e                                 %
4318%                                                                             %
4319%                                                                             %
4320%                                                                             %
4321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4322%
4323%  MagickGetImageDispose() gets the image disposal method.
4324%
4325%  The format of the MagickGetImageDispose method is:
4326%
4327%      DisposeType MagickGetImageDispose(MagickWand *wand)
4328%
4329%  A description of each parameter follows:
4330%
4331%    o wand: the magick wand.
4332%
4333*/
4334WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4335{
4336  assert(wand != (MagickWand *) NULL);
4337  assert(wand->signature == WandSignature);
4338  if (wand->debug != MagickFalse)
4339    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4340  if (wand->images == (Image *) NULL)
4341    {
4342      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4343        "ContainsNoImages","`%s'",wand->name);
4344      return(UndefinedDispose);
4345    }
4346  return((DisposeType) wand->images->dispose);
4347}
4348
4349/*
4350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4351%                                                                             %
4352%                                                                             %
4353%                                                                             %
4354%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4355%                                                                             %
4356%                                                                             %
4357%                                                                             %
4358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4359%
4360%  MagickGetImageDistortion() compares an image to a reconstructed image and
4361%  returns the specified distortion metric.
4362%
4363%  The format of the MagickGetImageDistortion method is:
4364%
4365%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4366%        const MagickWand *reference,const MetricType metric,
4367%        double *distortion)
4368%
4369%  A description of each parameter follows:
4370%
4371%    o wand: the magick wand.
4372%
4373%    o reference: the reference wand.
4374%
4375%    o metric: the metric.
4376%
4377%    o distortion: the computed distortion between the images.
4378%
4379*/
4380WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4381  const MagickWand *reference,const MetricType metric,double *distortion)
4382{
4383  MagickBooleanType
4384    status;
4385
4386  assert(wand != (MagickWand *) NULL);
4387  assert(wand->signature == WandSignature);
4388  if (wand->debug != MagickFalse)
4389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4390  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4391    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4392  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4393    &wand->images->exception);
4394  return(status);
4395}
4396
4397/*
4398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4399%                                                                             %
4400%                                                                             %
4401%                                                                             %
4402%   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                         %
4403%                                                                             %
4404%                                                                             %
4405%                                                                             %
4406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4407%
4408%  MagickGetImageDistortions() compares one or more pixel channels of an
4409%  image to a reconstructed image and returns the specified distortion metrics.
4410%
4411%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4412%
4413%  The format of the MagickGetImageDistortion method is:
4414%
4415%      double *MagickGetImageDistortion(MagickWand *wand,
4416%        const MagickWand *reference,const MetricType metric)
4417%
4418%  A description of each parameter follows:
4419%
4420%    o wand: the magick wand.
4421%
4422%    o reference: the reference wand.
4423%
4424%    o metric: the metric.
4425%
4426*/
4427WandExport double *MagickGetImageDistortions(MagickWand *wand,
4428  const MagickWand *reference,const MetricType metric)
4429{
4430  double
4431    *channel_distortion;
4432
4433  assert(wand != (MagickWand *) NULL);
4434  assert(wand->signature == WandSignature);
4435  if (wand->debug != MagickFalse)
4436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4437  assert(reference != (MagickWand *) NULL);
4438  assert(reference->signature == WandSignature);
4439  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4440    {
4441      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4442        "ContainsNoImages","`%s'",wand->name);
4443      return((double *) NULL);
4444    }
4445  channel_distortion=GetImageDistortions(wand->images,reference->images,
4446    metric,&wand->images->exception);
4447  return(channel_distortion);
4448}
4449
4450/*
4451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4452%                                                                             %
4453%                                                                             %
4454%                                                                             %
4455%   M a g i c k G e t I m a g e F i l e n a m e                               %
4456%                                                                             %
4457%                                                                             %
4458%                                                                             %
4459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4460%
4461%  MagickGetImageFilename() returns the filename of a particular image in a
4462%  sequence.
4463%
4464%  The format of the MagickGetImageFilename method is:
4465%
4466%      char *MagickGetImageFilename(MagickWand *wand)
4467%
4468%  A description of each parameter follows:
4469%
4470%    o wand: the magick wand.
4471%
4472*/
4473WandExport char *MagickGetImageFilename(MagickWand *wand)
4474{
4475  assert(wand != (MagickWand *) NULL);
4476  assert(wand->signature == WandSignature);
4477  if (wand->debug != MagickFalse)
4478    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4479  if (wand->images == (Image *) NULL)
4480    {
4481      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4482        "ContainsNoImages","`%s'",wand->name);
4483      return((char *) NULL);
4484    }
4485  return(AcquireString(wand->images->filename));
4486}
4487
4488/*
4489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4490%                                                                             %
4491%                                                                             %
4492%                                                                             %
4493%   M a g i c k G e t I m a g e F o r m a t                                   %
4494%                                                                             %
4495%                                                                             %
4496%                                                                             %
4497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4498%
4499%  MagickGetImageFormat() returns the format of a particular image in a
4500%  sequence.
4501%
4502%  The format of the MagickGetImageFormat method is:
4503%
4504%      const char *MagickGetImageFormat(MagickWand *wand)
4505%
4506%  A description of each parameter follows:
4507%
4508%    o wand: the magick wand.
4509%
4510*/
4511WandExport char *MagickGetImageFormat(MagickWand *wand)
4512{
4513  assert(wand != (MagickWand *) NULL);
4514  assert(wand->signature == WandSignature);
4515  if (wand->debug != MagickFalse)
4516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4517  if (wand->images == (Image *) NULL)
4518    {
4519      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4520        "ContainsNoImages","`%s'",wand->name);
4521      return((char *) NULL);
4522    }
4523  return(AcquireString(wand->images->magick));
4524}
4525
4526/*
4527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4528%                                                                             %
4529%                                                                             %
4530%                                                                             %
4531%   M a g i c k G e t I m a g e F u z z                                       %
4532%                                                                             %
4533%                                                                             %
4534%                                                                             %
4535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4536%
4537%  MagickGetImageFuzz() gets the image fuzz.
4538%
4539%  The format of the MagickGetImageFuzz method is:
4540%
4541%      double MagickGetImageFuzz(MagickWand *wand)
4542%
4543%  A description of each parameter follows:
4544%
4545%    o wand: the magick wand.
4546%
4547*/
4548WandExport double MagickGetImageFuzz(MagickWand *wand)
4549{
4550  assert(wand != (MagickWand *) NULL);
4551  assert(wand->signature == WandSignature);
4552  if (wand->debug != MagickFalse)
4553    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4554  if (wand->images == (Image *) NULL)
4555    {
4556      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4557        "ContainsNoImages","`%s'",wand->name);
4558      return(0.0);
4559    }
4560  return(wand->images->fuzz);
4561}
4562
4563/*
4564%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4565%                                                                             %
4566%                                                                             %
4567%                                                                             %
4568%   M a g i c k G e t I m a g e G a m m a                                     %
4569%                                                                             %
4570%                                                                             %
4571%                                                                             %
4572%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4573%
4574%  MagickGetImageGamma() gets the image gamma.
4575%
4576%  The format of the MagickGetImageGamma method is:
4577%
4578%      double MagickGetImageGamma(MagickWand *wand)
4579%
4580%  A description of each parameter follows:
4581%
4582%    o wand: the magick wand.
4583%
4584*/
4585WandExport double MagickGetImageGamma(MagickWand *wand)
4586{
4587  assert(wand != (MagickWand *) NULL);
4588  assert(wand->signature == WandSignature);
4589  if (wand->debug != MagickFalse)
4590    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4591  if (wand->images == (Image *) NULL)
4592    {
4593      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4594        "ContainsNoImages","`%s'",wand->name);
4595      return(0.0);
4596    }
4597  return(wand->images->gamma);
4598}
4599
4600/*
4601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4602%                                                                             %
4603%                                                                             %
4604%                                                                             %
4605%   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                 %
4606%                                                                             %
4607%                                                                             %
4608%                                                                             %
4609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4610%
4611%  MagickGetImageGravity() gets the image gravity.
4612%
4613%  The format of the MagickGetImageGravity method is:
4614%
4615%      GravityType MagickGetImageGravity(MagickWand *wand)
4616%
4617%  A description of each parameter follows:
4618%
4619%    o wand: the magick wand.
4620%
4621*/
4622WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4623{
4624  assert(wand != (MagickWand *) NULL);
4625  assert(wand->signature == WandSignature);
4626  if (wand->debug != MagickFalse)
4627    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4628  if (wand->images == (Image *) NULL)
4629    {
4630      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4631        "ContainsNoImages","`%s'",wand->name);
4632      return(UndefinedGravity);
4633    }
4634  return(wand->images->gravity);
4635}
4636
4637/*
4638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4639%                                                                             %
4640%                                                                             %
4641%                                                                             %
4642%   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                       %
4643%                                                                             %
4644%                                                                             %
4645%                                                                             %
4646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4647%
4648%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4649%
4650%  The format of the MagickGetImageGreenPrimary method is:
4651%
4652%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4653%        double *y)
4654%
4655%  A description of each parameter follows:
4656%
4657%    o wand: the magick wand.
4658%
4659%    o x: the chromaticity green primary x-point.
4660%
4661%    o y: the chromaticity green primary y-point.
4662%
4663*/
4664WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4665  double *x,double *y)
4666{
4667  assert(wand != (MagickWand *) NULL);
4668  assert(wand->signature == WandSignature);
4669  if (wand->debug != MagickFalse)
4670    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4671  if (wand->images == (Image *) NULL)
4672    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4673  *x=wand->images->chromaticity.green_primary.x;
4674  *y=wand->images->chromaticity.green_primary.y;
4675  return(MagickTrue);
4676}
4677
4678/*
4679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4680%                                                                             %
4681%                                                                             %
4682%                                                                             %
4683%   M a g i c k G e t I m a g e H e i g h t                                   %
4684%                                                                             %
4685%                                                                             %
4686%                                                                             %
4687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688%
4689%  MagickGetImageHeight() returns the image height.
4690%
4691%  The format of the MagickGetImageHeight method is:
4692%
4693%      size_t MagickGetImageHeight(MagickWand *wand)
4694%
4695%  A description of each parameter follows:
4696%
4697%    o wand: the magick wand.
4698%
4699*/
4700WandExport size_t MagickGetImageHeight(MagickWand *wand)
4701{
4702  assert(wand != (MagickWand *) NULL);
4703  assert(wand->signature == WandSignature);
4704  if (wand->debug != MagickFalse)
4705    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4706  if (wand->images == (Image *) NULL)
4707    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4708  return(wand->images->rows);
4709}
4710
4711/*
4712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4713%                                                                             %
4714%                                                                             %
4715%                                                                             %
4716%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4717%                                                                             %
4718%                                                                             %
4719%                                                                             %
4720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4721%
4722%  MagickGetImageHistogram() returns the image histogram as an array of
4723%  PixelWand wands.
4724%
4725%  The format of the MagickGetImageHistogram method is:
4726%
4727%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4728%        size_t *number_colors)
4729%
4730%  A description of each parameter follows:
4731%
4732%    o wand: the magick wand.
4733%
4734%    o number_colors: the number of unique colors in the image and the number
4735%      of pixel wands returned.
4736%
4737*/
4738WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4739  size_t *number_colors)
4740{
4741  PixelPacket
4742    *histogram;
4743
4744  PixelWand
4745    **pixel_wands;
4746
4747  register ssize_t
4748    i;
4749
4750  assert(wand != (MagickWand *) NULL);
4751  assert(wand->signature == WandSignature);
4752  if (wand->debug != MagickFalse)
4753    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4754  if (wand->images == (Image *) NULL)
4755    {
4756      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4757        "ContainsNoImages","`%s'",wand->name);
4758      return((PixelWand **) NULL);
4759    }
4760  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4761  if (histogram == (PixelPacket *) NULL)
4762    return((PixelWand **) NULL);
4763  pixel_wands=NewPixelWands(*number_colors);
4764  for (i=0; i < (ssize_t) *number_colors; i++)
4765  {
4766    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4767    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4768  }
4769  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4770  return(pixel_wands);
4771}
4772
4773/*
4774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4775%                                                                             %
4776%                                                                             %
4777%                                                                             %
4778%   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                 %
4779%                                                                             %
4780%                                                                             %
4781%                                                                             %
4782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4783%
4784%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4785%
4786%  The format of the MagickGetImageInterlaceScheme method is:
4787%
4788%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4789%
4790%  A description of each parameter follows:
4791%
4792%    o wand: the magick wand.
4793%
4794*/
4795WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4796{
4797  assert(wand != (MagickWand *) NULL);
4798  assert(wand->signature == WandSignature);
4799  if (wand->debug != MagickFalse)
4800    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4801  if (wand->images == (Image *) NULL)
4802    {
4803      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4804        "ContainsNoImages","`%s'",wand->name);
4805      return(UndefinedInterlace);
4806    }
4807  return(wand->images->interlace);
4808}
4809
4810/*
4811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4812%                                                                             %
4813%                                                                             %
4814%                                                                             %
4815%   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             %
4816%                                                                             %
4817%                                                                             %
4818%                                                                             %
4819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820%
4821%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4822%  sepcified image.
4823%
4824%  The format of the MagickGetImageInterpolateMethod method is:
4825%
4826%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4827%
4828%  A description of each parameter follows:
4829%
4830%    o wand: the magick wand.
4831%
4832*/
4833WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4834  MagickWand *wand)
4835{
4836  assert(wand != (MagickWand *) NULL);
4837  assert(wand->signature == WandSignature);
4838  if (wand->debug != MagickFalse)
4839    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4840  if (wand->images == (Image *) NULL)
4841    {
4842      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4843        "ContainsNoImages","`%s'",wand->name);
4844      return(UndefinedInterpolatePixel);
4845    }
4846  return(wand->images->interpolate);
4847}
4848
4849/*
4850%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4851%                                                                             %
4852%                                                                             %
4853%                                                                             %
4854%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4855%                                                                             %
4856%                                                                             %
4857%                                                                             %
4858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4859%
4860%  MagickGetImageIterations() gets the image iterations.
4861%
4862%  The format of the MagickGetImageIterations method is:
4863%
4864%      size_t MagickGetImageIterations(MagickWand *wand)
4865%
4866%  A description of each parameter follows:
4867%
4868%    o wand: the magick wand.
4869%
4870*/
4871WandExport size_t MagickGetImageIterations(MagickWand *wand)
4872{
4873  assert(wand != (MagickWand *) NULL);
4874  assert(wand->signature == WandSignature);
4875  if (wand->debug != MagickFalse)
4876    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4877  if (wand->images == (Image *) NULL)
4878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4879  return(wand->images->iterations);
4880}
4881
4882/*
4883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884%                                                                             %
4885%                                                                             %
4886%                                                                             %
4887%   M a g i c k G e t I m a g e L e n g t h                                   %
4888%                                                                             %
4889%                                                                             %
4890%                                                                             %
4891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892%
4893%  MagickGetImageLength() returns the image length in bytes.
4894%
4895%  The format of the MagickGetImageLength method is:
4896%
4897%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4898%        MagickSizeType *length)
4899%
4900%  A description of each parameter follows:
4901%
4902%    o wand: the magick wand.
4903%
4904%    o length: the image length in bytes.
4905%
4906*/
4907WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4908  MagickSizeType *length)
4909{
4910  assert(wand != (MagickWand *) NULL);
4911  assert(wand->signature == WandSignature);
4912  if (wand->debug != MagickFalse)
4913    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4914  if (wand->images == (Image *) NULL)
4915    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4916  *length=GetBlobSize(wand->images);
4917  return(MagickTrue);
4918}
4919
4920/*
4921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4922%                                                                             %
4923%                                                                             %
4924%                                                                             %
4925%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4926%                                                                             %
4927%                                                                             %
4928%                                                                             %
4929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930%
4931%  MagickGetImageMatteColor() returns the image matte color.
4932%
4933%  The format of the MagickGetImageMatteColor method is:
4934%
4935%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4936%        PixelWand *matte_color)
4937%
4938%  A description of each parameter follows:
4939%
4940%    o wand: the magick wand.
4941%
4942%    o matte_color: Return the matte color.
4943%
4944*/
4945WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4946  PixelWand *matte_color)
4947{
4948  assert(wand != (MagickWand *) NULL);
4949  assert(wand->signature == WandSignature);
4950  if (wand->debug != MagickFalse)
4951    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4952  if (wand->images == (Image *) NULL)
4953    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4954  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4955  return(MagickTrue);
4956}
4957
4958/*
4959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4960%                                                                             %
4961%                                                                             %
4962%                                                                             %
4963%   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                         %
4964%                                                                             %
4965%                                                                             %
4966%                                                                             %
4967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4968%
4969%  MagickGetImageOrientation() returns the image orientation.
4970%
4971%  The format of the MagickGetImageOrientation method is:
4972%
4973%      OrientationType MagickGetImageOrientation(MagickWand *wand)
4974%
4975%  A description of each parameter follows:
4976%
4977%    o wand: the magick wand.
4978%
4979*/
4980WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4981{
4982  assert(wand != (MagickWand *) NULL);
4983  assert(wand->signature == WandSignature);
4984  if (wand->debug != MagickFalse)
4985    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4986  if (wand->images == (Image *) NULL)
4987    {
4988      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4989        "ContainsNoImages","`%s'",wand->name);
4990      return(UndefinedOrientation);
4991    }
4992  return(wand->images->orientation);
4993}
4994
4995/*
4996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4997%                                                                             %
4998%                                                                             %
4999%                                                                             %
5000%   M a g i c k G e t I m a g e P a g e                                       %
5001%                                                                             %
5002%                                                                             %
5003%                                                                             %
5004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005%
5006%  MagickGetImagePage() returns the page geometry associated with the image.
5007%
5008%  The format of the MagickGetImagePage method is:
5009%
5010%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5011%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5012%
5013%  A description of each parameter follows:
5014%
5015%    o wand: the magick wand.
5016%
5017%    o width: the page width.
5018%
5019%    o height: the page height.
5020%
5021%    o x: the page x-offset.
5022%
5023%    o y: the page y-offset.
5024%
5025*/
5026WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5027  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5028{
5029  assert(wand != (const MagickWand *) NULL);
5030  assert(wand->signature == WandSignature);
5031  if (wand->debug != MagickFalse)
5032    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5033  if (wand->images == (Image *) NULL)
5034    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5035  *width=wand->images->page.width;
5036  *height=wand->images->page.height;
5037  *x=wand->images->page.x;
5038  *y=wand->images->page.y;
5039  return(MagickTrue);
5040}
5041
5042/*
5043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5044%                                                                             %
5045%                                                                             %
5046%                                                                             %
5047%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5048%                                                                             %
5049%                                                                             %
5050%                                                                             %
5051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5052%
5053%  MagickGetImagePixelColor() returns the color of the specified pixel.
5054%
5055%  The format of the MagickGetImagePixelColor method is:
5056%
5057%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5058%        const ssize_t x,const ssize_t y,PixelWand *color)
5059%
5060%  A description of each parameter follows:
5061%
5062%    o wand: the magick wand.
5063%
5064%    o x,y: the pixel offset into the image.
5065%
5066%    o color: Return the colormap color in this wand.
5067%
5068*/
5069WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5070  const ssize_t x,const ssize_t y,PixelWand *color)
5071{
5072  register const Quantum
5073    *p;
5074
5075  CacheView
5076    *image_view;
5077
5078  assert(wand != (MagickWand *) NULL);
5079  assert(wand->signature == WandSignature);
5080  if (wand->debug != MagickFalse)
5081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5082  if (wand->images == (Image *) NULL)
5083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5084  image_view=AcquireCacheView(wand->images);
5085  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5086  if (p == (const Quantum *) NULL)
5087    {
5088      image_view=DestroyCacheView(image_view);
5089      return(MagickFalse);
5090    }
5091  PixelSetQuantumPixel(wand->images,p,color);
5092  image_view=DestroyCacheView(image_view);
5093  return(MagickTrue);
5094}
5095
5096/*
5097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5098%                                                                             %
5099%                                                                             %
5100%                                                                             %
5101%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5102%                                                                             %
5103%                                                                             %
5104%                                                                             %
5105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5106%
5107%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5108%
5109%  The format of the MagickGetImageRedPrimary method is:
5110%
5111%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5112%        double *y)
5113%
5114%  A description of each parameter follows:
5115%
5116%    o wand: the magick wand.
5117%
5118%    o x: the chromaticity red primary x-point.
5119%
5120%    o y: the chromaticity red primary y-point.
5121%
5122*/
5123WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5124  double *x,double *y)
5125{
5126  assert(wand != (MagickWand *) NULL);
5127  assert(wand->signature == WandSignature);
5128  if (wand->debug != MagickFalse)
5129    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5130  if (wand->images == (Image *) NULL)
5131    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5132  *x=wand->images->chromaticity.red_primary.x;
5133  *y=wand->images->chromaticity.red_primary.y;
5134  return(MagickTrue);
5135}
5136
5137/*
5138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5139%                                                                             %
5140%                                                                             %
5141%                                                                             %
5142%   M a g i c k G e t I m a g e R e g i o n                                   %
5143%                                                                             %
5144%                                                                             %
5145%                                                                             %
5146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5147%
5148%  MagickGetImageRegion() extracts a region of the image and returns it as a
5149%  a new wand.
5150%
5151%  The format of the MagickGetImageRegion method is:
5152%
5153%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5154%        const size_t width,const size_t height,const ssize_t x,
5155%        const ssize_t y)
5156%
5157%  A description of each parameter follows:
5158%
5159%    o wand: the magick wand.
5160%
5161%    o width: the region width.
5162%
5163%    o height: the region height.
5164%
5165%    o x: the region x offset.
5166%
5167%    o y: the region y offset.
5168%
5169*/
5170WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5171  const size_t width,const size_t height,const ssize_t x,
5172  const ssize_t y)
5173{
5174  Image
5175    *region_image;
5176
5177  RectangleInfo
5178    region;
5179
5180  assert(wand != (MagickWand *) NULL);
5181  assert(wand->signature == WandSignature);
5182  if (wand->debug != MagickFalse)
5183    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5184  if (wand->images == (Image *) NULL)
5185    return((MagickWand *) NULL);
5186  region.width=width;
5187  region.height=height;
5188  region.x=x;
5189  region.y=y;
5190  region_image=CropImage(wand->images,&region,wand->exception);
5191  if (region_image == (Image *) NULL)
5192    return((MagickWand *) NULL);
5193  return(CloneMagickWandFromImages(wand,region_image));
5194}
5195
5196/*
5197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5198%                                                                             %
5199%                                                                             %
5200%                                                                             %
5201%   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                 %
5202%                                                                             %
5203%                                                                             %
5204%                                                                             %
5205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5206%
5207%  MagickGetImageRenderingIntent() gets the image rendering intent.
5208%
5209%  The format of the MagickGetImageRenderingIntent method is:
5210%
5211%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5212%
5213%  A description of each parameter follows:
5214%
5215%    o wand: the magick wand.
5216%
5217*/
5218WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5219{
5220  assert(wand != (MagickWand *) NULL);
5221  assert(wand->signature == WandSignature);
5222  if (wand->debug != MagickFalse)
5223    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5224  if (wand->images == (Image *) NULL)
5225    {
5226      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5227        "ContainsNoImages","`%s'",wand->name);
5228      return(UndefinedIntent);
5229    }
5230  return((RenderingIntent) wand->images->rendering_intent);
5231}
5232
5233/*
5234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5235%                                                                             %
5236%                                                                             %
5237%                                                                             %
5238%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5239%                                                                             %
5240%                                                                             %
5241%                                                                             %
5242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5243%
5244%  MagickGetImageResolution() gets the image X and Y resolution.
5245%
5246%  The format of the MagickGetImageResolution method is:
5247%
5248%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5249%        double *y)
5250%
5251%  A description of each parameter follows:
5252%
5253%    o wand: the magick wand.
5254%
5255%    o x: the image x-resolution.
5256%
5257%    o y: the image y-resolution.
5258%
5259*/
5260WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5261  double *x,double *y)
5262{
5263  assert(wand != (MagickWand *) NULL);
5264  assert(wand->signature == WandSignature);
5265  if (wand->debug != MagickFalse)
5266    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5267  if (wand->images == (Image *) NULL)
5268    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5269  *x=wand->images->x_resolution;
5270  *y=wand->images->y_resolution;
5271  return(MagickTrue);
5272}
5273
5274/*
5275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5276%                                                                             %
5277%                                                                             %
5278%                                                                             %
5279%   M a g i c k G e t I m a g e S c e n e                                     %
5280%                                                                             %
5281%                                                                             %
5282%                                                                             %
5283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5284%
5285%  MagickGetImageScene() gets the image scene.
5286%
5287%  The format of the MagickGetImageScene method is:
5288%
5289%      size_t MagickGetImageScene(MagickWand *wand)
5290%
5291%  A description of each parameter follows:
5292%
5293%    o wand: the magick wand.
5294%
5295*/
5296WandExport size_t MagickGetImageScene(MagickWand *wand)
5297{
5298  assert(wand != (MagickWand *) NULL);
5299  assert(wand->signature == WandSignature);
5300  if (wand->debug != MagickFalse)
5301    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5302  if (wand->images == (Image *) NULL)
5303    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5304  return(wand->images->scene);
5305}
5306
5307/*
5308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5309%                                                                             %
5310%                                                                             %
5311%                                                                             %
5312%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5313%                                                                             %
5314%                                                                             %
5315%                                                                             %
5316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5317%
5318%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5319%  pixel stream.
5320%
5321%  The format of the MagickGetImageSignature method is:
5322%
5323%      const char MagickGetImageSignature(MagickWand *wand)
5324%
5325%  A description of each parameter follows:
5326%
5327%    o wand: the magick wand.
5328%
5329*/
5330WandExport char *MagickGetImageSignature(MagickWand *wand)
5331{
5332  const char
5333    *value;
5334
5335  MagickBooleanType
5336    status;
5337
5338  assert(wand != (MagickWand *) NULL);
5339  assert(wand->signature == WandSignature);
5340  if (wand->debug != MagickFalse)
5341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5342  if (wand->images == (Image *) NULL)
5343    {
5344      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5345        "ContainsNoImages","`%s'",wand->name);
5346      return((char *) NULL);
5347    }
5348  status=SignatureImage(wand->images);
5349  if (status == MagickFalse)
5350    InheritException(wand->exception,&wand->images->exception);
5351  value=GetImageProperty(wand->images,"signature");
5352  if (value != (const char *) NULL)
5353    return(AcquireString(value));
5354  InheritException(wand->exception,&wand->images->exception);
5355  return((char *) NULL);
5356}
5357
5358/*
5359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5360%                                                                             %
5361%                                                                             %
5362%                                                                             %
5363%   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                   %
5364%                                                                             %
5365%                                                                             %
5366%                                                                             %
5367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5368%
5369%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5370%
5371%  The format of the MagickGetImageTicksPerSecond method is:
5372%
5373%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5374%
5375%  A description of each parameter follows:
5376%
5377%    o wand: the magick wand.
5378%
5379*/
5380WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5381{
5382  assert(wand != (MagickWand *) NULL);
5383  assert(wand->signature == WandSignature);
5384  if (wand->debug != MagickFalse)
5385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5386  if (wand->images == (Image *) NULL)
5387    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5388  return((size_t) wand->images->ticks_per_second);
5389}
5390
5391/*
5392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5393%                                                                             %
5394%                                                                             %
5395%                                                                             %
5396%   M a g i c k G e t I m a g e T y p e                                       %
5397%                                                                             %
5398%                                                                             %
5399%                                                                             %
5400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5401%
5402%  MagickGetImageType() gets the potential image type:
5403%
5404%        Bilevel        Grayscale       GrayscaleMatte
5405%        Palette        PaletteMatte    TrueColor
5406%        TrueColorMatte ColorSeparation ColorSeparationMatte
5407%
5408%  To ensure the image type matches its potential, use MagickSetImageType():
5409%
5410%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5411%
5412%  The format of the MagickGetImageType method is:
5413%
5414%      ImageType MagickGetImageType(MagickWand *wand)
5415%
5416%  A description of each parameter follows:
5417%
5418%    o wand: the magick wand.
5419%
5420*/
5421WandExport ImageType MagickGetImageType(MagickWand *wand)
5422{
5423  assert(wand != (MagickWand *) NULL);
5424  assert(wand->signature == WandSignature);
5425  if (wand->debug != MagickFalse)
5426    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5427  if (wand->images == (Image *) NULL)
5428    {
5429      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5430        "ContainsNoImages","`%s'",wand->name);
5431      return(UndefinedType);
5432    }
5433  return(GetImageType(wand->images,wand->exception));
5434}
5435
5436/*
5437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5438%                                                                             %
5439%                                                                             %
5440%                                                                             %
5441%   M a g i c k G e t I m a g e U n i t s                                     %
5442%                                                                             %
5443%                                                                             %
5444%                                                                             %
5445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5446%
5447%  MagickGetImageUnits() gets the image units of resolution.
5448%
5449%  The format of the MagickGetImageUnits method is:
5450%
5451%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5452%
5453%  A description of each parameter follows:
5454%
5455%    o wand: the magick wand.
5456%
5457*/
5458WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5459{
5460  assert(wand != (MagickWand *) NULL);
5461  assert(wand->signature == WandSignature);
5462  if (wand->debug != MagickFalse)
5463    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5464  if (wand->images == (Image *) NULL)
5465    {
5466      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5467        "ContainsNoImages","`%s'",wand->name);
5468      return(UndefinedResolution);
5469    }
5470  return(wand->images->units);
5471}
5472
5473/*
5474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5475%                                                                             %
5476%                                                                             %
5477%                                                                             %
5478%   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           %
5479%                                                                             %
5480%                                                                             %
5481%                                                                             %
5482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5483%
5484%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5485%  sepcified image.
5486%
5487%  The format of the MagickGetImageVirtualPixelMethod method is:
5488%
5489%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5490%
5491%  A description of each parameter follows:
5492%
5493%    o wand: the magick wand.
5494%
5495*/
5496WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5497{
5498  assert(wand != (MagickWand *) NULL);
5499  assert(wand->signature == WandSignature);
5500  if (wand->debug != MagickFalse)
5501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5502  if (wand->images == (Image *) NULL)
5503    {
5504      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5505        "ContainsNoImages","`%s'",wand->name);
5506      return(UndefinedVirtualPixelMethod);
5507    }
5508  return(GetImageVirtualPixelMethod(wand->images));
5509}
5510
5511/*
5512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5513%                                                                             %
5514%                                                                             %
5515%                                                                             %
5516%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5517%                                                                             %
5518%                                                                             %
5519%                                                                             %
5520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521%
5522%  MagickGetImageWhitePoint() returns the chromaticy white point.
5523%
5524%  The format of the MagickGetImageWhitePoint method is:
5525%
5526%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5527%        double *y)
5528%
5529%  A description of each parameter follows:
5530%
5531%    o wand: the magick wand.
5532%
5533%    o x: the chromaticity white x-point.
5534%
5535%    o y: the chromaticity white y-point.
5536%
5537*/
5538WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5539  double *x,double *y)
5540{
5541  assert(wand != (MagickWand *) NULL);
5542  assert(wand->signature == WandSignature);
5543  if (wand->debug != MagickFalse)
5544    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5545  if (wand->images == (Image *) NULL)
5546    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5547  *x=wand->images->chromaticity.white_point.x;
5548  *y=wand->images->chromaticity.white_point.y;
5549  return(MagickTrue);
5550}
5551
5552/*
5553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5554%                                                                             %
5555%                                                                             %
5556%                                                                             %
5557%   M a g i c k G e t I m a g e W i d t h                                     %
5558%                                                                             %
5559%                                                                             %
5560%                                                                             %
5561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5562%
5563%  MagickGetImageWidth() returns the image width.
5564%
5565%  The format of the MagickGetImageWidth method is:
5566%
5567%      size_t MagickGetImageWidth(MagickWand *wand)
5568%
5569%  A description of each parameter follows:
5570%
5571%    o wand: the magick wand.
5572%
5573*/
5574WandExport size_t MagickGetImageWidth(MagickWand *wand)
5575{
5576  assert(wand != (MagickWand *) NULL);
5577  assert(wand->signature == WandSignature);
5578  if (wand->debug != MagickFalse)
5579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5580  if (wand->images == (Image *) NULL)
5581    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5582  return(wand->images->columns);
5583}
5584
5585/*
5586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5587%                                                                             %
5588%                                                                             %
5589%                                                                             %
5590%   M a g i c k G e t N u m b e r I m a g e s                                 %
5591%                                                                             %
5592%                                                                             %
5593%                                                                             %
5594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595%
5596%  MagickGetNumberImages() returns the number of images associated with a
5597%  magick wand.
5598%
5599%  The format of the MagickGetNumberImages method is:
5600%
5601%      size_t MagickGetNumberImages(MagickWand *wand)
5602%
5603%  A description of each parameter follows:
5604%
5605%    o wand: the magick wand.
5606%
5607*/
5608WandExport size_t MagickGetNumberImages(MagickWand *wand)
5609{
5610  assert(wand != (MagickWand *) NULL);
5611  assert(wand->signature == WandSignature);
5612  if (wand->debug != MagickFalse)
5613    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5614  return(GetImageListLength(wand->images));
5615}
5616
5617/*
5618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5619%                                                                             %
5620%                                                                             %
5621%                                                                             %
5622%   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                 %
5623%                                                                             %
5624%                                                                             %
5625%                                                                             %
5626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5627%
5628%  MagickGetImageTotalInkDensity() gets the image total ink density.
5629%
5630%  The format of the MagickGetImageTotalInkDensity method is:
5631%
5632%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5633%
5634%  A description of each parameter follows:
5635%
5636%    o wand: the magick wand.
5637%
5638*/
5639WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5640{
5641  assert(wand != (MagickWand *) NULL);
5642  assert(wand->signature == WandSignature);
5643  if (wand->debug != MagickFalse)
5644    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5645  if (wand->images == (Image *) NULL)
5646    {
5647      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5648        "ContainsNoImages","`%s'",wand->name);
5649      return(0.0);
5650    }
5651  return(GetImageTotalInkDensity(wand->images));
5652}
5653
5654/*
5655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5656%                                                                             %
5657%                                                                             %
5658%                                                                             %
5659%   M a g i c k H a l d C l u t I m a g e                                     %
5660%                                                                             %
5661%                                                                             %
5662%                                                                             %
5663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5664%
5665%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5666%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5667%  dimensions.  Create it with the HALD coder.  You can apply any color
5668%  transformation to the Hald image and then use this method to apply the
5669%  transform to the image.
5670%
5671%  The format of the MagickHaldClutImage method is:
5672%
5673%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5674%        const MagickWand *hald_wand)
5675%
5676%  A description of each parameter follows:
5677%
5678%    o wand: the magick wand.
5679%
5680%    o hald_image: the hald CLUT image.
5681%
5682*/
5683WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5684  const MagickWand *hald_wand)
5685{
5686  MagickBooleanType
5687    status;
5688
5689  assert(wand != (MagickWand *) NULL);
5690  assert(wand->signature == WandSignature);
5691  if (wand->debug != MagickFalse)
5692    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5693  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5694    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5695  status=HaldClutImage(wand->images,hald_wand->images);
5696  if (status == MagickFalse)
5697    InheritException(wand->exception,&wand->images->exception);
5698  return(status);
5699}
5700
5701/*
5702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5703%                                                                             %
5704%                                                                             %
5705%                                                                             %
5706%   M a g i c k H a s N e x t I m a g e                                       %
5707%                                                                             %
5708%                                                                             %
5709%                                                                             %
5710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5711%
5712%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5713%  traversing the list in the forward direction
5714%
5715%  The format of the MagickHasNextImage method is:
5716%
5717%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5718%
5719%  A description of each parameter follows:
5720%
5721%    o wand: the magick wand.
5722%
5723*/
5724WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5725{
5726  assert(wand != (MagickWand *) NULL);
5727  assert(wand->signature == WandSignature);
5728  if (wand->debug != MagickFalse)
5729    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5730  if (wand->images == (Image *) NULL)
5731    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5732  if (GetNextImageInList(wand->images) == (Image *) NULL)
5733    return(MagickFalse);
5734  return(MagickTrue);
5735}
5736
5737/*
5738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5739%                                                                             %
5740%                                                                             %
5741%                                                                             %
5742%   M a g i c k H a s P r e v i o u s I m a g e                               %
5743%                                                                             %
5744%                                                                             %
5745%                                                                             %
5746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5747%
5748%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5749%  traversing the list in the reverse direction
5750%
5751%  The format of the MagickHasPreviousImage method is:
5752%
5753%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5754%
5755%  A description of each parameter follows:
5756%
5757%    o wand: the magick wand.
5758%
5759*/
5760WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5761{
5762  assert(wand != (MagickWand *) NULL);
5763  assert(wand->signature == WandSignature);
5764  if (wand->debug != MagickFalse)
5765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5766  if (wand->images == (Image *) NULL)
5767    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5768  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5769    return(MagickFalse);
5770  return(MagickTrue);
5771}
5772
5773/*
5774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5775%                                                                             %
5776%                                                                             %
5777%                                                                             %
5778%   M a g i c k I d e n t i f y I m a g e                                     %
5779%                                                                             %
5780%                                                                             %
5781%                                                                             %
5782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5783%
5784%  MagickIdentifyImage() identifies an image by printing its attributes to the
5785%  file.  Attributes include the image width, height, size, and others.
5786%
5787%  The format of the MagickIdentifyImage method is:
5788%
5789%      const char *MagickIdentifyImage(MagickWand *wand)
5790%
5791%  A description of each parameter follows:
5792%
5793%    o wand: the magick wand.
5794%
5795*/
5796WandExport char *MagickIdentifyImage(MagickWand *wand)
5797{
5798  char
5799    *description,
5800    filename[MaxTextExtent];
5801
5802  FILE
5803    *file;
5804
5805  int
5806    unique_file;
5807
5808  assert(wand != (MagickWand *) NULL);
5809  assert(wand->signature == WandSignature);
5810  if (wand->debug != MagickFalse)
5811    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5812  if (wand->images == (Image *) NULL)
5813    {
5814      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5815        "ContainsNoImages","`%s'",wand->name);
5816      return((char *) NULL);
5817    }
5818  description=(char *) NULL;
5819  unique_file=AcquireUniqueFileResource(filename);
5820  file=(FILE *) NULL;
5821  if (unique_file != -1)
5822    file=fdopen(unique_file,"wb");
5823  if ((unique_file == -1) || (file == (FILE *) NULL))
5824    {
5825      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5826        "UnableToCreateTemporaryFile","`%s'",wand->name);
5827      return((char *) NULL);
5828    }
5829  (void) IdentifyImage(wand->images,file,MagickTrue);
5830  (void) fclose(file);
5831  description=FileToString(filename,~0,wand->exception);
5832  (void) RelinquishUniqueFileResource(filename);
5833  return(description);
5834}
5835
5836/*
5837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838%                                                                             %
5839%                                                                             %
5840%                                                                             %
5841%   M a g i c k I m p l o d e I m a g e                                       %
5842%                                                                             %
5843%                                                                             %
5844%                                                                             %
5845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5846%
5847%  MagickImplodeImage() creates a new image that is a copy of an existing
5848%  one with the image pixels "implode" by the specified percentage.  It
5849%  allocates the memory necessary for the new Image structure and returns a
5850%  pointer to the new image.
5851%
5852%  The format of the MagickImplodeImage method is:
5853%
5854%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5855%        const double radius)
5856%
5857%  A description of each parameter follows:
5858%
5859%    o wand: the magick wand.
5860%
5861%    o amount: Define the extent of the implosion.
5862%
5863*/
5864WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5865  const double amount)
5866{
5867  Image
5868    *implode_image;
5869
5870  assert(wand != (MagickWand *) NULL);
5871  assert(wand->signature == WandSignature);
5872  if (wand->debug != MagickFalse)
5873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5874  if (wand->images == (Image *) NULL)
5875    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5876  implode_image=ImplodeImage(wand->images,amount,wand->exception);
5877  if (implode_image == (Image *) NULL)
5878    return(MagickFalse);
5879  ReplaceImageInList(&wand->images,implode_image);
5880  return(MagickTrue);
5881}
5882
5883/*
5884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885%                                                                             %
5886%                                                                             %
5887%                                                                             %
5888%   M a g i c k I m p o r t I m a g e P i x e l s                             %
5889%                                                                             %
5890%                                                                             %
5891%                                                                             %
5892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5893%
5894%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5895%  location you specify.  The method returns MagickFalse on success otherwise
5896%  MagickTrue if an error is encountered.  The pixel data can be either char,
5897%  short int, int, ssize_t, float, or double in the order specified by map.
5898%
5899%  Suppose your want to upload the first scanline of a 640x480 image from
5900%  character data in red-green-blue order:
5901%
5902%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5903%
5904%  The format of the MagickImportImagePixels method is:
5905%
5906%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5907%        const ssize_t x,const ssize_t y,const size_t columns,
5908%        const size_t rows,const char *map,const StorageType storage,
5909%        const void *pixels)
5910%
5911%  A description of each parameter follows:
5912%
5913%    o wand: the magick wand.
5914%
5915%    o x, y, columns, rows:  These values define the perimeter of a region
5916%      of pixels you want to define.
5917%
5918%    o map:  This string reflects the expected ordering of the pixel array.
5919%      It can be any combination or order of R = red, G = green, B = blue,
5920%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5921%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5922%      P = pad.
5923%
5924%    o storage: Define the data type of the pixels.  Float and double types are
5925%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5926%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5927%      or DoublePixel.
5928%
5929%    o pixels: This array of values contain the pixel components as defined by
5930%      map and type.  You must preallocate this array where the expected
5931%      length varies depending on the values of width, height, map, and type.
5932%
5933*/
5934WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5935  const ssize_t x,const ssize_t y,const size_t columns,
5936  const size_t rows,const char *map,const StorageType storage,
5937  const void *pixels)
5938{
5939  MagickBooleanType
5940    status;
5941
5942  assert(wand != (MagickWand *) NULL);
5943  assert(wand->signature == WandSignature);
5944  if (wand->debug != MagickFalse)
5945    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5946  if (wand->images == (Image *) NULL)
5947    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5948  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5949  if (status == MagickFalse)
5950    InheritException(wand->exception,&wand->images->exception);
5951  return(status);
5952}
5953
5954/*
5955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5956%                                                                             %
5957%                                                                             %
5958%                                                                             %
5959%   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       %
5960%                                                                             %
5961%                                                                             %
5962%                                                                             %
5963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5964%
5965%  MagickInverseFourierTransformImage() implements the inverse discrete
5966%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5967%  imaginary image pair.
5968%
5969%  The format of the MagickInverseFourierTransformImage method is:
5970%
5971%      MagickBooleanType MagickInverseFourierTransformImage(
5972%        MagickWand *magnitude_wand,MagickWand *phase_wand,
5973%        const MagickBooleanType magnitude)
5974%
5975%  A description of each parameter follows:
5976%
5977%    o magnitude_wand: the magnitude or real wand.
5978%
5979%    o phase_wand: the phase or imaginary wand.
5980%
5981%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5982%      imaginary image pair.
5983%
5984*/
5985WandExport MagickBooleanType MagickInverseFourierTransformImage(
5986  MagickWand *magnitude_wand,MagickWand *phase_wand,
5987  const MagickBooleanType magnitude)
5988{
5989  Image
5990    *inverse_image;
5991
5992  MagickWand
5993    *wand;
5994
5995  assert(magnitude_wand != (MagickWand *) NULL);
5996  assert(magnitude_wand->signature == WandSignature);
5997  if (magnitude_wand->debug != MagickFalse)
5998    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5999      magnitude_wand->name);
6000  wand=magnitude_wand;
6001  if (magnitude_wand->images == (Image *) NULL)
6002    ThrowWandException(WandError,"ContainsNoImages",
6003      magnitude_wand->name);
6004  assert(phase_wand != (MagickWand *) NULL);
6005  assert(phase_wand->signature == WandSignature);
6006  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6007    phase_wand->images,magnitude,wand->exception);
6008  if (inverse_image == (Image *) NULL)
6009    return(MagickFalse);
6010  ReplaceImageInList(&wand->images,inverse_image);
6011  return(MagickTrue);
6012}
6013
6014/*
6015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6016%                                                                             %
6017%                                                                             %
6018%                                                                             %
6019%   M a g i c k L a b e l I m a g e                                           %
6020%                                                                             %
6021%                                                                             %
6022%                                                                             %
6023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6024%
6025%  MagickLabelImage() adds a label to your image.
6026%
6027%  The format of the MagickLabelImage method is:
6028%
6029%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6030%
6031%  A description of each parameter follows:
6032%
6033%    o wand: the magick wand.
6034%
6035%    o label: the image label.
6036%
6037*/
6038WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6039  const char *label)
6040{
6041  MagickBooleanType
6042    status;
6043
6044  assert(wand != (MagickWand *) NULL);
6045  assert(wand->signature == WandSignature);
6046  if (wand->debug != MagickFalse)
6047    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6048  if (wand->images == (Image *) NULL)
6049    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6050  status=SetImageProperty(wand->images,"label",label);
6051  if (status == MagickFalse)
6052    InheritException(wand->exception,&wand->images->exception);
6053  return(status);
6054}
6055
6056/*
6057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6058%                                                                             %
6059%                                                                             %
6060%                                                                             %
6061%   M a g i c k L e v e l I m a g e                                           %
6062%                                                                             %
6063%                                                                             %
6064%                                                                             %
6065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6066%
6067%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6068%  falling between specified white and black points to the full available
6069%  quantum range. The parameters provided represent the black, mid, and white
6070%  points. The black point specifies the darkest color in the image. Colors
6071%  darker than the black point are set to zero. Mid point specifies a gamma
6072%  correction to apply to the image.  White point specifies the lightest color
6073%  in the image. Colors brighter than the white point are set to the maximum
6074%  quantum value.
6075%
6076%  The format of the MagickLevelImage method is:
6077%
6078%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6079%        const double black_point,const double gamma,const double white_point)
6080%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6081%        const ChannelType channel,const double black_point,const double gamma,
6082%        const double white_point)
6083%
6084%  A description of each parameter follows:
6085%
6086%    o wand: the magick wand.
6087%
6088%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6089%
6090%    o black_point: the black point.
6091%
6092%    o gamma: the gamma.
6093%
6094%    o white_point: the white point.
6095%
6096*/
6097WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6098  const double black_point,const double gamma,const double white_point)
6099{
6100  MagickBooleanType
6101    status;
6102
6103  assert(wand != (MagickWand *) NULL);
6104  assert(wand->signature == WandSignature);
6105  if (wand->debug != MagickFalse)
6106    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6107  if (wand->images == (Image *) NULL)
6108    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6109  status=LevelImage(wand->images,black_point,white_point,gamma);
6110  if (status == MagickFalse)
6111    InheritException(wand->exception,&wand->images->exception);
6112  return(status);
6113}
6114
6115/*
6116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6117%                                                                             %
6118%                                                                             %
6119%                                                                             %
6120%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6121%                                                                             %
6122%                                                                             %
6123%                                                                             %
6124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6125%
6126%  MagickLinearStretchImage() stretches with saturation the image intensity.
6127%
6128%  You can also reduce the influence of a particular channel with a gamma
6129%  value of 0.
6130%
6131%  The format of the MagickLinearStretchImage method is:
6132%
6133%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6134%        const double black_point,const double white_point)
6135%
6136%  A description of each parameter follows:
6137%
6138%    o wand: the magick wand.
6139%
6140%    o black_point: the black point.
6141%
6142%    o white_point: the white point.
6143%
6144*/
6145WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6146  const double black_point,const double white_point)
6147{
6148  MagickBooleanType
6149    status;
6150
6151  assert(wand != (MagickWand *) NULL);
6152  assert(wand->signature == WandSignature);
6153  if (wand->debug != MagickFalse)
6154    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6155  if (wand->images == (Image *) NULL)
6156    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6157  status=LinearStretchImage(wand->images,black_point,white_point);
6158  if (status == MagickFalse)
6159    InheritException(wand->exception,&wand->images->exception);
6160  return(status);
6161}
6162
6163/*
6164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6165%                                                                             %
6166%                                                                             %
6167%                                                                             %
6168%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6169%                                                                             %
6170%                                                                             %
6171%                                                                             %
6172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6173%
6174%  MagickLiquidRescaleImage() rescales image with seam carving.
6175%
6176%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6177%        const size_t columns,const size_t rows,
6178%        const double delta_x,const double rigidity)
6179%
6180%  A description of each parameter follows:
6181%
6182%    o wand: the magick wand.
6183%
6184%    o columns: the number of columns in the scaled image.
6185%
6186%    o rows: the number of rows in the scaled image.
6187%
6188%    o delta_x: maximum seam transversal step (0 means straight seams).
6189%
6190%    o rigidity: introduce a bias for non-straight seams (typically 0).
6191%
6192*/
6193WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6194  const size_t columns,const size_t rows,const double delta_x,
6195  const double rigidity)
6196{
6197  Image
6198    *rescale_image;
6199
6200  assert(wand != (MagickWand *) NULL);
6201  assert(wand->signature == WandSignature);
6202  if (wand->debug != MagickFalse)
6203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6204  if (wand->images == (Image *) NULL)
6205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6206  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6207    rigidity,wand->exception);
6208  if (rescale_image == (Image *) NULL)
6209    return(MagickFalse);
6210  ReplaceImageInList(&wand->images,rescale_image);
6211  return(MagickTrue);
6212}
6213
6214/*
6215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6216%                                                                             %
6217%                                                                             %
6218%                                                                             %
6219%   M a g i c k M a g n i f y I m a g e                                       %
6220%                                                                             %
6221%                                                                             %
6222%                                                                             %
6223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6224%
6225%  MagickMagnifyImage() is a convenience method that scales an image
6226%  proportionally to twice its original size.
6227%
6228%  The format of the MagickMagnifyImage method is:
6229%
6230%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6231%
6232%  A description of each parameter follows:
6233%
6234%    o wand: the magick wand.
6235%
6236*/
6237WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6238{
6239  Image
6240    *magnify_image;
6241
6242  assert(wand != (MagickWand *) NULL);
6243  assert(wand->signature == WandSignature);
6244  if (wand->debug != MagickFalse)
6245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6246  if (wand->images == (Image *) NULL)
6247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6248  magnify_image=MagnifyImage(wand->images,wand->exception);
6249  if (magnify_image == (Image *) NULL)
6250    return(MagickFalse);
6251  ReplaceImageInList(&wand->images,magnify_image);
6252  return(MagickTrue);
6253}
6254
6255/*
6256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6257%                                                                             %
6258%                                                                             %
6259%                                                                             %
6260%   M a g i c k M e r g e I m a g e L a y e r s                               %
6261%                                                                             %
6262%                                                                             %
6263%                                                                             %
6264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6265%
6266%  MagickMergeImageLayers() composes all the image layers from the current
6267%  given image onward to produce a single image of the merged layers.
6268%
6269%  The inital canvas's size depends on the given ImageLayerMethod, and is
6270%  initialized using the first images background color.  The images
6271%  are then compositied onto that image in sequence using the given
6272%  composition that has been assigned to each individual image.
6273%
6274%  The format of the MagickMergeImageLayers method is:
6275%
6276%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6277%        const ImageLayerMethod method)
6278%
6279%  A description of each parameter follows:
6280%
6281%    o wand: the magick wand.
6282%
6283%    o method: the method of selecting the size of the initial canvas.
6284%
6285%        MergeLayer: Merge all layers onto a canvas just large enough
6286%           to hold all the actual images. The virtual canvas of the
6287%           first image is preserved but otherwise ignored.
6288%
6289%        FlattenLayer: Use the virtual canvas size of first image.
6290%           Images which fall outside this canvas is clipped.
6291%           This can be used to 'fill out' a given virtual canvas.
6292%
6293%        MosaicLayer: Start with the virtual canvas of the first image,
6294%           enlarging left and right edges to contain all images.
6295%           Images with negative offsets will be clipped.
6296%
6297*/
6298WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6299  const ImageLayerMethod method)
6300{
6301  Image
6302    *mosaic_image;
6303
6304  assert(wand != (MagickWand *) NULL);
6305  assert(wand->signature == WandSignature);
6306  if (wand->debug != MagickFalse)
6307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6308  if (wand->images == (Image *) NULL)
6309    return((MagickWand *) NULL);
6310  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6311  if (mosaic_image == (Image *) NULL)
6312    return((MagickWand *) NULL);
6313  return(CloneMagickWandFromImages(wand,mosaic_image));
6314}
6315
6316/*
6317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6318%                                                                             %
6319%                                                                             %
6320%                                                                             %
6321%   M a g i c k M i n i f y I m a g e                                         %
6322%                                                                             %
6323%                                                                             %
6324%                                                                             %
6325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6326%
6327%  MagickMinifyImage() is a convenience method that scales an image
6328%  proportionally to one-half its original size
6329%
6330%  The format of the MagickMinifyImage method is:
6331%
6332%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6333%
6334%  A description of each parameter follows:
6335%
6336%    o wand: the magick wand.
6337%
6338*/
6339WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6340{
6341  Image
6342    *minify_image;
6343
6344  assert(wand != (MagickWand *) NULL);
6345  assert(wand->signature == WandSignature);
6346  if (wand->debug != MagickFalse)
6347    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6348  if (wand->images == (Image *) NULL)
6349    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6350  minify_image=MinifyImage(wand->images,wand->exception);
6351  if (minify_image == (Image *) NULL)
6352    return(MagickFalse);
6353  ReplaceImageInList(&wand->images,minify_image);
6354  return(MagickTrue);
6355}
6356
6357/*
6358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6359%                                                                             %
6360%                                                                             %
6361%                                                                             %
6362%   M a g i c k M o d u l a t e I m a g e                                     %
6363%                                                                             %
6364%                                                                             %
6365%                                                                             %
6366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6367%
6368%  MagickModulateImage() lets you control the brightness, saturation, and hue
6369%  of an image.  Hue is the percentage of absolute rotation from the current
6370%  position.  For example 50 results in a counter-clockwise rotation of 90
6371%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6372%  both resulting in a rotation of 180 degrees.
6373%
6374%  To increase the color brightness by 20% and decrease the color saturation by
6375%  10% and leave the hue unchanged, use: 120,90,100.
6376%
6377%  The format of the MagickModulateImage method is:
6378%
6379%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6380%        const double brightness,const double saturation,const double hue)
6381%
6382%  A description of each parameter follows:
6383%
6384%    o wand: the magick wand.
6385%
6386%    o brightness: the percent change in brighness.
6387%
6388%    o saturation: the percent change in saturation.
6389%
6390%    o hue: the percent change in hue.
6391%
6392*/
6393WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6394  const double brightness,const double saturation,const double hue)
6395{
6396  char
6397    modulate[MaxTextExtent];
6398
6399  MagickBooleanType
6400    status;
6401
6402  assert(wand != (MagickWand *) NULL);
6403  assert(wand->signature == WandSignature);
6404  if (wand->debug != MagickFalse)
6405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6406  if (wand->images == (Image *) NULL)
6407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6408  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6409    brightness,saturation,hue);
6410  status=ModulateImage(wand->images,modulate);
6411  if (status == MagickFalse)
6412    InheritException(wand->exception,&wand->images->exception);
6413  return(status);
6414}
6415
6416/*
6417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418%                                                                             %
6419%                                                                             %
6420%                                                                             %
6421%   M a g i c k M o n t a g e I m a g e                                       %
6422%                                                                             %
6423%                                                                             %
6424%                                                                             %
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%
6427%  MagickMontageImage() creates a composite image by combining several
6428%  separate images. The images are tiled on the composite image with the name
6429%  of the image optionally appearing just below the individual tile.
6430%
6431%  The format of the MagickMontageImage method is:
6432%
6433%      MagickWand *MagickMontageImage(MagickWand *wand,
6434%        const DrawingWand drawing_wand,const char *tile_geometry,
6435%        const char *thumbnail_geometry,const MontageMode mode,
6436%        const char *frame)
6437%
6438%  A description of each parameter follows:
6439%
6440%    o wand: the magick wand.
6441%
6442%    o drawing_wand: the drawing wand.  The font name, size, and color are
6443%      obtained from this wand.
6444%
6445%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6446%
6447%    o thumbnail_geometry: Preferred image size and border size of each
6448%      thumbnail (e.g. 120x120+4+3>).
6449%
6450%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6451%
6452%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6453%      The frame color is that of the thumbnail's matte color.
6454%
6455*/
6456WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6457  const DrawingWand *drawing_wand,const char *tile_geometry,
6458  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6459{
6460  char
6461    *font;
6462
6463  Image
6464    *montage_image;
6465
6466  MontageInfo
6467    *montage_info;
6468
6469  PixelWand
6470    *pixel_wand;
6471
6472  assert(wand != (MagickWand *) NULL);
6473  assert(wand->signature == WandSignature);
6474  if (wand->debug != MagickFalse)
6475    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6476  if (wand->images == (Image *) NULL)
6477    return((MagickWand *) NULL);
6478  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6479  switch (mode)
6480  {
6481    case FrameMode:
6482    {
6483      (void) CloneString(&montage_info->frame,"15x15+3+3");
6484      montage_info->shadow=MagickTrue;
6485      break;
6486    }
6487    case UnframeMode:
6488    {
6489      montage_info->frame=(char *) NULL;
6490      montage_info->shadow=MagickFalse;
6491      montage_info->border_width=0;
6492      break;
6493    }
6494    case ConcatenateMode:
6495    {
6496      montage_info->frame=(char *) NULL;
6497      montage_info->shadow=MagickFalse;
6498      (void) CloneString(&montage_info->geometry,"+0+0");
6499      montage_info->border_width=0;
6500      break;
6501    }
6502    default:
6503      break;
6504  }
6505  font=DrawGetFont(drawing_wand);
6506  if (font != (char *) NULL)
6507    (void) CloneString(&montage_info->font,font);
6508  if (frame != (char *) NULL)
6509    (void) CloneString(&montage_info->frame,frame);
6510  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6511  pixel_wand=NewPixelWand();
6512  DrawGetFillColor(drawing_wand,pixel_wand);
6513  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6514  DrawGetStrokeColor(drawing_wand,pixel_wand);
6515  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6516  pixel_wand=DestroyPixelWand(pixel_wand);
6517  if (thumbnail_geometry != (char *) NULL)
6518    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6519  if (tile_geometry != (char *) NULL)
6520    (void) CloneString(&montage_info->tile,tile_geometry);
6521  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6522    wand->exception);
6523  montage_info=DestroyMontageInfo(montage_info);
6524  if (montage_image == (Image *) NULL)
6525    return((MagickWand *) NULL);
6526  return(CloneMagickWandFromImages(wand,montage_image));
6527}
6528
6529/*
6530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6531%                                                                             %
6532%                                                                             %
6533%                                                                             %
6534%   M a g i c k M o r p h I m a g e s                                         %
6535%                                                                             %
6536%                                                                             %
6537%                                                                             %
6538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6539%
6540%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6541%  and size are linearly interpolated to give the appearance of a
6542%  meta-morphosis from one image to the next.
6543%
6544%  The format of the MagickMorphImages method is:
6545%
6546%      MagickWand *MagickMorphImages(MagickWand *wand,
6547%        const size_t number_frames)
6548%
6549%  A description of each parameter follows:
6550%
6551%    o wand: the magick wand.
6552%
6553%    o number_frames: the number of in-between images to generate.
6554%
6555*/
6556WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6557  const size_t number_frames)
6558{
6559  Image
6560    *morph_image;
6561
6562  assert(wand != (MagickWand *) NULL);
6563  assert(wand->signature == WandSignature);
6564  if (wand->debug != MagickFalse)
6565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6566  if (wand->images == (Image *) NULL)
6567    return((MagickWand *) NULL);
6568  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6569  if (morph_image == (Image *) NULL)
6570    return((MagickWand *) NULL);
6571  return(CloneMagickWandFromImages(wand,morph_image));
6572}
6573
6574/*
6575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6576%                                                                             %
6577%                                                                             %
6578%                                                                             %
6579%   M a g i c k M o r p h o l o g y I m a g e                                 %
6580%                                                                             %
6581%                                                                             %
6582%                                                                             %
6583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6584%
6585%  MagickMorphologyImage() applies a user supplied kernel to the image
6586%  according to the given mophology method.
6587%
6588%  The format of the MagickMorphologyImage method is:
6589%
6590%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6591%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6592%
6593%  A description of each parameter follows:
6594%
6595%    o wand: the magick wand.
6596%
6597%    o method: the morphology method to be applied.
6598%
6599%    o iterations: apply the operation this many times (or no change).
6600%      A value of -1 means loop until no change found.  How this is applied
6601%      may depend on the morphology method.  Typically this is a value of 1.
6602%
6603%    o kernel: An array of doubles representing the morphology kernel.
6604%
6605*/
6606WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6607  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6608{
6609  Image
6610    *morphology_image;
6611
6612  assert(wand != (MagickWand *) NULL);
6613  assert(wand->signature == WandSignature);
6614  if (wand->debug != MagickFalse)
6615    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6616  if (kernel == (const KernelInfo *) NULL)
6617    return(MagickFalse);
6618  if (wand->images == (Image *) NULL)
6619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6620  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6621    wand->exception);
6622  if (morphology_image == (Image *) NULL)
6623    return(MagickFalse);
6624  ReplaceImageInList(&wand->images,morphology_image);
6625  return(MagickTrue);
6626}
6627
6628/*
6629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6630%                                                                             %
6631%                                                                             %
6632%                                                                             %
6633%   M a g i c k M o t i o n B l u r I m a g e                                 %
6634%                                                                             %
6635%                                                                             %
6636%                                                                             %
6637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6638%
6639%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6640%  Gaussian operator of the given radius and standard deviation (sigma).
6641%  For reasonable results, radius should be larger than sigma.  Use a
6642%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6643%  Angle gives the angle of the blurring motion.
6644%
6645%  The format of the MagickMotionBlurImage method is:
6646%
6647%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6648%        const double radius,const double sigma,const double angle)
6649%
6650%  A description of each parameter follows:
6651%
6652%    o wand: the magick wand.
6653%
6654%    o radius: the radius of the Gaussian, in pixels, not counting
6655%      the center pixel.
6656%
6657%    o sigma: the standard deviation of the Gaussian, in pixels.
6658%
6659%    o angle: Apply the effect along this angle.
6660%
6661*/
6662WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6663  const double radius,const double sigma,const double angle)
6664{
6665  Image
6666    *blur_image;
6667
6668  assert(wand != (MagickWand *) NULL);
6669  assert(wand->signature == WandSignature);
6670  if (wand->debug != MagickFalse)
6671    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6672  if (wand->images == (Image *) NULL)
6673    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6674  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6675  if (blur_image == (Image *) NULL)
6676    return(MagickFalse);
6677  ReplaceImageInList(&wand->images,blur_image);
6678  return(MagickTrue);
6679}
6680
6681/*
6682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6683%                                                                             %
6684%                                                                             %
6685%                                                                             %
6686%   M a g i c k N e g a t e I m a g e                                         %
6687%                                                                             %
6688%                                                                             %
6689%                                                                             %
6690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6691%
6692%  MagickNegateImage() negates the colors in the reference image.  The
6693%  Grayscale option means that only grayscale values within the image are
6694%  negated.
6695%
6696%  You can also reduce the influence of a particular channel with a gamma
6697%  value of 0.
6698%
6699%  The format of the MagickNegateImage method is:
6700%
6701%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6702%        const MagickBooleanType gray)
6703%
6704%  A description of each parameter follows:
6705%
6706%    o wand: the magick wand.
6707%
6708%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6709%
6710*/
6711WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6712  const MagickBooleanType gray)
6713{
6714  MagickBooleanType
6715    status;
6716
6717  assert(wand != (MagickWand *) NULL);
6718  assert(wand->signature == WandSignature);
6719  if (wand->debug != MagickFalse)
6720    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6721  if (wand->images == (Image *) NULL)
6722    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6723  status=NegateImage(wand->images,gray);
6724  if (status == MagickFalse)
6725    InheritException(wand->exception,&wand->images->exception);
6726  return(status);
6727}
6728
6729/*
6730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6731%                                                                             %
6732%                                                                             %
6733%                                                                             %
6734%   M a g i c k N e w I m a g e                                               %
6735%                                                                             %
6736%                                                                             %
6737%                                                                             %
6738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6739%
6740%  MagickNewImage() adds a blank image canvas of the specified size and
6741%  background color to the wand.
6742%
6743%  The format of the MagickNewImage method is:
6744%
6745%      MagickBooleanType MagickNewImage(MagickWand *wand,
6746%        const size_t columns,const size_t rows,
6747%        const PixelWand *background)
6748%
6749%  A description of each parameter follows:
6750%
6751%    o wand: the magick wand.
6752%
6753%    o width: the image width.
6754%
6755%    o height: the image height.
6756%
6757%    o background: the image color.
6758%
6759*/
6760WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6761  const size_t width,const size_t height,
6762  const PixelWand *background)
6763{
6764  Image
6765    *images;
6766
6767  PixelInfo
6768    pixel;
6769
6770  assert(wand != (MagickWand *) NULL);
6771  assert(wand->signature == WandSignature);
6772  if (wand->debug != MagickFalse)
6773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6774  PixelGetMagickColor(background,&pixel);
6775  images=NewMagickImage(wand->image_info,width,height,&pixel);
6776  if (images == (Image *) NULL)
6777    return(MagickFalse);
6778  if (images->exception.severity != UndefinedException)
6779    InheritException(wand->exception,&images->exception);
6780  return(InsertImageInWand(wand,images));
6781}
6782
6783/*
6784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6785%                                                                             %
6786%                                                                             %
6787%                                                                             %
6788%   M a g i c k N e x t I m a g e                                             %
6789%                                                                             %
6790%                                                                             %
6791%                                                                             %
6792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6793%
6794%  MagickNextImage() associates the next image in the image list with a magick
6795%  wand.
6796%
6797%  The format of the MagickNextImage method is:
6798%
6799%      MagickBooleanType MagickNextImage(MagickWand *wand)
6800%
6801%  A description of each parameter follows:
6802%
6803%    o wand: the magick wand.
6804%
6805*/
6806WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6807{
6808  assert(wand != (MagickWand *) NULL);
6809  assert(wand->signature == WandSignature);
6810  if (wand->debug != MagickFalse)
6811    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6812  if (wand->images == (Image *) NULL)
6813    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6814  if (wand->pend != MagickFalse)
6815    {
6816      wand->pend=MagickFalse;
6817      return(MagickTrue);
6818    }
6819  if (GetNextImageInList(wand->images) == (Image *) NULL)
6820    {
6821      wand->pend=MagickTrue;
6822      return(MagickFalse);
6823    }
6824  wand->images=GetNextImageInList(wand->images);
6825  return(MagickTrue);
6826}
6827
6828/*
6829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830%                                                                             %
6831%                                                                             %
6832%                                                                             %
6833%   M a g i c k N o r m a l i z e I m a g e                                   %
6834%                                                                             %
6835%                                                                             %
6836%                                                                             %
6837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838%
6839%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6840%  the pixels color to span the entire range of colors available
6841%
6842%  You can also reduce the influence of a particular channel with a gamma
6843%  value of 0.
6844%
6845%  The format of the MagickNormalizeImage method is:
6846%
6847%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6848%
6849%  A description of each parameter follows:
6850%
6851%    o wand: the magick wand.
6852%
6853*/
6854WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6855{
6856  MagickBooleanType
6857    status;
6858
6859  assert(wand != (MagickWand *) NULL);
6860  assert(wand->signature == WandSignature);
6861  if (wand->debug != MagickFalse)
6862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6863  if (wand->images == (Image *) NULL)
6864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6865  status=NormalizeImage(wand->images);
6866  if (status == MagickFalse)
6867    InheritException(wand->exception,&wand->images->exception);
6868  return(status);
6869}
6870
6871/*
6872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6873%                                                                             %
6874%                                                                             %
6875%                                                                             %
6876%   M a g i c k O i l P a i n t I m a g e                                     %
6877%                                                                             %
6878%                                                                             %
6879%                                                                             %
6880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6881%
6882%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6883%  painting.  Each pixel is replaced by the most frequent color occurring
6884%  in a circular region defined by radius.
6885%
6886%  The format of the MagickOilPaintImage method is:
6887%
6888%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6889%        const double radius)
6890%
6891%  A description of each parameter follows:
6892%
6893%    o wand: the magick wand.
6894%
6895%    o radius: the radius of the circular neighborhood.
6896%
6897*/
6898WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6899  const double radius)
6900{
6901  Image
6902    *paint_image;
6903
6904  assert(wand != (MagickWand *) NULL);
6905  assert(wand->signature == WandSignature);
6906  if (wand->debug != MagickFalse)
6907    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6908  if (wand->images == (Image *) NULL)
6909    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6910  paint_image=OilPaintImage(wand->images,radius,wand->exception);
6911  if (paint_image == (Image *) NULL)
6912    return(MagickFalse);
6913  ReplaceImageInList(&wand->images,paint_image);
6914  return(MagickTrue);
6915}
6916
6917/*
6918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6919%                                                                             %
6920%                                                                             %
6921%                                                                             %
6922%   M a g i c k O p a q u e P a i n t I m a g e                               %
6923%                                                                             %
6924%                                                                             %
6925%                                                                             %
6926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6927%
6928%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6929%  defined by fill.
6930%
6931%  The format of the MagickOpaquePaintImage method is:
6932%
6933%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6934%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6935%        const MagickBooleanType invert)
6936%
6937%  A description of each parameter follows:
6938%
6939%    o wand: the magick wand.
6940%
6941%    o target: Change this target color to the fill color within the image.
6942%
6943%    o fill: the fill pixel wand.
6944%
6945%    o fuzz: By default target must match a particular pixel color
6946%      exactly.  However, in many cases two colors may differ by a small amount.
6947%      The fuzz member of image defines how much tolerance is acceptable to
6948%      consider two colors as the same.  For example, set fuzz to 10 and the
6949%      color red at intensities of 100 and 102 respectively are now interpreted
6950%      as the same color for the purposes of the floodfill.
6951%
6952%    o invert: paint any pixel that does not match the target color.
6953%
6954*/
6955WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6956  const PixelWand *target,const PixelWand *fill,const double fuzz,
6957  const MagickBooleanType invert)
6958{
6959  MagickBooleanType
6960    status;
6961
6962  PixelInfo
6963    fill_pixel,
6964    target_pixel;
6965
6966  assert(wand != (MagickWand *) NULL);
6967  assert(wand->signature == WandSignature);
6968  if (wand->debug != MagickFalse)
6969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6970  if (wand->images == (Image *) NULL)
6971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6972  PixelGetMagickColor(target,&target_pixel);
6973  PixelGetMagickColor(fill,&fill_pixel);
6974  wand->images->fuzz=fuzz;
6975  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert);
6976  if (status == MagickFalse)
6977    InheritException(wand->exception,&wand->images->exception);
6978  return(status);
6979}
6980
6981/*
6982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6983%                                                                             %
6984%                                                                             %
6985%                                                                             %
6986%   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                         %
6987%                                                                             %
6988%                                                                             %
6989%                                                                             %
6990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6991%
6992%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6993%  previous image in the sequence.  From this it attempts to select the
6994%  smallest cropped image to replace each frame, while preserving the results
6995%  of the animation.
6996%
6997%  The format of the MagickOptimizeImageLayers method is:
6998%
6999%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7000%
7001%  A description of each parameter follows:
7002%
7003%    o wand: the magick wand.
7004%
7005*/
7006WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7007{
7008  Image
7009    *optimize_image;
7010
7011  assert(wand != (MagickWand *) NULL);
7012  assert(wand->signature == WandSignature);
7013  if (wand->debug != MagickFalse)
7014    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7015  if (wand->images == (Image *) NULL)
7016    return((MagickWand *) NULL);
7017  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7018  if (optimize_image == (Image *) NULL)
7019    return((MagickWand *) NULL);
7020  return(CloneMagickWandFromImages(wand,optimize_image));
7021}
7022
7023/*
7024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7025%                                                                             %
7026%                                                                             %
7027%                                                                             %
7028%     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                   %
7029%                                                                             %
7030%                                                                             %
7031%                                                                             %
7032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7033%
7034%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7035%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7036%  which can be different for different channels, according to the input
7037%  arguments.
7038%
7039%  The format of the MagickOrderedPosterizeImage method is:
7040%
7041%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7042%        const char *threshold_map)
7043%
7044%  A description of each parameter follows:
7045%
7046%    o image: the image.
7047%
7048%    o threshold_map: A string containing the name of the threshold dither
7049%      map to use, followed by zero or more numbers representing the number of
7050%      color levels tho dither between.
7051%
7052%      Any level number less than 2 is equivalent to 2, and means only binary
7053%      dithering will be applied to each color channel.
7054%
7055%      No numbers also means a 2 level (bitmap) dither will be applied to all
7056%      channels, while a single number is the number of levels applied to each
7057%      channel in sequence.  More numbers will be applied in turn to each of
7058%      the color channels.
7059%
7060%      For example: "o3x3,6" generates a 6 level posterization of the image
7061%      with a ordered 3x3 diffused pixel dither being applied between each
7062%      level. While checker,8,8,4 will produce a 332 colormaped image with
7063%      only a single checkerboard hash pattern (50% grey) between each color
7064%      level, to basically double the number of color levels with a bare
7065%      minimim of dithering.
7066%
7067*/
7068WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7069  const char *threshold_map)
7070{
7071  MagickBooleanType
7072    status;
7073
7074  assert(wand != (MagickWand *) NULL);
7075  assert(wand->signature == WandSignature);
7076  if (wand->debug != MagickFalse)
7077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7078  if (wand->images == (Image *) NULL)
7079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7080  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7081  return(status);
7082}
7083
7084/*
7085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7086%                                                                             %
7087%                                                                             %
7088%                                                                             %
7089%   M a g i c k P i n g I m a g e                                             %
7090%                                                                             %
7091%                                                                             %
7092%                                                                             %
7093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7094%
7095%  MagickPingImage() is like MagickReadImage() except the only valid
7096%  information returned is the image width, height, size, and format.  It
7097%  is designed to efficiently obtain this information from a file without
7098%  reading the entire image sequence into memory.
7099%
7100%  The format of the MagickPingImage method is:
7101%
7102%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7103%
7104%  A description of each parameter follows:
7105%
7106%    o wand: the magick wand.
7107%
7108%    o filename: the image filename.
7109%
7110*/
7111WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7112  const char *filename)
7113{
7114  Image
7115    *images;
7116
7117  ImageInfo
7118    *ping_info;
7119
7120  assert(wand != (MagickWand *) NULL);
7121  assert(wand->signature == WandSignature);
7122  if (wand->debug != MagickFalse)
7123    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7124  ping_info=CloneImageInfo(wand->image_info);
7125  if (filename != (const char *) NULL)
7126    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7127  images=PingImage(ping_info,wand->exception);
7128  ping_info=DestroyImageInfo(ping_info);
7129  if (images == (Image *) NULL)
7130    return(MagickFalse);
7131  return(InsertImageInWand(wand,images));
7132}
7133
7134/*
7135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7136%                                                                             %
7137%                                                                             %
7138%                                                                             %
7139%   M a g i c k P i n g I m a g e B l o b                                     %
7140%                                                                             %
7141%                                                                             %
7142%                                                                             %
7143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7144%
7145%  MagickPingImageBlob() pings an image or image sequence from a blob.
7146%
7147%  The format of the MagickPingImageBlob method is:
7148%
7149%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7150%        const void *blob,const size_t length)
7151%
7152%  A description of each parameter follows:
7153%
7154%    o wand: the magick wand.
7155%
7156%    o blob: the blob.
7157%
7158%    o length: the blob length.
7159%
7160*/
7161WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7162  const void *blob,const size_t length)
7163{
7164  Image
7165    *images;
7166
7167  ImageInfo
7168    *read_info;
7169
7170  assert(wand != (MagickWand *) NULL);
7171  assert(wand->signature == WandSignature);
7172  if (wand->debug != MagickFalse)
7173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7174  read_info=CloneImageInfo(wand->image_info);
7175  SetImageInfoBlob(read_info,blob,length);
7176  images=PingImage(read_info,wand->exception);
7177  read_info=DestroyImageInfo(read_info);
7178  if (images == (Image *) NULL)
7179    return(MagickFalse);
7180  return(InsertImageInWand(wand,images));
7181}
7182
7183/*
7184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7185%                                                                             %
7186%                                                                             %
7187%                                                                             %
7188%   M a g i c k P i n g I m a g e F i l e                                     %
7189%                                                                             %
7190%                                                                             %
7191%                                                                             %
7192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7193%
7194%  MagickPingImageFile() pings an image or image sequence from an open file
7195%  descriptor.
7196%
7197%  The format of the MagickPingImageFile method is:
7198%
7199%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7200%
7201%  A description of each parameter follows:
7202%
7203%    o wand: the magick wand.
7204%
7205%    o file: the file descriptor.
7206%
7207*/
7208WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7209{
7210  Image
7211    *images;
7212
7213  ImageInfo
7214    *read_info;
7215
7216  assert(wand != (MagickWand *) NULL);
7217  assert(wand->signature == WandSignature);
7218  assert(file != (FILE *) NULL);
7219  if (wand->debug != MagickFalse)
7220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7221  read_info=CloneImageInfo(wand->image_info);
7222  SetImageInfoFile(read_info,file);
7223  images=PingImage(read_info,wand->exception);
7224  read_info=DestroyImageInfo(read_info);
7225  if (images == (Image *) NULL)
7226    return(MagickFalse);
7227  return(InsertImageInWand(wand,images));
7228}
7229
7230/*
7231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232%                                                                             %
7233%                                                                             %
7234%                                                                             %
7235%   M a g i c k P o l a r o i d I m a g e                                     %
7236%                                                                             %
7237%                                                                             %
7238%                                                                             %
7239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240%
7241%  MagickPolaroidImage() simulates a Polaroid picture.
7242%
7243%  The format of the MagickPolaroidImage method is:
7244%
7245%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7246%        const DrawingWand *drawing_wand,const double angle)
7247%
7248%  A description of each parameter follows:
7249%
7250%    o wand: the magick wand.
7251%
7252%    o drawing_wand: the draw wand.
7253%
7254%    o angle: Apply the effect along this angle.
7255%
7256*/
7257WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7258  const DrawingWand *drawing_wand,const double angle)
7259{
7260  DrawInfo
7261    *draw_info;
7262
7263  Image
7264    *polaroid_image;
7265
7266  assert(wand != (MagickWand *) NULL);
7267  assert(wand->signature == WandSignature);
7268  if (wand->debug != MagickFalse)
7269    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7270  if (wand->images == (Image *) NULL)
7271    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7272  draw_info=PeekDrawingWand(drawing_wand);
7273  if (draw_info == (DrawInfo *) NULL)
7274    return(MagickFalse);
7275  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7276  if (polaroid_image == (Image *) NULL)
7277    return(MagickFalse);
7278  ReplaceImageInList(&wand->images,polaroid_image);
7279  return(MagickTrue);
7280}
7281
7282/*
7283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7284%                                                                             %
7285%                                                                             %
7286%                                                                             %
7287%   M a g i c k P o s t e r i z e I m a g e                                   %
7288%                                                                             %
7289%                                                                             %
7290%                                                                             %
7291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7292%
7293%  MagickPosterizeImage() reduces the image to a limited number of color level.
7294%
7295%  The format of the MagickPosterizeImage method is:
7296%
7297%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7298%        const unsigned levels,const MagickBooleanType dither)
7299%
7300%  A description of each parameter follows:
7301%
7302%    o wand: the magick wand.
7303%
7304%    o levels: Number of color levels allowed in each channel.  Very low values
7305%      (2, 3, or 4) have the most visible effect.
7306%
7307%    o dither: Set this integer value to something other than zero to dither
7308%      the mapped image.
7309%
7310*/
7311WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7312  const size_t levels,const MagickBooleanType dither)
7313{
7314  MagickBooleanType
7315    status;
7316
7317  assert(wand != (MagickWand *) NULL);
7318  assert(wand->signature == WandSignature);
7319  if (wand->debug != MagickFalse)
7320    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7321  if (wand->images == (Image *) NULL)
7322    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7323  status=PosterizeImage(wand->images,levels,dither);
7324  if (status == MagickFalse)
7325    InheritException(wand->exception,&wand->images->exception);
7326  return(status);
7327}
7328
7329/*
7330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7331%                                                                             %
7332%                                                                             %
7333%                                                                             %
7334%   M a g i c k P r e v i e w I m a g e s                                     %
7335%                                                                             %
7336%                                                                             %
7337%                                                                             %
7338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7339%
7340%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7341%  image processing operation applied at varying strengths.  This helpful
7342%  to quickly pin-point an appropriate parameter for an image processing
7343%  operation.
7344%
7345%  The format of the MagickPreviewImages method is:
7346%
7347%      MagickWand *MagickPreviewImages(MagickWand *wand,
7348%        const PreviewType preview)
7349%
7350%  A description of each parameter follows:
7351%
7352%    o wand: the magick wand.
7353%
7354%    o preview: the preview type.
7355%
7356*/
7357WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7358  const PreviewType preview)
7359{
7360  Image
7361    *preview_image;
7362
7363  assert(wand != (MagickWand *) NULL);
7364  assert(wand->signature == WandSignature);
7365  if (wand->debug != MagickFalse)
7366    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7367  if (wand->images == (Image *) NULL)
7368    return((MagickWand *) NULL);
7369  preview_image=PreviewImage(wand->images,preview,wand->exception);
7370  if (preview_image == (Image *) NULL)
7371    return((MagickWand *) NULL);
7372  return(CloneMagickWandFromImages(wand,preview_image));
7373}
7374
7375/*
7376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7377%                                                                             %
7378%                                                                             %
7379%                                                                             %
7380%   M a g i c k P r e v i o u s I m a g e                                     %
7381%                                                                             %
7382%                                                                             %
7383%                                                                             %
7384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7385%
7386%  MagickPreviousImage() assocates the previous image in an image list with
7387%  the magick wand.
7388%
7389%  The format of the MagickPreviousImage method is:
7390%
7391%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7392%
7393%  A description of each parameter follows:
7394%
7395%    o wand: the magick wand.
7396%
7397*/
7398WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7399{
7400  assert(wand != (MagickWand *) NULL);
7401  assert(wand->signature == WandSignature);
7402  if (wand->debug != MagickFalse)
7403    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7404  if (wand->images == (Image *) NULL)
7405    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7406  if (wand->pend != MagickFalse)
7407    {
7408      wand->pend=MagickFalse;
7409      return(MagickTrue);
7410    }
7411  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7412    {
7413      wand->pend=MagickTrue;
7414      return(MagickFalse);
7415    }
7416  wand->images=GetPreviousImageInList(wand->images);
7417  return(MagickTrue);
7418}
7419
7420/*
7421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7422%                                                                             %
7423%                                                                             %
7424%                                                                             %
7425%   M a g i c k Q u a n t i z e I m a g e                                     %
7426%                                                                             %
7427%                                                                             %
7428%                                                                             %
7429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7430%
7431%  MagickQuantizeImage() analyzes the colors within a reference image and
7432%  chooses a fixed number of colors to represent the image.  The goal of the
7433%  algorithm is to minimize the color difference between the input and output
7434%  image while minimizing the processing time.
7435%
7436%  The format of the MagickQuantizeImage method is:
7437%
7438%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7439%        const size_t number_colors,const ColorspaceType colorspace,
7440%        const size_t treedepth,const MagickBooleanType dither,
7441%        const MagickBooleanType measure_error)
7442%
7443%  A description of each parameter follows:
7444%
7445%    o wand: the magick wand.
7446%
7447%    o number_colors: the number of colors.
7448%
7449%    o colorspace: Perform color reduction in this colorspace, typically
7450%      RGBColorspace.
7451%
7452%    o treedepth: Normally, this integer value is zero or one.  A zero or
7453%      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
7454%      reference image with the least amount of memory and the fastest
7455%      computational speed.  In some cases, such as an image with low color
7456%      dispersion (a few number of colors), a value other than
7457%      Log4(number_colors) is required.  To expand the color tree completely,
7458%      use a value of 8.
7459%
7460%    o dither: A value other than zero distributes the difference between an
7461%      original image and the corresponding color reduced image to
7462%      neighboring pixels along a Hilbert curve.
7463%
7464%    o measure_error: A value other than zero measures the difference between
7465%      the original and quantized images.  This difference is the total
7466%      quantization error.  The error is computed by summing over all pixels
7467%      in an image the distance squared in RGB space between each reference
7468%      pixel value and its quantized value.
7469%
7470*/
7471WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7472  const size_t number_colors,const ColorspaceType colorspace,
7473  const size_t treedepth,const MagickBooleanType dither,
7474  const MagickBooleanType measure_error)
7475{
7476  MagickBooleanType
7477    status;
7478
7479  QuantizeInfo
7480    *quantize_info;
7481
7482  assert(wand != (MagickWand *) NULL);
7483  assert(wand->signature == WandSignature);
7484  if (wand->debug != MagickFalse)
7485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7486  if (wand->images == (Image *) NULL)
7487    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7488  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7489  quantize_info->number_colors=number_colors;
7490  quantize_info->dither=dither;
7491  quantize_info->tree_depth=treedepth;
7492  quantize_info->colorspace=colorspace;
7493  quantize_info->measure_error=measure_error;
7494  status=QuantizeImage(quantize_info,wand->images);
7495  if (status == MagickFalse)
7496    InheritException(wand->exception,&wand->images->exception);
7497  quantize_info=DestroyQuantizeInfo(quantize_info);
7498  return(status);
7499}
7500
7501/*
7502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7503%                                                                             %
7504%                                                                             %
7505%                                                                             %
7506%   M a g i c k Q u a n t i z e I m a g e s                                   %
7507%                                                                             %
7508%                                                                             %
7509%                                                                             %
7510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7511%
7512%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7513%  chooses a fixed number of colors to represent the image.  The goal of the
7514%  algorithm is to minimize the color difference between the input and output
7515%  image while minimizing the processing time.
7516%
7517%  The format of the MagickQuantizeImages method is:
7518%
7519%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7520%        const size_t number_colors,const ColorspaceType colorspace,
7521%        const size_t treedepth,const MagickBooleanType dither,
7522%        const MagickBooleanType measure_error)
7523%
7524%  A description of each parameter follows:
7525%
7526%    o wand: the magick wand.
7527%
7528%    o number_colors: the number of colors.
7529%
7530%    o colorspace: Perform color reduction in this colorspace, typically
7531%      RGBColorspace.
7532%
7533%    o treedepth: Normally, this integer value is zero or one.  A zero or
7534%      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
7535%      reference image with the least amount of memory and the fastest
7536%      computational speed.  In some cases, such as an image with low color
7537%      dispersion (a few number of colors), a value other than
7538%      Log4(number_colors) is required.  To expand the color tree completely,
7539%      use a value of 8.
7540%
7541%    o dither: A value other than zero distributes the difference between an
7542%      original image and the corresponding color reduced algorithm to
7543%      neighboring pixels along a Hilbert curve.
7544%
7545%    o measure_error: A value other than zero measures the difference between
7546%      the original and quantized images.  This difference is the total
7547%      quantization error.  The error is computed by summing over all pixels
7548%      in an image the distance squared in RGB space between each reference
7549%      pixel value and its quantized value.
7550%
7551*/
7552WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7553  const size_t number_colors,const ColorspaceType colorspace,
7554  const size_t treedepth,const MagickBooleanType dither,
7555  const MagickBooleanType measure_error)
7556{
7557  MagickBooleanType
7558    status;
7559
7560  QuantizeInfo
7561    *quantize_info;
7562
7563  assert(wand != (MagickWand *) NULL);
7564  assert(wand->signature == WandSignature);
7565  if (wand->debug != MagickFalse)
7566    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7567  if (wand->images == (Image *) NULL)
7568    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7569  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7570  quantize_info->number_colors=number_colors;
7571  quantize_info->dither=dither;
7572  quantize_info->tree_depth=treedepth;
7573  quantize_info->colorspace=colorspace;
7574  quantize_info->measure_error=measure_error;
7575  status=QuantizeImages(quantize_info,wand->images);
7576  if (status == MagickFalse)
7577    InheritException(wand->exception,&wand->images->exception);
7578  quantize_info=DestroyQuantizeInfo(quantize_info);
7579  return(status);
7580}
7581
7582/*
7583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7584%                                                                             %
7585%                                                                             %
7586%                                                                             %
7587%   M a g i c k R a d i a l B l u r I m a g e                                 %
7588%                                                                             %
7589%                                                                             %
7590%                                                                             %
7591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7592%
7593%  MagickRadialBlurImage() radial blurs an image.
7594%
7595%  The format of the MagickRadialBlurImage method is:
7596%
7597%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7598%        const double angle)
7599%
7600%  A description of each parameter follows:
7601%
7602%    o wand: the magick wand.
7603%
7604%    o angle: the angle of the blur in degrees.
7605%
7606*/
7607WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7608  const double angle)
7609{
7610  Image
7611    *blur_image;
7612
7613  assert(wand != (MagickWand *) NULL);
7614  assert(wand->signature == WandSignature);
7615  if (wand->debug != MagickFalse)
7616    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7617  if (wand->images == (Image *) NULL)
7618    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7619  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7620  if (blur_image == (Image *) NULL)
7621    return(MagickFalse);
7622  ReplaceImageInList(&wand->images,blur_image);
7623  return(MagickTrue);
7624}
7625
7626/*
7627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7628%                                                                             %
7629%                                                                             %
7630%                                                                             %
7631%   M a g i c k R a i s e I m a g e                                           %
7632%                                                                             %
7633%                                                                             %
7634%                                                                             %
7635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7636%
7637%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7638%  by lightening and darkening the edges of the image.  Members width and
7639%  height of raise_info define the width of the vertical and horizontal
7640%  edge of the effect.
7641%
7642%  The format of the MagickRaiseImage method is:
7643%
7644%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7645%        const size_t width,const size_t height,const ssize_t x,
7646%        const ssize_t y,const MagickBooleanType raise)
7647%
7648%  A description of each parameter follows:
7649%
7650%    o wand: the magick wand.
7651%
7652%    o width,height,x,y:  Define the dimensions of the area to raise.
7653%
7654%    o raise: A value other than zero creates a 3-D raise effect,
7655%      otherwise it has a lowered effect.
7656%
7657*/
7658WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7659  const size_t width,const size_t height,const ssize_t x,
7660  const ssize_t y,const MagickBooleanType raise)
7661{
7662  MagickBooleanType
7663    status;
7664
7665  RectangleInfo
7666    raise_info;
7667
7668  assert(wand != (MagickWand *) NULL);
7669  assert(wand->signature == WandSignature);
7670  if (wand->debug != MagickFalse)
7671    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7672  if (wand->images == (Image *) NULL)
7673    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7674  raise_info.width=width;
7675  raise_info.height=height;
7676  raise_info.x=x;
7677  raise_info.y=y;
7678  status=RaiseImage(wand->images,&raise_info,raise);
7679  if (status == MagickFalse)
7680    InheritException(wand->exception,&wand->images->exception);
7681  return(status);
7682}
7683
7684/*
7685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7686%                                                                             %
7687%                                                                             %
7688%                                                                             %
7689%   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                       %
7690%                                                                             %
7691%                                                                             %
7692%                                                                             %
7693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7694%
7695%  MagickRandomThresholdImage() changes the value of individual pixels based on
7696%  the intensity of each pixel compared to threshold.  The result is a
7697%  high-contrast, two color image.
7698%
7699%  The format of the MagickRandomThresholdImage method is:
7700%
7701%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7702%        const double low,const double high)
7703%
7704%  A description of each parameter follows:
7705%
7706%    o wand: the magick wand.
7707%
7708%    o low,high: Specify the high and low thresholds.  These values range from
7709%      0 to QuantumRange.
7710%
7711*/
7712WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7713  const double low,const double high)
7714{
7715  char
7716    threshold[MaxTextExtent];
7717
7718  MagickBooleanType
7719    status;
7720
7721  assert(wand != (MagickWand *) NULL);
7722  assert(wand->signature == WandSignature);
7723  if (wand->debug != MagickFalse)
7724    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7725  if (wand->images == (Image *) NULL)
7726    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7727  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7728  status=RandomThresholdImage(wand->images,threshold,wand->exception);
7729  if (status == MagickFalse)
7730    InheritException(wand->exception,&wand->images->exception);
7731  return(status);
7732}
7733
7734/*
7735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7736%                                                                             %
7737%                                                                             %
7738%                                                                             %
7739%   M a g i c k R e a d I m a g e                                             %
7740%                                                                             %
7741%                                                                             %
7742%                                                                             %
7743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7744%
7745%  MagickReadImage() reads an image or image sequence.  The images are inserted
7746%  at the current image pointer position.   Use MagickSetFirstIterator(),
7747%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7748%  image pointer position at the beginning of the image list, the end, or
7749%  anywhere in-between respectively.
7750%
7751%  The format of the MagickReadImage method is:
7752%
7753%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7754%
7755%  A description of each parameter follows:
7756%
7757%    o wand: the magick wand.
7758%
7759%    o filename: the image filename.
7760%
7761*/
7762WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7763  const char *filename)
7764{
7765  Image
7766    *images;
7767
7768  ImageInfo
7769    *read_info;
7770
7771  assert(wand != (MagickWand *) NULL);
7772  assert(wand->signature == WandSignature);
7773  if (wand->debug != MagickFalse)
7774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7775  read_info=CloneImageInfo(wand->image_info);
7776  if (filename != (const char *) NULL)
7777    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7778  images=ReadImage(read_info,wand->exception);
7779  read_info=DestroyImageInfo(read_info);
7780  if (images == (Image *) NULL)
7781    return(MagickFalse);
7782  return(InsertImageInWand(wand,images));
7783}
7784
7785/*
7786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7787%                                                                             %
7788%                                                                             %
7789%                                                                             %
7790%   M a g i c k R e a d I m a g e B l o b                                     %
7791%                                                                             %
7792%                                                                             %
7793%                                                                             %
7794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7795%
7796%  MagickReadImageBlob() reads an image or image sequence from a blob.
7797%
7798%  The format of the MagickReadImageBlob method is:
7799%
7800%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7801%        const void *blob,const size_t length)
7802%
7803%  A description of each parameter follows:
7804%
7805%    o wand: the magick wand.
7806%
7807%    o blob: the blob.
7808%
7809%    o length: the blob length.
7810%
7811*/
7812WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7813  const void *blob,const size_t length)
7814{
7815  Image
7816    *images;
7817
7818  assert(wand != (MagickWand *) NULL);
7819  assert(wand->signature == WandSignature);
7820  if (wand->debug != MagickFalse)
7821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7822  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7823  if (images == (Image *) NULL)
7824    return(MagickFalse);
7825  return(InsertImageInWand(wand,images));
7826}
7827
7828/*
7829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7830%                                                                             %
7831%                                                                             %
7832%                                                                             %
7833%   M a g i c k R e a d I m a g e F i l e                                     %
7834%                                                                             %
7835%                                                                             %
7836%                                                                             %
7837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7838%
7839%  MagickReadImageFile() reads an image or image sequence from an open file
7840%  descriptor.
7841%
7842%  The format of the MagickReadImageFile method is:
7843%
7844%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7845%
7846%  A description of each parameter follows:
7847%
7848%    o wand: the magick wand.
7849%
7850%    o file: the file descriptor.
7851%
7852*/
7853WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7854{
7855  Image
7856    *images;
7857
7858  ImageInfo
7859    *read_info;
7860
7861  assert(wand != (MagickWand *) NULL);
7862  assert(wand->signature == WandSignature);
7863  assert(file != (FILE *) NULL);
7864  if (wand->debug != MagickFalse)
7865    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7866  read_info=CloneImageInfo(wand->image_info);
7867  SetImageInfoFile(read_info,file);
7868  images=ReadImage(read_info,wand->exception);
7869  read_info=DestroyImageInfo(read_info);
7870  if (images == (Image *) NULL)
7871    return(MagickFalse);
7872  return(InsertImageInWand(wand,images));
7873}
7874
7875/*
7876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7877%                                                                             %
7878%                                                                             %
7879%                                                                             %
7880%   M a g i c k R e m a p I m a g e                                           %
7881%                                                                             %
7882%                                                                             %
7883%                                                                             %
7884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7885%
7886%  MagickRemapImage() replaces the colors of an image with the closest color
7887%  from a reference image.
7888%
7889%  The format of the MagickRemapImage method is:
7890%
7891%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7892%        const MagickWand *remap_wand,const DitherMethod method)
7893%
7894%  A description of each parameter follows:
7895%
7896%    o wand: the magick wand.
7897%
7898%    o affinity: the affinity wand.
7899%
7900%    o method: choose from these dither methods: NoDitherMethod,
7901%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7902%
7903*/
7904WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7905  const MagickWand *remap_wand,const DitherMethod method)
7906{
7907  MagickBooleanType
7908    status;
7909
7910  QuantizeInfo
7911    *quantize_info;
7912
7913  assert(wand != (MagickWand *) NULL);
7914  assert(wand->signature == WandSignature);
7915  if (wand->debug != MagickFalse)
7916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7917  if ((wand->images == (Image *) NULL) ||
7918      (remap_wand->images == (Image *) NULL))
7919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7920  quantize_info=AcquireQuantizeInfo(wand->image_info);
7921  quantize_info->dither_method=method;
7922  if (method == NoDitherMethod)
7923    quantize_info->dither=MagickFalse;
7924  status=RemapImage(quantize_info,wand->images,remap_wand->images);
7925  quantize_info=DestroyQuantizeInfo(quantize_info);
7926  if (status == MagickFalse)
7927    InheritException(wand->exception,&wand->images->exception);
7928  return(status);
7929}
7930
7931/*
7932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7933%                                                                             %
7934%                                                                             %
7935%                                                                             %
7936%   M a g i c k R e m o v e I m a g e                                         %
7937%                                                                             %
7938%                                                                             %
7939%                                                                             %
7940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7941%
7942%  MagickRemoveImage() removes an image from the image list.
7943%
7944%  The format of the MagickRemoveImage method is:
7945%
7946%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7947%
7948%  A description of each parameter follows:
7949%
7950%    o wand: the magick wand.
7951%
7952%    o insert: the splice wand.
7953%
7954*/
7955WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7956{
7957  assert(wand != (MagickWand *) NULL);
7958  assert(wand->signature == WandSignature);
7959  if (wand->debug != MagickFalse)
7960    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7961  if (wand->images == (Image *) NULL)
7962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7963  DeleteImageFromList(&wand->images);
7964  return(MagickTrue);
7965}
7966
7967/*
7968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7969%                                                                             %
7970%                                                                             %
7971%                                                                             %
7972%   M a g i c k R e s a m p l e I m a g e                                     %
7973%                                                                             %
7974%                                                                             %
7975%                                                                             %
7976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7977%
7978%  MagickResampleImage() resample image to desired resolution.
7979%
7980%    Bessel   Blackman   Box
7981%    Catrom   Cubic      Gaussian
7982%    Hanning  Hermite    Lanczos
7983%    Mitchell Point      Quandratic
7984%    Sinc     Triangle
7985%
7986%  Most of the filters are FIR (finite impulse response), however, Bessel,
7987%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7988%  are windowed (brought down to zero) with the Blackman filter.
7989%
7990%  The format of the MagickResampleImage method is:
7991%
7992%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7993%        const double x_resolution,const double y_resolution,
7994%        const FilterTypes filter,const double blur)
7995%
7996%  A description of each parameter follows:
7997%
7998%    o wand: the magick wand.
7999%
8000%    o x_resolution: the new image x resolution.
8001%
8002%    o y_resolution: the new image y resolution.
8003%
8004%    o filter: Image filter to use.
8005%
8006%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8007%
8008*/
8009WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8010  const double x_resolution,const double y_resolution,const FilterTypes filter,
8011  const double blur)
8012{
8013  Image
8014    *resample_image;
8015
8016  assert(wand != (MagickWand *) NULL);
8017  assert(wand->signature == WandSignature);
8018  if (wand->debug != MagickFalse)
8019    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8020  if (wand->images == (Image *) NULL)
8021    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8022  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8023    blur,wand->exception);
8024  if (resample_image == (Image *) NULL)
8025    return(MagickFalse);
8026  ReplaceImageInList(&wand->images,resample_image);
8027  return(MagickTrue);
8028}
8029
8030/*
8031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8032%                                                                             %
8033%                                                                             %
8034%                                                                             %
8035%   M a g i c k R e s e t I m a g e P a g e                                   %
8036%                                                                             %
8037%                                                                             %
8038%                                                                             %
8039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8040%
8041%  MagickResetImagePage() resets the Wand page canvas and position.
8042%
8043%  The format of the MagickResetImagePage method is:
8044%
8045%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8046%        const char *page)
8047%
8048%  A description of each parameter follows:
8049%
8050%    o wand: the magick wand.
8051%
8052%    o page: the relative page specification.
8053%
8054*/
8055WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8056  const char *page)
8057{
8058  assert(wand != (MagickWand *) NULL);
8059  assert(wand->signature == WandSignature);
8060  if (wand->debug != MagickFalse)
8061    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8062  if (wand->images == (Image *) NULL)
8063    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8064  if ((page == (char *) NULL) || (*page == '\0'))
8065    {
8066      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8067      return(MagickTrue);
8068    }
8069  return(ResetImagePage(wand->images,page));
8070}
8071
8072/*
8073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8074%                                                                             %
8075%                                                                             %
8076%                                                                             %
8077%   M a g i c k R e s i z e I m a g e                                         %
8078%                                                                             %
8079%                                                                             %
8080%                                                                             %
8081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8082%
8083%  MagickResizeImage() scales an image to the desired dimensions with one of
8084%  these filters:
8085%
8086%    Bessel   Blackman   Box
8087%    Catrom   Cubic      Gaussian
8088%    Hanning  Hermite    Lanczos
8089%    Mitchell Point      Quandratic
8090%    Sinc     Triangle
8091%
8092%  Most of the filters are FIR (finite impulse response), however, Bessel,
8093%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8094%  are windowed (brought down to zero) with the Blackman filter.
8095%
8096%  The format of the MagickResizeImage method is:
8097%
8098%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8099%        const size_t columns,const size_t rows,
8100%        const FilterTypes filter,const double blur)
8101%
8102%  A description of each parameter follows:
8103%
8104%    o wand: the magick wand.
8105%
8106%    o columns: the number of columns in the scaled image.
8107%
8108%    o rows: the number of rows in the scaled image.
8109%
8110%    o filter: Image filter to use.
8111%
8112%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8113%
8114*/
8115WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8116  const size_t columns,const size_t rows,const FilterTypes filter,
8117  const double blur)
8118{
8119  Image
8120    *resize_image;
8121
8122  assert(wand != (MagickWand *) NULL);
8123  assert(wand->signature == WandSignature);
8124  if (wand->debug != MagickFalse)
8125    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8126  if (wand->images == (Image *) NULL)
8127    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8128  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8129    wand->exception);
8130  if (resize_image == (Image *) NULL)
8131    return(MagickFalse);
8132  ReplaceImageInList(&wand->images,resize_image);
8133  return(MagickTrue);
8134}
8135
8136/*
8137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8138%                                                                             %
8139%                                                                             %
8140%                                                                             %
8141%   M a g i c k R o l l I m a g e                                             %
8142%                                                                             %
8143%                                                                             %
8144%                                                                             %
8145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8146%
8147%  MagickRollImage() offsets an image as defined by x and y.
8148%
8149%  The format of the MagickRollImage method is:
8150%
8151%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8152%        const size_t y)
8153%
8154%  A description of each parameter follows:
8155%
8156%    o wand: the magick wand.
8157%
8158%    o x: the x offset.
8159%
8160%    o y: the y offset.
8161%
8162%
8163*/
8164WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8165  const ssize_t x,const ssize_t y)
8166{
8167  Image
8168    *roll_image;
8169
8170  assert(wand != (MagickWand *) NULL);
8171  assert(wand->signature == WandSignature);
8172  if (wand->debug != MagickFalse)
8173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8174  if (wand->images == (Image *) NULL)
8175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8176  roll_image=RollImage(wand->images,x,y,wand->exception);
8177  if (roll_image == (Image *) NULL)
8178    return(MagickFalse);
8179  ReplaceImageInList(&wand->images,roll_image);
8180  return(MagickTrue);
8181}
8182
8183/*
8184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185%                                                                             %
8186%                                                                             %
8187%                                                                             %
8188%   M a g i c k R o t a t e I m a g e                                         %
8189%                                                                             %
8190%                                                                             %
8191%                                                                             %
8192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8193%
8194%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8195%  triangles left over from rotating the image are filled with the
8196%  background color.
8197%
8198%  The format of the MagickRotateImage method is:
8199%
8200%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8201%        const PixelWand *background,const double degrees)
8202%
8203%  A description of each parameter follows:
8204%
8205%    o wand: the magick wand.
8206%
8207%    o background: the background pixel wand.
8208%
8209%    o degrees: the number of degrees to rotate the image.
8210%
8211%
8212*/
8213WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8214  const PixelWand *background,const double degrees)
8215{
8216  Image
8217    *rotate_image;
8218
8219  assert(wand != (MagickWand *) NULL);
8220  assert(wand->signature == WandSignature);
8221  if (wand->debug != MagickFalse)
8222    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8223  if (wand->images == (Image *) NULL)
8224    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8225  PixelGetQuantumPacket(background,&wand->images->background_color);
8226  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8227  if (rotate_image == (Image *) NULL)
8228    return(MagickFalse);
8229  ReplaceImageInList(&wand->images,rotate_image);
8230  return(MagickTrue);
8231}
8232
8233/*
8234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8235%                                                                             %
8236%                                                                             %
8237%                                                                             %
8238%   M a g i c k S a m p l e I m a g e                                         %
8239%                                                                             %
8240%                                                                             %
8241%                                                                             %
8242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8243%
8244%  MagickSampleImage() scales an image to the desired dimensions with pixel
8245%  sampling.  Unlike other scaling methods, this method does not introduce
8246%  any additional color into the scaled image.
8247%
8248%  The format of the MagickSampleImage method is:
8249%
8250%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8251%        const size_t columns,const size_t rows)
8252%
8253%  A description of each parameter follows:
8254%
8255%    o wand: the magick wand.
8256%
8257%    o columns: the number of columns in the scaled image.
8258%
8259%    o rows: the number of rows in the scaled image.
8260%
8261%
8262*/
8263WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8264  const size_t columns,const size_t rows)
8265{
8266  Image
8267    *sample_image;
8268
8269  assert(wand != (MagickWand *) NULL);
8270  assert(wand->signature == WandSignature);
8271  if (wand->debug != MagickFalse)
8272    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8273  if (wand->images == (Image *) NULL)
8274    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8275  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8276  if (sample_image == (Image *) NULL)
8277    return(MagickFalse);
8278  ReplaceImageInList(&wand->images,sample_image);
8279  return(MagickTrue);
8280}
8281
8282/*
8283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8284%                                                                             %
8285%                                                                             %
8286%                                                                             %
8287%   M a g i c k S c a l e I m a g e                                           %
8288%                                                                             %
8289%                                                                             %
8290%                                                                             %
8291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8292%
8293%  MagickScaleImage() scales the size of an image to the given dimensions.
8294%
8295%  The format of the MagickScaleImage method is:
8296%
8297%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8298%        const size_t columns,const size_t rows)
8299%
8300%  A description of each parameter follows:
8301%
8302%    o wand: the magick wand.
8303%
8304%    o columns: the number of columns in the scaled image.
8305%
8306%    o rows: the number of rows in the scaled image.
8307%
8308%
8309*/
8310WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8311  const size_t columns,const size_t rows)
8312{
8313  Image
8314    *scale_image;
8315
8316  assert(wand != (MagickWand *) NULL);
8317  assert(wand->signature == WandSignature);
8318  if (wand->debug != MagickFalse)
8319    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8320  if (wand->images == (Image *) NULL)
8321    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8322  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8323  if (scale_image == (Image *) NULL)
8324    return(MagickFalse);
8325  ReplaceImageInList(&wand->images,scale_image);
8326  return(MagickTrue);
8327}
8328
8329/*
8330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8331%                                                                             %
8332%                                                                             %
8333%                                                                             %
8334%   M a g i c k S e g m e n t I m a g e                                       %
8335%                                                                             %
8336%                                                                             %
8337%                                                                             %
8338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8339%
8340%  MagickSegmentImage() segments an image by analyzing the histograms of the
8341%  color components and identifying units that are homogeneous with the fuzzy
8342%  C-means technique.
8343%
8344%  The format of the SegmentImage method is:
8345%
8346%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8347%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8348%        const double cluster_threshold,const double smooth_threshold)
8349%
8350%  A description of each parameter follows.
8351%
8352%    o wand: the wand.
8353%
8354%    o colorspace: the image colorspace.
8355%
8356%    o verbose:  Set to MagickTrue to print detailed information about the
8357%      identified classes.
8358%
8359%    o cluster_threshold:  This represents the minimum number of pixels
8360%      contained in a hexahedra before it can be considered valid (expressed as
8361%      a percentage).
8362%
8363%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8364%      derivative of the histogram.  As the value is increased, you can expect a
8365%      smoother second derivative.
8366%
8367*/
8368MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8369  const ColorspaceType colorspace,const MagickBooleanType verbose,
8370  const double cluster_threshold,const double smooth_threshold)
8371{
8372  MagickBooleanType
8373    status;
8374
8375  assert(wand != (MagickWand *) NULL);
8376  assert(wand->signature == WandSignature);
8377  if (wand->debug != MagickFalse)
8378    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8379  if (wand->images == (Image *) NULL)
8380    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8381  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8382    smooth_threshold);
8383  if (status == MagickFalse)
8384    InheritException(wand->exception,&wand->images->exception);
8385  return(status);
8386}
8387
8388/*
8389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8390%                                                                             %
8391%                                                                             %
8392%                                                                             %
8393%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8394%                                                                             %
8395%                                                                             %
8396%                                                                             %
8397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8398%
8399%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8400%  threshold. It is similar to the unsharpen mask that sharpens everything with
8401%  contrast above a certain threshold.
8402%
8403%  The format of the MagickSelectiveBlurImage method is:
8404%
8405%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8406%        const double radius,const double sigma,const double threshold)
8407%
8408%  A description of each parameter follows:
8409%
8410%    o wand: the magick wand.
8411%
8412%    o radius: the radius of the gaussian, in pixels, not counting the center
8413%      pixel.
8414%
8415%    o sigma: the standard deviation of the gaussian, in pixels.
8416%
8417%    o threshold: only pixels within this contrast threshold are included
8418%      in the blur operation.
8419%
8420*/
8421WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8422  const double radius,const double sigma,const double threshold)
8423{
8424  Image
8425    *blur_image;
8426
8427  assert(wand != (MagickWand *) NULL);
8428  assert(wand->signature == WandSignature);
8429  if (wand->debug != MagickFalse)
8430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8431  if (wand->images == (Image *) NULL)
8432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8433  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8434    wand->exception);
8435  if (blur_image == (Image *) NULL)
8436    return(MagickFalse);
8437  ReplaceImageInList(&wand->images,blur_image);
8438  return(MagickTrue);
8439}
8440
8441/*
8442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8443%                                                                             %
8444%                                                                             %
8445%                                                                             %
8446%   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                       %
8447%                                                                             %
8448%                                                                             %
8449%                                                                             %
8450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8451%
8452%  MagickSeparateImage() separates a channel from the image and returns a
8453%  grayscale image.  A channel is a particular color component of each pixel
8454%  in the image.
8455%
8456%  The format of the MagickSeparateImage method is:
8457%
8458%      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8459%
8460%  A description of each parameter follows:
8461%
8462%    o wand: the magick wand.
8463%
8464*/
8465WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8466{
8467  MagickBooleanType
8468    status;
8469
8470  assert(wand != (MagickWand *) NULL);
8471  assert(wand->signature == WandSignature);
8472  if (wand->debug != MagickFalse)
8473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8474  if (wand->images == (Image *) NULL)
8475    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8476  status=SeparateImage(wand->images);
8477  if (status == MagickFalse)
8478    InheritException(wand->exception,&wand->images->exception);
8479  return(status);
8480}
8481
8482/*
8483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8484%                                                                             %
8485%                                                                             %
8486%                                                                             %
8487%     M a g i c k S e p i a T o n e I m a g e                                 %
8488%                                                                             %
8489%                                                                             %
8490%                                                                             %
8491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8492%
8493%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8494%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8495%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8496%  threshold of 80% is a good starting point for a reasonable tone.
8497%
8498%  The format of the MagickSepiaToneImage method is:
8499%
8500%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8501%        const double threshold)
8502%
8503%  A description of each parameter follows:
8504%
8505%    o wand: the magick wand.
8506%
8507%    o threshold:  Define the extent of the sepia toning.
8508%
8509*/
8510WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8511  const double threshold)
8512{
8513  Image
8514    *sepia_image;
8515
8516  assert(wand != (MagickWand *) NULL);
8517  assert(wand->signature == WandSignature);
8518  if (wand->debug != MagickFalse)
8519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8520  if (wand->images == (Image *) NULL)
8521    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8522  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8523  if (sepia_image == (Image *) NULL)
8524    return(MagickFalse);
8525  ReplaceImageInList(&wand->images,sepia_image);
8526  return(MagickTrue);
8527}
8528
8529/*
8530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8531%                                                                             %
8532%                                                                             %
8533%                                                                             %
8534%   M a g i c k S e t I m a g e                                               %
8535%                                                                             %
8536%                                                                             %
8537%                                                                             %
8538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8539%
8540%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8541%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8542%  wand.
8543%
8544%  The format of the MagickSetImage method is:
8545%
8546%      MagickBooleanType MagickSetImage(MagickWand *wand,
8547%        const MagickWand *set_wand)
8548%
8549%  A description of each parameter follows:
8550%
8551%    o wand: the magick wand.
8552%
8553%    o set_wand: the set_wand wand.
8554%
8555*/
8556WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8557  const MagickWand *set_wand)
8558{
8559  Image
8560    *images;
8561
8562  assert(wand != (MagickWand *) NULL);
8563  assert(wand->signature == WandSignature);
8564  if (wand->debug != MagickFalse)
8565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8566  assert(set_wand != (MagickWand *) NULL);
8567  assert(set_wand->signature == WandSignature);
8568  if (wand->debug != MagickFalse)
8569    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8570  if (set_wand->images == (Image *) NULL)
8571    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8572  images=CloneImageList(set_wand->images,wand->exception);
8573  if (images == (Image *) NULL)
8574    return(MagickFalse);
8575  ReplaceImageInList(&wand->images,images);
8576  return(MagickTrue);
8577}
8578
8579/*
8580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8581%                                                                             %
8582%                                                                             %
8583%                                                                             %
8584%   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                       %
8585%                                                                             %
8586%                                                                             %
8587%                                                                             %
8588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8589%
8590%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8591%  alpha channel.
8592%
8593%  The format of the MagickSetImageAlphaChannel method is:
8594%
8595%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8596%        const AlphaChannelType alpha_type)
8597%
8598%  A description of each parameter follows:
8599%
8600%    o wand: the magick wand.
8601%
8602%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8603%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8604%
8605*/
8606WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8607  const AlphaChannelType alpha_type)
8608{
8609  assert(wand != (MagickWand *) NULL);
8610  assert(wand->signature == WandSignature);
8611  if (wand->debug != MagickFalse)
8612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8613  if (wand->images == (Image *) NULL)
8614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8615  return(SetImageAlphaChannel(wand->images,alpha_type));
8616}
8617
8618/*
8619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8620%                                                                             %
8621%                                                                             %
8622%                                                                             %
8623%   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                 %
8624%                                                                             %
8625%                                                                             %
8626%                                                                             %
8627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8628%
8629%  MagickSetImageBackgroundColor() sets the image background color.
8630%
8631%  The format of the MagickSetImageBackgroundColor method is:
8632%
8633%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8634%        const PixelWand *background)
8635%
8636%  A description of each parameter follows:
8637%
8638%    o wand: the magick wand.
8639%
8640%    o background: the background pixel wand.
8641%
8642*/
8643WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8644  const PixelWand *background)
8645{
8646  assert(wand != (MagickWand *) NULL);
8647  assert(wand->signature == WandSignature);
8648  if (wand->debug != MagickFalse)
8649    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8650  if (wand->images == (Image *) NULL)
8651    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8652  PixelGetQuantumPacket(background,&wand->images->background_color);
8653  return(MagickTrue);
8654}
8655
8656/*
8657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658%                                                                             %
8659%                                                                             %
8660%                                                                             %
8661%   M a g i c k S e t I m a g e B i a s                                       %
8662%                                                                             %
8663%                                                                             %
8664%                                                                             %
8665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8666%
8667%  MagickSetImageBias() sets the image bias for any method that convolves an
8668%  image (e.g. MagickConvolveImage()).
8669%
8670%  The format of the MagickSetImageBias method is:
8671%
8672%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8673%        const double bias)
8674%
8675%  A description of each parameter follows:
8676%
8677%    o wand: the magick wand.
8678%
8679%    o bias: the image bias.
8680%
8681*/
8682WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8683  const double bias)
8684{
8685  assert(wand != (MagickWand *) NULL);
8686  assert(wand->signature == WandSignature);
8687  if (wand->debug != MagickFalse)
8688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8689  if (wand->images == (Image *) NULL)
8690    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8691  wand->images->bias=bias;
8692  return(MagickTrue);
8693}
8694
8695/*
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%                                                                             %
8698%                                                                             %
8699%                                                                             %
8700%   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                         %
8701%                                                                             %
8702%                                                                             %
8703%                                                                             %
8704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8705%
8706%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8707%
8708%  The format of the MagickSetImageBluePrimary method is:
8709%
8710%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8711%        const double x,const double y)
8712%
8713%  A description of each parameter follows:
8714%
8715%    o wand: the magick wand.
8716%
8717%    o x: the blue primary x-point.
8718%
8719%    o y: the blue primary y-point.
8720%
8721*/
8722WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8723  const double x,const double y)
8724{
8725  assert(wand != (MagickWand *) NULL);
8726  assert(wand->signature == WandSignature);
8727  if (wand->debug != MagickFalse)
8728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8729  if (wand->images == (Image *) NULL)
8730    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8731  wand->images->chromaticity.blue_primary.x=x;
8732  wand->images->chromaticity.blue_primary.y=y;
8733  return(MagickTrue);
8734}
8735
8736/*
8737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8738%                                                                             %
8739%                                                                             %
8740%                                                                             %
8741%   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                         %
8742%                                                                             %
8743%                                                                             %
8744%                                                                             %
8745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8746%
8747%  MagickSetImageBorderColor() sets the image border color.
8748%
8749%  The format of the MagickSetImageBorderColor method is:
8750%
8751%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8752%        const PixelWand *border)
8753%
8754%  A description of each parameter follows:
8755%
8756%    o wand: the magick wand.
8757%
8758%    o border: the border pixel wand.
8759%
8760*/
8761WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8762  const PixelWand *border)
8763{
8764  assert(wand != (MagickWand *) NULL);
8765  assert(wand->signature == WandSignature);
8766  if (wand->debug != MagickFalse)
8767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8768  if (wand->images == (Image *) NULL)
8769    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8770  PixelGetQuantumPacket(border,&wand->images->border_color);
8771  return(MagickTrue);
8772}
8773
8774/*
8775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8776%                                                                             %
8777%                                                                             %
8778%                                                                             %
8779%   M a g i c k S e t I m a g e C l i p M a s k                               %
8780%                                                                             %
8781%                                                                             %
8782%                                                                             %
8783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8784%
8785%  MagickSetImageClipMask() sets image clip mask.
8786%
8787%  The format of the MagickSetImageClipMask method is:
8788%
8789%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8790%        const MagickWand *clip_mask)
8791%
8792%  A description of each parameter follows:
8793%
8794%    o wand: the magick wand.
8795%
8796%    o clip_mask: the clip_mask wand.
8797%
8798*/
8799WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8800  const MagickWand *clip_mask)
8801{
8802  assert(wand != (MagickWand *) NULL);
8803  assert(wand->signature == WandSignature);
8804  if (wand->debug != MagickFalse)
8805    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8806  assert(clip_mask != (MagickWand *) NULL);
8807  assert(clip_mask->signature == WandSignature);
8808  if (wand->debug != MagickFalse)
8809    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8810  if (clip_mask->images == (Image *) NULL)
8811    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8812  return(SetImageClipMask(wand->images,clip_mask->images));
8813}
8814
8815/*
8816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8817%                                                                             %
8818%                                                                             %
8819%                                                                             %
8820%   M a g i c k S e t I m a g e C o l o r                                     %
8821%                                                                             %
8822%                                                                             %
8823%                                                                             %
8824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8825%
8826%  MagickSetImageColor() set the entire wand canvas to the specified color.
8827%
8828%  The format of the MagickSetImageColor method is:
8829%
8830%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8831%        const PixelWand *color)
8832%
8833%  A description of each parameter follows:
8834%
8835%    o wand: the magick wand.
8836%
8837%    o background: the image color.
8838%
8839*/
8840WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8841  const PixelWand *color)
8842{
8843  MagickBooleanType
8844    status;
8845
8846  PixelInfo
8847    pixel;
8848
8849  assert(wand != (MagickWand *) NULL);
8850  assert(wand->signature == WandSignature);
8851  if (wand->debug != MagickFalse)
8852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8853  PixelGetMagickColor(color,&pixel);
8854  status=SetImageColor(wand->images,&pixel);
8855  if (status == MagickFalse)
8856    InheritException(wand->exception,&wand->images->exception);
8857  return(status);
8858}
8859
8860/*
8861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8862%                                                                             %
8863%                                                                             %
8864%                                                                             %
8865%   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                     %
8866%                                                                             %
8867%                                                                             %
8868%                                                                             %
8869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8870%
8871%  MagickSetImageColormapColor() sets the color of the specified colormap
8872%  index.
8873%
8874%  The format of the MagickSetImageColormapColor method is:
8875%
8876%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8877%        const size_t index,const PixelWand *color)
8878%
8879%  A description of each parameter follows:
8880%
8881%    o wand: the magick wand.
8882%
8883%    o index: the offset into the image colormap.
8884%
8885%    o color: Return the colormap color in this wand.
8886%
8887*/
8888WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8889  const size_t index,const PixelWand *color)
8890{
8891  assert(wand != (MagickWand *) NULL);
8892  assert(wand->signature == WandSignature);
8893  if (wand->debug != MagickFalse)
8894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8895  if (wand->images == (Image *) NULL)
8896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8897  if ((wand->images->colormap == (PixelPacket *) NULL) ||
8898      (index >= wand->images->colors))
8899    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8900  PixelGetQuantumPacket(color,wand->images->colormap+index);
8901  return(SyncImage(wand->images));
8902}
8903
8904/*
8905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8906%                                                                             %
8907%                                                                             %
8908%                                                                             %
8909%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8910%                                                                             %
8911%                                                                             %
8912%                                                                             %
8913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8914%
8915%  MagickSetImageColorspace() sets the image colorspace.
8916%
8917%  The format of the MagickSetImageColorspace method is:
8918%
8919%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8920%        const ColorspaceType colorspace)
8921%
8922%  A description of each parameter follows:
8923%
8924%    o wand: the magick wand.
8925%
8926%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8927%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8928%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8929%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8930%      HSLColorspace, or HWBColorspace.
8931%
8932*/
8933WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8934  const ColorspaceType colorspace)
8935{
8936  assert(wand != (MagickWand *) NULL);
8937  assert(wand->signature == WandSignature);
8938  if (wand->debug != MagickFalse)
8939    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8940  if (wand->images == (Image *) NULL)
8941    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8942  return(SetImageColorspace(wand->images,colorspace));
8943}
8944
8945/*
8946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8947%                                                                             %
8948%                                                                             %
8949%                                                                             %
8950%   M a g i c k S e t I m a g e C o m p o s e                                 %
8951%                                                                             %
8952%                                                                             %
8953%                                                                             %
8954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8955%
8956%  MagickSetImageCompose() sets the image composite operator, useful for
8957%  specifying how to composite the image thumbnail when using the
8958%  MagickMontageImage() method.
8959%
8960%  The format of the MagickSetImageCompose method is:
8961%
8962%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8963%        const CompositeOperator compose)
8964%
8965%  A description of each parameter follows:
8966%
8967%    o wand: the magick wand.
8968%
8969%    o compose: the image composite operator.
8970%
8971*/
8972WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8973  const CompositeOperator compose)
8974{
8975  assert(wand != (MagickWand *) NULL);
8976  assert(wand->signature == WandSignature);
8977  if (wand->debug != MagickFalse)
8978    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8979  if (wand->images == (Image *) NULL)
8980    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8981  wand->images->compose=compose;
8982  return(MagickTrue);
8983}
8984
8985/*
8986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8987%                                                                             %
8988%                                                                             %
8989%                                                                             %
8990%   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                         %
8991%                                                                             %
8992%                                                                             %
8993%                                                                             %
8994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8995%
8996%  MagickSetImageCompression() sets the image compression.
8997%
8998%  The format of the MagickSetImageCompression method is:
8999%
9000%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9001%        const CompressionType compression)
9002%
9003%  A description of each parameter follows:
9004%
9005%    o wand: the magick wand.
9006%
9007%    o compression: the image compression type.
9008%
9009*/
9010WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9011  const CompressionType compression)
9012{
9013  assert(wand != (MagickWand *) NULL);
9014  assert(wand->signature == WandSignature);
9015  if (wand->debug != MagickFalse)
9016    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9017  if (wand->images == (Image *) NULL)
9018    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9019  wand->images->compression=compression;
9020  return(MagickTrue);
9021}
9022
9023/*
9024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9025%                                                                             %
9026%                                                                             %
9027%                                                                             %
9028%   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           %
9029%                                                                             %
9030%                                                                             %
9031%                                                                             %
9032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9033%
9034%  MagickSetImageCompressionQuality() sets the image compression quality.
9035%
9036%  The format of the MagickSetImageCompressionQuality method is:
9037%
9038%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9039%        const size_t quality)
9040%
9041%  A description of each parameter follows:
9042%
9043%    o wand: the magick wand.
9044%
9045%    o quality: the image compression tlityype.
9046%
9047*/
9048WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9049  const size_t quality)
9050{
9051  assert(wand != (MagickWand *) NULL);
9052  assert(wand->signature == WandSignature);
9053  if (wand->debug != MagickFalse)
9054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9055  if (wand->images == (Image *) NULL)
9056    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9057  wand->images->quality=quality;
9058  return(MagickTrue);
9059}
9060
9061/*
9062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063%                                                                             %
9064%                                                                             %
9065%                                                                             %
9066%   M a g i c k S e t I m a g e D e l a y                                     %
9067%                                                                             %
9068%                                                                             %
9069%                                                                             %
9070%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9071%
9072%  MagickSetImageDelay() sets the image delay.
9073%
9074%  The format of the MagickSetImageDelay method is:
9075%
9076%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9077%        const size_t delay)
9078%
9079%  A description of each parameter follows:
9080%
9081%    o wand: the magick wand.
9082%
9083%    o delay: the image delay in ticks-per-second units.
9084%
9085*/
9086WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9087  const size_t delay)
9088{
9089  assert(wand != (MagickWand *) NULL);
9090  assert(wand->signature == WandSignature);
9091  if (wand->debug != MagickFalse)
9092    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9093  if (wand->images == (Image *) NULL)
9094    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9095  wand->images->delay=delay;
9096  return(MagickTrue);
9097}
9098
9099/*
9100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9101%                                                                             %
9102%                                                                             %
9103%                                                                             %
9104%   M a g i c k S e t I m a g e D e p t h                                     %
9105%                                                                             %
9106%                                                                             %
9107%                                                                             %
9108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9109%
9110%  MagickSetImageDepth() sets the image depth.
9111%
9112%  The format of the MagickSetImageDepth method is:
9113%
9114%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9115%        const size_t depth)
9116%
9117%  A description of each parameter follows:
9118%
9119%    o wand: the magick wand.
9120%
9121%    o depth: the image depth in bits: 8, 16, or 32.
9122%
9123*/
9124WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9125  const size_t depth)
9126{
9127  assert(wand != (MagickWand *) NULL);
9128  assert(wand->signature == WandSignature);
9129  if (wand->debug != MagickFalse)
9130    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9131  if (wand->images == (Image *) NULL)
9132    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9133  return(SetImageDepth(wand->images,depth));
9134}
9135
9136/*
9137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9138%                                                                             %
9139%                                                                             %
9140%                                                                             %
9141%   M a g i c k S e t I m a g e D i s p o s e                                 %
9142%                                                                             %
9143%                                                                             %
9144%                                                                             %
9145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9146%
9147%  MagickSetImageDispose() sets the image disposal method.
9148%
9149%  The format of the MagickSetImageDispose method is:
9150%
9151%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9152%        const DisposeType dispose)
9153%
9154%  A description of each parameter follows:
9155%
9156%    o wand: the magick wand.
9157%
9158%    o dispose: the image disposeal type.
9159%
9160*/
9161WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9162  const DisposeType dispose)
9163{
9164  assert(wand != (MagickWand *) NULL);
9165  assert(wand->signature == WandSignature);
9166  if (wand->debug != MagickFalse)
9167    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9168  if (wand->images == (Image *) NULL)
9169    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9170  wand->images->dispose=dispose;
9171  return(MagickTrue);
9172}
9173
9174/*
9175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9176%                                                                             %
9177%                                                                             %
9178%                                                                             %
9179%   M a g i c k S e t I m a g e E x t e n t                                   %
9180%                                                                             %
9181%                                                                             %
9182%                                                                             %
9183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9184%
9185%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9186%
9187%  The format of the MagickSetImageExtent method is:
9188%
9189%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9190%        const size_t columns,const unsigned rows)
9191%
9192%  A description of each parameter follows:
9193%
9194%    o wand: the magick wand.
9195%
9196%    o columns:  The image width in pixels.
9197%
9198%    o rows:  The image height in pixels.
9199%
9200*/
9201WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9202  const size_t columns,const size_t rows)
9203{
9204  assert(wand != (MagickWand *) NULL);
9205  assert(wand->signature == WandSignature);
9206  if (wand->debug != MagickFalse)
9207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9208  if (wand->images == (Image *) NULL)
9209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9210  return(SetImageExtent(wand->images,columns,rows));
9211}
9212
9213/*
9214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9215%                                                                             %
9216%                                                                             %
9217%                                                                             %
9218%   M a g i c k S e t I m a g e F i l e n a m e                               %
9219%                                                                             %
9220%                                                                             %
9221%                                                                             %
9222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9223%
9224%  MagickSetImageFilename() sets the filename of a particular image in a
9225%  sequence.
9226%
9227%  The format of the MagickSetImageFilename method is:
9228%
9229%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9230%        const char *filename)
9231%
9232%  A description of each parameter follows:
9233%
9234%    o wand: the magick wand.
9235%
9236%    o filename: the image filename.
9237%
9238*/
9239WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9240  const char *filename)
9241{
9242  assert(wand != (MagickWand *) NULL);
9243  assert(wand->signature == WandSignature);
9244  if (wand->debug != MagickFalse)
9245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9246  if (wand->images == (Image *) NULL)
9247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9248  if (filename != (const char *) NULL)
9249    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9250  return(MagickTrue);
9251}
9252
9253/*
9254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9255%                                                                             %
9256%                                                                             %
9257%                                                                             %
9258%   M a g i c k S e t I m a g e F o r m a t                                   %
9259%                                                                             %
9260%                                                                             %
9261%                                                                             %
9262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9263%
9264%  MagickSetImageFormat() sets the format of a particular image in a
9265%  sequence.
9266%
9267%  The format of the MagickSetImageFormat method is:
9268%
9269%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9270%        const char *format)
9271%
9272%  A description of each parameter follows:
9273%
9274%    o wand: the magick wand.
9275%
9276%    o format: the image format.
9277%
9278*/
9279WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9280  const char *format)
9281{
9282  const MagickInfo
9283    *magick_info;
9284
9285  assert(wand != (MagickWand *) NULL);
9286  assert(wand->signature == WandSignature);
9287  if (wand->debug != MagickFalse)
9288    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9289  if (wand->images == (Image *) NULL)
9290    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9291  if ((format == (char *) NULL) || (*format == '\0'))
9292    {
9293      *wand->images->magick='\0';
9294      return(MagickTrue);
9295    }
9296  magick_info=GetMagickInfo(format,wand->exception);
9297  if (magick_info == (const MagickInfo *) NULL)
9298    return(MagickFalse);
9299  ClearMagickException(wand->exception);
9300  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9301  return(MagickTrue);
9302}
9303
9304/*
9305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9306%                                                                             %
9307%                                                                             %
9308%                                                                             %
9309%   M a g i c k S e t I m a g e F u z z                                       %
9310%                                                                             %
9311%                                                                             %
9312%                                                                             %
9313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9314%
9315%  MagickSetImageFuzz() sets the image fuzz.
9316%
9317%  The format of the MagickSetImageFuzz method is:
9318%
9319%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9320%        const double fuzz)
9321%
9322%  A description of each parameter follows:
9323%
9324%    o wand: the magick wand.
9325%
9326%    o fuzz: the image fuzz.
9327%
9328*/
9329WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9330  const double fuzz)
9331{
9332  assert(wand != (MagickWand *) NULL);
9333  assert(wand->signature == WandSignature);
9334  if (wand->debug != MagickFalse)
9335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9336  if (wand->images == (Image *) NULL)
9337    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9338  wand->images->fuzz=fuzz;
9339  return(MagickTrue);
9340}
9341
9342/*
9343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9344%                                                                             %
9345%                                                                             %
9346%                                                                             %
9347%   M a g i c k S e t I m a g e G a m m a                                     %
9348%                                                                             %
9349%                                                                             %
9350%                                                                             %
9351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9352%
9353%  MagickSetImageGamma() sets the image gamma.
9354%
9355%  The format of the MagickSetImageGamma method is:
9356%
9357%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9358%        const double gamma)
9359%
9360%  A description of each parameter follows:
9361%
9362%    o wand: the magick wand.
9363%
9364%    o gamma: the image gamma.
9365%
9366*/
9367WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9368  const double gamma)
9369{
9370  assert(wand != (MagickWand *) NULL);
9371  assert(wand->signature == WandSignature);
9372  if (wand->debug != MagickFalse)
9373    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9374  if (wand->images == (Image *) NULL)
9375    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9376  wand->images->gamma=gamma;
9377  return(MagickTrue);
9378}
9379
9380/*
9381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9382%                                                                             %
9383%                                                                             %
9384%                                                                             %
9385%   M a g i c k S e t I m a g e G r a v i t y                                 %
9386%                                                                             %
9387%                                                                             %
9388%                                                                             %
9389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9390%
9391%  MagickSetImageGravity() sets the image gravity type.
9392%
9393%  The format of the MagickSetImageGravity method is:
9394%
9395%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9396%        const GravityType gravity)
9397%
9398%  A description of each parameter follows:
9399%
9400%    o wand: the magick wand.
9401%
9402%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9403%      PlaneInterlace, PartitionInterlace.
9404%
9405*/
9406WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9407  const GravityType gravity)
9408{
9409  assert(wand != (MagickWand *) NULL);
9410  assert(wand->signature == WandSignature);
9411  if (wand->debug != MagickFalse)
9412    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9413  if (wand->images == (Image *) NULL)
9414    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9415  wand->images->gravity=gravity;
9416  return(MagickTrue);
9417}
9418
9419/*
9420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9421%                                                                             %
9422%                                                                             %
9423%                                                                             %
9424%   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                       %
9425%                                                                             %
9426%                                                                             %
9427%                                                                             %
9428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9429%
9430%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9431%  point.
9432%
9433%  The format of the MagickSetImageGreenPrimary method is:
9434%
9435%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9436%        const double x,const double y)
9437%
9438%  A description of each parameter follows:
9439%
9440%    o wand: the magick wand.
9441%
9442%    o x: the green primary x-point.
9443%
9444%    o y: the green primary y-point.
9445%
9446%
9447*/
9448WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9449  const double x,const double y)
9450{
9451  assert(wand != (MagickWand *) NULL);
9452  assert(wand->signature == WandSignature);
9453  if (wand->debug != MagickFalse)
9454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9455  if (wand->images == (Image *) NULL)
9456    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9457  wand->images->chromaticity.green_primary.x=x;
9458  wand->images->chromaticity.green_primary.y=y;
9459  return(MagickTrue);
9460}
9461
9462/*
9463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464%                                                                             %
9465%                                                                             %
9466%                                                                             %
9467%   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                 %
9468%                                                                             %
9469%                                                                             %
9470%                                                                             %
9471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9472%
9473%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9474%
9475%  The format of the MagickSetImageInterlaceScheme method is:
9476%
9477%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9478%        const InterlaceType interlace)
9479%
9480%  A description of each parameter follows:
9481%
9482%    o wand: the magick wand.
9483%
9484%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9485%      PlaneInterlace, PartitionInterlace.
9486%
9487*/
9488WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9489  const InterlaceType interlace)
9490{
9491  assert(wand != (MagickWand *) NULL);
9492  assert(wand->signature == WandSignature);
9493  if (wand->debug != MagickFalse)
9494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9495  if (wand->images == (Image *) NULL)
9496    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9497  wand->images->interlace=interlace;
9498  return(MagickTrue);
9499}
9500
9501/*
9502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503%                                                                             %
9504%                                                                             %
9505%                                                                             %
9506%   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             %
9507%                                                                             %
9508%                                                                             %
9509%                                                                             %
9510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9511%
9512%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9513%
9514%  The format of the MagickSetImageInterpolateMethod method is:
9515%
9516%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9517%        const InterpolatePixelMethod method)
9518%
9519%  A description of each parameter follows:
9520%
9521%    o wand: the magick wand.
9522%
9523%    o method: the image interpole pixel methods: choose from Undefined,
9524%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9525%
9526*/
9527WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9528  const InterpolatePixelMethod method)
9529{
9530  assert(wand != (MagickWand *) NULL);
9531  assert(wand->signature == WandSignature);
9532  if (wand->debug != MagickFalse)
9533    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9534  if (wand->images == (Image *) NULL)
9535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9536  wand->images->interpolate=method;
9537  return(MagickTrue);
9538}
9539
9540/*
9541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9542%                                                                             %
9543%                                                                             %
9544%                                                                             %
9545%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9546%                                                                             %
9547%                                                                             %
9548%                                                                             %
9549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9550%
9551%  MagickSetImageIterations() sets the image iterations.
9552%
9553%  The format of the MagickSetImageIterations method is:
9554%
9555%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9556%        const size_t iterations)
9557%
9558%  A description of each parameter follows:
9559%
9560%    o wand: the magick wand.
9561%
9562%    o delay: the image delay in 1/100th of a second.
9563%
9564*/
9565WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9566  const size_t iterations)
9567{
9568  assert(wand != (MagickWand *) NULL);
9569  assert(wand->signature == WandSignature);
9570  if (wand->debug != MagickFalse)
9571    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9572  if (wand->images == (Image *) NULL)
9573    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9574  wand->images->iterations=iterations;
9575  return(MagickTrue);
9576}
9577
9578/*
9579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580%                                                                             %
9581%                                                                             %
9582%                                                                             %
9583%   M a g i c k S e t I m a g e M a t t e                                     %
9584%                                                                             %
9585%                                                                             %
9586%                                                                             %
9587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9588%
9589%  MagickSetImageMatte() sets the image matte channel.
9590%
9591%  The format of the MagickSetImageMatteColor method is:
9592%
9593%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9594%        const MagickBooleanType *matte)
9595%
9596%  A description of each parameter follows:
9597%
9598%    o wand: the magick wand.
9599%
9600%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9601%      MagickFalse.
9602%
9603*/
9604WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9605  const MagickBooleanType matte)
9606{
9607  assert(wand != (MagickWand *) NULL);
9608  assert(wand->signature == WandSignature);
9609  if (wand->debug != MagickFalse)
9610    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9611  if (wand->images == (Image *) NULL)
9612    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9613  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9614    (void) SetImageOpacity(wand->images,OpaqueAlpha);
9615  wand->images->matte=matte;
9616  return(MagickTrue);
9617}
9618
9619/*
9620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9621%                                                                             %
9622%                                                                             %
9623%                                                                             %
9624%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9625%                                                                             %
9626%                                                                             %
9627%                                                                             %
9628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9629%
9630%  MagickSetImageMatteColor() sets the image matte color.
9631%
9632%  The format of the MagickSetImageMatteColor method is:
9633%
9634%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9635%        const PixelWand *matte)
9636%
9637%  A description of each parameter follows:
9638%
9639%    o wand: the magick wand.
9640%
9641%    o matte: the matte pixel wand.
9642%
9643*/
9644WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9645  const PixelWand *matte)
9646{
9647  assert(wand != (MagickWand *) NULL);
9648  assert(wand->signature == WandSignature);
9649  if (wand->debug != MagickFalse)
9650    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9651  if (wand->images == (Image *) NULL)
9652    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9653  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9654  return(MagickTrue);
9655}
9656
9657/*
9658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659%                                                                             %
9660%                                                                             %
9661%                                                                             %
9662%   M a g i c k S e t I m a g e O p a c i t y                                 %
9663%                                                                             %
9664%                                                                             %
9665%                                                                             %
9666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9667%
9668%  MagickSetImageOpacity() sets the image to the specified opacity level.
9669%
9670%  The format of the MagickSetImageOpacity method is:
9671%
9672%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9673%        const double alpha)
9674%
9675%  A description of each parameter follows:
9676%
9677%    o wand: the magick wand.
9678%
9679%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9680%      transparent.
9681%
9682*/
9683WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9684  const double alpha)
9685{
9686  MagickBooleanType
9687    status;
9688
9689  assert(wand != (MagickWand *) NULL);
9690  assert(wand->signature == WandSignature);
9691  if (wand->debug != MagickFalse)
9692    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9693  if (wand->images == (Image *) NULL)
9694    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9695  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9696  if (status == MagickFalse)
9697    InheritException(wand->exception,&wand->images->exception);
9698  return(status);
9699}
9700
9701/*
9702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9703%                                                                             %
9704%                                                                             %
9705%                                                                             %
9706%   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                         %
9707%                                                                             %
9708%                                                                             %
9709%                                                                             %
9710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9711%
9712%  MagickSetImageOrientation() sets the image orientation.
9713%
9714%  The format of the MagickSetImageOrientation method is:
9715%
9716%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9717%        const OrientationType orientation)
9718%
9719%  A description of each parameter follows:
9720%
9721%    o wand: the magick wand.
9722%
9723%    o orientation: the image orientation type.
9724%
9725*/
9726WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9727  const OrientationType orientation)
9728{
9729  assert(wand != (MagickWand *) NULL);
9730  assert(wand->signature == WandSignature);
9731  if (wand->debug != MagickFalse)
9732    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9733  if (wand->images == (Image *) NULL)
9734    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9735  wand->images->orientation=orientation;
9736  return(MagickTrue);
9737}
9738
9739/*
9740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9741%                                                                             %
9742%                                                                             %
9743%                                                                             %
9744%   M a g i c k S e t I m a g e P a g e                                       %
9745%                                                                             %
9746%                                                                             %
9747%                                                                             %
9748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9749%
9750%  MagickSetImagePage() sets the page geometry of the image.
9751%
9752%  The format of the MagickSetImagePage method is:
9753%
9754%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9755%        const size_t width,const size_t height,const ssize_t x,
9756%        const ssize_t y)
9757%
9758%  A description of each parameter follows:
9759%
9760%    o wand: the magick wand.
9761%
9762%    o width: the page width.
9763%
9764%    o height: the page height.
9765%
9766%    o x: the page x-offset.
9767%
9768%    o y: the page y-offset.
9769%
9770*/
9771WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9772  const size_t width,const size_t height,const ssize_t x,
9773  const ssize_t y)
9774{
9775  assert(wand != (MagickWand *) NULL);
9776  assert(wand->signature == WandSignature);
9777  if (wand->debug != MagickFalse)
9778    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9779  if (wand->images == (Image *) NULL)
9780    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9781  wand->images->page.width=width;
9782  wand->images->page.height=height;
9783  wand->images->page.x=x;
9784  wand->images->page.y=y;
9785  return(MagickTrue);
9786}
9787
9788/*
9789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9790%                                                                             %
9791%                                                                             %
9792%                                                                             %
9793%   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                 %
9794%                                                                             %
9795%                                                                             %
9796%                                                                             %
9797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9798%
9799%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9800%  specified method and returns the previous progress monitor if any.  The
9801%  progress monitor method looks like this:
9802%
9803%    MagickBooleanType MagickProgressMonitor(const char *text,
9804%      const MagickOffsetType offset,const MagickSizeType span,
9805%      void *client_data)
9806%
9807%  If the progress monitor returns MagickFalse, the current operation is
9808%  interrupted.
9809%
9810%  The format of the MagickSetImageProgressMonitor method is:
9811%
9812%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9813%        const MagickProgressMonitor progress_monitor,void *client_data)
9814%
9815%  A description of each parameter follows:
9816%
9817%    o wand: the magick wand.
9818%
9819%    o progress_monitor: Specifies a pointer to a method to monitor progress
9820%      of an image operation.
9821%
9822%    o client_data: Specifies a pointer to any client data.
9823%
9824*/
9825WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9826  const MagickProgressMonitor progress_monitor,void *client_data)
9827{
9828  MagickProgressMonitor
9829    previous_monitor;
9830
9831  assert(wand != (MagickWand *) NULL);
9832  assert(wand->signature == WandSignature);
9833  if (wand->debug != MagickFalse)
9834    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9835  if (wand->images == (Image *) NULL)
9836    {
9837      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9838        "ContainsNoImages","`%s'",wand->name);
9839      return((MagickProgressMonitor) NULL);
9840    }
9841  previous_monitor=SetImageProgressMonitor(wand->images,
9842    progress_monitor,client_data);
9843  return(previous_monitor);
9844}
9845
9846/*
9847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9848%                                                                             %
9849%                                                                             %
9850%                                                                             %
9851%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9852%                                                                             %
9853%                                                                             %
9854%                                                                             %
9855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9856%
9857%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9858%
9859%  The format of the MagickSetImageRedPrimary method is:
9860%
9861%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9862%        const double x,const double y)
9863%
9864%  A description of each parameter follows:
9865%
9866%    o wand: the magick wand.
9867%
9868%    o x: the red primary x-point.
9869%
9870%    o y: the red primary y-point.
9871%
9872*/
9873WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9874  const double x,const double y)
9875{
9876  assert(wand != (MagickWand *) NULL);
9877  assert(wand->signature == WandSignature);
9878  if (wand->debug != MagickFalse)
9879    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9880  if (wand->images == (Image *) NULL)
9881    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9882  wand->images->chromaticity.red_primary.x=x;
9883  wand->images->chromaticity.red_primary.y=y;
9884  return(MagickTrue);
9885}
9886
9887/*
9888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9889%                                                                             %
9890%                                                                             %
9891%                                                                             %
9892%   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                 %
9893%                                                                             %
9894%                                                                             %
9895%                                                                             %
9896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9897%
9898%  MagickSetImageRenderingIntent() sets the image rendering intent.
9899%
9900%  The format of the MagickSetImageRenderingIntent method is:
9901%
9902%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9903%        const RenderingIntent rendering_intent)
9904%
9905%  A description of each parameter follows:
9906%
9907%    o wand: the magick wand.
9908%
9909%    o rendering_intent: the image rendering intent: UndefinedIntent,
9910%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9911%
9912*/
9913WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9914  const RenderingIntent rendering_intent)
9915{
9916  assert(wand != (MagickWand *) NULL);
9917  assert(wand->signature == WandSignature);
9918  if (wand->debug != MagickFalse)
9919    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9920  if (wand->images == (Image *) NULL)
9921    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9922  wand->images->rendering_intent=rendering_intent;
9923  return(MagickTrue);
9924}
9925
9926/*
9927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9928%                                                                             %
9929%                                                                             %
9930%                                                                             %
9931%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9932%                                                                             %
9933%                                                                             %
9934%                                                                             %
9935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9936%
9937%  MagickSetImageResolution() sets the image resolution.
9938%
9939%  The format of the MagickSetImageResolution method is:
9940%
9941%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9942%        const double x_resolution,const doubtl y_resolution)
9943%
9944%  A description of each parameter follows:
9945%
9946%    o wand: the magick wand.
9947%
9948%    o x_resolution: the image x resolution.
9949%
9950%    o y_resolution: the image y resolution.
9951%
9952*/
9953WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9954  const double x_resolution,const double y_resolution)
9955{
9956  assert(wand != (MagickWand *) NULL);
9957  assert(wand->signature == WandSignature);
9958  if (wand->debug != MagickFalse)
9959    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9960  if (wand->images == (Image *) NULL)
9961    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9962  wand->images->x_resolution=x_resolution;
9963  wand->images->y_resolution=y_resolution;
9964  return(MagickTrue);
9965}
9966
9967/*
9968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9969%                                                                             %
9970%                                                                             %
9971%                                                                             %
9972%   M a g i c k S e t I m a g e S c e n e                                     %
9973%                                                                             %
9974%                                                                             %
9975%                                                                             %
9976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9977%
9978%  MagickSetImageScene() sets the image scene.
9979%
9980%  The format of the MagickSetImageScene method is:
9981%
9982%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9983%        const size_t scene)
9984%
9985%  A description of each parameter follows:
9986%
9987%    o wand: the magick wand.
9988%
9989%    o delay: the image scene number.
9990%
9991*/
9992WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9993  const size_t scene)
9994{
9995  assert(wand != (MagickWand *) NULL);
9996  assert(wand->signature == WandSignature);
9997  if (wand->debug != MagickFalse)
9998    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9999  if (wand->images == (Image *) NULL)
10000    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10001  wand->images->scene=scene;
10002  return(MagickTrue);
10003}
10004
10005/*
10006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10007%                                                                             %
10008%                                                                             %
10009%                                                                             %
10010%   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                   %
10011%                                                                             %
10012%                                                                             %
10013%                                                                             %
10014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10015%
10016%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10017%
10018%  The format of the MagickSetImageTicksPerSecond method is:
10019%
10020%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10021%        const ssize_t ticks_per-second)
10022%
10023%  A description of each parameter follows:
10024%
10025%    o wand: the magick wand.
10026%
10027%    o ticks_per_second: the units to use for the image delay.
10028%
10029*/
10030WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10031  const ssize_t ticks_per_second)
10032{
10033  assert(wand != (MagickWand *) NULL);
10034  assert(wand->signature == WandSignature);
10035  if (wand->debug != MagickFalse)
10036    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10037  if (wand->images == (Image *) NULL)
10038    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10039  wand->images->ticks_per_second=ticks_per_second;
10040  return(MagickTrue);
10041}
10042
10043/*
10044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10045%                                                                             %
10046%                                                                             %
10047%                                                                             %
10048%   M a g i c k S e t I m a g e T y p e                                       %
10049%                                                                             %
10050%                                                                             %
10051%                                                                             %
10052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10053%
10054%  MagickSetImageType() sets the image type.
10055%
10056%  The format of the MagickSetImageType method is:
10057%
10058%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10059%        const ImageType image_type)
10060%
10061%  A description of each parameter follows:
10062%
10063%    o wand: the magick wand.
10064%
10065%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10066%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10067%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10068%      or OptimizeType.
10069%
10070*/
10071WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10072  const ImageType image_type)
10073{
10074  assert(wand != (MagickWand *) NULL);
10075  assert(wand->signature == WandSignature);
10076  if (wand->debug != MagickFalse)
10077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10078  if (wand->images == (Image *) NULL)
10079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10080  return(SetImageType(wand->images,image_type));
10081}
10082
10083/*
10084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10085%                                                                             %
10086%                                                                             %
10087%                                                                             %
10088%   M a g i c k S e t I m a g e U n i t s                                     %
10089%                                                                             %
10090%                                                                             %
10091%                                                                             %
10092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093%
10094%  MagickSetImageUnits() sets the image units of resolution.
10095%
10096%  The format of the MagickSetImageUnits method is:
10097%
10098%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10099%        const ResolutionType units)
10100%
10101%  A description of each parameter follows:
10102%
10103%    o wand: the magick wand.
10104%
10105%    o units: the image units of resolution : UndefinedResolution,
10106%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10107%
10108*/
10109WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10110  const ResolutionType units)
10111{
10112  assert(wand != (MagickWand *) NULL);
10113  assert(wand->signature == WandSignature);
10114  if (wand->debug != MagickFalse)
10115    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10116  if (wand->images == (Image *) NULL)
10117    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10118  wand->images->units=units;
10119  return(MagickTrue);
10120}
10121
10122/*
10123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10124%                                                                             %
10125%                                                                             %
10126%                                                                             %
10127%   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           %
10128%                                                                             %
10129%                                                                             %
10130%                                                                             %
10131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10132%
10133%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10134%
10135%  The format of the MagickSetImageVirtualPixelMethod method is:
10136%
10137%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10138%        const VirtualPixelMethod method)
10139%
10140%  A description of each parameter follows:
10141%
10142%    o wand: the magick wand.
10143%
10144%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10145%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10146%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10147%
10148*/
10149WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10150  const VirtualPixelMethod method)
10151{
10152  assert(wand != (MagickWand *) NULL);
10153  assert(wand->signature == WandSignature);
10154  if (wand->debug != MagickFalse)
10155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10156  if (wand->images == (Image *) NULL)
10157    return(UndefinedVirtualPixelMethod);
10158  return(SetImageVirtualPixelMethod(wand->images,method));
10159}
10160
10161/*
10162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10163%                                                                             %
10164%                                                                             %
10165%                                                                             %
10166%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10167%                                                                             %
10168%                                                                             %
10169%                                                                             %
10170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10171%
10172%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10173%
10174%  The format of the MagickSetImageWhitePoint method is:
10175%
10176%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10177%        const double x,const double y)
10178%
10179%  A description of each parameter follows:
10180%
10181%    o wand: the magick wand.
10182%
10183%    o x: the white x-point.
10184%
10185%    o y: the white y-point.
10186%
10187*/
10188WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10189  const double x,const double y)
10190{
10191  assert(wand != (MagickWand *) NULL);
10192  assert(wand->signature == WandSignature);
10193  if (wand->debug != MagickFalse)
10194    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10195  if (wand->images == (Image *) NULL)
10196    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10197  wand->images->chromaticity.white_point.x=x;
10198  wand->images->chromaticity.white_point.y=y;
10199  return(MagickTrue);
10200}
10201
10202/*
10203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10204%                                                                             %
10205%                                                                             %
10206%                                                                             %
10207%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10208%                                                                             %
10209%                                                                             %
10210%                                                                             %
10211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10212%
10213%  MagickShadeImage() shines a distant light on an image to create a
10214%  three-dimensional effect. You control the positioning of the light with
10215%  azimuth and elevation; azimuth is measured in degrees off the x axis
10216%  and elevation is measured in pixels above the Z axis.
10217%
10218%  The format of the MagickShadeImage method is:
10219%
10220%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10221%        const MagickBooleanType gray,const double azimuth,
10222%        const double elevation)
10223%
10224%  A description of each parameter follows:
10225%
10226%    o wand: the magick wand.
10227%
10228%    o gray: A value other than zero shades the intensity of each pixel.
10229%
10230%    o azimuth, elevation:  Define the light source direction.
10231%
10232*/
10233WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10234  const MagickBooleanType gray,const double asimuth,const double elevation)
10235{
10236  Image
10237    *shade_image;
10238
10239  assert(wand != (MagickWand *) NULL);
10240  assert(wand->signature == WandSignature);
10241  if (wand->debug != MagickFalse)
10242    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10243  if (wand->images == (Image *) NULL)
10244    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10245  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10246  if (shade_image == (Image *) NULL)
10247    return(MagickFalse);
10248  ReplaceImageInList(&wand->images,shade_image);
10249  return(MagickTrue);
10250}
10251
10252/*
10253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254%                                                                             %
10255%                                                                             %
10256%                                                                             %
10257%   M a g i c k S h a d o w I m a g e                                         %
10258%                                                                             %
10259%                                                                             %
10260%                                                                             %
10261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10262%
10263%  MagickShadowImage() simulates an image shadow.
10264%
10265%  The format of the MagickShadowImage method is:
10266%
10267%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10268%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10269%
10270%  A description of each parameter follows:
10271%
10272%    o wand: the magick wand.
10273%
10274%    o opacity: percentage transparency.
10275%
10276%    o sigma: the standard deviation of the Gaussian, in pixels.
10277%
10278%    o x: the shadow x-offset.
10279%
10280%    o y: the shadow y-offset.
10281%
10282*/
10283WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10284  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10285{
10286  Image
10287    *shadow_image;
10288
10289  assert(wand != (MagickWand *) NULL);
10290  assert(wand->signature == WandSignature);
10291  if (wand->debug != MagickFalse)
10292    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10293  if (wand->images == (Image *) NULL)
10294    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10295  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10296  if (shadow_image == (Image *) NULL)
10297    return(MagickFalse);
10298  ReplaceImageInList(&wand->images,shadow_image);
10299  return(MagickTrue);
10300}
10301
10302/*
10303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10304%                                                                             %
10305%                                                                             %
10306%                                                                             %
10307%   M a g i c k S h a r p e n I m a g e                                       %
10308%                                                                             %
10309%                                                                             %
10310%                                                                             %
10311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10312%
10313%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10314%  Gaussian operator of the given radius and standard deviation (sigma).
10315%  For reasonable results, the radius should be larger than sigma.  Use a
10316%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10317%
10318%  The format of the MagickSharpenImage method is:
10319%
10320%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10321%        const double radius,const double sigma)
10322%
10323%  A description of each parameter follows:
10324%
10325%    o wand: the magick wand.
10326%
10327%    o radius: the radius of the Gaussian, in pixels, not counting the center
10328%      pixel.
10329%
10330%    o sigma: the standard deviation of the Gaussian, in pixels.
10331%
10332*/
10333WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10334  const double radius,const double sigma)
10335{
10336  Image
10337    *sharp_image;
10338
10339  assert(wand != (MagickWand *) NULL);
10340  assert(wand->signature == WandSignature);
10341  if (wand->debug != MagickFalse)
10342    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10343  if (wand->images == (Image *) NULL)
10344    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10345  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10346  if (sharp_image == (Image *) NULL)
10347    return(MagickFalse);
10348  ReplaceImageInList(&wand->images,sharp_image);
10349  return(MagickTrue);
10350}
10351
10352/*
10353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10354%                                                                             %
10355%                                                                             %
10356%                                                                             %
10357%   M a g i c k S h a v e I m a g e                                           %
10358%                                                                             %
10359%                                                                             %
10360%                                                                             %
10361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10362%
10363%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10364%  memory necessary for the new Image structure and returns a pointer to the
10365%  new image.
10366%
10367%  The format of the MagickShaveImage method is:
10368%
10369%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10370%        const size_t columns,const size_t rows)
10371%
10372%  A description of each parameter follows:
10373%
10374%    o wand: the magick wand.
10375%
10376%    o columns: the number of columns in the scaled image.
10377%
10378%    o rows: the number of rows in the scaled image.
10379%
10380%
10381*/
10382WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10383  const size_t columns,const size_t rows)
10384{
10385  Image
10386    *shave_image;
10387
10388  RectangleInfo
10389    shave_info;
10390
10391  assert(wand != (MagickWand *) NULL);
10392  assert(wand->signature == WandSignature);
10393  if (wand->debug != MagickFalse)
10394    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10395  if (wand->images == (Image *) NULL)
10396    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10397  shave_info.width=columns;
10398  shave_info.height=rows;
10399  shave_info.x=0;
10400  shave_info.y=0;
10401  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10402  if (shave_image == (Image *) NULL)
10403    return(MagickFalse);
10404  ReplaceImageInList(&wand->images,shave_image);
10405  return(MagickTrue);
10406}
10407
10408/*
10409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10410%                                                                             %
10411%                                                                             %
10412%                                                                             %
10413%   M a g i c k S h e a r I m a g e                                           %
10414%                                                                             %
10415%                                                                             %
10416%                                                                             %
10417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10418%
10419%  MagickShearImage() slides one edge of an image along the X or Y axis,
10420%  creating a parallelogram.  An X direction shear slides an edge along the X
10421%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10422%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10423%  is measured relative to the Y axis, and similarly, for Y direction shears
10424%  y_shear is measured relative to the X axis.  Empty triangles left over from
10425%  shearing the image are filled with the background color.
10426%
10427%  The format of the MagickShearImage method is:
10428%
10429%      MagickBooleanType MagickShearImage(MagickWand *wand,
10430%        const PixelWand *background,const double x_shear,onst double y_shear)
10431%
10432%  A description of each parameter follows:
10433%
10434%    o wand: the magick wand.
10435%
10436%    o background: the background pixel wand.
10437%
10438%    o x_shear: the number of degrees to shear the image.
10439%
10440%    o y_shear: the number of degrees to shear the image.
10441%
10442*/
10443WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10444  const PixelWand *background,const double x_shear,const double y_shear)
10445{
10446  Image
10447    *shear_image;
10448
10449  assert(wand != (MagickWand *) NULL);
10450  assert(wand->signature == WandSignature);
10451  if (wand->debug != MagickFalse)
10452    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10453  if (wand->images == (Image *) NULL)
10454    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10455  PixelGetQuantumPacket(background,&wand->images->background_color);
10456  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10457  if (shear_image == (Image *) NULL)
10458    return(MagickFalse);
10459  ReplaceImageInList(&wand->images,shear_image);
10460  return(MagickTrue);
10461}
10462
10463/*
10464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10465%                                                                             %
10466%                                                                             %
10467%                                                                             %
10468%   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                   %
10469%                                                                             %
10470%                                                                             %
10471%                                                                             %
10472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10473%
10474%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10475%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10476%  image using a sigmoidal transfer function without saturating highlights or
10477%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10478%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10479%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10480%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10481%  is reduced.
10482%
10483%  The format of the MagickSigmoidalContrastImage method is:
10484%
10485%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10486%        const MagickBooleanType sharpen,const double alpha,const double beta)
10487%
10488%  A description of each parameter follows:
10489%
10490%    o wand: the magick wand.
10491%
10492%    o sharpen: Increase or decrease image contrast.
10493%
10494%    o alpha: strength of the contrast, the larger the number the more
10495%      'threshold-like' it becomes.
10496%
10497%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10498%
10499*/
10500WandExport MagickBooleanType MagickSigmoidalContrastImage(
10501  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10502  const double beta)
10503{
10504  MagickBooleanType
10505    status;
10506
10507  assert(wand != (MagickWand *) NULL);
10508  assert(wand->signature == WandSignature);
10509  if (wand->debug != MagickFalse)
10510    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10511  if (wand->images == (Image *) NULL)
10512    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10513  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
10514  if (status == MagickFalse)
10515    InheritException(wand->exception,&wand->images->exception);
10516  return(status);
10517}
10518
10519/*
10520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10521%                                                                             %
10522%                                                                             %
10523%                                                                             %
10524%   M a g i c k S i m i l a r i t y I m a g e                                 %
10525%                                                                             %
10526%                                                                             %
10527%                                                                             %
10528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10529%
10530%  MagickSimilarityImage() compares the reference image of the image and
10531%  returns the best match offset.  In addition, it returns a similarity image
10532%  such that an exact match location is completely white and if none of the
10533%  pixels match, black, otherwise some gray level in-between.
10534%
10535%  The format of the MagickSimilarityImage method is:
10536%
10537%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10538%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10539%
10540%  A description of each parameter follows:
10541%
10542%    o wand: the magick wand.
10543%
10544%    o reference: the reference wand.
10545%
10546%    o offset: the best match offset of the reference image within the image.
10547%
10548%    o similarity: the computed similarity between the images.
10549%
10550*/
10551WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10552  const MagickWand *reference,RectangleInfo *offset,double *similarity)
10553{
10554  Image
10555    *similarity_image;
10556
10557  assert(wand != (MagickWand *) NULL);
10558  assert(wand->signature == WandSignature);
10559  if (wand->debug != MagickFalse)
10560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10561  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10562    {
10563      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10564        "ContainsNoImages","`%s'",wand->name);
10565      return((MagickWand *) NULL);
10566    }
10567  similarity_image=SimilarityImage(wand->images,reference->images,offset,
10568    similarity,&wand->images->exception);
10569  if (similarity_image == (Image *) NULL)
10570    return((MagickWand *) NULL);
10571  return(CloneMagickWandFromImages(wand,similarity_image));
10572}
10573
10574/*
10575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10576%                                                                             %
10577%                                                                             %
10578%                                                                             %
10579%   M a g i c k S k e t c h I m a g e                                         %
10580%                                                                             %
10581%                                                                             %
10582%                                                                             %
10583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10584%
10585%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10586%  a Gaussian operator of the given radius and standard deviation (sigma).
10587%  For reasonable results, radius should be larger than sigma.  Use a
10588%  radius of 0 and SketchImage() selects a suitable radius for you.
10589%  Angle gives the angle of the blurring motion.
10590%
10591%  The format of the MagickSketchImage method is:
10592%
10593%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10594%        const double radius,const double sigma,const double angle)
10595%
10596%  A description of each parameter follows:
10597%
10598%    o wand: the magick wand.
10599%
10600%    o radius: the radius of the Gaussian, in pixels, not counting
10601%      the center pixel.
10602%
10603%    o sigma: the standard deviation of the Gaussian, in pixels.
10604%
10605%    o angle: Apply the effect along this angle.
10606%
10607*/
10608WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10609  const double radius,const double sigma,const double angle)
10610{
10611  Image
10612    *sketch_image;
10613
10614  assert(wand != (MagickWand *) NULL);
10615  assert(wand->signature == WandSignature);
10616  if (wand->debug != MagickFalse)
10617    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10618  if (wand->images == (Image *) NULL)
10619    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10620  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10621  if (sketch_image == (Image *) NULL)
10622    return(MagickFalse);
10623  ReplaceImageInList(&wand->images,sketch_image);
10624  return(MagickTrue);
10625}
10626
10627/*
10628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10629%                                                                             %
10630%                                                                             %
10631%                                                                             %
10632%   M a g i c k S m u s h I m a g e s                                         %
10633%                                                                             %
10634%                                                                             %
10635%                                                                             %
10636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10637%
10638%  MagickSmushImages() takes all images from the current image pointer to the
10639%  end of the image list and smushs them to each other top-to-bottom if the
10640%  stack parameter is true, otherwise left-to-right.
10641%
10642%  The format of the MagickSmushImages method is:
10643%
10644%      MagickWand *MagickSmushImages(MagickWand *wand,
10645%        const MagickBooleanType stack,const ssize_t offset)
10646%
10647%  A description of each parameter follows:
10648%
10649%    o wand: the magick wand.
10650%
10651%    o stack: By default, images are stacked left-to-right. Set stack to
10652%      MagickTrue to stack them top-to-bottom.
10653%
10654%    o offset: minimum distance in pixels between images.
10655%
10656*/
10657WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10658  const MagickBooleanType stack,const ssize_t offset)
10659{
10660  Image
10661    *smush_image;
10662
10663  assert(wand != (MagickWand *) NULL);
10664  assert(wand->signature == WandSignature);
10665  if (wand->debug != MagickFalse)
10666    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10667  if (wand->images == (Image *) NULL)
10668    return((MagickWand *) NULL);
10669  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10670  if (smush_image == (Image *) NULL)
10671    return((MagickWand *) NULL);
10672  return(CloneMagickWandFromImages(wand,smush_image));
10673}
10674
10675/*
10676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10677%                                                                             %
10678%                                                                             %
10679%                                                                             %
10680%     M a g i c k S o l a r i z e I m a g e                                   %
10681%                                                                             %
10682%                                                                             %
10683%                                                                             %
10684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10685%
10686%  MagickSolarizeImage() applies a special effect to the image, similar to the
10687%  effect achieved in a photo darkroom by selectively exposing areas of photo
10688%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10689%  measure of the extent of the solarization.
10690%
10691%  The format of the MagickSolarizeImage method is:
10692%
10693%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10694%        const double threshold)
10695%
10696%  A description of each parameter follows:
10697%
10698%    o wand: the magick wand.
10699%
10700%    o threshold:  Define the extent of the solarization.
10701%
10702*/
10703WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10704  const double threshold)
10705{
10706  MagickBooleanType
10707    status;
10708
10709  assert(wand != (MagickWand *) NULL);
10710  assert(wand->signature == WandSignature);
10711  if (wand->debug != MagickFalse)
10712    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10713  if (wand->images == (Image *) NULL)
10714    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10715  status=SolarizeImage(wand->images,threshold);
10716  if (status == MagickFalse)
10717    InheritException(wand->exception,&wand->images->exception);
10718  return(status);
10719}
10720
10721/*
10722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10723%                                                                             %
10724%                                                                             %
10725%                                                                             %
10726%   M a g i c k S p a r s e C o l o r I m a g e                               %
10727%                                                                             %
10728%                                                                             %
10729%                                                                             %
10730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10731%
10732%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10733%  colors found at those coordinates, across the whole image, using various
10734%  methods.
10735%
10736%  The format of the MagickSparseColorImage method is:
10737%
10738%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10739%        const SparseColorMethod method,const size_t number_arguments,
10740%        const double *arguments)
10741%
10742%  A description of each parameter follows:
10743%
10744%    o image: the image to be sparseed.
10745%
10746%    o method: the method of image sparseion.
10747%
10748%        ArcSparseColorion will always ignore source image offset, and always
10749%        'bestfit' the destination image with the top left corner offset
10750%        relative to the polar mapping center.
10751%
10752%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10753%        style of image sparseion.
10754%
10755%        Affine, Perspective, and Bilinear, will do least squares fitting of
10756%        the distrotion when more than the minimum number of control point
10757%        pairs are provided.
10758%
10759%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10760%        less than 4 control point pairs are provided. While Affine sparseions
10761%        will let you use any number of control point pairs, that is Zero pairs
10762%        is a No-Op (viewport only) distrotion, one pair is a translation and
10763%        two pairs of control points will do a scale-rotate-translate, without
10764%        any shearing.
10765%
10766%    o number_arguments: the number of arguments given for this sparseion
10767%      method.
10768%
10769%    o arguments: the arguments for this sparseion method.
10770%
10771*/
10772WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10773  const SparseColorMethod method,const size_t number_arguments,
10774  const double *arguments)
10775{
10776  Image
10777    *sparse_image;
10778
10779  assert(wand != (MagickWand *) NULL);
10780  assert(wand->signature == WandSignature);
10781  if (wand->debug != MagickFalse)
10782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10783  if (wand->images == (Image *) NULL)
10784    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10785  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10786    wand->exception);
10787  if (sparse_image == (Image *) NULL)
10788    return(MagickFalse);
10789  ReplaceImageInList(&wand->images,sparse_image);
10790  return(MagickTrue);
10791}
10792
10793/*
10794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10795%                                                                             %
10796%                                                                             %
10797%                                                                             %
10798%   M a g i c k S p l i c e I m a g e                                         %
10799%                                                                             %
10800%                                                                             %
10801%                                                                             %
10802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10803%
10804%  MagickSpliceImage() splices a solid color into the image.
10805%
10806%  The format of the MagickSpliceImage method is:
10807%
10808%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10809%        const size_t width,const size_t height,const ssize_t x,
10810%        const ssize_t y)
10811%
10812%  A description of each parameter follows:
10813%
10814%    o wand: the magick wand.
10815%
10816%    o width: the region width.
10817%
10818%    o height: the region height.
10819%
10820%    o x: the region x offset.
10821%
10822%    o y: the region y offset.
10823%
10824*/
10825WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10826  const size_t width,const size_t height,const ssize_t x,
10827  const ssize_t y)
10828{
10829  Image
10830    *splice_image;
10831
10832  RectangleInfo
10833    splice;
10834
10835  assert(wand != (MagickWand *) NULL);
10836  assert(wand->signature == WandSignature);
10837  if (wand->debug != MagickFalse)
10838    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10839  if (wand->images == (Image *) NULL)
10840    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10841  splice.width=width;
10842  splice.height=height;
10843  splice.x=x;
10844  splice.y=y;
10845  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10846  if (splice_image == (Image *) NULL)
10847    return(MagickFalse);
10848  ReplaceImageInList(&wand->images,splice_image);
10849  return(MagickTrue);
10850}
10851
10852/*
10853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10854%                                                                             %
10855%                                                                             %
10856%                                                                             %
10857%   M a g i c k S p r e a d I m a g e                                         %
10858%                                                                             %
10859%                                                                             %
10860%                                                                             %
10861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10862%
10863%  MagickSpreadImage() is a special effects method that randomly displaces each
10864%  pixel in a block defined by the radius parameter.
10865%
10866%  The format of the MagickSpreadImage method is:
10867%
10868%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10869%
10870%  A description of each parameter follows:
10871%
10872%    o wand: the magick wand.
10873%
10874%    o radius:  Choose a random pixel in a neighborhood of this extent.
10875%
10876*/
10877WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10878  const double radius)
10879{
10880  Image
10881    *spread_image;
10882
10883  assert(wand != (MagickWand *) NULL);
10884  assert(wand->signature == WandSignature);
10885  if (wand->debug != MagickFalse)
10886    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10887  if (wand->images == (Image *) NULL)
10888    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10889  spread_image=SpreadImage(wand->images,radius,wand->exception);
10890  if (spread_image == (Image *) NULL)
10891    return(MagickFalse);
10892  ReplaceImageInList(&wand->images,spread_image);
10893  return(MagickTrue);
10894}
10895
10896/*
10897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10898%                                                                             %
10899%                                                                             %
10900%                                                                             %
10901%   M a g i c k S t a t i s t i c I m a g e                                   %
10902%                                                                             %
10903%                                                                             %
10904%                                                                             %
10905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10906%
10907%  MagickStatisticImage() replace each pixel with corresponding statistic from
10908%  the neighborhood of the specified width and height.
10909%
10910%  The format of the MagickStatisticImage method is:
10911%
10912%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10913%        const StatisticType type,const double width,const size_t height)
10914%
10915%  A description of each parameter follows:
10916%
10917%    o wand: the magick wand.
10918%
10919%    o type: the statistic type (e.g. median, mode, etc.).
10920%
10921%    o width: the width of the pixel neighborhood.
10922%
10923%    o height: the height of the pixel neighborhood.
10924%
10925*/
10926WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10927  const StatisticType type,const size_t width,const size_t height)
10928{
10929  Image
10930    *statistic_image;
10931
10932  assert(wand != (MagickWand *) NULL);
10933  assert(wand->signature == WandSignature);
10934  if (wand->debug != MagickFalse)
10935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10936  if (wand->images == (Image *) NULL)
10937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10938  statistic_image=StatisticImage(wand->images,type,width,height,
10939    wand->exception);
10940  if (statistic_image == (Image *) NULL)
10941    return(MagickFalse);
10942  ReplaceImageInList(&wand->images,statistic_image);
10943  return(MagickTrue);
10944}
10945
10946/*
10947%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10948%                                                                             %
10949%                                                                             %
10950%                                                                             %
10951%   M a g i c k S t e g a n o I m a g e                                       %
10952%                                                                             %
10953%                                                                             %
10954%                                                                             %
10955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10956%
10957%  MagickSteganoImage() hides a digital watermark within the image.
10958%  Recover the hidden watermark later to prove that the authenticity of
10959%  an image.  Offset defines the start position within the image to hide
10960%  the watermark.
10961%
10962%  The format of the MagickSteganoImage method is:
10963%
10964%      MagickWand *MagickSteganoImage(MagickWand *wand,
10965%        const MagickWand *watermark_wand,const ssize_t offset)
10966%
10967%  A description of each parameter follows:
10968%
10969%    o wand: the magick wand.
10970%
10971%    o watermark_wand: the watermark wand.
10972%
10973%    o offset: Start hiding at this offset into the image.
10974%
10975*/
10976WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10977  const MagickWand *watermark_wand,const ssize_t offset)
10978{
10979  Image
10980    *stegano_image;
10981
10982  assert(wand != (MagickWand *) NULL);
10983  assert(wand->signature == WandSignature);
10984  if (wand->debug != MagickFalse)
10985    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10986  if ((wand->images == (Image *) NULL) ||
10987      (watermark_wand->images == (Image *) NULL))
10988    {
10989      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10990        "ContainsNoImages","`%s'",wand->name);
10991      return((MagickWand *) NULL);
10992    }
10993  wand->images->offset=offset;
10994  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10995    wand->exception);
10996  if (stegano_image == (Image *) NULL)
10997    return((MagickWand *) NULL);
10998  return(CloneMagickWandFromImages(wand,stegano_image));
10999}
11000
11001/*
11002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11003%                                                                             %
11004%                                                                             %
11005%                                                                             %
11006%   M a g i c k S t e r e o I m a g e                                         %
11007%                                                                             %
11008%                                                                             %
11009%                                                                             %
11010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11011%
11012%  MagickStereoImage() composites two images and produces a single image that
11013%  is the composite of a left and right image of a stereo pair
11014%
11015%  The format of the MagickStereoImage method is:
11016%
11017%      MagickWand *MagickStereoImage(MagickWand *wand,
11018%        const MagickWand *offset_wand)
11019%
11020%  A description of each parameter follows:
11021%
11022%    o wand: the magick wand.
11023%
11024%    o offset_wand: Another image wand.
11025%
11026*/
11027WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11028  const MagickWand *offset_wand)
11029{
11030  Image
11031    *stereo_image;
11032
11033  assert(wand != (MagickWand *) NULL);
11034  assert(wand->signature == WandSignature);
11035  if (wand->debug != MagickFalse)
11036    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11037  if ((wand->images == (Image *) NULL) ||
11038      (offset_wand->images == (Image *) NULL))
11039    {
11040      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11041        "ContainsNoImages","`%s'",wand->name);
11042      return((MagickWand *) NULL);
11043    }
11044  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11045  if (stereo_image == (Image *) NULL)
11046    return((MagickWand *) NULL);
11047  return(CloneMagickWandFromImages(wand,stereo_image));
11048}
11049
11050/*
11051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11052%                                                                             %
11053%                                                                             %
11054%                                                                             %
11055%   M a g i c k S t r i p I m a g e                                           %
11056%                                                                             %
11057%                                                                             %
11058%                                                                             %
11059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11060%
11061%  MagickStripImage() strips an image of all profiles and comments.
11062%
11063%  The format of the MagickStripImage method is:
11064%
11065%      MagickBooleanType MagickStripImage(MagickWand *wand)
11066%
11067%  A description of each parameter follows:
11068%
11069%    o wand: the magick wand.
11070%
11071*/
11072WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11073{
11074  MagickBooleanType
11075    status;
11076
11077  assert(wand != (MagickWand *) NULL);
11078  assert(wand->signature == WandSignature);
11079  if (wand->debug != MagickFalse)
11080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11081  if (wand->images == (Image *) NULL)
11082    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11083  status=StripImage(wand->images);
11084  if (status == MagickFalse)
11085    InheritException(wand->exception,&wand->images->exception);
11086  return(status);
11087}
11088
11089/*
11090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11091%                                                                             %
11092%                                                                             %
11093%                                                                             %
11094%   M a g i c k S w i r l I m a g e                                           %
11095%                                                                             %
11096%                                                                             %
11097%                                                                             %
11098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11099%
11100%  MagickSwirlImage() swirls the pixels about the center of the image, where
11101%  degrees indicates the sweep of the arc through which each pixel is moved.
11102%  You get a more dramatic effect as the degrees move from 1 to 360.
11103%
11104%  The format of the MagickSwirlImage method is:
11105%
11106%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11107%
11108%  A description of each parameter follows:
11109%
11110%    o wand: the magick wand.
11111%
11112%    o degrees: Define the tightness of the swirling effect.
11113%
11114*/
11115WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11116  const double degrees)
11117{
11118  Image
11119    *swirl_image;
11120
11121  assert(wand != (MagickWand *) NULL);
11122  assert(wand->signature == WandSignature);
11123  if (wand->debug != MagickFalse)
11124    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11125  if (wand->images == (Image *) NULL)
11126    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11127  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11128  if (swirl_image == (Image *) NULL)
11129    return(MagickFalse);
11130  ReplaceImageInList(&wand->images,swirl_image);
11131  return(MagickTrue);
11132}
11133
11134/*
11135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11136%                                                                             %
11137%                                                                             %
11138%                                                                             %
11139%   M a g i c k T e x t u r e I m a g e                                       %
11140%                                                                             %
11141%                                                                             %
11142%                                                                             %
11143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11144%
11145%  MagickTextureImage() repeatedly tiles the texture image across and down the
11146%  image canvas.
11147%
11148%  The format of the MagickTextureImage method is:
11149%
11150%      MagickWand *MagickTextureImage(MagickWand *wand,
11151%        const MagickWand *texture_wand)
11152%
11153%  A description of each parameter follows:
11154%
11155%    o wand: the magick wand.
11156%
11157%    o texture_wand: the texture wand
11158%
11159*/
11160WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11161  const MagickWand *texture_wand)
11162{
11163  Image
11164    *texture_image;
11165
11166  MagickBooleanType
11167    status;
11168
11169  assert(wand != (MagickWand *) NULL);
11170  assert(wand->signature == WandSignature);
11171  if (wand->debug != MagickFalse)
11172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11173  if ((wand->images == (Image *) NULL) ||
11174      (texture_wand->images == (Image *) NULL))
11175    {
11176      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11177        "ContainsNoImages","`%s'",wand->name);
11178      return((MagickWand *) NULL);
11179    }
11180  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11181  if (texture_image == (Image *) NULL)
11182    return((MagickWand *) NULL);
11183  status=TextureImage(texture_image,texture_wand->images);
11184  if (status == MagickFalse)
11185    {
11186      InheritException(wand->exception,&texture_image->exception);
11187      texture_image=DestroyImage(texture_image);
11188      return((MagickWand *) NULL);
11189    }
11190  return(CloneMagickWandFromImages(wand,texture_image));
11191}
11192
11193/*
11194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11195%                                                                             %
11196%                                                                             %
11197%                                                                             %
11198%   M a g i c k T h r e s h o l d I m a g e                                   %
11199%                                                                             %
11200%                                                                             %
11201%                                                                             %
11202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11203%
11204%  MagickThresholdImage() changes the value of individual pixels based on
11205%  the intensity of each pixel compared to threshold.  The result is a
11206%  high-contrast, two color image.
11207%
11208%  The format of the MagickThresholdImage method is:
11209%
11210%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11211%        const double threshold)
11212%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11213%        const ChannelType channel,const double threshold)
11214%
11215%  A description of each parameter follows:
11216%
11217%    o wand: the magick wand.
11218%
11219%    o channel: the image channel(s).
11220%
11221%    o threshold: Define the threshold value.
11222%
11223*/
11224WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11225  const double threshold)
11226{
11227  MagickBooleanType
11228    status;
11229
11230  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11231  return(status);
11232}
11233
11234WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11235  const ChannelType channel,const double threshold)
11236{
11237  MagickBooleanType
11238    status;
11239
11240  assert(wand != (MagickWand *) NULL);
11241  assert(wand->signature == WandSignature);
11242  if (wand->debug != MagickFalse)
11243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11244  if (wand->images == (Image *) NULL)
11245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11246  status=BilevelImage(wand->images,threshold);
11247  if (status == MagickFalse)
11248    InheritException(wand->exception,&wand->images->exception);
11249  return(status);
11250}
11251
11252/*
11253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254%                                                                             %
11255%                                                                             %
11256%                                                                             %
11257%   M a g i c k T h u m b n a i l I m a g e                                   %
11258%                                                                             %
11259%                                                                             %
11260%                                                                             %
11261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262%
11263%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11264%  and removes any associated profiles.  The goal is to produce small low cost
11265%  thumbnail images suited for display on the Web.
11266%
11267%  The format of the MagickThumbnailImage method is:
11268%
11269%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11270%        const size_t columns,const size_t rows)
11271%
11272%  A description of each parameter follows:
11273%
11274%    o wand: the magick wand.
11275%
11276%    o columns: the number of columns in the scaled image.
11277%
11278%    o rows: the number of rows in the scaled image.
11279%
11280*/
11281WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11282  const size_t columns,const size_t rows)
11283{
11284  Image
11285    *thumbnail_image;
11286
11287  assert(wand != (MagickWand *) NULL);
11288  assert(wand->signature == WandSignature);
11289  if (wand->debug != MagickFalse)
11290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11291  if (wand->images == (Image *) NULL)
11292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11293  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11294  if (thumbnail_image == (Image *) NULL)
11295    return(MagickFalse);
11296  ReplaceImageInList(&wand->images,thumbnail_image);
11297  return(MagickTrue);
11298}
11299
11300/*
11301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11302%                                                                             %
11303%                                                                             %
11304%                                                                             %
11305%   M a g i c k T i n t I m a g e                                             %
11306%                                                                             %
11307%                                                                             %
11308%                                                                             %
11309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11310%
11311%  MagickTintImage() applies a color vector to each pixel in the image.  The
11312%  length of the vector is 0 for black and white and at its maximum for the
11313%  midtones.  The vector weighting function is
11314%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11315%
11316%  The format of the MagickTintImage method is:
11317%
11318%      MagickBooleanType MagickTintImage(MagickWand *wand,
11319%        const PixelWand *tint,const PixelWand *opacity)
11320%
11321%  A description of each parameter follows:
11322%
11323%    o wand: the magick wand.
11324%
11325%    o tint: the tint pixel wand.
11326%
11327%    o opacity: the opacity pixel wand.
11328%
11329*/
11330WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11331  const PixelWand *tint,const PixelWand *opacity)
11332{
11333  char
11334    percent_opaque[MaxTextExtent];
11335
11336  Image
11337    *tint_image;
11338
11339  PixelPacket
11340    target;
11341
11342  assert(wand != (MagickWand *) NULL);
11343  assert(wand->signature == WandSignature);
11344  if (wand->debug != MagickFalse)
11345    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11346  if (wand->images == (Image *) NULL)
11347    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11348  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11349    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11350    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11351    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11352    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11353    PixelGetOpacityQuantum(opacity)));
11354  PixelGetQuantumPacket(tint,&target);
11355  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11356  if (tint_image == (Image *) NULL)
11357    return(MagickFalse);
11358  ReplaceImageInList(&wand->images,tint_image);
11359  return(MagickTrue);
11360}
11361
11362/*
11363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11364%                                                                             %
11365%                                                                             %
11366%                                                                             %
11367%   M a g i c k T r a n s f o r m I m a g e                                   %
11368%                                                                             %
11369%                                                                             %
11370%                                                                             %
11371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372%
11373%  MagickTransformImage() is a convenience method that behaves like
11374%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11375%  information as a region geometry specification.  If the operation fails,
11376%  a NULL image handle is returned.
11377%
11378%  The format of the MagickTransformImage method is:
11379%
11380%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11381%        const char *geometry)
11382%
11383%  A description of each parameter follows:
11384%
11385%    o wand: the magick wand.
11386%
11387%    o crop: A crop geometry string.  This geometry defines a subregion of the
11388%      image to crop.
11389%
11390%    o geometry: An image geometry string.  This geometry defines the final
11391%      size of the image.
11392%
11393*/
11394WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11395  const char *crop,const char *geometry)
11396{
11397  Image
11398    *transform_image;
11399
11400  MagickBooleanType
11401    status;
11402
11403  assert(wand != (MagickWand *) NULL);
11404  assert(wand->signature == WandSignature);
11405  if (wand->debug != MagickFalse)
11406    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11407  if (wand->images == (Image *) NULL)
11408    return((MagickWand *) NULL);
11409  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11410  if (transform_image == (Image *) NULL)
11411    return((MagickWand *) NULL);
11412  status=TransformImage(&transform_image,crop,geometry);
11413  if (status == MagickFalse)
11414    {
11415      InheritException(wand->exception,&transform_image->exception);
11416      transform_image=DestroyImage(transform_image);
11417      return((MagickWand *) NULL);
11418    }
11419  return(CloneMagickWandFromImages(wand,transform_image));
11420}
11421
11422/*
11423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11424%                                                                             %
11425%                                                                             %
11426%                                                                             %
11427%   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               %
11428%                                                                             %
11429%                                                                             %
11430%                                                                             %
11431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11432%
11433%  MagickTransformImageColorspace() transform the image colorspace.
11434%
11435%  The format of the MagickTransformImageColorspace method is:
11436%
11437%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11438%        const ColorspaceType colorspace)
11439%
11440%  A description of each parameter follows:
11441%
11442%    o wand: the magick wand.
11443%
11444%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11445%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11446%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11447%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11448%      HSLColorspace, or HWBColorspace.
11449%
11450*/
11451WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11452  const ColorspaceType colorspace)
11453{
11454  assert(wand != (MagickWand *) NULL);
11455  assert(wand->signature == WandSignature);
11456  if (wand->debug != MagickFalse)
11457    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11458  if (wand->images == (Image *) NULL)
11459    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11460  return(TransformImageColorspace(wand->images,colorspace));
11461}
11462
11463/*
11464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11465%                                                                             %
11466%                                                                             %
11467%                                                                             %
11468%   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                     %
11469%                                                                             %
11470%                                                                             %
11471%                                                                             %
11472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11473%
11474%  MagickTransparentPaintImage() changes any pixel that matches color with the
11475%  color defined by fill.
11476%
11477%  The format of the MagickTransparentPaintImage method is:
11478%
11479%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11480%        const PixelWand *target,const double alpha,const double fuzz,
11481%        const MagickBooleanType invert)
11482%
11483%  A description of each parameter follows:
11484%
11485%    o wand: the magick wand.
11486%
11487%    o target: Change this target color to specified opacity value within
11488%      the image.
11489%
11490%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11491%      transparent.
11492%
11493%    o fuzz: By default target must match a particular pixel color
11494%      exactly.  However, in many cases two colors may differ by a small amount.
11495%      The fuzz member of image defines how much tolerance is acceptable to
11496%      consider two colors as the same.  For example, set fuzz to 10 and the
11497%      color red at intensities of 100 and 102 respectively are now interpreted
11498%      as the same color for the purposes of the floodfill.
11499%
11500%    o invert: paint any pixel that does not match the target color.
11501%
11502*/
11503WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11504  const PixelWand *target,const double alpha,const double fuzz,
11505  const MagickBooleanType invert)
11506{
11507  MagickBooleanType
11508    status;
11509
11510  PixelInfo
11511    target_pixel;
11512
11513  assert(wand != (MagickWand *) NULL);
11514  assert(wand->signature == WandSignature);
11515  if (wand->debug != MagickFalse)
11516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11517  if (wand->images == (Image *) NULL)
11518    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11519  PixelGetMagickColor(target,&target_pixel);
11520  wand->images->fuzz=fuzz;
11521  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11522    QuantumRange*alpha),invert);
11523  if (status == MagickFalse)
11524    InheritException(wand->exception,&wand->images->exception);
11525  return(status);
11526}
11527
11528/*
11529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11530%                                                                             %
11531%                                                                             %
11532%                                                                             %
11533%   M a g i c k T r a n s p o s e I m a g e                                   %
11534%                                                                             %
11535%                                                                             %
11536%                                                                             %
11537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11538%
11539%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11540%  pixels around the central x-axis while rotating them 90-degrees.
11541%
11542%  The format of the MagickTransposeImage method is:
11543%
11544%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11545%
11546%  A description of each parameter follows:
11547%
11548%    o wand: the magick wand.
11549%
11550*/
11551WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11552{
11553  Image
11554    *transpose_image;
11555
11556  assert(wand != (MagickWand *) NULL);
11557  assert(wand->signature == WandSignature);
11558  if (wand->debug != MagickFalse)
11559    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11560  if (wand->images == (Image *) NULL)
11561    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11562  transpose_image=TransposeImage(wand->images,wand->exception);
11563  if (transpose_image == (Image *) NULL)
11564    return(MagickFalse);
11565  ReplaceImageInList(&wand->images,transpose_image);
11566  return(MagickTrue);
11567}
11568
11569/*
11570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11571%                                                                             %
11572%                                                                             %
11573%                                                                             %
11574%   M a g i c k T r a n s v e r s e I m a g e                                 %
11575%                                                                             %
11576%                                                                             %
11577%                                                                             %
11578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11579%
11580%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11581%  pixels around the central y-axis while rotating them 270-degrees.
11582%
11583%  The format of the MagickTransverseImage method is:
11584%
11585%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11586%
11587%  A description of each parameter follows:
11588%
11589%    o wand: the magick wand.
11590%
11591*/
11592WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11593{
11594  Image
11595    *transverse_image;
11596
11597  assert(wand != (MagickWand *) NULL);
11598  assert(wand->signature == WandSignature);
11599  if (wand->debug != MagickFalse)
11600    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11601  if (wand->images == (Image *) NULL)
11602    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11603  transverse_image=TransverseImage(wand->images,wand->exception);
11604  if (transverse_image == (Image *) NULL)
11605    return(MagickFalse);
11606  ReplaceImageInList(&wand->images,transverse_image);
11607  return(MagickTrue);
11608}
11609
11610/*
11611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11612%                                                                             %
11613%                                                                             %
11614%                                                                             %
11615%   M a g i c k T r i m I m a g e                                             %
11616%                                                                             %
11617%                                                                             %
11618%                                                                             %
11619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11620%
11621%  MagickTrimImage() remove edges that are the background color from the image.
11622%
11623%  The format of the MagickTrimImage method is:
11624%
11625%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11626%
11627%  A description of each parameter follows:
11628%
11629%    o wand: the magick wand.
11630%
11631%    o fuzz: By default target must match a particular pixel color
11632%      exactly.  However, in many cases two colors may differ by a small amount.
11633%      The fuzz member of image defines how much tolerance is acceptable to
11634%      consider two colors as the same.  For example, set fuzz to 10 and the
11635%      color red at intensities of 100 and 102 respectively are now interpreted
11636%      as the same color for the purposes of the floodfill.
11637%
11638*/
11639WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11640{
11641  Image
11642    *trim_image;
11643
11644  assert(wand != (MagickWand *) NULL);
11645  assert(wand->signature == WandSignature);
11646  if (wand->debug != MagickFalse)
11647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11648  if (wand->images == (Image *) NULL)
11649    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11650  wand->images->fuzz=fuzz;
11651  trim_image=TrimImage(wand->images,wand->exception);
11652  if (trim_image == (Image *) NULL)
11653    return(MagickFalse);
11654  ReplaceImageInList(&wand->images,trim_image);
11655  return(MagickTrue);
11656}
11657
11658/*
11659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11660%                                                                             %
11661%                                                                             %
11662%                                                                             %
11663%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11664%                                                                             %
11665%                                                                             %
11666%                                                                             %
11667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11668%
11669%  MagickUniqueImageColors() discards all but one of any pixel color.
11670%
11671%  The format of the MagickUniqueImageColors method is:
11672%
11673%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11674%
11675%  A description of each parameter follows:
11676%
11677%    o wand: the magick wand.
11678%
11679*/
11680WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11681{
11682  Image
11683    *unique_image;
11684
11685  assert(wand != (MagickWand *) NULL);
11686  assert(wand->signature == WandSignature);
11687  if (wand->debug != MagickFalse)
11688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11689  if (wand->images == (Image *) NULL)
11690    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11691  unique_image=UniqueImageColors(wand->images,wand->exception);
11692  if (unique_image == (Image *) NULL)
11693    return(MagickFalse);
11694  ReplaceImageInList(&wand->images,unique_image);
11695  return(MagickTrue);
11696}
11697
11698/*
11699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11700%                                                                             %
11701%                                                                             %
11702%                                                                             %
11703%   M a g i c k U n s h a r p M a s k I m a g e                               %
11704%                                                                             %
11705%                                                                             %
11706%                                                                             %
11707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11708%
11709%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11710%  Gaussian operator of the given radius and standard deviation (sigma).
11711%  For reasonable results, radius should be larger than sigma.  Use a radius
11712%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11713%
11714%  The format of the MagickUnsharpMaskImage method is:
11715%
11716%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11717%        const double radius,const double sigma,const double amount,
11718%        const double threshold)
11719%
11720%  A description of each parameter follows:
11721%
11722%    o wand: the magick wand.
11723%
11724%    o radius: the radius of the Gaussian, in pixels, not counting the center
11725%      pixel.
11726%
11727%    o sigma: the standard deviation of the Gaussian, in pixels.
11728%
11729%    o amount: the percentage of the difference between the original and the
11730%      blur image that is added back into the original.
11731%
11732%    o threshold: the threshold in pixels needed to apply the diffence amount.
11733%
11734*/
11735WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11736  const double radius,const double sigma,const double amount,
11737  const double threshold)
11738{
11739  Image
11740    *unsharp_image;
11741
11742  assert(wand != (MagickWand *) NULL);
11743  assert(wand->signature == WandSignature);
11744  if (wand->debug != MagickFalse)
11745    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11746  if (wand->images == (Image *) NULL)
11747    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11748  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11749    wand->exception);
11750  if (unsharp_image == (Image *) NULL)
11751    return(MagickFalse);
11752  ReplaceImageInList(&wand->images,unsharp_image);
11753  return(MagickTrue);
11754}
11755
11756/*
11757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11758%                                                                             %
11759%                                                                             %
11760%                                                                             %
11761%   M a g i c k V i g n e t t e I m a g e                                     %
11762%                                                                             %
11763%                                                                             %
11764%                                                                             %
11765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11766%
11767%  MagickVignetteImage() softens the edges of the image in vignette style.
11768%
11769%  The format of the MagickVignetteImage method is:
11770%
11771%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11772%        const double black_point,const double white_point,const ssize_t x,
11773%        const ssize_t y)
11774%
11775%  A description of each parameter follows:
11776%
11777%    o wand: the magick wand.
11778%
11779%    o black_point: the black point.
11780%
11781%    o white_point: the white point.
11782%
11783%    o x, y:  Define the x and y ellipse offset.
11784%
11785*/
11786WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11787  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11788{
11789  Image
11790    *vignette_image;
11791
11792  assert(wand != (MagickWand *) NULL);
11793  assert(wand->signature == WandSignature);
11794  if (wand->debug != MagickFalse)
11795    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11796  if (wand->images == (Image *) NULL)
11797    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11798  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11799    wand->exception);
11800  if (vignette_image == (Image *) NULL)
11801    return(MagickFalse);
11802  ReplaceImageInList(&wand->images,vignette_image);
11803  return(MagickTrue);
11804}
11805
11806/*
11807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11808%                                                                             %
11809%                                                                             %
11810%                                                                             %
11811%   M a g i c k W a v e I m a g e                                             %
11812%                                                                             %
11813%                                                                             %
11814%                                                                             %
11815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11816%
11817%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11818%  the pixels vertically along a sine wave whose amplitude and wavelength
11819%  is specified by the given parameters.
11820%
11821%  The format of the MagickWaveImage method is:
11822%
11823%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11824%        const double wave_length)
11825%
11826%  A description of each parameter follows:
11827%
11828%    o wand: the magick wand.
11829%
11830%    o amplitude, wave_length:  Define the amplitude and wave length of the
11831%      sine wave.
11832%
11833*/
11834WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11835  const double amplitude,const double wave_length)
11836{
11837  Image
11838    *wave_image;
11839
11840  assert(wand != (MagickWand *) NULL);
11841  assert(wand->signature == WandSignature);
11842  if (wand->debug != MagickFalse)
11843    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11844  if (wand->images == (Image *) NULL)
11845    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11846  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11847  if (wave_image == (Image *) NULL)
11848    return(MagickFalse);
11849  ReplaceImageInList(&wand->images,wave_image);
11850  return(MagickTrue);
11851}
11852
11853/*
11854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11855%                                                                             %
11856%                                                                             %
11857%                                                                             %
11858%   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                         %
11859%                                                                             %
11860%                                                                             %
11861%                                                                             %
11862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11863%
11864%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11865%  above the threshold into white while leaving all pixels below the threshold
11866%  unchanged.
11867%
11868%  The format of the MagickWhiteThresholdImage method is:
11869%
11870%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11871%        const PixelWand *threshold)
11872%
11873%  A description of each parameter follows:
11874%
11875%    o wand: the magick wand.
11876%
11877%    o threshold: the pixel wand.
11878%
11879*/
11880WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11881  const PixelWand *threshold)
11882{
11883  char
11884    thresholds[MaxTextExtent];
11885
11886  MagickBooleanType
11887    status;
11888
11889  assert(wand != (MagickWand *) NULL);
11890  assert(wand->signature == WandSignature);
11891  if (wand->debug != MagickFalse)
11892    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11893  if (wand->images == (Image *) NULL)
11894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11895  (void) FormatLocaleString(thresholds,MaxTextExtent,
11896    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11897    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11898    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11899  status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11900  if (status == MagickFalse)
11901    InheritException(wand->exception,&wand->images->exception);
11902  return(status);
11903}
11904
11905/*
11906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11907%                                                                             %
11908%                                                                             %
11909%                                                                             %
11910%   M a g i c k W r i t e I m a g e                                           %
11911%                                                                             %
11912%                                                                             %
11913%                                                                             %
11914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11915%
11916%  MagickWriteImage() writes an image to the specified filename.  If the
11917%  filename parameter is NULL, the image is written to the filename set
11918%  by MagickReadImage() or MagickSetImageFilename().
11919%
11920%  The format of the MagickWriteImage method is:
11921%
11922%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11923%        const char *filename)
11924%
11925%  A description of each parameter follows:
11926%
11927%    o wand: the magick wand.
11928%
11929%    o filename: the image filename.
11930%
11931%
11932*/
11933WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11934  const char *filename)
11935{
11936  Image
11937    *image;
11938
11939  ImageInfo
11940    *write_info;
11941
11942  MagickBooleanType
11943    status;
11944
11945  assert(wand != (MagickWand *) NULL);
11946  assert(wand->signature == WandSignature);
11947  if (wand->debug != MagickFalse)
11948    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11949  if (wand->images == (Image *) NULL)
11950    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11951  if (filename != (const char *) NULL)
11952    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11953  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11954  if (image == (Image *) NULL)
11955    return(MagickFalse);
11956  write_info=CloneImageInfo(wand->image_info);
11957  write_info->adjoin=MagickTrue;
11958  status=WriteImage(write_info,image);
11959  if (status == MagickFalse)
11960    InheritException(wand->exception,&image->exception);
11961  image=DestroyImage(image);
11962  write_info=DestroyImageInfo(write_info);
11963  return(status);
11964}
11965
11966/*
11967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11968%                                                                             %
11969%                                                                             %
11970%                                                                             %
11971%   M a g i c k W r i t e I m a g e F i l e                                   %
11972%                                                                             %
11973%                                                                             %
11974%                                                                             %
11975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11976%
11977%  MagickWriteImageFile() writes an image to an open file descriptor.
11978%
11979%  The format of the MagickWriteImageFile method is:
11980%
11981%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11982%
11983%  A description of each parameter follows:
11984%
11985%    o wand: the magick wand.
11986%
11987%    o file: the file descriptor.
11988%
11989*/
11990WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11991{
11992  Image
11993    *image;
11994
11995  ImageInfo
11996    *write_info;
11997
11998  MagickBooleanType
11999    status;
12000
12001  assert(wand != (MagickWand *) NULL);
12002  assert(wand->signature == WandSignature);
12003  assert(file != (FILE *) NULL);
12004  if (wand->debug != MagickFalse)
12005    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12006  if (wand->images == (Image *) NULL)
12007    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12008  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12009  if (image == (Image *) NULL)
12010    return(MagickFalse);
12011  write_info=CloneImageInfo(wand->image_info);
12012  SetImageInfoFile(write_info,file);
12013  write_info->adjoin=MagickTrue;
12014  status=WriteImage(write_info,image);
12015  write_info=DestroyImageInfo(write_info);
12016  if (status == MagickFalse)
12017    InheritException(wand->exception,&image->exception);
12018  image=DestroyImage(image);
12019  return(status);
12020}
12021
12022/*
12023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12024%                                                                             %
12025%                                                                             %
12026%                                                                             %
12027%   M a g i c k W r i t e I m a g e s                                         %
12028%                                                                             %
12029%                                                                             %
12030%                                                                             %
12031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12032%
12033%  MagickWriteImages() writes an image or image sequence.
12034%
12035%  The format of the MagickWriteImages method is:
12036%
12037%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12038%        const char *filename,const MagickBooleanType adjoin)
12039%
12040%  A description of each parameter follows:
12041%
12042%    o wand: the magick wand.
12043%
12044%    o filename: the image filename.
12045%
12046%    o adjoin: join images into a single multi-image file.
12047%
12048*/
12049WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12050  const char *filename,const MagickBooleanType adjoin)
12051{
12052  ImageInfo
12053    *write_info;
12054
12055  MagickBooleanType
12056    status;
12057
12058  assert(wand != (MagickWand *) NULL);
12059  assert(wand->signature == WandSignature);
12060  if (wand->debug != MagickFalse)
12061    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12062  if (wand->images == (Image *) NULL)
12063    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12064  write_info=CloneImageInfo(wand->image_info);
12065  write_info->adjoin=adjoin;
12066  status=WriteImages(write_info,wand->images,filename,wand->exception);
12067  if (status == MagickFalse)
12068    InheritException(wand->exception,&wand->images->exception);
12069  write_info=DestroyImageInfo(write_info);
12070  return(status);
12071}
12072
12073/*
12074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12075%                                                                             %
12076%                                                                             %
12077%                                                                             %
12078%   M a g i c k W r i t e I m a g e s F i l e                                 %
12079%                                                                             %
12080%                                                                             %
12081%                                                                             %
12082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12083%
12084%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12085%
12086%  The format of the MagickWriteImagesFile method is:
12087%
12088%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12089%
12090%  A description of each parameter follows:
12091%
12092%    o wand: the magick wand.
12093%
12094%    o file: the file descriptor.
12095%
12096*/
12097WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12098{
12099  ImageInfo
12100    *write_info;
12101
12102  MagickBooleanType
12103    status;
12104
12105  assert(wand != (MagickWand *) NULL);
12106  assert(wand->signature == WandSignature);
12107  if (wand->debug != MagickFalse)
12108    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12109  if (wand->images == (Image *) NULL)
12110    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12111  write_info=CloneImageInfo(wand->image_info);
12112  SetImageInfoFile(write_info,file);
12113  write_info->adjoin=MagickTrue;
12114  status=WriteImages(write_info,wand->images,(const char *) NULL,
12115    wand->exception);
12116  write_info=DestroyImageInfo(write_info);
12117  if (status == MagickFalse)
12118    InheritException(wand->exception,&wand->images->exception);
12119  return(status);
12120}
12121