magick-image.c revision 27cb26facab1e769acb93effe47d05e57687e14d
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7%                 MM MM  A   A  G        I    C      K  K                     %
8%                 M M M  AAAAA  G GGG    I    C      KKK                      %
9%                 M   M  A   A  G   G    I    C      K  K                     %
10%                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11%                                                                             %
12%                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13%                       I    MM MM  A   A  G      E                           %
14%                       I    M M M  AAAAA  G  GG  EEE                         %
15%                       I    M   M  A   A  G   G  E                           %
16%                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17%                                                                             %
18%                                                                             %
19%                          MagickWand Image Methods                           %
20%                                                                             %
21%                               Software Design                               %
22%                                 John Cristy                                 %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
27%  dedicated to making software imaging solutions freely available.           %
28%                                                                             %
29%  You may not use this file except in compliance with the License.  You may  %
30%  obtain a copy of the License at                                            %
31%                                                                             %
32%    http://www.imagemagick.org/script/license.php                            %
33%                                                                             %
34%  Unless required by applicable law or agreed to in writing, software        %
35%  distributed under the License is distributed on an "AS IS" BASIS,          %
36%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37%  See the License for the specific language governing permissions and        %
38%  limitations under the License.                                             %
39%                                                                             %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47  Include declarations.
48*/
49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
54
55/*
56  Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61    tag,"`%s'",context); \
62  return(MagickFalse); \
63}
64#define MagickWandId  "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68%                                                                             %
69%                                                                             %
70%                                                                             %
71+   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72%                                                                             %
73%                                                                             %
74%                                                                             %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78%  list.
79%
80%  The format of the CloneMagickWandFromImages method is:
81%
82%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83%        Image *images)
84%
85%  A description of each parameter follows:
86%
87%    o wand: the magick wand.
88%
89%    o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93  Image *images)
94{
95  MagickWand
96    *clone_wand;
97
98  assert(wand != (MagickWand *) NULL);
99  assert(wand->signature == WandSignature);
100  if (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,const double bias)
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%    o bias: the bias.
192%
193*/
194WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
195  const double radius,const double sigma,const double bias)
196{
197  Image
198    *sharp_image;
199
200  assert(wand != (MagickWand *) NULL);
201  assert(wand->signature == WandSignature);
202  if (wand->debug != MagickFalse)
203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204  if (wand->images == (Image *) NULL)
205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
206  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
207  if (sharp_image == (Image *) NULL)
208    return(MagickFalse);
209  ReplaceImageInList(&wand->images,sharp_image);
210  return(MagickTrue);
211}
212
213/*
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%                                                                             %
216%                                                                             %
217%                                                                             %
218%   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
219%                                                                             %
220%                                                                             %
221%                                                                             %
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223%
224%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225%  triangulation.
226%
227%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228%        const size_t columns,const size_t rows,
229%        const PixelInterpolateMethod method)
230%
231%  A description of each parameter follows:
232%
233%    o wand: the magick wand.
234%
235%    o columns: the number of columns in the scaled image.
236%
237%    o rows: the number of rows in the scaled image.
238%
239%    o interpolate: the pixel interpolation method.
240%
241*/
242WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
243  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
244{
245  Image
246    *resize_image;
247
248  assert(wand != (MagickWand *) NULL);
249  assert(wand->signature == WandSignature);
250  if (wand->debug != MagickFalse)
251    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
252  if (wand->images == (Image *) NULL)
253    ThrowWandException(WandError,"ContainsNoImages",wand->name);
254  resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
255    wand->exception);
256  if (resize_image == (Image *) NULL)
257    return(MagickFalse);
258  ReplaceImageInList(&wand->images,resize_image);
259  return(MagickTrue);
260}
261
262/*
263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264%                                                                             %
265%                                                                             %
266%                                                                             %
267%   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                       %
268%                                                                             %
269%                                                                             %
270%                                                                             %
271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272%
273%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
274%  more intensely near image edges and less intensely far from edges. We
275%  sharpen the image with a Gaussian operator of the given radius and standard
276%  deviation (sigma).  For reasonable results, radius should be larger than
277%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
278%  suitable radius for you.
279%
280%  The format of the MagickAdaptiveSharpenImage method is:
281%
282%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
283%        const double radius,const double sigma,const double bias)
284%
285%  A description of each parameter follows:
286%
287%    o wand: the magick wand.
288%
289%    o radius: the radius of the Gaussian, in pixels, not counting the center
290%      pixel.
291%
292%    o sigma: the standard deviation of the Gaussian, in pixels.
293%
294%    o bias: the bias.
295%
296*/
297WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
298  const double radius,const double sigma,const double bias)
299{
300  Image
301    *sharp_image;
302
303  assert(wand != (MagickWand *) NULL);
304  assert(wand->signature == WandSignature);
305  if (wand->debug != MagickFalse)
306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
307  if (wand->images == (Image *) NULL)
308    ThrowWandException(WandError,"ContainsNoImages",wand->name);
309  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
310    wand->exception);
311  if (sharp_image == (Image *) NULL)
312    return(MagickFalse);
313  ReplaceImageInList(&wand->images,sharp_image);
314  return(MagickTrue);
315}
316
317/*
318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319%                                                                             %
320%                                                                             %
321%                                                                             %
322%   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                   %
323%                                                                             %
324%                                                                             %
325%                                                                             %
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327%
328%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
329%  based on the range of intensity values in its local neighborhood.  This
330%  allows for thresholding of an image whose global intensity histogram
331%  doesn't contain distinctive peaks.
332%
333%  The format of the AdaptiveThresholdImage method is:
334%
335%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
336%        const size_t width,const size_t height,const double bias)
337%
338%  A description of each parameter follows:
339%
340%    o wand: the magick wand.
341%
342%    o width: the width of the local neighborhood.
343%
344%    o height: the height of the local neighborhood.
345%
346%    o offset: the mean bias.
347%
348*/
349WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
350  const size_t width,const size_t height,const double bias)
351{
352  Image
353    *threshold_image;
354
355  assert(wand != (MagickWand *) NULL);
356  assert(wand->signature == WandSignature);
357  if (wand->debug != MagickFalse)
358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
359  if (wand->images == (Image *) NULL)
360    ThrowWandException(WandError,"ContainsNoImages",wand->name);
361  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
362    wand->exception);
363  if (threshold_image == (Image *) NULL)
364    return(MagickFalse);
365  ReplaceImageInList(&wand->images,threshold_image);
366  return(MagickTrue);
367}
368
369/*
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371%                                                                             %
372%                                                                             %
373%                                                                             %
374%   M a g i c k A d d I m a g e                                               %
375%                                                                             %
376%                                                                             %
377%                                                                             %
378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379%
380%  MagickAddImage() adds a clone of the images in the second wand and
381%  inserts them into the first wand, at the current image location.
382%
383%  Use MagickSetFirstIterator(), to insert new images before all the current
384%  images in the wand, otherwise image is placed after the current image.
385%
386%  The format of the MagickAddImage method is:
387%
388%      MagickBooleanType MagickAddImage(MagickWand *wand,
389%        const MagickWand *add_wand)
390%
391%  A description of each parameter follows:
392%
393%    o wand: the magick wand.
394%
395%    o add_wand: A wand that contains images to add at the current image
396%      location.
397%
398*/
399
400static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
401  Image *images)
402{
403  Image
404    *current;
405
406  current=wand->images;  /* note the current image */
407
408  /* if no images in wand, just add them and set first image as current */
409  if (current == (Image *) NULL)
410    {
411      wand->images=GetFirstImageInList(images);
412      return(MagickTrue);
413    }
414
415  /* user jumped to first image, so prepend new images - remain active */
416  if ((wand->set_first != MagickFalse) &&
417       (current->previous == (Image *) NULL) )
418    {
419      PrependImageToList(&current,images);
420      wand->images=GetFirstImageInList(images);
421      return(MagickTrue);
422    }
423  wand->set_first = MagickFalse; /* flag no longer valid */
424
425  /* Current image was flaged as 'pending' iterative processing. */
426  if (wand->image_pending != MagickFalse)
427    {
428      /* current pending image is the last, append new images */
429      if (current->next == (Image *) NULL)
430        {
431          AppendImageToList(&current,images);
432          wand->images=GetLastImageInList(images);
433          return(MagickTrue);
434        }
435      /* current pending image is the first image, prepend it */
436      if (current->previous == (Image *) NULL)
437        {
438          PrependImageToList(&current,images);
439          wand->images=GetFirstImageInList(images);
440          return(MagickTrue);
441        }
442    }
443
444  /* if at last image append new images */
445  if (current->next == (Image *) NULL)
446    {
447      InsertImageInList(&current,images);
448      wand->images=GetLastImageInList(images);
449      return(MagickTrue);
450    }
451  /* otherwise just insert image, just after the current image */
452  InsertImageInList(&current,images);
453  wand->images=GetFirstImageInList(images);
454  return(MagickTrue);
455}
456
457WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458  const MagickWand *add_wand)
459{
460  Image
461    *images;
462
463  assert(wand != (MagickWand *) NULL);
464  assert(wand->signature == WandSignature);
465  if (wand->debug != MagickFalse)
466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467  assert(add_wand != (MagickWand *) NULL);
468  assert(add_wand->signature == WandSignature);
469  if (add_wand->images == (Image *) NULL)
470    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
471
472  /* clone images in second wand, and insert into first */
473  images=CloneImageList(add_wand->images,wand->exception);
474  if (images == (Image *) NULL)
475    return(MagickFalse);
476  return(InsertImageInWand(wand,images));
477}
478
479/*
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481%                                                                             %
482%                                                                             %
483%                                                                             %
484%     M a g i c k A d d N o i s e I m a g e                                   %
485%                                                                             %
486%                                                                             %
487%                                                                             %
488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489%
490%  MagickAddNoiseImage() adds random noise to the image.
491%
492%  The format of the MagickAddNoiseImage method is:
493%
494%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
495%        const NoiseType noise_type,const double attenuate)
496%
497%  A description of each parameter follows:
498%
499%    o wand: the magick wand.
500%
501%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
502%      Impulse, Laplacian, or Poisson.
503%
504%    o attenuate:  attenuate the random distribution.
505%
506*/
507WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
508  const NoiseType noise_type,const double attenuate)
509{
510  Image
511    *noise_image;
512
513  assert(wand != (MagickWand *) NULL);
514  assert(wand->signature == WandSignature);
515  if (wand->debug != MagickFalse)
516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
517  if (wand->images == (Image *) NULL)
518    ThrowWandException(WandError,"ContainsNoImages",wand->name);
519  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
520  if (noise_image == (Image *) NULL)
521    return(MagickFalse);
522  ReplaceImageInList(&wand->images,noise_image);
523  return(MagickTrue);
524}
525
526/*
527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
528%                                                                             %
529%                                                                             %
530%                                                                             %
531%   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                       %
532%                                                                             %
533%                                                                             %
534%                                                                             %
535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
536%
537%  MagickAffineTransformImage() transforms an image as dictated by the affine
538%  matrix of the drawing wand.
539%
540%  The format of the MagickAffineTransformImage method is:
541%
542%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
543%        const DrawingWand *drawing_wand)
544%
545%  A description of each parameter follows:
546%
547%    o wand: the magick wand.
548%
549%    o drawing_wand: the draw wand.
550%
551*/
552WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
553  const DrawingWand *drawing_wand)
554{
555  DrawInfo
556    *draw_info;
557
558  Image
559    *affine_image;
560
561  assert(wand != (MagickWand *) NULL);
562  assert(wand->signature == WandSignature);
563  if (wand->debug != MagickFalse)
564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
565  if (wand->images == (Image *) NULL)
566    ThrowWandException(WandError,"ContainsNoImages",wand->name);
567  draw_info=PeekDrawingWand(drawing_wand);
568  if (draw_info == (DrawInfo *) NULL)
569    return(MagickFalse);
570  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
571    wand->exception);
572  draw_info=DestroyDrawInfo(draw_info);
573  if (affine_image == (Image *) NULL)
574    return(MagickFalse);
575  ReplaceImageInList(&wand->images,affine_image);
576  return(MagickTrue);
577}
578
579/*
580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581%                                                                             %
582%                                                                             %
583%                                                                             %
584%   M a g i c k A n n o t a t e I m a g e                                     %
585%                                                                             %
586%                                                                             %
587%                                                                             %
588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589%
590%  MagickAnnotateImage() annotates an image with text.
591%
592%  The format of the MagickAnnotateImage method is:
593%
594%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
595%        const DrawingWand *drawing_wand,const double x,const double y,
596%        const double angle,const char *text)
597%
598%  A description of each parameter follows:
599%
600%    o wand: the magick wand.
601%
602%    o drawing_wand: the draw wand.
603%
604%    o x: x ordinate to left of text
605%
606%    o y: y ordinate to text baseline
607%
608%    o angle: rotate text relative to this angle.
609%
610%    o text: text to draw
611%
612*/
613WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
614  const DrawingWand *drawing_wand,const double x,const double y,
615  const double angle,const char *text)
616{
617  char
618    geometry[MaxTextExtent];
619
620  DrawInfo
621    *draw_info;
622
623  MagickBooleanType
624    status;
625
626  assert(wand != (MagickWand *) NULL);
627  assert(wand->signature == WandSignature);
628  if (wand->debug != MagickFalse)
629    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
630  if (wand->images == (Image *) NULL)
631    ThrowWandException(WandError,"ContainsNoImages",wand->name);
632  draw_info=PeekDrawingWand(drawing_wand);
633  if (draw_info == (DrawInfo *) NULL)
634    return(MagickFalse);
635  (void) CloneString(&draw_info->text,text);
636  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
637  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
638  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
639  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
640  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
641  (void) CloneString(&draw_info->geometry,geometry);
642  status=AnnotateImage(wand->images,draw_info,wand->exception);
643  draw_info=DestroyDrawInfo(draw_info);
644  return(status);
645}
646
647/*
648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649%                                                                             %
650%                                                                             %
651%                                                                             %
652%   M a g i c k A n i m a t e I m a g e s                                     %
653%                                                                             %
654%                                                                             %
655%                                                                             %
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657%
658%  MagickAnimateImages() animates an image or image sequence.
659%
660%  The format of the MagickAnimateImages method is:
661%
662%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
663%        const char *server_name)
664%
665%  A description of each parameter follows:
666%
667%    o wand: the magick wand.
668%
669%    o server_name: the X server name.
670%
671*/
672WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
673  const char *server_name)
674{
675  MagickBooleanType
676    status;
677
678  assert(wand != (MagickWand *) NULL);
679  assert(wand->signature == WandSignature);
680  if (wand->debug != MagickFalse)
681    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
682  (void) CloneString(&wand->image_info->server_name,server_name);
683  status=AnimateImages(wand->image_info,wand->images,wand->exception);
684  return(status);
685}
686
687/*
688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689%                                                                             %
690%                                                                             %
691%                                                                             %
692%   M a g i c k A p p e n d I m a g e s                                       %
693%                                                                             %
694%                                                                             %
695%                                                                             %
696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697%
698%  MagickAppendImages() append a set of images.
699%
700%  The format of the MagickAppendImages method is:
701%
702%      MagickWand *MagickAppendImages(MagickWand *wand,
703%        const MagickBooleanType stack)
704%
705%  A description of each parameter follows:
706%
707%    o wand: the magick wand.
708%
709%    o stack: By default, images are stacked left-to-right. Set stack to
710%      MagickTrue to stack them top-to-bottom.
711%
712*/
713WandExport MagickWand *MagickAppendImages(MagickWand *wand,
714  const MagickBooleanType stack)
715{
716  Image
717    *append_image;
718
719  assert(wand != (MagickWand *) NULL);
720  assert(wand->signature == WandSignature);
721  if (wand->debug != MagickFalse)
722    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
723  if (wand->images == (Image *) NULL)
724    return((MagickWand *) NULL);
725  append_image=AppendImages(wand->images,stack,wand->exception);
726  if (append_image == (Image *) NULL)
727    return((MagickWand *) NULL);
728  return(CloneMagickWandFromImages(wand,append_image));
729}
730
731/*
732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
733%                                                                             %
734%                                                                             %
735%                                                                             %
736%   M a g i c k A u t o G a m m a I m a g e                                   %
737%                                                                             %
738%                                                                             %
739%                                                                             %
740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741%
742%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
743%  image to try make set its gamma appropriatally.
744%
745%  The format of the MagickAutoGammaImage method is:
746%
747%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
748%
749%  A description of each parameter follows:
750%
751%    o wand: the magick wand.
752%
753*/
754WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
755{
756  MagickBooleanType
757    status;
758
759  assert(wand != (MagickWand *) NULL);
760  assert(wand->signature == WandSignature);
761  if (wand->debug != MagickFalse)
762    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
763  if (wand->images == (Image *) NULL)
764    ThrowWandException(WandError,"ContainsNoImages",wand->name);
765  status=AutoGammaImage(wand->images,wand->exception);
766  return(status);
767}
768
769/*
770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771%                                                                             %
772%                                                                             %
773%                                                                             %
774%   M a g i c k A u t o L e v e l I m a g e                                   %
775%                                                                             %
776%                                                                             %
777%                                                                             %
778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779%
780%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
781%  scaling the minimum and maximum values to the full quantum range.
782%
783%  The format of the MagickAutoLevelImage method is:
784%
785%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
786%
787%  A description of each parameter follows:
788%
789%    o wand: the magick wand.
790%
791*/
792WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
793{
794  MagickBooleanType
795    status;
796
797  assert(wand != (MagickWand *) NULL);
798  assert(wand->signature == WandSignature);
799  if (wand->debug != MagickFalse)
800    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
801  if (wand->images == (Image *) NULL)
802    ThrowWandException(WandError,"ContainsNoImages",wand->name);
803  status=AutoLevelImage(wand->images,wand->exception);
804  return(status);
805}
806
807/*
808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809%                                                                             %
810%                                                                             %
811%                                                                             %
812%   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                         %
813%                                                                             %
814%                                                                             %
815%                                                                             %
816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817%
818%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
819%  pixels below the threshold into black while leaving all pixels above the
820%  threshold unchanged.
821%
822%  The format of the MagickBlackThresholdImage method is:
823%
824%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
825%        const PixelWand *threshold)
826%
827%  A description of each parameter follows:
828%
829%    o wand: the magick wand.
830%
831%    o threshold: the pixel wand.
832%
833*/
834WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
835  const PixelWand *threshold)
836{
837  char
838    thresholds[MaxTextExtent];
839
840  MagickBooleanType
841    status;
842
843  assert(wand != (MagickWand *) NULL);
844  assert(wand->signature == WandSignature);
845  if (wand->debug != MagickFalse)
846    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847  if (wand->images == (Image *) NULL)
848    ThrowWandException(WandError,"ContainsNoImages",wand->name);
849  (void) FormatLocaleString(thresholds,MaxTextExtent,
850    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
851    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
852    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
853  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
854  return(status);
855}
856
857/*
858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859%                                                                             %
860%                                                                             %
861%                                                                             %
862%   M a g i c k B l u e S h i f t I m a g e                                   %
863%                                                                             %
864%                                                                             %
865%                                                                             %
866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
867%
868%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
869%  nighttime in the moonlight.
870%
871%  The format of the MagickBlueShiftImage method is:
872%
873%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
874%        const double factor)
875%
876%  A description of each parameter follows:
877%
878%    o wand: the magick wand.
879%
880%    o factor: the blue shift factor (default 1.5)
881%
882*/
883WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
884  const double factor)
885{
886  Image
887    *shift_image;
888
889  assert(wand != (MagickWand *) NULL);
890  assert(wand->signature == WandSignature);
891  if (wand->debug != MagickFalse)
892    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
893  if (wand->images == (Image *) NULL)
894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
895  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
896  if (shift_image == (Image *) NULL)
897    return(MagickFalse);
898  ReplaceImageInList(&wand->images,shift_image);
899  return(MagickTrue);
900}
901
902/*
903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904%                                                                             %
905%                                                                             %
906%                                                                             %
907%   M a g i c k B l u r I m a g e                                             %
908%                                                                             %
909%                                                                             %
910%                                                                             %
911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912%
913%  MagickBlurImage() blurs an image.  We convolve the image with a
914%  gaussian operator of the given radius and standard deviation (sigma).
915%  For reasonable results, the radius should be larger than sigma.  Use a
916%  radius of 0 and BlurImage() selects a suitable radius for you.
917%
918%  The format of the MagickBlurImage method is:
919%
920%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
921%        const double sigmaconst double bias)
922%
923%  A description of each parameter follows:
924%
925%    o wand: the magick wand.
926%
927%    o radius: the radius of the , in pixels, not counting the center
928%      pixel.
929%
930%    o sigma: the standard deviation of the , in pixels.
931%
932%    o bias: the bias.
933%
934*/
935WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
936  const double radius,const double sigma,const double bias)
937{
938  Image
939    *blur_image;
940
941  assert(wand != (MagickWand *) NULL);
942  assert(wand->signature == WandSignature);
943  if (wand->debug != MagickFalse)
944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
945  if (wand->images == (Image *) NULL)
946    ThrowWandException(WandError,"ContainsNoImages",wand->name);
947  blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
948  if (blur_image == (Image *) NULL)
949    return(MagickFalse);
950  ReplaceImageInList(&wand->images,blur_image);
951  return(MagickTrue);
952}
953
954/*
955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956%                                                                             %
957%                                                                             %
958%                                                                             %
959%   M a g i c k B o r d e r I m a g e                                         %
960%                                                                             %
961%                                                                             %
962%                                                                             %
963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
964%
965%  MagickBorderImage() surrounds the image with a border of the color defined
966%  by the bordercolor pixel wand.
967%
968%  The format of the MagickBorderImage method is:
969%
970%      MagickBooleanType MagickBorderImage(MagickWand *wand,
971%        const PixelWand *bordercolor,const size_t width,
972%        const size_t height,const CompositeOperator compose)
973%
974%  A description of each parameter follows:
975%
976%    o wand: the magick wand.
977%
978%    o bordercolor: the border color pixel wand.
979%
980%    o width: the border width.
981%
982%    o height: the border height.
983%
984%    o compose: the composite operator.
985%
986*/
987WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
988  const PixelWand *bordercolor,const size_t width,const size_t height,
989  const CompositeOperator compose)
990{
991  Image
992    *border_image;
993
994  RectangleInfo
995    border_info;
996
997  assert(wand != (MagickWand *) NULL);
998  assert(wand->signature == WandSignature);
999  if (wand->debug != MagickFalse)
1000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1001  if (wand->images == (Image *) NULL)
1002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1003  border_info.width=width;
1004  border_info.height=height;
1005  border_info.x=0;
1006  border_info.y=0;
1007  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1008  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1009  if (border_image == (Image *) NULL)
1010    return(MagickFalse);
1011  ReplaceImageInList(&wand->images,border_image);
1012  return(MagickTrue);
1013}
1014
1015/*
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017%                                                                             %
1018%                                                                             %
1019%                                                                             %
1020%   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
1021%                                                                             %
1022%                                                                             %
1023%                                                                             %
1024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025%
1026%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1027%  of an image.  It converts the brightness and contrast parameters into slope
1028%  and intercept and calls a polynomical function to apply to the image.
1029
1030%
1031%  The format of the MagickBrightnessContrastImage method is:
1032%
1033%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1034%        const double brightness,const double contrast)
1035%
1036%  A description of each parameter follows:
1037%
1038%    o wand: the magick wand.
1039%
1040%    o brightness: the brightness percent (-100 .. 100).
1041%
1042%    o contrast: the contrast percent (-100 .. 100).
1043%
1044*/
1045WandExport MagickBooleanType MagickBrightnessContrastImage(
1046  MagickWand *wand,const double brightness,const double contrast)
1047{
1048  MagickBooleanType
1049    status;
1050
1051  assert(wand != (MagickWand *) NULL);
1052  assert(wand->signature == WandSignature);
1053  if (wand->debug != MagickFalse)
1054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1055  if (wand->images == (Image *) NULL)
1056    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1057  status=BrightnessContrastImage(wand->images,brightness,contrast,
1058    wand->exception);
1059  return(status);
1060}
1061
1062/*
1063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1064%                                                                             %
1065%                                                                             %
1066%                                                                             %
1067%   M a g i c k C h a r c o a l I m a g e                                     %
1068%                                                                             %
1069%                                                                             %
1070%                                                                             %
1071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1072%
1073%  MagickCharcoalImage() simulates a charcoal drawing.
1074%
1075%  The format of the MagickCharcoalImage method is:
1076%
1077%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1078%        const double radius,const double sigma,const double bias)
1079%
1080%  A description of each parameter follows:
1081%
1082%    o wand: the magick wand.
1083%
1084%    o radius: the radius of the Gaussian, in pixels, not counting the center
1085%      pixel.
1086%
1087%    o sigma: the standard deviation of the Gaussian, in pixels.
1088%
1089%    o bias: the bias.
1090%
1091*/
1092WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1093  const double radius,const double sigma,const double bias)
1094{
1095  Image
1096    *charcoal_image;
1097
1098  assert(wand != (MagickWand *) NULL);
1099  assert(wand->signature == WandSignature);
1100  if (wand->debug != MagickFalse)
1101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1102  if (wand->images == (Image *) NULL)
1103    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1104  charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1105  if (charcoal_image == (Image *) NULL)
1106    return(MagickFalse);
1107  ReplaceImageInList(&wand->images,charcoal_image);
1108  return(MagickTrue);
1109}
1110
1111/*
1112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1113%                                                                             %
1114%                                                                             %
1115%                                                                             %
1116%   M a g i c k C h o p I m a g e                                             %
1117%                                                                             %
1118%                                                                             %
1119%                                                                             %
1120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121%
1122%  MagickChopImage() removes a region of an image and collapses the image to
1123%  occupy the removed portion
1124%
1125%  The format of the MagickChopImage method is:
1126%
1127%      MagickBooleanType MagickChopImage(MagickWand *wand,
1128%        const size_t width,const size_t height,const ssize_t x,
1129%        const ssize_t y)
1130%
1131%  A description of each parameter follows:
1132%
1133%    o wand: the magick wand.
1134%
1135%    o width: the region width.
1136%
1137%    o height: the region height.
1138%
1139%    o x: the region x offset.
1140%
1141%    o y: the region y offset.
1142%
1143%
1144*/
1145WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1146  const size_t width,const size_t height,const ssize_t x,
1147  const ssize_t y)
1148{
1149  Image
1150    *chop_image;
1151
1152  RectangleInfo
1153    chop;
1154
1155  assert(wand != (MagickWand *) NULL);
1156  assert(wand->signature == WandSignature);
1157  if (wand->debug != MagickFalse)
1158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1159  if (wand->images == (Image *) NULL)
1160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1161  chop.width=width;
1162  chop.height=height;
1163  chop.x=x;
1164  chop.y=y;
1165  chop_image=ChopImage(wand->images,&chop,wand->exception);
1166  if (chop_image == (Image *) NULL)
1167    return(MagickFalse);
1168  ReplaceImageInList(&wand->images,chop_image);
1169  return(MagickTrue);
1170}
1171
1172/*
1173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1174%                                                                             %
1175%                                                                             %
1176%                                                                             %
1177%   M a g i c k C l a m p I m a g e                                           %
1178%                                                                             %
1179%                                                                             %
1180%                                                                             %
1181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182%
1183%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1184%
1185%  The format of the MagickClampImage method is:
1186%
1187%      MagickBooleanType MagickClampImage(MagickWand *wand)
1188%
1189%  A description of each parameter follows:
1190%
1191%    o wand: the magick wand.
1192%
1193%    o channel: the channel.
1194%
1195*/
1196WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1197{
1198  assert(wand != (MagickWand *) NULL);
1199  assert(wand->signature == WandSignature);
1200  if (wand->debug != MagickFalse)
1201    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1202  if (wand->images == (Image *) NULL)
1203    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1204  return(ClampImage(wand->images,wand->exception));
1205}
1206
1207/*
1208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209%                                                                             %
1210%                                                                             %
1211%                                                                             %
1212%   M a g i c k C l i p I m a g e                                             %
1213%                                                                             %
1214%                                                                             %
1215%                                                                             %
1216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1217%
1218%  MagickClipImage() clips along the first path from the 8BIM profile, if
1219%  present.
1220%
1221%  The format of the MagickClipImage method is:
1222%
1223%      MagickBooleanType MagickClipImage(MagickWand *wand)
1224%
1225%  A description of each parameter follows:
1226%
1227%    o wand: the magick wand.
1228%
1229*/
1230WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1231{
1232  MagickBooleanType
1233    status;
1234
1235  assert(wand != (MagickWand *) NULL);
1236  assert(wand->signature == WandSignature);
1237  if (wand->debug != MagickFalse)
1238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239  if (wand->images == (Image *) NULL)
1240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241  status=ClipImage(wand->images,wand->exception);
1242  return(status);
1243}
1244
1245/*
1246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1247%                                                                             %
1248%                                                                             %
1249%                                                                             %
1250%   M a g i c k C l i p I m a g e P a t h                                     %
1251%                                                                             %
1252%                                                                             %
1253%                                                                             %
1254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1255%
1256%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1257%  present. Later operations take effect inside the path.  Id may be a number
1258%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1259%  path.
1260%
1261%  The format of the MagickClipImagePath method is:
1262%
1263%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1264%        const char *pathname,const MagickBooleanType inside)
1265%
1266%  A description of each parameter follows:
1267%
1268%    o wand: the magick wand.
1269%
1270%    o pathname: name of clipping path resource. If name is preceded by #, use
1271%      clipping path numbered by name.
1272%
1273%    o inside: if non-zero, later operations take effect inside clipping path.
1274%      Otherwise later operations take effect outside clipping path.
1275%
1276*/
1277WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1278  const char *pathname,const MagickBooleanType inside)
1279{
1280  MagickBooleanType
1281    status;
1282
1283  assert(wand != (MagickWand *) NULL);
1284  assert(wand->signature == WandSignature);
1285  if (wand->debug != MagickFalse)
1286    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1287  if (wand->images == (Image *) NULL)
1288    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1289  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1290  return(status);
1291}
1292
1293/*
1294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295%                                                                             %
1296%                                                                             %
1297%                                                                             %
1298%   M a g i c k C l u t I m a g e                                             %
1299%                                                                             %
1300%                                                                             %
1301%                                                                             %
1302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303%
1304%  MagickClutImage() replaces colors in the image from a color lookup table.
1305%
1306%  The format of the MagickClutImage method is:
1307%
1308%      MagickBooleanType MagickClutImage(MagickWand *wand,
1309%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1310%
1311%  A description of each parameter follows:
1312%
1313%    o wand: the magick wand.
1314%
1315%    o clut_image: the clut image.
1316%
1317%    o method: the pixel interpolation method.
1318%
1319*/
1320WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1321  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1322{
1323  MagickBooleanType
1324    status;
1325
1326  assert(wand != (MagickWand *) NULL);
1327  assert(wand->signature == WandSignature);
1328  if (wand->debug != MagickFalse)
1329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1330  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1331    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1332  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1333  return(status);
1334}
1335
1336/*
1337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1338%                                                                             %
1339%                                                                             %
1340%                                                                             %
1341%   M a g i c k C o a l e s c e I m a g e s                                   %
1342%                                                                             %
1343%                                                                             %
1344%                                                                             %
1345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346%
1347%  MagickCoalesceImages() composites a set of images while respecting any page
1348%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1349%  typically start with an image background and each subsequent image
1350%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1351%  where each image in the sequence is the same size as the first and
1352%  composited with the next image in the sequence.
1353%
1354%  The format of the MagickCoalesceImages method is:
1355%
1356%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1357%
1358%  A description of each parameter follows:
1359%
1360%    o wand: the magick wand.
1361%
1362*/
1363WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1364{
1365  Image
1366    *coalesce_image;
1367
1368  assert(wand != (MagickWand *) NULL);
1369  assert(wand->signature == WandSignature);
1370  if (wand->debug != MagickFalse)
1371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1372  if (wand->images == (Image *) NULL)
1373    return((MagickWand *) NULL);
1374  coalesce_image=CoalesceImages(wand->images,wand->exception);
1375  if (coalesce_image == (Image *) NULL)
1376    return((MagickWand *) NULL);
1377  return(CloneMagickWandFromImages(wand,coalesce_image));
1378}
1379
1380/*
1381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1382%                                                                             %
1383%                                                                             %
1384%                                                                             %
1385%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1386%                                                                             %
1387%                                                                             %
1388%                                                                             %
1389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1390%
1391%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1392%  Collection (CCC) file which solely contains one or more color corrections
1393%  and applies the color correction to the image.  Here is a sample CCC file:
1394%
1395%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1396%          <ColorCorrection id="cc03345">
1397%                <SOPNode>
1398%                     <Slope> 0.9 1.2 0.5 </Slope>
1399%                     <Offset> 0.4 -0.5 0.6 </Offset>
1400%                     <Power> 1.0 0.8 1.5 </Power>
1401%                </SOPNode>
1402%                <SATNode>
1403%                     <Saturation> 0.85 </Saturation>
1404%                </SATNode>
1405%          </ColorCorrection>
1406%    </ColorCorrectionCollection>
1407%
1408%  which includes the offset, slope, and power for each of the RGB channels
1409%  as well as the saturation.
1410%
1411%  The format of the MagickColorDecisionListImage method is:
1412%
1413%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1414%        const double gamma)
1415%
1416%  A description of each parameter follows:
1417%
1418%    o wand: the magick wand.
1419%
1420%    o color_correction_collection: the color correction collection in XML.
1421%
1422*/
1423WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1424  const char *color_correction_collection)
1425{
1426  MagickBooleanType
1427    status;
1428
1429  assert(wand != (MagickWand *) NULL);
1430  assert(wand->signature == WandSignature);
1431  if (wand->debug != MagickFalse)
1432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1433  if (wand->images == (Image *) NULL)
1434    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1435  status=ColorDecisionListImage(wand->images,color_correction_collection,
1436    wand->exception);
1437  return(status);
1438}
1439
1440/*
1441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1442%                                                                             %
1443%                                                                             %
1444%                                                                             %
1445%   M a g i c k C o l o r i z e I m a g e                                     %
1446%                                                                             %
1447%                                                                             %
1448%                                                                             %
1449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1450%
1451%  MagickColorizeImage() blends the fill color with each pixel in the image.
1452%
1453%  The format of the MagickColorizeImage method is:
1454%
1455%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1456%        const PixelWand *colorize,const PixelWand *blend)
1457%
1458%  A description of each parameter follows:
1459%
1460%    o wand: the magick wand.
1461%
1462%    o colorize: the colorize pixel wand.
1463%
1464%    o alpha: the alpha pixel wand.
1465%
1466*/
1467WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1468  const PixelWand *colorize,const PixelWand *blend)
1469{
1470  char
1471    percent_blend[MaxTextExtent];
1472
1473  Image
1474    *colorize_image;
1475
1476  PixelInfo
1477    target;
1478
1479  assert(wand != (MagickWand *) NULL);
1480  assert(wand->signature == WandSignature);
1481  if (wand->debug != MagickFalse)
1482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1483  if (wand->images == (Image *) NULL)
1484    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1485  GetPixelInfo(wand->images,&target);
1486  if (target.colorspace != CMYKColorspace)
1487    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1488      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1489      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1490      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1491      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1492      PixelGetAlphaQuantum(blend)));
1493  else
1494    (void) FormatLocaleString(percent_blend,MaxTextExtent,
1495      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1496      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1497      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1498      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1499      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1500      PixelGetAlphaQuantum(blend)));
1501  target=PixelGetPixel(colorize);
1502  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1503    wand->exception);
1504  if (colorize_image == (Image *) NULL)
1505    return(MagickFalse);
1506  ReplaceImageInList(&wand->images,colorize_image);
1507  return(MagickTrue);
1508}
1509
1510/*
1511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512%                                                                             %
1513%                                                                             %
1514%                                                                             %
1515%   M a g i c k C o l o r M a t r i x I m a g e                               %
1516%                                                                             %
1517%                                                                             %
1518%                                                                             %
1519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520%
1521%  MagickColorMatrixImage() apply color transformation to an image. The method
1522%  permits saturation changes, hue rotation, luminance to alpha, and various
1523%  other effects.  Although variable-sized transformation matrices can be used,
1524%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1525%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1526%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1527%  and offsets are normalized (divide Flash offset by 255).
1528%
1529%  The format of the MagickColorMatrixImage method is:
1530%
1531%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1532%        const KernelInfo *color_matrix)
1533%
1534%  A description of each parameter follows:
1535%
1536%    o wand: the magick wand.
1537%
1538%    o color_matrix:  the color matrix.
1539%
1540*/
1541WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1542  const KernelInfo *color_matrix)
1543{
1544  Image
1545    *color_image;
1546
1547  assert(wand != (MagickWand *) NULL);
1548  assert(wand->signature == WandSignature);
1549  if (wand->debug != MagickFalse)
1550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1551  if (color_matrix == (const KernelInfo *) NULL)
1552    return(MagickFalse);
1553  if (wand->images == (Image *) NULL)
1554    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1555  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1556  if (color_image == (Image *) NULL)
1557    return(MagickFalse);
1558  ReplaceImageInList(&wand->images,color_image);
1559  return(MagickTrue);
1560}
1561
1562/*
1563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564%                                                                             %
1565%                                                                             %
1566%                                                                             %
1567%   M a g i c k C o m b i n e I m a g e s                                     %
1568%                                                                             %
1569%                                                                             %
1570%                                                                             %
1571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572%
1573%  MagickCombineImages() combines one or more images into a single image.  The
1574%  grayscale value of the pixels of each image in the sequence is assigned in
1575%  order to the specified  hannels of the combined image.   The typical
1576%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1577%
1578%  The format of the MagickCombineImages method is:
1579%
1580%      MagickWand *MagickCombineImages(MagickWand *wand)
1581%
1582%  A description of each parameter follows:
1583%
1584%    o wand: the magick wand.
1585%
1586*/
1587WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1588{
1589  Image
1590    *combine_image;
1591
1592  assert(wand != (MagickWand *) NULL);
1593  assert(wand->signature == WandSignature);
1594  if (wand->debug != MagickFalse)
1595    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1596  if (wand->images == (Image *) NULL)
1597    return((MagickWand *) NULL);
1598  combine_image=CombineImages(wand->images,wand->exception);
1599  if (combine_image == (Image *) NULL)
1600    return((MagickWand *) NULL);
1601  return(CloneMagickWandFromImages(wand,combine_image));
1602}
1603
1604/*
1605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1606%                                                                             %
1607%                                                                             %
1608%                                                                             %
1609%   M a g i c k C o m m e n t I m a g e                                       %
1610%                                                                             %
1611%                                                                             %
1612%                                                                             %
1613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614%
1615%  MagickCommentImage() adds a comment to your image.
1616%
1617%  The format of the MagickCommentImage method is:
1618%
1619%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1620%        const char *comment)
1621%
1622%  A description of each parameter follows:
1623%
1624%    o wand: the magick wand.
1625%
1626%    o comment: the image comment.
1627%
1628*/
1629WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1630  const char *comment)
1631{
1632  MagickBooleanType
1633    status;
1634
1635  assert(wand != (MagickWand *) NULL);
1636  assert(wand->signature == WandSignature);
1637  if (wand->debug != MagickFalse)
1638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1639  if (wand->images == (Image *) NULL)
1640    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1641  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1642  return(status);
1643}
1644
1645/*
1646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1647%                                                                             %
1648%                                                                             %
1649%                                                                             %
1650%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1651%                                                                             %
1652%                                                                             %
1653%                                                                             %
1654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655%
1656%  MagickCompareImagesLayers() compares each image with the next in a sequence
1657%  and returns the maximum bounding region of any pixel differences it
1658%  discovers.
1659%
1660%  The format of the MagickCompareImagesLayers method is:
1661%
1662%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1663%        const ImageLayerMethod method)
1664%
1665%  A description of each parameter follows:
1666%
1667%    o wand: the magick wand.
1668%
1669%    o method: the compare method.
1670%
1671*/
1672WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1673  const ImageLayerMethod method)
1674{
1675  Image
1676    *layers_image;
1677
1678  assert(wand != (MagickWand *) NULL);
1679  assert(wand->signature == WandSignature);
1680  if (wand->debug != MagickFalse)
1681    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1682  if (wand->images == (Image *) NULL)
1683    return((MagickWand *) NULL);
1684  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1685  if (layers_image == (Image *) NULL)
1686    return((MagickWand *) NULL);
1687  return(CloneMagickWandFromImages(wand,layers_image));
1688}
1689
1690/*
1691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1692%                                                                             %
1693%                                                                             %
1694%                                                                             %
1695%   M a g i c k C o m p a r e I m a g e s                                     %
1696%                                                                             %
1697%                                                                             %
1698%                                                                             %
1699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1700%
1701%  MagickCompareImages() compares an image to a reconstructed image and returns
1702%  the specified difference image.
1703%
1704%  The format of the MagickCompareImages method is:
1705%
1706%      MagickWand *MagickCompareImages(MagickWand *wand,
1707%        const MagickWand *reference,const MetricType metric,
1708%        double *distortion)
1709%
1710%  A description of each parameter follows:
1711%
1712%    o wand: the magick wand.
1713%
1714%    o reference: the reference wand.
1715%
1716%    o metric: the metric.
1717%
1718%    o distortion: the computed distortion between the images.
1719%
1720*/
1721WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1722  const MagickWand *reference,const MetricType metric,double *distortion)
1723{
1724  Image
1725    *compare_image;
1726
1727
1728  assert(wand != (MagickWand *) NULL);
1729  assert(wand->signature == WandSignature);
1730  if (wand->debug != MagickFalse)
1731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1732  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1733    {
1734      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1735        "ContainsNoImages","`%s'",wand->name);
1736      return((MagickWand *) NULL);
1737    }
1738  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1739    wand->exception);
1740  if (compare_image == (Image *) NULL)
1741    return((MagickWand *) NULL);
1742  return(CloneMagickWandFromImages(wand,compare_image));
1743}
1744
1745/*
1746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1747%                                                                             %
1748%                                                                             %
1749%                                                                             %
1750%   M a g i c k C o m p o s i t e I m a g e                                   %
1751%                                                                             %
1752%                                                                             %
1753%                                                                             %
1754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1755%
1756%  MagickCompositeImage() composite one image onto another at the specified
1757%  offset.
1758%
1759%  The format of the MagickCompositeImage method is:
1760%
1761%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1762%        const MagickWand *composite_wand,const CompositeOperator compose,
1763%        const ssize_t x,const ssize_t y)
1764%
1765%  A description of each parameter follows:
1766%
1767%    o wand: the magick wand.
1768%
1769%    o composite_image: the composite image.
1770%
1771%    o compose: This operator affects how the composite is applied to the
1772%      image.  The default is Over.  Choose from these operators:
1773%
1774%        OverCompositeOp       InCompositeOp         OutCompositeOp
1775%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1776%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1777%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1778%        DisplaceCompositeOp
1779%
1780%    o x: the column offset of the composited image.
1781%
1782%    o y: the row offset of the composited image.
1783%
1784*/
1785WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1786  const MagickWand *composite_wand,const CompositeOperator compose,
1787  const ssize_t x,const ssize_t y)
1788{
1789  MagickBooleanType
1790    status;
1791
1792  assert(wand != (MagickWand *) NULL);
1793  assert(wand->signature == WandSignature);
1794  if (wand->debug != MagickFalse)
1795    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1796  if ((wand->images == (Image *) NULL) ||
1797      (composite_wand->images == (Image *) NULL))
1798    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1799  status=CompositeImage(wand->images,compose,composite_wand->images,x,y,
1800    wand->exception);
1801  return(status);
1802}
1803
1804/*
1805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806%                                                                             %
1807%                                                                             %
1808%                                                                             %
1809%   M a g i c k C o n t r a s t I m a g e                                     %
1810%                                                                             %
1811%                                                                             %
1812%                                                                             %
1813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1814%
1815%  MagickContrastImage() enhances the intensity differences between the lighter
1816%  and darker elements of the image.  Set sharpen to a value other than 0 to
1817%  increase the image contrast otherwise the contrast is reduced.
1818%
1819%  The format of the MagickContrastImage method is:
1820%
1821%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1822%        const MagickBooleanType sharpen)
1823%
1824%  A description of each parameter follows:
1825%
1826%    o wand: the magick wand.
1827%
1828%    o sharpen: Increase or decrease image contrast.
1829%
1830%
1831*/
1832WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1833  const MagickBooleanType sharpen)
1834{
1835  MagickBooleanType
1836    status;
1837
1838  assert(wand != (MagickWand *) NULL);
1839  assert(wand->signature == WandSignature);
1840  if (wand->debug != MagickFalse)
1841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1842  if (wand->images == (Image *) NULL)
1843    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1844  status=ContrastImage(wand->images,sharpen,wand->exception);
1845  return(status);
1846}
1847
1848/*
1849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850%                                                                             %
1851%                                                                             %
1852%                                                                             %
1853%   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                       %
1854%                                                                             %
1855%                                                                             %
1856%                                                                             %
1857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858%
1859%  MagickContrastStretchImage() enhances the contrast of a color image by
1860%  adjusting the pixels color to span the entire range of colors available.
1861%  You can also reduce the influence of a particular channel with a gamma
1862%  value of 0.
1863%
1864%  The format of the MagickContrastStretchImage method is:
1865%
1866%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1867%        const double black_point,const double white_point)
1868%
1869%  A description of each parameter follows:
1870%
1871%    o wand: the magick wand.
1872%
1873%    o black_point: the black point.
1874%
1875%    o white_point: the white point.
1876%
1877*/
1878WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1879  const double black_point,const double white_point)
1880{
1881  MagickBooleanType
1882    status;
1883
1884  assert(wand != (MagickWand *) NULL);
1885  assert(wand->signature == WandSignature);
1886  if (wand->debug != MagickFalse)
1887    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1888  if (wand->images == (Image *) NULL)
1889    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1890  status=ContrastStretchImage(wand->images,black_point,white_point,
1891    wand->exception);
1892  return(status);
1893}
1894
1895/*
1896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1897%                                                                             %
1898%                                                                             %
1899%                                                                             %
1900%   M a g i c k C o n v o l v e I m a g e                                     %
1901%                                                                             %
1902%                                                                             %
1903%                                                                             %
1904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1905%
1906%  MagickConvolveImage() applies a custom convolution kernel to the image.
1907%
1908%  The format of the MagickConvolveImage method is:
1909%
1910%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1911%        const KernelInfo *kernel)
1912%
1913%  A description of each parameter follows:
1914%
1915%    o wand: the magick wand.
1916%
1917%    o kernel: An array of doubles representing the convolution kernel.
1918%
1919*/
1920WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1921  const KernelInfo *kernel)
1922{
1923  Image
1924    *filter_image;
1925
1926  assert(wand != (MagickWand *) NULL);
1927  assert(wand->signature == WandSignature);
1928  if (wand->debug != MagickFalse)
1929    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1930  if (kernel == (const KernelInfo *) NULL)
1931    return(MagickFalse);
1932  if (wand->images == (Image *) NULL)
1933    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1934  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1935  if (filter_image == (Image *) NULL)
1936    return(MagickFalse);
1937  ReplaceImageInList(&wand->images,filter_image);
1938  return(MagickTrue);
1939}
1940
1941/*
1942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1943%                                                                             %
1944%                                                                             %
1945%                                                                             %
1946%   M a g i c k C r o p I m a g e                                             %
1947%                                                                             %
1948%                                                                             %
1949%                                                                             %
1950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1951%
1952%  MagickCropImage() extracts a region of the image.
1953%
1954%  The format of the MagickCropImage method is:
1955%
1956%      MagickBooleanType MagickCropImage(MagickWand *wand,
1957%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1958%
1959%  A description of each parameter follows:
1960%
1961%    o wand: the magick wand.
1962%
1963%    o width: the region width.
1964%
1965%    o height: the region height.
1966%
1967%    o x: the region x-offset.
1968%
1969%    o y: the region y-offset.
1970%
1971*/
1972WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1973  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1974{
1975  Image
1976    *crop_image;
1977
1978  RectangleInfo
1979    crop;
1980
1981  assert(wand != (MagickWand *) NULL);
1982  assert(wand->signature == WandSignature);
1983  if (wand->debug != MagickFalse)
1984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1985  if (wand->images == (Image *) NULL)
1986    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1987  crop.width=width;
1988  crop.height=height;
1989  crop.x=x;
1990  crop.y=y;
1991  crop_image=CropImage(wand->images,&crop,wand->exception);
1992  if (crop_image == (Image *) NULL)
1993    return(MagickFalse);
1994  ReplaceImageInList(&wand->images,crop_image);
1995  return(MagickTrue);
1996}
1997
1998/*
1999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000%                                                                             %
2001%                                                                             %
2002%                                                                             %
2003%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2004%                                                                             %
2005%                                                                             %
2006%                                                                             %
2007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2008%
2009%  MagickCycleColormapImage() displaces an image's colormap by a given number
2010%  of positions.  If you cycle the colormap a number of times you can produce
2011%  a psychodelic effect.
2012%
2013%  The format of the MagickCycleColormapImage method is:
2014%
2015%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2016%        const ssize_t displace)
2017%
2018%  A description of each parameter follows:
2019%
2020%    o wand: the magick wand.
2021%
2022%    o pixel_wand: the pixel wand.
2023%
2024*/
2025WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2026  const ssize_t displace)
2027{
2028  MagickBooleanType
2029    status;
2030
2031  assert(wand != (MagickWand *) NULL);
2032  assert(wand->signature == WandSignature);
2033  if (wand->debug != MagickFalse)
2034    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2035  if (wand->images == (Image *) NULL)
2036    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2037  status=CycleColormapImage(wand->images,displace,wand->exception);
2038  return(status);
2039}
2040
2041/*
2042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2043%                                                                             %
2044%                                                                             %
2045%                                                                             %
2046%   M a g i c k C o n s t i t u t e I m a g e                                 %
2047%                                                                             %
2048%                                                                             %
2049%                                                                             %
2050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2051%
2052%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2053%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2054%  The data can be char, short int, int, float, or double.  Float and double
2055%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2056%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2057%  example, to create a 640x480 image from unsigned red-green-blue character
2058%  data, use
2059%
2060%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2061%
2062%  The format of the MagickConstituteImage method is:
2063%
2064%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2065%        const size_t columns,const size_t rows,const char *map,
2066%        const StorageType storage,void *pixels)
2067%
2068%  A description of each parameter follows:
2069%
2070%    o wand: the magick wand.
2071%
2072%    o columns: width in pixels of the image.
2073%
2074%    o rows: height in pixels of the image.
2075%
2076%    o map:  This string reflects the expected ordering of the pixel array.
2077%      It can be any combination or order of R = red, G = green, B = blue,
2078%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2079%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2080%      P = pad.
2081%
2082%    o storage: Define the data type of the pixels.  Float and double types are
2083%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2084%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2085%      LongPixel, QuantumPixel, or ShortPixel.
2086%
2087%    o pixels: This array of values contain the pixel components as defined by
2088%      map and type.  You must preallocate this array where the expected
2089%      length varies depending on the values of width, height, map, and type.
2090%
2091%
2092*/
2093WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2094  const size_t columns,const size_t rows,const char *map,
2095  const StorageType storage,const void *pixels)
2096{
2097  Image
2098    *images;
2099
2100  assert(wand != (MagickWand *) NULL);
2101  assert(wand->signature == WandSignature);
2102  if (wand->debug != MagickFalse)
2103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2104  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2105  if (images == (Image *) NULL)
2106    return(MagickFalse);
2107  return(InsertImageInWand(wand,images));
2108}
2109
2110/*
2111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2112%                                                                             %
2113%                                                                             %
2114%                                                                             %
2115%   M a g i c k D e c i p h e r I m a g e                                     %
2116%                                                                             %
2117%                                                                             %
2118%                                                                             %
2119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2120%
2121%  MagickDecipherImage() converts cipher pixels to plain pixels.
2122%
2123%  The format of the MagickDecipherImage method is:
2124%
2125%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2126%        const char *passphrase)
2127%
2128%  A description of each parameter follows:
2129%
2130%    o wand: the magick wand.
2131%
2132%    o passphrase: the passphrase.
2133%
2134*/
2135WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2136  const char *passphrase)
2137{
2138  assert(wand != (MagickWand *) NULL);
2139  assert(wand->signature == WandSignature);
2140  if (wand->debug != MagickFalse)
2141    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2142  if (wand->images == (Image *) NULL)
2143    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2144  return(DecipherImage(wand->images,passphrase,wand->exception));
2145}
2146
2147/*
2148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2149%                                                                             %
2150%                                                                             %
2151%                                                                             %
2152%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2153%                                                                             %
2154%                                                                             %
2155%                                                                             %
2156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2157%
2158%  MagickDeconstructImages() compares each image with the next in a sequence
2159%  and returns the maximum bounding region of any pixel differences it
2160%  discovers.
2161%
2162%  The format of the MagickDeconstructImages method is:
2163%
2164%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2165%
2166%  A description of each parameter follows:
2167%
2168%    o wand: the magick wand.
2169%
2170*/
2171WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2172{
2173  Image
2174    *deconstruct_image;
2175
2176  assert(wand != (MagickWand *) NULL);
2177  assert(wand->signature == WandSignature);
2178  if (wand->debug != MagickFalse)
2179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2180  if (wand->images == (Image *) NULL)
2181    return((MagickWand *) NULL);
2182  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2183    wand->exception);
2184  if (deconstruct_image == (Image *) NULL)
2185    return((MagickWand *) NULL);
2186  return(CloneMagickWandFromImages(wand,deconstruct_image));
2187}
2188
2189/*
2190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191%                                                                             %
2192%                                                                             %
2193%                                                                             %
2194%     M a g i c k D e s k e w I m a g e                                       %
2195%                                                                             %
2196%                                                                             %
2197%                                                                             %
2198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199%
2200%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2201%  occurs in scanned images because of the camera being misaligned,
2202%  imperfections in the scanning or surface, or simply because the paper was
2203%  not placed completely flat when scanned.
2204%
2205%  The format of the MagickDeskewImage method is:
2206%
2207%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2208%        const double threshold)
2209%
2210%  A description of each parameter follows:
2211%
2212%    o wand: the magick wand.
2213%
2214%    o threshold: separate background from foreground.
2215%
2216*/
2217WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2218  const double threshold)
2219{
2220  Image
2221    *sepia_image;
2222
2223  assert(wand != (MagickWand *) NULL);
2224  assert(wand->signature == WandSignature);
2225  if (wand->debug != MagickFalse)
2226    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2227  if (wand->images == (Image *) NULL)
2228    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2229  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2230  if (sepia_image == (Image *) NULL)
2231    return(MagickFalse);
2232  ReplaceImageInList(&wand->images,sepia_image);
2233  return(MagickTrue);
2234}
2235
2236/*
2237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2238%                                                                             %
2239%                                                                             %
2240%                                                                             %
2241%     M a g i c k D e s p e c k l e I m a g e                                 %
2242%                                                                             %
2243%                                                                             %
2244%                                                                             %
2245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246%
2247%  MagickDespeckleImage() reduces the speckle noise in an image while
2248%  perserving the edges of the original image.
2249%
2250%  The format of the MagickDespeckleImage method is:
2251%
2252%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2253%
2254%  A description of each parameter follows:
2255%
2256%    o wand: the magick wand.
2257%
2258*/
2259WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2260{
2261  Image
2262    *despeckle_image;
2263
2264  assert(wand != (MagickWand *) NULL);
2265  assert(wand->signature == WandSignature);
2266  if (wand->debug != MagickFalse)
2267    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2268  if (wand->images == (Image *) NULL)
2269    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2270  despeckle_image=DespeckleImage(wand->images,wand->exception);
2271  if (despeckle_image == (Image *) NULL)
2272    return(MagickFalse);
2273  ReplaceImageInList(&wand->images,despeckle_image);
2274  return(MagickTrue);
2275}
2276
2277/*
2278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2279%                                                                             %
2280%                                                                             %
2281%                                                                             %
2282%   M a g i c k D e s t r o y I m a g e                                       %
2283%                                                                             %
2284%                                                                             %
2285%                                                                             %
2286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2287%
2288%  MagickDestroyImage() dereferences an image, deallocating memory associated
2289%  with the image if the reference count becomes zero.
2290%
2291%  The format of the MagickDestroyImage method is:
2292%
2293%      Image *MagickDestroyImage(Image *image)
2294%
2295%  A description of each parameter follows:
2296%
2297%    o image: the image.
2298%
2299*/
2300WandExport Image *MagickDestroyImage(Image *image)
2301{
2302  return(DestroyImage(image));
2303}
2304
2305/*
2306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2307%                                                                             %
2308%                                                                             %
2309%                                                                             %
2310%   M a g i c k D i s p l a y I m a g e                                       %
2311%                                                                             %
2312%                                                                             %
2313%                                                                             %
2314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2315%
2316%  MagickDisplayImage() displays an image.
2317%
2318%  The format of the MagickDisplayImage method is:
2319%
2320%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2321%        const char *server_name)
2322%
2323%  A description of each parameter follows:
2324%
2325%    o wand: the magick wand.
2326%
2327%    o server_name: the X server name.
2328%
2329*/
2330WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2331  const char *server_name)
2332{
2333  Image
2334    *image;
2335
2336  MagickBooleanType
2337    status;
2338
2339  assert(wand != (MagickWand *) NULL);
2340  assert(wand->signature == WandSignature);
2341  if (wand->debug != MagickFalse)
2342    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2343  if (wand->images == (Image *) NULL)
2344    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2345  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2346  if (image == (Image *) NULL)
2347    return(MagickFalse);
2348  (void) CloneString(&wand->image_info->server_name,server_name);
2349  status=DisplayImages(wand->image_info,image,wand->exception);
2350  image=DestroyImage(image);
2351  return(status);
2352}
2353
2354/*
2355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2356%                                                                             %
2357%                                                                             %
2358%                                                                             %
2359%   M a g i c k D i s p l a y I m a g e s                                     %
2360%                                                                             %
2361%                                                                             %
2362%                                                                             %
2363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2364%
2365%  MagickDisplayImages() displays an image or image sequence.
2366%
2367%  The format of the MagickDisplayImages method is:
2368%
2369%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2370%        const char *server_name)
2371%
2372%  A description of each parameter follows:
2373%
2374%    o wand: the magick wand.
2375%
2376%    o server_name: the X server name.
2377%
2378*/
2379WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2380  const char *server_name)
2381{
2382  MagickBooleanType
2383    status;
2384
2385  assert(wand != (MagickWand *) NULL);
2386  assert(wand->signature == WandSignature);
2387  if (wand->debug != MagickFalse)
2388    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2389  (void) CloneString(&wand->image_info->server_name,server_name);
2390  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2391  return(status);
2392}
2393
2394/*
2395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2396%                                                                             %
2397%                                                                             %
2398%                                                                             %
2399%   M a g i c k D i s t o r t I m a g e                                       %
2400%                                                                             %
2401%                                                                             %
2402%                                                                             %
2403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2404%
2405%  MagickDistortImage() distorts an image using various distortion methods, by
2406%  mapping color lookups of the source image to a new destination image
2407%  usally of the same size as the source image, unless 'bestfit' is set to
2408%  true.
2409%
2410%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2411%  adjusted to ensure the whole source 'image' will just fit within the final
2412%  destination image, which will be sized and offset accordingly.  Also in
2413%  many cases the virtual offset of the source image will be taken into
2414%  account in the mapping.
2415%
2416%  The format of the MagickDistortImage method is:
2417%
2418%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2419%        const DistortImageMethod method,const size_t number_arguments,
2420%        const double *arguments,const MagickBooleanType bestfit)
2421%
2422%  A description of each parameter follows:
2423%
2424%    o image: the image to be distorted.
2425%
2426%    o method: the method of image distortion.
2427%
2428%        ArcDistortion always ignores the source image offset, and always
2429%        'bestfit' the destination image with the top left corner offset
2430%        relative to the polar mapping center.
2431%
2432%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2433%        style of image distortion.
2434%
2435%        Affine, Perspective, and Bilinear, do least squares fitting of the
2436%        distortion when more than the minimum number of control point pairs
2437%        are provided.
2438%
2439%        Perspective, and Bilinear, falls back to a Affine distortion when less
2440%        that 4 control point pairs are provided. While Affine distortions let
2441%        you use any number of control point pairs, that is Zero pairs is a
2442%        no-Op (viewport only) distrotion, one pair is a translation and two
2443%        pairs of control points do a scale-rotate-translate, without any
2444%        shearing.
2445%
2446%    o number_arguments: the number of arguments given for this distortion
2447%      method.
2448%
2449%    o arguments: the arguments for this distortion method.
2450%
2451%    o bestfit: Attempt to resize destination to fit distorted source.
2452%
2453*/
2454WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2455  const DistortImageMethod method,const size_t number_arguments,
2456  const double *arguments,const MagickBooleanType bestfit)
2457{
2458  Image
2459    *distort_image;
2460
2461  assert(wand != (MagickWand *) NULL);
2462  assert(wand->signature == WandSignature);
2463  if (wand->debug != MagickFalse)
2464    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2465  if (wand->images == (Image *) NULL)
2466    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2467  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2468    bestfit,wand->exception);
2469  if (distort_image == (Image *) NULL)
2470    return(MagickFalse);
2471  ReplaceImageInList(&wand->images,distort_image);
2472  return(MagickTrue);
2473}
2474
2475/*
2476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477%                                                                             %
2478%                                                                             %
2479%                                                                             %
2480%   M a g i c k D r a w I m a g e                                             %
2481%                                                                             %
2482%                                                                             %
2483%                                                                             %
2484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2485%
2486%  MagickDrawImage() renders the drawing wand on the current image.
2487%
2488%  The format of the MagickDrawImage method is:
2489%
2490%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2491%        const DrawingWand *drawing_wand)
2492%
2493%  A description of each parameter follows:
2494%
2495%    o wand: the magick wand.
2496%
2497%    o drawing_wand: the draw wand.
2498%
2499*/
2500WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2501  const DrawingWand *drawing_wand)
2502{
2503  char
2504    *primitive;
2505
2506  DrawInfo
2507    *draw_info;
2508
2509  MagickBooleanType
2510    status;
2511
2512  assert(wand != (MagickWand *) NULL);
2513  assert(wand->signature == WandSignature);
2514  if (wand->debug != MagickFalse)
2515    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2516  if (wand->images == (Image *) NULL)
2517    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2518  draw_info=PeekDrawingWand(drawing_wand);
2519  if ((draw_info == (DrawInfo *) NULL) ||
2520      (draw_info->primitive == (char *) NULL))
2521    return(MagickFalse);
2522  primitive=AcquireString(draw_info->primitive);
2523  draw_info=DestroyDrawInfo(draw_info);
2524  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2525  draw_info->primitive=primitive;
2526  status=DrawImage(wand->images,draw_info,wand->exception);
2527  draw_info=DestroyDrawInfo(draw_info);
2528  return(status);
2529}
2530
2531/*
2532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533%                                                                             %
2534%                                                                             %
2535%                                                                             %
2536%   M a g i c k E d g e I m a g e                                             %
2537%                                                                             %
2538%                                                                             %
2539%                                                                             %
2540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541%
2542%  MagickEdgeImage() enhance edges within the image with a convolution filter
2543%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2544%  radius for you.
2545%
2546%  The format of the MagickEdgeImage method is:
2547%
2548%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2549%        const double sigma)
2550%
2551%  A description of each parameter follows:
2552%
2553%    o wand: the magick wand.
2554%
2555%    o radius: the radius of the pixel neighborhood.
2556%
2557%    o sigma: the standard deviation of the Gaussian, in pixels.
2558%
2559*/
2560WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2561  const double radius,const double sigma)
2562{
2563  Image
2564    *edge_image;
2565
2566  assert(wand != (MagickWand *) NULL);
2567  assert(wand->signature == WandSignature);
2568  if (wand->debug != MagickFalse)
2569    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2570  if (wand->images == (Image *) NULL)
2571    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2572  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2573  if (edge_image == (Image *) NULL)
2574    return(MagickFalse);
2575  ReplaceImageInList(&wand->images,edge_image);
2576  return(MagickTrue);
2577}
2578
2579/*
2580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2581%                                                                             %
2582%                                                                             %
2583%                                                                             %
2584%   M a g i c k E m b o s s I m a g e                                         %
2585%                                                                             %
2586%                                                                             %
2587%                                                                             %
2588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2589%
2590%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2591%  effect.  We convolve the image with a Gaussian operator of the given radius
2592%  and standard deviation (sigma).  For reasonable results, radius should be
2593%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2594%  radius for you.
2595%
2596%  The format of the MagickEmbossImage method is:
2597%
2598%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2599%        const double sigma)
2600%
2601%  A description of each parameter follows:
2602%
2603%    o wand: the magick wand.
2604%
2605%    o radius: the radius of the Gaussian, in pixels, not counting the center
2606%      pixel.
2607%
2608%    o sigma: the standard deviation of the Gaussian, in pixels.
2609%
2610*/
2611WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2612  const double radius,const double sigma)
2613{
2614  Image
2615    *emboss_image;
2616
2617  assert(wand != (MagickWand *) NULL);
2618  assert(wand->signature == WandSignature);
2619  if (wand->debug != MagickFalse)
2620    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2621  if (wand->images == (Image *) NULL)
2622    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2623  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2624  if (emboss_image == (Image *) NULL)
2625    return(MagickFalse);
2626  ReplaceImageInList(&wand->images,emboss_image);
2627  return(MagickTrue);
2628}
2629
2630/*
2631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2632%                                                                             %
2633%                                                                             %
2634%                                                                             %
2635%   M a g i c k E n c i p h e r I m a g e                                     %
2636%                                                                             %
2637%                                                                             %
2638%                                                                             %
2639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2640%
2641%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2642%
2643%  The format of the MagickEncipherImage method is:
2644%
2645%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2646%        const char *passphrase)
2647%
2648%  A description of each parameter follows:
2649%
2650%    o wand: the magick wand.
2651%
2652%    o passphrase: the passphrase.
2653%
2654*/
2655WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2656  const char *passphrase)
2657{
2658  assert(wand != (MagickWand *) NULL);
2659  assert(wand->signature == WandSignature);
2660  if (wand->debug != MagickFalse)
2661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2662  if (wand->images == (Image *) NULL)
2663    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2664  return(EncipherImage(wand->images,passphrase,wand->exception));
2665}
2666
2667/*
2668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2669%                                                                             %
2670%                                                                             %
2671%                                                                             %
2672%   M a g i c k E n h a n c e I m a g e                                       %
2673%                                                                             %
2674%                                                                             %
2675%                                                                             %
2676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2677%
2678%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2679%  noisy image.
2680%
2681%  The format of the MagickEnhanceImage method is:
2682%
2683%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2684%
2685%  A description of each parameter follows:
2686%
2687%    o wand: the magick wand.
2688%
2689*/
2690WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2691{
2692  Image
2693    *enhance_image;
2694
2695  assert(wand != (MagickWand *) NULL);
2696  assert(wand->signature == WandSignature);
2697  if (wand->debug != MagickFalse)
2698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2699  if (wand->images == (Image *) NULL)
2700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2701  enhance_image=EnhanceImage(wand->images,wand->exception);
2702  if (enhance_image == (Image *) NULL)
2703    return(MagickFalse);
2704  ReplaceImageInList(&wand->images,enhance_image);
2705  return(MagickTrue);
2706}
2707
2708/*
2709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710%                                                                             %
2711%                                                                             %
2712%                                                                             %
2713%   M a g i c k E q u a l i z e I m a g e                                     %
2714%                                                                             %
2715%                                                                             %
2716%                                                                             %
2717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2718%
2719%  MagickEqualizeImage() equalizes the image histogram.
2720%
2721%  The format of the MagickEqualizeImage method is:
2722%
2723%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2724%
2725%  A description of each parameter follows:
2726%
2727%    o wand: the magick wand.
2728%
2729%    o channel: the image channel(s).
2730%
2731*/
2732WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2733{
2734  MagickBooleanType
2735    status;
2736
2737  assert(wand != (MagickWand *) NULL);
2738  assert(wand->signature == WandSignature);
2739  if (wand->debug != MagickFalse)
2740    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2741  if (wand->images == (Image *) NULL)
2742    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2743  status=EqualizeImage(wand->images,wand->exception);
2744  return(status);
2745}
2746
2747/*
2748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2749%                                                                             %
2750%                                                                             %
2751%                                                                             %
2752%   M a g i c k E v a l u a t e I m a g e                                     %
2753%                                                                             %
2754%                                                                             %
2755%                                                                             %
2756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2757%
2758%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2759%  expression to an image.  Use these operators to lighten or darken an image,
2760%  to increase or decrease contrast in an image, or to produce the "negative"
2761%  of an image.
2762%
2763%  The format of the MagickEvaluateImage method is:
2764%
2765%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2766%        const MagickEvaluateOperator operator,const double value)
2767%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2768%        const MagickEvaluateOperator operator)
2769%
2770%  A description of each parameter follows:
2771%
2772%    o wand: the magick wand.
2773%
2774%    o op: A channel operator.
2775%
2776%    o value: A value value.
2777%
2778*/
2779
2780WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2781  const MagickEvaluateOperator op)
2782{
2783  Image
2784    *evaluate_image;
2785
2786  assert(wand != (MagickWand *) NULL);
2787  assert(wand->signature == WandSignature);
2788  if (wand->debug != MagickFalse)
2789    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2790  if (wand->images == (Image *) NULL)
2791    return((MagickWand *) NULL);
2792  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2793  if (evaluate_image == (Image *) NULL)
2794    return((MagickWand *) NULL);
2795  return(CloneMagickWandFromImages(wand,evaluate_image));
2796}
2797
2798WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2799  const MagickEvaluateOperator op,const double value)
2800{
2801  MagickBooleanType
2802    status;
2803
2804  assert(wand != (MagickWand *) NULL);
2805  assert(wand->signature == WandSignature);
2806  if (wand->debug != MagickFalse)
2807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2808  if (wand->images == (Image *) NULL)
2809    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2810  status=EvaluateImage(wand->images,op,value,wand->exception);
2811  return(status);
2812}
2813
2814/*
2815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2816%                                                                             %
2817%                                                                             %
2818%                                                                             %
2819%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2820%                                                                             %
2821%                                                                             %
2822%                                                                             %
2823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824%
2825%  MagickExportImagePixels() extracts pixel data from an image and returns it
2826%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2827%  an error is encountered.  The data is returned as char, short int, int,
2828%  ssize_t, float, or double in the order specified by map.
2829%
2830%  Suppose you want to extract the first scanline of a 640x480 image as
2831%  character data in red-green-blue order:
2832%
2833%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2834%
2835%  The format of the MagickExportImagePixels method is:
2836%
2837%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2838%        const ssize_t x,const ssize_t y,const size_t columns,
2839%        const size_t rows,const char *map,const StorageType storage,
2840%        void *pixels)
2841%
2842%  A description of each parameter follows:
2843%
2844%    o wand: the magick wand.
2845%
2846%    o x, y, columns, rows:  These values define the perimeter
2847%      of a region of pixels you want to extract.
2848%
2849%    o map:  This string reflects the expected ordering of the pixel array.
2850%      It can be any combination or order of R = red, G = green, B = blue,
2851%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2852%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2853%      P = pad.
2854%
2855%    o storage: Define the data type of the pixels.  Float and double types are
2856%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2857%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2858%      LongPixel, QuantumPixel, or ShortPixel.
2859%
2860%    o pixels: This array of values contain the pixel components as defined by
2861%      map and type.  You must preallocate this array where the expected
2862%      length varies depending on the values of width, height, map, and type.
2863%
2864*/
2865WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2866  const ssize_t x,const ssize_t y,const size_t columns,
2867  const size_t rows,const char *map,const StorageType storage,
2868  void *pixels)
2869{
2870  MagickBooleanType
2871    status;
2872
2873  assert(wand != (MagickWand *) NULL);
2874  assert(wand->signature == WandSignature);
2875  if (wand->debug != MagickFalse)
2876    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2877  if (wand->images == (Image *) NULL)
2878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2879  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2880    storage,pixels,wand->exception);
2881  return(status);
2882}
2883
2884/*
2885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2886%                                                                             %
2887%                                                                             %
2888%                                                                             %
2889%   M a g i c k E x t e n t I m a g e                                         %
2890%                                                                             %
2891%                                                                             %
2892%                                                                             %
2893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2894%
2895%  MagickExtentImage() extends the image as defined by the geometry, gravity,
2896%  and wand background color.  Set the (x,y) offset of the geometry to move
2897%  the original wand relative to the extended wand.
2898%
2899%  The format of the MagickExtentImage method is:
2900%
2901%      MagickBooleanType MagickExtentImage(MagickWand *wand,
2902%        const size_t width,const size_t height,const ssize_t x,
2903%        const ssize_t y)
2904%
2905%  A description of each parameter follows:
2906%
2907%    o wand: the magick wand.
2908%
2909%    o width: the region width.
2910%
2911%    o height: the region height.
2912%
2913%    o x: the region x offset.
2914%
2915%    o y: the region y offset.
2916%
2917*/
2918WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2919  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2920{
2921  Image
2922    *extent_image;
2923
2924  RectangleInfo
2925    extent;
2926
2927  assert(wand != (MagickWand *) NULL);
2928  assert(wand->signature == WandSignature);
2929  if (wand->debug != MagickFalse)
2930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2931  if (wand->images == (Image *) NULL)
2932    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2933  extent.width=width;
2934  extent.height=height;
2935  extent.x=x;
2936  extent.y=y;
2937  extent_image=ExtentImage(wand->images,&extent,wand->exception);
2938  if (extent_image == (Image *) NULL)
2939    return(MagickFalse);
2940  ReplaceImageInList(&wand->images,extent_image);
2941  return(MagickTrue);
2942}
2943
2944/*
2945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2946%                                                                             %
2947%                                                                             %
2948%                                                                             %
2949%   M a g i c k F l i p I m a g e                                             %
2950%                                                                             %
2951%                                                                             %
2952%                                                                             %
2953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2954%
2955%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2956%  around the central x-axis.
2957%
2958%  The format of the MagickFlipImage method is:
2959%
2960%      MagickBooleanType MagickFlipImage(MagickWand *wand)
2961%
2962%  A description of each parameter follows:
2963%
2964%    o wand: the magick wand.
2965%
2966*/
2967WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2968{
2969  Image
2970    *flip_image;
2971
2972  assert(wand != (MagickWand *) NULL);
2973  assert(wand->signature == WandSignature);
2974  if (wand->debug != MagickFalse)
2975    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2976  if (wand->images == (Image *) NULL)
2977    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2978  flip_image=FlipImage(wand->images,wand->exception);
2979  if (flip_image == (Image *) NULL)
2980    return(MagickFalse);
2981  ReplaceImageInList(&wand->images,flip_image);
2982  return(MagickTrue);
2983}
2984
2985/*
2986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2987%                                                                             %
2988%                                                                             %
2989%                                                                             %
2990%   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                         %
2991%                                                                             %
2992%                                                                             %
2993%                                                                             %
2994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2995%
2996%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2997%  target and is an immediate neighbor.  If the method FillToBorderMethod is
2998%  specified, the color value is changed for any neighbor pixel that does not
2999%  match the bordercolor member of image.
3000%
3001%  The format of the MagickFloodfillPaintImage method is:
3002%
3003%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3004%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3005%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3006%
3007%  A description of each parameter follows:
3008%
3009%    o wand: the magick wand.
3010%
3011%    o fill: the floodfill color pixel wand.
3012%
3013%    o fuzz: By default target must match a particular pixel color
3014%      exactly.  However, in many cases two colors may differ by a small amount.
3015%      The fuzz member of image defines how much tolerance is acceptable to
3016%      consider two colors as the same.  For example, set fuzz to 10 and the
3017%      color red at intensities of 100 and 102 respectively are now interpreted
3018%      as the same color for the purposes of the floodfill.
3019%
3020%    o bordercolor: the border color pixel wand.
3021%
3022%    o x,y: the starting location of the operation.
3023%
3024%    o invert: paint any pixel that does not match the target color.
3025%
3026*/
3027WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3028  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3029  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3030{
3031  DrawInfo
3032    *draw_info;
3033
3034  MagickBooleanType
3035    status;
3036
3037  PixelInfo
3038    target;
3039
3040  assert(wand != (MagickWand *) NULL);
3041  assert(wand->signature == WandSignature);
3042  if (wand->debug != MagickFalse)
3043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3044  if (wand->images == (Image *) NULL)
3045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3046  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3047  PixelGetQuantumPacket(fill,&draw_info->fill);
3048  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3049    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3050  if (bordercolor != (PixelWand *) NULL)
3051    PixelGetMagickColor(bordercolor,&target);
3052  wand->images->fuzz=fuzz;
3053  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3054    wand->exception);
3055  draw_info=DestroyDrawInfo(draw_info);
3056  return(status);
3057}
3058
3059/*
3060%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3061%                                                                             %
3062%                                                                             %
3063%                                                                             %
3064%   M a g i c k F l o p I m a g e                                             %
3065%                                                                             %
3066%                                                                             %
3067%                                                                             %
3068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3069%
3070%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3071%  around the central y-axis.
3072%
3073%  The format of the MagickFlopImage method is:
3074%
3075%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3076%
3077%  A description of each parameter follows:
3078%
3079%    o wand: the magick wand.
3080%
3081*/
3082WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3083{
3084  Image
3085    *flop_image;
3086
3087  assert(wand != (MagickWand *) NULL);
3088  assert(wand->signature == WandSignature);
3089  if (wand->debug != MagickFalse)
3090    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3091  if (wand->images == (Image *) NULL)
3092    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3093  flop_image=FlopImage(wand->images,wand->exception);
3094  if (flop_image == (Image *) NULL)
3095    return(MagickFalse);
3096  ReplaceImageInList(&wand->images,flop_image);
3097  return(MagickTrue);
3098}
3099
3100/*
3101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3102%                                                                             %
3103%                                                                             %
3104%                                                                             %
3105%   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                     %
3106%                                                                             %
3107%                                                                             %
3108%                                                                             %
3109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3110%
3111%  MagickForwardFourierTransformImage() implements the discrete Fourier
3112%  transform (DFT) of the image either as a magnitude / phase or real /
3113%  imaginary image pair.
3114%
3115%  The format of the MagickForwardFourierTransformImage method is:
3116%
3117%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3118%        const MagickBooleanType magnitude)
3119%
3120%  A description of each parameter follows:
3121%
3122%    o wand: the magick wand.
3123%
3124%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3125%      imaginary image pair.
3126%
3127*/
3128WandExport MagickBooleanType MagickForwardFourierTransformImage(
3129  MagickWand *wand,const MagickBooleanType magnitude)
3130{
3131  Image
3132    *forward_image;
3133
3134  assert(wand != (MagickWand *) NULL);
3135  assert(wand->signature == WandSignature);
3136  if (wand->debug != MagickFalse)
3137    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3138  if (wand->images == (Image *) NULL)
3139    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3140  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3141    wand->exception);
3142  if (forward_image == (Image *) NULL)
3143    return(MagickFalse);
3144  ReplaceImageInList(&wand->images,forward_image);
3145  return(MagickTrue);
3146}
3147
3148/*
3149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3150%                                                                             %
3151%                                                                             %
3152%                                                                             %
3153%   M a g i c k F r a m e I m a g e                                           %
3154%                                                                             %
3155%                                                                             %
3156%                                                                             %
3157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3158%
3159%  MagickFrameImage() adds a simulated three-dimensional border around the
3160%  image.  The width and height specify the border width of the vertical and
3161%  horizontal sides of the frame.  The inner and outer bevels indicate the
3162%  width of the inner and outer shadows of the frame.
3163%
3164%  The format of the MagickFrameImage method is:
3165%
3166%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3167%        const PixelWand *matte_color,const size_t width,
3168%        const size_t height,const ssize_t inner_bevel,
3169%        const ssize_t outer_bevel,const CompositeOperator compose)
3170%
3171%  A description of each parameter follows:
3172%
3173%    o wand: the magick wand.
3174%
3175%    o matte_color: the frame color pixel wand.
3176%
3177%    o width: the border width.
3178%
3179%    o height: the border height.
3180%
3181%    o inner_bevel: the inner bevel width.
3182%
3183%    o outer_bevel: the outer bevel width.
3184%
3185%    o compose: the composite operator.
3186%
3187*/
3188WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3189  const PixelWand *matte_color,const size_t width,const size_t height,
3190  const ssize_t inner_bevel,const ssize_t outer_bevel,
3191  const CompositeOperator compose)
3192{
3193  Image
3194    *frame_image;
3195
3196  FrameInfo
3197    frame_info;
3198
3199  assert(wand != (MagickWand *) NULL);
3200  assert(wand->signature == WandSignature);
3201  if (wand->debug != MagickFalse)
3202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3203  if (wand->images == (Image *) NULL)
3204    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3205  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3206  frame_info.width=wand->images->columns+2*width;
3207  frame_info.height=wand->images->rows+2*height;
3208  frame_info.x=(ssize_t) width;
3209  frame_info.y=(ssize_t) height;
3210  frame_info.inner_bevel=inner_bevel;
3211  frame_info.outer_bevel=outer_bevel;
3212  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3213  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3214  if (frame_image == (Image *) NULL)
3215    return(MagickFalse);
3216  ReplaceImageInList(&wand->images,frame_image);
3217  return(MagickTrue);
3218}
3219
3220/*
3221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3222%                                                                             %
3223%                                                                             %
3224%                                                                             %
3225%   M a g i c k F u n c t i o n I m a g e                                     %
3226%                                                                             %
3227%                                                                             %
3228%                                                                             %
3229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3230%
3231%  MagickFunctionImage() applys an arithmetic, relational, or logical
3232%  expression to an image.  Use these operators to lighten or darken an image,
3233%  to increase or decrease contrast in an image, or to produce the "negative"
3234%  of an image.
3235%
3236%  The format of the MagickFunctionImage method is:
3237%
3238%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3239%        const MagickFunction function,const size_t number_arguments,
3240%        const double *arguments)
3241%
3242%  A description of each parameter follows:
3243%
3244%    o wand: the magick wand.
3245%
3246%    o function: the image function.
3247%
3248%    o number_arguments: the number of function arguments.
3249%
3250%    o arguments: the function arguments.
3251%
3252*/
3253WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3254  const MagickFunction function,const size_t number_arguments,
3255  const double *arguments)
3256{
3257  MagickBooleanType
3258    status;
3259
3260  assert(wand != (MagickWand *) NULL);
3261  assert(wand->signature == WandSignature);
3262  if (wand->debug != MagickFalse)
3263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3264  if (wand->images == (Image *) NULL)
3265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3266  status=FunctionImage(wand->images,function,number_arguments,arguments,
3267    wand->exception);
3268  return(status);
3269}
3270
3271/*
3272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3273%                                                                             %
3274%                                                                             %
3275%                                                                             %
3276%   M a g i c k F x I m a g e                                                 %
3277%                                                                             %
3278%                                                                             %
3279%                                                                             %
3280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3281%
3282%  MagickFxImage() evaluate expression for each pixel in the image.
3283%
3284%  The format of the MagickFxImage method is:
3285%
3286%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3287%
3288%  A description of each parameter follows:
3289%
3290%    o wand: the magick wand.
3291%
3292%    o expression: the expression.
3293%
3294*/
3295WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3296{
3297  Image
3298    *fx_image;
3299
3300  assert(wand != (MagickWand *) NULL);
3301  assert(wand->signature == WandSignature);
3302  if (wand->debug != MagickFalse)
3303    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3304  if (wand->images == (Image *) NULL)
3305    return((MagickWand *) NULL);
3306  fx_image=FxImage(wand->images,expression,wand->exception);
3307  if (fx_image == (Image *) NULL)
3308    return((MagickWand *) NULL);
3309  return(CloneMagickWandFromImages(wand,fx_image));
3310}
3311
3312/*
3313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3314%                                                                             %
3315%                                                                             %
3316%                                                                             %
3317%   M a g i c k G a m m a I m a g e                                           %
3318%                                                                             %
3319%                                                                             %
3320%                                                                             %
3321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3322%
3323%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3324%  different devices will have perceptual differences in the way the image's
3325%  intensities are represented on the screen.  Specify individual gamma levels
3326%  for the red, green, and blue channels, or adjust all three with the gamma
3327%  parameter.  Values typically range from 0.8 to 2.3.
3328%
3329%  You can also reduce the influence of a particular channel with a gamma
3330%  value of 0.
3331%
3332%  The format of the MagickGammaImage method is:
3333%
3334%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3335%
3336%  A description of each parameter follows:
3337%
3338%    o wand: the magick wand.
3339%
3340%    o level: Define the level of gamma correction.
3341%
3342*/
3343WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3344  const double gamma)
3345{
3346  MagickBooleanType
3347    status;
3348
3349  assert(wand != (MagickWand *) NULL);
3350  assert(wand->signature == WandSignature);
3351  if (wand->debug != MagickFalse)
3352    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3353  if (wand->images == (Image *) NULL)
3354    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3355  status=GammaImage(wand->images,gamma,wand->exception);
3356  return(status);
3357}
3358
3359/*
3360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3361%                                                                             %
3362%                                                                             %
3363%                                                                             %
3364%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3365%                                                                             %
3366%                                                                             %
3367%                                                                             %
3368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3369%
3370%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3371%  Gaussian operator of the given radius and standard deviation (sigma).
3372%  For reasonable results, the radius should be larger than sigma.  Use a
3373%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3374%
3375%  The format of the MagickGaussianBlurImage method is:
3376%
3377%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3378%        const double radius,const double sigma,const double bias)
3379%
3380%  A description of each parameter follows:
3381%
3382%    o wand: the magick wand.
3383%
3384%    o radius: the radius of the Gaussian, in pixels, not counting the center
3385%      pixel.
3386%
3387%    o sigma: the standard deviation of the Gaussian, in pixels.
3388%
3389%    o bias: the bias.
3390%
3391*/
3392WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3393  const double radius,const double sigma,const double bias)
3394{
3395  Image
3396    *blur_image;
3397
3398  assert(wand != (MagickWand *) NULL);
3399  assert(wand->signature == WandSignature);
3400  if (wand->debug != MagickFalse)
3401    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3402  if (wand->images == (Image *) NULL)
3403    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3404  blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3405  if (blur_image == (Image *) NULL)
3406    return(MagickFalse);
3407  ReplaceImageInList(&wand->images,blur_image);
3408  return(MagickTrue);
3409}
3410
3411/*
3412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3413%                                                                             %
3414%                                                                             %
3415%                                                                             %
3416%   M a g i c k G e t I m a g e                                               %
3417%                                                                             %
3418%                                                                             %
3419%                                                                             %
3420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3421%
3422%  MagickGetImage() gets the image at the current image index.
3423%
3424%  The format of the MagickGetImage method is:
3425%
3426%      MagickWand *MagickGetImage(MagickWand *wand)
3427%
3428%  A description of each parameter follows:
3429%
3430%    o wand: the magick wand.
3431%
3432*/
3433WandExport MagickWand *MagickGetImage(MagickWand *wand)
3434{
3435  Image
3436    *image;
3437
3438  assert(wand != (MagickWand *) NULL);
3439  assert(wand->signature == WandSignature);
3440  if (wand->debug != MagickFalse)
3441    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3442  if (wand->images == (Image *) NULL)
3443    {
3444      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3445        "ContainsNoImages","`%s'",wand->name);
3446      return((MagickWand *) NULL);
3447    }
3448  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3449  if (image == (Image *) NULL)
3450    return((MagickWand *) NULL);
3451  return(CloneMagickWandFromImages(wand,image));
3452}
3453
3454/*
3455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3456%                                                                             %
3457%                                                                             %
3458%                                                                             %
3459%   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                       %
3460%                                                                             %
3461%                                                                             %
3462%                                                                             %
3463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3464%
3465%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3466%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3467%  than CMYKA.
3468%
3469%  The format of the MagickGetImageAlphaChannel method is:
3470%
3471%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3472%
3473%  A description of each parameter follows:
3474%
3475%    o wand: the magick wand.
3476%
3477*/
3478WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3479{
3480  assert(wand != (MagickWand *) NULL);
3481  assert(wand->signature == WandSignature);
3482  if (wand->debug != MagickFalse)
3483    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3484  if (wand->images == (Image *) NULL)
3485    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3486  return(GetImageAlphaChannel(wand->images));
3487}
3488
3489/*
3490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3491%                                                                             %
3492%                                                                             %
3493%                                                                             %
3494%   M a g i c k G e t I m a g e C l i p M a s k                               %
3495%                                                                             %
3496%                                                                             %
3497%                                                                             %
3498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3499%
3500%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3501%
3502%  The format of the MagickGetImageClipMask method is:
3503%
3504%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3505%
3506%  A description of each parameter follows:
3507%
3508%    o wand: the magick wand.
3509%
3510*/
3511WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3512{
3513  Image
3514    *image;
3515
3516  assert(wand != (MagickWand *) NULL);
3517  assert(wand->signature == WandSignature);
3518  if (wand->debug != MagickFalse)
3519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3520  if (wand->images == (Image *) NULL)
3521    {
3522      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3523        "ContainsNoImages","`%s'",wand->name);
3524      return((MagickWand *) NULL);
3525    }
3526  image=GetImageClipMask(wand->images,wand->exception);
3527  if (image == (Image *) NULL)
3528    return((MagickWand *) NULL);
3529  return(CloneMagickWandFromImages(wand,image));
3530}
3531
3532/*
3533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3534%                                                                             %
3535%                                                                             %
3536%                                                                             %
3537%   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                 %
3538%                                                                             %
3539%                                                                             %
3540%                                                                             %
3541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3542%
3543%  MagickGetImageBackgroundColor() returns the image background color.
3544%
3545%  The format of the MagickGetImageBackgroundColor method is:
3546%
3547%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3548%        PixelWand *background_color)
3549%
3550%  A description of each parameter follows:
3551%
3552%    o wand: the magick wand.
3553%
3554%    o background_color: Return the background color.
3555%
3556*/
3557WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3558  PixelWand *background_color)
3559{
3560  assert(wand != (MagickWand *) NULL);
3561  assert(wand->signature == WandSignature);
3562  if (wand->debug != MagickFalse)
3563    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3564  if (wand->images == (Image *) NULL)
3565    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3566  PixelSetPixelColor(background_color,&wand->images->background_color);
3567  return(MagickTrue);
3568}
3569
3570/*
3571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3572%                                                                             %
3573%                                                                             %
3574%                                                                             %
3575%   M a g i c k G e t I m a g e B l o b                                       %
3576%                                                                             %
3577%                                                                             %
3578%                                                                             %
3579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3580%
3581%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3582%  the image as a blob (a formatted "file" in memory) and its length, starting
3583%  from the current position in the image sequence.  Use MagickSetImageFormat()
3584%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3585%
3586%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3587%  the image sequence.
3588%
3589%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3590%
3591%  The format of the MagickGetImageBlob method is:
3592%
3593%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3594%
3595%  A description of each parameter follows:
3596%
3597%    o wand: the magick wand.
3598%
3599%    o length: the length of the blob.
3600%
3601*/
3602WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3603{
3604  assert(wand != (MagickWand *) NULL);
3605  assert(wand->signature == WandSignature);
3606  if (wand->debug != MagickFalse)
3607    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3608  if (wand->images == (Image *) NULL)
3609    {
3610      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3611        "ContainsNoImages","`%s'",wand->name);
3612      return((unsigned char *) NULL);
3613    }
3614  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3615}
3616
3617/*
3618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3619%                                                                             %
3620%                                                                             %
3621%                                                                             %
3622%   M a g i c k G e t I m a g e s B l o b                                     %
3623%                                                                             %
3624%                                                                             %
3625%                                                                             %
3626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3627%
3628%  MagickGetImageBlob() implements direct to memory image formats.  It
3629%  returns the image sequence as a blob and its length.  The format of the image
3630%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3631%  return a different image format, use MagickSetImageFormat().
3632%
3633%  Note, some image formats do not permit multiple images to the same image
3634%  stream (e.g. JPEG).  in this instance, just the first image of the
3635%  sequence is returned as a blob.
3636%
3637%  The format of the MagickGetImagesBlob method is:
3638%
3639%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3640%
3641%  A description of each parameter follows:
3642%
3643%    o wand: the magick wand.
3644%
3645%    o length: the length of the blob.
3646%
3647*/
3648WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3649{
3650  unsigned char
3651    *blob;
3652
3653  assert(wand != (MagickWand *) NULL);
3654  assert(wand->signature == WandSignature);
3655  if (wand->debug != MagickFalse)
3656    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3657  if (wand->images == (Image *) NULL)
3658    {
3659      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3660        "ContainsNoImages","`%s'",wand->name);
3661      return((unsigned char *) NULL);
3662    }
3663  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3664    wand->exception);
3665  return(blob);
3666}
3667
3668/*
3669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3670%                                                                             %
3671%                                                                             %
3672%                                                                             %
3673%   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                         %
3674%                                                                             %
3675%                                                                             %
3676%                                                                             %
3677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3678%
3679%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3680%  image.
3681%
3682%  The format of the MagickGetImageBluePrimary method is:
3683%
3684%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3685%        double *y)
3686%
3687%  A description of each parameter follows:
3688%
3689%    o wand: the magick wand.
3690%
3691%    o x: the chromaticity blue primary x-point.
3692%
3693%    o y: the chromaticity blue primary y-point.
3694%
3695*/
3696WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3697  double *x,double *y)
3698{
3699  assert(wand != (MagickWand *) NULL);
3700  assert(wand->signature == WandSignature);
3701  if (wand->debug != MagickFalse)
3702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3703  if (wand->images == (Image *) NULL)
3704    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3705  *x=wand->images->chromaticity.blue_primary.x;
3706  *y=wand->images->chromaticity.blue_primary.y;
3707  return(MagickTrue);
3708}
3709
3710/*
3711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3712%                                                                             %
3713%                                                                             %
3714%                                                                             %
3715%   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                         %
3716%                                                                             %
3717%                                                                             %
3718%                                                                             %
3719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3720%
3721%  MagickGetImageBorderColor() returns the image border color.
3722%
3723%  The format of the MagickGetImageBorderColor method is:
3724%
3725%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3726%        PixelWand *border_color)
3727%
3728%  A description of each parameter follows:
3729%
3730%    o wand: the magick wand.
3731%
3732%    o border_color: Return the border color.
3733%
3734*/
3735WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3736  PixelWand *border_color)
3737{
3738  assert(wand != (MagickWand *) NULL);
3739  assert(wand->signature == WandSignature);
3740  if (wand->debug != MagickFalse)
3741    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3742  if (wand->images == (Image *) NULL)
3743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3744  PixelSetPixelColor(border_color,&wand->images->border_color);
3745  return(MagickTrue);
3746}
3747
3748/*
3749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3750%                                                                             %
3751%                                                                             %
3752%                                                                             %
3753%   M a g i c k G e t I m a g e F e a t u r e s                               %
3754%                                                                             %
3755%                                                                             %
3756%                                                                             %
3757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3758%
3759%  MagickGetImageFeatures() returns features for each channel in the
3760%  image in each of four directions (horizontal, vertical, left and right
3761%  diagonals) for the specified distance.  The features include the angular
3762%  second moment, contrast, correlation, sum of squares: variance, inverse
3763%  difference moment, sum average, sum varience, sum entropy, entropy,
3764%  difference variance, difference entropy, information measures of
3765%  correlation 1, information measures of correlation 2, and maximum
3766%  correlation coefficient.  You can access the red channel contrast, for
3767%  example, like this:
3768%
3769%      channel_features=MagickGetImageFeatures(wand,1);
3770%      contrast=channel_features[RedPixelChannel].contrast[0];
3771%
3772%  Use MagickRelinquishMemory() to free the statistics buffer.
3773%
3774%  The format of the MagickGetImageFeatures method is:
3775%
3776%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3777%        const size_t distance)
3778%
3779%  A description of each parameter follows:
3780%
3781%    o wand: the magick wand.
3782%
3783%    o distance: the distance.
3784%
3785*/
3786WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3787  const size_t distance)
3788{
3789  assert(wand != (MagickWand *) NULL);
3790  assert(wand->signature == WandSignature);
3791  if (wand->debug != MagickFalse)
3792    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3793  if (wand->images == (Image *) NULL)
3794    {
3795      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3796        "ContainsNoImages","`%s'",wand->name);
3797      return((ChannelFeatures *) NULL);
3798    }
3799  return(GetImageFeatures(wand->images,distance,wand->exception));
3800}
3801
3802/*
3803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3804%                                                                             %
3805%                                                                             %
3806%                                                                             %
3807%   M a g i c k G e t I m a g e K u r t o s i s                               %
3808%                                                                             %
3809%                                                                             %
3810%                                                                             %
3811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3812%
3813%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3814%  more image channels.
3815%
3816%  The format of the MagickGetImageKurtosis method is:
3817%
3818%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3819%        double *kurtosis,double *skewness)
3820%
3821%  A description of each parameter follows:
3822%
3823%    o wand: the magick wand.
3824%
3825%    o kurtosis:  The kurtosis for the specified channel(s).
3826%
3827%    o skewness:  The skewness for the specified channel(s).
3828%
3829*/
3830WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3831  double *kurtosis,double *skewness)
3832{
3833  MagickBooleanType
3834    status;
3835
3836  assert(wand != (MagickWand *) NULL);
3837  assert(wand->signature == WandSignature);
3838  if (wand->debug != MagickFalse)
3839    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3840  if (wand->images == (Image *) NULL)
3841    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3842  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3843  return(status);
3844}
3845
3846/*
3847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3848%                                                                             %
3849%                                                                             %
3850%                                                                             %
3851%   M a g i c k G e t I m a g e M e a n                                       %
3852%                                                                             %
3853%                                                                             %
3854%                                                                             %
3855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3856%
3857%  MagickGetImageMean() gets the mean and standard deviation of one or more
3858%  image channels.
3859%
3860%  The format of the MagickGetImageMean method is:
3861%
3862%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3863%        double *standard_deviation)
3864%
3865%  A description of each parameter follows:
3866%
3867%    o wand: the magick wand.
3868%
3869%    o channel: the image channel(s).
3870%
3871%    o mean:  The mean pixel value for the specified channel(s).
3872%
3873%    o standard_deviation:  The standard deviation for the specified channel(s).
3874%
3875*/
3876WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3877  double *standard_deviation)
3878{
3879  MagickBooleanType
3880    status;
3881
3882  assert(wand != (MagickWand *) NULL);
3883  assert(wand->signature == WandSignature);
3884  if (wand->debug != MagickFalse)
3885    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3886  if (wand->images == (Image *) NULL)
3887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3888  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3889  return(status);
3890}
3891
3892/*
3893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3894%                                                                             %
3895%                                                                             %
3896%                                                                             %
3897%   M a g i c k G e t I m a g e R a n g e                                     %
3898%                                                                             %
3899%                                                                             %
3900%                                                                             %
3901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3902%
3903%  MagickGetImageRange() gets the range for one or more image channels.
3904%
3905%  The format of the MagickGetImageRange method is:
3906%
3907%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3908%        double *maxima)
3909%
3910%  A description of each parameter follows:
3911%
3912%    o wand: the magick wand.
3913%
3914%    o minima:  The minimum pixel value for the specified channel(s).
3915%
3916%    o maxima:  The maximum pixel value for the specified channel(s).
3917%
3918*/
3919WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3920  double *minima,double *maxima)
3921{
3922  MagickBooleanType
3923    status;
3924
3925  assert(wand != (MagickWand *) NULL);
3926  assert(wand->signature == WandSignature);
3927  if (wand->debug != MagickFalse)
3928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3929  if (wand->images == (Image *) NULL)
3930    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3931  status=GetImageRange(wand->images,minima,maxima,wand->exception);
3932  return(status);
3933}
3934
3935/*
3936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3937%                                                                             %
3938%                                                                             %
3939%                                                                             %
3940%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3941%                                                                             %
3942%                                                                             %
3943%                                                                             %
3944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3945%
3946%  MagickGetImageStatistics() returns statistics for each channel in the
3947%  image.  The statistics include the channel depth, its minima and
3948%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3949%  You can access the red channel mean, for example, like this:
3950%
3951%      channel_statistics=MagickGetImageStatistics(wand);
3952%      red_mean=channel_statistics[RedPixelChannel].mean;
3953%
3954%  Use MagickRelinquishMemory() to free the statistics buffer.
3955%
3956%  The format of the MagickGetImageStatistics method is:
3957%
3958%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3959%
3960%  A description of each parameter follows:
3961%
3962%    o wand: the magick wand.
3963%
3964*/
3965WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3966{
3967  assert(wand != (MagickWand *) NULL);
3968  assert(wand->signature == WandSignature);
3969  if (wand->debug != MagickFalse)
3970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3971  if (wand->images == (Image *) NULL)
3972    {
3973      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3974        "ContainsNoImages","`%s'",wand->name);
3975      return((ChannelStatistics *) NULL);
3976    }
3977  return(GetImageStatistics(wand->images,wand->exception));
3978}
3979
3980/*
3981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3982%                                                                             %
3983%                                                                             %
3984%                                                                             %
3985%   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                     %
3986%                                                                             %
3987%                                                                             %
3988%                                                                             %
3989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3990%
3991%  MagickGetImageColormapColor() returns the color of the specified colormap
3992%  index.
3993%
3994%  The format of the MagickGetImageColormapColor method is:
3995%
3996%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3997%        const size_t index,PixelWand *color)
3998%
3999%  A description of each parameter follows:
4000%
4001%    o wand: the magick wand.
4002%
4003%    o index: the offset into the image colormap.
4004%
4005%    o color: Return the colormap color in this wand.
4006%
4007*/
4008WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4009  const size_t index,PixelWand *color)
4010{
4011  assert(wand != (MagickWand *) NULL);
4012  assert(wand->signature == WandSignature);
4013  if (wand->debug != MagickFalse)
4014    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4015  if (wand->images == (Image *) NULL)
4016    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4017  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4018      (index >= wand->images->colors))
4019    {
4020      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4021        "InvalidColormapIndex","`%s'",wand->name);
4022      return(MagickFalse);
4023    }
4024  PixelSetPixelColor(color,wand->images->colormap+index);
4025  return(MagickTrue);
4026}
4027
4028/*
4029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4030%                                                                             %
4031%                                                                             %
4032%                                                                             %
4033%   M a g i c k G e t I m a g e C o l o r s                                   %
4034%                                                                             %
4035%                                                                             %
4036%                                                                             %
4037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4038%
4039%  MagickGetImageColors() gets the number of unique colors in the image.
4040%
4041%  The format of the MagickGetImageColors method is:
4042%
4043%      size_t MagickGetImageColors(MagickWand *wand)
4044%
4045%  A description of each parameter follows:
4046%
4047%    o wand: the magick wand.
4048%
4049*/
4050WandExport size_t MagickGetImageColors(MagickWand *wand)
4051{
4052  assert(wand != (MagickWand *) NULL);
4053  assert(wand->signature == WandSignature);
4054  if (wand->debug != MagickFalse)
4055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4056  if (wand->images == (Image *) NULL)
4057    {
4058      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4059        "ContainsNoImages","`%s'",wand->name);
4060      return(0);
4061    }
4062  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4063}
4064
4065/*
4066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4067%                                                                             %
4068%                                                                             %
4069%                                                                             %
4070%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4071%                                                                             %
4072%                                                                             %
4073%                                                                             %
4074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4075%
4076%  MagickGetImageColorspace() gets the image colorspace.
4077%
4078%  The format of the MagickGetImageColorspace method is:
4079%
4080%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4081%
4082%  A description of each parameter follows:
4083%
4084%    o wand: the magick wand.
4085%
4086*/
4087WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4088{
4089  assert(wand != (MagickWand *) NULL);
4090  assert(wand->signature == WandSignature);
4091  if (wand->debug != MagickFalse)
4092    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4093  if (wand->images == (Image *) NULL)
4094    {
4095      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4096        "ContainsNoImages","`%s'",wand->name);
4097      return(UndefinedColorspace);
4098    }
4099  return(wand->images->colorspace);
4100}
4101
4102/*
4103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4104%                                                                             %
4105%                                                                             %
4106%                                                                             %
4107%   M a g i c k G e t I m a g e C o m p o s e                                 %
4108%                                                                             %
4109%                                                                             %
4110%                                                                             %
4111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4112%
4113%  MagickGetImageCompose() returns the composite operator associated with the
4114%  image.
4115%
4116%  The format of the MagickGetImageCompose method is:
4117%
4118%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4119%
4120%  A description of each parameter follows:
4121%
4122%    o wand: the magick wand.
4123%
4124*/
4125WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4126{
4127  assert(wand != (MagickWand *) NULL);
4128  assert(wand->signature == WandSignature);
4129  if (wand->debug != MagickFalse)
4130    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4131  if (wand->images == (Image *) NULL)
4132    {
4133      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4134        "ContainsNoImages","`%s'",wand->name);
4135      return(UndefinedCompositeOp);
4136    }
4137  return(wand->images->compose);
4138}
4139
4140/*
4141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4142%                                                                             %
4143%                                                                             %
4144%                                                                             %
4145%   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                         %
4146%                                                                             %
4147%                                                                             %
4148%                                                                             %
4149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4150%
4151%  MagickGetImageCompression() gets the image compression.
4152%
4153%  The format of the MagickGetImageCompression method is:
4154%
4155%      CompressionType MagickGetImageCompression(MagickWand *wand)
4156%
4157%  A description of each parameter follows:
4158%
4159%    o wand: the magick wand.
4160%
4161*/
4162WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4163{
4164  assert(wand != (MagickWand *) NULL);
4165  assert(wand->signature == WandSignature);
4166  if (wand->debug != MagickFalse)
4167    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4168  if (wand->images == (Image *) NULL)
4169    {
4170      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4171        "ContainsNoImages","`%s'",wand->name);
4172      return(UndefinedCompression);
4173    }
4174  return(wand->images->compression);
4175}
4176
4177/*
4178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4179%                                                                             %
4180%                                                                             %
4181%                                                                             %
4182%   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           %
4183%                                                                             %
4184%                                                                             %
4185%                                                                             %
4186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4187%
4188%  MagickGetImageCompression() gets the image compression quality.
4189%
4190%  The format of the MagickGetImageCompression method is:
4191%
4192%      size_t MagickGetImageCompression(MagickWand *wand)
4193%
4194%  A description of each parameter follows:
4195%
4196%    o wand: the magick wand.
4197%
4198*/
4199WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4200{
4201  assert(wand != (MagickWand *) NULL);
4202  assert(wand->signature == WandSignature);
4203  if (wand->debug != MagickFalse)
4204    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4205  if (wand->images == (Image *) NULL)
4206    {
4207      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4208        "ContainsNoImages","`%s'",wand->name);
4209      return(0UL);
4210    }
4211  return(wand->images->quality);
4212}
4213
4214/*
4215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4216%                                                                             %
4217%                                                                             %
4218%                                                                             %
4219%   M a g i c k G e t I m a g e D e l a y                                     %
4220%                                                                             %
4221%                                                                             %
4222%                                                                             %
4223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4224%
4225%  MagickGetImageDelay() gets the image delay.
4226%
4227%  The format of the MagickGetImageDelay method is:
4228%
4229%      size_t MagickGetImageDelay(MagickWand *wand)
4230%
4231%  A description of each parameter follows:
4232%
4233%    o wand: the magick wand.
4234%
4235*/
4236WandExport size_t MagickGetImageDelay(MagickWand *wand)
4237{
4238  assert(wand != (MagickWand *) NULL);
4239  assert(wand->signature == WandSignature);
4240  if (wand->debug != MagickFalse)
4241    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4242  if (wand->images == (Image *) NULL)
4243    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4244  return(wand->images->delay);
4245}
4246
4247/*
4248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4249%                                                                             %
4250%                                                                             %
4251%                                                                             %
4252%   M a g i c k G e t I m a g e D e p t h                                     %
4253%                                                                             %
4254%                                                                             %
4255%                                                                             %
4256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257%
4258%  MagickGetImageDepth() gets the image depth.
4259%
4260%  The format of the MagickGetImageDepth method is:
4261%
4262%      size_t MagickGetImageDepth(MagickWand *wand)
4263%
4264%  A description of each parameter follows:
4265%
4266%    o wand: the magick wand.
4267%
4268*/
4269WandExport size_t MagickGetImageDepth(MagickWand *wand)
4270{
4271  assert(wand != (MagickWand *) NULL);
4272  assert(wand->signature == WandSignature);
4273  if (wand->debug != MagickFalse)
4274    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4275  if (wand->images == (Image *) NULL)
4276    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4277  return(wand->images->depth);
4278}
4279
4280/*
4281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4282%                                                                             %
4283%                                                                             %
4284%                                                                             %
4285%   M a g i c k G e t I m a g e D i s p o s e                                 %
4286%                                                                             %
4287%                                                                             %
4288%                                                                             %
4289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4290%
4291%  MagickGetImageDispose() gets the image disposal method.
4292%
4293%  The format of the MagickGetImageDispose method is:
4294%
4295%      DisposeType MagickGetImageDispose(MagickWand *wand)
4296%
4297%  A description of each parameter follows:
4298%
4299%    o wand: the magick wand.
4300%
4301*/
4302WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4303{
4304  assert(wand != (MagickWand *) NULL);
4305  assert(wand->signature == WandSignature);
4306  if (wand->debug != MagickFalse)
4307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4308  if (wand->images == (Image *) NULL)
4309    {
4310      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4311        "ContainsNoImages","`%s'",wand->name);
4312      return(UndefinedDispose);
4313    }
4314  return((DisposeType) wand->images->dispose);
4315}
4316
4317/*
4318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4319%                                                                             %
4320%                                                                             %
4321%                                                                             %
4322%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4323%                                                                             %
4324%                                                                             %
4325%                                                                             %
4326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4327%
4328%  MagickGetImageDistortion() compares an image to a reconstructed image and
4329%  returns the specified distortion metric.
4330%
4331%  The format of the MagickGetImageDistortion method is:
4332%
4333%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4334%        const MagickWand *reference,const MetricType metric,
4335%        double *distortion)
4336%
4337%  A description of each parameter follows:
4338%
4339%    o wand: the magick wand.
4340%
4341%    o reference: the reference wand.
4342%
4343%    o metric: the metric.
4344%
4345%    o distortion: the computed distortion between the images.
4346%
4347*/
4348WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4349  const MagickWand *reference,const MetricType metric,double *distortion)
4350{
4351  MagickBooleanType
4352    status;
4353
4354  assert(wand != (MagickWand *) NULL);
4355  assert(wand->signature == WandSignature);
4356  if (wand->debug != MagickFalse)
4357    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4358  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4359    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4360  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4361    wand->exception);
4362  return(status);
4363}
4364
4365/*
4366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4367%                                                                             %
4368%                                                                             %
4369%                                                                             %
4370%   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                         %
4371%                                                                             %
4372%                                                                             %
4373%                                                                             %
4374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4375%
4376%  MagickGetImageDistortions() compares one or more pixel channels of an
4377%  image to a reconstructed image and returns the specified distortion metrics.
4378%
4379%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4380%
4381%  The format of the MagickGetImageDistortion method is:
4382%
4383%      double *MagickGetImageDistortion(MagickWand *wand,
4384%        const MagickWand *reference,const MetricType metric)
4385%
4386%  A description of each parameter follows:
4387%
4388%    o wand: the magick wand.
4389%
4390%    o reference: the reference wand.
4391%
4392%    o metric: the metric.
4393%
4394*/
4395WandExport double *MagickGetImageDistortions(MagickWand *wand,
4396  const MagickWand *reference,const MetricType metric)
4397{
4398  double
4399    *channel_distortion;
4400
4401  assert(wand != (MagickWand *) NULL);
4402  assert(wand->signature == WandSignature);
4403  if (wand->debug != MagickFalse)
4404    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4405  assert(reference != (MagickWand *) NULL);
4406  assert(reference->signature == WandSignature);
4407  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4408    {
4409      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4410        "ContainsNoImages","`%s'",wand->name);
4411      return((double *) NULL);
4412    }
4413  channel_distortion=GetImageDistortions(wand->images,reference->images,
4414    metric,wand->exception);
4415  return(channel_distortion);
4416}
4417
4418/*
4419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4420%                                                                             %
4421%                                                                             %
4422%                                                                             %
4423%   M a g i c k G e t I m a g e F i l e n a m e                               %
4424%                                                                             %
4425%                                                                             %
4426%                                                                             %
4427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4428%
4429%  MagickGetImageFilename() returns the filename of a particular image in a
4430%  sequence.
4431%
4432%  The format of the MagickGetImageFilename method is:
4433%
4434%      char *MagickGetImageFilename(MagickWand *wand)
4435%
4436%  A description of each parameter follows:
4437%
4438%    o wand: the magick wand.
4439%
4440*/
4441WandExport char *MagickGetImageFilename(MagickWand *wand)
4442{
4443  assert(wand != (MagickWand *) NULL);
4444  assert(wand->signature == WandSignature);
4445  if (wand->debug != MagickFalse)
4446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4447  if (wand->images == (Image *) NULL)
4448    {
4449      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4450        "ContainsNoImages","`%s'",wand->name);
4451      return((char *) NULL);
4452    }
4453  return(AcquireString(wand->images->filename));
4454}
4455
4456/*
4457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4458%                                                                             %
4459%                                                                             %
4460%                                                                             %
4461%   M a g i c k G e t I m a g e F o r m a t                                   %
4462%                                                                             %
4463%                                                                             %
4464%                                                                             %
4465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4466%
4467%  MagickGetImageFormat() returns the format of a particular image in a
4468%  sequence.
4469%
4470%  The format of the MagickGetImageFormat method is:
4471%
4472%      const char *MagickGetImageFormat(MagickWand *wand)
4473%
4474%  A description of each parameter follows:
4475%
4476%    o wand: the magick wand.
4477%
4478*/
4479WandExport char *MagickGetImageFormat(MagickWand *wand)
4480{
4481  assert(wand != (MagickWand *) NULL);
4482  assert(wand->signature == WandSignature);
4483  if (wand->debug != MagickFalse)
4484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4485  if (wand->images == (Image *) NULL)
4486    {
4487      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4488        "ContainsNoImages","`%s'",wand->name);
4489      return((char *) NULL);
4490    }
4491  return(AcquireString(wand->images->magick));
4492}
4493
4494/*
4495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4496%                                                                             %
4497%                                                                             %
4498%                                                                             %
4499%   M a g i c k G e t I m a g e F u z z                                       %
4500%                                                                             %
4501%                                                                             %
4502%                                                                             %
4503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4504%
4505%  MagickGetImageFuzz() gets the image fuzz.
4506%
4507%  The format of the MagickGetImageFuzz method is:
4508%
4509%      double MagickGetImageFuzz(MagickWand *wand)
4510%
4511%  A description of each parameter follows:
4512%
4513%    o wand: the magick wand.
4514%
4515*/
4516WandExport double MagickGetImageFuzz(MagickWand *wand)
4517{
4518  assert(wand != (MagickWand *) NULL);
4519  assert(wand->signature == WandSignature);
4520  if (wand->debug != MagickFalse)
4521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4522  if (wand->images == (Image *) NULL)
4523    {
4524      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4525        "ContainsNoImages","`%s'",wand->name);
4526      return(0.0);
4527    }
4528  return(wand->images->fuzz);
4529}
4530
4531/*
4532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4533%                                                                             %
4534%                                                                             %
4535%                                                                             %
4536%   M a g i c k G e t I m a g e G a m m a                                     %
4537%                                                                             %
4538%                                                                             %
4539%                                                                             %
4540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4541%
4542%  MagickGetImageGamma() gets the image gamma.
4543%
4544%  The format of the MagickGetImageGamma method is:
4545%
4546%      double MagickGetImageGamma(MagickWand *wand)
4547%
4548%  A description of each parameter follows:
4549%
4550%    o wand: the magick wand.
4551%
4552*/
4553WandExport double MagickGetImageGamma(MagickWand *wand)
4554{
4555  assert(wand != (MagickWand *) NULL);
4556  assert(wand->signature == WandSignature);
4557  if (wand->debug != MagickFalse)
4558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4559  if (wand->images == (Image *) NULL)
4560    {
4561      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4562        "ContainsNoImages","`%s'",wand->name);
4563      return(0.0);
4564    }
4565  return(wand->images->gamma);
4566}
4567
4568/*
4569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4570%                                                                             %
4571%                                                                             %
4572%                                                                             %
4573%   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                 %
4574%                                                                             %
4575%                                                                             %
4576%                                                                             %
4577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578%
4579%  MagickGetImageGravity() gets the image gravity.
4580%
4581%  The format of the MagickGetImageGravity method is:
4582%
4583%      GravityType MagickGetImageGravity(MagickWand *wand)
4584%
4585%  A description of each parameter follows:
4586%
4587%    o wand: the magick wand.
4588%
4589*/
4590WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4591{
4592  assert(wand != (MagickWand *) NULL);
4593  assert(wand->signature == WandSignature);
4594  if (wand->debug != MagickFalse)
4595    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4596  if (wand->images == (Image *) NULL)
4597    {
4598      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4599        "ContainsNoImages","`%s'",wand->name);
4600      return(UndefinedGravity);
4601    }
4602  return(wand->images->gravity);
4603}
4604
4605/*
4606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4607%                                                                             %
4608%                                                                             %
4609%                                                                             %
4610%   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                       %
4611%                                                                             %
4612%                                                                             %
4613%                                                                             %
4614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4615%
4616%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4617%
4618%  The format of the MagickGetImageGreenPrimary method is:
4619%
4620%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4621%        double *y)
4622%
4623%  A description of each parameter follows:
4624%
4625%    o wand: the magick wand.
4626%
4627%    o x: the chromaticity green primary x-point.
4628%
4629%    o y: the chromaticity green primary y-point.
4630%
4631*/
4632WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4633  double *x,double *y)
4634{
4635  assert(wand != (MagickWand *) NULL);
4636  assert(wand->signature == WandSignature);
4637  if (wand->debug != MagickFalse)
4638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4639  if (wand->images == (Image *) NULL)
4640    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4641  *x=wand->images->chromaticity.green_primary.x;
4642  *y=wand->images->chromaticity.green_primary.y;
4643  return(MagickTrue);
4644}
4645
4646/*
4647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648%                                                                             %
4649%                                                                             %
4650%                                                                             %
4651%   M a g i c k G e t I m a g e H e i g h t                                   %
4652%                                                                             %
4653%                                                                             %
4654%                                                                             %
4655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656%
4657%  MagickGetImageHeight() returns the image height.
4658%
4659%  The format of the MagickGetImageHeight method is:
4660%
4661%      size_t MagickGetImageHeight(MagickWand *wand)
4662%
4663%  A description of each parameter follows:
4664%
4665%    o wand: the magick wand.
4666%
4667*/
4668WandExport size_t MagickGetImageHeight(MagickWand *wand)
4669{
4670  assert(wand != (MagickWand *) NULL);
4671  assert(wand->signature == WandSignature);
4672  if (wand->debug != MagickFalse)
4673    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4674  if (wand->images == (Image *) NULL)
4675    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4676  return(wand->images->rows);
4677}
4678
4679/*
4680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4681%                                                                             %
4682%                                                                             %
4683%                                                                             %
4684%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4685%                                                                             %
4686%                                                                             %
4687%                                                                             %
4688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4689%
4690%  MagickGetImageHistogram() returns the image histogram as an array of
4691%  PixelWand wands.
4692%
4693%  The format of the MagickGetImageHistogram method is:
4694%
4695%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4696%        size_t *number_colors)
4697%
4698%  A description of each parameter follows:
4699%
4700%    o wand: the magick wand.
4701%
4702%    o number_colors: the number of unique colors in the image and the number
4703%      of pixel wands returned.
4704%
4705*/
4706WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4707  size_t *number_colors)
4708{
4709  PixelInfo
4710    *histogram;
4711
4712  PixelWand
4713    **pixel_wands;
4714
4715  register ssize_t
4716    i;
4717
4718  assert(wand != (MagickWand *) NULL);
4719  assert(wand->signature == WandSignature);
4720  if (wand->debug != MagickFalse)
4721    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4722  if (wand->images == (Image *) NULL)
4723    {
4724      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4725        "ContainsNoImages","`%s'",wand->name);
4726      return((PixelWand **) NULL);
4727    }
4728  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4729  if (histogram == (PixelInfo *) NULL)
4730    return((PixelWand **) NULL);
4731  pixel_wands=NewPixelWands(*number_colors);
4732  for (i=0; i < (ssize_t) *number_colors; i++)
4733  {
4734    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4735    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4736  }
4737  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4738  return(pixel_wands);
4739}
4740
4741/*
4742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4743%                                                                             %
4744%                                                                             %
4745%                                                                             %
4746%   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                 %
4747%                                                                             %
4748%                                                                             %
4749%                                                                             %
4750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4751%
4752%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4753%
4754%  The format of the MagickGetImageInterlaceScheme method is:
4755%
4756%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4757%
4758%  A description of each parameter follows:
4759%
4760%    o wand: the magick wand.
4761%
4762*/
4763WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4764{
4765  assert(wand != (MagickWand *) NULL);
4766  assert(wand->signature == WandSignature);
4767  if (wand->debug != MagickFalse)
4768    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4769  if (wand->images == (Image *) NULL)
4770    {
4771      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4772        "ContainsNoImages","`%s'",wand->name);
4773      return(UndefinedInterlace);
4774    }
4775  return(wand->images->interlace);
4776}
4777
4778/*
4779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4780%                                                                             %
4781%                                                                             %
4782%                                                                             %
4783%   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             %
4784%                                                                             %
4785%                                                                             %
4786%                                                                             %
4787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4788%
4789%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4790%  sepcified image.
4791%
4792%  The format of the MagickGetImageInterpolateMethod method is:
4793%
4794%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4795%        MagickWand *wand)
4796%
4797%  A description of each parameter follows:
4798%
4799%    o wand: the magick wand.
4800%
4801*/
4802WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4803  MagickWand *wand)
4804{
4805  assert(wand != (MagickWand *) NULL);
4806  assert(wand->signature == WandSignature);
4807  if (wand->debug != MagickFalse)
4808    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4809  if (wand->images == (Image *) NULL)
4810    {
4811      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4812        "ContainsNoImages","`%s'",wand->name);
4813      return(UndefinedInterpolatePixel);
4814    }
4815  return(wand->images->interpolate);
4816}
4817
4818/*
4819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820%                                                                             %
4821%                                                                             %
4822%                                                                             %
4823%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4824%                                                                             %
4825%                                                                             %
4826%                                                                             %
4827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4828%
4829%  MagickGetImageIterations() gets the image iterations.
4830%
4831%  The format of the MagickGetImageIterations method is:
4832%
4833%      size_t MagickGetImageIterations(MagickWand *wand)
4834%
4835%  A description of each parameter follows:
4836%
4837%    o wand: the magick wand.
4838%
4839*/
4840WandExport size_t MagickGetImageIterations(MagickWand *wand)
4841{
4842  assert(wand != (MagickWand *) NULL);
4843  assert(wand->signature == WandSignature);
4844  if (wand->debug != MagickFalse)
4845    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4846  if (wand->images == (Image *) NULL)
4847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4848  return(wand->images->iterations);
4849}
4850
4851/*
4852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4853%                                                                             %
4854%                                                                             %
4855%                                                                             %
4856%   M a g i c k G e t I m a g e L e n g t h                                   %
4857%                                                                             %
4858%                                                                             %
4859%                                                                             %
4860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861%
4862%  MagickGetImageLength() returns the image length in bytes.
4863%
4864%  The format of the MagickGetImageLength method is:
4865%
4866%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4867%        MagickSizeType *length)
4868%
4869%  A description of each parameter follows:
4870%
4871%    o wand: the magick wand.
4872%
4873%    o length: the image length in bytes.
4874%
4875*/
4876WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4877  MagickSizeType *length)
4878{
4879  assert(wand != (MagickWand *) NULL);
4880  assert(wand->signature == WandSignature);
4881  if (wand->debug != MagickFalse)
4882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4883  if (wand->images == (Image *) NULL)
4884    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4885  *length=GetBlobSize(wand->images);
4886  return(MagickTrue);
4887}
4888
4889/*
4890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4891%                                                                             %
4892%                                                                             %
4893%                                                                             %
4894%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4895%                                                                             %
4896%                                                                             %
4897%                                                                             %
4898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4899%
4900%  MagickGetImageMatteColor() returns the image matte color.
4901%
4902%  The format of the MagickGetImageMatteColor method is:
4903%
4904%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4905%        PixelWand *matte_color)
4906%
4907%  A description of each parameter follows:
4908%
4909%    o wand: the magick wand.
4910%
4911%    o matte_color: Return the matte color.
4912%
4913*/
4914WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4915  PixelWand *matte_color)
4916{
4917  assert(wand != (MagickWand *) NULL);
4918  assert(wand->signature == WandSignature);
4919  if (wand->debug != MagickFalse)
4920    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4921  if (wand->images == (Image *) NULL)
4922    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4923  PixelSetPixelColor(matte_color,&wand->images->matte_color);
4924  return(MagickTrue);
4925}
4926
4927/*
4928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4929%                                                                             %
4930%                                                                             %
4931%                                                                             %
4932%   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                         %
4933%                                                                             %
4934%                                                                             %
4935%                                                                             %
4936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4937%
4938%  MagickGetImageOrientation() returns the image orientation.
4939%
4940%  The format of the MagickGetImageOrientation method is:
4941%
4942%      OrientationType MagickGetImageOrientation(MagickWand *wand)
4943%
4944%  A description of each parameter follows:
4945%
4946%    o wand: the magick wand.
4947%
4948*/
4949WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4950{
4951  assert(wand != (MagickWand *) NULL);
4952  assert(wand->signature == WandSignature);
4953  if (wand->debug != MagickFalse)
4954    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4955  if (wand->images == (Image *) NULL)
4956    {
4957      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4958        "ContainsNoImages","`%s'",wand->name);
4959      return(UndefinedOrientation);
4960    }
4961  return(wand->images->orientation);
4962}
4963
4964/*
4965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4966%                                                                             %
4967%                                                                             %
4968%                                                                             %
4969%   M a g i c k G e t I m a g e P a g e                                       %
4970%                                                                             %
4971%                                                                             %
4972%                                                                             %
4973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4974%
4975%  MagickGetImagePage() returns the page geometry associated with the image.
4976%
4977%  The format of the MagickGetImagePage method is:
4978%
4979%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4980%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4981%
4982%  A description of each parameter follows:
4983%
4984%    o wand: the magick wand.
4985%
4986%    o width: the page width.
4987%
4988%    o height: the page height.
4989%
4990%    o x: the page x-offset.
4991%
4992%    o y: the page y-offset.
4993%
4994*/
4995WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4996  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4997{
4998  assert(wand != (const MagickWand *) NULL);
4999  assert(wand->signature == WandSignature);
5000  if (wand->debug != MagickFalse)
5001    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5002  if (wand->images == (Image *) NULL)
5003    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5004  *width=wand->images->page.width;
5005  *height=wand->images->page.height;
5006  *x=wand->images->page.x;
5007  *y=wand->images->page.y;
5008  return(MagickTrue);
5009}
5010
5011/*
5012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013%                                                                             %
5014%                                                                             %
5015%                                                                             %
5016%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5017%                                                                             %
5018%                                                                             %
5019%                                                                             %
5020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5021%
5022%  MagickGetImagePixelColor() returns the color of the specified pixel.
5023%
5024%  The format of the MagickGetImagePixelColor method is:
5025%
5026%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5027%        const ssize_t x,const ssize_t y,PixelWand *color)
5028%
5029%  A description of each parameter follows:
5030%
5031%    o wand: the magick wand.
5032%
5033%    o x,y: the pixel offset into the image.
5034%
5035%    o color: Return the colormap color in this wand.
5036%
5037*/
5038WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5039  const ssize_t x,const ssize_t y,PixelWand *color)
5040{
5041  register const Quantum
5042    *p;
5043
5044  CacheView
5045    *image_view;
5046
5047  assert(wand != (MagickWand *) NULL);
5048  assert(wand->signature == WandSignature);
5049  if (wand->debug != MagickFalse)
5050    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5051  if (wand->images == (Image *) NULL)
5052    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5053  image_view=AcquireCacheView(wand->images);
5054  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5055  if (p == (const Quantum *) NULL)
5056    {
5057      image_view=DestroyCacheView(image_view);
5058      return(MagickFalse);
5059    }
5060  PixelSetQuantumPixel(wand->images,p,color);
5061  image_view=DestroyCacheView(image_view);
5062  return(MagickTrue);
5063}
5064
5065/*
5066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5067%                                                                             %
5068%                                                                             %
5069%                                                                             %
5070%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5071%                                                                             %
5072%                                                                             %
5073%                                                                             %
5074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5075%
5076%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5077%
5078%  The format of the MagickGetImageRedPrimary method is:
5079%
5080%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5081%        double *y)
5082%
5083%  A description of each parameter follows:
5084%
5085%    o wand: the magick wand.
5086%
5087%    o x: the chromaticity red primary x-point.
5088%
5089%    o y: the chromaticity red primary y-point.
5090%
5091*/
5092WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5093  double *x,double *y)
5094{
5095  assert(wand != (MagickWand *) NULL);
5096  assert(wand->signature == WandSignature);
5097  if (wand->debug != MagickFalse)
5098    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5099  if (wand->images == (Image *) NULL)
5100    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5101  *x=wand->images->chromaticity.red_primary.x;
5102  *y=wand->images->chromaticity.red_primary.y;
5103  return(MagickTrue);
5104}
5105
5106/*
5107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5108%                                                                             %
5109%                                                                             %
5110%                                                                             %
5111%   M a g i c k G e t I m a g e R e g i o n                                   %
5112%                                                                             %
5113%                                                                             %
5114%                                                                             %
5115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5116%
5117%  MagickGetImageRegion() extracts a region of the image and returns it as a
5118%  a new wand.
5119%
5120%  The format of the MagickGetImageRegion method is:
5121%
5122%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5123%        const size_t width,const size_t height,const ssize_t x,
5124%        const ssize_t y)
5125%
5126%  A description of each parameter follows:
5127%
5128%    o wand: the magick wand.
5129%
5130%    o width: the region width.
5131%
5132%    o height: the region height.
5133%
5134%    o x: the region x offset.
5135%
5136%    o y: the region y offset.
5137%
5138*/
5139WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5140  const size_t width,const size_t height,const ssize_t x,
5141  const ssize_t y)
5142{
5143  Image
5144    *region_image;
5145
5146  RectangleInfo
5147    region;
5148
5149  assert(wand != (MagickWand *) NULL);
5150  assert(wand->signature == WandSignature);
5151  if (wand->debug != MagickFalse)
5152    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5153  if (wand->images == (Image *) NULL)
5154    return((MagickWand *) NULL);
5155  region.width=width;
5156  region.height=height;
5157  region.x=x;
5158  region.y=y;
5159  region_image=CropImage(wand->images,&region,wand->exception);
5160  if (region_image == (Image *) NULL)
5161    return((MagickWand *) NULL);
5162  return(CloneMagickWandFromImages(wand,region_image));
5163}
5164
5165/*
5166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5167%                                                                             %
5168%                                                                             %
5169%                                                                             %
5170%   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                 %
5171%                                                                             %
5172%                                                                             %
5173%                                                                             %
5174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5175%
5176%  MagickGetImageRenderingIntent() gets the image rendering intent.
5177%
5178%  The format of the MagickGetImageRenderingIntent method is:
5179%
5180%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5181%
5182%  A description of each parameter follows:
5183%
5184%    o wand: the magick wand.
5185%
5186*/
5187WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5188{
5189  assert(wand != (MagickWand *) NULL);
5190  assert(wand->signature == WandSignature);
5191  if (wand->debug != MagickFalse)
5192    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5193  if (wand->images == (Image *) NULL)
5194    {
5195      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5196        "ContainsNoImages","`%s'",wand->name);
5197      return(UndefinedIntent);
5198    }
5199  return((RenderingIntent) wand->images->rendering_intent);
5200}
5201
5202/*
5203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5204%                                                                             %
5205%                                                                             %
5206%                                                                             %
5207%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5208%                                                                             %
5209%                                                                             %
5210%                                                                             %
5211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5212%
5213%  MagickGetImageResolution() gets the image X and Y resolution.
5214%
5215%  The format of the MagickGetImageResolution method is:
5216%
5217%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5218%        double *y)
5219%
5220%  A description of each parameter follows:
5221%
5222%    o wand: the magick wand.
5223%
5224%    o x: the image x-resolution.
5225%
5226%    o y: the image y-resolution.
5227%
5228*/
5229WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5230  double *x,double *y)
5231{
5232  assert(wand != (MagickWand *) NULL);
5233  assert(wand->signature == WandSignature);
5234  if (wand->debug != MagickFalse)
5235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5236  if (wand->images == (Image *) NULL)
5237    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5238  *x=wand->images->resolution.x;
5239  *y=wand->images->resolution.y;
5240  return(MagickTrue);
5241}
5242
5243/*
5244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5245%                                                                             %
5246%                                                                             %
5247%                                                                             %
5248%   M a g i c k G e t I m a g e S c e n e                                     %
5249%                                                                             %
5250%                                                                             %
5251%                                                                             %
5252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5253%
5254%  MagickGetImageScene() gets the image scene.
5255%
5256%  The format of the MagickGetImageScene method is:
5257%
5258%      size_t MagickGetImageScene(MagickWand *wand)
5259%
5260%  A description of each parameter follows:
5261%
5262%    o wand: the magick wand.
5263%
5264*/
5265WandExport size_t MagickGetImageScene(MagickWand *wand)
5266{
5267  assert(wand != (MagickWand *) NULL);
5268  assert(wand->signature == WandSignature);
5269  if (wand->debug != MagickFalse)
5270    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5271  if (wand->images == (Image *) NULL)
5272    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5273  return(wand->images->scene);
5274}
5275
5276/*
5277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5278%                                                                             %
5279%                                                                             %
5280%                                                                             %
5281%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5282%                                                                             %
5283%                                                                             %
5284%                                                                             %
5285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5286%
5287%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5288%  pixel stream.
5289%
5290%  The format of the MagickGetImageSignature method is:
5291%
5292%      const char MagickGetImageSignature(MagickWand *wand)
5293%
5294%  A description of each parameter follows:
5295%
5296%    o wand: the magick wand.
5297%
5298*/
5299WandExport char *MagickGetImageSignature(MagickWand *wand)
5300{
5301  const char
5302    *value;
5303
5304  MagickBooleanType
5305    status;
5306
5307  assert(wand != (MagickWand *) NULL);
5308  assert(wand->signature == WandSignature);
5309  if (wand->debug != MagickFalse)
5310    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5311  if (wand->images == (Image *) NULL)
5312    {
5313      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5314        "ContainsNoImages","`%s'",wand->name);
5315      return((char *) NULL);
5316    }
5317  status=SignatureImage(wand->images,wand->exception);
5318  if (status == MagickFalse)
5319    return((char *) NULL);
5320  value=GetImageProperty(wand->images,"signature",wand->exception);
5321  if (value == (const char *) NULL)
5322    return((char *) NULL);
5323  return(AcquireString(value));
5324}
5325
5326/*
5327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5328%                                                                             %
5329%                                                                             %
5330%                                                                             %
5331%   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                   %
5332%                                                                             %
5333%                                                                             %
5334%                                                                             %
5335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5336%
5337%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5338%
5339%  The format of the MagickGetImageTicksPerSecond method is:
5340%
5341%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5342%
5343%  A description of each parameter follows:
5344%
5345%    o wand: the magick wand.
5346%
5347*/
5348WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5349{
5350  assert(wand != (MagickWand *) NULL);
5351  assert(wand->signature == WandSignature);
5352  if (wand->debug != MagickFalse)
5353    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5354  if (wand->images == (Image *) NULL)
5355    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5356  return((size_t) wand->images->ticks_per_second);
5357}
5358
5359/*
5360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361%                                                                             %
5362%                                                                             %
5363%                                                                             %
5364%   M a g i c k G e t I m a g e T y p e                                       %
5365%                                                                             %
5366%                                                                             %
5367%                                                                             %
5368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5369%
5370%  MagickGetImageType() gets the potential image type:
5371%
5372%        Bilevel        Grayscale       GrayscaleMatte
5373%        Palette        PaletteMatte    TrueColor
5374%        TrueColorMatte ColorSeparation ColorSeparationMatte
5375%
5376%  To ensure the image type matches its potential, use MagickSetImageType():
5377%
5378%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5379%
5380%  The format of the MagickGetImageType method is:
5381%
5382%      ImageType MagickGetImageType(MagickWand *wand)
5383%
5384%  A description of each parameter follows:
5385%
5386%    o wand: the magick wand.
5387%
5388*/
5389WandExport ImageType MagickGetImageType(MagickWand *wand)
5390{
5391  assert(wand != (MagickWand *) NULL);
5392  assert(wand->signature == WandSignature);
5393  if (wand->debug != MagickFalse)
5394    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5395  if (wand->images == (Image *) NULL)
5396    {
5397      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5398        "ContainsNoImages","`%s'",wand->name);
5399      return(UndefinedType);
5400    }
5401  return(GetImageType(wand->images,wand->exception));
5402}
5403
5404/*
5405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5406%                                                                             %
5407%                                                                             %
5408%                                                                             %
5409%   M a g i c k G e t I m a g e U n i t s                                     %
5410%                                                                             %
5411%                                                                             %
5412%                                                                             %
5413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5414%
5415%  MagickGetImageUnits() gets the image units of resolution.
5416%
5417%  The format of the MagickGetImageUnits method is:
5418%
5419%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5420%
5421%  A description of each parameter follows:
5422%
5423%    o wand: the magick wand.
5424%
5425*/
5426WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5427{
5428  assert(wand != (MagickWand *) NULL);
5429  assert(wand->signature == WandSignature);
5430  if (wand->debug != MagickFalse)
5431    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5432  if (wand->images == (Image *) NULL)
5433    {
5434      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5435        "ContainsNoImages","`%s'",wand->name);
5436      return(UndefinedResolution);
5437    }
5438  return(wand->images->units);
5439}
5440
5441/*
5442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5443%                                                                             %
5444%                                                                             %
5445%                                                                             %
5446%   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           %
5447%                                                                             %
5448%                                                                             %
5449%                                                                             %
5450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5451%
5452%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5453%  sepcified image.
5454%
5455%  The format of the MagickGetImageVirtualPixelMethod method is:
5456%
5457%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5458%
5459%  A description of each parameter follows:
5460%
5461%    o wand: the magick wand.
5462%
5463*/
5464WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5465{
5466  assert(wand != (MagickWand *) NULL);
5467  assert(wand->signature == WandSignature);
5468  if (wand->debug != MagickFalse)
5469    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5470  if (wand->images == (Image *) NULL)
5471    {
5472      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5473        "ContainsNoImages","`%s'",wand->name);
5474      return(UndefinedVirtualPixelMethod);
5475    }
5476  return(GetImageVirtualPixelMethod(wand->images));
5477}
5478
5479/*
5480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5481%                                                                             %
5482%                                                                             %
5483%                                                                             %
5484%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5485%                                                                             %
5486%                                                                             %
5487%                                                                             %
5488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5489%
5490%  MagickGetImageWhitePoint() returns the chromaticy white point.
5491%
5492%  The format of the MagickGetImageWhitePoint method is:
5493%
5494%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5495%        double *y)
5496%
5497%  A description of each parameter follows:
5498%
5499%    o wand: the magick wand.
5500%
5501%    o x: the chromaticity white x-point.
5502%
5503%    o y: the chromaticity white y-point.
5504%
5505*/
5506WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5507  double *x,double *y)
5508{
5509  assert(wand != (MagickWand *) NULL);
5510  assert(wand->signature == WandSignature);
5511  if (wand->debug != MagickFalse)
5512    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5513  if (wand->images == (Image *) NULL)
5514    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5515  *x=wand->images->chromaticity.white_point.x;
5516  *y=wand->images->chromaticity.white_point.y;
5517  return(MagickTrue);
5518}
5519
5520/*
5521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5522%                                                                             %
5523%                                                                             %
5524%                                                                             %
5525%   M a g i c k G e t I m a g e W i d t h                                     %
5526%                                                                             %
5527%                                                                             %
5528%                                                                             %
5529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5530%
5531%  MagickGetImageWidth() returns the image width.
5532%
5533%  The format of the MagickGetImageWidth method is:
5534%
5535%      size_t MagickGetImageWidth(MagickWand *wand)
5536%
5537%  A description of each parameter follows:
5538%
5539%    o wand: the magick wand.
5540%
5541*/
5542WandExport size_t MagickGetImageWidth(MagickWand *wand)
5543{
5544  assert(wand != (MagickWand *) NULL);
5545  assert(wand->signature == WandSignature);
5546  if (wand->debug != MagickFalse)
5547    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5548  if (wand->images == (Image *) NULL)
5549    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5550  return(wand->images->columns);
5551}
5552
5553/*
5554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5555%                                                                             %
5556%                                                                             %
5557%                                                                             %
5558%   M a g i c k G e t N u m b e r I m a g e s                                 %
5559%                                                                             %
5560%                                                                             %
5561%                                                                             %
5562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5563%
5564%  MagickGetNumberImages() returns the number of images associated with a
5565%  magick wand.
5566%
5567%  The format of the MagickGetNumberImages method is:
5568%
5569%      size_t MagickGetNumberImages(MagickWand *wand)
5570%
5571%  A description of each parameter follows:
5572%
5573%    o wand: the magick wand.
5574%
5575*/
5576WandExport size_t MagickGetNumberImages(MagickWand *wand)
5577{
5578  assert(wand != (MagickWand *) NULL);
5579  assert(wand->signature == WandSignature);
5580  if (wand->debug != MagickFalse)
5581    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5582  return(GetImageListLength(wand->images));
5583}
5584
5585/*
5586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5587%                                                                             %
5588%                                                                             %
5589%                                                                             %
5590%   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                 %
5591%                                                                             %
5592%                                                                             %
5593%                                                                             %
5594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595%
5596%  MagickGetImageTotalInkDensity() gets the image total ink density.
5597%
5598%  The format of the MagickGetImageTotalInkDensity method is:
5599%
5600%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5601%
5602%  A description of each parameter follows:
5603%
5604%    o wand: the magick wand.
5605%
5606*/
5607WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5608{
5609  assert(wand != (MagickWand *) NULL);
5610  assert(wand->signature == WandSignature);
5611  if (wand->debug != MagickFalse)
5612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5613  if (wand->images == (Image *) NULL)
5614    {
5615      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5616        "ContainsNoImages","`%s'",wand->name);
5617      return(0.0);
5618    }
5619  return(GetImageTotalInkDensity(wand->images,wand->exception));
5620}
5621
5622/*
5623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5624%                                                                             %
5625%                                                                             %
5626%                                                                             %
5627%   M a g i c k H a l d C l u t I m a g e                                     %
5628%                                                                             %
5629%                                                                             %
5630%                                                                             %
5631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5632%
5633%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5634%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5635%  dimensions.  Create it with the HALD coder.  You can apply any color
5636%  transformation to the Hald image and then use this method to apply the
5637%  transform to the image.
5638%
5639%  The format of the MagickHaldClutImage method is:
5640%
5641%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5642%        const MagickWand *hald_wand)
5643%
5644%  A description of each parameter follows:
5645%
5646%    o wand: the magick wand.
5647%
5648%    o hald_image: the hald CLUT image.
5649%
5650*/
5651WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5652  const MagickWand *hald_wand)
5653{
5654  MagickBooleanType
5655    status;
5656
5657  assert(wand != (MagickWand *) NULL);
5658  assert(wand->signature == WandSignature);
5659  if (wand->debug != MagickFalse)
5660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5661  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5662    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5663  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5664  return(status);
5665}
5666
5667/*
5668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5669%                                                                             %
5670%                                                                             %
5671%                                                                             %
5672%   M a g i c k H a s N e x t I m a g e                                       %
5673%                                                                             %
5674%                                                                             %
5675%                                                                             %
5676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5677%
5678%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5679%  traversing the list in the forward direction
5680%
5681%  The format of the MagickHasNextImage method is:
5682%
5683%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5684%
5685%  A description of each parameter follows:
5686%
5687%    o wand: the magick wand.
5688%
5689*/
5690WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5691{
5692  assert(wand != (MagickWand *) NULL);
5693  assert(wand->signature == WandSignature);
5694  if (wand->debug != MagickFalse)
5695    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5696  if (wand->images == (Image *) NULL)
5697    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5698  if (GetNextImageInList(wand->images) == (Image *) NULL)
5699    return(MagickFalse);
5700  return(MagickTrue);
5701}
5702
5703/*
5704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5705%                                                                             %
5706%                                                                             %
5707%                                                                             %
5708%   M a g i c k H a s P r e v i o u s I m a g e                               %
5709%                                                                             %
5710%                                                                             %
5711%                                                                             %
5712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5713%
5714%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5715%  traversing the list in the reverse direction
5716%
5717%  The format of the MagickHasPreviousImage method is:
5718%
5719%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5720%
5721%  A description of each parameter follows:
5722%
5723%    o wand: the magick wand.
5724%
5725*/
5726WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5727{
5728  assert(wand != (MagickWand *) NULL);
5729  assert(wand->signature == WandSignature);
5730  if (wand->debug != MagickFalse)
5731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5732  if (wand->images == (Image *) NULL)
5733    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5734  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5735    return(MagickFalse);
5736  return(MagickTrue);
5737}
5738
5739/*
5740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5741%                                                                             %
5742%                                                                             %
5743%                                                                             %
5744%   M a g i c k I d e n t i f y I m a g e                                     %
5745%                                                                             %
5746%                                                                             %
5747%                                                                             %
5748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5749%
5750%  MagickIdentifyImage() identifies an image by printing its attributes to the
5751%  file.  Attributes include the image width, height, size, and others.
5752%
5753%  The format of the MagickIdentifyImage method is:
5754%
5755%      const char *MagickIdentifyImage(MagickWand *wand)
5756%
5757%  A description of each parameter follows:
5758%
5759%    o wand: the magick wand.
5760%
5761*/
5762WandExport char *MagickIdentifyImage(MagickWand *wand)
5763{
5764  char
5765    *description,
5766    filename[MaxTextExtent];
5767
5768  FILE
5769    *file;
5770
5771  int
5772    unique_file;
5773
5774  assert(wand != (MagickWand *) NULL);
5775  assert(wand->signature == WandSignature);
5776  if (wand->debug != MagickFalse)
5777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5778  if (wand->images == (Image *) NULL)
5779    {
5780      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5781        "ContainsNoImages","`%s'",wand->name);
5782      return((char *) NULL);
5783    }
5784  description=(char *) NULL;
5785  unique_file=AcquireUniqueFileResource(filename);
5786  file=(FILE *) NULL;
5787  if (unique_file != -1)
5788    file=fdopen(unique_file,"wb");
5789  if ((unique_file == -1) || (file == (FILE *) NULL))
5790    {
5791      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5792        "UnableToCreateTemporaryFile","`%s'",wand->name);
5793      return((char *) NULL);
5794    }
5795  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5796  (void) fclose(file);
5797  description=FileToString(filename,~0,wand->exception);
5798  (void) RelinquishUniqueFileResource(filename);
5799  return(description);
5800}
5801
5802/*
5803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5804%                                                                             %
5805%                                                                             %
5806%                                                                             %
5807%   M a g i c k I m p l o d e I m a g e                                       %
5808%                                                                             %
5809%                                                                             %
5810%                                                                             %
5811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5812%
5813%  MagickImplodeImage() creates a new image that is a copy of an existing
5814%  one with the image pixels "implode" by the specified percentage.  It
5815%  allocates the memory necessary for the new Image structure and returns a
5816%  pointer to the new image.
5817%
5818%  The format of the MagickImplodeImage method is:
5819%
5820%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5821%        const double radius,const PixelInterpolateMethod method)
5822%
5823%  A description of each parameter follows:
5824%
5825%    o wand: the magick wand.
5826%
5827%    o amount: Define the extent of the implosion.
5828%
5829%    o method: the pixel interpolation method.
5830%
5831*/
5832WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5833  const double amount,const PixelInterpolateMethod method)
5834{
5835  Image
5836    *implode_image;
5837
5838  assert(wand != (MagickWand *) NULL);
5839  assert(wand->signature == WandSignature);
5840  if (wand->debug != MagickFalse)
5841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5842  if (wand->images == (Image *) NULL)
5843    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5844  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5845  if (implode_image == (Image *) NULL)
5846    return(MagickFalse);
5847  ReplaceImageInList(&wand->images,implode_image);
5848  return(MagickTrue);
5849}
5850
5851/*
5852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5853%                                                                             %
5854%                                                                             %
5855%                                                                             %
5856%   M a g i c k I m p o r t I m a g e P i x e l s                             %
5857%                                                                             %
5858%                                                                             %
5859%                                                                             %
5860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5861%
5862%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5863%  location you specify.  The method returns MagickFalse on success otherwise
5864%  MagickTrue if an error is encountered.  The pixel data can be either char,
5865%  short int, int, ssize_t, float, or double in the order specified by map.
5866%
5867%  Suppose your want to upload the first scanline of a 640x480 image from
5868%  character data in red-green-blue order:
5869%
5870%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5871%
5872%  The format of the MagickImportImagePixels method is:
5873%
5874%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5875%        const ssize_t x,const ssize_t y,const size_t columns,
5876%        const size_t rows,const char *map,const StorageType storage,
5877%        const void *pixels)
5878%
5879%  A description of each parameter follows:
5880%
5881%    o wand: the magick wand.
5882%
5883%    o x, y, columns, rows:  These values define the perimeter of a region
5884%      of pixels you want to define.
5885%
5886%    o map:  This string reflects the expected ordering of the pixel array.
5887%      It can be any combination or order of R = red, G = green, B = blue,
5888%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5889%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5890%      P = pad.
5891%
5892%    o storage: Define the data type of the pixels.  Float and double types are
5893%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5894%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5895%      or DoublePixel.
5896%
5897%    o pixels: This array of values contain the pixel components as defined by
5898%      map and type.  You must preallocate this array where the expected
5899%      length varies depending on the values of width, height, map, and type.
5900%
5901*/
5902WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5903  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5904  const char *map,const StorageType storage,const void *pixels)
5905{
5906  MagickBooleanType
5907    status;
5908
5909  assert(wand != (MagickWand *) NULL);
5910  assert(wand->signature == WandSignature);
5911  if (wand->debug != MagickFalse)
5912    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5913  if (wand->images == (Image *) NULL)
5914    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5915  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5916    wand->exception);
5917  return(status);
5918}
5919
5920/*
5921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5922%                                                                             %
5923%                                                                             %
5924%                                                                             %
5925%   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       %
5926%                                                                             %
5927%                                                                             %
5928%                                                                             %
5929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5930%
5931%  MagickInverseFourierTransformImage() implements the inverse discrete
5932%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5933%  imaginary image pair.
5934%
5935%  The format of the MagickInverseFourierTransformImage method is:
5936%
5937%      MagickBooleanType MagickInverseFourierTransformImage(
5938%        MagickWand *magnitude_wand,MagickWand *phase_wand,
5939%        const MagickBooleanType magnitude)
5940%
5941%  A description of each parameter follows:
5942%
5943%    o magnitude_wand: the magnitude or real wand.
5944%
5945%    o phase_wand: the phase or imaginary wand.
5946%
5947%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5948%      imaginary image pair.
5949%
5950*/
5951WandExport MagickBooleanType MagickInverseFourierTransformImage(
5952  MagickWand *magnitude_wand,MagickWand *phase_wand,
5953  const MagickBooleanType magnitude)
5954{
5955  Image
5956    *inverse_image;
5957
5958  MagickWand
5959    *wand;
5960
5961  assert(magnitude_wand != (MagickWand *) NULL);
5962  assert(magnitude_wand->signature == WandSignature);
5963  if (magnitude_wand->debug != MagickFalse)
5964    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5965      magnitude_wand->name);
5966  wand=magnitude_wand;
5967  if (magnitude_wand->images == (Image *) NULL)
5968    ThrowWandException(WandError,"ContainsNoImages",
5969      magnitude_wand->name);
5970  assert(phase_wand != (MagickWand *) NULL);
5971  assert(phase_wand->signature == WandSignature);
5972  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5973    phase_wand->images,magnitude,wand->exception);
5974  if (inverse_image == (Image *) NULL)
5975    return(MagickFalse);
5976  ReplaceImageInList(&wand->images,inverse_image);
5977  return(MagickTrue);
5978}
5979
5980/*
5981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982%                                                                             %
5983%                                                                             %
5984%                                                                             %
5985%   M a g i c k L a b e l I m a g e                                           %
5986%                                                                             %
5987%                                                                             %
5988%                                                                             %
5989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5990%
5991%  MagickLabelImage() adds a label to your image.
5992%
5993%  The format of the MagickLabelImage method is:
5994%
5995%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5996%
5997%  A description of each parameter follows:
5998%
5999%    o wand: the magick wand.
6000%
6001%    o label: the image label.
6002%
6003*/
6004WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6005  const char *label)
6006{
6007  MagickBooleanType
6008    status;
6009
6010  assert(wand != (MagickWand *) NULL);
6011  assert(wand->signature == WandSignature);
6012  if (wand->debug != MagickFalse)
6013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6014  if (wand->images == (Image *) NULL)
6015    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6016  status=SetImageProperty(wand->images,"label",label,wand->exception);
6017  return(status);
6018}
6019
6020/*
6021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6022%                                                                             %
6023%                                                                             %
6024%                                                                             %
6025%   M a g i c k L e v e l I m a g e                                           %
6026%                                                                             %
6027%                                                                             %
6028%                                                                             %
6029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6030%
6031%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6032%  falling between specified white and black points to the full available
6033%  quantum range. The parameters provided represent the black, mid, and white
6034%  points. The black point specifies the darkest color in the image. Colors
6035%  darker than the black point are set to zero. Mid point specifies a gamma
6036%  correction to apply to the image.  White point specifies the lightest color
6037%  in the image. Colors brighter than the white point are set to the maximum
6038%  quantum value.
6039%
6040%  The format of the MagickLevelImage method is:
6041%
6042%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6043%        const double black_point,const double gamma,const double white_point)
6044%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6045%        const ChannelType channel,const double black_point,const double gamma,
6046%        const double white_point)
6047%
6048%  A description of each parameter follows:
6049%
6050%    o wand: the magick wand.
6051%
6052%    o channel: Identify which channel to level: RedPixelChannel,
6053%      GreenPixelChannel, etc.
6054%
6055%    o black_point: the black point.
6056%
6057%    o gamma: the gamma.
6058%
6059%    o white_point: the white point.
6060%
6061*/
6062WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6063  const double black_point,const double gamma,const double white_point)
6064{
6065  MagickBooleanType
6066    status;
6067
6068  assert(wand != (MagickWand *) NULL);
6069  assert(wand->signature == WandSignature);
6070  if (wand->debug != MagickFalse)
6071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6072  if (wand->images == (Image *) NULL)
6073    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6074  status=LevelImage(wand->images,black_point,white_point,gamma,
6075    wand->exception);
6076  return(status);
6077}
6078
6079/*
6080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6081%                                                                             %
6082%                                                                             %
6083%                                                                             %
6084%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6085%                                                                             %
6086%                                                                             %
6087%                                                                             %
6088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6089%
6090%  MagickLinearStretchImage() stretches with saturation the image intensity.
6091%
6092%  You can also reduce the influence of a particular channel with a gamma
6093%  value of 0.
6094%
6095%  The format of the MagickLinearStretchImage method is:
6096%
6097%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6098%        const double black_point,const double white_point)
6099%
6100%  A description of each parameter follows:
6101%
6102%    o wand: the magick wand.
6103%
6104%    o black_point: the black point.
6105%
6106%    o white_point: the white point.
6107%
6108*/
6109WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6110  const double black_point,const double white_point)
6111{
6112  MagickBooleanType
6113    status;
6114
6115  assert(wand != (MagickWand *) NULL);
6116  assert(wand->signature == WandSignature);
6117  if (wand->debug != MagickFalse)
6118    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6119  if (wand->images == (Image *) NULL)
6120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6121  status=LinearStretchImage(wand->images,black_point,white_point,
6122    wand->exception);
6123  return(status);
6124}
6125
6126/*
6127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6128%                                                                             %
6129%                                                                             %
6130%                                                                             %
6131%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6132%                                                                             %
6133%                                                                             %
6134%                                                                             %
6135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6136%
6137%  MagickLiquidRescaleImage() rescales image with seam carving.
6138%
6139%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6140%        const size_t columns,const size_t rows,
6141%        const double delta_x,const double rigidity)
6142%
6143%  A description of each parameter follows:
6144%
6145%    o wand: the magick wand.
6146%
6147%    o columns: the number of columns in the scaled image.
6148%
6149%    o rows: the number of rows in the scaled image.
6150%
6151%    o delta_x: maximum seam transversal step (0 means straight seams).
6152%
6153%    o rigidity: introduce a bias for non-straight seams (typically 0).
6154%
6155*/
6156WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6157  const size_t columns,const size_t rows,const double delta_x,
6158  const double rigidity)
6159{
6160  Image
6161    *rescale_image;
6162
6163  assert(wand != (MagickWand *) NULL);
6164  assert(wand->signature == WandSignature);
6165  if (wand->debug != MagickFalse)
6166    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6167  if (wand->images == (Image *) NULL)
6168    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6169  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6170    rigidity,wand->exception);
6171  if (rescale_image == (Image *) NULL)
6172    return(MagickFalse);
6173  ReplaceImageInList(&wand->images,rescale_image);
6174  return(MagickTrue);
6175}
6176
6177/*
6178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6179%                                                                             %
6180%                                                                             %
6181%                                                                             %
6182%   M a g i c k M a g n i f y I m a g e                                       %
6183%                                                                             %
6184%                                                                             %
6185%                                                                             %
6186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6187%
6188%  MagickMagnifyImage() is a convenience method that scales an image
6189%  proportionally to twice its original size.
6190%
6191%  The format of the MagickMagnifyImage method is:
6192%
6193%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6194%
6195%  A description of each parameter follows:
6196%
6197%    o wand: the magick wand.
6198%
6199*/
6200WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6201{
6202  Image
6203    *magnify_image;
6204
6205  assert(wand != (MagickWand *) NULL);
6206  assert(wand->signature == WandSignature);
6207  if (wand->debug != MagickFalse)
6208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6209  if (wand->images == (Image *) NULL)
6210    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6211  magnify_image=MagnifyImage(wand->images,wand->exception);
6212  if (magnify_image == (Image *) NULL)
6213    return(MagickFalse);
6214  ReplaceImageInList(&wand->images,magnify_image);
6215  return(MagickTrue);
6216}
6217
6218/*
6219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6220%                                                                             %
6221%                                                                             %
6222%                                                                             %
6223%   M a g i c k M e r g e I m a g e L a y e r s                               %
6224%                                                                             %
6225%                                                                             %
6226%                                                                             %
6227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6228%
6229%  MagickMergeImageLayers() composes all the image layers from the current
6230%  given image onward to produce a single image of the merged layers.
6231%
6232%  The inital canvas's size depends on the given ImageLayerMethod, and is
6233%  initialized using the first images background color.  The images
6234%  are then compositied onto that image in sequence using the given
6235%  composition that has been assigned to each individual image.
6236%
6237%  The format of the MagickMergeImageLayers method is:
6238%
6239%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6240%        const ImageLayerMethod method)
6241%
6242%  A description of each parameter follows:
6243%
6244%    o wand: the magick wand.
6245%
6246%    o method: the method of selecting the size of the initial canvas.
6247%
6248%        MergeLayer: Merge all layers onto a canvas just large enough
6249%           to hold all the actual images. The virtual canvas of the
6250%           first image is preserved but otherwise ignored.
6251%
6252%        FlattenLayer: Use the virtual canvas size of first image.
6253%           Images which fall outside this canvas is clipped.
6254%           This can be used to 'fill out' a given virtual canvas.
6255%
6256%        MosaicLayer: Start with the virtual canvas of the first image,
6257%           enlarging left and right edges to contain all images.
6258%           Images with negative offsets will be clipped.
6259%
6260*/
6261WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6262  const ImageLayerMethod method)
6263{
6264  Image
6265    *mosaic_image;
6266
6267  assert(wand != (MagickWand *) NULL);
6268  assert(wand->signature == WandSignature);
6269  if (wand->debug != MagickFalse)
6270    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6271  if (wand->images == (Image *) NULL)
6272    return((MagickWand *) NULL);
6273  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6274  if (mosaic_image == (Image *) NULL)
6275    return((MagickWand *) NULL);
6276  return(CloneMagickWandFromImages(wand,mosaic_image));
6277}
6278
6279/*
6280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6281%                                                                             %
6282%                                                                             %
6283%                                                                             %
6284%   M a g i c k M i n i f y I m a g e                                         %
6285%                                                                             %
6286%                                                                             %
6287%                                                                             %
6288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6289%
6290%  MagickMinifyImage() is a convenience method that scales an image
6291%  proportionally to one-half its original size
6292%
6293%  The format of the MagickMinifyImage method is:
6294%
6295%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6296%
6297%  A description of each parameter follows:
6298%
6299%    o wand: the magick wand.
6300%
6301*/
6302WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6303{
6304  Image
6305    *minify_image;
6306
6307  assert(wand != (MagickWand *) NULL);
6308  assert(wand->signature == WandSignature);
6309  if (wand->debug != MagickFalse)
6310    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6311  if (wand->images == (Image *) NULL)
6312    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6313  minify_image=MinifyImage(wand->images,wand->exception);
6314  if (minify_image == (Image *) NULL)
6315    return(MagickFalse);
6316  ReplaceImageInList(&wand->images,minify_image);
6317  return(MagickTrue);
6318}
6319
6320/*
6321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6322%                                                                             %
6323%                                                                             %
6324%                                                                             %
6325%   M a g i c k M o d u l a t e I m a g e                                     %
6326%                                                                             %
6327%                                                                             %
6328%                                                                             %
6329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6330%
6331%  MagickModulateImage() lets you control the brightness, saturation, and hue
6332%  of an image.  Hue is the percentage of absolute rotation from the current
6333%  position.  For example 50 results in a counter-clockwise rotation of 90
6334%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6335%  both resulting in a rotation of 180 degrees.
6336%
6337%  To increase the color brightness by 20% and decrease the color saturation by
6338%  10% and leave the hue unchanged, use: 120,90,100.
6339%
6340%  The format of the MagickModulateImage method is:
6341%
6342%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6343%        const double brightness,const double saturation,const double hue)
6344%
6345%  A description of each parameter follows:
6346%
6347%    o wand: the magick wand.
6348%
6349%    o brightness: the percent change in brighness.
6350%
6351%    o saturation: the percent change in saturation.
6352%
6353%    o hue: the percent change in hue.
6354%
6355*/
6356WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6357  const double brightness,const double saturation,const double hue)
6358{
6359  char
6360    modulate[MaxTextExtent];
6361
6362  MagickBooleanType
6363    status;
6364
6365  assert(wand != (MagickWand *) NULL);
6366  assert(wand->signature == WandSignature);
6367  if (wand->debug != MagickFalse)
6368    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6369  if (wand->images == (Image *) NULL)
6370    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6371  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6372    brightness,saturation,hue);
6373  status=ModulateImage(wand->images,modulate,wand->exception);
6374  return(status);
6375}
6376
6377/*
6378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6379%                                                                             %
6380%                                                                             %
6381%                                                                             %
6382%   M a g i c k M o n t a g e I m a g e                                       %
6383%                                                                             %
6384%                                                                             %
6385%                                                                             %
6386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6387%
6388%  MagickMontageImage() creates a composite image by combining several
6389%  separate images. The images are tiled on the composite image with the name
6390%  of the image optionally appearing just below the individual tile.
6391%
6392%  The format of the MagickMontageImage method is:
6393%
6394%      MagickWand *MagickMontageImage(MagickWand *wand,
6395%        const DrawingWand drawing_wand,const char *tile_geometry,
6396%        const char *thumbnail_geometry,const MontageMode mode,
6397%        const char *frame)
6398%
6399%  A description of each parameter follows:
6400%
6401%    o wand: the magick wand.
6402%
6403%    o drawing_wand: the drawing wand.  The font name, size, and color are
6404%      obtained from this wand.
6405%
6406%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6407%
6408%    o thumbnail_geometry: Preferred image size and border size of each
6409%      thumbnail (e.g. 120x120+4+3>).
6410%
6411%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6412%
6413%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6414%      The frame color is that of the thumbnail's matte color.
6415%
6416*/
6417WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6418  const DrawingWand *drawing_wand,const char *tile_geometry,
6419  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6420{
6421  char
6422    *font;
6423
6424  Image
6425    *montage_image;
6426
6427  MontageInfo
6428    *montage_info;
6429
6430  PixelWand
6431    *pixel_wand;
6432
6433  assert(wand != (MagickWand *) NULL);
6434  assert(wand->signature == WandSignature);
6435  if (wand->debug != MagickFalse)
6436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6437  if (wand->images == (Image *) NULL)
6438    return((MagickWand *) NULL);
6439  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6440  switch (mode)
6441  {
6442    case FrameMode:
6443    {
6444      (void) CloneString(&montage_info->frame,"15x15+3+3");
6445      montage_info->shadow=MagickTrue;
6446      break;
6447    }
6448    case UnframeMode:
6449    {
6450      montage_info->frame=(char *) NULL;
6451      montage_info->shadow=MagickFalse;
6452      montage_info->border_width=0;
6453      break;
6454    }
6455    case ConcatenateMode:
6456    {
6457      montage_info->frame=(char *) NULL;
6458      montage_info->shadow=MagickFalse;
6459      (void) CloneString(&montage_info->geometry,"+0+0");
6460      montage_info->border_width=0;
6461      break;
6462    }
6463    default:
6464      break;
6465  }
6466  font=DrawGetFont(drawing_wand);
6467  if (font != (char *) NULL)
6468    (void) CloneString(&montage_info->font,font);
6469  if (frame != (char *) NULL)
6470    (void) CloneString(&montage_info->frame,frame);
6471  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6472  pixel_wand=NewPixelWand();
6473  DrawGetFillColor(drawing_wand,pixel_wand);
6474  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6475  DrawGetStrokeColor(drawing_wand,pixel_wand);
6476  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6477  pixel_wand=DestroyPixelWand(pixel_wand);
6478  if (thumbnail_geometry != (char *) NULL)
6479    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6480  if (tile_geometry != (char *) NULL)
6481    (void) CloneString(&montage_info->tile,tile_geometry);
6482  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6483    wand->exception);
6484  montage_info=DestroyMontageInfo(montage_info);
6485  if (montage_image == (Image *) NULL)
6486    return((MagickWand *) NULL);
6487  return(CloneMagickWandFromImages(wand,montage_image));
6488}
6489
6490/*
6491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6492%                                                                             %
6493%                                                                             %
6494%                                                                             %
6495%   M a g i c k M o r p h I m a g e s                                         %
6496%                                                                             %
6497%                                                                             %
6498%                                                                             %
6499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6500%
6501%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6502%  and size are linearly interpolated to give the appearance of a
6503%  meta-morphosis from one image to the next.
6504%
6505%  The format of the MagickMorphImages method is:
6506%
6507%      MagickWand *MagickMorphImages(MagickWand *wand,
6508%        const size_t number_frames)
6509%
6510%  A description of each parameter follows:
6511%
6512%    o wand: the magick wand.
6513%
6514%    o number_frames: the number of in-between images to generate.
6515%
6516*/
6517WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6518  const size_t number_frames)
6519{
6520  Image
6521    *morph_image;
6522
6523  assert(wand != (MagickWand *) NULL);
6524  assert(wand->signature == WandSignature);
6525  if (wand->debug != MagickFalse)
6526    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6527  if (wand->images == (Image *) NULL)
6528    return((MagickWand *) NULL);
6529  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6530  if (morph_image == (Image *) NULL)
6531    return((MagickWand *) NULL);
6532  return(CloneMagickWandFromImages(wand,morph_image));
6533}
6534
6535/*
6536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6537%                                                                             %
6538%                                                                             %
6539%                                                                             %
6540%   M a g i c k M o r p h o l o g y I m a g e                                 %
6541%                                                                             %
6542%                                                                             %
6543%                                                                             %
6544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6545%
6546%  MagickMorphologyImage() applies a user supplied kernel to the image
6547%  according to the given mophology method.
6548%
6549%  The format of the MagickMorphologyImage method is:
6550%
6551%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6552%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6553%
6554%  A description of each parameter follows:
6555%
6556%    o wand: the magick wand.
6557%
6558%    o method: the morphology method to be applied.
6559%
6560%    o iterations: apply the operation this many times (or no change).
6561%      A value of -1 means loop until no change found.  How this is applied
6562%      may depend on the morphology method.  Typically this is a value of 1.
6563%
6564%    o kernel: An array of doubles representing the morphology kernel.
6565%
6566*/
6567WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6568  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6569{
6570  Image
6571    *morphology_image;
6572
6573  assert(wand != (MagickWand *) NULL);
6574  assert(wand->signature == WandSignature);
6575  if (wand->debug != MagickFalse)
6576    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6577  if (kernel == (const KernelInfo *) NULL)
6578    return(MagickFalse);
6579  if (wand->images == (Image *) NULL)
6580    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6581  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6582    wand->exception);
6583  if (morphology_image == (Image *) NULL)
6584    return(MagickFalse);
6585  ReplaceImageInList(&wand->images,morphology_image);
6586  return(MagickTrue);
6587}
6588
6589/*
6590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591%                                                                             %
6592%                                                                             %
6593%                                                                             %
6594%   M a g i c k M o t i o n B l u r I m a g e                                 %
6595%                                                                             %
6596%                                                                             %
6597%                                                                             %
6598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6599%
6600%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6601%  Gaussian operator of the given radius and standard deviation (sigma).
6602%  For reasonable results, radius should be larger than sigma.  Use a
6603%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6604%  Angle gives the angle of the blurring motion.
6605%
6606%  The format of the MagickMotionBlurImage method is:
6607%
6608%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6609%        const double radius,const double sigma,const double angle,
6610%        const double bias)
6611%
6612%  A description of each parameter follows:
6613%
6614%    o wand: the magick wand.
6615%
6616%    o radius: the radius of the Gaussian, in pixels, not counting
6617%      the center pixel.
6618%
6619%    o sigma: the standard deviation of the Gaussian, in pixels.
6620%
6621%    o angle: Apply the effect along this angle.
6622%
6623*/
6624WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6625  const double radius,const double sigma,const double angle,const double bias)
6626{
6627  Image
6628    *blur_image;
6629
6630  assert(wand != (MagickWand *) NULL);
6631  assert(wand->signature == WandSignature);
6632  if (wand->debug != MagickFalse)
6633    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6634  if (wand->images == (Image *) NULL)
6635    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6636  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6637    wand->exception);
6638  if (blur_image == (Image *) NULL)
6639    return(MagickFalse);
6640  ReplaceImageInList(&wand->images,blur_image);
6641  return(MagickTrue);
6642}
6643
6644/*
6645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6646%                                                                             %
6647%                                                                             %
6648%                                                                             %
6649%   M a g i c k N e g a t e I m a g e                                         %
6650%                                                                             %
6651%                                                                             %
6652%                                                                             %
6653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6654%
6655%  MagickNegateImage() negates the colors in the reference image.  The
6656%  Grayscale option means that only grayscale values within the image are
6657%  negated.
6658%
6659%  You can also reduce the influence of a particular channel with a gamma
6660%  value of 0.
6661%
6662%  The format of the MagickNegateImage method is:
6663%
6664%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6665%        const MagickBooleanType gray)
6666%
6667%  A description of each parameter follows:
6668%
6669%    o wand: the magick wand.
6670%
6671%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6672%
6673*/
6674WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6675  const MagickBooleanType gray)
6676{
6677  MagickBooleanType
6678    status;
6679
6680  assert(wand != (MagickWand *) NULL);
6681  assert(wand->signature == WandSignature);
6682  if (wand->debug != MagickFalse)
6683    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6684  if (wand->images == (Image *) NULL)
6685    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6686  status=NegateImage(wand->images,gray,wand->exception);
6687  return(status);
6688}
6689
6690/*
6691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6692%                                                                             %
6693%                                                                             %
6694%                                                                             %
6695%   M a g i c k N e w I m a g e                                               %
6696%                                                                             %
6697%                                                                             %
6698%                                                                             %
6699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6700%
6701%  MagickNewImage() adds a blank image canvas of the specified size and
6702%  background color to the wand.
6703%
6704%  The format of the MagickNewImage method is:
6705%
6706%      MagickBooleanType MagickNewImage(MagickWand *wand,
6707%        const size_t columns,const size_t rows,
6708%        const PixelWand *background)
6709%
6710%  A description of each parameter follows:
6711%
6712%    o wand: the magick wand.
6713%
6714%    o width: the image width.
6715%
6716%    o height: the image height.
6717%
6718%    o background: the image color.
6719%
6720*/
6721WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6722  const size_t height,const PixelWand *background)
6723{
6724  Image
6725    *images;
6726
6727  PixelInfo
6728    pixel;
6729
6730  assert(wand != (MagickWand *) NULL);
6731  assert(wand->signature == WandSignature);
6732  if (wand->debug != MagickFalse)
6733    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6734  PixelGetMagickColor(background,&pixel);
6735  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6736  if (images == (Image *) NULL)
6737    return(MagickFalse);
6738  return(InsertImageInWand(wand,images));
6739}
6740
6741/*
6742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6743%                                                                             %
6744%                                                                             %
6745%                                                                             %
6746%   M a g i c k N e x t I m a g e                                             %
6747%                                                                             %
6748%                                                                             %
6749%                                                                             %
6750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6751%
6752%  MagickNextImage() associates the next image in the image list with a magick
6753%  wand.  It returns true if the it succeeds, meaning the current image is the
6754%  next image to be iterated over.
6755%
6756%  The format of the MagickNextImage method is:
6757%
6758%      MagickBooleanType MagickNextImage(MagickWand *wand)
6759%
6760%  A description of each parameter follows:
6761%
6762%    o wand: the magick wand.
6763%
6764*/
6765WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6766{
6767  assert(wand != (MagickWand *) NULL);
6768  assert(wand->signature == WandSignature);
6769  if (wand->debug != MagickFalse)
6770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6771  if (wand->images == (Image *) NULL)
6772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6773  /* If current image is 'pending' just return true.  */
6774  if (wand->image_pending != MagickFalse)
6775    {
6776      wand->image_pending=MagickFalse;
6777      return(MagickTrue);
6778    }
6779  /* If there is no next image, (Iterator is finished) */
6780  if (GetNextImageInList(wand->images) == (Image *) NULL)
6781      return(MagickFalse);
6782  /* just move to next image - current image is not 'pending' */
6783  wand->images=GetNextImageInList(wand->images);
6784  return(MagickTrue);
6785}
6786
6787/*
6788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6789%                                                                             %
6790%                                                                             %
6791%                                                                             %
6792%   M a g i c k N o r m a l i z e I m a g e                                   %
6793%                                                                             %
6794%                                                                             %
6795%                                                                             %
6796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6797%
6798%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6799%  the pixels color to span the entire range of colors available
6800%
6801%  You can also reduce the influence of a particular channel with a gamma
6802%  value of 0.
6803%
6804%  The format of the MagickNormalizeImage method is:
6805%
6806%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6807%
6808%  A description of each parameter follows:
6809%
6810%    o wand: the magick wand.
6811%
6812*/
6813WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6814{
6815  MagickBooleanType
6816    status;
6817
6818  assert(wand != (MagickWand *) NULL);
6819  assert(wand->signature == WandSignature);
6820  if (wand->debug != MagickFalse)
6821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6822  if (wand->images == (Image *) NULL)
6823    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6824  status=NormalizeImage(wand->images,wand->exception);
6825  return(status);
6826}
6827
6828/*
6829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830%                                                                             %
6831%                                                                             %
6832%                                                                             %
6833%   M a g i c k O i l P a i n t I m a g e                                     %
6834%                                                                             %
6835%                                                                             %
6836%                                                                             %
6837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838%
6839%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6840%  painting.  Each pixel is replaced by the most frequent color occurring
6841%  in a circular region defined by radius.
6842%
6843%  The format of the MagickOilPaintImage method is:
6844%
6845%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6846%        const double radius,const double sigma)
6847%
6848%  A description of each parameter follows:
6849%
6850%    o wand: the magick wand.
6851%
6852%    o radius: the radius of the circular neighborhood.
6853%
6854%    o sigma: the standard deviation of the Gaussian, in pixels.
6855%
6856*/
6857WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6858  const double radius,const double sigma)
6859{
6860  Image
6861    *paint_image;
6862
6863  assert(wand != (MagickWand *) NULL);
6864  assert(wand->signature == WandSignature);
6865  if (wand->debug != MagickFalse)
6866    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6867  if (wand->images == (Image *) NULL)
6868    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6869  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6870  if (paint_image == (Image *) NULL)
6871    return(MagickFalse);
6872  ReplaceImageInList(&wand->images,paint_image);
6873  return(MagickTrue);
6874}
6875
6876/*
6877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6878%                                                                             %
6879%                                                                             %
6880%                                                                             %
6881%   M a g i c k O p a q u e P a i n t I m a g e                               %
6882%                                                                             %
6883%                                                                             %
6884%                                                                             %
6885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6886%
6887%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6888%  defined by fill.
6889%
6890%  The format of the MagickOpaquePaintImage method is:
6891%
6892%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6893%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6894%        const MagickBooleanType invert)
6895%
6896%  A description of each parameter follows:
6897%
6898%    o wand: the magick wand.
6899%
6900%    o target: Change this target color to the fill color within the image.
6901%
6902%    o fill: the fill pixel wand.
6903%
6904%    o fuzz: By default target must match a particular pixel color
6905%      exactly.  However, in many cases two colors may differ by a small amount.
6906%      The fuzz member of image defines how much tolerance is acceptable to
6907%      consider two colors as the same.  For example, set fuzz to 10 and the
6908%      color red at intensities of 100 and 102 respectively are now interpreted
6909%      as the same color for the purposes of the floodfill.
6910%
6911%    o invert: paint any pixel that does not match the target color.
6912%
6913*/
6914WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6915  const PixelWand *target,const PixelWand *fill,const double fuzz,
6916  const MagickBooleanType invert)
6917{
6918  MagickBooleanType
6919    status;
6920
6921  PixelInfo
6922    fill_pixel,
6923    target_pixel;
6924
6925  assert(wand != (MagickWand *) NULL);
6926  assert(wand->signature == WandSignature);
6927  if (wand->debug != MagickFalse)
6928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6929  if (wand->images == (Image *) NULL)
6930    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6931  PixelGetMagickColor(target,&target_pixel);
6932  PixelGetMagickColor(fill,&fill_pixel);
6933  wand->images->fuzz=fuzz;
6934  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6935    wand->exception);
6936  return(status);
6937}
6938
6939/*
6940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6941%                                                                             %
6942%                                                                             %
6943%                                                                             %
6944%   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                         %
6945%                                                                             %
6946%                                                                             %
6947%                                                                             %
6948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6949%
6950%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6951%  previous image in the sequence.  From this it attempts to select the
6952%  smallest cropped image to replace each frame, while preserving the results
6953%  of the animation.
6954%
6955%  The format of the MagickOptimizeImageLayers method is:
6956%
6957%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6958%
6959%  A description of each parameter follows:
6960%
6961%    o wand: the magick wand.
6962%
6963*/
6964WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6965{
6966  Image
6967    *optimize_image;
6968
6969  assert(wand != (MagickWand *) NULL);
6970  assert(wand->signature == WandSignature);
6971  if (wand->debug != MagickFalse)
6972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6973  if (wand->images == (Image *) NULL)
6974    return((MagickWand *) NULL);
6975  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6976  if (optimize_image == (Image *) NULL)
6977    return((MagickWand *) NULL);
6978  return(CloneMagickWandFromImages(wand,optimize_image));
6979}
6980
6981/*
6982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6983%                                                                             %
6984%                                                                             %
6985%                                                                             %
6986%     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                   %
6987%                                                                             %
6988%                                                                             %
6989%                                                                             %
6990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6991%
6992%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6993%  of pre-defined dithering threshold maps, but over multiple intensity levels,
6994%  which can be different for different channels, according to the input
6995%  arguments.
6996%
6997%  The format of the MagickOrderedPosterizeImage method is:
6998%
6999%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7000%        const char *threshold_map)
7001%
7002%  A description of each parameter follows:
7003%
7004%    o image: the image.
7005%
7006%    o threshold_map: A string containing the name of the threshold dither
7007%      map to use, followed by zero or more numbers representing the number of
7008%      color levels tho dither between.
7009%
7010%      Any level number less than 2 is equivalent to 2, and means only binary
7011%      dithering will be applied to each color channel.
7012%
7013%      No numbers also means a 2 level (bitmap) dither will be applied to all
7014%      channels, while a single number is the number of levels applied to each
7015%      channel in sequence.  More numbers will be applied in turn to each of
7016%      the color channels.
7017%
7018%      For example: "o3x3,6" generates a 6 level posterization of the image
7019%      with a ordered 3x3 diffused pixel dither being applied between each
7020%      level. While checker,8,8,4 will produce a 332 colormaped image with
7021%      only a single checkerboard hash pattern (50% grey) between each color
7022%      level, to basically double the number of color levels with a bare
7023%      minimim of dithering.
7024%
7025*/
7026WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7027  const char *threshold_map)
7028{
7029  MagickBooleanType
7030    status;
7031
7032  assert(wand != (MagickWand *) NULL);
7033  assert(wand->signature == WandSignature);
7034  if (wand->debug != MagickFalse)
7035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7036  if (wand->images == (Image *) NULL)
7037    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7038  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7039  return(status);
7040}
7041
7042/*
7043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7044%                                                                             %
7045%                                                                             %
7046%                                                                             %
7047%   M a g i c k P i n g I m a g e                                             %
7048%                                                                             %
7049%                                                                             %
7050%                                                                             %
7051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7052%
7053%  MagickPingImage() is the same as MagickReadImage() except the only valid
7054%  information returned is the image width, height, size, and format.  It
7055%  is designed to efficiently obtain this information from a file without
7056%  reading the entire image sequence into memory.
7057%
7058%  The format of the MagickPingImage method is:
7059%
7060%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7061%
7062%  A description of each parameter follows:
7063%
7064%    o wand: the magick wand.
7065%
7066%    o filename: the image filename.
7067%
7068*/
7069WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7070  const char *filename)
7071{
7072  Image
7073    *images;
7074
7075  ImageInfo
7076    *ping_info;
7077
7078  assert(wand != (MagickWand *) NULL);
7079  assert(wand->signature == WandSignature);
7080  if (wand->debug != MagickFalse)
7081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7082  ping_info=CloneImageInfo(wand->image_info);
7083  if (filename != (const char *) NULL)
7084    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7085  images=PingImage(ping_info,wand->exception);
7086  ping_info=DestroyImageInfo(ping_info);
7087  if (images == (Image *) NULL)
7088    return(MagickFalse);
7089  return(InsertImageInWand(wand,images));
7090}
7091
7092/*
7093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7094%                                                                             %
7095%                                                                             %
7096%                                                                             %
7097%   M a g i c k P i n g I m a g e B l o b                                     %
7098%                                                                             %
7099%                                                                             %
7100%                                                                             %
7101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7102%
7103%  MagickPingImageBlob() pings an image or image sequence from a blob.
7104%
7105%  The format of the MagickPingImageBlob method is:
7106%
7107%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7108%        const void *blob,const size_t length)
7109%
7110%  A description of each parameter follows:
7111%
7112%    o wand: the magick wand.
7113%
7114%    o blob: the blob.
7115%
7116%    o length: the blob length.
7117%
7118*/
7119WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7120  const void *blob,const size_t length)
7121{
7122  Image
7123    *images;
7124
7125  ImageInfo
7126    *read_info;
7127
7128  assert(wand != (MagickWand *) NULL);
7129  assert(wand->signature == WandSignature);
7130  if (wand->debug != MagickFalse)
7131    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7132  read_info=CloneImageInfo(wand->image_info);
7133  SetImageInfoBlob(read_info,blob,length);
7134  images=PingImage(read_info,wand->exception);
7135  read_info=DestroyImageInfo(read_info);
7136  if (images == (Image *) NULL)
7137    return(MagickFalse);
7138  return(InsertImageInWand(wand,images));
7139}
7140
7141/*
7142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143%                                                                             %
7144%                                                                             %
7145%                                                                             %
7146%   M a g i c k P i n g I m a g e F i l e                                     %
7147%                                                                             %
7148%                                                                             %
7149%                                                                             %
7150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151%
7152%  MagickPingImageFile() pings an image or image sequence from an open file
7153%  descriptor.
7154%
7155%  The format of the MagickPingImageFile method is:
7156%
7157%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7158%
7159%  A description of each parameter follows:
7160%
7161%    o wand: the magick wand.
7162%
7163%    o file: the file descriptor.
7164%
7165*/
7166WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7167{
7168  Image
7169    *images;
7170
7171  ImageInfo
7172    *read_info;
7173
7174  assert(wand != (MagickWand *) NULL);
7175  assert(wand->signature == WandSignature);
7176  assert(file != (FILE *) NULL);
7177  if (wand->debug != MagickFalse)
7178    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7179  read_info=CloneImageInfo(wand->image_info);
7180  SetImageInfoFile(read_info,file);
7181  images=PingImage(read_info,wand->exception);
7182  read_info=DestroyImageInfo(read_info);
7183  if (images == (Image *) NULL)
7184    return(MagickFalse);
7185  return(InsertImageInWand(wand,images));
7186}
7187
7188/*
7189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7190%                                                                             %
7191%                                                                             %
7192%                                                                             %
7193%   M a g i c k P o l a r o i d I m a g e                                     %
7194%                                                                             %
7195%                                                                             %
7196%                                                                             %
7197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7198%
7199%  MagickPolaroidImage() simulates a Polaroid picture.
7200%
7201%  The format of the MagickPolaroidImage method is:
7202%
7203%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7204%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7205%        const PixelInterpolateMethod method)
7206%
7207%  A description of each parameter follows:
7208%
7209%    o wand: the magick wand.
7210%
7211%    o drawing_wand: the draw wand.
7212%
7213%    o caption: the Polaroid caption.
7214%
7215%    o angle: Apply the effect along this angle.
7216%
7217%    o method: the pixel interpolation method.
7218%
7219*/
7220WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7221  const DrawingWand *drawing_wand,const char *caption,const double angle,
7222  const PixelInterpolateMethod method)
7223{
7224  DrawInfo
7225    *draw_info;
7226
7227  Image
7228    *polaroid_image;
7229
7230  assert(wand != (MagickWand *) NULL);
7231  assert(wand->signature == WandSignature);
7232  if (wand->debug != MagickFalse)
7233    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7234  if (wand->images == (Image *) NULL)
7235    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7236  draw_info=PeekDrawingWand(drawing_wand);
7237  if (draw_info == (DrawInfo *) NULL)
7238    return(MagickFalse);
7239  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7240    wand->exception);
7241  if (polaroid_image == (Image *) NULL)
7242    return(MagickFalse);
7243  ReplaceImageInList(&wand->images,polaroid_image);
7244  return(MagickTrue);
7245}
7246
7247/*
7248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7249%                                                                             %
7250%                                                                             %
7251%                                                                             %
7252%   M a g i c k P o s t e r i z e I m a g e                                   %
7253%                                                                             %
7254%                                                                             %
7255%                                                                             %
7256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7257%
7258%  MagickPosterizeImage() reduces the image to a limited number of color level.
7259%
7260%  The format of the MagickPosterizeImage method is:
7261%
7262%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7263%        const unsigned levels,const MagickBooleanType dither)
7264%
7265%  A description of each parameter follows:
7266%
7267%    o wand: the magick wand.
7268%
7269%    o levels: Number of color levels allowed in each channel.  Very low values
7270%      (2, 3, or 4) have the most visible effect.
7271%
7272%    o dither: Set this integer value to something other than zero to dither
7273%      the mapped image.
7274%
7275*/
7276WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7277  const size_t levels,const MagickBooleanType dither)
7278{
7279  MagickBooleanType
7280    status;
7281
7282  assert(wand != (MagickWand *) NULL);
7283  assert(wand->signature == WandSignature);
7284  if (wand->debug != MagickFalse)
7285    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7286  if (wand->images == (Image *) NULL)
7287    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7288  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7289  return(status);
7290}
7291
7292/*
7293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7294%                                                                             %
7295%                                                                             %
7296%                                                                             %
7297%   M a g i c k P r e v i e w I m a g e s                                     %
7298%                                                                             %
7299%                                                                             %
7300%                                                                             %
7301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7302%
7303%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7304%  image processing operation applied at varying strengths.  This helpful
7305%  to quickly pin-point an appropriate parameter for an image processing
7306%  operation.
7307%
7308%  The format of the MagickPreviewImages method is:
7309%
7310%      MagickWand *MagickPreviewImages(MagickWand *wand,
7311%        const PreviewType preview)
7312%
7313%  A description of each parameter follows:
7314%
7315%    o wand: the magick wand.
7316%
7317%    o preview: the preview type.
7318%
7319*/
7320WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7321  const PreviewType preview)
7322{
7323  Image
7324    *preview_image;
7325
7326  assert(wand != (MagickWand *) NULL);
7327  assert(wand->signature == WandSignature);
7328  if (wand->debug != MagickFalse)
7329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7330  if (wand->images == (Image *) NULL)
7331    return((MagickWand *) NULL);
7332  preview_image=PreviewImage(wand->images,preview,wand->exception);
7333  if (preview_image == (Image *) NULL)
7334    return((MagickWand *) NULL);
7335  return(CloneMagickWandFromImages(wand,preview_image));
7336}
7337
7338/*
7339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7340%                                                                             %
7341%                                                                             %
7342%                                                                             %
7343%   M a g i c k P r e v i o u s I m a g e                                     %
7344%                                                                             %
7345%                                                                             %
7346%                                                                             %
7347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7348%
7349%  MagickPreviousImage() assocates the previous image in an image list with
7350%  the magick wand.
7351%
7352%  The format of the MagickPreviousImage method is:
7353%
7354%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7355%
7356%  A description of each parameter follows:
7357%
7358%    o wand: the magick wand.
7359%
7360*/
7361WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7369
7370  wand->image_pending=MagickFalse;  /* pending status has no meaning */
7371  /* If there is no prev image, return false (Iterator is finished) */
7372  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7373      return(MagickFalse);
7374  /* just do it - current image is not 'pending' */
7375  wand->images=GetPreviousImageInList(wand->images);
7376  return(MagickTrue);
7377}
7378
7379/*
7380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7381%                                                                             %
7382%                                                                             %
7383%                                                                             %
7384%   M a g i c k Q u a n t i z e I m a g e                                     %
7385%                                                                             %
7386%                                                                             %
7387%                                                                             %
7388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7389%
7390%  MagickQuantizeImage() analyzes the colors within a reference image and
7391%  chooses a fixed number of colors to represent the image.  The goal of the
7392%  algorithm is to minimize the color difference between the input and output
7393%  image while minimizing the processing time.
7394%
7395%  The format of the MagickQuantizeImage method is:
7396%
7397%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7398%        const size_t number_colors,const ColorspaceType colorspace,
7399%        const size_t treedepth,const MagickBooleanType dither,
7400%        const MagickBooleanType measure_error)
7401%
7402%  A description of each parameter follows:
7403%
7404%    o wand: the magick wand.
7405%
7406%    o number_colors: the number of colors.
7407%
7408%    o colorspace: Perform color reduction in this colorspace, typically
7409%      RGBColorspace.
7410%
7411%    o treedepth: Normally, this integer value is zero or one.  A zero or
7412%      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
7413%      reference image with the least amount of memory and the fastest
7414%      computational speed.  In some cases, such as an image with low color
7415%      dispersion (a few number of colors), a value other than
7416%      Log4(number_colors) is required.  To expand the color tree completely,
7417%      use a value of 8.
7418%
7419%    o dither: A value other than zero distributes the difference between an
7420%      original image and the corresponding color reduced image to
7421%      neighboring pixels along a Hilbert curve.
7422%
7423%    o measure_error: A value other than zero measures the difference between
7424%      the original and quantized images.  This difference is the total
7425%      quantization error.  The error is computed by summing over all pixels
7426%      in an image the distance squared in RGB space between each reference
7427%      pixel value and its quantized value.
7428%
7429*/
7430WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7431  const size_t number_colors,const ColorspaceType colorspace,
7432  const size_t treedepth,const MagickBooleanType dither,
7433  const MagickBooleanType measure_error)
7434{
7435  MagickBooleanType
7436    status;
7437
7438  QuantizeInfo
7439    *quantize_info;
7440
7441  assert(wand != (MagickWand *) NULL);
7442  assert(wand->signature == WandSignature);
7443  if (wand->debug != MagickFalse)
7444    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7445  if (wand->images == (Image *) NULL)
7446    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7447  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7448  quantize_info->number_colors=number_colors;
7449  quantize_info->dither=dither;
7450  quantize_info->tree_depth=treedepth;
7451  quantize_info->colorspace=colorspace;
7452  quantize_info->measure_error=measure_error;
7453  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7454  quantize_info=DestroyQuantizeInfo(quantize_info);
7455  return(status);
7456}
7457
7458/*
7459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7460%                                                                             %
7461%                                                                             %
7462%                                                                             %
7463%   M a g i c k Q u a n t i z e I m a g e s                                   %
7464%                                                                             %
7465%                                                                             %
7466%                                                                             %
7467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7468%
7469%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7470%  chooses a fixed number of colors to represent the image.  The goal of the
7471%  algorithm is to minimize the color difference between the input and output
7472%  image while minimizing the processing time.
7473%
7474%  The format of the MagickQuantizeImages method is:
7475%
7476%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7477%        const size_t number_colors,const ColorspaceType colorspace,
7478%        const size_t treedepth,const MagickBooleanType dither,
7479%        const MagickBooleanType measure_error)
7480%
7481%  A description of each parameter follows:
7482%
7483%    o wand: the magick wand.
7484%
7485%    o number_colors: the number of colors.
7486%
7487%    o colorspace: Perform color reduction in this colorspace, typically
7488%      RGBColorspace.
7489%
7490%    o treedepth: Normally, this integer value is zero or one.  A zero or
7491%      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
7492%      reference image with the least amount of memory and the fastest
7493%      computational speed.  In some cases, such as an image with low color
7494%      dispersion (a few number of colors), a value other than
7495%      Log4(number_colors) is required.  To expand the color tree completely,
7496%      use a value of 8.
7497%
7498%    o dither: A value other than zero distributes the difference between an
7499%      original image and the corresponding color reduced algorithm to
7500%      neighboring pixels along a Hilbert curve.
7501%
7502%    o measure_error: A value other than zero measures the difference between
7503%      the original and quantized images.  This difference is the total
7504%      quantization error.  The error is computed by summing over all pixels
7505%      in an image the distance squared in RGB space between each reference
7506%      pixel value and its quantized value.
7507%
7508*/
7509WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7510  const size_t number_colors,const ColorspaceType colorspace,
7511  const size_t treedepth,const MagickBooleanType dither,
7512  const MagickBooleanType measure_error)
7513{
7514  MagickBooleanType
7515    status;
7516
7517  QuantizeInfo
7518    *quantize_info;
7519
7520  assert(wand != (MagickWand *) NULL);
7521  assert(wand->signature == WandSignature);
7522  if (wand->debug != MagickFalse)
7523    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7524  if (wand->images == (Image *) NULL)
7525    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7526  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7527  quantize_info->number_colors=number_colors;
7528  quantize_info->dither=dither;
7529  quantize_info->tree_depth=treedepth;
7530  quantize_info->colorspace=colorspace;
7531  quantize_info->measure_error=measure_error;
7532  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7533  quantize_info=DestroyQuantizeInfo(quantize_info);
7534  return(status);
7535}
7536
7537/*
7538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7539%                                                                             %
7540%                                                                             %
7541%                                                                             %
7542%   M a g i c k R a d i a l B l u r I m a g e                                 %
7543%                                                                             %
7544%                                                                             %
7545%                                                                             %
7546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7547%
7548%  MagickRadialBlurImage() radial blurs an image.
7549%
7550%  The format of the MagickRadialBlurImage method is:
7551%
7552%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7553%        const double angle,const double bias)
7554%
7555%  A description of each parameter follows:
7556%
7557%    o wand: the magick wand.
7558%
7559%    o angle: the angle of the blur in degrees.
7560%
7561%    o bias: the bias.
7562%
7563*/
7564WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7565  const double angle,const double bias)
7566{
7567  Image
7568    *blur_image;
7569
7570  assert(wand != (MagickWand *) NULL);
7571  assert(wand->signature == WandSignature);
7572  if (wand->debug != MagickFalse)
7573    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7574  if (wand->images == (Image *) NULL)
7575    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7576  blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7577  if (blur_image == (Image *) NULL)
7578    return(MagickFalse);
7579  ReplaceImageInList(&wand->images,blur_image);
7580  return(MagickTrue);
7581}
7582
7583/*
7584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7585%                                                                             %
7586%                                                                             %
7587%                                                                             %
7588%   M a g i c k R a i s e I m a g e                                           %
7589%                                                                             %
7590%                                                                             %
7591%                                                                             %
7592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7593%
7594%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7595%  by lightening and darkening the edges of the image.  Members width and
7596%  height of raise_info define the width of the vertical and horizontal
7597%  edge of the effect.
7598%
7599%  The format of the MagickRaiseImage method is:
7600%
7601%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7602%        const size_t width,const size_t height,const ssize_t x,
7603%        const ssize_t y,const MagickBooleanType raise)
7604%
7605%  A description of each parameter follows:
7606%
7607%    o wand: the magick wand.
7608%
7609%    o width,height,x,y:  Define the dimensions of the area to raise.
7610%
7611%    o raise: A value other than zero creates a 3-D raise effect,
7612%      otherwise it has a lowered effect.
7613%
7614*/
7615WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7616  const size_t width,const size_t height,const ssize_t x,
7617  const ssize_t y,const MagickBooleanType raise)
7618{
7619  MagickBooleanType
7620    status;
7621
7622  RectangleInfo
7623    raise_info;
7624
7625  assert(wand != (MagickWand *) NULL);
7626  assert(wand->signature == WandSignature);
7627  if (wand->debug != MagickFalse)
7628    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7629  if (wand->images == (Image *) NULL)
7630    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7631  raise_info.width=width;
7632  raise_info.height=height;
7633  raise_info.x=x;
7634  raise_info.y=y;
7635  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7636  return(status);
7637}
7638
7639/*
7640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7641%                                                                             %
7642%                                                                             %
7643%                                                                             %
7644%   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                       %
7645%                                                                             %
7646%                                                                             %
7647%                                                                             %
7648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7649%
7650%  MagickRandomThresholdImage() changes the value of individual pixels based on
7651%  the intensity of each pixel compared to threshold.  The result is a
7652%  high-contrast, two color image.
7653%
7654%  The format of the MagickRandomThresholdImage method is:
7655%
7656%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7657%        const double low,const double high)
7658%
7659%  A description of each parameter follows:
7660%
7661%    o wand: the magick wand.
7662%
7663%    o low,high: Specify the high and low thresholds.  These values range from
7664%      0 to QuantumRange.
7665%
7666*/
7667WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7668  const double low,const double high)
7669{
7670  char
7671    threshold[MaxTextExtent];
7672
7673  assert(wand != (MagickWand *) NULL);
7674  assert(wand->signature == WandSignature);
7675  if (wand->debug != MagickFalse)
7676    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7677  if (wand->images == (Image *) NULL)
7678    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7679  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7680  return(RandomThresholdImage(wand->images,threshold,wand->exception));
7681}
7682
7683/*
7684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7685%                                                                             %
7686%                                                                             %
7687%                                                                             %
7688%   M a g i c k R e a d I m a g e                                             %
7689%                                                                             %
7690%                                                                             %
7691%                                                                             %
7692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7693%
7694%  MagickReadImage() reads an image or image sequence.  The images are inserted
7695%  at the current image pointer position.
7696%
7697%  Use MagickSetFirstIterator(), to insert new images before all the current
7698%  images in the wand, MagickSetLastIterator() to append add to the end,
7699%  MagickSetImageIndex() to place images just after the given index.
7700%
7701%  The format of the MagickReadImage method is:
7702%
7703%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7704%
7705%  A description of each parameter follows:
7706%
7707%    o wand: the magick wand.
7708%
7709%    o filename: the image filename.
7710%
7711*/
7712WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7713  const char *filename)
7714{
7715  Image
7716    *images;
7717
7718  ImageInfo
7719    *read_info;
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  read_info=CloneImageInfo(wand->image_info);
7726  if (filename != (const char *) NULL)
7727    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7728  images=ReadImage(read_info,wand->exception);
7729  read_info=DestroyImageInfo(read_info);
7730  if (images == (Image *) NULL)
7731    return(MagickFalse);
7732  return(InsertImageInWand(wand,images));
7733}
7734
7735/*
7736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7737%                                                                             %
7738%                                                                             %
7739%                                                                             %
7740%   M a g i c k R e a d I m a g e B l o b                                     %
7741%                                                                             %
7742%                                                                             %
7743%                                                                             %
7744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7745%
7746%  MagickReadImageBlob() reads an image or image sequence from a blob.
7747%  In all other respects it is like MagickReadImage().
7748%
7749%  The format of the MagickReadImageBlob method is:
7750%
7751%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7752%        const void *blob,const size_t length)
7753%
7754%  A description of each parameter follows:
7755%
7756%    o wand: the magick wand.
7757%
7758%    o blob: the blob.
7759%
7760%    o length: the blob length.
7761%
7762*/
7763WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7764  const void *blob,const size_t length)
7765{
7766  Image
7767    *images;
7768
7769  assert(wand != (MagickWand *) NULL);
7770  assert(wand->signature == WandSignature);
7771  if (wand->debug != MagickFalse)
7772    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7773  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7774  if (images == (Image *) NULL)
7775    return(MagickFalse);
7776  return(InsertImageInWand(wand,images));
7777}
7778
7779/*
7780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7781%                                                                             %
7782%                                                                             %
7783%                                                                             %
7784%   M a g i c k R e a d I m a g e F i l e                                     %
7785%                                                                             %
7786%                                                                             %
7787%                                                                             %
7788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7789%
7790%  MagickReadImageFile() reads an image or image sequence from an already
7791%  opened file descriptor.  Otherwise it is like MagickReadImage().
7792%
7793%  The format of the MagickReadImageFile method is:
7794%
7795%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7796%
7797%  A description of each parameter follows:
7798%
7799%    o wand: the magick wand.
7800%
7801%    o file: the file descriptor.
7802%
7803*/
7804WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7805{
7806  Image
7807    *images;
7808
7809  ImageInfo
7810    *read_info;
7811
7812  assert(wand != (MagickWand *) NULL);
7813  assert(wand->signature == WandSignature);
7814  assert(file != (FILE *) NULL);
7815  if (wand->debug != MagickFalse)
7816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7817  read_info=CloneImageInfo(wand->image_info);
7818  SetImageInfoFile(read_info,file);
7819  images=ReadImage(read_info,wand->exception);
7820  read_info=DestroyImageInfo(read_info);
7821  if (images == (Image *) NULL)
7822    return(MagickFalse);
7823  return(InsertImageInWand(wand,images));
7824}
7825
7826/*
7827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7828%                                                                             %
7829%                                                                             %
7830%                                                                             %
7831%   M a g i c k R e m a p I m a g e                                           %
7832%                                                                             %
7833%                                                                             %
7834%                                                                             %
7835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7836%
7837%  MagickRemapImage() replaces the colors of an image with the closest color
7838%  from a reference image.
7839%
7840%  The format of the MagickRemapImage method is:
7841%
7842%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7843%        const MagickWand *remap_wand,const DitherMethod method)
7844%
7845%  A description of each parameter follows:
7846%
7847%    o wand: the magick wand.
7848%
7849%    o affinity: the affinity wand.
7850%
7851%    o method: choose from these dither methods: NoDitherMethod,
7852%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7853%
7854*/
7855WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7856  const MagickWand *remap_wand,const DitherMethod method)
7857{
7858  MagickBooleanType
7859    status;
7860
7861  QuantizeInfo
7862    *quantize_info;
7863
7864  assert(wand != (MagickWand *) NULL);
7865  assert(wand->signature == WandSignature);
7866  if (wand->debug != MagickFalse)
7867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868  if ((wand->images == (Image *) NULL) ||
7869      (remap_wand->images == (Image *) NULL))
7870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7871  quantize_info=AcquireQuantizeInfo(wand->image_info);
7872  quantize_info->dither_method=method;
7873  if (method == NoDitherMethod)
7874    quantize_info->dither=MagickFalse;
7875  status=RemapImage(quantize_info,wand->images,remap_wand->images,
7876    wand->exception);
7877  quantize_info=DestroyQuantizeInfo(quantize_info);
7878  return(status);
7879}
7880
7881/*
7882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7883%                                                                             %
7884%                                                                             %
7885%                                                                             %
7886%   M a g i c k R e m o v e I m a g e                                         %
7887%                                                                             %
7888%                                                                             %
7889%                                                                             %
7890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7891%
7892%  MagickRemoveImage() removes an image from the image list.
7893%
7894%  The format of the MagickRemoveImage method is:
7895%
7896%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7897%
7898%  A description of each parameter follows:
7899%
7900%    o wand: the magick wand.
7901%
7902%    o insert: the splice wand.
7903%
7904*/
7905WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7906{
7907  assert(wand != (MagickWand *) NULL);
7908  assert(wand->signature == WandSignature);
7909  if (wand->debug != MagickFalse)
7910    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7911  if (wand->images == (Image *) NULL)
7912    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7913  DeleteImageFromList(&wand->images);
7914  return(MagickTrue);
7915}
7916
7917/*
7918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7919%                                                                             %
7920%                                                                             %
7921%                                                                             %
7922%   M a g i c k R e s a m p l e I m a g e                                     %
7923%                                                                             %
7924%                                                                             %
7925%                                                                             %
7926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7927%
7928%  MagickResampleImage() resample image to desired resolution.
7929%
7930%    Bessel   Blackman   Box
7931%    Catrom   Cubic      Gaussian
7932%    Hanning  Hermite    Lanczos
7933%    Mitchell Point      Quandratic
7934%    Sinc     Triangle
7935%
7936%  Most of the filters are FIR (finite impulse response), however, Bessel,
7937%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7938%  are windowed (brought down to zero) with the Blackman filter.
7939%
7940%  The format of the MagickResampleImage method is:
7941%
7942%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7943%        const double x_resolution,const double y_resolution,
7944%        const FilterTypes filter,const double blur)
7945%
7946%  A description of each parameter follows:
7947%
7948%    o wand: the magick wand.
7949%
7950%    o x_resolution: the new image x resolution.
7951%
7952%    o y_resolution: the new image y resolution.
7953%
7954%    o filter: Image filter to use.
7955%
7956%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7957%
7958*/
7959WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7960  const double x_resolution,const double y_resolution,const FilterTypes filter,
7961  const double blur)
7962{
7963  Image
7964    *resample_image;
7965
7966  assert(wand != (MagickWand *) NULL);
7967  assert(wand->signature == WandSignature);
7968  if (wand->debug != MagickFalse)
7969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7970  if (wand->images == (Image *) NULL)
7971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7972  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7973    blur,wand->exception);
7974  if (resample_image == (Image *) NULL)
7975    return(MagickFalse);
7976  ReplaceImageInList(&wand->images,resample_image);
7977  return(MagickTrue);
7978}
7979
7980/*
7981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7982%                                                                             %
7983%                                                                             %
7984%                                                                             %
7985%   M a g i c k R e s e t I m a g e P a g e                                   %
7986%                                                                             %
7987%                                                                             %
7988%                                                                             %
7989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7990%
7991%  MagickResetImagePage() resets the Wand page canvas and position.
7992%
7993%  The format of the MagickResetImagePage method is:
7994%
7995%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7996%        const char *page)
7997%
7998%  A description of each parameter follows:
7999%
8000%    o wand: the magick wand.
8001%
8002%    o page: the relative page specification.
8003%
8004*/
8005WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8006  const char *page)
8007{
8008  assert(wand != (MagickWand *) NULL);
8009  assert(wand->signature == WandSignature);
8010  if (wand->debug != MagickFalse)
8011    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8012  if (wand->images == (Image *) NULL)
8013    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8014  if ((page == (char *) NULL) || (*page == '\0'))
8015    {
8016      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8017      return(MagickTrue);
8018    }
8019  return(ResetImagePage(wand->images,page));
8020}
8021
8022/*
8023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8024%                                                                             %
8025%                                                                             %
8026%                                                                             %
8027%   M a g i c k R e s i z e I m a g e                                         %
8028%                                                                             %
8029%                                                                             %
8030%                                                                             %
8031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8032%
8033%  MagickResizeImage() scales an image to the desired dimensions with one of
8034%  these filters:
8035%
8036%    Bessel   Blackman   Box
8037%    Catrom   Cubic      Gaussian
8038%    Hanning  Hermite    Lanczos
8039%    Mitchell Point      Quandratic
8040%    Sinc     Triangle
8041%
8042%  Most of the filters are FIR (finite impulse response), however, Bessel,
8043%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8044%  are windowed (brought down to zero) with the Blackman filter.
8045%
8046%  The format of the MagickResizeImage method is:
8047%
8048%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8049%        const size_t columns,const size_t rows,
8050%        const FilterTypes filter,const double blur)
8051%
8052%  A description of each parameter follows:
8053%
8054%    o wand: the magick wand.
8055%
8056%    o columns: the number of columns in the scaled image.
8057%
8058%    o rows: the number of rows in the scaled image.
8059%
8060%    o filter: Image filter to use.
8061%
8062%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8063%
8064*/
8065WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8066  const size_t columns,const size_t rows,const FilterTypes filter,
8067  const double blur)
8068{
8069  Image
8070    *resize_image;
8071
8072  assert(wand != (MagickWand *) NULL);
8073  assert(wand->signature == WandSignature);
8074  if (wand->debug != MagickFalse)
8075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8076  if (wand->images == (Image *) NULL)
8077    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8078  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8079    wand->exception);
8080  if (resize_image == (Image *) NULL)
8081    return(MagickFalse);
8082  ReplaceImageInList(&wand->images,resize_image);
8083  return(MagickTrue);
8084}
8085
8086/*
8087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8088%                                                                             %
8089%                                                                             %
8090%                                                                             %
8091%   M a g i c k R o l l I m a g e                                             %
8092%                                                                             %
8093%                                                                             %
8094%                                                                             %
8095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8096%
8097%  MagickRollImage() offsets an image as defined by x and y.
8098%
8099%  The format of the MagickRollImage method is:
8100%
8101%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8102%        const size_t y)
8103%
8104%  A description of each parameter follows:
8105%
8106%    o wand: the magick wand.
8107%
8108%    o x: the x offset.
8109%
8110%    o y: the y offset.
8111%
8112%
8113*/
8114WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8115  const ssize_t x,const ssize_t y)
8116{
8117  Image
8118    *roll_image;
8119
8120  assert(wand != (MagickWand *) NULL);
8121  assert(wand->signature == WandSignature);
8122  if (wand->debug != MagickFalse)
8123    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8124  if (wand->images == (Image *) NULL)
8125    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8126  roll_image=RollImage(wand->images,x,y,wand->exception);
8127  if (roll_image == (Image *) NULL)
8128    return(MagickFalse);
8129  ReplaceImageInList(&wand->images,roll_image);
8130  return(MagickTrue);
8131}
8132
8133/*
8134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8135%                                                                             %
8136%                                                                             %
8137%                                                                             %
8138%   M a g i c k R o t a t e I m a g e                                         %
8139%                                                                             %
8140%                                                                             %
8141%                                                                             %
8142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8143%
8144%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8145%  triangles left over from rotating the image are filled with the
8146%  background color.
8147%
8148%  The format of the MagickRotateImage method is:
8149%
8150%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8151%        const PixelWand *background,const double degrees)
8152%
8153%  A description of each parameter follows:
8154%
8155%    o wand: the magick wand.
8156%
8157%    o background: the background pixel wand.
8158%
8159%    o degrees: the number of degrees to rotate the image.
8160%
8161%
8162*/
8163WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8164  const PixelWand *background,const double degrees)
8165{
8166  Image
8167    *rotate_image;
8168
8169  assert(wand != (MagickWand *) NULL);
8170  assert(wand->signature == WandSignature);
8171  if (wand->debug != MagickFalse)
8172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8173  if (wand->images == (Image *) NULL)
8174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8175  PixelGetQuantumPacket(background,&wand->images->background_color);
8176  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8177  if (rotate_image == (Image *) NULL)
8178    return(MagickFalse);
8179  ReplaceImageInList(&wand->images,rotate_image);
8180  return(MagickTrue);
8181}
8182
8183/*
8184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185%                                                                             %
8186%                                                                             %
8187%                                                                             %
8188%   M a g i c k S a m p l e I m a g e                                         %
8189%                                                                             %
8190%                                                                             %
8191%                                                                             %
8192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8193%
8194%  MagickSampleImage() scales an image to the desired dimensions with pixel
8195%  sampling.  Unlike other scaling methods, this method does not introduce
8196%  any additional color into the scaled image.
8197%
8198%  The format of the MagickSampleImage method is:
8199%
8200%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8201%        const size_t columns,const size_t rows)
8202%
8203%  A description of each parameter follows:
8204%
8205%    o wand: the magick wand.
8206%
8207%    o columns: the number of columns in the scaled image.
8208%
8209%    o rows: the number of rows in the scaled image.
8210%
8211%
8212*/
8213WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8214  const size_t columns,const size_t rows)
8215{
8216  Image
8217    *sample_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  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8226  if (sample_image == (Image *) NULL)
8227    return(MagickFalse);
8228  ReplaceImageInList(&wand->images,sample_image);
8229  return(MagickTrue);
8230}
8231
8232/*
8233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8234%                                                                             %
8235%                                                                             %
8236%                                                                             %
8237%   M a g i c k S c a l e I m a g e                                           %
8238%                                                                             %
8239%                                                                             %
8240%                                                                             %
8241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8242%
8243%  MagickScaleImage() scales the size of an image to the given dimensions.
8244%
8245%  The format of the MagickScaleImage method is:
8246%
8247%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8248%        const size_t columns,const size_t rows)
8249%
8250%  A description of each parameter follows:
8251%
8252%    o wand: the magick wand.
8253%
8254%    o columns: the number of columns in the scaled image.
8255%
8256%    o rows: the number of rows in the scaled image.
8257%
8258%
8259*/
8260WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8261  const size_t columns,const size_t rows)
8262{
8263  Image
8264    *scale_image;
8265
8266  assert(wand != (MagickWand *) NULL);
8267  assert(wand->signature == WandSignature);
8268  if (wand->debug != MagickFalse)
8269    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8270  if (wand->images == (Image *) NULL)
8271    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8272  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8273  if (scale_image == (Image *) NULL)
8274    return(MagickFalse);
8275  ReplaceImageInList(&wand->images,scale_image);
8276  return(MagickTrue);
8277}
8278
8279/*
8280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8281%                                                                             %
8282%                                                                             %
8283%                                                                             %
8284%   M a g i c k S e g m e n t I m a g e                                       %
8285%                                                                             %
8286%                                                                             %
8287%                                                                             %
8288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8289%
8290%  MagickSegmentImage() segments an image by analyzing the histograms of the
8291%  color components and identifying units that are homogeneous with the fuzzy
8292%  C-means technique.
8293%
8294%  The format of the SegmentImage method is:
8295%
8296%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8297%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8298%        const double cluster_threshold,const double smooth_threshold)
8299%
8300%  A description of each parameter follows.
8301%
8302%    o wand: the wand.
8303%
8304%    o colorspace: the image colorspace.
8305%
8306%    o verbose:  Set to MagickTrue to print detailed information about the
8307%      identified classes.
8308%
8309%    o cluster_threshold:  This represents the minimum number of pixels
8310%      contained in a hexahedra before it can be considered valid (expressed as
8311%      a percentage).
8312%
8313%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8314%      derivative of the histogram.  As the value is increased, you can expect a
8315%      smoother second derivative.
8316%
8317*/
8318MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8319  const ColorspaceType colorspace,const MagickBooleanType verbose,
8320  const double cluster_threshold,const double smooth_threshold)
8321{
8322  MagickBooleanType
8323    status;
8324
8325  assert(wand != (MagickWand *) NULL);
8326  assert(wand->signature == WandSignature);
8327  if (wand->debug != MagickFalse)
8328    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8329  if (wand->images == (Image *) NULL)
8330    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8331  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8332    smooth_threshold,wand->exception);
8333  return(status);
8334}
8335
8336/*
8337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8338%                                                                             %
8339%                                                                             %
8340%                                                                             %
8341%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8342%                                                                             %
8343%                                                                             %
8344%                                                                             %
8345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8346%
8347%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8348%  threshold. It is similar to the unsharpen mask that sharpens everything with
8349%  contrast above a certain threshold.
8350%
8351%  The format of the MagickSelectiveBlurImage method is:
8352%
8353%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8354%        const double radius,const double sigma,const double threshold,
8355%        const double bias)
8356%
8357%  A description of each parameter follows:
8358%
8359%    o wand: the magick wand.
8360%
8361%    o radius: the radius of the gaussian, in pixels, not counting the center
8362%      pixel.
8363%
8364%    o sigma: the standard deviation of the gaussian, in pixels.
8365%
8366%    o threshold: only pixels within this contrast threshold are included
8367%      in the blur operation.
8368%
8369%    o bias: the bias.
8370%
8371*/
8372WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8373  const double radius,const double sigma,const double threshold,
8374  const double bias)
8375{
8376  Image
8377    *blur_image;
8378
8379  assert(wand != (MagickWand *) NULL);
8380  assert(wand->signature == WandSignature);
8381  if (wand->debug != MagickFalse)
8382    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8383  if (wand->images == (Image *) NULL)
8384    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8385  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8386    wand->exception);
8387  if (blur_image == (Image *) NULL)
8388    return(MagickFalse);
8389  ReplaceImageInList(&wand->images,blur_image);
8390  return(MagickTrue);
8391}
8392
8393/*
8394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8395%                                                                             %
8396%                                                                             %
8397%                                                                             %
8398%   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                       %
8399%                                                                             %
8400%                                                                             %
8401%                                                                             %
8402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8403%
8404%  MagickSeparateImage() separates a channel from the image and returns a
8405%  grayscale image.  A channel is a particular color component of each pixel
8406%  in the image.
8407%
8408%  The format of the MagickSeparateImage method is:
8409%
8410%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8411%        const ChannelType channel)
8412%
8413%  A description of each parameter follows:
8414%
8415%    o wand: the magick wand.
8416%
8417%    o channel: the channel.
8418%
8419*/
8420WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8421  const ChannelType channel)
8422{
8423  Image
8424    *separate_image;
8425
8426  assert(wand != (MagickWand *) NULL);
8427  assert(wand->signature == WandSignature);
8428  if (wand->debug != MagickFalse)
8429    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8430  if (wand->images == (Image *) NULL)
8431    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8432  separate_image=SeparateImage(wand->images,channel,wand->exception);
8433  if (separate_image == (Image *) NULL)
8434    return(MagickFalse);
8435  ReplaceImageInList(&wand->images,separate_image);
8436  return(MagickTrue);
8437}
8438
8439/*
8440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8441%                                                                             %
8442%                                                                             %
8443%                                                                             %
8444%     M a g i c k S e p i a T o n e I m a g e                                 %
8445%                                                                             %
8446%                                                                             %
8447%                                                                             %
8448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8449%
8450%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8451%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8452%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8453%  threshold of 80% is a good starting point for a reasonable tone.
8454%
8455%  The format of the MagickSepiaToneImage method is:
8456%
8457%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8458%        const double threshold)
8459%
8460%  A description of each parameter follows:
8461%
8462%    o wand: the magick wand.
8463%
8464%    o threshold:  Define the extent of the sepia toning.
8465%
8466*/
8467WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8468  const double threshold)
8469{
8470  Image
8471    *sepia_image;
8472
8473  assert(wand != (MagickWand *) NULL);
8474  assert(wand->signature == WandSignature);
8475  if (wand->debug != MagickFalse)
8476    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8477  if (wand->images == (Image *) NULL)
8478    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8479  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8480  if (sepia_image == (Image *) NULL)
8481    return(MagickFalse);
8482  ReplaceImageInList(&wand->images,sepia_image);
8483  return(MagickTrue);
8484}
8485
8486/*
8487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8488%                                                                             %
8489%                                                                             %
8490%                                                                             %
8491%   M a g i c k S e t I m a g e                                               %
8492%                                                                             %
8493%                                                                             %
8494%                                                                             %
8495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8496%
8497%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8498%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8499%  wand.
8500%
8501%  The format of the MagickSetImage method is:
8502%
8503%      MagickBooleanType MagickSetImage(MagickWand *wand,
8504%        const MagickWand *set_wand)
8505%
8506%  A description of each parameter follows:
8507%
8508%    o wand: the magick wand.
8509%
8510%    o set_wand: the set_wand wand.
8511%
8512*/
8513WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8514  const MagickWand *set_wand)
8515{
8516  Image
8517    *images;
8518
8519  assert(wand != (MagickWand *) NULL);
8520  assert(wand->signature == WandSignature);
8521  if (wand->debug != MagickFalse)
8522    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8523  assert(set_wand != (MagickWand *) NULL);
8524  assert(set_wand->signature == WandSignature);
8525  if (wand->debug != MagickFalse)
8526    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8527  if (set_wand->images == (Image *) NULL)
8528    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8529  images=CloneImageList(set_wand->images,wand->exception);
8530  if (images == (Image *) NULL)
8531    return(MagickFalse);
8532  ReplaceImageInList(&wand->images,images);
8533  return(MagickTrue);
8534}
8535
8536/*
8537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8538%                                                                             %
8539%                                                                             %
8540%                                                                             %
8541%   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                       %
8542%                                                                             %
8543%                                                                             %
8544%                                                                             %
8545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8546%
8547%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8548%  alpha channel.
8549%
8550%  The format of the MagickSetImageAlphaChannel method is:
8551%
8552%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8553%        const AlphaChannelType alpha_type)
8554%
8555%  A description of each parameter follows:
8556%
8557%    o wand: the magick wand.
8558%
8559%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8560%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8561%
8562*/
8563WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8564  const AlphaChannelType alpha_type)
8565{
8566  assert(wand != (MagickWand *) NULL);
8567  assert(wand->signature == WandSignature);
8568  if (wand->debug != MagickFalse)
8569    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8570  if (wand->images == (Image *) NULL)
8571    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8572  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8573}
8574
8575/*
8576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8577%                                                                             %
8578%                                                                             %
8579%                                                                             %
8580%   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                 %
8581%                                                                             %
8582%                                                                             %
8583%                                                                             %
8584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8585%
8586%  MagickSetImageBackgroundColor() sets the image background color.
8587%
8588%  The format of the MagickSetImageBackgroundColor method is:
8589%
8590%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8591%        const PixelWand *background)
8592%
8593%  A description of each parameter follows:
8594%
8595%    o wand: the magick wand.
8596%
8597%    o background: the background pixel wand.
8598%
8599*/
8600WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8601  const PixelWand *background)
8602{
8603  assert(wand != (MagickWand *) NULL);
8604  assert(wand->signature == WandSignature);
8605  if (wand->debug != MagickFalse)
8606    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8607  if (wand->images == (Image *) NULL)
8608    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8609  PixelGetQuantumPacket(background,&wand->images->background_color);
8610  return(MagickTrue);
8611}
8612
8613/*
8614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8615%                                                                             %
8616%                                                                             %
8617%                                                                             %
8618%   M a g i c k S e t I m a g e B i a s                                       %
8619%                                                                             %
8620%                                                                             %
8621%                                                                             %
8622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8623%
8624%  MagickSetImageBias() sets the image bias for any method that convolves an
8625%  image (e.g. MagickConvolveImage()).
8626%
8627%  The format of the MagickSetImageBias method is:
8628%
8629%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8630%        const double bias)
8631%
8632%  A description of each parameter follows:
8633%
8634%    o wand: the magick wand.
8635%
8636%    o bias: the image bias.
8637%
8638*/
8639WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8640  const double bias)
8641{
8642  assert(wand != (MagickWand *) NULL);
8643  assert(wand->signature == WandSignature);
8644  if (wand->debug != MagickFalse)
8645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8646  if (wand->images == (Image *) NULL)
8647    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8648  wand->images->bias=bias;
8649  return(MagickTrue);
8650}
8651
8652/*
8653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8654%                                                                             %
8655%                                                                             %
8656%                                                                             %
8657%   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                         %
8658%                                                                             %
8659%                                                                             %
8660%                                                                             %
8661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8662%
8663%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8664%
8665%  The format of the MagickSetImageBluePrimary method is:
8666%
8667%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8668%        const double x,const double y)
8669%
8670%  A description of each parameter follows:
8671%
8672%    o wand: the magick wand.
8673%
8674%    o x: the blue primary x-point.
8675%
8676%    o y: the blue primary y-point.
8677%
8678*/
8679WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8680  const double x,const double y)
8681{
8682  assert(wand != (MagickWand *) NULL);
8683  assert(wand->signature == WandSignature);
8684  if (wand->debug != MagickFalse)
8685    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8686  if (wand->images == (Image *) NULL)
8687    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8688  wand->images->chromaticity.blue_primary.x=x;
8689  wand->images->chromaticity.blue_primary.y=y;
8690  return(MagickTrue);
8691}
8692
8693/*
8694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8695%                                                                             %
8696%                                                                             %
8697%                                                                             %
8698%   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                         %
8699%                                                                             %
8700%                                                                             %
8701%                                                                             %
8702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8703%
8704%  MagickSetImageBorderColor() sets the image border color.
8705%
8706%  The format of the MagickSetImageBorderColor method is:
8707%
8708%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8709%        const PixelWand *border)
8710%
8711%  A description of each parameter follows:
8712%
8713%    o wand: the magick wand.
8714%
8715%    o border: the border pixel wand.
8716%
8717*/
8718WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8719  const PixelWand *border)
8720{
8721  assert(wand != (MagickWand *) NULL);
8722  assert(wand->signature == WandSignature);
8723  if (wand->debug != MagickFalse)
8724    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8725  if (wand->images == (Image *) NULL)
8726    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8727  PixelGetQuantumPacket(border,&wand->images->border_color);
8728  return(MagickTrue);
8729}
8730
8731/*
8732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8733%                                                                             %
8734%                                                                             %
8735%                                                                             %
8736%   M a g i c k S e t I m a g e C l i p M a s k                               %
8737%                                                                             %
8738%                                                                             %
8739%                                                                             %
8740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8741%
8742%  MagickSetImageClipMask() sets image clip mask.
8743%
8744%  The format of the MagickSetImageClipMask method is:
8745%
8746%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8747%        const MagickWand *clip_mask)
8748%
8749%  A description of each parameter follows:
8750%
8751%    o wand: the magick wand.
8752%
8753%    o clip_mask: the clip_mask wand.
8754%
8755*/
8756WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8757  const MagickWand *clip_mask)
8758{
8759  assert(wand != (MagickWand *) NULL);
8760  assert(wand->signature == WandSignature);
8761  if (wand->debug != MagickFalse)
8762    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8763  assert(clip_mask != (MagickWand *) NULL);
8764  assert(clip_mask->signature == WandSignature);
8765  if (clip_mask->debug != MagickFalse)
8766    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8767  if (clip_mask->images == (Image *) NULL)
8768    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8769  return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8770}
8771
8772/*
8773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8774%                                                                             %
8775%                                                                             %
8776%                                                                             %
8777%   M a g i c k S e t I m a g e C o l o r                                     %
8778%                                                                             %
8779%                                                                             %
8780%                                                                             %
8781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8782%
8783%  MagickSetImageColor() set the entire wand canvas to the specified color.
8784%
8785%  The format of the MagickSetImageColor method is:
8786%
8787%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8788%        const PixelWand *color)
8789%
8790%  A description of each parameter follows:
8791%
8792%    o wand: the magick wand.
8793%
8794%    o background: the image color.
8795%
8796*/
8797WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8798  const PixelWand *color)
8799{
8800  PixelInfo
8801    pixel;
8802
8803  assert(wand != (MagickWand *) NULL);
8804  assert(wand->signature == WandSignature);
8805  if (wand->debug != MagickFalse)
8806    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8807  PixelGetMagickColor(color,&pixel);
8808  return(SetImageColor(wand->images,&pixel,wand->exception));
8809}
8810
8811/*
8812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8813%                                                                             %
8814%                                                                             %
8815%                                                                             %
8816%   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                     %
8817%                                                                             %
8818%                                                                             %
8819%                                                                             %
8820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8821%
8822%  MagickSetImageColormapColor() sets the color of the specified colormap
8823%  index.
8824%
8825%  The format of the MagickSetImageColormapColor method is:
8826%
8827%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8828%        const size_t index,const PixelWand *color)
8829%
8830%  A description of each parameter follows:
8831%
8832%    o wand: the magick wand.
8833%
8834%    o index: the offset into the image colormap.
8835%
8836%    o color: Return the colormap color in this wand.
8837%
8838*/
8839WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8840  const size_t index,const PixelWand *color)
8841{
8842  assert(wand != (MagickWand *) NULL);
8843  assert(wand->signature == WandSignature);
8844  if (wand->debug != MagickFalse)
8845    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8846  if (wand->images == (Image *) NULL)
8847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8848  if ((wand->images->colormap == (PixelInfo *) NULL) ||
8849      (index >= wand->images->colors))
8850    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8851  PixelGetQuantumPacket(color,wand->images->colormap+index);
8852  return(SyncImage(wand->images,wand->exception));
8853}
8854
8855/*
8856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8857%                                                                             %
8858%                                                                             %
8859%                                                                             %
8860%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8861%                                                                             %
8862%                                                                             %
8863%                                                                             %
8864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8865%
8866%  MagickSetImageColorspace() sets the image colorspace.
8867%
8868%  The format of the MagickSetImageColorspace method is:
8869%
8870%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8871%        const ColorspaceType colorspace)
8872%
8873%  A description of each parameter follows:
8874%
8875%    o wand: the magick wand.
8876%
8877%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8878%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8879%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8880%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8881%      HSLColorspace, or HWBColorspace.
8882%
8883*/
8884WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8885  const ColorspaceType colorspace)
8886{
8887  assert(wand != (MagickWand *) NULL);
8888  assert(wand->signature == WandSignature);
8889  if (wand->debug != MagickFalse)
8890    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8891  if (wand->images == (Image *) NULL)
8892    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8893  return(SetImageColorspace(wand->images,colorspace,wand->exception));
8894}
8895
8896/*
8897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8898%                                                                             %
8899%                                                                             %
8900%                                                                             %
8901%   M a g i c k S e t I m a g e C o m p o s e                                 %
8902%                                                                             %
8903%                                                                             %
8904%                                                                             %
8905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8906%
8907%  MagickSetImageCompose() sets the image composite operator, useful for
8908%  specifying how to composite the image thumbnail when using the
8909%  MagickMontageImage() method.
8910%
8911%  The format of the MagickSetImageCompose method is:
8912%
8913%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8914%        const CompositeOperator compose)
8915%
8916%  A description of each parameter follows:
8917%
8918%    o wand: the magick wand.
8919%
8920%    o compose: the image composite operator.
8921%
8922*/
8923WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8924  const CompositeOperator compose)
8925{
8926  assert(wand != (MagickWand *) NULL);
8927  assert(wand->signature == WandSignature);
8928  if (wand->debug != MagickFalse)
8929    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8930  if (wand->images == (Image *) NULL)
8931    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8932  wand->images->compose=compose;
8933  return(MagickTrue);
8934}
8935
8936/*
8937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8938%                                                                             %
8939%                                                                             %
8940%                                                                             %
8941%   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                         %
8942%                                                                             %
8943%                                                                             %
8944%                                                                             %
8945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8946%
8947%  MagickSetImageCompression() sets the image compression.
8948%
8949%  The format of the MagickSetImageCompression method is:
8950%
8951%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8952%        const CompressionType compression)
8953%
8954%  A description of each parameter follows:
8955%
8956%    o wand: the magick wand.
8957%
8958%    o compression: the image compression type.
8959%
8960*/
8961WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8962  const CompressionType compression)
8963{
8964  assert(wand != (MagickWand *) NULL);
8965  assert(wand->signature == WandSignature);
8966  if (wand->debug != MagickFalse)
8967    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8968  if (wand->images == (Image *) NULL)
8969    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8970  wand->images->compression=compression;
8971  return(MagickTrue);
8972}
8973
8974/*
8975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8976%                                                                             %
8977%                                                                             %
8978%                                                                             %
8979%   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           %
8980%                                                                             %
8981%                                                                             %
8982%                                                                             %
8983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8984%
8985%  MagickSetImageCompressionQuality() sets the image compression quality.
8986%
8987%  The format of the MagickSetImageCompressionQuality method is:
8988%
8989%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8990%        const size_t quality)
8991%
8992%  A description of each parameter follows:
8993%
8994%    o wand: the magick wand.
8995%
8996%    o quality: the image compression tlityype.
8997%
8998*/
8999WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9000  const size_t quality)
9001{
9002  assert(wand != (MagickWand *) NULL);
9003  assert(wand->signature == WandSignature);
9004  if (wand->debug != MagickFalse)
9005    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9006  if (wand->images == (Image *) NULL)
9007    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9008  wand->images->quality=quality;
9009  return(MagickTrue);
9010}
9011
9012/*
9013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9014%                                                                             %
9015%                                                                             %
9016%                                                                             %
9017%   M a g i c k S e t I m a g e D e l a y                                     %
9018%                                                                             %
9019%                                                                             %
9020%                                                                             %
9021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9022%
9023%  MagickSetImageDelay() sets the image delay.
9024%
9025%  The format of the MagickSetImageDelay method is:
9026%
9027%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9028%        const size_t delay)
9029%
9030%  A description of each parameter follows:
9031%
9032%    o wand: the magick wand.
9033%
9034%    o delay: the image delay in ticks-per-second units.
9035%
9036*/
9037WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9038  const size_t delay)
9039{
9040  assert(wand != (MagickWand *) NULL);
9041  assert(wand->signature == WandSignature);
9042  if (wand->debug != MagickFalse)
9043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9044  if (wand->images == (Image *) NULL)
9045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9046  wand->images->delay=delay;
9047  return(MagickTrue);
9048}
9049
9050/*
9051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9052%                                                                             %
9053%                                                                             %
9054%                                                                             %
9055%   M a g i c k S e t I m a g e D e p t h                                     %
9056%                                                                             %
9057%                                                                             %
9058%                                                                             %
9059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9060%
9061%  MagickSetImageDepth() sets the image depth.
9062%
9063%  The format of the MagickSetImageDepth method is:
9064%
9065%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9066%        const size_t depth)
9067%
9068%  A description of each parameter follows:
9069%
9070%    o wand: the magick wand.
9071%
9072%    o depth: the image depth in bits: 8, 16, or 32.
9073%
9074*/
9075WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9076  const size_t depth)
9077{
9078  assert(wand != (MagickWand *) NULL);
9079  assert(wand->signature == WandSignature);
9080  if (wand->debug != MagickFalse)
9081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9082  if (wand->images == (Image *) NULL)
9083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9084  return(SetImageDepth(wand->images,depth,wand->exception));
9085}
9086
9087/*
9088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9089%                                                                             %
9090%                                                                             %
9091%                                                                             %
9092%   M a g i c k S e t I m a g e D i s p o s e                                 %
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9097%
9098%  MagickSetImageDispose() sets the image disposal method.
9099%
9100%  The format of the MagickSetImageDispose method is:
9101%
9102%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9103%        const DisposeType dispose)
9104%
9105%  A description of each parameter follows:
9106%
9107%    o wand: the magick wand.
9108%
9109%    o dispose: the image disposeal type.
9110%
9111*/
9112WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9113  const DisposeType dispose)
9114{
9115  assert(wand != (MagickWand *) NULL);
9116  assert(wand->signature == WandSignature);
9117  if (wand->debug != MagickFalse)
9118    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9119  if (wand->images == (Image *) NULL)
9120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9121  wand->images->dispose=dispose;
9122  return(MagickTrue);
9123}
9124
9125/*
9126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9127%                                                                             %
9128%                                                                             %
9129%                                                                             %
9130%   M a g i c k S e t I m a g e E x t e n t                                   %
9131%                                                                             %
9132%                                                                             %
9133%                                                                             %
9134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9135%
9136%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9137%
9138%  The format of the MagickSetImageExtent method is:
9139%
9140%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9141%        const size_t columns,const unsigned rows)
9142%
9143%  A description of each parameter follows:
9144%
9145%    o wand: the magick wand.
9146%
9147%    o columns:  The image width in pixels.
9148%
9149%    o rows:  The image height in pixels.
9150%
9151*/
9152WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9153  const size_t columns,const size_t rows)
9154{
9155  assert(wand != (MagickWand *) NULL);
9156  assert(wand->signature == WandSignature);
9157  if (wand->debug != MagickFalse)
9158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9159  if (wand->images == (Image *) NULL)
9160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9161  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9162}
9163
9164/*
9165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9166%                                                                             %
9167%                                                                             %
9168%                                                                             %
9169%   M a g i c k S e t I m a g e F i l e n a m e                               %
9170%                                                                             %
9171%                                                                             %
9172%                                                                             %
9173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9174%
9175%  MagickSetImageFilename() sets the filename of a particular image in a
9176%  sequence.
9177%
9178%  The format of the MagickSetImageFilename method is:
9179%
9180%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9181%        const char *filename)
9182%
9183%  A description of each parameter follows:
9184%
9185%    o wand: the magick wand.
9186%
9187%    o filename: the image filename.
9188%
9189*/
9190WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9191  const char *filename)
9192{
9193  assert(wand != (MagickWand *) NULL);
9194  assert(wand->signature == WandSignature);
9195  if (wand->debug != MagickFalse)
9196    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9197  if (wand->images == (Image *) NULL)
9198    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9199  if (filename != (const char *) NULL)
9200    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9201  return(MagickTrue);
9202}
9203
9204/*
9205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9206%                                                                             %
9207%                                                                             %
9208%                                                                             %
9209%   M a g i c k S e t I m a g e F o r m a t                                   %
9210%                                                                             %
9211%                                                                             %
9212%                                                                             %
9213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9214%
9215%  MagickSetImageFormat() sets the format of a particular image in a
9216%  sequence.
9217%
9218%  The format of the MagickSetImageFormat method is:
9219%
9220%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9221%        const char *format)
9222%
9223%  A description of each parameter follows:
9224%
9225%    o wand: the magick wand.
9226%
9227%    o format: the image format.
9228%
9229*/
9230WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9231  const char *format)
9232{
9233  const MagickInfo
9234    *magick_info;
9235
9236  assert(wand != (MagickWand *) NULL);
9237  assert(wand->signature == WandSignature);
9238  if (wand->debug != MagickFalse)
9239    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9240  if (wand->images == (Image *) NULL)
9241    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9242  if ((format == (char *) NULL) || (*format == '\0'))
9243    {
9244      *wand->images->magick='\0';
9245      return(MagickTrue);
9246    }
9247  magick_info=GetMagickInfo(format,wand->exception);
9248  if (magick_info == (const MagickInfo *) NULL)
9249    return(MagickFalse);
9250  ClearMagickException(wand->exception);
9251  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9252  return(MagickTrue);
9253}
9254
9255/*
9256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9257%                                                                             %
9258%                                                                             %
9259%                                                                             %
9260%   M a g i c k S e t I m a g e F u z z                                       %
9261%                                                                             %
9262%                                                                             %
9263%                                                                             %
9264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9265%
9266%  MagickSetImageFuzz() sets the image fuzz.
9267%
9268%  The format of the MagickSetImageFuzz method is:
9269%
9270%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9271%        const double fuzz)
9272%
9273%  A description of each parameter follows:
9274%
9275%    o wand: the magick wand.
9276%
9277%    o fuzz: the image fuzz.
9278%
9279*/
9280WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9281  const double fuzz)
9282{
9283  assert(wand != (MagickWand *) NULL);
9284  assert(wand->signature == WandSignature);
9285  if (wand->debug != MagickFalse)
9286    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9287  if (wand->images == (Image *) NULL)
9288    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9289  wand->images->fuzz=fuzz;
9290  return(MagickTrue);
9291}
9292
9293/*
9294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9295%                                                                             %
9296%                                                                             %
9297%                                                                             %
9298%   M a g i c k S e t I m a g e G a m m a                                     %
9299%                                                                             %
9300%                                                                             %
9301%                                                                             %
9302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9303%
9304%  MagickSetImageGamma() sets the image gamma.
9305%
9306%  The format of the MagickSetImageGamma method is:
9307%
9308%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9309%        const double gamma)
9310%
9311%  A description of each parameter follows:
9312%
9313%    o wand: the magick wand.
9314%
9315%    o gamma: the image gamma.
9316%
9317*/
9318WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9319  const double gamma)
9320{
9321  assert(wand != (MagickWand *) NULL);
9322  assert(wand->signature == WandSignature);
9323  if (wand->debug != MagickFalse)
9324    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9325  if (wand->images == (Image *) NULL)
9326    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9327  wand->images->gamma=gamma;
9328  return(MagickTrue);
9329}
9330
9331/*
9332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9333%                                                                             %
9334%                                                                             %
9335%                                                                             %
9336%   M a g i c k S e t I m a g e G r a v i t y                                 %
9337%                                                                             %
9338%                                                                             %
9339%                                                                             %
9340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9341%
9342%  MagickSetImageGravity() sets the image gravity type.
9343%
9344%  The format of the MagickSetImageGravity method is:
9345%
9346%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9347%        const GravityType gravity)
9348%
9349%  A description of each parameter follows:
9350%
9351%    o wand: the magick wand.
9352%
9353%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9354%      PlaneInterlace, PartitionInterlace.
9355%
9356*/
9357WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9358  const GravityType gravity)
9359{
9360  assert(wand != (MagickWand *) NULL);
9361  assert(wand->signature == WandSignature);
9362  if (wand->debug != MagickFalse)
9363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9364  if (wand->images == (Image *) NULL)
9365    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9366  wand->images->gravity=gravity;
9367  return(MagickTrue);
9368}
9369
9370/*
9371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9372%                                                                             %
9373%                                                                             %
9374%                                                                             %
9375%   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                       %
9376%                                                                             %
9377%                                                                             %
9378%                                                                             %
9379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9380%
9381%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9382%  point.
9383%
9384%  The format of the MagickSetImageGreenPrimary method is:
9385%
9386%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9387%        const double x,const double y)
9388%
9389%  A description of each parameter follows:
9390%
9391%    o wand: the magick wand.
9392%
9393%    o x: the green primary x-point.
9394%
9395%    o y: the green primary y-point.
9396%
9397%
9398*/
9399WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9400  const double x,const double y)
9401{
9402  assert(wand != (MagickWand *) NULL);
9403  assert(wand->signature == WandSignature);
9404  if (wand->debug != MagickFalse)
9405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9406  if (wand->images == (Image *) NULL)
9407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9408  wand->images->chromaticity.green_primary.x=x;
9409  wand->images->chromaticity.green_primary.y=y;
9410  return(MagickTrue);
9411}
9412
9413/*
9414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9415%                                                                             %
9416%                                                                             %
9417%                                                                             %
9418%   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                 %
9419%                                                                             %
9420%                                                                             %
9421%                                                                             %
9422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9423%
9424%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9425%
9426%  The format of the MagickSetImageInterlaceScheme method is:
9427%
9428%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9429%        const InterlaceType interlace)
9430%
9431%  A description of each parameter follows:
9432%
9433%    o wand: the magick wand.
9434%
9435%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9436%      PlaneInterlace, PartitionInterlace.
9437%
9438*/
9439WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9440  const InterlaceType interlace)
9441{
9442  assert(wand != (MagickWand *) NULL);
9443  assert(wand->signature == WandSignature);
9444  if (wand->debug != MagickFalse)
9445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9446  if (wand->images == (Image *) NULL)
9447    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9448  wand->images->interlace=interlace;
9449  return(MagickTrue);
9450}
9451
9452/*
9453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9454%                                                                             %
9455%                                                                             %
9456%                                                                             %
9457%   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             %
9458%                                                                             %
9459%                                                                             %
9460%                                                                             %
9461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9462%
9463%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9464%
9465%  The format of the MagickSetImagePixelInterpolateMethod method is:
9466%
9467%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9468%        const PixelInterpolateMethod method)
9469%
9470%  A description of each parameter follows:
9471%
9472%    o wand: the magick wand.
9473%
9474%    o method: the image interpole pixel methods: choose from Undefined,
9475%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9476%
9477*/
9478WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9479  const PixelInterpolateMethod method)
9480{
9481  assert(wand != (MagickWand *) NULL);
9482  assert(wand->signature == WandSignature);
9483  if (wand->debug != MagickFalse)
9484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9485  if (wand->images == (Image *) NULL)
9486    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9487  wand->images->interpolate=method;
9488  return(MagickTrue);
9489}
9490
9491/*
9492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9493%                                                                             %
9494%                                                                             %
9495%                                                                             %
9496%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9497%                                                                             %
9498%                                                                             %
9499%                                                                             %
9500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9501%
9502%  MagickSetImageIterations() sets the image iterations.
9503%
9504%  The format of the MagickSetImageIterations method is:
9505%
9506%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9507%        const size_t iterations)
9508%
9509%  A description of each parameter follows:
9510%
9511%    o wand: the magick wand.
9512%
9513%    o delay: the image delay in 1/100th of a second.
9514%
9515*/
9516WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9517  const size_t iterations)
9518{
9519  assert(wand != (MagickWand *) NULL);
9520  assert(wand->signature == WandSignature);
9521  if (wand->debug != MagickFalse)
9522    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9523  if (wand->images == (Image *) NULL)
9524    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9525  wand->images->iterations=iterations;
9526  return(MagickTrue);
9527}
9528
9529/*
9530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9531%                                                                             %
9532%                                                                             %
9533%                                                                             %
9534%   M a g i c k S e t I m a g e M a t t e                                     %
9535%                                                                             %
9536%                                                                             %
9537%                                                                             %
9538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9539%
9540%  MagickSetImageMatte() sets the image matte channel.
9541%
9542%  The format of the MagickSetImageMatteColor method is:
9543%
9544%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9545%        const MagickBooleanType *matte)
9546%
9547%  A description of each parameter follows:
9548%
9549%    o wand: the magick wand.
9550%
9551%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9552%      MagickFalse.
9553%
9554*/
9555WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9556  const MagickBooleanType matte)
9557{
9558  assert(wand != (MagickWand *) NULL);
9559  assert(wand->signature == WandSignature);
9560  if (wand->debug != MagickFalse)
9561    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9562  if (wand->images == (Image *) NULL)
9563    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9564  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9565    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9566  wand->images->matte=matte;
9567  return(MagickTrue);
9568}
9569
9570/*
9571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9572%                                                                             %
9573%                                                                             %
9574%                                                                             %
9575%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9576%                                                                             %
9577%                                                                             %
9578%                                                                             %
9579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580%
9581%  MagickSetImageMatteColor() sets the image matte color.
9582%
9583%  The format of the MagickSetImageMatteColor method is:
9584%
9585%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9586%        const PixelWand *matte)
9587%
9588%  A description of each parameter follows:
9589%
9590%    o wand: the magick wand.
9591%
9592%    o matte: the matte pixel wand.
9593%
9594*/
9595WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9596  const PixelWand *matte)
9597{
9598  assert(wand != (MagickWand *) NULL);
9599  assert(wand->signature == WandSignature);
9600  if (wand->debug != MagickFalse)
9601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9602  if (wand->images == (Image *) NULL)
9603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9604  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9605  return(MagickTrue);
9606}
9607
9608/*
9609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9610%                                                                             %
9611%                                                                             %
9612%                                                                             %
9613%   M a g i c k S e t I m a g e O p a c i t y                                 %
9614%                                                                             %
9615%                                                                             %
9616%                                                                             %
9617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618%
9619%  MagickSetImageAlpha() sets the image to the specified alpha level.
9620%
9621%  The format of the MagickSetImageAlpha method is:
9622%
9623%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9624%        const double alpha)
9625%
9626%  A description of each parameter follows:
9627%
9628%    o wand: the magick wand.
9629%
9630%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9631%      transparent.
9632%
9633*/
9634WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9635  const double alpha)
9636{
9637  MagickBooleanType
9638    status;
9639
9640  assert(wand != (MagickWand *) NULL);
9641  assert(wand->signature == WandSignature);
9642  if (wand->debug != MagickFalse)
9643    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9644  if (wand->images == (Image *) NULL)
9645    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9646  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9647    wand->exception);
9648  return(status);
9649}
9650
9651/*
9652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9653%                                                                             %
9654%                                                                             %
9655%                                                                             %
9656%   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                         %
9657%                                                                             %
9658%                                                                             %
9659%                                                                             %
9660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9661%
9662%  MagickSetImageOrientation() sets the image orientation.
9663%
9664%  The format of the MagickSetImageOrientation method is:
9665%
9666%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9667%        const OrientationType orientation)
9668%
9669%  A description of each parameter follows:
9670%
9671%    o wand: the magick wand.
9672%
9673%    o orientation: the image orientation type.
9674%
9675*/
9676WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9677  const OrientationType orientation)
9678{
9679  assert(wand != (MagickWand *) NULL);
9680  assert(wand->signature == WandSignature);
9681  if (wand->debug != MagickFalse)
9682    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9683  if (wand->images == (Image *) NULL)
9684    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9685  wand->images->orientation=orientation;
9686  return(MagickTrue);
9687}
9688
9689/*
9690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9691%                                                                             %
9692%                                                                             %
9693%                                                                             %
9694%   M a g i c k S e t I m a g e P a g e                                       %
9695%                                                                             %
9696%                                                                             %
9697%                                                                             %
9698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9699%
9700%  MagickSetImagePage() sets the page geometry of the image.
9701%
9702%  The format of the MagickSetImagePage method is:
9703%
9704%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9705%        const size_t width,const size_t height,const ssize_t x,
9706%        const ssize_t y)
9707%
9708%  A description of each parameter follows:
9709%
9710%    o wand: the magick wand.
9711%
9712%    o width: the page width.
9713%
9714%    o height: the page height.
9715%
9716%    o x: the page x-offset.
9717%
9718%    o y: the page y-offset.
9719%
9720*/
9721WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9722  const size_t width,const size_t height,const ssize_t x,
9723  const ssize_t y)
9724{
9725  assert(wand != (MagickWand *) NULL);
9726  assert(wand->signature == WandSignature);
9727  if (wand->debug != MagickFalse)
9728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9729  if (wand->images == (Image *) NULL)
9730    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9731  wand->images->page.width=width;
9732  wand->images->page.height=height;
9733  wand->images->page.x=x;
9734  wand->images->page.y=y;
9735  return(MagickTrue);
9736}
9737
9738/*
9739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9740%                                                                             %
9741%                                                                             %
9742%                                                                             %
9743%   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                 %
9744%                                                                             %
9745%                                                                             %
9746%                                                                             %
9747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748%
9749%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9750%  specified method and returns the previous progress monitor if any.  The
9751%  progress monitor method looks like this:
9752%
9753%    MagickBooleanType MagickProgressMonitor(const char *text,
9754%      const MagickOffsetType offset,const MagickSizeType span,
9755%      void *client_data)
9756%
9757%  If the progress monitor returns MagickFalse, the current operation is
9758%  interrupted.
9759%
9760%  The format of the MagickSetImageProgressMonitor method is:
9761%
9762%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9763%        const MagickProgressMonitor progress_monitor,void *client_data)
9764%
9765%  A description of each parameter follows:
9766%
9767%    o wand: the magick wand.
9768%
9769%    o progress_monitor: Specifies a pointer to a method to monitor progress
9770%      of an image operation.
9771%
9772%    o client_data: Specifies a pointer to any client data.
9773%
9774*/
9775WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9776  const MagickProgressMonitor progress_monitor,void *client_data)
9777{
9778  MagickProgressMonitor
9779    previous_monitor;
9780
9781  assert(wand != (MagickWand *) NULL);
9782  assert(wand->signature == WandSignature);
9783  if (wand->debug != MagickFalse)
9784    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9785  if (wand->images == (Image *) NULL)
9786    {
9787      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9788        "ContainsNoImages","`%s'",wand->name);
9789      return((MagickProgressMonitor) NULL);
9790    }
9791  previous_monitor=SetImageProgressMonitor(wand->images,
9792    progress_monitor,client_data);
9793  return(previous_monitor);
9794}
9795
9796/*
9797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9798%                                                                             %
9799%                                                                             %
9800%                                                                             %
9801%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9802%                                                                             %
9803%                                                                             %
9804%                                                                             %
9805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9806%
9807%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9808%
9809%  The format of the MagickSetImageRedPrimary method is:
9810%
9811%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9812%        const double x,const double y)
9813%
9814%  A description of each parameter follows:
9815%
9816%    o wand: the magick wand.
9817%
9818%    o x: the red primary x-point.
9819%
9820%    o y: the red primary y-point.
9821%
9822*/
9823WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9824  const double x,const double y)
9825{
9826  assert(wand != (MagickWand *) NULL);
9827  assert(wand->signature == WandSignature);
9828  if (wand->debug != MagickFalse)
9829    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9830  if (wand->images == (Image *) NULL)
9831    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9832  wand->images->chromaticity.red_primary.x=x;
9833  wand->images->chromaticity.red_primary.y=y;
9834  return(MagickTrue);
9835}
9836
9837/*
9838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9839%                                                                             %
9840%                                                                             %
9841%                                                                             %
9842%   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                 %
9843%                                                                             %
9844%                                                                             %
9845%                                                                             %
9846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9847%
9848%  MagickSetImageRenderingIntent() sets the image rendering intent.
9849%
9850%  The format of the MagickSetImageRenderingIntent method is:
9851%
9852%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9853%        const RenderingIntent rendering_intent)
9854%
9855%  A description of each parameter follows:
9856%
9857%    o wand: the magick wand.
9858%
9859%    o rendering_intent: the image rendering intent: UndefinedIntent,
9860%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9861%
9862*/
9863WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9864  const RenderingIntent rendering_intent)
9865{
9866  assert(wand != (MagickWand *) NULL);
9867  assert(wand->signature == WandSignature);
9868  if (wand->debug != MagickFalse)
9869    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9870  if (wand->images == (Image *) NULL)
9871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9872  wand->images->rendering_intent=rendering_intent;
9873  return(MagickTrue);
9874}
9875
9876/*
9877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9878%                                                                             %
9879%                                                                             %
9880%                                                                             %
9881%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9882%                                                                             %
9883%                                                                             %
9884%                                                                             %
9885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9886%
9887%  MagickSetImageResolution() sets the image resolution.
9888%
9889%  The format of the MagickSetImageResolution method is:
9890%
9891%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9892%        const double x_resolution,const doubtl y_resolution)
9893%
9894%  A description of each parameter follows:
9895%
9896%    o wand: the magick wand.
9897%
9898%    o x_resolution: the image x resolution.
9899%
9900%    o y_resolution: the image y resolution.
9901%
9902*/
9903WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9904  const double x_resolution,const double y_resolution)
9905{
9906  assert(wand != (MagickWand *) NULL);
9907  assert(wand->signature == WandSignature);
9908  if (wand->debug != MagickFalse)
9909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9910  if (wand->images == (Image *) NULL)
9911    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9912  wand->images->resolution.x=x_resolution;
9913  wand->images->resolution.y=y_resolution;
9914  return(MagickTrue);
9915}
9916
9917/*
9918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9919%                                                                             %
9920%                                                                             %
9921%                                                                             %
9922%   M a g i c k S e t I m a g e S c e n e                                     %
9923%                                                                             %
9924%                                                                             %
9925%                                                                             %
9926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9927%
9928%  MagickSetImageScene() sets the image scene.
9929%
9930%  The format of the MagickSetImageScene method is:
9931%
9932%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9933%        const size_t scene)
9934%
9935%  A description of each parameter follows:
9936%
9937%    o wand: the magick wand.
9938%
9939%    o delay: the image scene number.
9940%
9941*/
9942WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9943  const size_t scene)
9944{
9945  assert(wand != (MagickWand *) NULL);
9946  assert(wand->signature == WandSignature);
9947  if (wand->debug != MagickFalse)
9948    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9949  if (wand->images == (Image *) NULL)
9950    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9951  wand->images->scene=scene;
9952  return(MagickTrue);
9953}
9954
9955/*
9956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9957%                                                                             %
9958%                                                                             %
9959%                                                                             %
9960%   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                   %
9961%                                                                             %
9962%                                                                             %
9963%                                                                             %
9964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9965%
9966%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9967%
9968%  The format of the MagickSetImageTicksPerSecond method is:
9969%
9970%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9971%        const ssize_t ticks_per-second)
9972%
9973%  A description of each parameter follows:
9974%
9975%    o wand: the magick wand.
9976%
9977%    o ticks_per_second: the units to use for the image delay.
9978%
9979*/
9980WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9981  const ssize_t ticks_per_second)
9982{
9983  assert(wand != (MagickWand *) NULL);
9984  assert(wand->signature == WandSignature);
9985  if (wand->debug != MagickFalse)
9986    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9987  if (wand->images == (Image *) NULL)
9988    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9989  wand->images->ticks_per_second=ticks_per_second;
9990  return(MagickTrue);
9991}
9992
9993/*
9994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9995%                                                                             %
9996%                                                                             %
9997%                                                                             %
9998%   M a g i c k S e t I m a g e T y p e                                       %
9999%                                                                             %
10000%                                                                             %
10001%                                                                             %
10002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10003%
10004%  MagickSetImageType() sets the image type.
10005%
10006%  The format of the MagickSetImageType method is:
10007%
10008%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10009%        const ImageType image_type)
10010%
10011%  A description of each parameter follows:
10012%
10013%    o wand: the magick wand.
10014%
10015%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10016%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10017%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10018%      or OptimizeType.
10019%
10020*/
10021WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10022  const ImageType image_type)
10023{
10024  assert(wand != (MagickWand *) NULL);
10025  assert(wand->signature == WandSignature);
10026  if (wand->debug != MagickFalse)
10027    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10028  if (wand->images == (Image *) NULL)
10029    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10030  return(SetImageType(wand->images,image_type,wand->exception));
10031}
10032
10033/*
10034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10035%                                                                             %
10036%                                                                             %
10037%                                                                             %
10038%   M a g i c k S e t I m a g e U n i t s                                     %
10039%                                                                             %
10040%                                                                             %
10041%                                                                             %
10042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10043%
10044%  MagickSetImageUnits() sets the image units of resolution.
10045%
10046%  The format of the MagickSetImageUnits method is:
10047%
10048%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10049%        const ResolutionType units)
10050%
10051%  A description of each parameter follows:
10052%
10053%    o wand: the magick wand.
10054%
10055%    o units: the image units of resolution : UndefinedResolution,
10056%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10057%
10058*/
10059WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10060  const ResolutionType units)
10061{
10062  assert(wand != (MagickWand *) NULL);
10063  assert(wand->signature == WandSignature);
10064  if (wand->debug != MagickFalse)
10065    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10066  if (wand->images == (Image *) NULL)
10067    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10068  wand->images->units=units;
10069  return(MagickTrue);
10070}
10071
10072/*
10073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10074%                                                                             %
10075%                                                                             %
10076%                                                                             %
10077%   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           %
10078%                                                                             %
10079%                                                                             %
10080%                                                                             %
10081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10082%
10083%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10084%
10085%  The format of the MagickSetImageVirtualPixelMethod method is:
10086%
10087%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10088%        const VirtualPixelMethod method)
10089%
10090%  A description of each parameter follows:
10091%
10092%    o wand: the magick wand.
10093%
10094%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10095%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10096%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10097%
10098*/
10099WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10100  const VirtualPixelMethod method)
10101{
10102  assert(wand != (MagickWand *) NULL);
10103  assert(wand->signature == WandSignature);
10104  if (wand->debug != MagickFalse)
10105    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10106  if (wand->images == (Image *) NULL)
10107    return(UndefinedVirtualPixelMethod);
10108  return(SetImageVirtualPixelMethod(wand->images,method));
10109}
10110
10111/*
10112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10113%                                                                             %
10114%                                                                             %
10115%                                                                             %
10116%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10117%                                                                             %
10118%                                                                             %
10119%                                                                             %
10120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10121%
10122%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10123%
10124%  The format of the MagickSetImageWhitePoint method is:
10125%
10126%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10127%        const double x,const double y)
10128%
10129%  A description of each parameter follows:
10130%
10131%    o wand: the magick wand.
10132%
10133%    o x: the white x-point.
10134%
10135%    o y: the white y-point.
10136%
10137*/
10138WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10139  const double x,const double y)
10140{
10141  assert(wand != (MagickWand *) NULL);
10142  assert(wand->signature == WandSignature);
10143  if (wand->debug != MagickFalse)
10144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10145  if (wand->images == (Image *) NULL)
10146    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10147  wand->images->chromaticity.white_point.x=x;
10148  wand->images->chromaticity.white_point.y=y;
10149  return(MagickTrue);
10150}
10151
10152/*
10153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10154%                                                                             %
10155%                                                                             %
10156%                                                                             %
10157%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10158%                                                                             %
10159%                                                                             %
10160%                                                                             %
10161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10162%
10163%  MagickShadeImage() shines a distant light on an image to create a
10164%  three-dimensional effect. You control the positioning of the light with
10165%  azimuth and elevation; azimuth is measured in degrees off the x axis
10166%  and elevation is measured in pixels above the Z axis.
10167%
10168%  The format of the MagickShadeImage method is:
10169%
10170%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10171%        const MagickBooleanType gray,const double azimuth,
10172%        const double elevation)
10173%
10174%  A description of each parameter follows:
10175%
10176%    o wand: the magick wand.
10177%
10178%    o gray: A value other than zero shades the intensity of each pixel.
10179%
10180%    o azimuth, elevation:  Define the light source direction.
10181%
10182*/
10183WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10184  const MagickBooleanType gray,const double asimuth,const double elevation)
10185{
10186  Image
10187    *shade_image;
10188
10189  assert(wand != (MagickWand *) NULL);
10190  assert(wand->signature == WandSignature);
10191  if (wand->debug != MagickFalse)
10192    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10193  if (wand->images == (Image *) NULL)
10194    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10195  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10196  if (shade_image == (Image *) NULL)
10197    return(MagickFalse);
10198  ReplaceImageInList(&wand->images,shade_image);
10199  return(MagickTrue);
10200}
10201
10202/*
10203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10204%                                                                             %
10205%                                                                             %
10206%                                                                             %
10207%   M a g i c k S h a d o w I m a g e                                         %
10208%                                                                             %
10209%                                                                             %
10210%                                                                             %
10211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10212%
10213%  MagickShadowImage() simulates an image shadow.
10214%
10215%  The format of the MagickShadowImage method is:
10216%
10217%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10218%        const double alpha,const double sigma,const double bias,
10219%        const ssize_t x,const ssize_t y)
10220%
10221%  A description of each parameter follows:
10222%
10223%    o wand: the magick wand.
10224%
10225%    o alpha: percentage transparency.
10226%
10227%    o sigma: the standard deviation of the Gaussian, in pixels.
10228%
10229%    o bias: the bias.
10230%
10231%    o x: the shadow x-offset.
10232%
10233%    o y: the shadow y-offset.
10234%
10235*/
10236WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10237  const double alpha,const double sigma,const double bias,const ssize_t x,
10238  const ssize_t y)
10239{
10240  Image
10241    *shadow_image;
10242
10243  assert(wand != (MagickWand *) NULL);
10244  assert(wand->signature == WandSignature);
10245  if (wand->debug != MagickFalse)
10246    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10247  if (wand->images == (Image *) NULL)
10248    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10249  shadow_image=ShadowImage(wand->images,alpha,sigma,bias,x,y,wand->exception);
10250  if (shadow_image == (Image *) NULL)
10251    return(MagickFalse);
10252  ReplaceImageInList(&wand->images,shadow_image);
10253  return(MagickTrue);
10254}
10255
10256/*
10257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10258%                                                                             %
10259%                                                                             %
10260%                                                                             %
10261%   M a g i c k S h a r p e n I m a g e                                       %
10262%                                                                             %
10263%                                                                             %
10264%                                                                             %
10265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266%
10267%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10268%  Gaussian operator of the given radius and standard deviation (sigma).
10269%  For reasonable results, the radius should be larger than sigma.  Use a
10270%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10271%
10272%  The format of the MagickSharpenImage method is:
10273%
10274%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10275%        const double radius,const double sigma,const double bias)
10276%
10277%  A description of each parameter follows:
10278%
10279%    o wand: the magick wand.
10280%
10281%    o radius: the radius of the Gaussian, in pixels, not counting the center
10282%      pixel.
10283%
10284%    o sigma: the standard deviation of the Gaussian, in pixels.
10285%
10286%    o bias: the bias.
10287%
10288*/
10289WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10290  const double radius,const double sigma,const double bias)
10291{
10292  Image
10293    *sharp_image;
10294
10295  assert(wand != (MagickWand *) NULL);
10296  assert(wand->signature == WandSignature);
10297  if (wand->debug != MagickFalse)
10298    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10299  if (wand->images == (Image *) NULL)
10300    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10301  sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10302  if (sharp_image == (Image *) NULL)
10303    return(MagickFalse);
10304  ReplaceImageInList(&wand->images,sharp_image);
10305  return(MagickTrue);
10306}
10307
10308/*
10309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10310%                                                                             %
10311%                                                                             %
10312%                                                                             %
10313%   M a g i c k S h a v e I m a g e                                           %
10314%                                                                             %
10315%                                                                             %
10316%                                                                             %
10317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10318%
10319%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10320%  memory necessary for the new Image structure and returns a pointer to the
10321%  new image.
10322%
10323%  The format of the MagickShaveImage method is:
10324%
10325%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10326%        const size_t columns,const size_t rows)
10327%
10328%  A description of each parameter follows:
10329%
10330%    o wand: the magick wand.
10331%
10332%    o columns: the number of columns in the scaled image.
10333%
10334%    o rows: the number of rows in the scaled image.
10335%
10336%
10337*/
10338WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10339  const size_t columns,const size_t rows)
10340{
10341  Image
10342    *shave_image;
10343
10344  RectangleInfo
10345    shave_info;
10346
10347  assert(wand != (MagickWand *) NULL);
10348  assert(wand->signature == WandSignature);
10349  if (wand->debug != MagickFalse)
10350    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10351  if (wand->images == (Image *) NULL)
10352    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10353  shave_info.width=columns;
10354  shave_info.height=rows;
10355  shave_info.x=0;
10356  shave_info.y=0;
10357  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10358  if (shave_image == (Image *) NULL)
10359    return(MagickFalse);
10360  ReplaceImageInList(&wand->images,shave_image);
10361  return(MagickTrue);
10362}
10363
10364/*
10365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10366%                                                                             %
10367%                                                                             %
10368%                                                                             %
10369%   M a g i c k S h e a r I m a g e                                           %
10370%                                                                             %
10371%                                                                             %
10372%                                                                             %
10373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10374%
10375%  MagickShearImage() slides one edge of an image along the X or Y axis,
10376%  creating a parallelogram.  An X direction shear slides an edge along the X
10377%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10378%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10379%  is measured relative to the Y axis, and similarly, for Y direction shears
10380%  y_shear is measured relative to the X axis.  Empty triangles left over from
10381%  shearing the image are filled with the background color.
10382%
10383%  The format of the MagickShearImage method is:
10384%
10385%      MagickBooleanType MagickShearImage(MagickWand *wand,
10386%        const PixelWand *background,const double x_shear,onst double y_shear)
10387%
10388%  A description of each parameter follows:
10389%
10390%    o wand: the magick wand.
10391%
10392%    o background: the background pixel wand.
10393%
10394%    o x_shear: the number of degrees to shear the image.
10395%
10396%    o y_shear: the number of degrees to shear the image.
10397%
10398*/
10399WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10400  const PixelWand *background,const double x_shear,const double y_shear)
10401{
10402  Image
10403    *shear_image;
10404
10405  assert(wand != (MagickWand *) NULL);
10406  assert(wand->signature == WandSignature);
10407  if (wand->debug != MagickFalse)
10408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10409  if (wand->images == (Image *) NULL)
10410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10411  PixelGetQuantumPacket(background,&wand->images->background_color);
10412  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10413  if (shear_image == (Image *) NULL)
10414    return(MagickFalse);
10415  ReplaceImageInList(&wand->images,shear_image);
10416  return(MagickTrue);
10417}
10418
10419/*
10420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10421%                                                                             %
10422%                                                                             %
10423%                                                                             %
10424%   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                   %
10425%                                                                             %
10426%                                                                             %
10427%                                                                             %
10428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10429%
10430%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10431%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10432%  image using a sigmoidal transfer function without saturating highlights or
10433%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10434%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10435%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10436%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10437%  is reduced.
10438%
10439%  The format of the MagickSigmoidalContrastImage method is:
10440%
10441%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10442%        const MagickBooleanType sharpen,const double alpha,const double beta)
10443%
10444%  A description of each parameter follows:
10445%
10446%    o wand: the magick wand.
10447%
10448%    o sharpen: Increase or decrease image contrast.
10449%
10450%    o alpha: strength of the contrast, the larger the number the more
10451%      'threshold-like' it becomes.
10452%
10453%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10454%
10455*/
10456WandExport MagickBooleanType MagickSigmoidalContrastImage(
10457  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10458  const double beta)
10459{
10460  MagickBooleanType
10461    status;
10462
10463  assert(wand != (MagickWand *) NULL);
10464  assert(wand->signature == WandSignature);
10465  if (wand->debug != MagickFalse)
10466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10467  if (wand->images == (Image *) NULL)
10468    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10469  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10470    wand->exception);
10471  return(status);
10472}
10473
10474/*
10475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10476%                                                                             %
10477%                                                                             %
10478%                                                                             %
10479%   M a g i c k S i m i l a r i t y I m a g e                                 %
10480%                                                                             %
10481%                                                                             %
10482%                                                                             %
10483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10484%
10485%  MagickSimilarityImage() compares the reference image of the image and
10486%  returns the best match offset.  In addition, it returns a similarity image
10487%  such that an exact match location is completely white and if none of the
10488%  pixels match, black, otherwise some gray level in-between.
10489%
10490%  The format of the MagickSimilarityImage method is:
10491%
10492%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10493%        const MagickWand *reference,const MetricType metric,
10494%        RectangeInfo *offset,double *similarity)
10495%
10496%  A description of each parameter follows:
10497%
10498%    o wand: the magick wand.
10499%
10500%    o reference: the reference wand.
10501%
10502%    o metric: the metric.
10503%
10504%    o offset: the best match offset of the reference image within the image.
10505%
10506%    o similarity: the computed similarity between the images.
10507%
10508*/
10509WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10510  const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10511  double *similarity)
10512{
10513  Image
10514    *similarity_image;
10515
10516  assert(wand != (MagickWand *) NULL);
10517  assert(wand->signature == WandSignature);
10518  if (wand->debug != MagickFalse)
10519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10520  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10521    {
10522      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10523        "ContainsNoImages","`%s'",wand->name);
10524      return((MagickWand *) NULL);
10525    }
10526  similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10527    similarity,wand->exception);
10528  if (similarity_image == (Image *) NULL)
10529    return((MagickWand *) NULL);
10530  return(CloneMagickWandFromImages(wand,similarity_image));
10531}
10532
10533/*
10534%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10535%                                                                             %
10536%                                                                             %
10537%                                                                             %
10538%   M a g i c k S k e t c h I m a g e                                         %
10539%                                                                             %
10540%                                                                             %
10541%                                                                             %
10542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10543%
10544%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10545%  a Gaussian operator of the given radius and standard deviation (sigma).
10546%  For reasonable results, radius should be larger than sigma.  Use a
10547%  radius of 0 and SketchImage() selects a suitable radius for you.
10548%  Angle gives the angle of the blurring motion.
10549%
10550%  The format of the MagickSketchImage method is:
10551%
10552%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10553%        const double radius,const double sigma,const double angle,
10554%        const double bias)
10555%
10556%  A description of each parameter follows:
10557%
10558%    o wand: the magick wand.
10559%
10560%    o radius: the radius of the Gaussian, in pixels, not counting
10561%      the center pixel.
10562%
10563%    o sigma: the standard deviation of the Gaussian, in pixels.
10564%
10565%    o angle: apply the effect along this angle.
10566%
10567%    o bias: the bias.
10568%
10569*/
10570WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10571  const double radius,const double sigma,const double angle,const double bias)
10572{
10573  Image
10574    *sketch_image;
10575
10576  assert(wand != (MagickWand *) NULL);
10577  assert(wand->signature == WandSignature);
10578  if (wand->debug != MagickFalse)
10579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10580  if (wand->images == (Image *) NULL)
10581    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10582  sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10583    wand->exception);
10584  if (sketch_image == (Image *) NULL)
10585    return(MagickFalse);
10586  ReplaceImageInList(&wand->images,sketch_image);
10587  return(MagickTrue);
10588}
10589
10590/*
10591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10592%                                                                             %
10593%                                                                             %
10594%                                                                             %
10595%   M a g i c k S m u s h I m a g e s                                         %
10596%                                                                             %
10597%                                                                             %
10598%                                                                             %
10599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10600%
10601%  MagickSmushImages() takes all images from the current image pointer to the
10602%  end of the image list and smushs them to each other top-to-bottom if the
10603%  stack parameter is true, otherwise left-to-right.
10604%
10605%  The format of the MagickSmushImages method is:
10606%
10607%      MagickWand *MagickSmushImages(MagickWand *wand,
10608%        const MagickBooleanType stack,const ssize_t offset)
10609%
10610%  A description of each parameter follows:
10611%
10612%    o wand: the magick wand.
10613%
10614%    o stack: By default, images are stacked left-to-right. Set stack to
10615%      MagickTrue to stack them top-to-bottom.
10616%
10617%    o offset: minimum distance in pixels between images.
10618%
10619*/
10620WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10621  const MagickBooleanType stack,const ssize_t offset)
10622{
10623  Image
10624    *smush_image;
10625
10626  assert(wand != (MagickWand *) NULL);
10627  assert(wand->signature == WandSignature);
10628  if (wand->debug != MagickFalse)
10629    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10630  if (wand->images == (Image *) NULL)
10631    return((MagickWand *) NULL);
10632  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10633  if (smush_image == (Image *) NULL)
10634    return((MagickWand *) NULL);
10635  return(CloneMagickWandFromImages(wand,smush_image));
10636}
10637
10638/*
10639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10640%                                                                             %
10641%                                                                             %
10642%                                                                             %
10643%     M a g i c k S o l a r i z e I m a g e                                   %
10644%                                                                             %
10645%                                                                             %
10646%                                                                             %
10647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10648%
10649%  MagickSolarizeImage() applies a special effect to the image, similar to the
10650%  effect achieved in a photo darkroom by selectively exposing areas of photo
10651%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10652%  measure of the extent of the solarization.
10653%
10654%  The format of the MagickSolarizeImage method is:
10655%
10656%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10657%        const double threshold)
10658%
10659%  A description of each parameter follows:
10660%
10661%    o wand: the magick wand.
10662%
10663%    o threshold:  Define the extent of the solarization.
10664%
10665*/
10666WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10667  const double threshold)
10668{
10669  MagickBooleanType
10670    status;
10671
10672  assert(wand != (MagickWand *) NULL);
10673  assert(wand->signature == WandSignature);
10674  if (wand->debug != MagickFalse)
10675    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10676  if (wand->images == (Image *) NULL)
10677    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10678  status=SolarizeImage(wand->images,threshold,wand->exception);
10679  return(status);
10680}
10681
10682/*
10683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10684%                                                                             %
10685%                                                                             %
10686%                                                                             %
10687%   M a g i c k S p a r s e C o l o r I m a g e                               %
10688%                                                                             %
10689%                                                                             %
10690%                                                                             %
10691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10692%
10693%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10694%  colors found at those coordinates, across the whole image, using various
10695%  methods.
10696%
10697%  The format of the MagickSparseColorImage method is:
10698%
10699%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10700%        const SparseColorMethod method,const size_t number_arguments,
10701%        const double *arguments)
10702%
10703%  A description of each parameter follows:
10704%
10705%    o image: the image to be sparseed.
10706%
10707%    o method: the method of image sparseion.
10708%
10709%        ArcSparseColorion will always ignore source image offset, and always
10710%        'bestfit' the destination image with the top left corner offset
10711%        relative to the polar mapping center.
10712%
10713%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10714%        style of image sparseion.
10715%
10716%        Affine, Perspective, and Bilinear, will do least squares fitting of
10717%        the distrotion when more than the minimum number of control point
10718%        pairs are provided.
10719%
10720%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10721%        less than 4 control point pairs are provided. While Affine sparseions
10722%        will let you use any number of control point pairs, that is Zero pairs
10723%        is a No-Op (viewport only) distrotion, one pair is a translation and
10724%        two pairs of control points will do a scale-rotate-translate, without
10725%        any shearing.
10726%
10727%    o number_arguments: the number of arguments given for this sparseion
10728%      method.
10729%
10730%    o arguments: the arguments for this sparseion method.
10731%
10732*/
10733WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10734  const SparseColorMethod method,const size_t number_arguments,
10735  const double *arguments)
10736{
10737  Image
10738    *sparse_image;
10739
10740  assert(wand != (MagickWand *) NULL);
10741  assert(wand->signature == WandSignature);
10742  if (wand->debug != MagickFalse)
10743    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10744  if (wand->images == (Image *) NULL)
10745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10746  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10747    wand->exception);
10748  if (sparse_image == (Image *) NULL)
10749    return(MagickFalse);
10750  ReplaceImageInList(&wand->images,sparse_image);
10751  return(MagickTrue);
10752}
10753
10754/*
10755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10756%                                                                             %
10757%                                                                             %
10758%                                                                             %
10759%   M a g i c k S p l i c e I m a g e                                         %
10760%                                                                             %
10761%                                                                             %
10762%                                                                             %
10763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10764%
10765%  MagickSpliceImage() splices a solid color into the image.
10766%
10767%  The format of the MagickSpliceImage method is:
10768%
10769%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10770%        const size_t width,const size_t height,const ssize_t x,
10771%        const ssize_t y)
10772%
10773%  A description of each parameter follows:
10774%
10775%    o wand: the magick wand.
10776%
10777%    o width: the region width.
10778%
10779%    o height: the region height.
10780%
10781%    o x: the region x offset.
10782%
10783%    o y: the region y offset.
10784%
10785*/
10786WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10787  const size_t width,const size_t height,const ssize_t x,
10788  const ssize_t y)
10789{
10790  Image
10791    *splice_image;
10792
10793  RectangleInfo
10794    splice;
10795
10796  assert(wand != (MagickWand *) NULL);
10797  assert(wand->signature == WandSignature);
10798  if (wand->debug != MagickFalse)
10799    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10800  if (wand->images == (Image *) NULL)
10801    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10802  splice.width=width;
10803  splice.height=height;
10804  splice.x=x;
10805  splice.y=y;
10806  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10807  if (splice_image == (Image *) NULL)
10808    return(MagickFalse);
10809  ReplaceImageInList(&wand->images,splice_image);
10810  return(MagickTrue);
10811}
10812
10813/*
10814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10815%                                                                             %
10816%                                                                             %
10817%                                                                             %
10818%   M a g i c k S p r e a d I m a g e                                         %
10819%                                                                             %
10820%                                                                             %
10821%                                                                             %
10822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10823%
10824%  MagickSpreadImage() is a special effects method that randomly displaces each
10825%  pixel in a block defined by the radius parameter.
10826%
10827%  The format of the MagickSpreadImage method is:
10828%
10829%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10830%        const PixelInterpolateMethod method)
10831%
10832%  A description of each parameter follows:
10833%
10834%    o wand: the magick wand.
10835%
10836%    o radius:  Choose a random pixel in a neighborhood of this extent.
10837%
10838%    o method: the pixel interpolation method.
10839%
10840*/
10841WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10842  const double radius,const PixelInterpolateMethod method)
10843{
10844  Image
10845    *spread_image;
10846
10847  assert(wand != (MagickWand *) NULL);
10848  assert(wand->signature == WandSignature);
10849  if (wand->debug != MagickFalse)
10850    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10851  if (wand->images == (Image *) NULL)
10852    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10853  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10854  if (spread_image == (Image *) NULL)
10855    return(MagickFalse);
10856  ReplaceImageInList(&wand->images,spread_image);
10857  return(MagickTrue);
10858}
10859
10860/*
10861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10862%                                                                             %
10863%                                                                             %
10864%                                                                             %
10865%   M a g i c k S t a t i s t i c I m a g e                                   %
10866%                                                                             %
10867%                                                                             %
10868%                                                                             %
10869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10870%
10871%  MagickStatisticImage() replace each pixel with corresponding statistic from
10872%  the neighborhood of the specified width and height.
10873%
10874%  The format of the MagickStatisticImage method is:
10875%
10876%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10877%        const StatisticType type,const double width,const size_t height)
10878%
10879%  A description of each parameter follows:
10880%
10881%    o wand: the magick wand.
10882%
10883%    o type: the statistic type (e.g. median, mode, etc.).
10884%
10885%    o width: the width of the pixel neighborhood.
10886%
10887%    o height: the height of the pixel neighborhood.
10888%
10889*/
10890WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10891  const StatisticType type,const size_t width,const size_t height)
10892{
10893  Image
10894    *statistic_image;
10895
10896  assert(wand != (MagickWand *) NULL);
10897  assert(wand->signature == WandSignature);
10898  if (wand->debug != MagickFalse)
10899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10900  if (wand->images == (Image *) NULL)
10901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10902  statistic_image=StatisticImage(wand->images,type,width,height,
10903    wand->exception);
10904  if (statistic_image == (Image *) NULL)
10905    return(MagickFalse);
10906  ReplaceImageInList(&wand->images,statistic_image);
10907  return(MagickTrue);
10908}
10909
10910/*
10911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10912%                                                                             %
10913%                                                                             %
10914%                                                                             %
10915%   M a g i c k S t e g a n o I m a g e                                       %
10916%                                                                             %
10917%                                                                             %
10918%                                                                             %
10919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10920%
10921%  MagickSteganoImage() hides a digital watermark within the image.
10922%  Recover the hidden watermark later to prove that the authenticity of
10923%  an image.  Offset defines the start position within the image to hide
10924%  the watermark.
10925%
10926%  The format of the MagickSteganoImage method is:
10927%
10928%      MagickWand *MagickSteganoImage(MagickWand *wand,
10929%        const MagickWand *watermark_wand,const ssize_t offset)
10930%
10931%  A description of each parameter follows:
10932%
10933%    o wand: the magick wand.
10934%
10935%    o watermark_wand: the watermark wand.
10936%
10937%    o offset: Start hiding at this offset into the image.
10938%
10939*/
10940WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10941  const MagickWand *watermark_wand,const ssize_t offset)
10942{
10943  Image
10944    *stegano_image;
10945
10946  assert(wand != (MagickWand *) NULL);
10947  assert(wand->signature == WandSignature);
10948  if (wand->debug != MagickFalse)
10949    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10950  if ((wand->images == (Image *) NULL) ||
10951      (watermark_wand->images == (Image *) NULL))
10952    {
10953      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10954        "ContainsNoImages","`%s'",wand->name);
10955      return((MagickWand *) NULL);
10956    }
10957  wand->images->offset=offset;
10958  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10959    wand->exception);
10960  if (stegano_image == (Image *) NULL)
10961    return((MagickWand *) NULL);
10962  return(CloneMagickWandFromImages(wand,stegano_image));
10963}
10964
10965/*
10966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10967%                                                                             %
10968%                                                                             %
10969%                                                                             %
10970%   M a g i c k S t e r e o I m a g e                                         %
10971%                                                                             %
10972%                                                                             %
10973%                                                                             %
10974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10975%
10976%  MagickStereoImage() composites two images and produces a single image that
10977%  is the composite of a left and right image of a stereo pair
10978%
10979%  The format of the MagickStereoImage method is:
10980%
10981%      MagickWand *MagickStereoImage(MagickWand *wand,
10982%        const MagickWand *offset_wand)
10983%
10984%  A description of each parameter follows:
10985%
10986%    o wand: the magick wand.
10987%
10988%    o offset_wand: Another image wand.
10989%
10990*/
10991WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10992  const MagickWand *offset_wand)
10993{
10994  Image
10995    *stereo_image;
10996
10997  assert(wand != (MagickWand *) NULL);
10998  assert(wand->signature == WandSignature);
10999  if (wand->debug != MagickFalse)
11000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11001  if ((wand->images == (Image *) NULL) ||
11002      (offset_wand->images == (Image *) NULL))
11003    {
11004      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11005        "ContainsNoImages","`%s'",wand->name);
11006      return((MagickWand *) NULL);
11007    }
11008  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11009  if (stereo_image == (Image *) NULL)
11010    return((MagickWand *) NULL);
11011  return(CloneMagickWandFromImages(wand,stereo_image));
11012}
11013
11014/*
11015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11016%                                                                             %
11017%                                                                             %
11018%                                                                             %
11019%   M a g i c k S t r i p I m a g e                                           %
11020%                                                                             %
11021%                                                                             %
11022%                                                                             %
11023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11024%
11025%  MagickStripImage() strips an image of all profiles and comments.
11026%
11027%  The format of the MagickStripImage method is:
11028%
11029%      MagickBooleanType MagickStripImage(MagickWand *wand)
11030%
11031%  A description of each parameter follows:
11032%
11033%    o wand: the magick wand.
11034%
11035*/
11036WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11037{
11038  assert(wand != (MagickWand *) NULL);
11039  assert(wand->signature == WandSignature);
11040  if (wand->debug != MagickFalse)
11041    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11042  if (wand->images == (Image *) NULL)
11043    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11044  return(StripImage(wand->images,wand->exception));
11045}
11046
11047/*
11048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11049%                                                                             %
11050%                                                                             %
11051%                                                                             %
11052%   M a g i c k S w i r l I m a g e                                           %
11053%                                                                             %
11054%                                                                             %
11055%                                                                             %
11056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11057%
11058%  MagickSwirlImage() swirls the pixels about the center of the image, where
11059%  degrees indicates the sweep of the arc through which each pixel is moved.
11060%  You get a more dramatic effect as the degrees move from 1 to 360.
11061%
11062%  The format of the MagickSwirlImage method is:
11063%
11064%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11065%        const PixelInterpolateMethod method)
11066%
11067%  A description of each parameter follows:
11068%
11069%    o wand: the magick wand.
11070%
11071%    o degrees: Define the tightness of the swirling effect.
11072%
11073%    o method: the pixel interpolation method.
11074%
11075*/
11076WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11077  const double degrees,const PixelInterpolateMethod method)
11078{
11079  Image
11080    *swirl_image;
11081
11082  assert(wand != (MagickWand *) NULL);
11083  assert(wand->signature == WandSignature);
11084  if (wand->debug != MagickFalse)
11085    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11086  if (wand->images == (Image *) NULL)
11087    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11088  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11089  if (swirl_image == (Image *) NULL)
11090    return(MagickFalse);
11091  ReplaceImageInList(&wand->images,swirl_image);
11092  return(MagickTrue);
11093}
11094
11095/*
11096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11097%                                                                             %
11098%                                                                             %
11099%                                                                             %
11100%   M a g i c k T e x t u r e I m a g e                                       %
11101%                                                                             %
11102%                                                                             %
11103%                                                                             %
11104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11105%
11106%  MagickTextureImage() repeatedly tiles the texture image across and down the
11107%  image canvas.
11108%
11109%  The format of the MagickTextureImage method is:
11110%
11111%      MagickWand *MagickTextureImage(MagickWand *wand,
11112%        const MagickWand *texture_wand)
11113%
11114%  A description of each parameter follows:
11115%
11116%    o wand: the magick wand.
11117%
11118%    o texture_wand: the texture wand
11119%
11120*/
11121WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11122  const MagickWand *texture_wand)
11123{
11124  Image
11125    *texture_image;
11126
11127  MagickBooleanType
11128    status;
11129
11130  assert(wand != (MagickWand *) NULL);
11131  assert(wand->signature == WandSignature);
11132  if (wand->debug != MagickFalse)
11133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11134  if ((wand->images == (Image *) NULL) ||
11135      (texture_wand->images == (Image *) NULL))
11136    {
11137      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11138        "ContainsNoImages","`%s'",wand->name);
11139      return((MagickWand *) NULL);
11140    }
11141  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11142  if (texture_image == (Image *) NULL)
11143    return((MagickWand *) NULL);
11144  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11145  if (status == MagickFalse)
11146    {
11147      texture_image=DestroyImage(texture_image);
11148      return((MagickWand *) NULL);
11149    }
11150  return(CloneMagickWandFromImages(wand,texture_image));
11151}
11152
11153/*
11154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11155%                                                                             %
11156%                                                                             %
11157%                                                                             %
11158%   M a g i c k T h r e s h o l d I m a g e                                   %
11159%                                                                             %
11160%                                                                             %
11161%                                                                             %
11162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11163%
11164%  MagickThresholdImage() changes the value of individual pixels based on
11165%  the intensity of each pixel compared to threshold.  The result is a
11166%  high-contrast, two color image.
11167%
11168%  The format of the MagickThresholdImage method is:
11169%
11170%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11171%        const double threshold)
11172%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11173%        const ChannelType channel,const double threshold)
11174%
11175%  A description of each parameter follows:
11176%
11177%    o wand: the magick wand.
11178%
11179%    o channel: the image channel(s).
11180%
11181%    o threshold: Define the threshold value.
11182%
11183*/
11184WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11185  const double threshold)
11186{
11187  MagickBooleanType
11188    status;
11189
11190  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11191  return(status);
11192}
11193
11194WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11195  const ChannelType channel,const double threshold)
11196{
11197  MagickBooleanType
11198    status;
11199
11200  assert(wand != (MagickWand *) NULL);
11201  assert(wand->signature == WandSignature);
11202  if (wand->debug != MagickFalse)
11203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11204  if (wand->images == (Image *) NULL)
11205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11206  status=BilevelImage(wand->images,threshold,wand->exception);
11207  return(status);
11208}
11209
11210/*
11211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11212%                                                                             %
11213%                                                                             %
11214%                                                                             %
11215%   M a g i c k T h u m b n a i l I m a g e                                   %
11216%                                                                             %
11217%                                                                             %
11218%                                                                             %
11219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11220%
11221%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11222%  and removes any associated profiles.  The goal is to produce small low cost
11223%  thumbnail images suited for display on the Web.
11224%
11225%  The format of the MagickThumbnailImage method is:
11226%
11227%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11228%        const size_t columns,const size_t rows)
11229%
11230%  A description of each parameter follows:
11231%
11232%    o wand: the magick wand.
11233%
11234%    o columns: the number of columns in the scaled image.
11235%
11236%    o rows: the number of rows in the scaled image.
11237%
11238*/
11239WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11240  const size_t columns,const size_t rows)
11241{
11242  Image
11243    *thumbnail_image;
11244
11245  assert(wand != (MagickWand *) NULL);
11246  assert(wand->signature == WandSignature);
11247  if (wand->debug != MagickFalse)
11248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11249  if (wand->images == (Image *) NULL)
11250    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11251  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11252  if (thumbnail_image == (Image *) NULL)
11253    return(MagickFalse);
11254  ReplaceImageInList(&wand->images,thumbnail_image);
11255  return(MagickTrue);
11256}
11257
11258/*
11259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11260%                                                                             %
11261%                                                                             %
11262%                                                                             %
11263%   M a g i c k T i n t I m a g e                                             %
11264%                                                                             %
11265%                                                                             %
11266%                                                                             %
11267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11268%
11269%  MagickTintImage() applies a color vector to each pixel in the image.  The
11270%  length of the vector is 0 for black and white and at its maximum for the
11271%  midtones.  The vector weighting function is
11272%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11273%
11274%  The format of the MagickTintImage method is:
11275%
11276%      MagickBooleanType MagickTintImage(MagickWand *wand,
11277%        const PixelWand *tint,const PixelWand *blend)
11278%
11279%  A description of each parameter follows:
11280%
11281%    o wand: the magick wand.
11282%
11283%    o tint: the tint pixel wand.
11284%
11285%    o alpha: the alpha pixel wand.
11286%
11287*/
11288WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11289  const PixelWand *tint,const PixelWand *blend)
11290{
11291  char
11292    percent_blend[MaxTextExtent];
11293
11294  Image
11295    *tint_image;
11296
11297  PixelInfo
11298    target;
11299
11300  assert(wand != (MagickWand *) NULL);
11301  assert(wand->signature == WandSignature);
11302  if (wand->debug != MagickFalse)
11303    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11304  if (wand->images == (Image *) NULL)
11305    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11306  if (wand->images->colorspace != CMYKColorspace)
11307    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11308      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11309      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11310      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11311      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11312      PixelGetAlphaQuantum(blend)));
11313  else
11314    (void) FormatLocaleString(percent_blend,MaxTextExtent,
11315      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11316      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11317      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11318      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11319      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11320      PixelGetAlphaQuantum(blend)));
11321  target=PixelGetPixel(tint);
11322  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11323  if (tint_image == (Image *) NULL)
11324    return(MagickFalse);
11325  ReplaceImageInList(&wand->images,tint_image);
11326  return(MagickTrue);
11327}
11328
11329/*
11330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11331%                                                                             %
11332%                                                                             %
11333%                                                                             %
11334%   M a g i c k T r a n s f o r m I m a g e                                   %
11335%                                                                             %
11336%                                                                             %
11337%                                                                             %
11338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11339%
11340%  MagickTransformImage() is a convenience method that behaves like
11341%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11342%  information as a region geometry specification.  If the operation fails,
11343%  a NULL image handle is returned.
11344%
11345%  The format of the MagickTransformImage method is:
11346%
11347%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11348%        const char *geometry)
11349%
11350%  A description of each parameter follows:
11351%
11352%    o wand: the magick wand.
11353%
11354%    o crop: A crop geometry string.  This geometry defines a subregion of the
11355%      image to crop.
11356%
11357%    o geometry: An image geometry string.  This geometry defines the final
11358%      size of the image.
11359%
11360*/
11361WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11362  const char *crop,const char *geometry)
11363{
11364  Image
11365    *transform_image;
11366
11367  MagickBooleanType
11368    status;
11369
11370  assert(wand != (MagickWand *) NULL);
11371  assert(wand->signature == WandSignature);
11372  if (wand->debug != MagickFalse)
11373    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11374  if (wand->images == (Image *) NULL)
11375    return((MagickWand *) NULL);
11376  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11377  if (transform_image == (Image *) NULL)
11378    return((MagickWand *) NULL);
11379  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11380  if (status == MagickFalse)
11381    {
11382      transform_image=DestroyImage(transform_image);
11383      return((MagickWand *) NULL);
11384    }
11385  return(CloneMagickWandFromImages(wand,transform_image));
11386}
11387
11388/*
11389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11390%                                                                             %
11391%                                                                             %
11392%                                                                             %
11393%   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               %
11394%                                                                             %
11395%                                                                             %
11396%                                                                             %
11397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11398%
11399%  MagickTransformImageColorspace() transform the image colorspace.
11400%
11401%  The format of the MagickTransformImageColorspace method is:
11402%
11403%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11404%        const ColorspaceType colorspace)
11405%
11406%  A description of each parameter follows:
11407%
11408%    o wand: the magick wand.
11409%
11410%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11411%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11412%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11413%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11414%      HSLColorspace, or HWBColorspace.
11415%
11416*/
11417WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11418  const ColorspaceType colorspace)
11419{
11420  assert(wand != (MagickWand *) NULL);
11421  assert(wand->signature == WandSignature);
11422  if (wand->debug != MagickFalse)
11423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11424  if (wand->images == (Image *) NULL)
11425    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11426  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11427}
11428
11429/*
11430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11431%                                                                             %
11432%                                                                             %
11433%                                                                             %
11434%   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                     %
11435%                                                                             %
11436%                                                                             %
11437%                                                                             %
11438%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11439%
11440%  MagickTransparentPaintImage() changes any pixel that matches color with the
11441%  color defined by fill.
11442%
11443%  The format of the MagickTransparentPaintImage method is:
11444%
11445%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11446%        const PixelWand *target,const double alpha,const double fuzz,
11447%        const MagickBooleanType invert)
11448%
11449%  A description of each parameter follows:
11450%
11451%    o wand: the magick wand.
11452%
11453%    o target: Change this target color to specified alpha value within
11454%      the image.
11455%
11456%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11457%      transparent.
11458%
11459%    o fuzz: By default target must match a particular pixel color
11460%      exactly.  However, in many cases two colors may differ by a small amount.
11461%      The fuzz member of image defines how much tolerance is acceptable to
11462%      consider two colors as the same.  For example, set fuzz to 10 and the
11463%      color red at intensities of 100 and 102 respectively are now interpreted
11464%      as the same color for the purposes of the floodfill.
11465%
11466%    o invert: paint any pixel that does not match the target color.
11467%
11468*/
11469WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11470  const PixelWand *target,const double alpha,const double fuzz,
11471  const MagickBooleanType invert)
11472{
11473  MagickBooleanType
11474    status;
11475
11476  PixelInfo
11477    target_pixel;
11478
11479  assert(wand != (MagickWand *) NULL);
11480  assert(wand->signature == WandSignature);
11481  if (wand->debug != MagickFalse)
11482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11483  if (wand->images == (Image *) NULL)
11484    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11485  PixelGetMagickColor(target,&target_pixel);
11486  wand->images->fuzz=fuzz;
11487  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11488    QuantumRange*alpha),invert,wand->exception);
11489  return(status);
11490}
11491
11492/*
11493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11494%                                                                             %
11495%                                                                             %
11496%                                                                             %
11497%   M a g i c k T r a n s p o s e I m a g e                                   %
11498%                                                                             %
11499%                                                                             %
11500%                                                                             %
11501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11502%
11503%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11504%  pixels around the central x-axis while rotating them 90-degrees.
11505%
11506%  The format of the MagickTransposeImage method is:
11507%
11508%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11509%
11510%  A description of each parameter follows:
11511%
11512%    o wand: the magick wand.
11513%
11514*/
11515WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11516{
11517  Image
11518    *transpose_image;
11519
11520  assert(wand != (MagickWand *) NULL);
11521  assert(wand->signature == WandSignature);
11522  if (wand->debug != MagickFalse)
11523    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11524  if (wand->images == (Image *) NULL)
11525    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11526  transpose_image=TransposeImage(wand->images,wand->exception);
11527  if (transpose_image == (Image *) NULL)
11528    return(MagickFalse);
11529  ReplaceImageInList(&wand->images,transpose_image);
11530  return(MagickTrue);
11531}
11532
11533/*
11534%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11535%                                                                             %
11536%                                                                             %
11537%                                                                             %
11538%   M a g i c k T r a n s v e r s e I m a g e                                 %
11539%                                                                             %
11540%                                                                             %
11541%                                                                             %
11542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11543%
11544%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11545%  pixels around the central y-axis while rotating them 270-degrees.
11546%
11547%  The format of the MagickTransverseImage method is:
11548%
11549%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11550%
11551%  A description of each parameter follows:
11552%
11553%    o wand: the magick wand.
11554%
11555*/
11556WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11557{
11558  Image
11559    *transverse_image;
11560
11561  assert(wand != (MagickWand *) NULL);
11562  assert(wand->signature == WandSignature);
11563  if (wand->debug != MagickFalse)
11564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11565  if (wand->images == (Image *) NULL)
11566    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11567  transverse_image=TransverseImage(wand->images,wand->exception);
11568  if (transverse_image == (Image *) NULL)
11569    return(MagickFalse);
11570  ReplaceImageInList(&wand->images,transverse_image);
11571  return(MagickTrue);
11572}
11573
11574/*
11575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11576%                                                                             %
11577%                                                                             %
11578%                                                                             %
11579%   M a g i c k T r i m I m a g e                                             %
11580%                                                                             %
11581%                                                                             %
11582%                                                                             %
11583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11584%
11585%  MagickTrimImage() remove edges that are the background color from the image.
11586%
11587%  The format of the MagickTrimImage method is:
11588%
11589%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11590%
11591%  A description of each parameter follows:
11592%
11593%    o wand: the magick wand.
11594%
11595%    o fuzz: By default target must match a particular pixel color
11596%      exactly.  However, in many cases two colors may differ by a small amount.
11597%      The fuzz member of image defines how much tolerance is acceptable to
11598%      consider two colors as the same.  For example, set fuzz to 10 and the
11599%      color red at intensities of 100 and 102 respectively are now interpreted
11600%      as the same color for the purposes of the floodfill.
11601%
11602*/
11603WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11604{
11605  Image
11606    *trim_image;
11607
11608  assert(wand != (MagickWand *) NULL);
11609  assert(wand->signature == WandSignature);
11610  if (wand->debug != MagickFalse)
11611    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11612  if (wand->images == (Image *) NULL)
11613    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11614  wand->images->fuzz=fuzz;
11615  trim_image=TrimImage(wand->images,wand->exception);
11616  if (trim_image == (Image *) NULL)
11617    return(MagickFalse);
11618  ReplaceImageInList(&wand->images,trim_image);
11619  return(MagickTrue);
11620}
11621
11622/*
11623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11624%                                                                             %
11625%                                                                             %
11626%                                                                             %
11627%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11628%                                                                             %
11629%                                                                             %
11630%                                                                             %
11631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11632%
11633%  MagickUniqueImageColors() discards all but one of any pixel color.
11634%
11635%  The format of the MagickUniqueImageColors method is:
11636%
11637%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11638%
11639%  A description of each parameter follows:
11640%
11641%    o wand: the magick wand.
11642%
11643*/
11644WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11645{
11646  Image
11647    *unique_image;
11648
11649  assert(wand != (MagickWand *) NULL);
11650  assert(wand->signature == WandSignature);
11651  if (wand->debug != MagickFalse)
11652    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11653  if (wand->images == (Image *) NULL)
11654    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11655  unique_image=UniqueImageColors(wand->images,wand->exception);
11656  if (unique_image == (Image *) NULL)
11657    return(MagickFalse);
11658  ReplaceImageInList(&wand->images,unique_image);
11659  return(MagickTrue);
11660}
11661
11662/*
11663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11664%                                                                             %
11665%                                                                             %
11666%                                                                             %
11667%   M a g i c k U n s h a r p M a s k I m a g e                               %
11668%                                                                             %
11669%                                                                             %
11670%                                                                             %
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672%
11673%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11674%  Gaussian operator of the given radius and standard deviation (sigma).
11675%  For reasonable results, radius should be larger than sigma.  Use a radius
11676%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11677%
11678%  The format of the MagickUnsharpMaskImage method is:
11679%
11680%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11681%        const double radius,const double sigma,const double amount,
11682%        const double threshold)
11683%
11684%  A description of each parameter follows:
11685%
11686%    o wand: the magick wand.
11687%
11688%    o radius: the radius of the Gaussian, in pixels, not counting the center
11689%      pixel.
11690%
11691%    o sigma: the standard deviation of the Gaussian, in pixels.
11692%
11693%    o amount: the percentage of the difference between the original and the
11694%      blur image that is added back into the original.
11695%
11696%    o threshold: the threshold in pixels needed to apply the diffence amount.
11697%
11698*/
11699WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11700  const double radius,const double sigma,const double amount,
11701  const double threshold)
11702{
11703  Image
11704    *unsharp_image;
11705
11706  assert(wand != (MagickWand *) NULL);
11707  assert(wand->signature == WandSignature);
11708  if (wand->debug != MagickFalse)
11709    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11710  if (wand->images == (Image *) NULL)
11711    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11712  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11713    wand->exception);
11714  if (unsharp_image == (Image *) NULL)
11715    return(MagickFalse);
11716  ReplaceImageInList(&wand->images,unsharp_image);
11717  return(MagickTrue);
11718}
11719
11720/*
11721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11722%                                                                             %
11723%                                                                             %
11724%                                                                             %
11725%   M a g i c k V i g n e t t e I m a g e                                     %
11726%                                                                             %
11727%                                                                             %
11728%                                                                             %
11729%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11730%
11731%  MagickVignetteImage() softens the edges of the image in vignette style.
11732%
11733%  The format of the MagickVignetteImage method is:
11734%
11735%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11736%        const double radius,const double sigma,const double bias,
11737%        const ssize_t x,const ssize_t y)
11738%
11739%  A description of each parameter follows:
11740%
11741%    o wand: the magick wand.
11742%
11743%    o radius: the radius.
11744%
11745%    o sigma: the sigma.
11746%
11747%    o bias: the bias.
11748%
11749%    o x, y:  Define the x and y ellipse offset.
11750%
11751*/
11752WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11753  const double radius,const double sigma,const double bias,const ssize_t x,
11754  const ssize_t y)
11755{
11756  Image
11757    *vignette_image;
11758
11759  assert(wand != (MagickWand *) NULL);
11760  assert(wand->signature == WandSignature);
11761  if (wand->debug != MagickFalse)
11762    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11763  if (wand->images == (Image *) NULL)
11764    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11765  vignette_image=VignetteImage(wand->images,radius,sigma,bias,x,y,
11766    wand->exception);
11767  if (vignette_image == (Image *) NULL)
11768    return(MagickFalse);
11769  ReplaceImageInList(&wand->images,vignette_image);
11770  return(MagickTrue);
11771}
11772
11773/*
11774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11775%                                                                             %
11776%                                                                             %
11777%                                                                             %
11778%   M a g i c k W a v e I m a g e                                             %
11779%                                                                             %
11780%                                                                             %
11781%                                                                             %
11782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11783%
11784%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11785%  the pixels vertically along a sine wave whose amplitude and wavelength
11786%  is specified by the given parameters.
11787%
11788%  The format of the MagickWaveImage method is:
11789%
11790%      MagickBooleanType MagickWaveImage(MagickWand *wand,
11791%        const double amplitude,const double wave_length,
11792%        const PixelInterpolateMethod method)
11793%
11794%  A description of each parameter follows:
11795%
11796%    o wand: the magick wand.
11797%
11798%    o amplitude, wave_length:  Define the amplitude and wave length of the
11799%      sine wave.
11800%
11801%    o method: the pixel interpolation method.
11802%
11803*/
11804WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11805  const double amplitude,const double wave_length,
11806  const PixelInterpolateMethod method)
11807{
11808  Image
11809    *wave_image;
11810
11811  assert(wand != (MagickWand *) NULL);
11812  assert(wand->signature == WandSignature);
11813  if (wand->debug != MagickFalse)
11814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11815  if (wand->images == (Image *) NULL)
11816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11817  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11818    wand->exception);
11819  if (wave_image == (Image *) NULL)
11820    return(MagickFalse);
11821  ReplaceImageInList(&wand->images,wave_image);
11822  return(MagickTrue);
11823}
11824
11825/*
11826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11827%                                                                             %
11828%                                                                             %
11829%                                                                             %
11830%   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                         %
11831%                                                                             %
11832%                                                                             %
11833%                                                                             %
11834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11835%
11836%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11837%  above the threshold into white while leaving all pixels below the threshold
11838%  unchanged.
11839%
11840%  The format of the MagickWhiteThresholdImage method is:
11841%
11842%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11843%        const PixelWand *threshold)
11844%
11845%  A description of each parameter follows:
11846%
11847%    o wand: the magick wand.
11848%
11849%    o threshold: the pixel wand.
11850%
11851*/
11852WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11853  const PixelWand *threshold)
11854{
11855  char
11856    thresholds[MaxTextExtent];
11857
11858  assert(wand != (MagickWand *) NULL);
11859  assert(wand->signature == WandSignature);
11860  if (wand->debug != MagickFalse)
11861    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11862  if (wand->images == (Image *) NULL)
11863    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11864  (void) FormatLocaleString(thresholds,MaxTextExtent,
11865    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11866    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11867    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11868  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
11869}
11870
11871/*
11872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11873%                                                                             %
11874%                                                                             %
11875%                                                                             %
11876%   M a g i c k W r i t e I m a g e                                           %
11877%                                                                             %
11878%                                                                             %
11879%                                                                             %
11880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11881%
11882%  MagickWriteImage() writes an image to the specified filename.  If the
11883%  filename parameter is NULL, the image is written to the filename set
11884%  by MagickReadImage() or MagickSetImageFilename().
11885%
11886%  The format of the MagickWriteImage method is:
11887%
11888%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11889%        const char *filename)
11890%
11891%  A description of each parameter follows:
11892%
11893%    o wand: the magick wand.
11894%
11895%    o filename: the image filename.
11896%
11897%
11898*/
11899WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11900  const char *filename)
11901{
11902  Image
11903    *image;
11904
11905  ImageInfo
11906    *write_info;
11907
11908  MagickBooleanType
11909    status;
11910
11911  assert(wand != (MagickWand *) NULL);
11912  assert(wand->signature == WandSignature);
11913  if (wand->debug != MagickFalse)
11914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11915  if (wand->images == (Image *) NULL)
11916    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11917  if (filename != (const char *) NULL)
11918    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11919  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11920  if (image == (Image *) NULL)
11921    return(MagickFalse);
11922  write_info=CloneImageInfo(wand->image_info);
11923  write_info->adjoin=MagickTrue;
11924  status=WriteImage(write_info,image,wand->exception);
11925  image=DestroyImage(image);
11926  write_info=DestroyImageInfo(write_info);
11927  return(status);
11928}
11929
11930/*
11931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11932%                                                                             %
11933%                                                                             %
11934%                                                                             %
11935%   M a g i c k W r i t e I m a g e F i l e                                   %
11936%                                                                             %
11937%                                                                             %
11938%                                                                             %
11939%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11940%
11941%  MagickWriteImageFile() writes an image to an open file descriptor.
11942%
11943%  The format of the MagickWriteImageFile method is:
11944%
11945%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11946%
11947%  A description of each parameter follows:
11948%
11949%    o wand: the magick wand.
11950%
11951%    o file: the file descriptor.
11952%
11953*/
11954WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11955{
11956  Image
11957    *image;
11958
11959  ImageInfo
11960    *write_info;
11961
11962  MagickBooleanType
11963    status;
11964
11965  assert(wand != (MagickWand *) NULL);
11966  assert(wand->signature == WandSignature);
11967  assert(file != (FILE *) NULL);
11968  if (wand->debug != MagickFalse)
11969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11970  if (wand->images == (Image *) NULL)
11971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11972  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11973  if (image == (Image *) NULL)
11974    return(MagickFalse);
11975  write_info=CloneImageInfo(wand->image_info);
11976  SetImageInfoFile(write_info,file);
11977  write_info->adjoin=MagickTrue;
11978  status=WriteImage(write_info,image,wand->exception);
11979  write_info=DestroyImageInfo(write_info);
11980  image=DestroyImage(image);
11981  return(status);
11982}
11983
11984/*
11985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11986%                                                                             %
11987%                                                                             %
11988%                                                                             %
11989%   M a g i c k W r i t e I m a g e s                                         %
11990%                                                                             %
11991%                                                                             %
11992%                                                                             %
11993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11994%
11995%  MagickWriteImages() writes an image or image sequence.
11996%
11997%  The format of the MagickWriteImages method is:
11998%
11999%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12000%        const char *filename,const MagickBooleanType adjoin)
12001%
12002%  A description of each parameter follows:
12003%
12004%    o wand: the magick wand.
12005%
12006%    o filename: the image filename.
12007%
12008%    o adjoin: join images into a single multi-image file.
12009%
12010*/
12011WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12012  const char *filename,const MagickBooleanType adjoin)
12013{
12014  ImageInfo
12015    *write_info;
12016
12017  MagickBooleanType
12018    status;
12019
12020  assert(wand != (MagickWand *) NULL);
12021  assert(wand->signature == WandSignature);
12022  if (wand->debug != MagickFalse)
12023    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12024  if (wand->images == (Image *) NULL)
12025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12026  write_info=CloneImageInfo(wand->image_info);
12027  write_info->adjoin=adjoin;
12028  status=WriteImages(write_info,wand->images,filename,wand->exception);
12029  write_info=DestroyImageInfo(write_info);
12030  return(status);
12031}
12032
12033/*
12034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12035%                                                                             %
12036%                                                                             %
12037%                                                                             %
12038%   M a g i c k W r i t e I m a g e s F i l e                                 %
12039%                                                                             %
12040%                                                                             %
12041%                                                                             %
12042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12043%
12044%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12045%
12046%  The format of the MagickWriteImagesFile method is:
12047%
12048%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12049%
12050%  A description of each parameter follows:
12051%
12052%    o wand: the magick wand.
12053%
12054%    o file: the file descriptor.
12055%
12056*/
12057WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12058{
12059  ImageInfo
12060    *write_info;
12061
12062  MagickBooleanType
12063    status;
12064
12065  assert(wand != (MagickWand *) NULL);
12066  assert(wand->signature == WandSignature);
12067  if (wand->debug != MagickFalse)
12068    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12069  if (wand->images == (Image *) NULL)
12070    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12071  write_info=CloneImageInfo(wand->image_info);
12072  SetImageInfoFile(write_info,file);
12073  write_info->adjoin=MagickTrue;
12074  status=WriteImages(write_info,wand->images,(const char *) NULL,
12075    wand->exception);
12076  write_info=DestroyImageInfo(write_info);
12077  return(status);
12078}
12079