magick-image.c revision 05c0c9ada50c0973e9449f1f1c3ea3717d248eb5
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7%                 MM MM  A   A  G        I    C      K  K                     %
8%                 M M M  AAAAA  G GGG    I    C      KKK                      %
9%                 M   M  A   A  G   G    I    C      K  K                     %
10%                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11%                                                                             %
12%                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13%                       I    MM MM  A   A  G      E                           %
14%                       I    M M M  AAAAA  G  GG  EEE                         %
15%                       I    M   M  A   A  G   G  E                           %
16%                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17%                                                                             %
18%                                                                             %
19%                          MagickWand Image Methods                           %
20%                                                                             %
21%                               Software Design                               %
22%                                 John Cristy                                 %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
27%  dedicated to making software imaging solutions freely available.           %
28%                                                                             %
29%  You may not use this file except in compliance with the License.  You may  %
30%  obtain a copy of the License at                                            %
31%                                                                             %
32%    http://www.imagemagick.org/script/license.php                            %
33%                                                                             %
34%  Unless required by applicable law or agreed to in writing, software        %
35%  distributed under the License is distributed on an "AS IS" BASIS,          %
36%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37%  See the License for the specific language governing permissions and        %
38%  limitations under the License.                                             %
39%                                                                             %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47  Include declarations.
48*/
49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
54
55/*
56  Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61    tag,"`%s'",context); \
62  return(MagickFalse); \
63}
64#define MagickWandId  "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68%                                                                             %
69%                                                                             %
70%                                                                             %
71+   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72%                                                                             %
73%                                                                             %
74%                                                                             %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78%  list.
79%
80%  The format of the CloneMagickWandFromImages method is:
81%
82%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83%        Image *images)
84%
85%  A description of each parameter follows:
86%
87%    o wand: the magick wand.
88%
89%    o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93  Image *images)
94{
95  MagickWand
96    *clone_wand;
97
98  assert(wand != (MagickWand *) NULL);
99  assert(wand->signature == WandSignature);
100  if (wand->debug != MagickFalse)
101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103  if (clone_wand == (MagickWand *) NULL)
104    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105      images->filename);
106  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107  clone_wand->id=AcquireWandId();
108  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109    MagickWandId,(double) clone_wand->id);
110  clone_wand->exception=AcquireExceptionInfo();
111  InheritException(clone_wand->exception,wand->exception);
112  clone_wand->image_info=CloneImageInfo(wand->image_info);
113  clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114  clone_wand->images=images;
115  clone_wand->debug=IsEventLogging();
116  if (clone_wand->debug != MagickFalse)
117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118  clone_wand->signature=WandSignature;
119  return(clone_wand);
120}
121
122/*
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124%                                                                             %
125%                                                                             %
126%                                                                             %
127%   G e t I m a g e F r o m M a g i c k W a n d                               %
128%                                                                             %
129%                                                                             %
130%                                                                             %
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132%
133%  GetImageFromMagickWand() returns the current image from the magick wand.
134%
135%  The format of the GetImageFromMagickWand method is:
136%
137%      Image *GetImageFromMagickWand(const MagickWand *wand)
138%
139%  A description of each parameter follows:
140%
141%    o wand: the magick wand.
142%
143*/
144WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145{
146  assert(wand != (MagickWand *) NULL);
147  assert(wand->signature == WandSignature);
148  if (wand->debug != MagickFalse)
149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150  if (wand->images == (Image *) NULL)
151    {
152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153        "ContainsNoImages","`%s'",wand->name);
154      return((Image *) NULL);
155    }
156  return(wand->images);
157}
158
159/*
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161%                                                                             %
162%                                                                             %
163%                                                                             %
164%   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165%                                                                             %
166%                                                                             %
167%                                                                             %
168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169%
170%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171%  less intensely near image edges and more intensely far from edges. We
172%  blur the image with a Gaussian operator of the given radius and standard
173%  deviation (sigma).  For reasonable results, radius should be larger than
174%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175%  suitable radius for you.
176%
177%  The format of the MagickAdaptiveBlurImage method is:
178%
179%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180%        const double radius,const double sigma,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%
230%  A description of each parameter follows:
231%
232%    o wand: the magick wand.
233%
234%    o columns: the number of columns in the scaled image.
235%
236%    o rows: the number of rows in the scaled image.
237%
238*/
239WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
240  const size_t columns,const size_t rows)
241{
242  Image
243    *resize_image;
244
245  assert(wand != (MagickWand *) NULL);
246  assert(wand->signature == WandSignature);
247  if (wand->debug != MagickFalse)
248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
249  if (wand->images == (Image *) NULL)
250    ThrowWandException(WandError,"ContainsNoImages",wand->name);
251  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
252  if (resize_image == (Image *) NULL)
253    return(MagickFalse);
254  ReplaceImageInList(&wand->images,resize_image);
255  return(MagickTrue);
256}
257
258/*
259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260%                                                                             %
261%                                                                             %
262%                                                                             %
263%   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                       %
264%                                                                             %
265%                                                                             %
266%                                                                             %
267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268%
269%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
270%  more intensely near image edges and less intensely far from edges. We
271%  sharpen the image with a Gaussian operator of the given radius and standard
272%  deviation (sigma).  For reasonable results, radius should be larger than
273%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
274%  suitable radius for you.
275%
276%  The format of the MagickAdaptiveSharpenImage method is:
277%
278%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
279%        const double radius,const double sigma,const double bias)
280%
281%  A description of each parameter follows:
282%
283%    o wand: the magick wand.
284%
285%    o radius: the radius of the Gaussian, in pixels, not counting the center
286%      pixel.
287%
288%    o sigma: the standard deviation of the Gaussian, in pixels.
289%
290%    o bias: the bias.
291%
292*/
293WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
294  const double radius,const double sigma,const double bias)
295{
296  Image
297    *sharp_image;
298
299  assert(wand != (MagickWand *) NULL);
300  assert(wand->signature == WandSignature);
301  if (wand->debug != MagickFalse)
302    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
303  if (wand->images == (Image *) NULL)
304    ThrowWandException(WandError,"ContainsNoImages",wand->name);
305  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
306    wand->exception);
307  if (sharp_image == (Image *) NULL)
308    return(MagickFalse);
309  ReplaceImageInList(&wand->images,sharp_image);
310  return(MagickTrue);
311}
312
313/*
314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315%                                                                             %
316%                                                                             %
317%                                                                             %
318%   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                   %
319%                                                                             %
320%                                                                             %
321%                                                                             %
322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323%
324%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
325%  based on the range of intensity values in its local neighborhood.  This
326%  allows for thresholding of an image whose global intensity histogram
327%  doesn't contain distinctive peaks.
328%
329%  The format of the AdaptiveThresholdImage method is:
330%
331%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
332%        const size_t width,const size_t height,const ssize_t offset)
333%
334%  A description of each parameter follows:
335%
336%    o wand: the magick wand.
337%
338%    o width: the width of the local neighborhood.
339%
340%    o height: the height of the local neighborhood.
341%
342%    o offset: the mean offset.
343%
344*/
345WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
346  const size_t width,const size_t height,const ssize_t offset)
347{
348  Image
349    *threshold_image;
350
351  assert(wand != (MagickWand *) NULL);
352  assert(wand->signature == WandSignature);
353  if (wand->debug != MagickFalse)
354    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
355  if (wand->images == (Image *) NULL)
356    ThrowWandException(WandError,"ContainsNoImages",wand->name);
357  threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
358    wand->exception);
359  if (threshold_image == (Image *) NULL)
360    return(MagickFalse);
361  ReplaceImageInList(&wand->images,threshold_image);
362  return(MagickTrue);
363}
364
365/*
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367%                                                                             %
368%                                                                             %
369%                                                                             %
370%   M a g i c k A d d I m a g e                                               %
371%                                                                             %
372%                                                                             %
373%                                                                             %
374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375%
376%  MagickAddImage() adds the specified images at the current image location.
377%
378%  The format of the MagickAddImage method is:
379%
380%      MagickBooleanType MagickAddImage(MagickWand *wand,
381%        const MagickWand *add_wand)
382%
383%  A description of each parameter follows:
384%
385%    o wand: the magick wand.
386%
387%    o add_wand: A wand that contains images to add at the current image
388%      location.
389%
390*/
391
392static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
393  Image *images)
394{
395  Image
396    *sentinel;
397
398  sentinel=wand->images;
399  if (sentinel == (Image *) NULL)
400    {
401      wand->images=GetFirstImageInList(images);
402      return(MagickTrue);
403    }
404  if (wand->active == MagickFalse)
405    {
406      if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
407        {
408          AppendImageToList(&sentinel,images);
409          wand->images=GetLastImageInList(images);
410          return(MagickTrue);
411        }
412      if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
413        {
414          PrependImageToList(&sentinel,images);
415          wand->images=GetFirstImageInList(images);
416          return(MagickTrue);
417        }
418    }
419  if (sentinel->next == (Image *) NULL)
420    {
421      InsertImageInList(&sentinel,images);
422      wand->images=GetLastImageInList(images);
423      return(MagickTrue);
424    }
425  InsertImageInList(&sentinel,images);
426  wand->images=GetFirstImageInList(images);
427  return(MagickTrue);
428}
429
430WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
431  const MagickWand *add_wand)
432{
433  Image
434    *images;
435
436  assert(wand != (MagickWand *) NULL);
437  assert(wand->signature == WandSignature);
438  if (wand->debug != MagickFalse)
439    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
440  assert(add_wand != (MagickWand *) NULL);
441  assert(add_wand->signature == WandSignature);
442  if (add_wand->images == (Image *) NULL)
443    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
444  images=CloneImageList(add_wand->images,wand->exception);
445  if (images == (Image *) NULL)
446    return(MagickFalse);
447  return(InsertImageInWand(wand,images));
448}
449
450/*
451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452%                                                                             %
453%                                                                             %
454%                                                                             %
455%     M a g i c k A d d N o i s e I m a g e                                   %
456%                                                                             %
457%                                                                             %
458%                                                                             %
459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460%
461%  MagickAddNoiseImage() adds random noise to the image.
462%
463%  The format of the MagickAddNoiseImage method is:
464%
465%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
466%        const NoiseType noise_type)
467%
468%  A description of each parameter follows:
469%
470%    o wand: the magick wand.
471%
472%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
473%      Impulse, Laplacian, or Poisson.
474%
475*/
476WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
477  const NoiseType noise_type)
478{
479  Image
480    *noise_image;
481
482  assert(wand != (MagickWand *) NULL);
483  assert(wand->signature == WandSignature);
484  if (wand->debug != MagickFalse)
485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
486  if (wand->images == (Image *) NULL)
487    ThrowWandException(WandError,"ContainsNoImages",wand->name);
488  noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
489  if (noise_image == (Image *) NULL)
490    return(MagickFalse);
491  ReplaceImageInList(&wand->images,noise_image);
492  return(MagickTrue);
493}
494
495/*
496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
497%                                                                             %
498%                                                                             %
499%                                                                             %
500%   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                       %
501%                                                                             %
502%                                                                             %
503%                                                                             %
504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505%
506%  MagickAffineTransformImage() transforms an image as dictated by the affine
507%  matrix of the drawing wand.
508%
509%  The format of the MagickAffineTransformImage method is:
510%
511%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
512%        const DrawingWand *drawing_wand)
513%
514%  A description of each parameter follows:
515%
516%    o wand: the magick wand.
517%
518%    o drawing_wand: the draw wand.
519%
520*/
521WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
522  const DrawingWand *drawing_wand)
523{
524  DrawInfo
525    *draw_info;
526
527  Image
528    *affine_image;
529
530  assert(wand != (MagickWand *) NULL);
531  assert(wand->signature == WandSignature);
532  if (wand->debug != MagickFalse)
533    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
534  if (wand->images == (Image *) NULL)
535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
536  draw_info=PeekDrawingWand(drawing_wand);
537  if (draw_info == (DrawInfo *) NULL)
538    return(MagickFalse);
539  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
540    wand->exception);
541  draw_info=DestroyDrawInfo(draw_info);
542  if (affine_image == (Image *) NULL)
543    return(MagickFalse);
544  ReplaceImageInList(&wand->images,affine_image);
545  return(MagickTrue);
546}
547
548/*
549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550%                                                                             %
551%                                                                             %
552%                                                                             %
553%   M a g i c k A n n o t a t e I m a g e                                     %
554%                                                                             %
555%                                                                             %
556%                                                                             %
557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558%
559%  MagickAnnotateImage() annotates an image with text.
560%
561%  The format of the MagickAnnotateImage method is:
562%
563%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
564%        const DrawingWand *drawing_wand,const double x,const double y,
565%        const double angle,const char *text)
566%
567%  A description of each parameter follows:
568%
569%    o wand: the magick wand.
570%
571%    o drawing_wand: the draw wand.
572%
573%    o x: x ordinate to left of text
574%
575%    o y: y ordinate to text baseline
576%
577%    o angle: rotate text relative to this angle.
578%
579%    o text: text to draw
580%
581*/
582WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
583  const DrawingWand *drawing_wand,const double x,const double y,
584  const double angle,const char *text)
585{
586  char
587    geometry[MaxTextExtent];
588
589  DrawInfo
590    *draw_info;
591
592  MagickBooleanType
593    status;
594
595  assert(wand != (MagickWand *) NULL);
596  assert(wand->signature == WandSignature);
597  if (wand->debug != MagickFalse)
598    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
599  if (wand->images == (Image *) NULL)
600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
601  draw_info=PeekDrawingWand(drawing_wand);
602  if (draw_info == (DrawInfo *) NULL)
603    return(MagickFalse);
604  (void) CloneString(&draw_info->text,text);
605  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
606  draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
607  draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
608  draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
609  draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
610  (void) CloneString(&draw_info->geometry,geometry);
611  status=AnnotateImage(wand->images,draw_info,&wand->images->exception);
612  draw_info=DestroyDrawInfo(draw_info);
613  return(status);
614}
615
616/*
617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
618%                                                                             %
619%                                                                             %
620%                                                                             %
621%   M a g i c k A n i m a t e I m a g e s                                     %
622%                                                                             %
623%                                                                             %
624%                                                                             %
625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
626%
627%  MagickAnimateImages() animates an image or image sequence.
628%
629%  The format of the MagickAnimateImages method is:
630%
631%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
632%        const char *server_name)
633%
634%  A description of each parameter follows:
635%
636%    o wand: the magick wand.
637%
638%    o server_name: the X server name.
639%
640*/
641WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
642  const char *server_name)
643{
644  MagickBooleanType
645    status;
646
647  assert(wand != (MagickWand *) NULL);
648  assert(wand->signature == WandSignature);
649  if (wand->debug != MagickFalse)
650    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
651  (void) CloneString(&wand->image_info->server_name,server_name);
652  status=AnimateImages(wand->image_info,wand->images,&wand->images->exception);
653  return(status);
654}
655
656/*
657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
658%                                                                             %
659%                                                                             %
660%                                                                             %
661%   M a g i c k A p p e n d I m a g e s                                       %
662%                                                                             %
663%                                                                             %
664%                                                                             %
665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
666%
667%  MagickAppendImages() append a set of images.
668%
669%  The format of the MagickAppendImages method is:
670%
671%      MagickWand *MagickAppendImages(MagickWand *wand,
672%        const MagickBooleanType stack)
673%
674%  A description of each parameter follows:
675%
676%    o wand: the magick wand.
677%
678%    o stack: By default, images are stacked left-to-right. Set stack to
679%      MagickTrue to stack them top-to-bottom.
680%
681*/
682WandExport MagickWand *MagickAppendImages(MagickWand *wand,
683  const MagickBooleanType stack)
684{
685  Image
686    *append_image;
687
688  assert(wand != (MagickWand *) NULL);
689  assert(wand->signature == WandSignature);
690  if (wand->debug != MagickFalse)
691    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
692  if (wand->images == (Image *) NULL)
693    return((MagickWand *) NULL);
694  append_image=AppendImages(wand->images,stack,wand->exception);
695  if (append_image == (Image *) NULL)
696    return((MagickWand *) NULL);
697  return(CloneMagickWandFromImages(wand,append_image));
698}
699
700/*
701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
702%                                                                             %
703%                                                                             %
704%                                                                             %
705%   M a g i c k A u t o G a m m a I m a g e                                   %
706%                                                                             %
707%                                                                             %
708%                                                                             %
709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
710%
711%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
712%  image to try make set its gamma appropriatally.
713%
714%  The format of the MagickAutoGammaImage method is:
715%
716%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
717%
718%  A description of each parameter follows:
719%
720%    o wand: the magick wand.
721%
722*/
723WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
724{
725  MagickBooleanType
726    status;
727
728  assert(wand != (MagickWand *) NULL);
729  assert(wand->signature == WandSignature);
730  if (wand->debug != MagickFalse)
731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
732  if (wand->images == (Image *) NULL)
733    ThrowWandException(WandError,"ContainsNoImages",wand->name);
734  status=AutoGammaImage(wand->images,&wand->images->exception);
735  return(status);
736}
737
738/*
739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
740%                                                                             %
741%                                                                             %
742%                                                                             %
743%   M a g i c k A u t o L e v e l I m a g e                                   %
744%                                                                             %
745%                                                                             %
746%                                                                             %
747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
748%
749%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
750%  scaling the minimum and maximum values to the full quantum range.
751%
752%  The format of the MagickAutoLevelImage method is:
753%
754%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
755%
756%  A description of each parameter follows:
757%
758%    o wand: the magick wand.
759%
760*/
761WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
762{
763  MagickBooleanType
764    status;
765
766  assert(wand != (MagickWand *) NULL);
767  assert(wand->signature == WandSignature);
768  if (wand->debug != MagickFalse)
769    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
770  if (wand->images == (Image *) NULL)
771    ThrowWandException(WandError,"ContainsNoImages",wand->name);
772  status=AutoLevelImage(wand->images,&wand->images->exception);
773  return(status);
774}
775
776/*
777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778%                                                                             %
779%                                                                             %
780%                                                                             %
781%   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                         %
782%                                                                             %
783%                                                                             %
784%                                                                             %
785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
786%
787%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
788%  pixels below the threshold into black while leaving all pixels above the
789%  threshold unchanged.
790%
791%  The format of the MagickBlackThresholdImage method is:
792%
793%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
794%        const PixelWand *threshold)
795%
796%  A description of each parameter follows:
797%
798%    o wand: the magick wand.
799%
800%    o threshold: the pixel wand.
801%
802*/
803WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
804  const PixelWand *threshold)
805{
806  char
807    thresholds[MaxTextExtent];
808
809  MagickBooleanType
810    status;
811
812  assert(wand != (MagickWand *) NULL);
813  assert(wand->signature == WandSignature);
814  if (wand->debug != MagickFalse)
815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
816  if (wand->images == (Image *) NULL)
817    ThrowWandException(WandError,"ContainsNoImages",wand->name);
818  (void) FormatLocaleString(thresholds,MaxTextExtent,
819    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
820    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
821    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
822  status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
823  if (status == MagickFalse)
824    InheritException(wand->exception,&wand->images->exception);
825  return(status);
826}
827
828/*
829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
830%                                                                             %
831%                                                                             %
832%                                                                             %
833%   M a g i c k B l u e S h i f t I m a g e                                   %
834%                                                                             %
835%                                                                             %
836%                                                                             %
837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838%
839%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
840%  nighttime in the moonlight.
841%
842%  The format of the MagickBlueShiftImage method is:
843%
844%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
845%        const double factor)
846%
847%  A description of each parameter follows:
848%
849%    o wand: the magick wand.
850%
851%    o factor: the blue shift factor (default 1.5)
852%
853*/
854WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
855  const double factor)
856{
857  Image
858    *shift_image;
859
860  assert(wand != (MagickWand *) NULL);
861  assert(wand->signature == WandSignature);
862  if (wand->debug != MagickFalse)
863    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
864  if (wand->images == (Image *) NULL)
865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
866  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
867  if (shift_image == (Image *) NULL)
868    return(MagickFalse);
869  ReplaceImageInList(&wand->images,shift_image);
870  return(MagickTrue);
871}
872
873/*
874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
875%                                                                             %
876%                                                                             %
877%                                                                             %
878%   M a g i c k B l u r I m a g e                                             %
879%                                                                             %
880%                                                                             %
881%                                                                             %
882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
883%
884%  MagickBlurImage() blurs an image.  We convolve the image with a
885%  gaussian operator of the given radius and standard deviation (sigma).
886%  For reasonable results, the radius should be larger than sigma.  Use a
887%  radius of 0 and BlurImage() selects a suitable radius for you.
888%
889%  The format of the MagickBlurImage method is:
890%
891%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
892%        const double sigmaconst double bias)
893%
894%  A description of each parameter follows:
895%
896%    o wand: the magick wand.
897%
898%    o radius: the radius of the , in pixels, not counting the center
899%      pixel.
900%
901%    o sigma: the standard deviation of the , in pixels.
902%
903%    o bias: the bias.
904%
905*/
906WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
907  const double radius,const double sigma,const double bias)
908{
909  Image
910    *blur_image;
911
912  assert(wand != (MagickWand *) NULL);
913  assert(wand->signature == WandSignature);
914  if (wand->debug != MagickFalse)
915    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
916  if (wand->images == (Image *) NULL)
917    ThrowWandException(WandError,"ContainsNoImages",wand->name);
918  blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
919  if (blur_image == (Image *) NULL)
920    return(MagickFalse);
921  ReplaceImageInList(&wand->images,blur_image);
922  return(MagickTrue);
923}
924
925/*
926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
927%                                                                             %
928%                                                                             %
929%                                                                             %
930%   M a g i c k B o r d e r I m a g e                                         %
931%                                                                             %
932%                                                                             %
933%                                                                             %
934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
935%
936%  MagickBorderImage() surrounds the image with a border of the color defined
937%  by the bordercolor pixel wand.
938%
939%  The format of the MagickBorderImage method is:
940%
941%      MagickBooleanType MagickBorderImage(MagickWand *wand,
942%        const PixelWand *bordercolor,const size_t width,
943%        const size_t height)
944%
945%  A description of each parameter follows:
946%
947%    o wand: the magick wand.
948%
949%    o bordercolor: the border color pixel wand.
950%
951%    o width: the border width.
952%
953%    o height: the border height.
954%
955*/
956WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
957  const PixelWand *bordercolor,const size_t width,
958  const size_t height)
959{
960  Image
961    *border_image;
962
963  RectangleInfo
964    border_info;
965
966  assert(wand != (MagickWand *) NULL);
967  assert(wand->signature == WandSignature);
968  if (wand->debug != MagickFalse)
969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
970  if (wand->images == (Image *) NULL)
971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
972  border_info.width=width;
973  border_info.height=height;
974  border_info.x=0;
975  border_info.y=0;
976  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
977  border_image=BorderImage(wand->images,&border_info,wand->exception);
978  if (border_image == (Image *) NULL)
979    return(MagickFalse);
980  ReplaceImageInList(&wand->images,border_image);
981  return(MagickTrue);
982}
983
984/*
985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
986%                                                                             %
987%                                                                             %
988%                                                                             %
989%   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   %
990%                                                                             %
991%                                                                             %
992%                                                                             %
993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
994%
995%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
996%  of an image.  It converts the brightness and contrast parameters into slope
997%  and intercept and calls a polynomical function to apply to the image.
998
999%
1000%  The format of the MagickBrightnessContrastImage method is:
1001%
1002%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1003%        const double brightness,const double contrast)
1004%
1005%  A description of each parameter follows:
1006%
1007%    o wand: the magick wand.
1008%
1009%    o brightness: the brightness percent (-100 .. 100).
1010%
1011%    o contrast: the contrast percent (-100 .. 100).
1012%
1013*/
1014WandExport MagickBooleanType MagickBrightnessContrastImage(
1015  MagickWand *wand,const double brightness,const double contrast)
1016{
1017  MagickBooleanType
1018    status;
1019
1020  assert(wand != (MagickWand *) NULL);
1021  assert(wand->signature == WandSignature);
1022  if (wand->debug != MagickFalse)
1023    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1024  if (wand->images == (Image *) NULL)
1025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1026  status=BrightnessContrastImage(wand->images,brightness,contrast,
1027    &wand->images->exception);
1028  return(status);
1029}
1030
1031/*
1032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1033%                                                                             %
1034%                                                                             %
1035%                                                                             %
1036%   M a g i c k C h a r c o a l I m a g e                                     %
1037%                                                                             %
1038%                                                                             %
1039%                                                                             %
1040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1041%
1042%  MagickCharcoalImage() simulates a charcoal drawing.
1043%
1044%  The format of the MagickCharcoalImage method is:
1045%
1046%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1047%        const double radius,const double sigma,const double bias)
1048%
1049%  A description of each parameter follows:
1050%
1051%    o wand: the magick wand.
1052%
1053%    o radius: the radius of the Gaussian, in pixels, not counting the center
1054%      pixel.
1055%
1056%    o sigma: the standard deviation of the Gaussian, in pixels.
1057%
1058%    o bias: the bias.
1059%
1060*/
1061WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1062  const double radius,const double sigma,const double bias)
1063{
1064  Image
1065    *charcoal_image;
1066
1067  assert(wand != (MagickWand *) NULL);
1068  assert(wand->signature == WandSignature);
1069  if (wand->debug != MagickFalse)
1070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1071  if (wand->images == (Image *) NULL)
1072    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1073  charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1074  if (charcoal_image == (Image *) NULL)
1075    return(MagickFalse);
1076  ReplaceImageInList(&wand->images,charcoal_image);
1077  return(MagickTrue);
1078}
1079
1080/*
1081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082%                                                                             %
1083%                                                                             %
1084%                                                                             %
1085%   M a g i c k C h o p I m a g e                                             %
1086%                                                                             %
1087%                                                                             %
1088%                                                                             %
1089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090%
1091%  MagickChopImage() removes a region of an image and collapses the image to
1092%  occupy the removed portion
1093%
1094%  The format of the MagickChopImage method is:
1095%
1096%      MagickBooleanType MagickChopImage(MagickWand *wand,
1097%        const size_t width,const size_t height,const ssize_t x,
1098%        const ssize_t y)
1099%
1100%  A description of each parameter follows:
1101%
1102%    o wand: the magick wand.
1103%
1104%    o width: the region width.
1105%
1106%    o height: the region height.
1107%
1108%    o x: the region x offset.
1109%
1110%    o y: the region y offset.
1111%
1112%
1113*/
1114WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1115  const size_t width,const size_t height,const ssize_t x,
1116  const ssize_t y)
1117{
1118  Image
1119    *chop_image;
1120
1121  RectangleInfo
1122    chop;
1123
1124  assert(wand != (MagickWand *) NULL);
1125  assert(wand->signature == WandSignature);
1126  if (wand->debug != MagickFalse)
1127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1128  if (wand->images == (Image *) NULL)
1129    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1130  chop.width=width;
1131  chop.height=height;
1132  chop.x=x;
1133  chop.y=y;
1134  chop_image=ChopImage(wand->images,&chop,wand->exception);
1135  if (chop_image == (Image *) NULL)
1136    return(MagickFalse);
1137  ReplaceImageInList(&wand->images,chop_image);
1138  return(MagickTrue);
1139}
1140
1141/*
1142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143%                                                                             %
1144%                                                                             %
1145%                                                                             %
1146%   M a g i c k C l a m p I m a g e                                           %
1147%                                                                             %
1148%                                                                             %
1149%                                                                             %
1150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1151%
1152%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1153%
1154%  The format of the MagickClampImage method is:
1155%
1156%      MagickBooleanType MagickClampImage(MagickWand *wand)
1157%
1158%  A description of each parameter follows:
1159%
1160%    o wand: the magick wand.
1161%
1162%    o channel: the channel.
1163%
1164*/
1165WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1166{
1167  MagickBooleanType
1168    status;
1169
1170  assert(wand != (MagickWand *) NULL);
1171  assert(wand->signature == WandSignature);
1172  if (wand->debug != MagickFalse)
1173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1174  if (wand->images == (Image *) NULL)
1175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1176  status=ClampImage(wand->images);
1177  if (status == MagickFalse)
1178    InheritException(wand->exception,&wand->images->exception);
1179  return(status);
1180}
1181
1182/*
1183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184%                                                                             %
1185%                                                                             %
1186%                                                                             %
1187%   M a g i c k C l i p I m a g e                                             %
1188%                                                                             %
1189%                                                                             %
1190%                                                                             %
1191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1192%
1193%  MagickClipImage() clips along the first path from the 8BIM profile, if
1194%  present.
1195%
1196%  The format of the MagickClipImage method is:
1197%
1198%      MagickBooleanType MagickClipImage(MagickWand *wand)
1199%
1200%  A description of each parameter follows:
1201%
1202%    o wand: the magick wand.
1203%
1204*/
1205WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1206{
1207  MagickBooleanType
1208    status;
1209
1210  assert(wand != (MagickWand *) NULL);
1211  assert(wand->signature == WandSignature);
1212  if (wand->debug != MagickFalse)
1213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1214  if (wand->images == (Image *) NULL)
1215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1216  status=ClipImage(wand->images,wand->exception);
1217  return(status);
1218}
1219
1220/*
1221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1222%                                                                             %
1223%                                                                             %
1224%                                                                             %
1225%   M a g i c k C l i p I m a g e P a t h                                     %
1226%                                                                             %
1227%                                                                             %
1228%                                                                             %
1229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1230%
1231%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1232%  present. Later operations take effect inside the path.  Id may be a number
1233%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1234%  path.
1235%
1236%  The format of the MagickClipImagePath method is:
1237%
1238%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1239%        const char *pathname,const MagickBooleanType inside)
1240%
1241%  A description of each parameter follows:
1242%
1243%    o wand: the magick wand.
1244%
1245%    o pathname: name of clipping path resource. If name is preceded by #, use
1246%      clipping path numbered by name.
1247%
1248%    o inside: if non-zero, later operations take effect inside clipping path.
1249%      Otherwise later operations take effect outside clipping path.
1250%
1251*/
1252WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1253  const char *pathname,const MagickBooleanType inside)
1254{
1255  MagickBooleanType
1256    status;
1257
1258  assert(wand != (MagickWand *) NULL);
1259  assert(wand->signature == WandSignature);
1260  if (wand->debug != MagickFalse)
1261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1262  if (wand->images == (Image *) NULL)
1263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1264  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1265  return(status);
1266}
1267
1268/*
1269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1270%                                                                             %
1271%                                                                             %
1272%                                                                             %
1273%   M a g i c k C l u t I m a g e                                             %
1274%                                                                             %
1275%                                                                             %
1276%                                                                             %
1277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1278%
1279%  MagickClutImage() replaces colors in the image from a color lookup table.
1280%
1281%  The format of the MagickClutImage method is:
1282%
1283%      MagickBooleanType MagickClutImage(MagickWand *wand,
1284%        const MagickWand *clut_wand)
1285%
1286%  A description of each parameter follows:
1287%
1288%    o wand: the magick wand.
1289%
1290%    o clut_image: the clut image.
1291%
1292*/
1293WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1294  const MagickWand *clut_wand)
1295{
1296  MagickBooleanType
1297    status;
1298
1299  assert(wand != (MagickWand *) NULL);
1300  assert(wand->signature == WandSignature);
1301  if (wand->debug != MagickFalse)
1302    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1303  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1304    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1305  status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
1306  return(status);
1307}
1308
1309/*
1310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1311%                                                                             %
1312%                                                                             %
1313%                                                                             %
1314%   M a g i c k C o a l e s c e I m a g e s                                   %
1315%                                                                             %
1316%                                                                             %
1317%                                                                             %
1318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1319%
1320%  MagickCoalesceImages() composites a set of images while respecting any page
1321%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1322%  typically start with an image background and each subsequent image
1323%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1324%  where each image in the sequence is the same size as the first and
1325%  composited with the next image in the sequence.
1326%
1327%  The format of the MagickCoalesceImages method is:
1328%
1329%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1330%
1331%  A description of each parameter follows:
1332%
1333%    o wand: the magick wand.
1334%
1335*/
1336WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1337{
1338  Image
1339    *coalesce_image;
1340
1341  assert(wand != (MagickWand *) NULL);
1342  assert(wand->signature == WandSignature);
1343  if (wand->debug != MagickFalse)
1344    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1345  if (wand->images == (Image *) NULL)
1346    return((MagickWand *) NULL);
1347  coalesce_image=CoalesceImages(wand->images,wand->exception);
1348  if (coalesce_image == (Image *) NULL)
1349    return((MagickWand *) NULL);
1350  return(CloneMagickWandFromImages(wand,coalesce_image));
1351}
1352
1353/*
1354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355%                                                                             %
1356%                                                                             %
1357%                                                                             %
1358%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1359%                                                                             %
1360%                                                                             %
1361%                                                                             %
1362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363%
1364%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1365%  Collection (CCC) file which solely contains one or more color corrections
1366%  and applies the color correction to the image.  Here is a sample CCC file:
1367%
1368%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1369%          <ColorCorrection id="cc03345">
1370%                <SOPNode>
1371%                     <Slope> 0.9 1.2 0.5 </Slope>
1372%                     <Offset> 0.4 -0.5 0.6 </Offset>
1373%                     <Power> 1.0 0.8 1.5 </Power>
1374%                </SOPNode>
1375%                <SATNode>
1376%                     <Saturation> 0.85 </Saturation>
1377%                </SATNode>
1378%          </ColorCorrection>
1379%    </ColorCorrectionCollection>
1380%
1381%  which includes the offset, slope, and power for each of the RGB channels
1382%  as well as the saturation.
1383%
1384%  The format of the MagickColorDecisionListImage method is:
1385%
1386%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1387%        const double gamma)
1388%
1389%  A description of each parameter follows:
1390%
1391%    o wand: the magick wand.
1392%
1393%    o color_correction_collection: the color correction collection in XML.
1394%
1395*/
1396WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1397  const char *color_correction_collection)
1398{
1399  MagickBooleanType
1400    status;
1401
1402  assert(wand != (MagickWand *) NULL);
1403  assert(wand->signature == WandSignature);
1404  if (wand->debug != MagickFalse)
1405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1406  if (wand->images == (Image *) NULL)
1407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1408  status=ColorDecisionListImage(wand->images,color_correction_collection,
1409    &wand->images->exception);
1410  return(status);
1411}
1412
1413/*
1414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1415%                                                                             %
1416%                                                                             %
1417%                                                                             %
1418%   M a g i c k C o l o r i z e I m a g e                                     %
1419%                                                                             %
1420%                                                                             %
1421%                                                                             %
1422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1423%
1424%  MagickColorizeImage() blends the fill color with each pixel in the image.
1425%
1426%  The format of the MagickColorizeImage method is:
1427%
1428%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1429%        const PixelWand *colorize,const PixelWand *opacity)
1430%
1431%  A description of each parameter follows:
1432%
1433%    o wand: the magick wand.
1434%
1435%    o colorize: the colorize pixel wand.
1436%
1437%    o opacity: the opacity pixel wand.
1438%
1439*/
1440WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1441  const PixelWand *colorize,const PixelWand *opacity)
1442{
1443  char
1444    percent_opaque[MaxTextExtent];
1445
1446  Image
1447    *colorize_image;
1448
1449  PixelPacket
1450    target;
1451
1452  assert(wand != (MagickWand *) NULL);
1453  assert(wand->signature == WandSignature);
1454  if (wand->debug != MagickFalse)
1455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1456  if (wand->images == (Image *) NULL)
1457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1458  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1459    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1460    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1461    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1462    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1463    PixelGetOpacityQuantum(opacity)));
1464  PixelGetQuantumPacket(colorize,&target);
1465  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1466    wand->exception);
1467  if (colorize_image == (Image *) NULL)
1468    return(MagickFalse);
1469  ReplaceImageInList(&wand->images,colorize_image);
1470  return(MagickTrue);
1471}
1472
1473/*
1474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1475%                                                                             %
1476%                                                                             %
1477%                                                                             %
1478%   M a g i c k C o l o r M a t r i x I m a g e                               %
1479%                                                                             %
1480%                                                                             %
1481%                                                                             %
1482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1483%
1484%  MagickColorMatrixImage() apply color transformation to an image. The method
1485%  permits saturation changes, hue rotation, luminance to alpha, and various
1486%  other effects.  Although variable-sized transformation matrices can be used,
1487%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1488%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1489%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1490%  and offsets are normalized (divide Flash offset by 255).
1491%
1492%  The format of the MagickColorMatrixImage method is:
1493%
1494%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1495%        const KernelInfo *color_matrix)
1496%
1497%  A description of each parameter follows:
1498%
1499%    o wand: the magick wand.
1500%
1501%    o color_matrix:  the color matrix.
1502%
1503*/
1504WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1505  const KernelInfo *color_matrix)
1506{
1507  Image
1508    *color_image;
1509
1510  assert(wand != (MagickWand *) NULL);
1511  assert(wand->signature == WandSignature);
1512  if (wand->debug != MagickFalse)
1513    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1514  if (color_matrix == (const KernelInfo *) NULL)
1515    return(MagickFalse);
1516  if (wand->images == (Image *) NULL)
1517    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1518  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1519  if (color_image == (Image *) NULL)
1520    return(MagickFalse);
1521  ReplaceImageInList(&wand->images,color_image);
1522  return(MagickTrue);
1523}
1524
1525/*
1526%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1527%                                                                             %
1528%                                                                             %
1529%                                                                             %
1530%   M a g i c k C o m b i n e I m a g e s                                     %
1531%                                                                             %
1532%                                                                             %
1533%                                                                             %
1534%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1535%
1536%  MagickCombineImages() combines one or more images into a single image.  The
1537%  grayscale value of the pixels of each image in the sequence is assigned in
1538%  order to the specified  hannels of the combined image.   The typical
1539%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1540%
1541%  The format of the MagickCombineImages method is:
1542%
1543%      MagickWand *MagickCombineImages(MagickWand *wand)
1544%
1545%  A description of each parameter follows:
1546%
1547%    o wand: the magick wand.
1548%
1549*/
1550WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1551{
1552  Image
1553    *combine_image;
1554
1555  assert(wand != (MagickWand *) NULL);
1556  assert(wand->signature == WandSignature);
1557  if (wand->debug != MagickFalse)
1558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1559  if (wand->images == (Image *) NULL)
1560    return((MagickWand *) NULL);
1561  combine_image=CombineImages(wand->images,wand->exception);
1562  if (combine_image == (Image *) NULL)
1563    return((MagickWand *) NULL);
1564  return(CloneMagickWandFromImages(wand,combine_image));
1565}
1566
1567/*
1568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1569%                                                                             %
1570%                                                                             %
1571%                                                                             %
1572%   M a g i c k C o m m e n t I m a g e                                       %
1573%                                                                             %
1574%                                                                             %
1575%                                                                             %
1576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1577%
1578%  MagickCommentImage() adds a comment to your image.
1579%
1580%  The format of the MagickCommentImage method is:
1581%
1582%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1583%        const char *comment)
1584%
1585%  A description of each parameter follows:
1586%
1587%    o wand: the magick wand.
1588%
1589%    o comment: the image comment.
1590%
1591*/
1592WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1593  const char *comment)
1594{
1595  MagickBooleanType
1596    status;
1597
1598  assert(wand != (MagickWand *) NULL);
1599  assert(wand->signature == WandSignature);
1600  if (wand->debug != MagickFalse)
1601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1602  if (wand->images == (Image *) NULL)
1603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1604  status=SetImageProperty(wand->images,"comment",comment);
1605  if (status == MagickFalse)
1606    InheritException(wand->exception,&wand->images->exception);
1607  return(status);
1608}
1609
1610/*
1611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1612%                                                                             %
1613%                                                                             %
1614%                                                                             %
1615%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1616%                                                                             %
1617%                                                                             %
1618%                                                                             %
1619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1620%
1621%  MagickCompareImagesLayers() compares each image with the next in a sequence
1622%  and returns the maximum bounding region of any pixel differences it
1623%  discovers.
1624%
1625%  The format of the MagickCompareImagesLayers method is:
1626%
1627%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1628%        const ImageLayerMethod method)
1629%
1630%  A description of each parameter follows:
1631%
1632%    o wand: the magick wand.
1633%
1634%    o method: the compare method.
1635%
1636*/
1637WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1638  const ImageLayerMethod method)
1639{
1640  Image
1641    *layers_image;
1642
1643  assert(wand != (MagickWand *) NULL);
1644  assert(wand->signature == WandSignature);
1645  if (wand->debug != MagickFalse)
1646    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1647  if (wand->images == (Image *) NULL)
1648    return((MagickWand *) NULL);
1649  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1650  if (layers_image == (Image *) NULL)
1651    return((MagickWand *) NULL);
1652  return(CloneMagickWandFromImages(wand,layers_image));
1653}
1654
1655/*
1656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1657%                                                                             %
1658%                                                                             %
1659%                                                                             %
1660%   M a g i c k C o m p a r e I m a g e s                                     %
1661%                                                                             %
1662%                                                                             %
1663%                                                                             %
1664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665%
1666%  MagickCompareImages() compares an image to a reconstructed image and returns
1667%  the specified difference image.
1668%
1669%  The format of the MagickCompareImages method is:
1670%
1671%      MagickWand *MagickCompareImages(MagickWand *wand,
1672%        const MagickWand *reference,const MetricType metric,
1673%        double *distortion)
1674%
1675%  A description of each parameter follows:
1676%
1677%    o wand: the magick wand.
1678%
1679%    o reference: the reference wand.
1680%
1681%    o metric: the metric.
1682%
1683%    o distortion: the computed distortion between the images.
1684%
1685*/
1686WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1687  const MagickWand *reference,const MetricType metric,double *distortion)
1688{
1689  Image
1690    *compare_image;
1691
1692
1693  assert(wand != (MagickWand *) NULL);
1694  assert(wand->signature == WandSignature);
1695  if (wand->debug != MagickFalse)
1696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1697  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1698    {
1699      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1700        "ContainsNoImages","`%s'",wand->name);
1701      return((MagickWand *) NULL);
1702    }
1703  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1704    &wand->images->exception);
1705  if (compare_image == (Image *) NULL)
1706    return((MagickWand *) NULL);
1707  return(CloneMagickWandFromImages(wand,compare_image));
1708}
1709
1710/*
1711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1712%                                                                             %
1713%                                                                             %
1714%                                                                             %
1715%   M a g i c k C o m p o s i t e I m a g e                                   %
1716%                                                                             %
1717%                                                                             %
1718%                                                                             %
1719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1720%
1721%  MagickCompositeImage() composite one image onto another at the specified
1722%  offset.
1723%
1724%  The format of the MagickCompositeImage method is:
1725%
1726%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1727%        const MagickWand *composite_wand,const CompositeOperator compose,
1728%        const ssize_t x,const ssize_t y)
1729%
1730%  A description of each parameter follows:
1731%
1732%    o wand: the magick wand.
1733%
1734%    o composite_image: the composite image.
1735%
1736%    o compose: This operator affects how the composite is applied to the
1737%      image.  The default is Over.  Choose from these operators:
1738%
1739%        OverCompositeOp       InCompositeOp         OutCompositeOp
1740%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1741%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1742%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1743%        DisplaceCompositeOp
1744%
1745%    o x: the column offset of the composited image.
1746%
1747%    o y: the row offset of the composited image.
1748%
1749*/
1750WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1751  const MagickWand *composite_wand,const CompositeOperator compose,
1752  const ssize_t x,const ssize_t y)
1753{
1754  MagickBooleanType
1755    status;
1756
1757  assert(wand != (MagickWand *) NULL);
1758  assert(wand->signature == WandSignature);
1759  if (wand->debug != MagickFalse)
1760    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1761  if ((wand->images == (Image *) NULL) ||
1762      (composite_wand->images == (Image *) NULL))
1763    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1764  status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1765  if (status == MagickFalse)
1766    InheritException(wand->exception,&wand->images->exception);
1767  return(status);
1768}
1769
1770/*
1771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1772%                                                                             %
1773%                                                                             %
1774%                                                                             %
1775%   M a g i c k C o n t r a s t I m a g e                                     %
1776%                                                                             %
1777%                                                                             %
1778%                                                                             %
1779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1780%
1781%  MagickContrastImage() enhances the intensity differences between the lighter
1782%  and darker elements of the image.  Set sharpen to a value other than 0 to
1783%  increase the image contrast otherwise the contrast is reduced.
1784%
1785%  The format of the MagickContrastImage method is:
1786%
1787%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1788%        const MagickBooleanType sharpen)
1789%
1790%  A description of each parameter follows:
1791%
1792%    o wand: the magick wand.
1793%
1794%    o sharpen: Increase or decrease image contrast.
1795%
1796%
1797*/
1798WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1799  const MagickBooleanType sharpen)
1800{
1801  MagickBooleanType
1802    status;
1803
1804  assert(wand != (MagickWand *) NULL);
1805  assert(wand->signature == WandSignature);
1806  if (wand->debug != MagickFalse)
1807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1808  if (wand->images == (Image *) NULL)
1809    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1810  status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1811  return(status);
1812}
1813
1814/*
1815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1816%                                                                             %
1817%                                                                             %
1818%                                                                             %
1819%   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                       %
1820%                                                                             %
1821%                                                                             %
1822%                                                                             %
1823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1824%
1825%  MagickContrastStretchImage() enhances the contrast of a color image by
1826%  adjusting the pixels color to span the entire range of colors available.
1827%  You can also reduce the influence of a particular channel with a gamma
1828%  value of 0.
1829%
1830%  The format of the MagickContrastStretchImage method is:
1831%
1832%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1833%        const double black_point,const double white_point)
1834%
1835%  A description of each parameter follows:
1836%
1837%    o wand: the magick wand.
1838%
1839%    o black_point: the black point.
1840%
1841%    o white_point: the white point.
1842%
1843*/
1844WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1845  const double black_point,const double white_point)
1846{
1847  MagickBooleanType
1848    status;
1849
1850  assert(wand != (MagickWand *) NULL);
1851  assert(wand->signature == WandSignature);
1852  if (wand->debug != MagickFalse)
1853    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1854  if (wand->images == (Image *) NULL)
1855    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1856  status=ContrastStretchImage(wand->images,black_point,white_point,
1857    &wand->images->exception);
1858  return(status);
1859}
1860
1861/*
1862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1863%                                                                             %
1864%                                                                             %
1865%                                                                             %
1866%   M a g i c k C o n v o l v e I m a g e                                     %
1867%                                                                             %
1868%                                                                             %
1869%                                                                             %
1870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1871%
1872%  MagickConvolveImage() applies a custom convolution kernel to the image.
1873%
1874%  The format of the MagickConvolveImage method is:
1875%
1876%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1877%        const KernelInfo *kernel)
1878%
1879%  A description of each parameter follows:
1880%
1881%    o wand: the magick wand.
1882%
1883%    o kernel: An array of doubles representing the convolution kernel.
1884%
1885*/
1886WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1887  const KernelInfo *kernel)
1888{
1889  Image
1890    *filter_image;
1891
1892  assert(wand != (MagickWand *) NULL);
1893  assert(wand->signature == WandSignature);
1894  if (wand->debug != MagickFalse)
1895    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1896  if (kernel == (const KernelInfo *) NULL)
1897    return(MagickFalse);
1898  if (wand->images == (Image *) NULL)
1899    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1900  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1901  if (filter_image == (Image *) NULL)
1902    return(MagickFalse);
1903  ReplaceImageInList(&wand->images,filter_image);
1904  return(MagickTrue);
1905}
1906
1907/*
1908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1909%                                                                             %
1910%                                                                             %
1911%                                                                             %
1912%   M a g i c k C r o p I m a g e                                             %
1913%                                                                             %
1914%                                                                             %
1915%                                                                             %
1916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1917%
1918%  MagickCropImage() extracts a region of the image.
1919%
1920%  The format of the MagickCropImage method is:
1921%
1922%      MagickBooleanType MagickCropImage(MagickWand *wand,
1923%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1924%
1925%  A description of each parameter follows:
1926%
1927%    o wand: the magick wand.
1928%
1929%    o width: the region width.
1930%
1931%    o height: the region height.
1932%
1933%    o x: the region x-offset.
1934%
1935%    o y: the region y-offset.
1936%
1937*/
1938WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1939  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1940{
1941  Image
1942    *crop_image;
1943
1944  RectangleInfo
1945    crop;
1946
1947  assert(wand != (MagickWand *) NULL);
1948  assert(wand->signature == WandSignature);
1949  if (wand->debug != MagickFalse)
1950    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1951  if (wand->images == (Image *) NULL)
1952    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1953  crop.width=width;
1954  crop.height=height;
1955  crop.x=x;
1956  crop.y=y;
1957  crop_image=CropImage(wand->images,&crop,wand->exception);
1958  if (crop_image == (Image *) NULL)
1959    return(MagickFalse);
1960  ReplaceImageInList(&wand->images,crop_image);
1961  return(MagickTrue);
1962}
1963
1964/*
1965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1966%                                                                             %
1967%                                                                             %
1968%                                                                             %
1969%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1970%                                                                             %
1971%                                                                             %
1972%                                                                             %
1973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1974%
1975%  MagickCycleColormapImage() displaces an image's colormap by a given number
1976%  of positions.  If you cycle the colormap a number of times you can produce
1977%  a psychodelic effect.
1978%
1979%  The format of the MagickCycleColormapImage method is:
1980%
1981%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1982%        const ssize_t displace)
1983%
1984%  A description of each parameter follows:
1985%
1986%    o wand: the magick wand.
1987%
1988%    o pixel_wand: the pixel wand.
1989%
1990*/
1991WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1992  const ssize_t displace)
1993{
1994  MagickBooleanType
1995    status;
1996
1997  assert(wand != (MagickWand *) NULL);
1998  assert(wand->signature == WandSignature);
1999  if (wand->debug != MagickFalse)
2000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2001  if (wand->images == (Image *) NULL)
2002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2003  status=CycleColormapImage(wand->images,displace,wand->exception);
2004  return(status);
2005}
2006
2007/*
2008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2009%                                                                             %
2010%                                                                             %
2011%                                                                             %
2012%   M a g i c k C o n s t i t u t e I m a g e                                 %
2013%                                                                             %
2014%                                                                             %
2015%                                                                             %
2016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017%
2018%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2019%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2020%  The data can be char, short int, int, float, or double.  Float and double
2021%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2022%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2023%  example, to create a 640x480 image from unsigned red-green-blue character
2024%  data, use
2025%
2026%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2027%
2028%  The format of the MagickConstituteImage method is:
2029%
2030%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2031%        const size_t columns,const size_t rows,const char *map,
2032%        const StorageType storage,void *pixels)
2033%
2034%  A description of each parameter follows:
2035%
2036%    o wand: the magick wand.
2037%
2038%    o columns: width in pixels of the image.
2039%
2040%    o rows: height in pixels of the image.
2041%
2042%    o map:  This string reflects the expected ordering of the pixel array.
2043%      It can be any combination or order of R = red, G = green, B = blue,
2044%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2045%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2046%      P = pad.
2047%
2048%    o storage: Define the data type of the pixels.  Float and double types are
2049%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2050%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2051%      LongPixel, QuantumPixel, or ShortPixel.
2052%
2053%    o pixels: This array of values contain the pixel components as defined by
2054%      map and type.  You must preallocate this array where the expected
2055%      length varies depending on the values of width, height, map, and type.
2056%
2057%
2058*/
2059WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2060  const size_t columns,const size_t rows,const char *map,
2061  const StorageType storage,const void *pixels)
2062{
2063  Image
2064    *images;
2065
2066  assert(wand != (MagickWand *) NULL);
2067  assert(wand->signature == WandSignature);
2068  if (wand->debug != MagickFalse)
2069    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2070  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2071  if (images == (Image *) NULL)
2072    return(MagickFalse);
2073  return(InsertImageInWand(wand,images));
2074}
2075
2076/*
2077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2078%                                                                             %
2079%                                                                             %
2080%                                                                             %
2081%   M a g i c k D e c i p h e r I m a g e                                     %
2082%                                                                             %
2083%                                                                             %
2084%                                                                             %
2085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2086%
2087%  MagickDecipherImage() converts cipher pixels to plain pixels.
2088%
2089%  The format of the MagickDecipherImage method is:
2090%
2091%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2092%        const char *passphrase)
2093%
2094%  A description of each parameter follows:
2095%
2096%    o wand: the magick wand.
2097%
2098%    o passphrase: the passphrase.
2099%
2100*/
2101WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2102  const char *passphrase)
2103{
2104  assert(wand != (MagickWand *) NULL);
2105  assert(wand->signature == WandSignature);
2106  if (wand->debug != MagickFalse)
2107    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2108  if (wand->images == (Image *) NULL)
2109    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2110  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2111}
2112
2113/*
2114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2115%                                                                             %
2116%                                                                             %
2117%                                                                             %
2118%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2119%                                                                             %
2120%                                                                             %
2121%                                                                             %
2122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123%
2124%  MagickDeconstructImages() compares each image with the next in a sequence
2125%  and returns the maximum bounding region of any pixel differences it
2126%  discovers.
2127%
2128%  The format of the MagickDeconstructImages method is:
2129%
2130%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2131%
2132%  A description of each parameter follows:
2133%
2134%    o wand: the magick wand.
2135%
2136*/
2137WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2138{
2139  Image
2140    *deconstruct_image;
2141
2142  assert(wand != (MagickWand *) NULL);
2143  assert(wand->signature == WandSignature);
2144  if (wand->debug != MagickFalse)
2145    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2146  if (wand->images == (Image *) NULL)
2147    return((MagickWand *) NULL);
2148  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2149    wand->exception);
2150  if (deconstruct_image == (Image *) NULL)
2151    return((MagickWand *) NULL);
2152  return(CloneMagickWandFromImages(wand,deconstruct_image));
2153}
2154
2155/*
2156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2157%                                                                             %
2158%                                                                             %
2159%                                                                             %
2160%     M a g i c k D e s k e w I m a g e                                       %
2161%                                                                             %
2162%                                                                             %
2163%                                                                             %
2164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2165%
2166%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2167%  occurs in scanned images because of the camera being misaligned,
2168%  imperfections in the scanning or surface, or simply because the paper was
2169%  not placed completely flat when scanned.
2170%
2171%  The format of the MagickDeskewImage method is:
2172%
2173%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2174%        const double threshold)
2175%
2176%  A description of each parameter follows:
2177%
2178%    o wand: the magick wand.
2179%
2180%    o threshold: separate background from foreground.
2181%
2182*/
2183WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2184  const double threshold)
2185{
2186  Image
2187    *sepia_image;
2188
2189  assert(wand != (MagickWand *) NULL);
2190  assert(wand->signature == WandSignature);
2191  if (wand->debug != MagickFalse)
2192    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2193  if (wand->images == (Image *) NULL)
2194    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2195  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2196  if (sepia_image == (Image *) NULL)
2197    return(MagickFalse);
2198  ReplaceImageInList(&wand->images,sepia_image);
2199  return(MagickTrue);
2200}
2201
2202/*
2203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2204%                                                                             %
2205%                                                                             %
2206%                                                                             %
2207%     M a g i c k D e s p e c k l e I m a g e                                 %
2208%                                                                             %
2209%                                                                             %
2210%                                                                             %
2211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2212%
2213%  MagickDespeckleImage() reduces the speckle noise in an image while
2214%  perserving the edges of the original image.
2215%
2216%  The format of the MagickDespeckleImage method is:
2217%
2218%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2219%
2220%  A description of each parameter follows:
2221%
2222%    o wand: the magick wand.
2223%
2224*/
2225WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2226{
2227  Image
2228    *despeckle_image;
2229
2230  assert(wand != (MagickWand *) NULL);
2231  assert(wand->signature == WandSignature);
2232  if (wand->debug != MagickFalse)
2233    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2234  if (wand->images == (Image *) NULL)
2235    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2236  despeckle_image=DespeckleImage(wand->images,wand->exception);
2237  if (despeckle_image == (Image *) NULL)
2238    return(MagickFalse);
2239  ReplaceImageInList(&wand->images,despeckle_image);
2240  return(MagickTrue);
2241}
2242
2243/*
2244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2245%                                                                             %
2246%                                                                             %
2247%                                                                             %
2248%   M a g i c k D e s t r o y I m a g e                                       %
2249%                                                                             %
2250%                                                                             %
2251%                                                                             %
2252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2253%
2254%  MagickDestroyImage() dereferences an image, deallocating memory associated
2255%  with the image if the reference count becomes zero.
2256%
2257%  The format of the MagickDestroyImage method is:
2258%
2259%      Image *MagickDestroyImage(Image *image)
2260%
2261%  A description of each parameter follows:
2262%
2263%    o image: the image.
2264%
2265*/
2266WandExport Image *MagickDestroyImage(Image *image)
2267{
2268  return(DestroyImage(image));
2269}
2270
2271/*
2272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273%                                                                             %
2274%                                                                             %
2275%                                                                             %
2276%   M a g i c k D i s p l a y I m a g e                                       %
2277%                                                                             %
2278%                                                                             %
2279%                                                                             %
2280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2281%
2282%  MagickDisplayImage() displays an image.
2283%
2284%  The format of the MagickDisplayImage method is:
2285%
2286%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2287%        const char *server_name)
2288%
2289%  A description of each parameter follows:
2290%
2291%    o wand: the magick wand.
2292%
2293%    o server_name: the X server name.
2294%
2295*/
2296WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2297  const char *server_name)
2298{
2299  Image
2300    *image;
2301
2302  MagickBooleanType
2303    status;
2304
2305  assert(wand != (MagickWand *) NULL);
2306  assert(wand->signature == WandSignature);
2307  if (wand->debug != MagickFalse)
2308    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2309  if (wand->images == (Image *) NULL)
2310    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2311  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2312  if (image == (Image *) NULL)
2313    return(MagickFalse);
2314  (void) CloneString(&wand->image_info->server_name,server_name);
2315  status=DisplayImages(wand->image_info,image,&image->exception);
2316  image=DestroyImage(image);
2317  return(status);
2318}
2319
2320/*
2321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2322%                                                                             %
2323%                                                                             %
2324%                                                                             %
2325%   M a g i c k D i s p l a y I m a g e s                                     %
2326%                                                                             %
2327%                                                                             %
2328%                                                                             %
2329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2330%
2331%  MagickDisplayImages() displays an image or image sequence.
2332%
2333%  The format of the MagickDisplayImages method is:
2334%
2335%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2336%        const char *server_name)
2337%
2338%  A description of each parameter follows:
2339%
2340%    o wand: the magick wand.
2341%
2342%    o server_name: the X server name.
2343%
2344*/
2345WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2346  const char *server_name)
2347{
2348  MagickBooleanType
2349    status;
2350
2351  assert(wand != (MagickWand *) NULL);
2352  assert(wand->signature == WandSignature);
2353  if (wand->debug != MagickFalse)
2354    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2355  (void) CloneString(&wand->image_info->server_name,server_name);
2356  status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
2357  return(status);
2358}
2359
2360/*
2361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2362%                                                                             %
2363%                                                                             %
2364%                                                                             %
2365%   M a g i c k D i s t o r t I m a g e                                       %
2366%                                                                             %
2367%                                                                             %
2368%                                                                             %
2369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2370%
2371%  MagickDistortImage() distorts an image using various distortion methods, by
2372%  mapping color lookups of the source image to a new destination image
2373%  usally of the same size as the source image, unless 'bestfit' is set to
2374%  true.
2375%
2376%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2377%  adjusted to ensure the whole source 'image' will just fit within the final
2378%  destination image, which will be sized and offset accordingly.  Also in
2379%  many cases the virtual offset of the source image will be taken into
2380%  account in the mapping.
2381%
2382%  The format of the MagickDistortImage method is:
2383%
2384%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2385%        const DistortImageMethod method,const size_t number_arguments,
2386%        const double *arguments,const MagickBooleanType bestfit)
2387%
2388%  A description of each parameter follows:
2389%
2390%    o image: the image to be distorted.
2391%
2392%    o method: the method of image distortion.
2393%
2394%        ArcDistortion always ignores the source image offset, and always
2395%        'bestfit' the destination image with the top left corner offset
2396%        relative to the polar mapping center.
2397%
2398%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2399%        style of image distortion.
2400%
2401%        Affine, Perspective, and Bilinear, do least squares fitting of the
2402%        distortion when more than the minimum number of control point pairs
2403%        are provided.
2404%
2405%        Perspective, and Bilinear, falls back to a Affine distortion when less
2406%        that 4 control point pairs are provided. While Affine distortions let
2407%        you use any number of control point pairs, that is Zero pairs is a
2408%        no-Op (viewport only) distrotion, one pair is a translation and two
2409%        pairs of control points do a scale-rotate-translate, without any
2410%        shearing.
2411%
2412%    o number_arguments: the number of arguments given for this distortion
2413%      method.
2414%
2415%    o arguments: the arguments for this distortion method.
2416%
2417%    o bestfit: Attempt to resize destination to fit distorted source.
2418%
2419*/
2420WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2421  const DistortImageMethod method,const size_t number_arguments,
2422  const double *arguments,const MagickBooleanType bestfit)
2423{
2424  Image
2425    *distort_image;
2426
2427  assert(wand != (MagickWand *) NULL);
2428  assert(wand->signature == WandSignature);
2429  if (wand->debug != MagickFalse)
2430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2431  if (wand->images == (Image *) NULL)
2432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2433  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2434    bestfit,wand->exception);
2435  if (distort_image == (Image *) NULL)
2436    return(MagickFalse);
2437  ReplaceImageInList(&wand->images,distort_image);
2438  return(MagickTrue);
2439}
2440
2441/*
2442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2443%                                                                             %
2444%                                                                             %
2445%                                                                             %
2446%   M a g i c k D r a w I m a g e                                             %
2447%                                                                             %
2448%                                                                             %
2449%                                                                             %
2450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2451%
2452%  MagickDrawImage() renders the drawing wand on the current image.
2453%
2454%  The format of the MagickDrawImage method is:
2455%
2456%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2457%        const DrawingWand *drawing_wand)
2458%
2459%  A description of each parameter follows:
2460%
2461%    o wand: the magick wand.
2462%
2463%    o drawing_wand: the draw wand.
2464%
2465*/
2466WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2467  const DrawingWand *drawing_wand)
2468{
2469  char
2470    *primitive;
2471
2472  DrawInfo
2473    *draw_info;
2474
2475  MagickBooleanType
2476    status;
2477
2478  assert(wand != (MagickWand *) NULL);
2479  assert(wand->signature == WandSignature);
2480  if (wand->debug != MagickFalse)
2481    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2482  if (wand->images == (Image *) NULL)
2483    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2484  draw_info=PeekDrawingWand(drawing_wand);
2485  if ((draw_info == (DrawInfo *) NULL) ||
2486      (draw_info->primitive == (char *) NULL))
2487    return(MagickFalse);
2488  primitive=AcquireString(draw_info->primitive);
2489  draw_info=DestroyDrawInfo(draw_info);
2490  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2491  draw_info->primitive=primitive;
2492  status=DrawImage(wand->images,draw_info,wand->exception);
2493  draw_info=DestroyDrawInfo(draw_info);
2494  return(status);
2495}
2496
2497/*
2498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2499%                                                                             %
2500%                                                                             %
2501%                                                                             %
2502%   M a g i c k E d g e I m a g e                                             %
2503%                                                                             %
2504%                                                                             %
2505%                                                                             %
2506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2507%
2508%  MagickEdgeImage() enhance edges within the image with a convolution filter
2509%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2510%  radius for you.
2511%
2512%  The format of the MagickEdgeImage method is:
2513%
2514%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2515%        const double sigma)
2516%
2517%  A description of each parameter follows:
2518%
2519%    o wand: the magick wand.
2520%
2521%    o radius: the radius of the pixel neighborhood.
2522%
2523%    o sigma: the standard deviation of the Gaussian, in pixels.
2524%
2525*/
2526WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2527  const double radius,const double sigma)
2528{
2529  Image
2530    *edge_image;
2531
2532  assert(wand != (MagickWand *) NULL);
2533  assert(wand->signature == WandSignature);
2534  if (wand->debug != MagickFalse)
2535    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2536  if (wand->images == (Image *) NULL)
2537    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2538  edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2539  if (edge_image == (Image *) NULL)
2540    return(MagickFalse);
2541  ReplaceImageInList(&wand->images,edge_image);
2542  return(MagickTrue);
2543}
2544
2545/*
2546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2547%                                                                             %
2548%                                                                             %
2549%                                                                             %
2550%   M a g i c k E m b o s s I m a g e                                         %
2551%                                                                             %
2552%                                                                             %
2553%                                                                             %
2554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555%
2556%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2557%  effect.  We convolve the image with a Gaussian operator of the given radius
2558%  and standard deviation (sigma).  For reasonable results, radius should be
2559%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2560%  radius for you.
2561%
2562%  The format of the MagickEmbossImage method is:
2563%
2564%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2565%        const double sigma)
2566%
2567%  A description of each parameter follows:
2568%
2569%    o wand: the magick wand.
2570%
2571%    o radius: the radius of the Gaussian, in pixels, not counting the center
2572%      pixel.
2573%
2574%    o sigma: the standard deviation of the Gaussian, in pixels.
2575%
2576*/
2577WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2578  const double radius,const double sigma)
2579{
2580  Image
2581    *emboss_image;
2582
2583  assert(wand != (MagickWand *) NULL);
2584  assert(wand->signature == WandSignature);
2585  if (wand->debug != MagickFalse)
2586    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2587  if (wand->images == (Image *) NULL)
2588    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2589  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2590  if (emboss_image == (Image *) NULL)
2591    return(MagickFalse);
2592  ReplaceImageInList(&wand->images,emboss_image);
2593  return(MagickTrue);
2594}
2595
2596/*
2597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2598%                                                                             %
2599%                                                                             %
2600%                                                                             %
2601%   M a g i c k E n c i p h e r I m a g e                                     %
2602%                                                                             %
2603%                                                                             %
2604%                                                                             %
2605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2606%
2607%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2608%
2609%  The format of the MagickEncipherImage method is:
2610%
2611%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2612%        const char *passphrase)
2613%
2614%  A description of each parameter follows:
2615%
2616%    o wand: the magick wand.
2617%
2618%    o passphrase: the passphrase.
2619%
2620*/
2621WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2622  const char *passphrase)
2623{
2624  assert(wand != (MagickWand *) NULL);
2625  assert(wand->signature == WandSignature);
2626  if (wand->debug != MagickFalse)
2627    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2628  if (wand->images == (Image *) NULL)
2629    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2630  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2631}
2632
2633/*
2634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2635%                                                                             %
2636%                                                                             %
2637%                                                                             %
2638%   M a g i c k E n h a n c e I m a g e                                       %
2639%                                                                             %
2640%                                                                             %
2641%                                                                             %
2642%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2643%
2644%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2645%  noisy image.
2646%
2647%  The format of the MagickEnhanceImage method is:
2648%
2649%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2650%
2651%  A description of each parameter follows:
2652%
2653%    o wand: the magick wand.
2654%
2655*/
2656WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2657{
2658  Image
2659    *enhance_image;
2660
2661  assert(wand != (MagickWand *) NULL);
2662  assert(wand->signature == WandSignature);
2663  if (wand->debug != MagickFalse)
2664    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2665  if (wand->images == (Image *) NULL)
2666    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2667  enhance_image=EnhanceImage(wand->images,wand->exception);
2668  if (enhance_image == (Image *) NULL)
2669    return(MagickFalse);
2670  ReplaceImageInList(&wand->images,enhance_image);
2671  return(MagickTrue);
2672}
2673
2674/*
2675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2676%                                                                             %
2677%                                                                             %
2678%                                                                             %
2679%   M a g i c k E q u a l i z e I m a g e                                     %
2680%                                                                             %
2681%                                                                             %
2682%                                                                             %
2683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2684%
2685%  MagickEqualizeImage() equalizes the image histogram.
2686%
2687%  The format of the MagickEqualizeImage method is:
2688%
2689%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2690%
2691%  A description of each parameter follows:
2692%
2693%    o wand: the magick wand.
2694%
2695%    o channel: the image channel(s).
2696%
2697*/
2698WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2699{
2700  MagickBooleanType
2701    status;
2702
2703  assert(wand != (MagickWand *) NULL);
2704  assert(wand->signature == WandSignature);
2705  if (wand->debug != MagickFalse)
2706    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2707  if (wand->images == (Image *) NULL)
2708    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2709  status=EqualizeImage(wand->images,&wand->images->exception);
2710  return(status);
2711}
2712
2713/*
2714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2715%                                                                             %
2716%                                                                             %
2717%                                                                             %
2718%   M a g i c k E v a l u a t e I m a g e                                     %
2719%                                                                             %
2720%                                                                             %
2721%                                                                             %
2722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2723%
2724%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2725%  expression to an image.  Use these operators to lighten or darken an image,
2726%  to increase or decrease contrast in an image, or to produce the "negative"
2727%  of an image.
2728%
2729%  The format of the MagickEvaluateImage method is:
2730%
2731%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2732%        const MagickEvaluateOperator operator,const double value)
2733%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2734%        const MagickEvaluateOperator operator)
2735%
2736%  A description of each parameter follows:
2737%
2738%    o wand: the magick wand.
2739%
2740%    o op: A channel operator.
2741%
2742%    o value: A value value.
2743%
2744*/
2745
2746WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2747  const MagickEvaluateOperator op)
2748{
2749  Image
2750    *evaluate_image;
2751
2752  assert(wand != (MagickWand *) NULL);
2753  assert(wand->signature == WandSignature);
2754  if (wand->debug != MagickFalse)
2755    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2756  if (wand->images == (Image *) NULL)
2757    return((MagickWand *) NULL);
2758  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2759  if (evaluate_image == (Image *) NULL)
2760    return((MagickWand *) NULL);
2761  return(CloneMagickWandFromImages(wand,evaluate_image));
2762}
2763
2764WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2765  const MagickEvaluateOperator op,const double value)
2766{
2767  MagickBooleanType
2768    status;
2769
2770  assert(wand != (MagickWand *) NULL);
2771  assert(wand->signature == WandSignature);
2772  if (wand->debug != MagickFalse)
2773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2774  if (wand->images == (Image *) NULL)
2775    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2776  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2777  return(status);
2778}
2779
2780/*
2781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2782%                                                                             %
2783%                                                                             %
2784%                                                                             %
2785%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2786%                                                                             %
2787%                                                                             %
2788%                                                                             %
2789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2790%
2791%  MagickExportImagePixels() extracts pixel data from an image and returns it
2792%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2793%  an error is encountered.  The data is returned as char, short int, int,
2794%  ssize_t, float, or double in the order specified by map.
2795%
2796%  Suppose you want to extract the first scanline of a 640x480 image as
2797%  character data in red-green-blue order:
2798%
2799%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2800%
2801%  The format of the MagickExportImagePixels method is:
2802%
2803%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2804%        const ssize_t x,const ssize_t y,const size_t columns,
2805%        const size_t rows,const char *map,const StorageType storage,
2806%        void *pixels)
2807%
2808%  A description of each parameter follows:
2809%
2810%    o wand: the magick wand.
2811%
2812%    o x, y, columns, rows:  These values define the perimeter
2813%      of a region of pixels you want to extract.
2814%
2815%    o map:  This string reflects the expected ordering of the pixel array.
2816%      It can be any combination or order of R = red, G = green, B = blue,
2817%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2818%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2819%      P = pad.
2820%
2821%    o storage: Define the data type of the pixels.  Float and double types are
2822%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2823%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2824%      LongPixel, QuantumPixel, or ShortPixel.
2825%
2826%    o pixels: This array of values contain the pixel components as defined by
2827%      map and type.  You must preallocate this array where the expected
2828%      length varies depending on the values of width, height, map, and type.
2829%
2830*/
2831WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2832  const ssize_t x,const ssize_t y,const size_t columns,
2833  const size_t rows,const char *map,const StorageType storage,
2834  void *pixels)
2835{
2836  MagickBooleanType
2837    status;
2838
2839  assert(wand != (MagickWand *) NULL);
2840  assert(wand->signature == WandSignature);
2841  if (wand->debug != MagickFalse)
2842    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2843  if (wand->images == (Image *) NULL)
2844    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2845  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2846    storage,pixels,wand->exception);
2847  if (status == MagickFalse)
2848    InheritException(wand->exception,&wand->images->exception);
2849  return(status);
2850}
2851
2852/*
2853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2854%                                                                             %
2855%                                                                             %
2856%                                                                             %
2857%   M a g i c k E x t e n t I m a g e                                         %
2858%                                                                             %
2859%                                                                             %
2860%                                                                             %
2861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2862%
2863%  MagickExtentImage() extends the image as defined by the geometry, gravity,
2864%  and wand background color.  Set the (x,y) offset of the geometry to move
2865%  the original wand relative to the extended wand.
2866%
2867%  The format of the MagickExtentImage method is:
2868%
2869%      MagickBooleanType MagickExtentImage(MagickWand *wand,
2870%        const size_t width,const size_t height,const ssize_t x,
2871%        const ssize_t y)
2872%
2873%  A description of each parameter follows:
2874%
2875%    o wand: the magick wand.
2876%
2877%    o width: the region width.
2878%
2879%    o height: the region height.
2880%
2881%    o x: the region x offset.
2882%
2883%    o y: the region y offset.
2884%
2885*/
2886WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2887  const size_t width,const size_t height,const ssize_t x,
2888  const ssize_t y)
2889{
2890  Image
2891    *extent_image;
2892
2893  RectangleInfo
2894    extent;
2895
2896  assert(wand != (MagickWand *) NULL);
2897  assert(wand->signature == WandSignature);
2898  if (wand->debug != MagickFalse)
2899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2900  if (wand->images == (Image *) NULL)
2901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2902  extent.width=width;
2903  extent.height=height;
2904  extent.x=x;
2905  extent.y=y;
2906  extent_image=ExtentImage(wand->images,&extent,wand->exception);
2907  if (extent_image == (Image *) NULL)
2908    return(MagickFalse);
2909  ReplaceImageInList(&wand->images,extent_image);
2910  return(MagickTrue);
2911}
2912
2913/*
2914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2915%                                                                             %
2916%                                                                             %
2917%                                                                             %
2918%   M a g i c k F l i p I m a g e                                             %
2919%                                                                             %
2920%                                                                             %
2921%                                                                             %
2922%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2923%
2924%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2925%  around the central x-axis.
2926%
2927%  The format of the MagickFlipImage method is:
2928%
2929%      MagickBooleanType MagickFlipImage(MagickWand *wand)
2930%
2931%  A description of each parameter follows:
2932%
2933%    o wand: the magick wand.
2934%
2935*/
2936WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2937{
2938  Image
2939    *flip_image;
2940
2941  assert(wand != (MagickWand *) NULL);
2942  assert(wand->signature == WandSignature);
2943  if (wand->debug != MagickFalse)
2944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2945  if (wand->images == (Image *) NULL)
2946    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2947  flip_image=FlipImage(wand->images,wand->exception);
2948  if (flip_image == (Image *) NULL)
2949    return(MagickFalse);
2950  ReplaceImageInList(&wand->images,flip_image);
2951  return(MagickTrue);
2952}
2953
2954/*
2955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2956%                                                                             %
2957%                                                                             %
2958%                                                                             %
2959%   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                         %
2960%                                                                             %
2961%                                                                             %
2962%                                                                             %
2963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2964%
2965%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2966%  target and is an immediate neighbor.  If the method FillToBorderMethod is
2967%  specified, the color value is changed for any neighbor pixel that does not
2968%  match the bordercolor member of image.
2969%
2970%  The format of the MagickFloodfillPaintImage method is:
2971%
2972%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2973%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2974%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2975%
2976%  A description of each parameter follows:
2977%
2978%    o wand: the magick wand.
2979%
2980%    o fill: the floodfill color pixel wand.
2981%
2982%    o fuzz: By default target must match a particular pixel color
2983%      exactly.  However, in many cases two colors may differ by a small amount.
2984%      The fuzz member of image defines how much tolerance is acceptable to
2985%      consider two colors as the same.  For example, set fuzz to 10 and the
2986%      color red at intensities of 100 and 102 respectively are now interpreted
2987%      as the same color for the purposes of the floodfill.
2988%
2989%    o bordercolor: the border color pixel wand.
2990%
2991%    o x,y: the starting location of the operation.
2992%
2993%    o invert: paint any pixel that does not match the target color.
2994%
2995*/
2996WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2997  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2998  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2999{
3000  DrawInfo
3001    *draw_info;
3002
3003  MagickBooleanType
3004    status;
3005
3006  PixelInfo
3007    target;
3008
3009  assert(wand != (MagickWand *) NULL);
3010  assert(wand->signature == WandSignature);
3011  if (wand->debug != MagickFalse)
3012    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3013  if (wand->images == (Image *) NULL)
3014    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3015  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3016  PixelGetQuantumPacket(fill,&draw_info->fill);
3017  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3018    y % wand->images->rows,&target,wand->exception);
3019  if (bordercolor != (PixelWand *) NULL)
3020    PixelGetMagickColor(bordercolor,&target);
3021  wand->images->fuzz=fuzz;
3022  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3023    &wand->images->exception);
3024  draw_info=DestroyDrawInfo(draw_info);
3025  return(status);
3026}
3027
3028/*
3029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3030%                                                                             %
3031%                                                                             %
3032%                                                                             %
3033%   M a g i c k F l o p I m a g e                                             %
3034%                                                                             %
3035%                                                                             %
3036%                                                                             %
3037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3038%
3039%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3040%  around the central y-axis.
3041%
3042%  The format of the MagickFlopImage method is:
3043%
3044%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3045%
3046%  A description of each parameter follows:
3047%
3048%    o wand: the magick wand.
3049%
3050*/
3051WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3052{
3053  Image
3054    *flop_image;
3055
3056  assert(wand != (MagickWand *) NULL);
3057  assert(wand->signature == WandSignature);
3058  if (wand->debug != MagickFalse)
3059    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3060  if (wand->images == (Image *) NULL)
3061    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3062  flop_image=FlopImage(wand->images,wand->exception);
3063  if (flop_image == (Image *) NULL)
3064    return(MagickFalse);
3065  ReplaceImageInList(&wand->images,flop_image);
3066  return(MagickTrue);
3067}
3068
3069/*
3070%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3071%                                                                             %
3072%                                                                             %
3073%                                                                             %
3074%   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                     %
3075%                                                                             %
3076%                                                                             %
3077%                                                                             %
3078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3079%
3080%  MagickForwardFourierTransformImage() implements the discrete Fourier
3081%  transform (DFT) of the image either as a magnitude / phase or real /
3082%  imaginary image pair.
3083%
3084%  The format of the MagickForwardFourierTransformImage method is:
3085%
3086%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3087%        const MagickBooleanType magnitude)
3088%
3089%  A description of each parameter follows:
3090%
3091%    o wand: the magick wand.
3092%
3093%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3094%      imaginary image pair.
3095%
3096*/
3097WandExport MagickBooleanType MagickForwardFourierTransformImage(
3098  MagickWand *wand,const MagickBooleanType magnitude)
3099{
3100  Image
3101    *forward_image;
3102
3103  assert(wand != (MagickWand *) NULL);
3104  assert(wand->signature == WandSignature);
3105  if (wand->debug != MagickFalse)
3106    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3107  if (wand->images == (Image *) NULL)
3108    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3109  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3110    wand->exception);
3111  if (forward_image == (Image *) NULL)
3112    return(MagickFalse);
3113  ReplaceImageInList(&wand->images,forward_image);
3114  return(MagickTrue);
3115}
3116
3117/*
3118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3119%                                                                             %
3120%                                                                             %
3121%                                                                             %
3122%   M a g i c k F r a m e I m a g e                                           %
3123%                                                                             %
3124%                                                                             %
3125%                                                                             %
3126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3127%
3128%  MagickFrameImage() adds a simulated three-dimensional border around the
3129%  image.  The width and height specify the border width of the vertical and
3130%  horizontal sides of the frame.  The inner and outer bevels indicate the
3131%  width of the inner and outer shadows of the frame.
3132%
3133%  The format of the MagickFrameImage method is:
3134%
3135%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3136%        const PixelWand *matte_color,const size_t width,
3137%        const size_t height,const ssize_t inner_bevel,
3138%        const ssize_t outer_bevel)
3139%
3140%  A description of each parameter follows:
3141%
3142%    o wand: the magick wand.
3143%
3144%    o matte_color: the frame color pixel wand.
3145%
3146%    o width: the border width.
3147%
3148%    o height: the border height.
3149%
3150%    o inner_bevel: the inner bevel width.
3151%
3152%    o outer_bevel: the outer bevel width.
3153%
3154*/
3155WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3156  const PixelWand *matte_color,const size_t width,
3157  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3158{
3159  Image
3160    *frame_image;
3161
3162  FrameInfo
3163    frame_info;
3164
3165  assert(wand != (MagickWand *) NULL);
3166  assert(wand->signature == WandSignature);
3167  if (wand->debug != MagickFalse)
3168    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3169  if (wand->images == (Image *) NULL)
3170    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3171  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3172  frame_info.width=wand->images->columns+2*width;
3173  frame_info.height=wand->images->rows+2*height;
3174  frame_info.x=(ssize_t) width;
3175  frame_info.y=(ssize_t) height;
3176  frame_info.inner_bevel=inner_bevel;
3177  frame_info.outer_bevel=outer_bevel;
3178  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3179  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3180  if (frame_image == (Image *) NULL)
3181    return(MagickFalse);
3182  ReplaceImageInList(&wand->images,frame_image);
3183  return(MagickTrue);
3184}
3185
3186/*
3187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3188%                                                                             %
3189%                                                                             %
3190%                                                                             %
3191%   M a g i c k F u n c t i o n I m a g e                                     %
3192%                                                                             %
3193%                                                                             %
3194%                                                                             %
3195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3196%
3197%  MagickFunctionImage() applys an arithmetic, relational, or logical
3198%  expression to an image.  Use these operators to lighten or darken an image,
3199%  to increase or decrease contrast in an image, or to produce the "negative"
3200%  of an image.
3201%
3202%  The format of the MagickFunctionImage method is:
3203%
3204%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3205%        const MagickFunction function,const size_t number_arguments,
3206%        const double *arguments)
3207%
3208%  A description of each parameter follows:
3209%
3210%    o wand: the magick wand.
3211%
3212%    o function: the image function.
3213%
3214%    o number_arguments: the number of function arguments.
3215%
3216%    o arguments: the function arguments.
3217%
3218*/
3219WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3220  const MagickFunction function,const size_t number_arguments,
3221  const double *arguments)
3222{
3223  MagickBooleanType
3224    status;
3225
3226  assert(wand != (MagickWand *) NULL);
3227  assert(wand->signature == WandSignature);
3228  if (wand->debug != MagickFalse)
3229    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3230  if (wand->images == (Image *) NULL)
3231    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3232  status=FunctionImage(wand->images,function,number_arguments,arguments,
3233    &wand->images->exception);
3234  return(status);
3235}
3236
3237/*
3238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3239%                                                                             %
3240%                                                                             %
3241%                                                                             %
3242%   M a g i c k F x I m a g e                                                 %
3243%                                                                             %
3244%                                                                             %
3245%                                                                             %
3246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3247%
3248%  MagickFxImage() evaluate expression for each pixel in the image.
3249%
3250%  The format of the MagickFxImage method is:
3251%
3252%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3253%
3254%  A description of each parameter follows:
3255%
3256%    o wand: the magick wand.
3257%
3258%    o expression: the expression.
3259%
3260*/
3261WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3262{
3263  Image
3264    *fx_image;
3265
3266  assert(wand != (MagickWand *) NULL);
3267  assert(wand->signature == WandSignature);
3268  if (wand->debug != MagickFalse)
3269    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3270  if (wand->images == (Image *) NULL)
3271    return((MagickWand *) NULL);
3272  fx_image=FxImage(wand->images,expression,wand->exception);
3273  if (fx_image == (Image *) NULL)
3274    return((MagickWand *) NULL);
3275  return(CloneMagickWandFromImages(wand,fx_image));
3276}
3277
3278/*
3279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3280%                                                                             %
3281%                                                                             %
3282%                                                                             %
3283%   M a g i c k G a m m a I m a g e                                           %
3284%                                                                             %
3285%                                                                             %
3286%                                                                             %
3287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3288%
3289%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3290%  different devices will have perceptual differences in the way the image's
3291%  intensities are represented on the screen.  Specify individual gamma levels
3292%  for the red, green, and blue channels, or adjust all three with the gamma
3293%  parameter.  Values typically range from 0.8 to 2.3.
3294%
3295%  You can also reduce the influence of a particular channel with a gamma
3296%  value of 0.
3297%
3298%  The format of the MagickGammaImage method is:
3299%
3300%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3301%
3302%  A description of each parameter follows:
3303%
3304%    o wand: the magick wand.
3305%
3306%    o level: Define the level of gamma correction.
3307%
3308*/
3309WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3310  const double gamma)
3311{
3312  MagickBooleanType
3313    status;
3314
3315  assert(wand != (MagickWand *) NULL);
3316  assert(wand->signature == WandSignature);
3317  if (wand->debug != MagickFalse)
3318    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3319  if (wand->images == (Image *) NULL)
3320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3321  status=GammaImage(wand->images,gamma,wand->exception);
3322  return(status);
3323}
3324
3325/*
3326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3327%                                                                             %
3328%                                                                             %
3329%                                                                             %
3330%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3331%                                                                             %
3332%                                                                             %
3333%                                                                             %
3334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3335%
3336%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3337%  Gaussian operator of the given radius and standard deviation (sigma).
3338%  For reasonable results, the radius should be larger than sigma.  Use a
3339%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3340%
3341%  The format of the MagickGaussianBlurImage method is:
3342%
3343%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3344%        const double radius,const double sigma,const double bias)
3345%
3346%  A description of each parameter follows:
3347%
3348%    o wand: the magick wand.
3349%
3350%    o radius: the radius of the Gaussian, in pixels, not counting the center
3351%      pixel.
3352%
3353%    o sigma: the standard deviation of the Gaussian, in pixels.
3354%
3355%    o bias: the bias.
3356%
3357*/
3358WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3359  const double radius,const double sigma,const double bias)
3360{
3361  Image
3362    *blur_image;
3363
3364  assert(wand != (MagickWand *) NULL);
3365  assert(wand->signature == WandSignature);
3366  if (wand->debug != MagickFalse)
3367    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3368  if (wand->images == (Image *) NULL)
3369    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3370  blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3371  if (blur_image == (Image *) NULL)
3372    return(MagickFalse);
3373  ReplaceImageInList(&wand->images,blur_image);
3374  return(MagickTrue);
3375}
3376
3377/*
3378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3379%                                                                             %
3380%                                                                             %
3381%                                                                             %
3382%   M a g i c k G e t I m a g e                                               %
3383%                                                                             %
3384%                                                                             %
3385%                                                                             %
3386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3387%
3388%  MagickGetImage() gets the image at the current image index.
3389%
3390%  The format of the MagickGetImage method is:
3391%
3392%      MagickWand *MagickGetImage(MagickWand *wand)
3393%
3394%  A description of each parameter follows:
3395%
3396%    o wand: the magick wand.
3397%
3398*/
3399WandExport MagickWand *MagickGetImage(MagickWand *wand)
3400{
3401  Image
3402    *image;
3403
3404  assert(wand != (MagickWand *) NULL);
3405  assert(wand->signature == WandSignature);
3406  if (wand->debug != MagickFalse)
3407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3408  if (wand->images == (Image *) NULL)
3409    {
3410      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3411        "ContainsNoImages","`%s'",wand->name);
3412      return((MagickWand *) NULL);
3413    }
3414  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3415  if (image == (Image *) NULL)
3416    return((MagickWand *) NULL);
3417  return(CloneMagickWandFromImages(wand,image));
3418}
3419
3420/*
3421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3422%                                                                             %
3423%                                                                             %
3424%                                                                             %
3425%   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                       %
3426%                                                                             %
3427%                                                                             %
3428%                                                                             %
3429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3430%
3431%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3432%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3433%  than CMYKA.
3434%
3435%  The format of the MagickGetImageAlphaChannel method is:
3436%
3437%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3438%
3439%  A description of each parameter follows:
3440%
3441%    o wand: the magick wand.
3442%
3443*/
3444WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3445{
3446  assert(wand != (MagickWand *) NULL);
3447  assert(wand->signature == WandSignature);
3448  if (wand->debug != MagickFalse)
3449    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3450  if (wand->images == (Image *) NULL)
3451    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3452  return(GetImageAlphaChannel(wand->images));
3453}
3454
3455/*
3456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457%                                                                             %
3458%                                                                             %
3459%                                                                             %
3460%   M a g i c k G e t I m a g e C l i p M a s k                               %
3461%                                                                             %
3462%                                                                             %
3463%                                                                             %
3464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3465%
3466%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3467%
3468%  The format of the MagickGetImageClipMask method is:
3469%
3470%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3471%
3472%  A description of each parameter follows:
3473%
3474%    o wand: the magick wand.
3475%
3476*/
3477WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3478{
3479  Image
3480    *image;
3481
3482  assert(wand != (MagickWand *) NULL);
3483  assert(wand->signature == WandSignature);
3484  if (wand->debug != MagickFalse)
3485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3486  if (wand->images == (Image *) NULL)
3487    {
3488      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3489        "ContainsNoImages","`%s'",wand->name);
3490      return((MagickWand *) NULL);
3491    }
3492  image=GetImageClipMask(wand->images,wand->exception);
3493  if (image == (Image *) NULL)
3494    return((MagickWand *) NULL);
3495  return(CloneMagickWandFromImages(wand,image));
3496}
3497
3498/*
3499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3500%                                                                             %
3501%                                                                             %
3502%                                                                             %
3503%   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                 %
3504%                                                                             %
3505%                                                                             %
3506%                                                                             %
3507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3508%
3509%  MagickGetImageBackgroundColor() returns the image background color.
3510%
3511%  The format of the MagickGetImageBackgroundColor method is:
3512%
3513%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3514%        PixelWand *background_color)
3515%
3516%  A description of each parameter follows:
3517%
3518%    o wand: the magick wand.
3519%
3520%    o background_color: Return the background color.
3521%
3522*/
3523WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3524  PixelWand *background_color)
3525{
3526  assert(wand != (MagickWand *) NULL);
3527  assert(wand->signature == WandSignature);
3528  if (wand->debug != MagickFalse)
3529    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3530  if (wand->images == (Image *) NULL)
3531    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3532  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3533  return(MagickTrue);
3534}
3535
3536/*
3537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3538%                                                                             %
3539%                                                                             %
3540%                                                                             %
3541%   M a g i c k G e t I m a g e B l o b                                       %
3542%                                                                             %
3543%                                                                             %
3544%                                                                             %
3545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3546%
3547%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3548%  the image as a blob (a formatted "file" in memory) and its length, starting
3549%  from the current position in the image sequence.  Use MagickSetImageFormat()
3550%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3551%
3552%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3553%  the image sequence.
3554%
3555%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3556%
3557%  The format of the MagickGetImageBlob method is:
3558%
3559%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3560%
3561%  A description of each parameter follows:
3562%
3563%    o wand: the magick wand.
3564%
3565%    o length: the length of the blob.
3566%
3567*/
3568WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3569{
3570  assert(wand != (MagickWand *) NULL);
3571  assert(wand->signature == WandSignature);
3572  if (wand->debug != MagickFalse)
3573    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3574  if (wand->images == (Image *) NULL)
3575    {
3576      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3577        "ContainsNoImages","`%s'",wand->name);
3578      return((unsigned char *) NULL);
3579    }
3580  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3581}
3582
3583/*
3584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3585%                                                                             %
3586%                                                                             %
3587%                                                                             %
3588%   M a g i c k G e t I m a g e s B l o b                                     %
3589%                                                                             %
3590%                                                                             %
3591%                                                                             %
3592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3593%
3594%  MagickGetImageBlob() implements direct to memory image formats.  It
3595%  returns the image sequence as a blob and its length.  The format of the image
3596%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3597%  return a different image format, use MagickSetImageFormat().
3598%
3599%  Note, some image formats do not permit multiple images to the same image
3600%  stream (e.g. JPEG).  in this instance, just the first image of the
3601%  sequence is returned as a blob.
3602%
3603%  The format of the MagickGetImagesBlob method is:
3604%
3605%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3606%
3607%  A description of each parameter follows:
3608%
3609%    o wand: the magick wand.
3610%
3611%    o length: the length of the blob.
3612%
3613*/
3614WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3615{
3616  unsigned char
3617    *blob;
3618
3619  assert(wand != (MagickWand *) NULL);
3620  assert(wand->signature == WandSignature);
3621  if (wand->debug != MagickFalse)
3622    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3623  if (wand->images == (Image *) NULL)
3624    {
3625      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3626        "ContainsNoImages","`%s'",wand->name);
3627      return((unsigned char *) NULL);
3628    }
3629  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3630    wand->exception);
3631  return(blob);
3632}
3633
3634/*
3635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3636%                                                                             %
3637%                                                                             %
3638%                                                                             %
3639%   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                         %
3640%                                                                             %
3641%                                                                             %
3642%                                                                             %
3643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3644%
3645%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3646%  image.
3647%
3648%  The format of the MagickGetImageBluePrimary method is:
3649%
3650%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3651%        double *y)
3652%
3653%  A description of each parameter follows:
3654%
3655%    o wand: the magick wand.
3656%
3657%    o x: the chromaticity blue primary x-point.
3658%
3659%    o y: the chromaticity blue primary y-point.
3660%
3661*/
3662WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3663  double *x,double *y)
3664{
3665  assert(wand != (MagickWand *) NULL);
3666  assert(wand->signature == WandSignature);
3667  if (wand->debug != MagickFalse)
3668    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3669  if (wand->images == (Image *) NULL)
3670    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3671  *x=wand->images->chromaticity.blue_primary.x;
3672  *y=wand->images->chromaticity.blue_primary.y;
3673  return(MagickTrue);
3674}
3675
3676/*
3677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3678%                                                                             %
3679%                                                                             %
3680%                                                                             %
3681%   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                         %
3682%                                                                             %
3683%                                                                             %
3684%                                                                             %
3685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3686%
3687%  MagickGetImageBorderColor() returns the image border color.
3688%
3689%  The format of the MagickGetImageBorderColor method is:
3690%
3691%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3692%        PixelWand *border_color)
3693%
3694%  A description of each parameter follows:
3695%
3696%    o wand: the magick wand.
3697%
3698%    o border_color: Return the border color.
3699%
3700*/
3701WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3702  PixelWand *border_color)
3703{
3704  assert(wand != (MagickWand *) NULL);
3705  assert(wand->signature == WandSignature);
3706  if (wand->debug != MagickFalse)
3707    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3708  if (wand->images == (Image *) NULL)
3709    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3710  PixelSetQuantumPacket(border_color,&wand->images->border_color);
3711  return(MagickTrue);
3712}
3713
3714/*
3715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3716%                                                                             %
3717%                                                                             %
3718%                                                                             %
3719%   M a g i c k G e t I m a g e F e a t u r e s                               %
3720%                                                                             %
3721%                                                                             %
3722%                                                                             %
3723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3724%
3725%  MagickGetImageFeatures() returns features for each channel in the
3726%  image in each of four directions (horizontal, vertical, left and right
3727%  diagonals) for the specified distance.  The features include the angular
3728%  second moment, contrast, correlation, sum of squares: variance, inverse
3729%  difference moment, sum average, sum varience, sum entropy, entropy,
3730%  difference variance, difference entropy, information measures of
3731%  correlation 1, information measures of correlation 2, and maximum
3732%  correlation coefficient.  You can access the red channel contrast, for
3733%  example, like this:
3734%
3735%      channel_features=MagickGetImageFeatures(wand,1);
3736%      contrast=channel_features[RedChannel].contrast[0];
3737%
3738%  Use MagickRelinquishMemory() to free the statistics buffer.
3739%
3740%  The format of the MagickGetImageFeatures method is:
3741%
3742%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3743%        const size_t distance)
3744%
3745%  A description of each parameter follows:
3746%
3747%    o wand: the magick wand.
3748%
3749%    o distance: the distance.
3750%
3751*/
3752WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3753  const size_t distance)
3754{
3755  assert(wand != (MagickWand *) NULL);
3756  assert(wand->signature == WandSignature);
3757  if (wand->debug != MagickFalse)
3758    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3759  if (wand->images == (Image *) NULL)
3760    {
3761      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3762        "ContainsNoImages","`%s'",wand->name);
3763      return((ChannelFeatures *) NULL);
3764    }
3765  return(GetImageFeatures(wand->images,distance,wand->exception));
3766}
3767
3768/*
3769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3770%                                                                             %
3771%                                                                             %
3772%                                                                             %
3773%   M a g i c k G e t I m a g e K u r t o s i s                               %
3774%                                                                             %
3775%                                                                             %
3776%                                                                             %
3777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3778%
3779%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3780%  more image channels.
3781%
3782%  The format of the MagickGetImageKurtosis method is:
3783%
3784%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3785%        double *kurtosis,double *skewness)
3786%
3787%  A description of each parameter follows:
3788%
3789%    o wand: the magick wand.
3790%
3791%    o kurtosis:  The kurtosis for the specified channel(s).
3792%
3793%    o skewness:  The skewness for the specified channel(s).
3794%
3795*/
3796WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3797  double *kurtosis,double *skewness)
3798{
3799  MagickBooleanType
3800    status;
3801
3802  assert(wand != (MagickWand *) NULL);
3803  assert(wand->signature == WandSignature);
3804  if (wand->debug != MagickFalse)
3805    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3806  if (wand->images == (Image *) NULL)
3807    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3808  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3809  return(status);
3810}
3811
3812/*
3813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3814%                                                                             %
3815%                                                                             %
3816%                                                                             %
3817%   M a g i c k G e t I m a g e M e a n                                       %
3818%                                                                             %
3819%                                                                             %
3820%                                                                             %
3821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822%
3823%  MagickGetImageMean() gets the mean and standard deviation of one or more
3824%  image channels.
3825%
3826%  The format of the MagickGetImageMean method is:
3827%
3828%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3829%        double *standard_deviation)
3830%
3831%  A description of each parameter follows:
3832%
3833%    o wand: the magick wand.
3834%
3835%    o channel: the image channel(s).
3836%
3837%    o mean:  The mean pixel value for the specified channel(s).
3838%
3839%    o standard_deviation:  The standard deviation for the specified channel(s).
3840%
3841*/
3842WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3843  double *standard_deviation)
3844{
3845  MagickBooleanType
3846    status;
3847
3848  assert(wand != (MagickWand *) NULL);
3849  assert(wand->signature == WandSignature);
3850  if (wand->debug != MagickFalse)
3851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3852  if (wand->images == (Image *) NULL)
3853    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3854  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3855  return(status);
3856}
3857
3858/*
3859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3860%                                                                             %
3861%                                                                             %
3862%                                                                             %
3863%   M a g i c k G e t I m a g e R a n g e                                     %
3864%                                                                             %
3865%                                                                             %
3866%                                                                             %
3867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3868%
3869%  MagickGetImageRange() gets the range for one or more image channels.
3870%
3871%  The format of the MagickGetImageRange method is:
3872%
3873%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3874%        double *maxima)
3875%
3876%  A description of each parameter follows:
3877%
3878%    o wand: the magick wand.
3879%
3880%    o minima:  The minimum pixel value for the specified channel(s).
3881%
3882%    o maxima:  The maximum pixel value for the specified channel(s).
3883%
3884*/
3885WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3886  double *minima,double *maxima)
3887{
3888  MagickBooleanType
3889    status;
3890
3891  assert(wand != (MagickWand *) NULL);
3892  assert(wand->signature == WandSignature);
3893  if (wand->debug != MagickFalse)
3894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3895  if (wand->images == (Image *) NULL)
3896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3897  status=GetImageRange(wand->images,minima,maxima,wand->exception);
3898  return(status);
3899}
3900
3901/*
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903%                                                                             %
3904%                                                                             %
3905%                                                                             %
3906%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3907%                                                                             %
3908%                                                                             %
3909%                                                                             %
3910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3911%
3912%  MagickGetImageStatistics() returns statistics for each channel in the
3913%  image.  The statistics include the channel depth, its minima and
3914%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3915%  You can access the red channel mean, for example, like this:
3916%
3917%      channel_statistics=MagickGetImageStatistics(wand);
3918%      red_mean=channel_statistics[RedChannel].mean;
3919%
3920%  Use MagickRelinquishMemory() to free the statistics buffer.
3921%
3922%  The format of the MagickGetImageStatistics method is:
3923%
3924%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3925%
3926%  A description of each parameter follows:
3927%
3928%    o wand: the magick wand.
3929%
3930*/
3931WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3932{
3933  assert(wand != (MagickWand *) NULL);
3934  assert(wand->signature == WandSignature);
3935  if (wand->debug != MagickFalse)
3936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3937  if (wand->images == (Image *) NULL)
3938    {
3939      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3940        "ContainsNoImages","`%s'",wand->name);
3941      return((ChannelStatistics *) NULL);
3942    }
3943  return(GetImageStatistics(wand->images,wand->exception));
3944}
3945
3946/*
3947%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948%                                                                             %
3949%                                                                             %
3950%                                                                             %
3951%   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                     %
3952%                                                                             %
3953%                                                                             %
3954%                                                                             %
3955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3956%
3957%  MagickGetImageColormapColor() returns the color of the specified colormap
3958%  index.
3959%
3960%  The format of the MagickGetImageColormapColor method is:
3961%
3962%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3963%        const size_t index,PixelWand *color)
3964%
3965%  A description of each parameter follows:
3966%
3967%    o wand: the magick wand.
3968%
3969%    o index: the offset into the image colormap.
3970%
3971%    o color: Return the colormap color in this wand.
3972%
3973*/
3974WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3975  const size_t index,PixelWand *color)
3976{
3977  assert(wand != (MagickWand *) NULL);
3978  assert(wand->signature == WandSignature);
3979  if (wand->debug != MagickFalse)
3980    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3981  if (wand->images == (Image *) NULL)
3982    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3983  if ((wand->images->colormap == (PixelPacket *) NULL) ||
3984      (index >= wand->images->colors))
3985    {
3986      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3987        "InvalidColormapIndex","`%s'",wand->name);
3988      return(MagickFalse);
3989    }
3990  PixelSetQuantumPacket(color,wand->images->colormap+index);
3991  return(MagickTrue);
3992}
3993
3994/*
3995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3996%                                                                             %
3997%                                                                             %
3998%                                                                             %
3999%   M a g i c k G e t I m a g e C o l o r s                                   %
4000%                                                                             %
4001%                                                                             %
4002%                                                                             %
4003%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4004%
4005%  MagickGetImageColors() gets the number of unique colors in the image.
4006%
4007%  The format of the MagickGetImageColors method is:
4008%
4009%      size_t MagickGetImageColors(MagickWand *wand)
4010%
4011%  A description of each parameter follows:
4012%
4013%    o wand: the magick wand.
4014%
4015*/
4016WandExport size_t MagickGetImageColors(MagickWand *wand)
4017{
4018  assert(wand != (MagickWand *) NULL);
4019  assert(wand->signature == WandSignature);
4020  if (wand->debug != MagickFalse)
4021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4022  if (wand->images == (Image *) NULL)
4023    {
4024      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4025        "ContainsNoImages","`%s'",wand->name);
4026      return(0);
4027    }
4028  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4029}
4030
4031/*
4032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4033%                                                                             %
4034%                                                                             %
4035%                                                                             %
4036%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4037%                                                                             %
4038%                                                                             %
4039%                                                                             %
4040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4041%
4042%  MagickGetImageColorspace() gets the image colorspace.
4043%
4044%  The format of the MagickGetImageColorspace method is:
4045%
4046%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4047%
4048%  A description of each parameter follows:
4049%
4050%    o wand: the magick wand.
4051%
4052*/
4053WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4054{
4055  assert(wand != (MagickWand *) NULL);
4056  assert(wand->signature == WandSignature);
4057  if (wand->debug != MagickFalse)
4058    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4059  if (wand->images == (Image *) NULL)
4060    {
4061      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4062        "ContainsNoImages","`%s'",wand->name);
4063      return(UndefinedColorspace);
4064    }
4065  return(wand->images->colorspace);
4066}
4067
4068/*
4069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4070%                                                                             %
4071%                                                                             %
4072%                                                                             %
4073%   M a g i c k G e t I m a g e C o m p o s e                                 %
4074%                                                                             %
4075%                                                                             %
4076%                                                                             %
4077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4078%
4079%  MagickGetImageCompose() returns the composite operator associated with the
4080%  image.
4081%
4082%  The format of the MagickGetImageCompose method is:
4083%
4084%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4085%
4086%  A description of each parameter follows:
4087%
4088%    o wand: the magick wand.
4089%
4090*/
4091WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4092{
4093  assert(wand != (MagickWand *) NULL);
4094  assert(wand->signature == WandSignature);
4095  if (wand->debug != MagickFalse)
4096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4097  if (wand->images == (Image *) NULL)
4098    {
4099      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4100        "ContainsNoImages","`%s'",wand->name);
4101      return(UndefinedCompositeOp);
4102    }
4103  return(wand->images->compose);
4104}
4105
4106/*
4107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4108%                                                                             %
4109%                                                                             %
4110%                                                                             %
4111%   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                         %
4112%                                                                             %
4113%                                                                             %
4114%                                                                             %
4115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4116%
4117%  MagickGetImageCompression() gets the image compression.
4118%
4119%  The format of the MagickGetImageCompression method is:
4120%
4121%      CompressionType MagickGetImageCompression(MagickWand *wand)
4122%
4123%  A description of each parameter follows:
4124%
4125%    o wand: the magick wand.
4126%
4127*/
4128WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4129{
4130  assert(wand != (MagickWand *) NULL);
4131  assert(wand->signature == WandSignature);
4132  if (wand->debug != MagickFalse)
4133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4134  if (wand->images == (Image *) NULL)
4135    {
4136      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4137        "ContainsNoImages","`%s'",wand->name);
4138      return(UndefinedCompression);
4139    }
4140  return(wand->images->compression);
4141}
4142
4143/*
4144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4145%                                                                             %
4146%                                                                             %
4147%                                                                             %
4148%   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           %
4149%                                                                             %
4150%                                                                             %
4151%                                                                             %
4152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4153%
4154%  MagickGetImageCompression() gets the image compression quality.
4155%
4156%  The format of the MagickGetImageCompression method is:
4157%
4158%      size_t MagickGetImageCompression(MagickWand *wand)
4159%
4160%  A description of each parameter follows:
4161%
4162%    o wand: the magick wand.
4163%
4164*/
4165WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4166{
4167  assert(wand != (MagickWand *) NULL);
4168  assert(wand->signature == WandSignature);
4169  if (wand->debug != MagickFalse)
4170    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4171  if (wand->images == (Image *) NULL)
4172    {
4173      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4174        "ContainsNoImages","`%s'",wand->name);
4175      return(0UL);
4176    }
4177  return(wand->images->quality);
4178}
4179
4180/*
4181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4182%                                                                             %
4183%                                                                             %
4184%                                                                             %
4185%   M a g i c k G e t I m a g e D e l a y                                     %
4186%                                                                             %
4187%                                                                             %
4188%                                                                             %
4189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4190%
4191%  MagickGetImageDelay() gets the image delay.
4192%
4193%  The format of the MagickGetImageDelay method is:
4194%
4195%      size_t MagickGetImageDelay(MagickWand *wand)
4196%
4197%  A description of each parameter follows:
4198%
4199%    o wand: the magick wand.
4200%
4201*/
4202WandExport size_t MagickGetImageDelay(MagickWand *wand)
4203{
4204  assert(wand != (MagickWand *) NULL);
4205  assert(wand->signature == WandSignature);
4206  if (wand->debug != MagickFalse)
4207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4208  if (wand->images == (Image *) NULL)
4209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4210  return(wand->images->delay);
4211}
4212
4213/*
4214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4215%                                                                             %
4216%                                                                             %
4217%                                                                             %
4218%   M a g i c k G e t I m a g e D e p t h                                     %
4219%                                                                             %
4220%                                                                             %
4221%                                                                             %
4222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4223%
4224%  MagickGetImageDepth() gets the image depth.
4225%
4226%  The format of the MagickGetImageDepth method is:
4227%
4228%      size_t MagickGetImageDepth(MagickWand *wand)
4229%
4230%  A description of each parameter follows:
4231%
4232%    o wand: the magick wand.
4233%
4234*/
4235WandExport size_t MagickGetImageDepth(MagickWand *wand)
4236{
4237  assert(wand != (MagickWand *) NULL);
4238  assert(wand->signature == WandSignature);
4239  if (wand->debug != MagickFalse)
4240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4241  if (wand->images == (Image *) NULL)
4242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4243  return(GetImageDepth(wand->images,wand->exception));
4244}
4245
4246/*
4247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4248%                                                                             %
4249%                                                                             %
4250%                                                                             %
4251%   M a g i c k G e t I m a g e D i s p o s e                                 %
4252%                                                                             %
4253%                                                                             %
4254%                                                                             %
4255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4256%
4257%  MagickGetImageDispose() gets the image disposal method.
4258%
4259%  The format of the MagickGetImageDispose method is:
4260%
4261%      DisposeType MagickGetImageDispose(MagickWand *wand)
4262%
4263%  A description of each parameter follows:
4264%
4265%    o wand: the magick wand.
4266%
4267*/
4268WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4269{
4270  assert(wand != (MagickWand *) NULL);
4271  assert(wand->signature == WandSignature);
4272  if (wand->debug != MagickFalse)
4273    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4274  if (wand->images == (Image *) NULL)
4275    {
4276      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4277        "ContainsNoImages","`%s'",wand->name);
4278      return(UndefinedDispose);
4279    }
4280  return((DisposeType) wand->images->dispose);
4281}
4282
4283/*
4284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4285%                                                                             %
4286%                                                                             %
4287%                                                                             %
4288%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4289%                                                                             %
4290%                                                                             %
4291%                                                                             %
4292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4293%
4294%  MagickGetImageDistortion() compares an image to a reconstructed image and
4295%  returns the specified distortion metric.
4296%
4297%  The format of the MagickGetImageDistortion method is:
4298%
4299%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4300%        const MagickWand *reference,const MetricType metric,
4301%        double *distortion)
4302%
4303%  A description of each parameter follows:
4304%
4305%    o wand: the magick wand.
4306%
4307%    o reference: the reference wand.
4308%
4309%    o metric: the metric.
4310%
4311%    o distortion: the computed distortion between the images.
4312%
4313*/
4314WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4315  const MagickWand *reference,const MetricType metric,double *distortion)
4316{
4317  MagickBooleanType
4318    status;
4319
4320  assert(wand != (MagickWand *) NULL);
4321  assert(wand->signature == WandSignature);
4322  if (wand->debug != MagickFalse)
4323    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4324  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4326  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4327    &wand->images->exception);
4328  return(status);
4329}
4330
4331/*
4332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4333%                                                                             %
4334%                                                                             %
4335%                                                                             %
4336%   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                         %
4337%                                                                             %
4338%                                                                             %
4339%                                                                             %
4340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4341%
4342%  MagickGetImageDistortions() compares one or more pixel channels of an
4343%  image to a reconstructed image and returns the specified distortion metrics.
4344%
4345%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4346%
4347%  The format of the MagickGetImageDistortion method is:
4348%
4349%      double *MagickGetImageDistortion(MagickWand *wand,
4350%        const MagickWand *reference,const MetricType metric)
4351%
4352%  A description of each parameter follows:
4353%
4354%    o wand: the magick wand.
4355%
4356%    o reference: the reference wand.
4357%
4358%    o metric: the metric.
4359%
4360*/
4361WandExport double *MagickGetImageDistortions(MagickWand *wand,
4362  const MagickWand *reference,const MetricType metric)
4363{
4364  double
4365    *channel_distortion;
4366
4367  assert(wand != (MagickWand *) NULL);
4368  assert(wand->signature == WandSignature);
4369  if (wand->debug != MagickFalse)
4370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4371  assert(reference != (MagickWand *) NULL);
4372  assert(reference->signature == WandSignature);
4373  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4374    {
4375      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4376        "ContainsNoImages","`%s'",wand->name);
4377      return((double *) NULL);
4378    }
4379  channel_distortion=GetImageDistortions(wand->images,reference->images,
4380    metric,&wand->images->exception);
4381  return(channel_distortion);
4382}
4383
4384/*
4385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4386%                                                                             %
4387%                                                                             %
4388%                                                                             %
4389%   M a g i c k G e t I m a g e F i l e n a m e                               %
4390%                                                                             %
4391%                                                                             %
4392%                                                                             %
4393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4394%
4395%  MagickGetImageFilename() returns the filename of a particular image in a
4396%  sequence.
4397%
4398%  The format of the MagickGetImageFilename method is:
4399%
4400%      char *MagickGetImageFilename(MagickWand *wand)
4401%
4402%  A description of each parameter follows:
4403%
4404%    o wand: the magick wand.
4405%
4406*/
4407WandExport char *MagickGetImageFilename(MagickWand *wand)
4408{
4409  assert(wand != (MagickWand *) NULL);
4410  assert(wand->signature == WandSignature);
4411  if (wand->debug != MagickFalse)
4412    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4413  if (wand->images == (Image *) NULL)
4414    {
4415      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4416        "ContainsNoImages","`%s'",wand->name);
4417      return((char *) NULL);
4418    }
4419  return(AcquireString(wand->images->filename));
4420}
4421
4422/*
4423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4424%                                                                             %
4425%                                                                             %
4426%                                                                             %
4427%   M a g i c k G e t I m a g e F o r m a t                                   %
4428%                                                                             %
4429%                                                                             %
4430%                                                                             %
4431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4432%
4433%  MagickGetImageFormat() returns the format of a particular image in a
4434%  sequence.
4435%
4436%  The format of the MagickGetImageFormat method is:
4437%
4438%      const char *MagickGetImageFormat(MagickWand *wand)
4439%
4440%  A description of each parameter follows:
4441%
4442%    o wand: the magick wand.
4443%
4444*/
4445WandExport char *MagickGetImageFormat(MagickWand *wand)
4446{
4447  assert(wand != (MagickWand *) NULL);
4448  assert(wand->signature == WandSignature);
4449  if (wand->debug != MagickFalse)
4450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4451  if (wand->images == (Image *) NULL)
4452    {
4453      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4454        "ContainsNoImages","`%s'",wand->name);
4455      return((char *) NULL);
4456    }
4457  return(AcquireString(wand->images->magick));
4458}
4459
4460/*
4461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4462%                                                                             %
4463%                                                                             %
4464%                                                                             %
4465%   M a g i c k G e t I m a g e F u z z                                       %
4466%                                                                             %
4467%                                                                             %
4468%                                                                             %
4469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4470%
4471%  MagickGetImageFuzz() gets the image fuzz.
4472%
4473%  The format of the MagickGetImageFuzz method is:
4474%
4475%      double MagickGetImageFuzz(MagickWand *wand)
4476%
4477%  A description of each parameter follows:
4478%
4479%    o wand: the magick wand.
4480%
4481*/
4482WandExport double MagickGetImageFuzz(MagickWand *wand)
4483{
4484  assert(wand != (MagickWand *) NULL);
4485  assert(wand->signature == WandSignature);
4486  if (wand->debug != MagickFalse)
4487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4488  if (wand->images == (Image *) NULL)
4489    {
4490      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4491        "ContainsNoImages","`%s'",wand->name);
4492      return(0.0);
4493    }
4494  return(wand->images->fuzz);
4495}
4496
4497/*
4498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4499%                                                                             %
4500%                                                                             %
4501%                                                                             %
4502%   M a g i c k G e t I m a g e G a m m a                                     %
4503%                                                                             %
4504%                                                                             %
4505%                                                                             %
4506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4507%
4508%  MagickGetImageGamma() gets the image gamma.
4509%
4510%  The format of the MagickGetImageGamma method is:
4511%
4512%      double MagickGetImageGamma(MagickWand *wand)
4513%
4514%  A description of each parameter follows:
4515%
4516%    o wand: the magick wand.
4517%
4518*/
4519WandExport double MagickGetImageGamma(MagickWand *wand)
4520{
4521  assert(wand != (MagickWand *) NULL);
4522  assert(wand->signature == WandSignature);
4523  if (wand->debug != MagickFalse)
4524    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4525  if (wand->images == (Image *) NULL)
4526    {
4527      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4528        "ContainsNoImages","`%s'",wand->name);
4529      return(0.0);
4530    }
4531  return(wand->images->gamma);
4532}
4533
4534/*
4535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4536%                                                                             %
4537%                                                                             %
4538%                                                                             %
4539%   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                 %
4540%                                                                             %
4541%                                                                             %
4542%                                                                             %
4543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4544%
4545%  MagickGetImageGravity() gets the image gravity.
4546%
4547%  The format of the MagickGetImageGravity method is:
4548%
4549%      GravityType MagickGetImageGravity(MagickWand *wand)
4550%
4551%  A description of each parameter follows:
4552%
4553%    o wand: the magick wand.
4554%
4555*/
4556WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4557{
4558  assert(wand != (MagickWand *) NULL);
4559  assert(wand->signature == WandSignature);
4560  if (wand->debug != MagickFalse)
4561    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4562  if (wand->images == (Image *) NULL)
4563    {
4564      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4565        "ContainsNoImages","`%s'",wand->name);
4566      return(UndefinedGravity);
4567    }
4568  return(wand->images->gravity);
4569}
4570
4571/*
4572%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4573%                                                                             %
4574%                                                                             %
4575%                                                                             %
4576%   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                       %
4577%                                                                             %
4578%                                                                             %
4579%                                                                             %
4580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4581%
4582%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4583%
4584%  The format of the MagickGetImageGreenPrimary method is:
4585%
4586%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4587%        double *y)
4588%
4589%  A description of each parameter follows:
4590%
4591%    o wand: the magick wand.
4592%
4593%    o x: the chromaticity green primary x-point.
4594%
4595%    o y: the chromaticity green primary y-point.
4596%
4597*/
4598WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4599  double *x,double *y)
4600{
4601  assert(wand != (MagickWand *) NULL);
4602  assert(wand->signature == WandSignature);
4603  if (wand->debug != MagickFalse)
4604    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4605  if (wand->images == (Image *) NULL)
4606    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4607  *x=wand->images->chromaticity.green_primary.x;
4608  *y=wand->images->chromaticity.green_primary.y;
4609  return(MagickTrue);
4610}
4611
4612/*
4613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4614%                                                                             %
4615%                                                                             %
4616%                                                                             %
4617%   M a g i c k G e t I m a g e H e i g h t                                   %
4618%                                                                             %
4619%                                                                             %
4620%                                                                             %
4621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4622%
4623%  MagickGetImageHeight() returns the image height.
4624%
4625%  The format of the MagickGetImageHeight method is:
4626%
4627%      size_t MagickGetImageHeight(MagickWand *wand)
4628%
4629%  A description of each parameter follows:
4630%
4631%    o wand: the magick wand.
4632%
4633*/
4634WandExport size_t MagickGetImageHeight(MagickWand *wand)
4635{
4636  assert(wand != (MagickWand *) NULL);
4637  assert(wand->signature == WandSignature);
4638  if (wand->debug != MagickFalse)
4639    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4640  if (wand->images == (Image *) NULL)
4641    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4642  return(wand->images->rows);
4643}
4644
4645/*
4646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4647%                                                                             %
4648%                                                                             %
4649%                                                                             %
4650%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4651%                                                                             %
4652%                                                                             %
4653%                                                                             %
4654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4655%
4656%  MagickGetImageHistogram() returns the image histogram as an array of
4657%  PixelWand wands.
4658%
4659%  The format of the MagickGetImageHistogram method is:
4660%
4661%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4662%        size_t *number_colors)
4663%
4664%  A description of each parameter follows:
4665%
4666%    o wand: the magick wand.
4667%
4668%    o number_colors: the number of unique colors in the image and the number
4669%      of pixel wands returned.
4670%
4671*/
4672WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4673  size_t *number_colors)
4674{
4675  PixelPacket
4676    *histogram;
4677
4678  PixelWand
4679    **pixel_wands;
4680
4681  register ssize_t
4682    i;
4683
4684  assert(wand != (MagickWand *) NULL);
4685  assert(wand->signature == WandSignature);
4686  if (wand->debug != MagickFalse)
4687    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4688  if (wand->images == (Image *) NULL)
4689    {
4690      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4691        "ContainsNoImages","`%s'",wand->name);
4692      return((PixelWand **) NULL);
4693    }
4694  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4695  if (histogram == (PixelPacket *) NULL)
4696    return((PixelWand **) NULL);
4697  pixel_wands=NewPixelWands(*number_colors);
4698  for (i=0; i < (ssize_t) *number_colors; i++)
4699  {
4700    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4701    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4702  }
4703  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4704  return(pixel_wands);
4705}
4706
4707/*
4708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4709%                                                                             %
4710%                                                                             %
4711%                                                                             %
4712%   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                 %
4713%                                                                             %
4714%                                                                             %
4715%                                                                             %
4716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4717%
4718%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4719%
4720%  The format of the MagickGetImageInterlaceScheme method is:
4721%
4722%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4723%
4724%  A description of each parameter follows:
4725%
4726%    o wand: the magick wand.
4727%
4728*/
4729WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4730{
4731  assert(wand != (MagickWand *) NULL);
4732  assert(wand->signature == WandSignature);
4733  if (wand->debug != MagickFalse)
4734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4735  if (wand->images == (Image *) NULL)
4736    {
4737      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4738        "ContainsNoImages","`%s'",wand->name);
4739      return(UndefinedInterlace);
4740    }
4741  return(wand->images->interlace);
4742}
4743
4744/*
4745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4746%                                                                             %
4747%                                                                             %
4748%                                                                             %
4749%   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             %
4750%                                                                             %
4751%                                                                             %
4752%                                                                             %
4753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4754%
4755%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4756%  sepcified image.
4757%
4758%  The format of the MagickGetImageInterpolateMethod method is:
4759%
4760%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4761%
4762%  A description of each parameter follows:
4763%
4764%    o wand: the magick wand.
4765%
4766*/
4767WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4768  MagickWand *wand)
4769{
4770  assert(wand != (MagickWand *) NULL);
4771  assert(wand->signature == WandSignature);
4772  if (wand->debug != MagickFalse)
4773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4774  if (wand->images == (Image *) NULL)
4775    {
4776      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4777        "ContainsNoImages","`%s'",wand->name);
4778      return(UndefinedInterpolatePixel);
4779    }
4780  return(wand->images->interpolate);
4781}
4782
4783/*
4784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4785%                                                                             %
4786%                                                                             %
4787%                                                                             %
4788%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4789%                                                                             %
4790%                                                                             %
4791%                                                                             %
4792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4793%
4794%  MagickGetImageIterations() gets the image iterations.
4795%
4796%  The format of the MagickGetImageIterations method is:
4797%
4798%      size_t MagickGetImageIterations(MagickWand *wand)
4799%
4800%  A description of each parameter follows:
4801%
4802%    o wand: the magick wand.
4803%
4804*/
4805WandExport size_t MagickGetImageIterations(MagickWand *wand)
4806{
4807  assert(wand != (MagickWand *) NULL);
4808  assert(wand->signature == WandSignature);
4809  if (wand->debug != MagickFalse)
4810    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4811  if (wand->images == (Image *) NULL)
4812    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4813  return(wand->images->iterations);
4814}
4815
4816/*
4817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4818%                                                                             %
4819%                                                                             %
4820%                                                                             %
4821%   M a g i c k G e t I m a g e L e n g t h                                   %
4822%                                                                             %
4823%                                                                             %
4824%                                                                             %
4825%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4826%
4827%  MagickGetImageLength() returns the image length in bytes.
4828%
4829%  The format of the MagickGetImageLength method is:
4830%
4831%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4832%        MagickSizeType *length)
4833%
4834%  A description of each parameter follows:
4835%
4836%    o wand: the magick wand.
4837%
4838%    o length: the image length in bytes.
4839%
4840*/
4841WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4842  MagickSizeType *length)
4843{
4844  assert(wand != (MagickWand *) NULL);
4845  assert(wand->signature == WandSignature);
4846  if (wand->debug != MagickFalse)
4847    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4848  if (wand->images == (Image *) NULL)
4849    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4850  *length=GetBlobSize(wand->images);
4851  return(MagickTrue);
4852}
4853
4854/*
4855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4856%                                                                             %
4857%                                                                             %
4858%                                                                             %
4859%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4860%                                                                             %
4861%                                                                             %
4862%                                                                             %
4863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4864%
4865%  MagickGetImageMatteColor() returns the image matte color.
4866%
4867%  The format of the MagickGetImageMatteColor method is:
4868%
4869%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4870%        PixelWand *matte_color)
4871%
4872%  A description of each parameter follows:
4873%
4874%    o wand: the magick wand.
4875%
4876%    o matte_color: Return the matte color.
4877%
4878*/
4879WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4880  PixelWand *matte_color)
4881{
4882  assert(wand != (MagickWand *) NULL);
4883  assert(wand->signature == WandSignature);
4884  if (wand->debug != MagickFalse)
4885    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4886  if (wand->images == (Image *) NULL)
4887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4888  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4889  return(MagickTrue);
4890}
4891
4892/*
4893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4894%                                                                             %
4895%                                                                             %
4896%                                                                             %
4897%   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                         %
4898%                                                                             %
4899%                                                                             %
4900%                                                                             %
4901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4902%
4903%  MagickGetImageOrientation() returns the image orientation.
4904%
4905%  The format of the MagickGetImageOrientation method is:
4906%
4907%      OrientationType MagickGetImageOrientation(MagickWand *wand)
4908%
4909%  A description of each parameter follows:
4910%
4911%    o wand: the magick wand.
4912%
4913*/
4914WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4915{
4916  assert(wand != (MagickWand *) NULL);
4917  assert(wand->signature == WandSignature);
4918  if (wand->debug != MagickFalse)
4919    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4920  if (wand->images == (Image *) NULL)
4921    {
4922      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4923        "ContainsNoImages","`%s'",wand->name);
4924      return(UndefinedOrientation);
4925    }
4926  return(wand->images->orientation);
4927}
4928
4929/*
4930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4931%                                                                             %
4932%                                                                             %
4933%                                                                             %
4934%   M a g i c k G e t I m a g e P a g e                                       %
4935%                                                                             %
4936%                                                                             %
4937%                                                                             %
4938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4939%
4940%  MagickGetImagePage() returns the page geometry associated with the image.
4941%
4942%  The format of the MagickGetImagePage method is:
4943%
4944%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4945%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4946%
4947%  A description of each parameter follows:
4948%
4949%    o wand: the magick wand.
4950%
4951%    o width: the page width.
4952%
4953%    o height: the page height.
4954%
4955%    o x: the page x-offset.
4956%
4957%    o y: the page y-offset.
4958%
4959*/
4960WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4961  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4962{
4963  assert(wand != (const MagickWand *) NULL);
4964  assert(wand->signature == WandSignature);
4965  if (wand->debug != MagickFalse)
4966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4967  if (wand->images == (Image *) NULL)
4968    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4969  *width=wand->images->page.width;
4970  *height=wand->images->page.height;
4971  *x=wand->images->page.x;
4972  *y=wand->images->page.y;
4973  return(MagickTrue);
4974}
4975
4976/*
4977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4978%                                                                             %
4979%                                                                             %
4980%                                                                             %
4981%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4982%                                                                             %
4983%                                                                             %
4984%                                                                             %
4985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4986%
4987%  MagickGetImagePixelColor() returns the color of the specified pixel.
4988%
4989%  The format of the MagickGetImagePixelColor method is:
4990%
4991%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
4992%        const ssize_t x,const ssize_t y,PixelWand *color)
4993%
4994%  A description of each parameter follows:
4995%
4996%    o wand: the magick wand.
4997%
4998%    o x,y: the pixel offset into the image.
4999%
5000%    o color: Return the colormap color in this wand.
5001%
5002*/
5003WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5004  const ssize_t x,const ssize_t y,PixelWand *color)
5005{
5006  register const Quantum
5007    *p;
5008
5009  CacheView
5010    *image_view;
5011
5012  assert(wand != (MagickWand *) NULL);
5013  assert(wand->signature == WandSignature);
5014  if (wand->debug != MagickFalse)
5015    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5016  if (wand->images == (Image *) NULL)
5017    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5018  image_view=AcquireCacheView(wand->images);
5019  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5020  if (p == (const Quantum *) NULL)
5021    {
5022      image_view=DestroyCacheView(image_view);
5023      return(MagickFalse);
5024    }
5025  PixelSetQuantumPixel(wand->images,p,color);
5026  image_view=DestroyCacheView(image_view);
5027  return(MagickTrue);
5028}
5029
5030/*
5031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5032%                                                                             %
5033%                                                                             %
5034%                                                                             %
5035%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5036%                                                                             %
5037%                                                                             %
5038%                                                                             %
5039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5040%
5041%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5042%
5043%  The format of the MagickGetImageRedPrimary method is:
5044%
5045%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5046%        double *y)
5047%
5048%  A description of each parameter follows:
5049%
5050%    o wand: the magick wand.
5051%
5052%    o x: the chromaticity red primary x-point.
5053%
5054%    o y: the chromaticity red primary y-point.
5055%
5056*/
5057WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5058  double *x,double *y)
5059{
5060  assert(wand != (MagickWand *) NULL);
5061  assert(wand->signature == WandSignature);
5062  if (wand->debug != MagickFalse)
5063    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5064  if (wand->images == (Image *) NULL)
5065    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5066  *x=wand->images->chromaticity.red_primary.x;
5067  *y=wand->images->chromaticity.red_primary.y;
5068  return(MagickTrue);
5069}
5070
5071/*
5072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5073%                                                                             %
5074%                                                                             %
5075%                                                                             %
5076%   M a g i c k G e t I m a g e R e g i o n                                   %
5077%                                                                             %
5078%                                                                             %
5079%                                                                             %
5080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081%
5082%  MagickGetImageRegion() extracts a region of the image and returns it as a
5083%  a new wand.
5084%
5085%  The format of the MagickGetImageRegion method is:
5086%
5087%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5088%        const size_t width,const size_t height,const ssize_t x,
5089%        const ssize_t y)
5090%
5091%  A description of each parameter follows:
5092%
5093%    o wand: the magick wand.
5094%
5095%    o width: the region width.
5096%
5097%    o height: the region height.
5098%
5099%    o x: the region x offset.
5100%
5101%    o y: the region y offset.
5102%
5103*/
5104WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5105  const size_t width,const size_t height,const ssize_t x,
5106  const ssize_t y)
5107{
5108  Image
5109    *region_image;
5110
5111  RectangleInfo
5112    region;
5113
5114  assert(wand != (MagickWand *) NULL);
5115  assert(wand->signature == WandSignature);
5116  if (wand->debug != MagickFalse)
5117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5118  if (wand->images == (Image *) NULL)
5119    return((MagickWand *) NULL);
5120  region.width=width;
5121  region.height=height;
5122  region.x=x;
5123  region.y=y;
5124  region_image=CropImage(wand->images,&region,wand->exception);
5125  if (region_image == (Image *) NULL)
5126    return((MagickWand *) NULL);
5127  return(CloneMagickWandFromImages(wand,region_image));
5128}
5129
5130/*
5131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5132%                                                                             %
5133%                                                                             %
5134%                                                                             %
5135%   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                 %
5136%                                                                             %
5137%                                                                             %
5138%                                                                             %
5139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5140%
5141%  MagickGetImageRenderingIntent() gets the image rendering intent.
5142%
5143%  The format of the MagickGetImageRenderingIntent method is:
5144%
5145%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5146%
5147%  A description of each parameter follows:
5148%
5149%    o wand: the magick wand.
5150%
5151*/
5152WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5153{
5154  assert(wand != (MagickWand *) NULL);
5155  assert(wand->signature == WandSignature);
5156  if (wand->debug != MagickFalse)
5157    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5158  if (wand->images == (Image *) NULL)
5159    {
5160      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5161        "ContainsNoImages","`%s'",wand->name);
5162      return(UndefinedIntent);
5163    }
5164  return((RenderingIntent) wand->images->rendering_intent);
5165}
5166
5167/*
5168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5169%                                                                             %
5170%                                                                             %
5171%                                                                             %
5172%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5173%                                                                             %
5174%                                                                             %
5175%                                                                             %
5176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5177%
5178%  MagickGetImageResolution() gets the image X and Y resolution.
5179%
5180%  The format of the MagickGetImageResolution method is:
5181%
5182%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5183%        double *y)
5184%
5185%  A description of each parameter follows:
5186%
5187%    o wand: the magick wand.
5188%
5189%    o x: the image x-resolution.
5190%
5191%    o y: the image y-resolution.
5192%
5193*/
5194WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5195  double *x,double *y)
5196{
5197  assert(wand != (MagickWand *) NULL);
5198  assert(wand->signature == WandSignature);
5199  if (wand->debug != MagickFalse)
5200    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5201  if (wand->images == (Image *) NULL)
5202    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5203  *x=wand->images->x_resolution;
5204  *y=wand->images->y_resolution;
5205  return(MagickTrue);
5206}
5207
5208/*
5209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5210%                                                                             %
5211%                                                                             %
5212%                                                                             %
5213%   M a g i c k G e t I m a g e S c e n e                                     %
5214%                                                                             %
5215%                                                                             %
5216%                                                                             %
5217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5218%
5219%  MagickGetImageScene() gets the image scene.
5220%
5221%  The format of the MagickGetImageScene method is:
5222%
5223%      size_t MagickGetImageScene(MagickWand *wand)
5224%
5225%  A description of each parameter follows:
5226%
5227%    o wand: the magick wand.
5228%
5229*/
5230WandExport size_t MagickGetImageScene(MagickWand *wand)
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  return(wand->images->scene);
5239}
5240
5241/*
5242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5243%                                                                             %
5244%                                                                             %
5245%                                                                             %
5246%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5247%                                                                             %
5248%                                                                             %
5249%                                                                             %
5250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5251%
5252%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5253%  pixel stream.
5254%
5255%  The format of the MagickGetImageSignature method is:
5256%
5257%      const char MagickGetImageSignature(MagickWand *wand)
5258%
5259%  A description of each parameter follows:
5260%
5261%    o wand: the magick wand.
5262%
5263*/
5264WandExport char *MagickGetImageSignature(MagickWand *wand)
5265{
5266  const char
5267    *value;
5268
5269  MagickBooleanType
5270    status;
5271
5272  assert(wand != (MagickWand *) NULL);
5273  assert(wand->signature == WandSignature);
5274  if (wand->debug != MagickFalse)
5275    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5276  if (wand->images == (Image *) NULL)
5277    {
5278      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5279        "ContainsNoImages","`%s'",wand->name);
5280      return((char *) NULL);
5281    }
5282  status=SignatureImage(wand->images,wand->exception);
5283  if (status == MagickFalse)
5284    return((char *) NULL);
5285  value=GetImageProperty(wand->images,"signature");
5286  if (value == (const char *) NULL)
5287    return((char *) NULL);
5288  return(AcquireString(value));
5289}
5290
5291/*
5292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5293%                                                                             %
5294%                                                                             %
5295%                                                                             %
5296%   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                   %
5297%                                                                             %
5298%                                                                             %
5299%                                                                             %
5300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5301%
5302%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5303%
5304%  The format of the MagickGetImageTicksPerSecond method is:
5305%
5306%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5307%
5308%  A description of each parameter follows:
5309%
5310%    o wand: the magick wand.
5311%
5312*/
5313WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5314{
5315  assert(wand != (MagickWand *) NULL);
5316  assert(wand->signature == WandSignature);
5317  if (wand->debug != MagickFalse)
5318    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5319  if (wand->images == (Image *) NULL)
5320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5321  return((size_t) wand->images->ticks_per_second);
5322}
5323
5324/*
5325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5326%                                                                             %
5327%                                                                             %
5328%                                                                             %
5329%   M a g i c k G e t I m a g e T y p e                                       %
5330%                                                                             %
5331%                                                                             %
5332%                                                                             %
5333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5334%
5335%  MagickGetImageType() gets the potential image type:
5336%
5337%        Bilevel        Grayscale       GrayscaleMatte
5338%        Palette        PaletteMatte    TrueColor
5339%        TrueColorMatte ColorSeparation ColorSeparationMatte
5340%
5341%  To ensure the image type matches its potential, use MagickSetImageType():
5342%
5343%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5344%
5345%  The format of the MagickGetImageType method is:
5346%
5347%      ImageType MagickGetImageType(MagickWand *wand)
5348%
5349%  A description of each parameter follows:
5350%
5351%    o wand: the magick wand.
5352%
5353*/
5354WandExport ImageType MagickGetImageType(MagickWand *wand)
5355{
5356  assert(wand != (MagickWand *) NULL);
5357  assert(wand->signature == WandSignature);
5358  if (wand->debug != MagickFalse)
5359    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5360  if (wand->images == (Image *) NULL)
5361    {
5362      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5363        "ContainsNoImages","`%s'",wand->name);
5364      return(UndefinedType);
5365    }
5366  return(GetImageType(wand->images,wand->exception));
5367}
5368
5369/*
5370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5371%                                                                             %
5372%                                                                             %
5373%                                                                             %
5374%   M a g i c k G e t I m a g e U n i t s                                     %
5375%                                                                             %
5376%                                                                             %
5377%                                                                             %
5378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5379%
5380%  MagickGetImageUnits() gets the image units of resolution.
5381%
5382%  The format of the MagickGetImageUnits method is:
5383%
5384%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5385%
5386%  A description of each parameter follows:
5387%
5388%    o wand: the magick wand.
5389%
5390*/
5391WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5392{
5393  assert(wand != (MagickWand *) NULL);
5394  assert(wand->signature == WandSignature);
5395  if (wand->debug != MagickFalse)
5396    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5397  if (wand->images == (Image *) NULL)
5398    {
5399      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5400        "ContainsNoImages","`%s'",wand->name);
5401      return(UndefinedResolution);
5402    }
5403  return(wand->images->units);
5404}
5405
5406/*
5407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5408%                                                                             %
5409%                                                                             %
5410%                                                                             %
5411%   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           %
5412%                                                                             %
5413%                                                                             %
5414%                                                                             %
5415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5416%
5417%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5418%  sepcified image.
5419%
5420%  The format of the MagickGetImageVirtualPixelMethod method is:
5421%
5422%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5423%
5424%  A description of each parameter follows:
5425%
5426%    o wand: the magick wand.
5427%
5428*/
5429WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5430{
5431  assert(wand != (MagickWand *) NULL);
5432  assert(wand->signature == WandSignature);
5433  if (wand->debug != MagickFalse)
5434    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5435  if (wand->images == (Image *) NULL)
5436    {
5437      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5438        "ContainsNoImages","`%s'",wand->name);
5439      return(UndefinedVirtualPixelMethod);
5440    }
5441  return(GetImageVirtualPixelMethod(wand->images));
5442}
5443
5444/*
5445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5446%                                                                             %
5447%                                                                             %
5448%                                                                             %
5449%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5450%                                                                             %
5451%                                                                             %
5452%                                                                             %
5453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5454%
5455%  MagickGetImageWhitePoint() returns the chromaticy white point.
5456%
5457%  The format of the MagickGetImageWhitePoint method is:
5458%
5459%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5460%        double *y)
5461%
5462%  A description of each parameter follows:
5463%
5464%    o wand: the magick wand.
5465%
5466%    o x: the chromaticity white x-point.
5467%
5468%    o y: the chromaticity white y-point.
5469%
5470*/
5471WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5472  double *x,double *y)
5473{
5474  assert(wand != (MagickWand *) NULL);
5475  assert(wand->signature == WandSignature);
5476  if (wand->debug != MagickFalse)
5477    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5478  if (wand->images == (Image *) NULL)
5479    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5480  *x=wand->images->chromaticity.white_point.x;
5481  *y=wand->images->chromaticity.white_point.y;
5482  return(MagickTrue);
5483}
5484
5485/*
5486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5487%                                                                             %
5488%                                                                             %
5489%                                                                             %
5490%   M a g i c k G e t I m a g e W i d t h                                     %
5491%                                                                             %
5492%                                                                             %
5493%                                                                             %
5494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5495%
5496%  MagickGetImageWidth() returns the image width.
5497%
5498%  The format of the MagickGetImageWidth method is:
5499%
5500%      size_t MagickGetImageWidth(MagickWand *wand)
5501%
5502%  A description of each parameter follows:
5503%
5504%    o wand: the magick wand.
5505%
5506*/
5507WandExport size_t MagickGetImageWidth(MagickWand *wand)
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  return(wand->images->columns);
5516}
5517
5518/*
5519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5520%                                                                             %
5521%                                                                             %
5522%                                                                             %
5523%   M a g i c k G e t N u m b e r I m a g e s                                 %
5524%                                                                             %
5525%                                                                             %
5526%                                                                             %
5527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5528%
5529%  MagickGetNumberImages() returns the number of images associated with a
5530%  magick wand.
5531%
5532%  The format of the MagickGetNumberImages method is:
5533%
5534%      size_t MagickGetNumberImages(MagickWand *wand)
5535%
5536%  A description of each parameter follows:
5537%
5538%    o wand: the magick wand.
5539%
5540*/
5541WandExport size_t MagickGetNumberImages(MagickWand *wand)
5542{
5543  assert(wand != (MagickWand *) NULL);
5544  assert(wand->signature == WandSignature);
5545  if (wand->debug != MagickFalse)
5546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5547  return(GetImageListLength(wand->images));
5548}
5549
5550/*
5551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5552%                                                                             %
5553%                                                                             %
5554%                                                                             %
5555%   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                 %
5556%                                                                             %
5557%                                                                             %
5558%                                                                             %
5559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5560%
5561%  MagickGetImageTotalInkDensity() gets the image total ink density.
5562%
5563%  The format of the MagickGetImageTotalInkDensity method is:
5564%
5565%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5566%
5567%  A description of each parameter follows:
5568%
5569%    o wand: the magick wand.
5570%
5571*/
5572WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5573{
5574  assert(wand != (MagickWand *) NULL);
5575  assert(wand->signature == WandSignature);
5576  if (wand->debug != MagickFalse)
5577    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5578  if (wand->images == (Image *) NULL)
5579    {
5580      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5581        "ContainsNoImages","`%s'",wand->name);
5582      return(0.0);
5583    }
5584  return(GetImageTotalInkDensity(wand->images));
5585}
5586
5587/*
5588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5589%                                                                             %
5590%                                                                             %
5591%                                                                             %
5592%   M a g i c k H a l d C l u t I m a g e                                     %
5593%                                                                             %
5594%                                                                             %
5595%                                                                             %
5596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5597%
5598%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5599%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5600%  dimensions.  Create it with the HALD coder.  You can apply any color
5601%  transformation to the Hald image and then use this method to apply the
5602%  transform to the image.
5603%
5604%  The format of the MagickHaldClutImage method is:
5605%
5606%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5607%        const MagickWand *hald_wand)
5608%
5609%  A description of each parameter follows:
5610%
5611%    o wand: the magick wand.
5612%
5613%    o hald_image: the hald CLUT image.
5614%
5615*/
5616WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5617  const MagickWand *hald_wand)
5618{
5619  MagickBooleanType
5620    status;
5621
5622  assert(wand != (MagickWand *) NULL);
5623  assert(wand->signature == WandSignature);
5624  if (wand->debug != MagickFalse)
5625    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5626  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5627    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5628  status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5629  return(status);
5630}
5631
5632/*
5633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634%                                                                             %
5635%                                                                             %
5636%                                                                             %
5637%   M a g i c k H a s N e x t I m a g e                                       %
5638%                                                                             %
5639%                                                                             %
5640%                                                                             %
5641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642%
5643%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5644%  traversing the list in the forward direction
5645%
5646%  The format of the MagickHasNextImage method is:
5647%
5648%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5649%
5650%  A description of each parameter follows:
5651%
5652%    o wand: the magick wand.
5653%
5654*/
5655WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
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)
5662    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5663  if (GetNextImageInList(wand->images) == (Image *) NULL)
5664    return(MagickFalse);
5665  return(MagickTrue);
5666}
5667
5668/*
5669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5670%                                                                             %
5671%                                                                             %
5672%                                                                             %
5673%   M a g i c k H a s P r e v i o u s I m a g e                               %
5674%                                                                             %
5675%                                                                             %
5676%                                                                             %
5677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5678%
5679%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5680%  traversing the list in the reverse direction
5681%
5682%  The format of the MagickHasPreviousImage method is:
5683%
5684%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5685%
5686%  A description of each parameter follows:
5687%
5688%    o wand: the magick wand.
5689%
5690*/
5691WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5692{
5693  assert(wand != (MagickWand *) NULL);
5694  assert(wand->signature == WandSignature);
5695  if (wand->debug != MagickFalse)
5696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5697  if (wand->images == (Image *) NULL)
5698    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5699  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5700    return(MagickFalse);
5701  return(MagickTrue);
5702}
5703
5704/*
5705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5706%                                                                             %
5707%                                                                             %
5708%                                                                             %
5709%   M a g i c k I d e n t i f y I m a g e                                     %
5710%                                                                             %
5711%                                                                             %
5712%                                                                             %
5713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5714%
5715%  MagickIdentifyImage() identifies an image by printing its attributes to the
5716%  file.  Attributes include the image width, height, size, and others.
5717%
5718%  The format of the MagickIdentifyImage method is:
5719%
5720%      const char *MagickIdentifyImage(MagickWand *wand)
5721%
5722%  A description of each parameter follows:
5723%
5724%    o wand: the magick wand.
5725%
5726*/
5727WandExport char *MagickIdentifyImage(MagickWand *wand)
5728{
5729  char
5730    *description,
5731    filename[MaxTextExtent];
5732
5733  FILE
5734    *file;
5735
5736  int
5737    unique_file;
5738
5739  assert(wand != (MagickWand *) NULL);
5740  assert(wand->signature == WandSignature);
5741  if (wand->debug != MagickFalse)
5742    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5743  if (wand->images == (Image *) NULL)
5744    {
5745      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5746        "ContainsNoImages","`%s'",wand->name);
5747      return((char *) NULL);
5748    }
5749  description=(char *) NULL;
5750  unique_file=AcquireUniqueFileResource(filename);
5751  file=(FILE *) NULL;
5752  if (unique_file != -1)
5753    file=fdopen(unique_file,"wb");
5754  if ((unique_file == -1) || (file == (FILE *) NULL))
5755    {
5756      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5757        "UnableToCreateTemporaryFile","`%s'",wand->name);
5758      return((char *) NULL);
5759    }
5760  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5761  (void) fclose(file);
5762  description=FileToString(filename,~0,wand->exception);
5763  (void) RelinquishUniqueFileResource(filename);
5764  return(description);
5765}
5766
5767/*
5768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5769%                                                                             %
5770%                                                                             %
5771%                                                                             %
5772%   M a g i c k I m p l o d e I m a g e                                       %
5773%                                                                             %
5774%                                                                             %
5775%                                                                             %
5776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5777%
5778%  MagickImplodeImage() creates a new image that is a copy of an existing
5779%  one with the image pixels "implode" by the specified percentage.  It
5780%  allocates the memory necessary for the new Image structure and returns a
5781%  pointer to the new image.
5782%
5783%  The format of the MagickImplodeImage method is:
5784%
5785%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5786%        const double radius)
5787%
5788%  A description of each parameter follows:
5789%
5790%    o wand: the magick wand.
5791%
5792%    o amount: Define the extent of the implosion.
5793%
5794*/
5795WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5796  const double amount)
5797{
5798  Image
5799    *implode_image;
5800
5801  assert(wand != (MagickWand *) NULL);
5802  assert(wand->signature == WandSignature);
5803  if (wand->debug != MagickFalse)
5804    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5805  if (wand->images == (Image *) NULL)
5806    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5807  implode_image=ImplodeImage(wand->images,amount,wand->exception);
5808  if (implode_image == (Image *) NULL)
5809    return(MagickFalse);
5810  ReplaceImageInList(&wand->images,implode_image);
5811  return(MagickTrue);
5812}
5813
5814/*
5815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5816%                                                                             %
5817%                                                                             %
5818%                                                                             %
5819%   M a g i c k I m p o r t I m a g e P i x e l s                             %
5820%                                                                             %
5821%                                                                             %
5822%                                                                             %
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824%
5825%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5826%  location you specify.  The method returns MagickFalse on success otherwise
5827%  MagickTrue if an error is encountered.  The pixel data can be either char,
5828%  short int, int, ssize_t, float, or double in the order specified by map.
5829%
5830%  Suppose your want to upload the first scanline of a 640x480 image from
5831%  character data in red-green-blue order:
5832%
5833%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5834%
5835%  The format of the MagickImportImagePixels method is:
5836%
5837%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5838%        const ssize_t x,const ssize_t y,const size_t columns,
5839%        const size_t rows,const char *map,const StorageType storage,
5840%        const void *pixels)
5841%
5842%  A description of each parameter follows:
5843%
5844%    o wand: the magick wand.
5845%
5846%    o x, y, columns, rows:  These values define the perimeter of a region
5847%      of pixels you want to define.
5848%
5849%    o map:  This string reflects the expected ordering of the pixel array.
5850%      It can be any combination or order of R = red, G = green, B = blue,
5851%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5852%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5853%      P = pad.
5854%
5855%    o storage: Define the data type of the pixels.  Float and double types are
5856%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5857%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5858%      or DoublePixel.
5859%
5860%    o pixels: This array of values contain the pixel components as defined by
5861%      map and type.  You must preallocate this array where the expected
5862%      length varies depending on the values of width, height, map, and type.
5863%
5864*/
5865WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5866  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5867  const char *map,const StorageType storage,const void *pixels)
5868{
5869  MagickBooleanType
5870    status;
5871
5872  assert(wand != (MagickWand *) NULL);
5873  assert(wand->signature == WandSignature);
5874  if (wand->debug != MagickFalse)
5875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5876  if (wand->images == (Image *) NULL)
5877    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5878  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5879    wand->exception);
5880  return(status);
5881}
5882
5883/*
5884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885%                                                                             %
5886%                                                                             %
5887%                                                                             %
5888%   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       %
5889%                                                                             %
5890%                                                                             %
5891%                                                                             %
5892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5893%
5894%  MagickInverseFourierTransformImage() implements the inverse discrete
5895%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5896%  imaginary image pair.
5897%
5898%  The format of the MagickInverseFourierTransformImage method is:
5899%
5900%      MagickBooleanType MagickInverseFourierTransformImage(
5901%        MagickWand *magnitude_wand,MagickWand *phase_wand,
5902%        const MagickBooleanType magnitude)
5903%
5904%  A description of each parameter follows:
5905%
5906%    o magnitude_wand: the magnitude or real wand.
5907%
5908%    o phase_wand: the phase or imaginary wand.
5909%
5910%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5911%      imaginary image pair.
5912%
5913*/
5914WandExport MagickBooleanType MagickInverseFourierTransformImage(
5915  MagickWand *magnitude_wand,MagickWand *phase_wand,
5916  const MagickBooleanType magnitude)
5917{
5918  Image
5919    *inverse_image;
5920
5921  MagickWand
5922    *wand;
5923
5924  assert(magnitude_wand != (MagickWand *) NULL);
5925  assert(magnitude_wand->signature == WandSignature);
5926  if (magnitude_wand->debug != MagickFalse)
5927    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5928      magnitude_wand->name);
5929  wand=magnitude_wand;
5930  if (magnitude_wand->images == (Image *) NULL)
5931    ThrowWandException(WandError,"ContainsNoImages",
5932      magnitude_wand->name);
5933  assert(phase_wand != (MagickWand *) NULL);
5934  assert(phase_wand->signature == WandSignature);
5935  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5936    phase_wand->images,magnitude,wand->exception);
5937  if (inverse_image == (Image *) NULL)
5938    return(MagickFalse);
5939  ReplaceImageInList(&wand->images,inverse_image);
5940  return(MagickTrue);
5941}
5942
5943/*
5944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5945%                                                                             %
5946%                                                                             %
5947%                                                                             %
5948%   M a g i c k L a b e l I m a g e                                           %
5949%                                                                             %
5950%                                                                             %
5951%                                                                             %
5952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5953%
5954%  MagickLabelImage() adds a label to your image.
5955%
5956%  The format of the MagickLabelImage method is:
5957%
5958%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5959%
5960%  A description of each parameter follows:
5961%
5962%    o wand: the magick wand.
5963%
5964%    o label: the image label.
5965%
5966*/
5967WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5968  const char *label)
5969{
5970  MagickBooleanType
5971    status;
5972
5973  assert(wand != (MagickWand *) NULL);
5974  assert(wand->signature == WandSignature);
5975  if (wand->debug != MagickFalse)
5976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5977  if (wand->images == (Image *) NULL)
5978    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5979  status=SetImageProperty(wand->images,"label",label);
5980  if (status == MagickFalse)
5981    InheritException(wand->exception,&wand->images->exception);
5982  return(status);
5983}
5984
5985/*
5986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5987%                                                                             %
5988%                                                                             %
5989%                                                                             %
5990%   M a g i c k L e v e l I m a g e                                           %
5991%                                                                             %
5992%                                                                             %
5993%                                                                             %
5994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5995%
5996%  MagickLevelImage() adjusts the levels of an image by scaling the colors
5997%  falling between specified white and black points to the full available
5998%  quantum range. The parameters provided represent the black, mid, and white
5999%  points. The black point specifies the darkest color in the image. Colors
6000%  darker than the black point are set to zero. Mid point specifies a gamma
6001%  correction to apply to the image.  White point specifies the lightest color
6002%  in the image. Colors brighter than the white point are set to the maximum
6003%  quantum value.
6004%
6005%  The format of the MagickLevelImage method is:
6006%
6007%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6008%        const double black_point,const double gamma,const double white_point)
6009%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6010%        const ChannelType channel,const double black_point,const double gamma,
6011%        const double white_point)
6012%
6013%  A description of each parameter follows:
6014%
6015%    o wand: the magick wand.
6016%
6017%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6018%
6019%    o black_point: the black point.
6020%
6021%    o gamma: the gamma.
6022%
6023%    o white_point: the white point.
6024%
6025*/
6026WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6027  const double black_point,const double gamma,const double white_point)
6028{
6029  MagickBooleanType
6030    status;
6031
6032  assert(wand != (MagickWand *) NULL);
6033  assert(wand->signature == WandSignature);
6034  if (wand->debug != MagickFalse)
6035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6036  if (wand->images == (Image *) NULL)
6037    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6038  status=LevelImage(wand->images,black_point,white_point,gamma,
6039    &wand->images->exception);
6040  return(status);
6041}
6042
6043/*
6044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6045%                                                                             %
6046%                                                                             %
6047%                                                                             %
6048%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6049%                                                                             %
6050%                                                                             %
6051%                                                                             %
6052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6053%
6054%  MagickLinearStretchImage() stretches with saturation the image intensity.
6055%
6056%  You can also reduce the influence of a particular channel with a gamma
6057%  value of 0.
6058%
6059%  The format of the MagickLinearStretchImage method is:
6060%
6061%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6062%        const double black_point,const double white_point)
6063%
6064%  A description of each parameter follows:
6065%
6066%    o wand: the magick wand.
6067%
6068%    o black_point: the black point.
6069%
6070%    o white_point: the white point.
6071%
6072*/
6073WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6074  const double black_point,const double white_point)
6075{
6076  MagickBooleanType
6077    status;
6078
6079  assert(wand != (MagickWand *) NULL);
6080  assert(wand->signature == WandSignature);
6081  if (wand->debug != MagickFalse)
6082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6083  if (wand->images == (Image *) NULL)
6084    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6085  status=LinearStretchImage(wand->images,black_point,white_point,
6086    &wand->images->exception);
6087  return(status);
6088}
6089
6090/*
6091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6092%                                                                             %
6093%                                                                             %
6094%                                                                             %
6095%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6096%                                                                             %
6097%                                                                             %
6098%                                                                             %
6099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6100%
6101%  MagickLiquidRescaleImage() rescales image with seam carving.
6102%
6103%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6104%        const size_t columns,const size_t rows,
6105%        const double delta_x,const double rigidity)
6106%
6107%  A description of each parameter follows:
6108%
6109%    o wand: the magick wand.
6110%
6111%    o columns: the number of columns in the scaled image.
6112%
6113%    o rows: the number of rows in the scaled image.
6114%
6115%    o delta_x: maximum seam transversal step (0 means straight seams).
6116%
6117%    o rigidity: introduce a bias for non-straight seams (typically 0).
6118%
6119*/
6120WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6121  const size_t columns,const size_t rows,const double delta_x,
6122  const double rigidity)
6123{
6124  Image
6125    *rescale_image;
6126
6127  assert(wand != (MagickWand *) NULL);
6128  assert(wand->signature == WandSignature);
6129  if (wand->debug != MagickFalse)
6130    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6131  if (wand->images == (Image *) NULL)
6132    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6133  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6134    rigidity,wand->exception);
6135  if (rescale_image == (Image *) NULL)
6136    return(MagickFalse);
6137  ReplaceImageInList(&wand->images,rescale_image);
6138  return(MagickTrue);
6139}
6140
6141/*
6142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6143%                                                                             %
6144%                                                                             %
6145%                                                                             %
6146%   M a g i c k M a g n i f y I m a g e                                       %
6147%                                                                             %
6148%                                                                             %
6149%                                                                             %
6150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6151%
6152%  MagickMagnifyImage() is a convenience method that scales an image
6153%  proportionally to twice its original size.
6154%
6155%  The format of the MagickMagnifyImage method is:
6156%
6157%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6158%
6159%  A description of each parameter follows:
6160%
6161%    o wand: the magick wand.
6162%
6163*/
6164WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6165{
6166  Image
6167    *magnify_image;
6168
6169  assert(wand != (MagickWand *) NULL);
6170  assert(wand->signature == WandSignature);
6171  if (wand->debug != MagickFalse)
6172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6173  if (wand->images == (Image *) NULL)
6174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6175  magnify_image=MagnifyImage(wand->images,wand->exception);
6176  if (magnify_image == (Image *) NULL)
6177    return(MagickFalse);
6178  ReplaceImageInList(&wand->images,magnify_image);
6179  return(MagickTrue);
6180}
6181
6182/*
6183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6184%                                                                             %
6185%                                                                             %
6186%                                                                             %
6187%   M a g i c k M e r g e I m a g e L a y e r s                               %
6188%                                                                             %
6189%                                                                             %
6190%                                                                             %
6191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6192%
6193%  MagickMergeImageLayers() composes all the image layers from the current
6194%  given image onward to produce a single image of the merged layers.
6195%
6196%  The inital canvas's size depends on the given ImageLayerMethod, and is
6197%  initialized using the first images background color.  The images
6198%  are then compositied onto that image in sequence using the given
6199%  composition that has been assigned to each individual image.
6200%
6201%  The format of the MagickMergeImageLayers method is:
6202%
6203%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6204%        const ImageLayerMethod method)
6205%
6206%  A description of each parameter follows:
6207%
6208%    o wand: the magick wand.
6209%
6210%    o method: the method of selecting the size of the initial canvas.
6211%
6212%        MergeLayer: Merge all layers onto a canvas just large enough
6213%           to hold all the actual images. The virtual canvas of the
6214%           first image is preserved but otherwise ignored.
6215%
6216%        FlattenLayer: Use the virtual canvas size of first image.
6217%           Images which fall outside this canvas is clipped.
6218%           This can be used to 'fill out' a given virtual canvas.
6219%
6220%        MosaicLayer: Start with the virtual canvas of the first image,
6221%           enlarging left and right edges to contain all images.
6222%           Images with negative offsets will be clipped.
6223%
6224*/
6225WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6226  const ImageLayerMethod method)
6227{
6228  Image
6229    *mosaic_image;
6230
6231  assert(wand != (MagickWand *) NULL);
6232  assert(wand->signature == WandSignature);
6233  if (wand->debug != MagickFalse)
6234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6235  if (wand->images == (Image *) NULL)
6236    return((MagickWand *) NULL);
6237  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6238  if (mosaic_image == (Image *) NULL)
6239    return((MagickWand *) NULL);
6240  return(CloneMagickWandFromImages(wand,mosaic_image));
6241}
6242
6243/*
6244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6245%                                                                             %
6246%                                                                             %
6247%                                                                             %
6248%   M a g i c k M i n i f y I m a g e                                         %
6249%                                                                             %
6250%                                                                             %
6251%                                                                             %
6252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6253%
6254%  MagickMinifyImage() is a convenience method that scales an image
6255%  proportionally to one-half its original size
6256%
6257%  The format of the MagickMinifyImage method is:
6258%
6259%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6260%
6261%  A description of each parameter follows:
6262%
6263%    o wand: the magick wand.
6264%
6265*/
6266WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6267{
6268  Image
6269    *minify_image;
6270
6271  assert(wand != (MagickWand *) NULL);
6272  assert(wand->signature == WandSignature);
6273  if (wand->debug != MagickFalse)
6274    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6275  if (wand->images == (Image *) NULL)
6276    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6277  minify_image=MinifyImage(wand->images,wand->exception);
6278  if (minify_image == (Image *) NULL)
6279    return(MagickFalse);
6280  ReplaceImageInList(&wand->images,minify_image);
6281  return(MagickTrue);
6282}
6283
6284/*
6285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6286%                                                                             %
6287%                                                                             %
6288%                                                                             %
6289%   M a g i c k M o d u l a t e I m a g e                                     %
6290%                                                                             %
6291%                                                                             %
6292%                                                                             %
6293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6294%
6295%  MagickModulateImage() lets you control the brightness, saturation, and hue
6296%  of an image.  Hue is the percentage of absolute rotation from the current
6297%  position.  For example 50 results in a counter-clockwise rotation of 90
6298%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6299%  both resulting in a rotation of 180 degrees.
6300%
6301%  To increase the color brightness by 20% and decrease the color saturation by
6302%  10% and leave the hue unchanged, use: 120,90,100.
6303%
6304%  The format of the MagickModulateImage method is:
6305%
6306%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6307%        const double brightness,const double saturation,const double hue)
6308%
6309%  A description of each parameter follows:
6310%
6311%    o wand: the magick wand.
6312%
6313%    o brightness: the percent change in brighness.
6314%
6315%    o saturation: the percent change in saturation.
6316%
6317%    o hue: the percent change in hue.
6318%
6319*/
6320WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6321  const double brightness,const double saturation,const double hue)
6322{
6323  char
6324    modulate[MaxTextExtent];
6325
6326  MagickBooleanType
6327    status;
6328
6329  assert(wand != (MagickWand *) NULL);
6330  assert(wand->signature == WandSignature);
6331  if (wand->debug != MagickFalse)
6332    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6333  if (wand->images == (Image *) NULL)
6334    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6335  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6336    brightness,saturation,hue);
6337  status=ModulateImage(wand->images,modulate,&wand->images->exception);
6338  return(status);
6339}
6340
6341/*
6342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6343%                                                                             %
6344%                                                                             %
6345%                                                                             %
6346%   M a g i c k M o n t a g e I m a g e                                       %
6347%                                                                             %
6348%                                                                             %
6349%                                                                             %
6350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6351%
6352%  MagickMontageImage() creates a composite image by combining several
6353%  separate images. The images are tiled on the composite image with the name
6354%  of the image optionally appearing just below the individual tile.
6355%
6356%  The format of the MagickMontageImage method is:
6357%
6358%      MagickWand *MagickMontageImage(MagickWand *wand,
6359%        const DrawingWand drawing_wand,const char *tile_geometry,
6360%        const char *thumbnail_geometry,const MontageMode mode,
6361%        const char *frame)
6362%
6363%  A description of each parameter follows:
6364%
6365%    o wand: the magick wand.
6366%
6367%    o drawing_wand: the drawing wand.  The font name, size, and color are
6368%      obtained from this wand.
6369%
6370%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6371%
6372%    o thumbnail_geometry: Preferred image size and border size of each
6373%      thumbnail (e.g. 120x120+4+3>).
6374%
6375%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6376%
6377%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6378%      The frame color is that of the thumbnail's matte color.
6379%
6380*/
6381WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6382  const DrawingWand *drawing_wand,const char *tile_geometry,
6383  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6384{
6385  char
6386    *font;
6387
6388  Image
6389    *montage_image;
6390
6391  MontageInfo
6392    *montage_info;
6393
6394  PixelWand
6395    *pixel_wand;
6396
6397  assert(wand != (MagickWand *) NULL);
6398  assert(wand->signature == WandSignature);
6399  if (wand->debug != MagickFalse)
6400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6401  if (wand->images == (Image *) NULL)
6402    return((MagickWand *) NULL);
6403  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6404  switch (mode)
6405  {
6406    case FrameMode:
6407    {
6408      (void) CloneString(&montage_info->frame,"15x15+3+3");
6409      montage_info->shadow=MagickTrue;
6410      break;
6411    }
6412    case UnframeMode:
6413    {
6414      montage_info->frame=(char *) NULL;
6415      montage_info->shadow=MagickFalse;
6416      montage_info->border_width=0;
6417      break;
6418    }
6419    case ConcatenateMode:
6420    {
6421      montage_info->frame=(char *) NULL;
6422      montage_info->shadow=MagickFalse;
6423      (void) CloneString(&montage_info->geometry,"+0+0");
6424      montage_info->border_width=0;
6425      break;
6426    }
6427    default:
6428      break;
6429  }
6430  font=DrawGetFont(drawing_wand);
6431  if (font != (char *) NULL)
6432    (void) CloneString(&montage_info->font,font);
6433  if (frame != (char *) NULL)
6434    (void) CloneString(&montage_info->frame,frame);
6435  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6436  pixel_wand=NewPixelWand();
6437  DrawGetFillColor(drawing_wand,pixel_wand);
6438  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6439  DrawGetStrokeColor(drawing_wand,pixel_wand);
6440  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6441  pixel_wand=DestroyPixelWand(pixel_wand);
6442  if (thumbnail_geometry != (char *) NULL)
6443    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6444  if (tile_geometry != (char *) NULL)
6445    (void) CloneString(&montage_info->tile,tile_geometry);
6446  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6447    wand->exception);
6448  montage_info=DestroyMontageInfo(montage_info);
6449  if (montage_image == (Image *) NULL)
6450    return((MagickWand *) NULL);
6451  return(CloneMagickWandFromImages(wand,montage_image));
6452}
6453
6454/*
6455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6456%                                                                             %
6457%                                                                             %
6458%                                                                             %
6459%   M a g i c k M o r p h I m a g e s                                         %
6460%                                                                             %
6461%                                                                             %
6462%                                                                             %
6463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6464%
6465%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6466%  and size are linearly interpolated to give the appearance of a
6467%  meta-morphosis from one image to the next.
6468%
6469%  The format of the MagickMorphImages method is:
6470%
6471%      MagickWand *MagickMorphImages(MagickWand *wand,
6472%        const size_t number_frames)
6473%
6474%  A description of each parameter follows:
6475%
6476%    o wand: the magick wand.
6477%
6478%    o number_frames: the number of in-between images to generate.
6479%
6480*/
6481WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6482  const size_t number_frames)
6483{
6484  Image
6485    *morph_image;
6486
6487  assert(wand != (MagickWand *) NULL);
6488  assert(wand->signature == WandSignature);
6489  if (wand->debug != MagickFalse)
6490    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6491  if (wand->images == (Image *) NULL)
6492    return((MagickWand *) NULL);
6493  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6494  if (morph_image == (Image *) NULL)
6495    return((MagickWand *) NULL);
6496  return(CloneMagickWandFromImages(wand,morph_image));
6497}
6498
6499/*
6500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6501%                                                                             %
6502%                                                                             %
6503%                                                                             %
6504%   M a g i c k M o r p h o l o g y I m a g e                                 %
6505%                                                                             %
6506%                                                                             %
6507%                                                                             %
6508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6509%
6510%  MagickMorphologyImage() applies a user supplied kernel to the image
6511%  according to the given mophology method.
6512%
6513%  The format of the MagickMorphologyImage method is:
6514%
6515%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6516%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6517%
6518%  A description of each parameter follows:
6519%
6520%    o wand: the magick wand.
6521%
6522%    o method: the morphology method to be applied.
6523%
6524%    o iterations: apply the operation this many times (or no change).
6525%      A value of -1 means loop until no change found.  How this is applied
6526%      may depend on the morphology method.  Typically this is a value of 1.
6527%
6528%    o kernel: An array of doubles representing the morphology kernel.
6529%
6530*/
6531WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6532  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6533{
6534  Image
6535    *morphology_image;
6536
6537  assert(wand != (MagickWand *) NULL);
6538  assert(wand->signature == WandSignature);
6539  if (wand->debug != MagickFalse)
6540    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6541  if (kernel == (const KernelInfo *) NULL)
6542    return(MagickFalse);
6543  if (wand->images == (Image *) NULL)
6544    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6545  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6546    wand->exception);
6547  if (morphology_image == (Image *) NULL)
6548    return(MagickFalse);
6549  ReplaceImageInList(&wand->images,morphology_image);
6550  return(MagickTrue);
6551}
6552
6553/*
6554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6555%                                                                             %
6556%                                                                             %
6557%                                                                             %
6558%   M a g i c k M o t i o n B l u r I m a g e                                 %
6559%                                                                             %
6560%                                                                             %
6561%                                                                             %
6562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6563%
6564%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6565%  Gaussian operator of the given radius and standard deviation (sigma).
6566%  For reasonable results, radius should be larger than sigma.  Use a
6567%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6568%  Angle gives the angle of the blurring motion.
6569%
6570%  The format of the MagickMotionBlurImage method is:
6571%
6572%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6573%        const double radius,const double sigma,const double angle)
6574%
6575%  A description of each parameter follows:
6576%
6577%    o wand: the magick wand.
6578%
6579%    o radius: the radius of the Gaussian, in pixels, not counting
6580%      the center pixel.
6581%
6582%    o sigma: the standard deviation of the Gaussian, in pixels.
6583%
6584%    o angle: Apply the effect along this angle.
6585%
6586*/
6587WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6588  const double radius,const double sigma,const double angle)
6589{
6590  Image
6591    *blur_image;
6592
6593  assert(wand != (MagickWand *) NULL);
6594  assert(wand->signature == WandSignature);
6595  if (wand->debug != MagickFalse)
6596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6597  if (wand->images == (Image *) NULL)
6598    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6599  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6600  if (blur_image == (Image *) NULL)
6601    return(MagickFalse);
6602  ReplaceImageInList(&wand->images,blur_image);
6603  return(MagickTrue);
6604}
6605
6606/*
6607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6608%                                                                             %
6609%                                                                             %
6610%                                                                             %
6611%   M a g i c k N e g a t e I m a g e                                         %
6612%                                                                             %
6613%                                                                             %
6614%                                                                             %
6615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6616%
6617%  MagickNegateImage() negates the colors in the reference image.  The
6618%  Grayscale option means that only grayscale values within the image are
6619%  negated.
6620%
6621%  You can also reduce the influence of a particular channel with a gamma
6622%  value of 0.
6623%
6624%  The format of the MagickNegateImage method is:
6625%
6626%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6627%        const MagickBooleanType gray)
6628%
6629%  A description of each parameter follows:
6630%
6631%    o wand: the magick wand.
6632%
6633%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6634%
6635*/
6636WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6637  const MagickBooleanType gray)
6638{
6639  MagickBooleanType
6640    status;
6641
6642  assert(wand != (MagickWand *) NULL);
6643  assert(wand->signature == WandSignature);
6644  if (wand->debug != MagickFalse)
6645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6646  if (wand->images == (Image *) NULL)
6647    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6648  status=NegateImage(wand->images,gray,wand->exception);
6649  return(status);
6650}
6651
6652/*
6653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6654%                                                                             %
6655%                                                                             %
6656%                                                                             %
6657%   M a g i c k N e w I m a g e                                               %
6658%                                                                             %
6659%                                                                             %
6660%                                                                             %
6661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6662%
6663%  MagickNewImage() adds a blank image canvas of the specified size and
6664%  background color to the wand.
6665%
6666%  The format of the MagickNewImage method is:
6667%
6668%      MagickBooleanType MagickNewImage(MagickWand *wand,
6669%        const size_t columns,const size_t rows,
6670%        const PixelWand *background)
6671%
6672%  A description of each parameter follows:
6673%
6674%    o wand: the magick wand.
6675%
6676%    o width: the image width.
6677%
6678%    o height: the image height.
6679%
6680%    o background: the image color.
6681%
6682*/
6683WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6684  const size_t width,const size_t height,
6685  const PixelWand *background)
6686{
6687  Image
6688    *images;
6689
6690  PixelInfo
6691    pixel;
6692
6693  assert(wand != (MagickWand *) NULL);
6694  assert(wand->signature == WandSignature);
6695  if (wand->debug != MagickFalse)
6696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6697  PixelGetMagickColor(background,&pixel);
6698  images=NewMagickImage(wand->image_info,width,height,&pixel);
6699  if (images == (Image *) NULL)
6700    return(MagickFalse);
6701  if (images->exception.severity != UndefinedException)
6702    InheritException(wand->exception,&images->exception);
6703  return(InsertImageInWand(wand,images));
6704}
6705
6706/*
6707%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6708%                                                                             %
6709%                                                                             %
6710%                                                                             %
6711%   M a g i c k N e x t I m a g e                                             %
6712%                                                                             %
6713%                                                                             %
6714%                                                                             %
6715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6716%
6717%  MagickNextImage() associates the next image in the image list with a magick
6718%  wand.
6719%
6720%  The format of the MagickNextImage method is:
6721%
6722%      MagickBooleanType MagickNextImage(MagickWand *wand)
6723%
6724%  A description of each parameter follows:
6725%
6726%    o wand: the magick wand.
6727%
6728*/
6729WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6730{
6731  assert(wand != (MagickWand *) NULL);
6732  assert(wand->signature == WandSignature);
6733  if (wand->debug != MagickFalse)
6734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6735  if (wand->images == (Image *) NULL)
6736    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6737  if (wand->pend != MagickFalse)
6738    {
6739      wand->pend=MagickFalse;
6740      return(MagickTrue);
6741    }
6742  if (GetNextImageInList(wand->images) == (Image *) NULL)
6743    {
6744      wand->pend=MagickTrue;
6745      return(MagickFalse);
6746    }
6747  wand->images=GetNextImageInList(wand->images);
6748  return(MagickTrue);
6749}
6750
6751/*
6752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6753%                                                                             %
6754%                                                                             %
6755%                                                                             %
6756%   M a g i c k N o r m a l i z e I m a g e                                   %
6757%                                                                             %
6758%                                                                             %
6759%                                                                             %
6760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6761%
6762%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6763%  the pixels color to span the entire range of colors available
6764%
6765%  You can also reduce the influence of a particular channel with a gamma
6766%  value of 0.
6767%
6768%  The format of the MagickNormalizeImage method is:
6769%
6770%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6771%
6772%  A description of each parameter follows:
6773%
6774%    o wand: the magick wand.
6775%
6776*/
6777WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6778{
6779  MagickBooleanType
6780    status;
6781
6782  assert(wand != (MagickWand *) NULL);
6783  assert(wand->signature == WandSignature);
6784  if (wand->debug != MagickFalse)
6785    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6786  if (wand->images == (Image *) NULL)
6787    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6788  status=NormalizeImage(wand->images,&wand->images->exception);
6789  return(status);
6790}
6791
6792/*
6793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6794%                                                                             %
6795%                                                                             %
6796%                                                                             %
6797%   M a g i c k O i l P a i n t I m a g e                                     %
6798%                                                                             %
6799%                                                                             %
6800%                                                                             %
6801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6802%
6803%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6804%  painting.  Each pixel is replaced by the most frequent color occurring
6805%  in a circular region defined by radius.
6806%
6807%  The format of the MagickOilPaintImage method is:
6808%
6809%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6810%        const double radius,const double sigma)
6811%
6812%  A description of each parameter follows:
6813%
6814%    o wand: the magick wand.
6815%
6816%    o radius: the radius of the circular neighborhood.
6817%
6818%    o sigma: the standard deviation of the Gaussian, in pixels.
6819%
6820*/
6821WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6822  const double radius,const double sigma)
6823{
6824  Image
6825    *paint_image;
6826
6827  assert(wand != (MagickWand *) NULL);
6828  assert(wand->signature == WandSignature);
6829  if (wand->debug != MagickFalse)
6830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6831  if (wand->images == (Image *) NULL)
6832    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6833  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6834  if (paint_image == (Image *) NULL)
6835    return(MagickFalse);
6836  ReplaceImageInList(&wand->images,paint_image);
6837  return(MagickTrue);
6838}
6839
6840/*
6841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6842%                                                                             %
6843%                                                                             %
6844%                                                                             %
6845%   M a g i c k O p a q u e P a i n t I m a g e                               %
6846%                                                                             %
6847%                                                                             %
6848%                                                                             %
6849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6850%
6851%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6852%  defined by fill.
6853%
6854%  The format of the MagickOpaquePaintImage method is:
6855%
6856%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6857%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6858%        const MagickBooleanType invert)
6859%
6860%  A description of each parameter follows:
6861%
6862%    o wand: the magick wand.
6863%
6864%    o target: Change this target color to the fill color within the image.
6865%
6866%    o fill: the fill pixel wand.
6867%
6868%    o fuzz: By default target must match a particular pixel color
6869%      exactly.  However, in many cases two colors may differ by a small amount.
6870%      The fuzz member of image defines how much tolerance is acceptable to
6871%      consider two colors as the same.  For example, set fuzz to 10 and the
6872%      color red at intensities of 100 and 102 respectively are now interpreted
6873%      as the same color for the purposes of the floodfill.
6874%
6875%    o invert: paint any pixel that does not match the target color.
6876%
6877*/
6878WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6879  const PixelWand *target,const PixelWand *fill,const double fuzz,
6880  const MagickBooleanType invert)
6881{
6882  MagickBooleanType
6883    status;
6884
6885  PixelInfo
6886    fill_pixel,
6887    target_pixel;
6888
6889  assert(wand != (MagickWand *) NULL);
6890  assert(wand->signature == WandSignature);
6891  if (wand->debug != MagickFalse)
6892    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6893  if (wand->images == (Image *) NULL)
6894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6895  PixelGetMagickColor(target,&target_pixel);
6896  PixelGetMagickColor(fill,&fill_pixel);
6897  wand->images->fuzz=fuzz;
6898  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6899    &wand->images->exception);
6900  return(status);
6901}
6902
6903/*
6904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6905%                                                                             %
6906%                                                                             %
6907%                                                                             %
6908%   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                         %
6909%                                                                             %
6910%                                                                             %
6911%                                                                             %
6912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6913%
6914%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6915%  previous image in the sequence.  From this it attempts to select the
6916%  smallest cropped image to replace each frame, while preserving the results
6917%  of the animation.
6918%
6919%  The format of the MagickOptimizeImageLayers method is:
6920%
6921%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6922%
6923%  A description of each parameter follows:
6924%
6925%    o wand: the magick wand.
6926%
6927*/
6928WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6929{
6930  Image
6931    *optimize_image;
6932
6933  assert(wand != (MagickWand *) NULL);
6934  assert(wand->signature == WandSignature);
6935  if (wand->debug != MagickFalse)
6936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6937  if (wand->images == (Image *) NULL)
6938    return((MagickWand *) NULL);
6939  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6940  if (optimize_image == (Image *) NULL)
6941    return((MagickWand *) NULL);
6942  return(CloneMagickWandFromImages(wand,optimize_image));
6943}
6944
6945/*
6946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6947%                                                                             %
6948%                                                                             %
6949%                                                                             %
6950%     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                   %
6951%                                                                             %
6952%                                                                             %
6953%                                                                             %
6954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6955%
6956%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6957%  of pre-defined dithering threshold maps, but over multiple intensity levels,
6958%  which can be different for different channels, according to the input
6959%  arguments.
6960%
6961%  The format of the MagickOrderedPosterizeImage method is:
6962%
6963%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6964%        const char *threshold_map)
6965%
6966%  A description of each parameter follows:
6967%
6968%    o image: the image.
6969%
6970%    o threshold_map: A string containing the name of the threshold dither
6971%      map to use, followed by zero or more numbers representing the number of
6972%      color levels tho dither between.
6973%
6974%      Any level number less than 2 is equivalent to 2, and means only binary
6975%      dithering will be applied to each color channel.
6976%
6977%      No numbers also means a 2 level (bitmap) dither will be applied to all
6978%      channels, while a single number is the number of levels applied to each
6979%      channel in sequence.  More numbers will be applied in turn to each of
6980%      the color channels.
6981%
6982%      For example: "o3x3,6" generates a 6 level posterization of the image
6983%      with a ordered 3x3 diffused pixel dither being applied between each
6984%      level. While checker,8,8,4 will produce a 332 colormaped image with
6985%      only a single checkerboard hash pattern (50% grey) between each color
6986%      level, to basically double the number of color levels with a bare
6987%      minimim of dithering.
6988%
6989*/
6990WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6991  const char *threshold_map)
6992{
6993  MagickBooleanType
6994    status;
6995
6996  assert(wand != (MagickWand *) NULL);
6997  assert(wand->signature == WandSignature);
6998  if (wand->debug != MagickFalse)
6999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7000  if (wand->images == (Image *) NULL)
7001    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7002  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7003  return(status);
7004}
7005
7006/*
7007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7008%                                                                             %
7009%                                                                             %
7010%                                                                             %
7011%   M a g i c k P i n g I m a g e                                             %
7012%                                                                             %
7013%                                                                             %
7014%                                                                             %
7015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7016%
7017%  MagickPingImage() is like MagickReadImage() except the only valid
7018%  information returned is the image width, height, size, and format.  It
7019%  is designed to efficiently obtain this information from a file without
7020%  reading the entire image sequence into memory.
7021%
7022%  The format of the MagickPingImage method is:
7023%
7024%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7025%
7026%  A description of each parameter follows:
7027%
7028%    o wand: the magick wand.
7029%
7030%    o filename: the image filename.
7031%
7032*/
7033WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7034  const char *filename)
7035{
7036  Image
7037    *images;
7038
7039  ImageInfo
7040    *ping_info;
7041
7042  assert(wand != (MagickWand *) NULL);
7043  assert(wand->signature == WandSignature);
7044  if (wand->debug != MagickFalse)
7045    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7046  ping_info=CloneImageInfo(wand->image_info);
7047  if (filename != (const char *) NULL)
7048    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7049  images=PingImage(ping_info,wand->exception);
7050  ping_info=DestroyImageInfo(ping_info);
7051  if (images == (Image *) NULL)
7052    return(MagickFalse);
7053  return(InsertImageInWand(wand,images));
7054}
7055
7056/*
7057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7058%                                                                             %
7059%                                                                             %
7060%                                                                             %
7061%   M a g i c k P i n g I m a g e B l o b                                     %
7062%                                                                             %
7063%                                                                             %
7064%                                                                             %
7065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7066%
7067%  MagickPingImageBlob() pings an image or image sequence from a blob.
7068%
7069%  The format of the MagickPingImageBlob method is:
7070%
7071%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7072%        const void *blob,const size_t length)
7073%
7074%  A description of each parameter follows:
7075%
7076%    o wand: the magick wand.
7077%
7078%    o blob: the blob.
7079%
7080%    o length: the blob length.
7081%
7082*/
7083WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7084  const void *blob,const size_t length)
7085{
7086  Image
7087    *images;
7088
7089  ImageInfo
7090    *read_info;
7091
7092  assert(wand != (MagickWand *) NULL);
7093  assert(wand->signature == WandSignature);
7094  if (wand->debug != MagickFalse)
7095    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7096  read_info=CloneImageInfo(wand->image_info);
7097  SetImageInfoBlob(read_info,blob,length);
7098  images=PingImage(read_info,wand->exception);
7099  read_info=DestroyImageInfo(read_info);
7100  if (images == (Image *) NULL)
7101    return(MagickFalse);
7102  return(InsertImageInWand(wand,images));
7103}
7104
7105/*
7106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7107%                                                                             %
7108%                                                                             %
7109%                                                                             %
7110%   M a g i c k P i n g I m a g e F i l e                                     %
7111%                                                                             %
7112%                                                                             %
7113%                                                                             %
7114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7115%
7116%  MagickPingImageFile() pings an image or image sequence from an open file
7117%  descriptor.
7118%
7119%  The format of the MagickPingImageFile method is:
7120%
7121%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7122%
7123%  A description of each parameter follows:
7124%
7125%    o wand: the magick wand.
7126%
7127%    o file: the file descriptor.
7128%
7129*/
7130WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7131{
7132  Image
7133    *images;
7134
7135  ImageInfo
7136    *read_info;
7137
7138  assert(wand != (MagickWand *) NULL);
7139  assert(wand->signature == WandSignature);
7140  assert(file != (FILE *) NULL);
7141  if (wand->debug != MagickFalse)
7142    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7143  read_info=CloneImageInfo(wand->image_info);
7144  SetImageInfoFile(read_info,file);
7145  images=PingImage(read_info,wand->exception);
7146  read_info=DestroyImageInfo(read_info);
7147  if (images == (Image *) NULL)
7148    return(MagickFalse);
7149  return(InsertImageInWand(wand,images));
7150}
7151
7152/*
7153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7154%                                                                             %
7155%                                                                             %
7156%                                                                             %
7157%   M a g i c k P o l a r o i d I m a g e                                     %
7158%                                                                             %
7159%                                                                             %
7160%                                                                             %
7161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7162%
7163%  MagickPolaroidImage() simulates a Polaroid picture.
7164%
7165%  The format of the MagickPolaroidImage method is:
7166%
7167%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7168%        const DrawingWand *drawing_wand,const double angle)
7169%
7170%  A description of each parameter follows:
7171%
7172%    o wand: the magick wand.
7173%
7174%    o drawing_wand: the draw wand.
7175%
7176%    o angle: Apply the effect along this angle.
7177%
7178*/
7179WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7180  const DrawingWand *drawing_wand,const double angle)
7181{
7182  DrawInfo
7183    *draw_info;
7184
7185  Image
7186    *polaroid_image;
7187
7188  assert(wand != (MagickWand *) NULL);
7189  assert(wand->signature == WandSignature);
7190  if (wand->debug != MagickFalse)
7191    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7192  if (wand->images == (Image *) NULL)
7193    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7194  draw_info=PeekDrawingWand(drawing_wand);
7195  if (draw_info == (DrawInfo *) NULL)
7196    return(MagickFalse);
7197  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7198  if (polaroid_image == (Image *) NULL)
7199    return(MagickFalse);
7200  ReplaceImageInList(&wand->images,polaroid_image);
7201  return(MagickTrue);
7202}
7203
7204/*
7205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7206%                                                                             %
7207%                                                                             %
7208%                                                                             %
7209%   M a g i c k P o s t e r i z e I m a g e                                   %
7210%                                                                             %
7211%                                                                             %
7212%                                                                             %
7213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7214%
7215%  MagickPosterizeImage() reduces the image to a limited number of color level.
7216%
7217%  The format of the MagickPosterizeImage method is:
7218%
7219%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7220%        const unsigned levels,const MagickBooleanType dither)
7221%
7222%  A description of each parameter follows:
7223%
7224%    o wand: the magick wand.
7225%
7226%    o levels: Number of color levels allowed in each channel.  Very low values
7227%      (2, 3, or 4) have the most visible effect.
7228%
7229%    o dither: Set this integer value to something other than zero to dither
7230%      the mapped image.
7231%
7232*/
7233WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7234  const size_t levels,const MagickBooleanType dither)
7235{
7236  MagickBooleanType
7237    status;
7238
7239  assert(wand != (MagickWand *) NULL);
7240  assert(wand->signature == WandSignature);
7241  if (wand->debug != MagickFalse)
7242    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7243  if (wand->images == (Image *) NULL)
7244    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7245  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7246  return(status);
7247}
7248
7249/*
7250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7251%                                                                             %
7252%                                                                             %
7253%                                                                             %
7254%   M a g i c k P r e v i e w I m a g e s                                     %
7255%                                                                             %
7256%                                                                             %
7257%                                                                             %
7258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7259%
7260%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7261%  image processing operation applied at varying strengths.  This helpful
7262%  to quickly pin-point an appropriate parameter for an image processing
7263%  operation.
7264%
7265%  The format of the MagickPreviewImages method is:
7266%
7267%      MagickWand *MagickPreviewImages(MagickWand *wand,
7268%        const PreviewType preview)
7269%
7270%  A description of each parameter follows:
7271%
7272%    o wand: the magick wand.
7273%
7274%    o preview: the preview type.
7275%
7276*/
7277WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7278  const PreviewType preview)
7279{
7280  Image
7281    *preview_image;
7282
7283  assert(wand != (MagickWand *) NULL);
7284  assert(wand->signature == WandSignature);
7285  if (wand->debug != MagickFalse)
7286    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7287  if (wand->images == (Image *) NULL)
7288    return((MagickWand *) NULL);
7289  preview_image=PreviewImage(wand->images,preview,wand->exception);
7290  if (preview_image == (Image *) NULL)
7291    return((MagickWand *) NULL);
7292  return(CloneMagickWandFromImages(wand,preview_image));
7293}
7294
7295/*
7296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7297%                                                                             %
7298%                                                                             %
7299%                                                                             %
7300%   M a g i c k P r e v i o u s I m a g e                                     %
7301%                                                                             %
7302%                                                                             %
7303%                                                                             %
7304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7305%
7306%  MagickPreviousImage() assocates the previous image in an image list with
7307%  the magick wand.
7308%
7309%  The format of the MagickPreviousImage method is:
7310%
7311%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7312%
7313%  A description of each parameter follows:
7314%
7315%    o wand: the magick wand.
7316%
7317*/
7318WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7319{
7320  assert(wand != (MagickWand *) NULL);
7321  assert(wand->signature == WandSignature);
7322  if (wand->debug != MagickFalse)
7323    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7324  if (wand->images == (Image *) NULL)
7325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7326  if (wand->pend != MagickFalse)
7327    {
7328      wand->pend=MagickFalse;
7329      return(MagickTrue);
7330    }
7331  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7332    {
7333      wand->pend=MagickTrue;
7334      return(MagickFalse);
7335    }
7336  wand->images=GetPreviousImageInList(wand->images);
7337  return(MagickTrue);
7338}
7339
7340/*
7341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7342%                                                                             %
7343%                                                                             %
7344%                                                                             %
7345%   M a g i c k Q u a n t i z e I m a g e                                     %
7346%                                                                             %
7347%                                                                             %
7348%                                                                             %
7349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7350%
7351%  MagickQuantizeImage() analyzes the colors within a reference image and
7352%  chooses a fixed number of colors to represent the image.  The goal of the
7353%  algorithm is to minimize the color difference between the input and output
7354%  image while minimizing the processing time.
7355%
7356%  The format of the MagickQuantizeImage method is:
7357%
7358%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7359%        const size_t number_colors,const ColorspaceType colorspace,
7360%        const size_t treedepth,const MagickBooleanType dither,
7361%        const MagickBooleanType measure_error)
7362%
7363%  A description of each parameter follows:
7364%
7365%    o wand: the magick wand.
7366%
7367%    o number_colors: the number of colors.
7368%
7369%    o colorspace: Perform color reduction in this colorspace, typically
7370%      RGBColorspace.
7371%
7372%    o treedepth: Normally, this integer value is zero or one.  A zero or
7373%      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
7374%      reference image with the least amount of memory and the fastest
7375%      computational speed.  In some cases, such as an image with low color
7376%      dispersion (a few number of colors), a value other than
7377%      Log4(number_colors) is required.  To expand the color tree completely,
7378%      use a value of 8.
7379%
7380%    o dither: A value other than zero distributes the difference between an
7381%      original image and the corresponding color reduced image to
7382%      neighboring pixels along a Hilbert curve.
7383%
7384%    o measure_error: A value other than zero measures the difference between
7385%      the original and quantized images.  This difference is the total
7386%      quantization error.  The error is computed by summing over all pixels
7387%      in an image the distance squared in RGB space between each reference
7388%      pixel value and its quantized value.
7389%
7390*/
7391WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7392  const size_t number_colors,const ColorspaceType colorspace,
7393  const size_t treedepth,const MagickBooleanType dither,
7394  const MagickBooleanType measure_error)
7395{
7396  MagickBooleanType
7397    status;
7398
7399  QuantizeInfo
7400    *quantize_info;
7401
7402  assert(wand != (MagickWand *) NULL);
7403  assert(wand->signature == WandSignature);
7404  if (wand->debug != MagickFalse)
7405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7406  if (wand->images == (Image *) NULL)
7407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7408  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7409  quantize_info->number_colors=number_colors;
7410  quantize_info->dither=dither;
7411  quantize_info->tree_depth=treedepth;
7412  quantize_info->colorspace=colorspace;
7413  quantize_info->measure_error=measure_error;
7414  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7415  quantize_info=DestroyQuantizeInfo(quantize_info);
7416  return(status);
7417}
7418
7419/*
7420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7421%                                                                             %
7422%                                                                             %
7423%                                                                             %
7424%   M a g i c k Q u a n t i z e I m a g e s                                   %
7425%                                                                             %
7426%                                                                             %
7427%                                                                             %
7428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7429%
7430%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7431%  chooses a fixed number of colors to represent the image.  The goal of the
7432%  algorithm is to minimize the color difference between the input and output
7433%  image while minimizing the processing time.
7434%
7435%  The format of the MagickQuantizeImages method is:
7436%
7437%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7438%        const size_t number_colors,const ColorspaceType colorspace,
7439%        const size_t treedepth,const MagickBooleanType dither,
7440%        const MagickBooleanType measure_error)
7441%
7442%  A description of each parameter follows:
7443%
7444%    o wand: the magick wand.
7445%
7446%    o number_colors: the number of colors.
7447%
7448%    o colorspace: Perform color reduction in this colorspace, typically
7449%      RGBColorspace.
7450%
7451%    o treedepth: Normally, this integer value is zero or one.  A zero or
7452%      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
7453%      reference image with the least amount of memory and the fastest
7454%      computational speed.  In some cases, such as an image with low color
7455%      dispersion (a few number of colors), a value other than
7456%      Log4(number_colors) is required.  To expand the color tree completely,
7457%      use a value of 8.
7458%
7459%    o dither: A value other than zero distributes the difference between an
7460%      original image and the corresponding color reduced algorithm to
7461%      neighboring pixels along a Hilbert curve.
7462%
7463%    o measure_error: A value other than zero measures the difference between
7464%      the original and quantized images.  This difference is the total
7465%      quantization error.  The error is computed by summing over all pixels
7466%      in an image the distance squared in RGB space between each reference
7467%      pixel value and its quantized value.
7468%
7469*/
7470WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7471  const size_t number_colors,const ColorspaceType colorspace,
7472  const size_t treedepth,const MagickBooleanType dither,
7473  const MagickBooleanType measure_error)
7474{
7475  MagickBooleanType
7476    status;
7477
7478  QuantizeInfo
7479    *quantize_info;
7480
7481  assert(wand != (MagickWand *) NULL);
7482  assert(wand->signature == WandSignature);
7483  if (wand->debug != MagickFalse)
7484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7485  if (wand->images == (Image *) NULL)
7486    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7487  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7488  quantize_info->number_colors=number_colors;
7489  quantize_info->dither=dither;
7490  quantize_info->tree_depth=treedepth;
7491  quantize_info->colorspace=colorspace;
7492  quantize_info->measure_error=measure_error;
7493  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7494  quantize_info=DestroyQuantizeInfo(quantize_info);
7495  return(status);
7496}
7497
7498/*
7499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7500%                                                                             %
7501%                                                                             %
7502%                                                                             %
7503%   M a g i c k R a d i a l B l u r I m a g e                                 %
7504%                                                                             %
7505%                                                                             %
7506%                                                                             %
7507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7508%
7509%  MagickRadialBlurImage() radial blurs an image.
7510%
7511%  The format of the MagickRadialBlurImage method is:
7512%
7513%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7514%        const double angle)
7515%
7516%  A description of each parameter follows:
7517%
7518%    o wand: the magick wand.
7519%
7520%    o angle: the angle of the blur in degrees.
7521%
7522*/
7523WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7524  const double angle)
7525{
7526  Image
7527    *blur_image;
7528
7529  assert(wand != (MagickWand *) NULL);
7530  assert(wand->signature == WandSignature);
7531  if (wand->debug != MagickFalse)
7532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7533  if (wand->images == (Image *) NULL)
7534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7535  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7536  if (blur_image == (Image *) NULL)
7537    return(MagickFalse);
7538  ReplaceImageInList(&wand->images,blur_image);
7539  return(MagickTrue);
7540}
7541
7542/*
7543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7544%                                                                             %
7545%                                                                             %
7546%                                                                             %
7547%   M a g i c k R a i s e I m a g e                                           %
7548%                                                                             %
7549%                                                                             %
7550%                                                                             %
7551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7552%
7553%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7554%  by lightening and darkening the edges of the image.  Members width and
7555%  height of raise_info define the width of the vertical and horizontal
7556%  edge of the effect.
7557%
7558%  The format of the MagickRaiseImage method is:
7559%
7560%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7561%        const size_t width,const size_t height,const ssize_t x,
7562%        const ssize_t y,const MagickBooleanType raise)
7563%
7564%  A description of each parameter follows:
7565%
7566%    o wand: the magick wand.
7567%
7568%    o width,height,x,y:  Define the dimensions of the area to raise.
7569%
7570%    o raise: A value other than zero creates a 3-D raise effect,
7571%      otherwise it has a lowered effect.
7572%
7573*/
7574WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7575  const size_t width,const size_t height,const ssize_t x,
7576  const ssize_t y,const MagickBooleanType raise)
7577{
7578  MagickBooleanType
7579    status;
7580
7581  RectangleInfo
7582    raise_info;
7583
7584  assert(wand != (MagickWand *) NULL);
7585  assert(wand->signature == WandSignature);
7586  if (wand->debug != MagickFalse)
7587    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7588  if (wand->images == (Image *) NULL)
7589    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7590  raise_info.width=width;
7591  raise_info.height=height;
7592  raise_info.x=x;
7593  raise_info.y=y;
7594  status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7595  return(status);
7596}
7597
7598/*
7599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7600%                                                                             %
7601%                                                                             %
7602%                                                                             %
7603%   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                       %
7604%                                                                             %
7605%                                                                             %
7606%                                                                             %
7607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7608%
7609%  MagickRandomThresholdImage() changes the value of individual pixels based on
7610%  the intensity of each pixel compared to threshold.  The result is a
7611%  high-contrast, two color image.
7612%
7613%  The format of the MagickRandomThresholdImage method is:
7614%
7615%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7616%        const double low,const double high)
7617%
7618%  A description of each parameter follows:
7619%
7620%    o wand: the magick wand.
7621%
7622%    o low,high: Specify the high and low thresholds.  These values range from
7623%      0 to QuantumRange.
7624%
7625*/
7626WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7627  const double low,const double high)
7628{
7629  char
7630    threshold[MaxTextExtent];
7631
7632  MagickBooleanType
7633    status;
7634
7635  assert(wand != (MagickWand *) NULL);
7636  assert(wand->signature == WandSignature);
7637  if (wand->debug != MagickFalse)
7638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7639  if (wand->images == (Image *) NULL)
7640    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7641  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7642  status=RandomThresholdImage(wand->images,threshold,wand->exception);
7643  if (status == MagickFalse)
7644    InheritException(wand->exception,&wand->images->exception);
7645  return(status);
7646}
7647
7648/*
7649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7650%                                                                             %
7651%                                                                             %
7652%                                                                             %
7653%   M a g i c k R e a d I m a g e                                             %
7654%                                                                             %
7655%                                                                             %
7656%                                                                             %
7657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7658%
7659%  MagickReadImage() reads an image or image sequence.  The images are inserted
7660%  at the current image pointer position.   Use MagickSetFirstIterator(),
7661%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7662%  image pointer position at the beginning of the image list, the end, or
7663%  anywhere in-between respectively.
7664%
7665%  The format of the MagickReadImage method is:
7666%
7667%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7668%
7669%  A description of each parameter follows:
7670%
7671%    o wand: the magick wand.
7672%
7673%    o filename: the image filename.
7674%
7675*/
7676WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7677  const char *filename)
7678{
7679  Image
7680    *images;
7681
7682  ImageInfo
7683    *read_info;
7684
7685  assert(wand != (MagickWand *) NULL);
7686  assert(wand->signature == WandSignature);
7687  if (wand->debug != MagickFalse)
7688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7689  read_info=CloneImageInfo(wand->image_info);
7690  if (filename != (const char *) NULL)
7691    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7692  images=ReadImage(read_info,wand->exception);
7693  read_info=DestroyImageInfo(read_info);
7694  if (images == (Image *) NULL)
7695    return(MagickFalse);
7696  return(InsertImageInWand(wand,images));
7697}
7698
7699/*
7700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7701%                                                                             %
7702%                                                                             %
7703%                                                                             %
7704%   M a g i c k R e a d I m a g e B l o b                                     %
7705%                                                                             %
7706%                                                                             %
7707%                                                                             %
7708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7709%
7710%  MagickReadImageBlob() reads an image or image sequence from a blob.
7711%
7712%  The format of the MagickReadImageBlob method is:
7713%
7714%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7715%        const void *blob,const size_t length)
7716%
7717%  A description of each parameter follows:
7718%
7719%    o wand: the magick wand.
7720%
7721%    o blob: the blob.
7722%
7723%    o length: the blob length.
7724%
7725*/
7726WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7727  const void *blob,const size_t length)
7728{
7729  Image
7730    *images;
7731
7732  assert(wand != (MagickWand *) NULL);
7733  assert(wand->signature == WandSignature);
7734  if (wand->debug != MagickFalse)
7735    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7736  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7737  if (images == (Image *) NULL)
7738    return(MagickFalse);
7739  return(InsertImageInWand(wand,images));
7740}
7741
7742/*
7743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7744%                                                                             %
7745%                                                                             %
7746%                                                                             %
7747%   M a g i c k R e a d I m a g e F i l e                                     %
7748%                                                                             %
7749%                                                                             %
7750%                                                                             %
7751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7752%
7753%  MagickReadImageFile() reads an image or image sequence from an open file
7754%  descriptor.
7755%
7756%  The format of the MagickReadImageFile method is:
7757%
7758%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7759%
7760%  A description of each parameter follows:
7761%
7762%    o wand: the magick wand.
7763%
7764%    o file: the file descriptor.
7765%
7766*/
7767WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7768{
7769  Image
7770    *images;
7771
7772  ImageInfo
7773    *read_info;
7774
7775  assert(wand != (MagickWand *) NULL);
7776  assert(wand->signature == WandSignature);
7777  assert(file != (FILE *) NULL);
7778  if (wand->debug != MagickFalse)
7779    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7780  read_info=CloneImageInfo(wand->image_info);
7781  SetImageInfoFile(read_info,file);
7782  images=ReadImage(read_info,wand->exception);
7783  read_info=DestroyImageInfo(read_info);
7784  if (images == (Image *) NULL)
7785    return(MagickFalse);
7786  return(InsertImageInWand(wand,images));
7787}
7788
7789/*
7790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7791%                                                                             %
7792%                                                                             %
7793%                                                                             %
7794%   M a g i c k R e m a p I m a g e                                           %
7795%                                                                             %
7796%                                                                             %
7797%                                                                             %
7798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7799%
7800%  MagickRemapImage() replaces the colors of an image with the closest color
7801%  from a reference image.
7802%
7803%  The format of the MagickRemapImage method is:
7804%
7805%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7806%        const MagickWand *remap_wand,const DitherMethod method)
7807%
7808%  A description of each parameter follows:
7809%
7810%    o wand: the magick wand.
7811%
7812%    o affinity: the affinity wand.
7813%
7814%    o method: choose from these dither methods: NoDitherMethod,
7815%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7816%
7817*/
7818WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7819  const MagickWand *remap_wand,const DitherMethod method)
7820{
7821  MagickBooleanType
7822    status;
7823
7824  QuantizeInfo
7825    *quantize_info;
7826
7827  assert(wand != (MagickWand *) NULL);
7828  assert(wand->signature == WandSignature);
7829  if (wand->debug != MagickFalse)
7830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7831  if ((wand->images == (Image *) NULL) ||
7832      (remap_wand->images == (Image *) NULL))
7833    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7834  quantize_info=AcquireQuantizeInfo(wand->image_info);
7835  quantize_info->dither_method=method;
7836  if (method == NoDitherMethod)
7837    quantize_info->dither=MagickFalse;
7838  status=RemapImage(quantize_info,wand->images,remap_wand->images,
7839    wand->exception);
7840  quantize_info=DestroyQuantizeInfo(quantize_info);
7841  return(status);
7842}
7843
7844/*
7845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7846%                                                                             %
7847%                                                                             %
7848%                                                                             %
7849%   M a g i c k R e m o v e I m a g e                                         %
7850%                                                                             %
7851%                                                                             %
7852%                                                                             %
7853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7854%
7855%  MagickRemoveImage() removes an image from the image list.
7856%
7857%  The format of the MagickRemoveImage method is:
7858%
7859%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7860%
7861%  A description of each parameter follows:
7862%
7863%    o wand: the magick wand.
7864%
7865%    o insert: the splice wand.
7866%
7867*/
7868WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7869{
7870  assert(wand != (MagickWand *) NULL);
7871  assert(wand->signature == WandSignature);
7872  if (wand->debug != MagickFalse)
7873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7874  if (wand->images == (Image *) NULL)
7875    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7876  DeleteImageFromList(&wand->images);
7877  return(MagickTrue);
7878}
7879
7880/*
7881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7882%                                                                             %
7883%                                                                             %
7884%                                                                             %
7885%   M a g i c k R e s a m p l e I m a g e                                     %
7886%                                                                             %
7887%                                                                             %
7888%                                                                             %
7889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7890%
7891%  MagickResampleImage() resample image to desired resolution.
7892%
7893%    Bessel   Blackman   Box
7894%    Catrom   Cubic      Gaussian
7895%    Hanning  Hermite    Lanczos
7896%    Mitchell Point      Quandratic
7897%    Sinc     Triangle
7898%
7899%  Most of the filters are FIR (finite impulse response), however, Bessel,
7900%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7901%  are windowed (brought down to zero) with the Blackman filter.
7902%
7903%  The format of the MagickResampleImage method is:
7904%
7905%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7906%        const double x_resolution,const double y_resolution,
7907%        const FilterTypes filter,const double blur)
7908%
7909%  A description of each parameter follows:
7910%
7911%    o wand: the magick wand.
7912%
7913%    o x_resolution: the new image x resolution.
7914%
7915%    o y_resolution: the new image y resolution.
7916%
7917%    o filter: Image filter to use.
7918%
7919%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7920%
7921*/
7922WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7923  const double x_resolution,const double y_resolution,const FilterTypes filter,
7924  const double blur)
7925{
7926  Image
7927    *resample_image;
7928
7929  assert(wand != (MagickWand *) NULL);
7930  assert(wand->signature == WandSignature);
7931  if (wand->debug != MagickFalse)
7932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7933  if (wand->images == (Image *) NULL)
7934    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7935  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7936    blur,wand->exception);
7937  if (resample_image == (Image *) NULL)
7938    return(MagickFalse);
7939  ReplaceImageInList(&wand->images,resample_image);
7940  return(MagickTrue);
7941}
7942
7943/*
7944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7945%                                                                             %
7946%                                                                             %
7947%                                                                             %
7948%   M a g i c k R e s e t I m a g e P a g e                                   %
7949%                                                                             %
7950%                                                                             %
7951%                                                                             %
7952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7953%
7954%  MagickResetImagePage() resets the Wand page canvas and position.
7955%
7956%  The format of the MagickResetImagePage method is:
7957%
7958%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7959%        const char *page)
7960%
7961%  A description of each parameter follows:
7962%
7963%    o wand: the magick wand.
7964%
7965%    o page: the relative page specification.
7966%
7967*/
7968WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7969  const char *page)
7970{
7971  assert(wand != (MagickWand *) NULL);
7972  assert(wand->signature == WandSignature);
7973  if (wand->debug != MagickFalse)
7974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7975  if (wand->images == (Image *) NULL)
7976    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7977  if ((page == (char *) NULL) || (*page == '\0'))
7978    {
7979      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
7980      return(MagickTrue);
7981    }
7982  return(ResetImagePage(wand->images,page));
7983}
7984
7985/*
7986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7987%                                                                             %
7988%                                                                             %
7989%                                                                             %
7990%   M a g i c k R e s i z e I m a g e                                         %
7991%                                                                             %
7992%                                                                             %
7993%                                                                             %
7994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7995%
7996%  MagickResizeImage() scales an image to the desired dimensions with one of
7997%  these filters:
7998%
7999%    Bessel   Blackman   Box
8000%    Catrom   Cubic      Gaussian
8001%    Hanning  Hermite    Lanczos
8002%    Mitchell Point      Quandratic
8003%    Sinc     Triangle
8004%
8005%  Most of the filters are FIR (finite impulse response), however, Bessel,
8006%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8007%  are windowed (brought down to zero) with the Blackman filter.
8008%
8009%  The format of the MagickResizeImage method is:
8010%
8011%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8012%        const size_t columns,const size_t rows,
8013%        const FilterTypes filter,const double blur)
8014%
8015%  A description of each parameter follows:
8016%
8017%    o wand: the magick wand.
8018%
8019%    o columns: the number of columns in the scaled image.
8020%
8021%    o rows: the number of rows in the scaled image.
8022%
8023%    o filter: Image filter to use.
8024%
8025%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8026%
8027*/
8028WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8029  const size_t columns,const size_t rows,const FilterTypes filter,
8030  const double blur)
8031{
8032  Image
8033    *resize_image;
8034
8035  assert(wand != (MagickWand *) NULL);
8036  assert(wand->signature == WandSignature);
8037  if (wand->debug != MagickFalse)
8038    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8039  if (wand->images == (Image *) NULL)
8040    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8041  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8042    wand->exception);
8043  if (resize_image == (Image *) NULL)
8044    return(MagickFalse);
8045  ReplaceImageInList(&wand->images,resize_image);
8046  return(MagickTrue);
8047}
8048
8049/*
8050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8051%                                                                             %
8052%                                                                             %
8053%                                                                             %
8054%   M a g i c k R o l l I m a g e                                             %
8055%                                                                             %
8056%                                                                             %
8057%                                                                             %
8058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8059%
8060%  MagickRollImage() offsets an image as defined by x and y.
8061%
8062%  The format of the MagickRollImage method is:
8063%
8064%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8065%        const size_t y)
8066%
8067%  A description of each parameter follows:
8068%
8069%    o wand: the magick wand.
8070%
8071%    o x: the x offset.
8072%
8073%    o y: the y offset.
8074%
8075%
8076*/
8077WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8078  const ssize_t x,const ssize_t y)
8079{
8080  Image
8081    *roll_image;
8082
8083  assert(wand != (MagickWand *) NULL);
8084  assert(wand->signature == WandSignature);
8085  if (wand->debug != MagickFalse)
8086    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8087  if (wand->images == (Image *) NULL)
8088    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8089  roll_image=RollImage(wand->images,x,y,wand->exception);
8090  if (roll_image == (Image *) NULL)
8091    return(MagickFalse);
8092  ReplaceImageInList(&wand->images,roll_image);
8093  return(MagickTrue);
8094}
8095
8096/*
8097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8098%                                                                             %
8099%                                                                             %
8100%                                                                             %
8101%   M a g i c k R o t a t e I m a g e                                         %
8102%                                                                             %
8103%                                                                             %
8104%                                                                             %
8105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8106%
8107%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8108%  triangles left over from rotating the image are filled with the
8109%  background color.
8110%
8111%  The format of the MagickRotateImage method is:
8112%
8113%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8114%        const PixelWand *background,const double degrees)
8115%
8116%  A description of each parameter follows:
8117%
8118%    o wand: the magick wand.
8119%
8120%    o background: the background pixel wand.
8121%
8122%    o degrees: the number of degrees to rotate the image.
8123%
8124%
8125*/
8126WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8127  const PixelWand *background,const double degrees)
8128{
8129  Image
8130    *rotate_image;
8131
8132  assert(wand != (MagickWand *) NULL);
8133  assert(wand->signature == WandSignature);
8134  if (wand->debug != MagickFalse)
8135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8136  if (wand->images == (Image *) NULL)
8137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8138  PixelGetQuantumPacket(background,&wand->images->background_color);
8139  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8140  if (rotate_image == (Image *) NULL)
8141    return(MagickFalse);
8142  ReplaceImageInList(&wand->images,rotate_image);
8143  return(MagickTrue);
8144}
8145
8146/*
8147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8148%                                                                             %
8149%                                                                             %
8150%                                                                             %
8151%   M a g i c k S a m p l e I m a g e                                         %
8152%                                                                             %
8153%                                                                             %
8154%                                                                             %
8155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8156%
8157%  MagickSampleImage() scales an image to the desired dimensions with pixel
8158%  sampling.  Unlike other scaling methods, this method does not introduce
8159%  any additional color into the scaled image.
8160%
8161%  The format of the MagickSampleImage method is:
8162%
8163%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8164%        const size_t columns,const size_t rows)
8165%
8166%  A description of each parameter follows:
8167%
8168%    o wand: the magick wand.
8169%
8170%    o columns: the number of columns in the scaled image.
8171%
8172%    o rows: the number of rows in the scaled image.
8173%
8174%
8175*/
8176WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8177  const size_t columns,const size_t rows)
8178{
8179  Image
8180    *sample_image;
8181
8182  assert(wand != (MagickWand *) NULL);
8183  assert(wand->signature == WandSignature);
8184  if (wand->debug != MagickFalse)
8185    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8186  if (wand->images == (Image *) NULL)
8187    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8188  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8189  if (sample_image == (Image *) NULL)
8190    return(MagickFalse);
8191  ReplaceImageInList(&wand->images,sample_image);
8192  return(MagickTrue);
8193}
8194
8195/*
8196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8197%                                                                             %
8198%                                                                             %
8199%                                                                             %
8200%   M a g i c k S c a l e I m a g e                                           %
8201%                                                                             %
8202%                                                                             %
8203%                                                                             %
8204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8205%
8206%  MagickScaleImage() scales the size of an image to the given dimensions.
8207%
8208%  The format of the MagickScaleImage method is:
8209%
8210%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8211%        const size_t columns,const size_t rows)
8212%
8213%  A description of each parameter follows:
8214%
8215%    o wand: the magick wand.
8216%
8217%    o columns: the number of columns in the scaled image.
8218%
8219%    o rows: the number of rows in the scaled image.
8220%
8221%
8222*/
8223WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8224  const size_t columns,const size_t rows)
8225{
8226  Image
8227    *scale_image;
8228
8229  assert(wand != (MagickWand *) NULL);
8230  assert(wand->signature == WandSignature);
8231  if (wand->debug != MagickFalse)
8232    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8233  if (wand->images == (Image *) NULL)
8234    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8235  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8236  if (scale_image == (Image *) NULL)
8237    return(MagickFalse);
8238  ReplaceImageInList(&wand->images,scale_image);
8239  return(MagickTrue);
8240}
8241
8242/*
8243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8244%                                                                             %
8245%                                                                             %
8246%                                                                             %
8247%   M a g i c k S e g m e n t I m a g e                                       %
8248%                                                                             %
8249%                                                                             %
8250%                                                                             %
8251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8252%
8253%  MagickSegmentImage() segments an image by analyzing the histograms of the
8254%  color components and identifying units that are homogeneous with the fuzzy
8255%  C-means technique.
8256%
8257%  The format of the SegmentImage method is:
8258%
8259%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8260%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8261%        const double cluster_threshold,const double smooth_threshold)
8262%
8263%  A description of each parameter follows.
8264%
8265%    o wand: the wand.
8266%
8267%    o colorspace: the image colorspace.
8268%
8269%    o verbose:  Set to MagickTrue to print detailed information about the
8270%      identified classes.
8271%
8272%    o cluster_threshold:  This represents the minimum number of pixels
8273%      contained in a hexahedra before it can be considered valid (expressed as
8274%      a percentage).
8275%
8276%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8277%      derivative of the histogram.  As the value is increased, you can expect a
8278%      smoother second derivative.
8279%
8280*/
8281MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8282  const ColorspaceType colorspace,const MagickBooleanType verbose,
8283  const double cluster_threshold,const double smooth_threshold)
8284{
8285  MagickBooleanType
8286    status;
8287
8288  assert(wand != (MagickWand *) NULL);
8289  assert(wand->signature == WandSignature);
8290  if (wand->debug != MagickFalse)
8291    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8292  if (wand->images == (Image *) NULL)
8293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8294  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8295    smooth_threshold,wand->exception);
8296  return(status);
8297}
8298
8299/*
8300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8301%                                                                             %
8302%                                                                             %
8303%                                                                             %
8304%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8305%                                                                             %
8306%                                                                             %
8307%                                                                             %
8308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8309%
8310%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8311%  threshold. It is similar to the unsharpen mask that sharpens everything with
8312%  contrast above a certain threshold.
8313%
8314%  The format of the MagickSelectiveBlurImage method is:
8315%
8316%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8317%        const double radius,const double sigma,const double threshold)
8318%
8319%  A description of each parameter follows:
8320%
8321%    o wand: the magick wand.
8322%
8323%    o radius: the radius of the gaussian, in pixels, not counting the center
8324%      pixel.
8325%
8326%    o sigma: the standard deviation of the gaussian, in pixels.
8327%
8328%    o threshold: only pixels within this contrast threshold are included
8329%      in the blur operation.
8330%
8331*/
8332WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8333  const double radius,const double sigma,const double threshold)
8334{
8335  Image
8336    *blur_image;
8337
8338  assert(wand != (MagickWand *) NULL);
8339  assert(wand->signature == WandSignature);
8340  if (wand->debug != MagickFalse)
8341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8342  if (wand->images == (Image *) NULL)
8343    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8344  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8345    wand->exception);
8346  if (blur_image == (Image *) NULL)
8347    return(MagickFalse);
8348  ReplaceImageInList(&wand->images,blur_image);
8349  return(MagickTrue);
8350}
8351
8352/*
8353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8354%                                                                             %
8355%                                                                             %
8356%                                                                             %
8357%   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                       %
8358%                                                                             %
8359%                                                                             %
8360%                                                                             %
8361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8362%
8363%  MagickSeparateImage() separates a channel from the image and returns a
8364%  grayscale image.  A channel is a particular color component of each pixel
8365%  in the image.
8366%
8367%  The format of the MagickSeparateImage method is:
8368%
8369%      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8370%
8371%  A description of each parameter follows:
8372%
8373%    o wand: the magick wand.
8374%
8375*/
8376WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8377{
8378  MagickBooleanType
8379    status;
8380
8381  assert(wand != (MagickWand *) NULL);
8382  assert(wand->signature == WandSignature);
8383  if (wand->debug != MagickFalse)
8384    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8385  if (wand->images == (Image *) NULL)
8386    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8387  status=SeparateImage(wand->images);
8388  if (status == MagickFalse)
8389    InheritException(wand->exception,&wand->images->exception);
8390  return(status);
8391}
8392
8393/*
8394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8395%                                                                             %
8396%                                                                             %
8397%                                                                             %
8398%     M a g i c k S e p i a T o n e I m a g e                                 %
8399%                                                                             %
8400%                                                                             %
8401%                                                                             %
8402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8403%
8404%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8405%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8406%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8407%  threshold of 80% is a good starting point for a reasonable tone.
8408%
8409%  The format of the MagickSepiaToneImage method is:
8410%
8411%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8412%        const double threshold)
8413%
8414%  A description of each parameter follows:
8415%
8416%    o wand: the magick wand.
8417%
8418%    o threshold:  Define the extent of the sepia toning.
8419%
8420*/
8421WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8422  const double threshold)
8423{
8424  Image
8425    *sepia_image;
8426
8427  assert(wand != (MagickWand *) NULL);
8428  assert(wand->signature == WandSignature);
8429  if (wand->debug != MagickFalse)
8430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8431  if (wand->images == (Image *) NULL)
8432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8433  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8434  if (sepia_image == (Image *) NULL)
8435    return(MagickFalse);
8436  ReplaceImageInList(&wand->images,sepia_image);
8437  return(MagickTrue);
8438}
8439
8440/*
8441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8442%                                                                             %
8443%                                                                             %
8444%                                                                             %
8445%   M a g i c k S e t I m a g e                                               %
8446%                                                                             %
8447%                                                                             %
8448%                                                                             %
8449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8450%
8451%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8452%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8453%  wand.
8454%
8455%  The format of the MagickSetImage method is:
8456%
8457%      MagickBooleanType MagickSetImage(MagickWand *wand,
8458%        const MagickWand *set_wand)
8459%
8460%  A description of each parameter follows:
8461%
8462%    o wand: the magick wand.
8463%
8464%    o set_wand: the set_wand wand.
8465%
8466*/
8467WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8468  const MagickWand *set_wand)
8469{
8470  Image
8471    *images;
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  assert(set_wand != (MagickWand *) NULL);
8478  assert(set_wand->signature == WandSignature);
8479  if (wand->debug != MagickFalse)
8480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8481  if (set_wand->images == (Image *) NULL)
8482    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8483  images=CloneImageList(set_wand->images,wand->exception);
8484  if (images == (Image *) NULL)
8485    return(MagickFalse);
8486  ReplaceImageInList(&wand->images,images);
8487  return(MagickTrue);
8488}
8489
8490/*
8491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8492%                                                                             %
8493%                                                                             %
8494%                                                                             %
8495%   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                       %
8496%                                                                             %
8497%                                                                             %
8498%                                                                             %
8499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8500%
8501%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8502%  alpha channel.
8503%
8504%  The format of the MagickSetImageAlphaChannel method is:
8505%
8506%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8507%        const AlphaChannelType alpha_type)
8508%
8509%  A description of each parameter follows:
8510%
8511%    o wand: the magick wand.
8512%
8513%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8514%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8515%
8516*/
8517WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8518  const AlphaChannelType alpha_type)
8519{
8520  assert(wand != (MagickWand *) NULL);
8521  assert(wand->signature == WandSignature);
8522  if (wand->debug != MagickFalse)
8523    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8524  if (wand->images == (Image *) NULL)
8525    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8526  return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8527}
8528
8529/*
8530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8531%                                                                             %
8532%                                                                             %
8533%                                                                             %
8534%   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                 %
8535%                                                                             %
8536%                                                                             %
8537%                                                                             %
8538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8539%
8540%  MagickSetImageBackgroundColor() sets the image background color.
8541%
8542%  The format of the MagickSetImageBackgroundColor method is:
8543%
8544%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8545%        const PixelWand *background)
8546%
8547%  A description of each parameter follows:
8548%
8549%    o wand: the magick wand.
8550%
8551%    o background: the background pixel wand.
8552%
8553*/
8554WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8555  const PixelWand *background)
8556{
8557  assert(wand != (MagickWand *) NULL);
8558  assert(wand->signature == WandSignature);
8559  if (wand->debug != MagickFalse)
8560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8561  if (wand->images == (Image *) NULL)
8562    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8563  PixelGetQuantumPacket(background,&wand->images->background_color);
8564  return(MagickTrue);
8565}
8566
8567/*
8568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8569%                                                                             %
8570%                                                                             %
8571%                                                                             %
8572%   M a g i c k S e t I m a g e B i a s                                       %
8573%                                                                             %
8574%                                                                             %
8575%                                                                             %
8576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8577%
8578%  MagickSetImageBias() sets the image bias for any method that convolves an
8579%  image (e.g. MagickConvolveImage()).
8580%
8581%  The format of the MagickSetImageBias method is:
8582%
8583%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8584%        const double bias)
8585%
8586%  A description of each parameter follows:
8587%
8588%    o wand: the magick wand.
8589%
8590%    o bias: the image bias.
8591%
8592*/
8593WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8594  const double bias)
8595{
8596  assert(wand != (MagickWand *) NULL);
8597  assert(wand->signature == WandSignature);
8598  if (wand->debug != MagickFalse)
8599    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8600  if (wand->images == (Image *) NULL)
8601    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8602  wand->images->bias=bias;
8603  return(MagickTrue);
8604}
8605
8606/*
8607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8608%                                                                             %
8609%                                                                             %
8610%                                                                             %
8611%   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                         %
8612%                                                                             %
8613%                                                                             %
8614%                                                                             %
8615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8616%
8617%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8618%
8619%  The format of the MagickSetImageBluePrimary method is:
8620%
8621%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8622%        const double x,const double y)
8623%
8624%  A description of each parameter follows:
8625%
8626%    o wand: the magick wand.
8627%
8628%    o x: the blue primary x-point.
8629%
8630%    o y: the blue primary y-point.
8631%
8632*/
8633WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8634  const double x,const double y)
8635{
8636  assert(wand != (MagickWand *) NULL);
8637  assert(wand->signature == WandSignature);
8638  if (wand->debug != MagickFalse)
8639    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8640  if (wand->images == (Image *) NULL)
8641    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8642  wand->images->chromaticity.blue_primary.x=x;
8643  wand->images->chromaticity.blue_primary.y=y;
8644  return(MagickTrue);
8645}
8646
8647/*
8648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8649%                                                                             %
8650%                                                                             %
8651%                                                                             %
8652%   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                         %
8653%                                                                             %
8654%                                                                             %
8655%                                                                             %
8656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8657%
8658%  MagickSetImageBorderColor() sets the image border color.
8659%
8660%  The format of the MagickSetImageBorderColor method is:
8661%
8662%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8663%        const PixelWand *border)
8664%
8665%  A description of each parameter follows:
8666%
8667%    o wand: the magick wand.
8668%
8669%    o border: the border pixel wand.
8670%
8671*/
8672WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8673  const PixelWand *border)
8674{
8675  assert(wand != (MagickWand *) NULL);
8676  assert(wand->signature == WandSignature);
8677  if (wand->debug != MagickFalse)
8678    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8679  if (wand->images == (Image *) NULL)
8680    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8681  PixelGetQuantumPacket(border,&wand->images->border_color);
8682  return(MagickTrue);
8683}
8684
8685/*
8686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8687%                                                                             %
8688%                                                                             %
8689%                                                                             %
8690%   M a g i c k S e t I m a g e C l i p M a s k                               %
8691%                                                                             %
8692%                                                                             %
8693%                                                                             %
8694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8695%
8696%  MagickSetImageClipMask() sets image clip mask.
8697%
8698%  The format of the MagickSetImageClipMask method is:
8699%
8700%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8701%        const MagickWand *clip_mask)
8702%
8703%  A description of each parameter follows:
8704%
8705%    o wand: the magick wand.
8706%
8707%    o clip_mask: the clip_mask wand.
8708%
8709*/
8710WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8711  const MagickWand *clip_mask)
8712{
8713  assert(wand != (MagickWand *) NULL);
8714  assert(wand->signature == WandSignature);
8715  if (wand->debug != MagickFalse)
8716    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8717  assert(clip_mask != (MagickWand *) NULL);
8718  assert(clip_mask->signature == WandSignature);
8719  if (wand->debug != MagickFalse)
8720    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8721  if (clip_mask->images == (Image *) NULL)
8722    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8723  return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8724}
8725
8726/*
8727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8728%                                                                             %
8729%                                                                             %
8730%                                                                             %
8731%   M a g i c k S e t I m a g e C o l o r                                     %
8732%                                                                             %
8733%                                                                             %
8734%                                                                             %
8735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8736%
8737%  MagickSetImageColor() set the entire wand canvas to the specified color.
8738%
8739%  The format of the MagickSetImageColor method is:
8740%
8741%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8742%        const PixelWand *color)
8743%
8744%  A description of each parameter follows:
8745%
8746%    o wand: the magick wand.
8747%
8748%    o background: the image color.
8749%
8750*/
8751WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8752  const PixelWand *color)
8753{
8754  MagickBooleanType
8755    status;
8756
8757  PixelInfo
8758    pixel;
8759
8760  assert(wand != (MagickWand *) NULL);
8761  assert(wand->signature == WandSignature);
8762  if (wand->debug != MagickFalse)
8763    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8764  PixelGetMagickColor(color,&pixel);
8765  status=SetImageColor(wand->images,&pixel);
8766  if (status == MagickFalse)
8767    InheritException(wand->exception,&wand->images->exception);
8768  return(status);
8769}
8770
8771/*
8772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8773%                                                                             %
8774%                                                                             %
8775%                                                                             %
8776%   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                     %
8777%                                                                             %
8778%                                                                             %
8779%                                                                             %
8780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8781%
8782%  MagickSetImageColormapColor() sets the color of the specified colormap
8783%  index.
8784%
8785%  The format of the MagickSetImageColormapColor method is:
8786%
8787%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8788%        const size_t index,const PixelWand *color)
8789%
8790%  A description of each parameter follows:
8791%
8792%    o wand: the magick wand.
8793%
8794%    o index: the offset into the image colormap.
8795%
8796%    o color: Return the colormap color in this wand.
8797%
8798*/
8799WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8800  const size_t index,const PixelWand *color)
8801{
8802  assert(wand != (MagickWand *) NULL);
8803  assert(wand->signature == WandSignature);
8804  if (wand->debug != MagickFalse)
8805    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8806  if (wand->images == (Image *) NULL)
8807    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8808  if ((wand->images->colormap == (PixelPacket *) NULL) ||
8809      (index >= wand->images->colors))
8810    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8811  PixelGetQuantumPacket(color,wand->images->colormap+index);
8812  return(SyncImage(wand->images));
8813}
8814
8815/*
8816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8817%                                                                             %
8818%                                                                             %
8819%                                                                             %
8820%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8821%                                                                             %
8822%                                                                             %
8823%                                                                             %
8824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8825%
8826%  MagickSetImageColorspace() sets the image colorspace.
8827%
8828%  The format of the MagickSetImageColorspace method is:
8829%
8830%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8831%        const ColorspaceType colorspace)
8832%
8833%  A description of each parameter follows:
8834%
8835%    o wand: the magick wand.
8836%
8837%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8838%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8839%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8840%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8841%      HSLColorspace, or HWBColorspace.
8842%
8843*/
8844WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8845  const ColorspaceType colorspace)
8846{
8847  assert(wand != (MagickWand *) NULL);
8848  assert(wand->signature == WandSignature);
8849  if (wand->debug != MagickFalse)
8850    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8851  if (wand->images == (Image *) NULL)
8852    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8853  return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8854}
8855
8856/*
8857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8858%                                                                             %
8859%                                                                             %
8860%                                                                             %
8861%   M a g i c k S e t I m a g e C o m p o s e                                 %
8862%                                                                             %
8863%                                                                             %
8864%                                                                             %
8865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8866%
8867%  MagickSetImageCompose() sets the image composite operator, useful for
8868%  specifying how to composite the image thumbnail when using the
8869%  MagickMontageImage() method.
8870%
8871%  The format of the MagickSetImageCompose method is:
8872%
8873%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8874%        const CompositeOperator compose)
8875%
8876%  A description of each parameter follows:
8877%
8878%    o wand: the magick wand.
8879%
8880%    o compose: the image composite operator.
8881%
8882*/
8883WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8884  const CompositeOperator compose)
8885{
8886  assert(wand != (MagickWand *) NULL);
8887  assert(wand->signature == WandSignature);
8888  if (wand->debug != MagickFalse)
8889    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8890  if (wand->images == (Image *) NULL)
8891    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8892  wand->images->compose=compose;
8893  return(MagickTrue);
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 r e s s i o n                         %
8902%                                                                             %
8903%                                                                             %
8904%                                                                             %
8905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8906%
8907%  MagickSetImageCompression() sets the image compression.
8908%
8909%  The format of the MagickSetImageCompression method is:
8910%
8911%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8912%        const CompressionType compression)
8913%
8914%  A description of each parameter follows:
8915%
8916%    o wand: the magick wand.
8917%
8918%    o compression: the image compression type.
8919%
8920*/
8921WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8922  const CompressionType compression)
8923{
8924  assert(wand != (MagickWand *) NULL);
8925  assert(wand->signature == WandSignature);
8926  if (wand->debug != MagickFalse)
8927    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8928  if (wand->images == (Image *) NULL)
8929    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8930  wand->images->compression=compression;
8931  return(MagickTrue);
8932}
8933
8934/*
8935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8936%                                                                             %
8937%                                                                             %
8938%                                                                             %
8939%   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           %
8940%                                                                             %
8941%                                                                             %
8942%                                                                             %
8943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8944%
8945%  MagickSetImageCompressionQuality() sets the image compression quality.
8946%
8947%  The format of the MagickSetImageCompressionQuality method is:
8948%
8949%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8950%        const size_t quality)
8951%
8952%  A description of each parameter follows:
8953%
8954%    o wand: the magick wand.
8955%
8956%    o quality: the image compression tlityype.
8957%
8958*/
8959WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8960  const size_t quality)
8961{
8962  assert(wand != (MagickWand *) NULL);
8963  assert(wand->signature == WandSignature);
8964  if (wand->debug != MagickFalse)
8965    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8966  if (wand->images == (Image *) NULL)
8967    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8968  wand->images->quality=quality;
8969  return(MagickTrue);
8970}
8971
8972/*
8973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8974%                                                                             %
8975%                                                                             %
8976%                                                                             %
8977%   M a g i c k S e t I m a g e D e l a y                                     %
8978%                                                                             %
8979%                                                                             %
8980%                                                                             %
8981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8982%
8983%  MagickSetImageDelay() sets the image delay.
8984%
8985%  The format of the MagickSetImageDelay method is:
8986%
8987%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
8988%        const size_t delay)
8989%
8990%  A description of each parameter follows:
8991%
8992%    o wand: the magick wand.
8993%
8994%    o delay: the image delay in ticks-per-second units.
8995%
8996*/
8997WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
8998  const size_t delay)
8999{
9000  assert(wand != (MagickWand *) NULL);
9001  assert(wand->signature == WandSignature);
9002  if (wand->debug != MagickFalse)
9003    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9004  if (wand->images == (Image *) NULL)
9005    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9006  wand->images->delay=delay;
9007  return(MagickTrue);
9008}
9009
9010/*
9011%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9012%                                                                             %
9013%                                                                             %
9014%                                                                             %
9015%   M a g i c k S e t I m a g e D e p t h                                     %
9016%                                                                             %
9017%                                                                             %
9018%                                                                             %
9019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9020%
9021%  MagickSetImageDepth() sets the image depth.
9022%
9023%  The format of the MagickSetImageDepth method is:
9024%
9025%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9026%        const size_t depth)
9027%
9028%  A description of each parameter follows:
9029%
9030%    o wand: the magick wand.
9031%
9032%    o depth: the image depth in bits: 8, 16, or 32.
9033%
9034*/
9035WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9036  const size_t depth)
9037{
9038  assert(wand != (MagickWand *) NULL);
9039  assert(wand->signature == WandSignature);
9040  if (wand->debug != MagickFalse)
9041    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9042  if (wand->images == (Image *) NULL)
9043    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9044  return(SetImageDepth(wand->images,depth));
9045}
9046
9047/*
9048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9049%                                                                             %
9050%                                                                             %
9051%                                                                             %
9052%   M a g i c k S e t I m a g e D i s p o s e                                 %
9053%                                                                             %
9054%                                                                             %
9055%                                                                             %
9056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9057%
9058%  MagickSetImageDispose() sets the image disposal method.
9059%
9060%  The format of the MagickSetImageDispose method is:
9061%
9062%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9063%        const DisposeType dispose)
9064%
9065%  A description of each parameter follows:
9066%
9067%    o wand: the magick wand.
9068%
9069%    o dispose: the image disposeal type.
9070%
9071*/
9072WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9073  const DisposeType dispose)
9074{
9075  assert(wand != (MagickWand *) NULL);
9076  assert(wand->signature == WandSignature);
9077  if (wand->debug != MagickFalse)
9078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9079  if (wand->images == (Image *) NULL)
9080    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9081  wand->images->dispose=dispose;
9082  return(MagickTrue);
9083}
9084
9085/*
9086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9087%                                                                             %
9088%                                                                             %
9089%                                                                             %
9090%   M a g i c k S e t I m a g e E x t e n t                                   %
9091%                                                                             %
9092%                                                                             %
9093%                                                                             %
9094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9095%
9096%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9097%
9098%  The format of the MagickSetImageExtent method is:
9099%
9100%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9101%        const size_t columns,const unsigned rows)
9102%
9103%  A description of each parameter follows:
9104%
9105%    o wand: the magick wand.
9106%
9107%    o columns:  The image width in pixels.
9108%
9109%    o rows:  The image height in pixels.
9110%
9111*/
9112WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9113  const size_t columns,const size_t rows)
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  return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9122}
9123
9124/*
9125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9126%                                                                             %
9127%                                                                             %
9128%                                                                             %
9129%   M a g i c k S e t I m a g e F i l e n a m e                               %
9130%                                                                             %
9131%                                                                             %
9132%                                                                             %
9133%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9134%
9135%  MagickSetImageFilename() sets the filename of a particular image in a
9136%  sequence.
9137%
9138%  The format of the MagickSetImageFilename method is:
9139%
9140%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9141%        const char *filename)
9142%
9143%  A description of each parameter follows:
9144%
9145%    o wand: the magick wand.
9146%
9147%    o filename: the image filename.
9148%
9149*/
9150WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9151  const char *filename)
9152{
9153  assert(wand != (MagickWand *) NULL);
9154  assert(wand->signature == WandSignature);
9155  if (wand->debug != MagickFalse)
9156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9157  if (wand->images == (Image *) NULL)
9158    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9159  if (filename != (const char *) NULL)
9160    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9161  return(MagickTrue);
9162}
9163
9164/*
9165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9166%                                                                             %
9167%                                                                             %
9168%                                                                             %
9169%   M a g i c k S e t I m a g e F o r m a t                                   %
9170%                                                                             %
9171%                                                                             %
9172%                                                                             %
9173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9174%
9175%  MagickSetImageFormat() sets the format of a particular image in a
9176%  sequence.
9177%
9178%  The format of the MagickSetImageFormat method is:
9179%
9180%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9181%        const char *format)
9182%
9183%  A description of each parameter follows:
9184%
9185%    o wand: the magick wand.
9186%
9187%    o format: the image format.
9188%
9189*/
9190WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9191  const char *format)
9192{
9193  const MagickInfo
9194    *magick_info;
9195
9196  assert(wand != (MagickWand *) NULL);
9197  assert(wand->signature == WandSignature);
9198  if (wand->debug != MagickFalse)
9199    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9200  if (wand->images == (Image *) NULL)
9201    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9202  if ((format == (char *) NULL) || (*format == '\0'))
9203    {
9204      *wand->images->magick='\0';
9205      return(MagickTrue);
9206    }
9207  magick_info=GetMagickInfo(format,wand->exception);
9208  if (magick_info == (const MagickInfo *) NULL)
9209    return(MagickFalse);
9210  ClearMagickException(wand->exception);
9211  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9212  return(MagickTrue);
9213}
9214
9215/*
9216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9217%                                                                             %
9218%                                                                             %
9219%                                                                             %
9220%   M a g i c k S e t I m a g e F u z z                                       %
9221%                                                                             %
9222%                                                                             %
9223%                                                                             %
9224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9225%
9226%  MagickSetImageFuzz() sets the image fuzz.
9227%
9228%  The format of the MagickSetImageFuzz method is:
9229%
9230%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9231%        const double fuzz)
9232%
9233%  A description of each parameter follows:
9234%
9235%    o wand: the magick wand.
9236%
9237%    o fuzz: the image fuzz.
9238%
9239*/
9240WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9241  const double fuzz)
9242{
9243  assert(wand != (MagickWand *) NULL);
9244  assert(wand->signature == WandSignature);
9245  if (wand->debug != MagickFalse)
9246    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9247  if (wand->images == (Image *) NULL)
9248    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9249  wand->images->fuzz=fuzz;
9250  return(MagickTrue);
9251}
9252
9253/*
9254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9255%                                                                             %
9256%                                                                             %
9257%                                                                             %
9258%   M a g i c k S e t I m a g e G a m m a                                     %
9259%                                                                             %
9260%                                                                             %
9261%                                                                             %
9262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9263%
9264%  MagickSetImageGamma() sets the image gamma.
9265%
9266%  The format of the MagickSetImageGamma method is:
9267%
9268%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9269%        const double gamma)
9270%
9271%  A description of each parameter follows:
9272%
9273%    o wand: the magick wand.
9274%
9275%    o gamma: the image gamma.
9276%
9277*/
9278WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9279  const double gamma)
9280{
9281  assert(wand != (MagickWand *) NULL);
9282  assert(wand->signature == WandSignature);
9283  if (wand->debug != MagickFalse)
9284    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9285  if (wand->images == (Image *) NULL)
9286    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9287  wand->images->gamma=gamma;
9288  return(MagickTrue);
9289}
9290
9291/*
9292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9293%                                                                             %
9294%                                                                             %
9295%                                                                             %
9296%   M a g i c k S e t I m a g e G r a v i t y                                 %
9297%                                                                             %
9298%                                                                             %
9299%                                                                             %
9300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9301%
9302%  MagickSetImageGravity() sets the image gravity type.
9303%
9304%  The format of the MagickSetImageGravity method is:
9305%
9306%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9307%        const GravityType gravity)
9308%
9309%  A description of each parameter follows:
9310%
9311%    o wand: the magick wand.
9312%
9313%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9314%      PlaneInterlace, PartitionInterlace.
9315%
9316*/
9317WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9318  const GravityType gravity)
9319{
9320  assert(wand != (MagickWand *) NULL);
9321  assert(wand->signature == WandSignature);
9322  if (wand->debug != MagickFalse)
9323    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9324  if (wand->images == (Image *) NULL)
9325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9326  wand->images->gravity=gravity;
9327  return(MagickTrue);
9328}
9329
9330/*
9331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9332%                                                                             %
9333%                                                                             %
9334%                                                                             %
9335%   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                       %
9336%                                                                             %
9337%                                                                             %
9338%                                                                             %
9339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9340%
9341%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9342%  point.
9343%
9344%  The format of the MagickSetImageGreenPrimary method is:
9345%
9346%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9347%        const double x,const double y)
9348%
9349%  A description of each parameter follows:
9350%
9351%    o wand: the magick wand.
9352%
9353%    o x: the green primary x-point.
9354%
9355%    o y: the green primary y-point.
9356%
9357%
9358*/
9359WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9360  const double x,const double y)
9361{
9362  assert(wand != (MagickWand *) NULL);
9363  assert(wand->signature == WandSignature);
9364  if (wand->debug != MagickFalse)
9365    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9366  if (wand->images == (Image *) NULL)
9367    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9368  wand->images->chromaticity.green_primary.x=x;
9369  wand->images->chromaticity.green_primary.y=y;
9370  return(MagickTrue);
9371}
9372
9373/*
9374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9375%                                                                             %
9376%                                                                             %
9377%                                                                             %
9378%   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                 %
9379%                                                                             %
9380%                                                                             %
9381%                                                                             %
9382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9383%
9384%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9385%
9386%  The format of the MagickSetImageInterlaceScheme method is:
9387%
9388%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9389%        const InterlaceType interlace)
9390%
9391%  A description of each parameter follows:
9392%
9393%    o wand: the magick wand.
9394%
9395%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9396%      PlaneInterlace, PartitionInterlace.
9397%
9398*/
9399WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9400  const InterlaceType interlace)
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->interlace=interlace;
9409  return(MagickTrue);
9410}
9411
9412/*
9413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9414%                                                                             %
9415%                                                                             %
9416%                                                                             %
9417%   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             %
9418%                                                                             %
9419%                                                                             %
9420%                                                                             %
9421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9422%
9423%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9424%
9425%  The format of the MagickSetImageInterpolateMethod method is:
9426%
9427%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9428%        const InterpolatePixelMethod method)
9429%
9430%  A description of each parameter follows:
9431%
9432%    o wand: the magick wand.
9433%
9434%    o method: the image interpole pixel methods: choose from Undefined,
9435%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9436%
9437*/
9438WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9439  const InterpolatePixelMethod method)
9440{
9441  assert(wand != (MagickWand *) NULL);
9442  assert(wand->signature == WandSignature);
9443  if (wand->debug != MagickFalse)
9444    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9445  if (wand->images == (Image *) NULL)
9446    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9447  wand->images->interpolate=method;
9448  return(MagickTrue);
9449}
9450
9451/*
9452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9453%                                                                             %
9454%                                                                             %
9455%                                                                             %
9456%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9457%                                                                             %
9458%                                                                             %
9459%                                                                             %
9460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9461%
9462%  MagickSetImageIterations() sets the image iterations.
9463%
9464%  The format of the MagickSetImageIterations method is:
9465%
9466%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9467%        const size_t iterations)
9468%
9469%  A description of each parameter follows:
9470%
9471%    o wand: the magick wand.
9472%
9473%    o delay: the image delay in 1/100th of a second.
9474%
9475*/
9476WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9477  const size_t iterations)
9478{
9479  assert(wand != (MagickWand *) NULL);
9480  assert(wand->signature == WandSignature);
9481  if (wand->debug != MagickFalse)
9482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9483  if (wand->images == (Image *) NULL)
9484    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9485  wand->images->iterations=iterations;
9486  return(MagickTrue);
9487}
9488
9489/*
9490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9491%                                                                             %
9492%                                                                             %
9493%                                                                             %
9494%   M a g i c k S e t I m a g e M a t t e                                     %
9495%                                                                             %
9496%                                                                             %
9497%                                                                             %
9498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9499%
9500%  MagickSetImageMatte() sets the image matte channel.
9501%
9502%  The format of the MagickSetImageMatteColor method is:
9503%
9504%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9505%        const MagickBooleanType *matte)
9506%
9507%  A description of each parameter follows:
9508%
9509%    o wand: the magick wand.
9510%
9511%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9512%      MagickFalse.
9513%
9514*/
9515WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9516  const MagickBooleanType matte)
9517{
9518  assert(wand != (MagickWand *) NULL);
9519  assert(wand->signature == WandSignature);
9520  if (wand->debug != MagickFalse)
9521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9522  if (wand->images == (Image *) NULL)
9523    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9524  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9525    (void) SetImageOpacity(wand->images,OpaqueAlpha);
9526  wand->images->matte=matte;
9527  return(MagickTrue);
9528}
9529
9530/*
9531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9532%                                                                             %
9533%                                                                             %
9534%                                                                             %
9535%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9536%                                                                             %
9537%                                                                             %
9538%                                                                             %
9539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9540%
9541%  MagickSetImageMatteColor() sets the image matte color.
9542%
9543%  The format of the MagickSetImageMatteColor method is:
9544%
9545%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9546%        const PixelWand *matte)
9547%
9548%  A description of each parameter follows:
9549%
9550%    o wand: the magick wand.
9551%
9552%    o matte: the matte pixel wand.
9553%
9554*/
9555WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9556  const PixelWand *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  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9565  return(MagickTrue);
9566}
9567
9568/*
9569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9570%                                                                             %
9571%                                                                             %
9572%                                                                             %
9573%   M a g i c k S e t I m a g e O p a c i t y                                 %
9574%                                                                             %
9575%                                                                             %
9576%                                                                             %
9577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9578%
9579%  MagickSetImageOpacity() sets the image to the specified opacity level.
9580%
9581%  The format of the MagickSetImageOpacity method is:
9582%
9583%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9584%        const double alpha)
9585%
9586%  A description of each parameter follows:
9587%
9588%    o wand: the magick wand.
9589%
9590%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9591%      transparent.
9592%
9593*/
9594WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9595  const double alpha)
9596{
9597  MagickBooleanType
9598    status;
9599
9600  assert(wand != (MagickWand *) NULL);
9601  assert(wand->signature == WandSignature);
9602  if (wand->debug != MagickFalse)
9603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9604  if (wand->images == (Image *) NULL)
9605    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9606  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9607  if (status == MagickFalse)
9608    InheritException(wand->exception,&wand->images->exception);
9609  return(status);
9610}
9611
9612/*
9613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9614%                                                                             %
9615%                                                                             %
9616%                                                                             %
9617%   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                         %
9618%                                                                             %
9619%                                                                             %
9620%                                                                             %
9621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9622%
9623%  MagickSetImageOrientation() sets the image orientation.
9624%
9625%  The format of the MagickSetImageOrientation method is:
9626%
9627%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9628%        const OrientationType orientation)
9629%
9630%  A description of each parameter follows:
9631%
9632%    o wand: the magick wand.
9633%
9634%    o orientation: the image orientation type.
9635%
9636*/
9637WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9638  const OrientationType orientation)
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  wand->images->orientation=orientation;
9647  return(MagickTrue);
9648}
9649
9650/*
9651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9652%                                                                             %
9653%                                                                             %
9654%                                                                             %
9655%   M a g i c k S e t I m a g e P a g e                                       %
9656%                                                                             %
9657%                                                                             %
9658%                                                                             %
9659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9660%
9661%  MagickSetImagePage() sets the page geometry of the image.
9662%
9663%  The format of the MagickSetImagePage method is:
9664%
9665%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9666%        const size_t width,const size_t height,const ssize_t x,
9667%        const ssize_t y)
9668%
9669%  A description of each parameter follows:
9670%
9671%    o wand: the magick wand.
9672%
9673%    o width: the page width.
9674%
9675%    o height: the page height.
9676%
9677%    o x: the page x-offset.
9678%
9679%    o y: the page y-offset.
9680%
9681*/
9682WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9683  const size_t width,const size_t height,const ssize_t x,
9684  const ssize_t y)
9685{
9686  assert(wand != (MagickWand *) NULL);
9687  assert(wand->signature == WandSignature);
9688  if (wand->debug != MagickFalse)
9689    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9690  if (wand->images == (Image *) NULL)
9691    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9692  wand->images->page.width=width;
9693  wand->images->page.height=height;
9694  wand->images->page.x=x;
9695  wand->images->page.y=y;
9696  return(MagickTrue);
9697}
9698
9699/*
9700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9701%                                                                             %
9702%                                                                             %
9703%                                                                             %
9704%   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                 %
9705%                                                                             %
9706%                                                                             %
9707%                                                                             %
9708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9709%
9710%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9711%  specified method and returns the previous progress monitor if any.  The
9712%  progress monitor method looks like this:
9713%
9714%    MagickBooleanType MagickProgressMonitor(const char *text,
9715%      const MagickOffsetType offset,const MagickSizeType span,
9716%      void *client_data)
9717%
9718%  If the progress monitor returns MagickFalse, the current operation is
9719%  interrupted.
9720%
9721%  The format of the MagickSetImageProgressMonitor method is:
9722%
9723%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9724%        const MagickProgressMonitor progress_monitor,void *client_data)
9725%
9726%  A description of each parameter follows:
9727%
9728%    o wand: the magick wand.
9729%
9730%    o progress_monitor: Specifies a pointer to a method to monitor progress
9731%      of an image operation.
9732%
9733%    o client_data: Specifies a pointer to any client data.
9734%
9735*/
9736WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9737  const MagickProgressMonitor progress_monitor,void *client_data)
9738{
9739  MagickProgressMonitor
9740    previous_monitor;
9741
9742  assert(wand != (MagickWand *) NULL);
9743  assert(wand->signature == WandSignature);
9744  if (wand->debug != MagickFalse)
9745    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9746  if (wand->images == (Image *) NULL)
9747    {
9748      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9749        "ContainsNoImages","`%s'",wand->name);
9750      return((MagickProgressMonitor) NULL);
9751    }
9752  previous_monitor=SetImageProgressMonitor(wand->images,
9753    progress_monitor,client_data);
9754  return(previous_monitor);
9755}
9756
9757/*
9758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9759%                                                                             %
9760%                                                                             %
9761%                                                                             %
9762%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9763%                                                                             %
9764%                                                                             %
9765%                                                                             %
9766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9767%
9768%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9769%
9770%  The format of the MagickSetImageRedPrimary method is:
9771%
9772%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9773%        const double x,const double y)
9774%
9775%  A description of each parameter follows:
9776%
9777%    o wand: the magick wand.
9778%
9779%    o x: the red primary x-point.
9780%
9781%    o y: the red primary y-point.
9782%
9783*/
9784WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9785  const double x,const double y)
9786{
9787  assert(wand != (MagickWand *) NULL);
9788  assert(wand->signature == WandSignature);
9789  if (wand->debug != MagickFalse)
9790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9791  if (wand->images == (Image *) NULL)
9792    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9793  wand->images->chromaticity.red_primary.x=x;
9794  wand->images->chromaticity.red_primary.y=y;
9795  return(MagickTrue);
9796}
9797
9798/*
9799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9800%                                                                             %
9801%                                                                             %
9802%                                                                             %
9803%   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                 %
9804%                                                                             %
9805%                                                                             %
9806%                                                                             %
9807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9808%
9809%  MagickSetImageRenderingIntent() sets the image rendering intent.
9810%
9811%  The format of the MagickSetImageRenderingIntent method is:
9812%
9813%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9814%        const RenderingIntent rendering_intent)
9815%
9816%  A description of each parameter follows:
9817%
9818%    o wand: the magick wand.
9819%
9820%    o rendering_intent: the image rendering intent: UndefinedIntent,
9821%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9822%
9823*/
9824WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9825  const RenderingIntent rendering_intent)
9826{
9827  assert(wand != (MagickWand *) NULL);
9828  assert(wand->signature == WandSignature);
9829  if (wand->debug != MagickFalse)
9830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9831  if (wand->images == (Image *) NULL)
9832    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9833  wand->images->rendering_intent=rendering_intent;
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 s o l u t i o n                           %
9843%                                                                             %
9844%                                                                             %
9845%                                                                             %
9846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9847%
9848%  MagickSetImageResolution() sets the image resolution.
9849%
9850%  The format of the MagickSetImageResolution method is:
9851%
9852%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9853%        const double x_resolution,const doubtl y_resolution)
9854%
9855%  A description of each parameter follows:
9856%
9857%    o wand: the magick wand.
9858%
9859%    o x_resolution: the image x resolution.
9860%
9861%    o y_resolution: the image y resolution.
9862%
9863*/
9864WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9865  const double x_resolution,const double y_resolution)
9866{
9867  assert(wand != (MagickWand *) NULL);
9868  assert(wand->signature == WandSignature);
9869  if (wand->debug != MagickFalse)
9870    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9871  if (wand->images == (Image *) NULL)
9872    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9873  wand->images->x_resolution=x_resolution;
9874  wand->images->y_resolution=y_resolution;
9875  return(MagickTrue);
9876}
9877
9878/*
9879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9880%                                                                             %
9881%                                                                             %
9882%                                                                             %
9883%   M a g i c k S e t I m a g e S c e n e                                     %
9884%                                                                             %
9885%                                                                             %
9886%                                                                             %
9887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9888%
9889%  MagickSetImageScene() sets the image scene.
9890%
9891%  The format of the MagickSetImageScene method is:
9892%
9893%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9894%        const size_t scene)
9895%
9896%  A description of each parameter follows:
9897%
9898%    o wand: the magick wand.
9899%
9900%    o delay: the image scene number.
9901%
9902*/
9903WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9904  const size_t scene)
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->scene=scene;
9913  return(MagickTrue);
9914}
9915
9916/*
9917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9918%                                                                             %
9919%                                                                             %
9920%                                                                             %
9921%   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                   %
9922%                                                                             %
9923%                                                                             %
9924%                                                                             %
9925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9926%
9927%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9928%
9929%  The format of the MagickSetImageTicksPerSecond method is:
9930%
9931%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9932%        const ssize_t ticks_per-second)
9933%
9934%  A description of each parameter follows:
9935%
9936%    o wand: the magick wand.
9937%
9938%    o ticks_per_second: the units to use for the image delay.
9939%
9940*/
9941WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9942  const ssize_t ticks_per_second)
9943{
9944  assert(wand != (MagickWand *) NULL);
9945  assert(wand->signature == WandSignature);
9946  if (wand->debug != MagickFalse)
9947    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9948  if (wand->images == (Image *) NULL)
9949    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9950  wand->images->ticks_per_second=ticks_per_second;
9951  return(MagickTrue);
9952}
9953
9954/*
9955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9956%                                                                             %
9957%                                                                             %
9958%                                                                             %
9959%   M a g i c k S e t I m a g e T y p e                                       %
9960%                                                                             %
9961%                                                                             %
9962%                                                                             %
9963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9964%
9965%  MagickSetImageType() sets the image type.
9966%
9967%  The format of the MagickSetImageType method is:
9968%
9969%      MagickBooleanType MagickSetImageType(MagickWand *wand,
9970%        const ImageType image_type)
9971%
9972%  A description of each parameter follows:
9973%
9974%    o wand: the magick wand.
9975%
9976%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
9977%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
9978%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
9979%      or OptimizeType.
9980%
9981*/
9982WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
9983  const ImageType image_type)
9984{
9985  assert(wand != (MagickWand *) NULL);
9986  assert(wand->signature == WandSignature);
9987  if (wand->debug != MagickFalse)
9988    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9989  if (wand->images == (Image *) NULL)
9990    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9991  return(SetImageType(wand->images,image_type,wand->exception));
9992}
9993
9994/*
9995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9996%                                                                             %
9997%                                                                             %
9998%                                                                             %
9999%   M a g i c k S e t I m a g e U n i t s                                     %
10000%                                                                             %
10001%                                                                             %
10002%                                                                             %
10003%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10004%
10005%  MagickSetImageUnits() sets the image units of resolution.
10006%
10007%  The format of the MagickSetImageUnits method is:
10008%
10009%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10010%        const ResolutionType units)
10011%
10012%  A description of each parameter follows:
10013%
10014%    o wand: the magick wand.
10015%
10016%    o units: the image units of resolution : UndefinedResolution,
10017%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10018%
10019*/
10020WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10021  const ResolutionType units)
10022{
10023  assert(wand != (MagickWand *) NULL);
10024  assert(wand->signature == WandSignature);
10025  if (wand->debug != MagickFalse)
10026    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10027  if (wand->images == (Image *) NULL)
10028    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10029  wand->images->units=units;
10030  return(MagickTrue);
10031}
10032
10033/*
10034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10035%                                                                             %
10036%                                                                             %
10037%                                                                             %
10038%   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           %
10039%                                                                             %
10040%                                                                             %
10041%                                                                             %
10042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10043%
10044%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10045%
10046%  The format of the MagickSetImageVirtualPixelMethod method is:
10047%
10048%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10049%        const VirtualPixelMethod method)
10050%
10051%  A description of each parameter follows:
10052%
10053%    o wand: the magick wand.
10054%
10055%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10056%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10057%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10058%
10059*/
10060WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10061  const VirtualPixelMethod method)
10062{
10063  assert(wand != (MagickWand *) NULL);
10064  assert(wand->signature == WandSignature);
10065  if (wand->debug != MagickFalse)
10066    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10067  if (wand->images == (Image *) NULL)
10068    return(UndefinedVirtualPixelMethod);
10069  return(SetImageVirtualPixelMethod(wand->images,method));
10070}
10071
10072/*
10073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10074%                                                                             %
10075%                                                                             %
10076%                                                                             %
10077%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10078%                                                                             %
10079%                                                                             %
10080%                                                                             %
10081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10082%
10083%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10084%
10085%  The format of the MagickSetImageWhitePoint method is:
10086%
10087%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10088%        const double x,const double y)
10089%
10090%  A description of each parameter follows:
10091%
10092%    o wand: the magick wand.
10093%
10094%    o x: the white x-point.
10095%
10096%    o y: the white y-point.
10097%
10098*/
10099WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10100  const double x,const double y)
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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10108  wand->images->chromaticity.white_point.x=x;
10109  wand->images->chromaticity.white_point.y=y;
10110  return(MagickTrue);
10111}
10112
10113/*
10114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10115%                                                                             %
10116%                                                                             %
10117%                                                                             %
10118%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10119%                                                                             %
10120%                                                                             %
10121%                                                                             %
10122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10123%
10124%  MagickShadeImage() shines a distant light on an image to create a
10125%  three-dimensional effect. You control the positioning of the light with
10126%  azimuth and elevation; azimuth is measured in degrees off the x axis
10127%  and elevation is measured in pixels above the Z axis.
10128%
10129%  The format of the MagickShadeImage method is:
10130%
10131%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10132%        const MagickBooleanType gray,const double azimuth,
10133%        const double elevation)
10134%
10135%  A description of each parameter follows:
10136%
10137%    o wand: the magick wand.
10138%
10139%    o gray: A value other than zero shades the intensity of each pixel.
10140%
10141%    o azimuth, elevation:  Define the light source direction.
10142%
10143*/
10144WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10145  const MagickBooleanType gray,const double asimuth,const double elevation)
10146{
10147  Image
10148    *shade_image;
10149
10150  assert(wand != (MagickWand *) NULL);
10151  assert(wand->signature == WandSignature);
10152  if (wand->debug != MagickFalse)
10153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10154  if (wand->images == (Image *) NULL)
10155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10156  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10157  if (shade_image == (Image *) NULL)
10158    return(MagickFalse);
10159  ReplaceImageInList(&wand->images,shade_image);
10160  return(MagickTrue);
10161}
10162
10163/*
10164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10165%                                                                             %
10166%                                                                             %
10167%                                                                             %
10168%   M a g i c k S h a d o w I m a g e                                         %
10169%                                                                             %
10170%                                                                             %
10171%                                                                             %
10172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10173%
10174%  MagickShadowImage() simulates an image shadow.
10175%
10176%  The format of the MagickShadowImage method is:
10177%
10178%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10179%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10180%
10181%  A description of each parameter follows:
10182%
10183%    o wand: the magick wand.
10184%
10185%    o opacity: percentage transparency.
10186%
10187%    o sigma: the standard deviation of the Gaussian, in pixels.
10188%
10189%    o x: the shadow x-offset.
10190%
10191%    o y: the shadow y-offset.
10192%
10193*/
10194WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10195  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10196{
10197  Image
10198    *shadow_image;
10199
10200  assert(wand != (MagickWand *) NULL);
10201  assert(wand->signature == WandSignature);
10202  if (wand->debug != MagickFalse)
10203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10204  if (wand->images == (Image *) NULL)
10205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10206  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10207  if (shadow_image == (Image *) NULL)
10208    return(MagickFalse);
10209  ReplaceImageInList(&wand->images,shadow_image);
10210  return(MagickTrue);
10211}
10212
10213/*
10214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10215%                                                                             %
10216%                                                                             %
10217%                                                                             %
10218%   M a g i c k S h a r p e n I m a g e                                       %
10219%                                                                             %
10220%                                                                             %
10221%                                                                             %
10222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10223%
10224%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10225%  Gaussian operator of the given radius and standard deviation (sigma).
10226%  For reasonable results, the radius should be larger than sigma.  Use a
10227%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10228%
10229%  The format of the MagickSharpenImage method is:
10230%
10231%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10232%        const double radius,const double sigma,const double bias)
10233%
10234%  A description of each parameter follows:
10235%
10236%    o wand: the magick wand.
10237%
10238%    o radius: the radius of the Gaussian, in pixels, not counting the center
10239%      pixel.
10240%
10241%    o sigma: the standard deviation of the Gaussian, in pixels.
10242%
10243%    o bias: the bias.
10244%
10245*/
10246WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10247  const double radius,const double sigma,const double bias)
10248{
10249  Image
10250    *sharp_image;
10251
10252  assert(wand != (MagickWand *) NULL);
10253  assert(wand->signature == WandSignature);
10254  if (wand->debug != MagickFalse)
10255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10256  if (wand->images == (Image *) NULL)
10257    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10258  sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10259  if (sharp_image == (Image *) NULL)
10260    return(MagickFalse);
10261  ReplaceImageInList(&wand->images,sharp_image);
10262  return(MagickTrue);
10263}
10264
10265/*
10266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10267%                                                                             %
10268%                                                                             %
10269%                                                                             %
10270%   M a g i c k S h a v e I m a g e                                           %
10271%                                                                             %
10272%                                                                             %
10273%                                                                             %
10274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10275%
10276%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10277%  memory necessary for the new Image structure and returns a pointer to the
10278%  new image.
10279%
10280%  The format of the MagickShaveImage method is:
10281%
10282%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10283%        const size_t columns,const size_t rows)
10284%
10285%  A description of each parameter follows:
10286%
10287%    o wand: the magick wand.
10288%
10289%    o columns: the number of columns in the scaled image.
10290%
10291%    o rows: the number of rows in the scaled image.
10292%
10293%
10294*/
10295WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10296  const size_t columns,const size_t rows)
10297{
10298  Image
10299    *shave_image;
10300
10301  RectangleInfo
10302    shave_info;
10303
10304  assert(wand != (MagickWand *) NULL);
10305  assert(wand->signature == WandSignature);
10306  if (wand->debug != MagickFalse)
10307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10308  if (wand->images == (Image *) NULL)
10309    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10310  shave_info.width=columns;
10311  shave_info.height=rows;
10312  shave_info.x=0;
10313  shave_info.y=0;
10314  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10315  if (shave_image == (Image *) NULL)
10316    return(MagickFalse);
10317  ReplaceImageInList(&wand->images,shave_image);
10318  return(MagickTrue);
10319}
10320
10321/*
10322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10323%                                                                             %
10324%                                                                             %
10325%                                                                             %
10326%   M a g i c k S h e a r I m a g e                                           %
10327%                                                                             %
10328%                                                                             %
10329%                                                                             %
10330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10331%
10332%  MagickShearImage() slides one edge of an image along the X or Y axis,
10333%  creating a parallelogram.  An X direction shear slides an edge along the X
10334%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10335%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10336%  is measured relative to the Y axis, and similarly, for Y direction shears
10337%  y_shear is measured relative to the X axis.  Empty triangles left over from
10338%  shearing the image are filled with the background color.
10339%
10340%  The format of the MagickShearImage method is:
10341%
10342%      MagickBooleanType MagickShearImage(MagickWand *wand,
10343%        const PixelWand *background,const double x_shear,onst double y_shear)
10344%
10345%  A description of each parameter follows:
10346%
10347%    o wand: the magick wand.
10348%
10349%    o background: the background pixel wand.
10350%
10351%    o x_shear: the number of degrees to shear the image.
10352%
10353%    o y_shear: the number of degrees to shear the image.
10354%
10355*/
10356WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10357  const PixelWand *background,const double x_shear,const double y_shear)
10358{
10359  Image
10360    *shear_image;
10361
10362  assert(wand != (MagickWand *) NULL);
10363  assert(wand->signature == WandSignature);
10364  if (wand->debug != MagickFalse)
10365    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10366  if (wand->images == (Image *) NULL)
10367    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10368  PixelGetQuantumPacket(background,&wand->images->background_color);
10369  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10370  if (shear_image == (Image *) NULL)
10371    return(MagickFalse);
10372  ReplaceImageInList(&wand->images,shear_image);
10373  return(MagickTrue);
10374}
10375
10376/*
10377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10378%                                                                             %
10379%                                                                             %
10380%                                                                             %
10381%   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                   %
10382%                                                                             %
10383%                                                                             %
10384%                                                                             %
10385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10386%
10387%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10388%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10389%  image using a sigmoidal transfer function without saturating highlights or
10390%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10391%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10392%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10393%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10394%  is reduced.
10395%
10396%  The format of the MagickSigmoidalContrastImage method is:
10397%
10398%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10399%        const MagickBooleanType sharpen,const double alpha,const double beta)
10400%
10401%  A description of each parameter follows:
10402%
10403%    o wand: the magick wand.
10404%
10405%    o sharpen: Increase or decrease image contrast.
10406%
10407%    o alpha: strength of the contrast, the larger the number the more
10408%      'threshold-like' it becomes.
10409%
10410%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10411%
10412*/
10413WandExport MagickBooleanType MagickSigmoidalContrastImage(
10414  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10415  const double beta)
10416{
10417  MagickBooleanType
10418    status;
10419
10420  assert(wand != (MagickWand *) NULL);
10421  assert(wand->signature == WandSignature);
10422  if (wand->debug != MagickFalse)
10423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10424  if (wand->images == (Image *) NULL)
10425    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10426  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10427    &wand->images->exception);
10428  return(status);
10429}
10430
10431/*
10432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10433%                                                                             %
10434%                                                                             %
10435%                                                                             %
10436%   M a g i c k S i m i l a r i t y I m a g e                                 %
10437%                                                                             %
10438%                                                                             %
10439%                                                                             %
10440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10441%
10442%  MagickSimilarityImage() compares the reference image of the image and
10443%  returns the best match offset.  In addition, it returns a similarity image
10444%  such that an exact match location is completely white and if none of the
10445%  pixels match, black, otherwise some gray level in-between.
10446%
10447%  The format of the MagickSimilarityImage method is:
10448%
10449%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10450%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10451%
10452%  A description of each parameter follows:
10453%
10454%    o wand: the magick wand.
10455%
10456%    o reference: the reference wand.
10457%
10458%    o offset: the best match offset of the reference image within the image.
10459%
10460%    o similarity: the computed similarity between the images.
10461%
10462*/
10463WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10464  const MagickWand *reference,RectangleInfo *offset,double *similarity)
10465{
10466  Image
10467    *similarity_image;
10468
10469  assert(wand != (MagickWand *) NULL);
10470  assert(wand->signature == WandSignature);
10471  if (wand->debug != MagickFalse)
10472    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10473  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10474    {
10475      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10476        "ContainsNoImages","`%s'",wand->name);
10477      return((MagickWand *) NULL);
10478    }
10479  similarity_image=SimilarityImage(wand->images,reference->images,offset,
10480    similarity,&wand->images->exception);
10481  if (similarity_image == (Image *) NULL)
10482    return((MagickWand *) NULL);
10483  return(CloneMagickWandFromImages(wand,similarity_image));
10484}
10485
10486/*
10487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10488%                                                                             %
10489%                                                                             %
10490%                                                                             %
10491%   M a g i c k S k e t c h I m a g e                                         %
10492%                                                                             %
10493%                                                                             %
10494%                                                                             %
10495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10496%
10497%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10498%  a Gaussian operator of the given radius and standard deviation (sigma).
10499%  For reasonable results, radius should be larger than sigma.  Use a
10500%  radius of 0 and SketchImage() selects a suitable radius for you.
10501%  Angle gives the angle of the blurring motion.
10502%
10503%  The format of the MagickSketchImage method is:
10504%
10505%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10506%        const double radius,const double sigma,const double angle)
10507%
10508%  A description of each parameter follows:
10509%
10510%    o wand: the magick wand.
10511%
10512%    o radius: the radius of the Gaussian, in pixels, not counting
10513%      the center pixel.
10514%
10515%    o sigma: the standard deviation of the Gaussian, in pixels.
10516%
10517%    o angle: Apply the effect along this angle.
10518%
10519*/
10520WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10521  const double radius,const double sigma,const double angle)
10522{
10523  Image
10524    *sketch_image;
10525
10526  assert(wand != (MagickWand *) NULL);
10527  assert(wand->signature == WandSignature);
10528  if (wand->debug != MagickFalse)
10529    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10530  if (wand->images == (Image *) NULL)
10531    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10532  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10533  if (sketch_image == (Image *) NULL)
10534    return(MagickFalse);
10535  ReplaceImageInList(&wand->images,sketch_image);
10536  return(MagickTrue);
10537}
10538
10539/*
10540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10541%                                                                             %
10542%                                                                             %
10543%                                                                             %
10544%   M a g i c k S m u s h I m a g e s                                         %
10545%                                                                             %
10546%                                                                             %
10547%                                                                             %
10548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10549%
10550%  MagickSmushImages() takes all images from the current image pointer to the
10551%  end of the image list and smushs them to each other top-to-bottom if the
10552%  stack parameter is true, otherwise left-to-right.
10553%
10554%  The format of the MagickSmushImages method is:
10555%
10556%      MagickWand *MagickSmushImages(MagickWand *wand,
10557%        const MagickBooleanType stack,const ssize_t offset)
10558%
10559%  A description of each parameter follows:
10560%
10561%    o wand: the magick wand.
10562%
10563%    o stack: By default, images are stacked left-to-right. Set stack to
10564%      MagickTrue to stack them top-to-bottom.
10565%
10566%    o offset: minimum distance in pixels between images.
10567%
10568*/
10569WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10570  const MagickBooleanType stack,const ssize_t offset)
10571{
10572  Image
10573    *smush_image;
10574
10575  assert(wand != (MagickWand *) NULL);
10576  assert(wand->signature == WandSignature);
10577  if (wand->debug != MagickFalse)
10578    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10579  if (wand->images == (Image *) NULL)
10580    return((MagickWand *) NULL);
10581  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10582  if (smush_image == (Image *) NULL)
10583    return((MagickWand *) NULL);
10584  return(CloneMagickWandFromImages(wand,smush_image));
10585}
10586
10587/*
10588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10589%                                                                             %
10590%                                                                             %
10591%                                                                             %
10592%     M a g i c k S o l a r i z e I m a g e                                   %
10593%                                                                             %
10594%                                                                             %
10595%                                                                             %
10596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10597%
10598%  MagickSolarizeImage() applies a special effect to the image, similar to the
10599%  effect achieved in a photo darkroom by selectively exposing areas of photo
10600%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10601%  measure of the extent of the solarization.
10602%
10603%  The format of the MagickSolarizeImage method is:
10604%
10605%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10606%        const double threshold)
10607%
10608%  A description of each parameter follows:
10609%
10610%    o wand: the magick wand.
10611%
10612%    o threshold:  Define the extent of the solarization.
10613%
10614*/
10615WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10616  const double threshold)
10617{
10618  MagickBooleanType
10619    status;
10620
10621  assert(wand != (MagickWand *) NULL);
10622  assert(wand->signature == WandSignature);
10623  if (wand->debug != MagickFalse)
10624    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10625  if (wand->images == (Image *) NULL)
10626    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10627  status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10628  return(status);
10629}
10630
10631/*
10632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10633%                                                                             %
10634%                                                                             %
10635%                                                                             %
10636%   M a g i c k S p a r s e C o l o r I m a g e                               %
10637%                                                                             %
10638%                                                                             %
10639%                                                                             %
10640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10641%
10642%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10643%  colors found at those coordinates, across the whole image, using various
10644%  methods.
10645%
10646%  The format of the MagickSparseColorImage method is:
10647%
10648%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10649%        const SparseColorMethod method,const size_t number_arguments,
10650%        const double *arguments)
10651%
10652%  A description of each parameter follows:
10653%
10654%    o image: the image to be sparseed.
10655%
10656%    o method: the method of image sparseion.
10657%
10658%        ArcSparseColorion will always ignore source image offset, and always
10659%        'bestfit' the destination image with the top left corner offset
10660%        relative to the polar mapping center.
10661%
10662%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10663%        style of image sparseion.
10664%
10665%        Affine, Perspective, and Bilinear, will do least squares fitting of
10666%        the distrotion when more than the minimum number of control point
10667%        pairs are provided.
10668%
10669%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10670%        less than 4 control point pairs are provided. While Affine sparseions
10671%        will let you use any number of control point pairs, that is Zero pairs
10672%        is a No-Op (viewport only) distrotion, one pair is a translation and
10673%        two pairs of control points will do a scale-rotate-translate, without
10674%        any shearing.
10675%
10676%    o number_arguments: the number of arguments given for this sparseion
10677%      method.
10678%
10679%    o arguments: the arguments for this sparseion method.
10680%
10681*/
10682WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10683  const SparseColorMethod method,const size_t number_arguments,
10684  const double *arguments)
10685{
10686  Image
10687    *sparse_image;
10688
10689  assert(wand != (MagickWand *) NULL);
10690  assert(wand->signature == WandSignature);
10691  if (wand->debug != MagickFalse)
10692    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10693  if (wand->images == (Image *) NULL)
10694    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10695  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10696    wand->exception);
10697  if (sparse_image == (Image *) NULL)
10698    return(MagickFalse);
10699  ReplaceImageInList(&wand->images,sparse_image);
10700  return(MagickTrue);
10701}
10702
10703/*
10704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10705%                                                                             %
10706%                                                                             %
10707%                                                                             %
10708%   M a g i c k S p l i c e I m a g e                                         %
10709%                                                                             %
10710%                                                                             %
10711%                                                                             %
10712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10713%
10714%  MagickSpliceImage() splices a solid color into the image.
10715%
10716%  The format of the MagickSpliceImage method is:
10717%
10718%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10719%        const size_t width,const size_t height,const ssize_t x,
10720%        const ssize_t y)
10721%
10722%  A description of each parameter follows:
10723%
10724%    o wand: the magick wand.
10725%
10726%    o width: the region width.
10727%
10728%    o height: the region height.
10729%
10730%    o x: the region x offset.
10731%
10732%    o y: the region y offset.
10733%
10734*/
10735WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10736  const size_t width,const size_t height,const ssize_t x,
10737  const ssize_t y)
10738{
10739  Image
10740    *splice_image;
10741
10742  RectangleInfo
10743    splice;
10744
10745  assert(wand != (MagickWand *) NULL);
10746  assert(wand->signature == WandSignature);
10747  if (wand->debug != MagickFalse)
10748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10749  if (wand->images == (Image *) NULL)
10750    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10751  splice.width=width;
10752  splice.height=height;
10753  splice.x=x;
10754  splice.y=y;
10755  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10756  if (splice_image == (Image *) NULL)
10757    return(MagickFalse);
10758  ReplaceImageInList(&wand->images,splice_image);
10759  return(MagickTrue);
10760}
10761
10762/*
10763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10764%                                                                             %
10765%                                                                             %
10766%                                                                             %
10767%   M a g i c k S p r e a d I m a g e                                         %
10768%                                                                             %
10769%                                                                             %
10770%                                                                             %
10771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10772%
10773%  MagickSpreadImage() is a special effects method that randomly displaces each
10774%  pixel in a block defined by the radius parameter.
10775%
10776%  The format of the MagickSpreadImage method is:
10777%
10778%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10779%
10780%  A description of each parameter follows:
10781%
10782%    o wand: the magick wand.
10783%
10784%    o radius:  Choose a random pixel in a neighborhood of this extent.
10785%
10786*/
10787WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10788  const double radius)
10789{
10790  Image
10791    *spread_image;
10792
10793  assert(wand != (MagickWand *) NULL);
10794  assert(wand->signature == WandSignature);
10795  if (wand->debug != MagickFalse)
10796    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10797  if (wand->images == (Image *) NULL)
10798    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10799  spread_image=SpreadImage(wand->images,radius,wand->exception);
10800  if (spread_image == (Image *) NULL)
10801    return(MagickFalse);
10802  ReplaceImageInList(&wand->images,spread_image);
10803  return(MagickTrue);
10804}
10805
10806/*
10807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10808%                                                                             %
10809%                                                                             %
10810%                                                                             %
10811%   M a g i c k S t a t i s t i c I m a g e                                   %
10812%                                                                             %
10813%                                                                             %
10814%                                                                             %
10815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10816%
10817%  MagickStatisticImage() replace each pixel with corresponding statistic from
10818%  the neighborhood of the specified width and height.
10819%
10820%  The format of the MagickStatisticImage method is:
10821%
10822%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10823%        const StatisticType type,const double width,const size_t height)
10824%
10825%  A description of each parameter follows:
10826%
10827%    o wand: the magick wand.
10828%
10829%    o type: the statistic type (e.g. median, mode, etc.).
10830%
10831%    o width: the width of the pixel neighborhood.
10832%
10833%    o height: the height of the pixel neighborhood.
10834%
10835*/
10836WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10837  const StatisticType type,const size_t width,const size_t height)
10838{
10839  Image
10840    *statistic_image;
10841
10842  assert(wand != (MagickWand *) NULL);
10843  assert(wand->signature == WandSignature);
10844  if (wand->debug != MagickFalse)
10845    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10846  if (wand->images == (Image *) NULL)
10847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10848  statistic_image=StatisticImage(wand->images,type,width,height,
10849    wand->exception);
10850  if (statistic_image == (Image *) NULL)
10851    return(MagickFalse);
10852  ReplaceImageInList(&wand->images,statistic_image);
10853  return(MagickTrue);
10854}
10855
10856/*
10857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10858%                                                                             %
10859%                                                                             %
10860%                                                                             %
10861%   M a g i c k S t e g a n o I m a g e                                       %
10862%                                                                             %
10863%                                                                             %
10864%                                                                             %
10865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10866%
10867%  MagickSteganoImage() hides a digital watermark within the image.
10868%  Recover the hidden watermark later to prove that the authenticity of
10869%  an image.  Offset defines the start position within the image to hide
10870%  the watermark.
10871%
10872%  The format of the MagickSteganoImage method is:
10873%
10874%      MagickWand *MagickSteganoImage(MagickWand *wand,
10875%        const MagickWand *watermark_wand,const ssize_t offset)
10876%
10877%  A description of each parameter follows:
10878%
10879%    o wand: the magick wand.
10880%
10881%    o watermark_wand: the watermark wand.
10882%
10883%    o offset: Start hiding at this offset into the image.
10884%
10885*/
10886WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10887  const MagickWand *watermark_wand,const ssize_t offset)
10888{
10889  Image
10890    *stegano_image;
10891
10892  assert(wand != (MagickWand *) NULL);
10893  assert(wand->signature == WandSignature);
10894  if (wand->debug != MagickFalse)
10895    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10896  if ((wand->images == (Image *) NULL) ||
10897      (watermark_wand->images == (Image *) NULL))
10898    {
10899      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10900        "ContainsNoImages","`%s'",wand->name);
10901      return((MagickWand *) NULL);
10902    }
10903  wand->images->offset=offset;
10904  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10905    wand->exception);
10906  if (stegano_image == (Image *) NULL)
10907    return((MagickWand *) NULL);
10908  return(CloneMagickWandFromImages(wand,stegano_image));
10909}
10910
10911/*
10912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10913%                                                                             %
10914%                                                                             %
10915%                                                                             %
10916%   M a g i c k S t e r e o I m a g e                                         %
10917%                                                                             %
10918%                                                                             %
10919%                                                                             %
10920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10921%
10922%  MagickStereoImage() composites two images and produces a single image that
10923%  is the composite of a left and right image of a stereo pair
10924%
10925%  The format of the MagickStereoImage method is:
10926%
10927%      MagickWand *MagickStereoImage(MagickWand *wand,
10928%        const MagickWand *offset_wand)
10929%
10930%  A description of each parameter follows:
10931%
10932%    o wand: the magick wand.
10933%
10934%    o offset_wand: Another image wand.
10935%
10936*/
10937WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10938  const MagickWand *offset_wand)
10939{
10940  Image
10941    *stereo_image;
10942
10943  assert(wand != (MagickWand *) NULL);
10944  assert(wand->signature == WandSignature);
10945  if (wand->debug != MagickFalse)
10946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10947  if ((wand->images == (Image *) NULL) ||
10948      (offset_wand->images == (Image *) NULL))
10949    {
10950      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10951        "ContainsNoImages","`%s'",wand->name);
10952      return((MagickWand *) NULL);
10953    }
10954  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10955  if (stereo_image == (Image *) NULL)
10956    return((MagickWand *) NULL);
10957  return(CloneMagickWandFromImages(wand,stereo_image));
10958}
10959
10960/*
10961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10962%                                                                             %
10963%                                                                             %
10964%                                                                             %
10965%   M a g i c k S t r i p I m a g e                                           %
10966%                                                                             %
10967%                                                                             %
10968%                                                                             %
10969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10970%
10971%  MagickStripImage() strips an image of all profiles and comments.
10972%
10973%  The format of the MagickStripImage method is:
10974%
10975%      MagickBooleanType MagickStripImage(MagickWand *wand)
10976%
10977%  A description of each parameter follows:
10978%
10979%    o wand: the magick wand.
10980%
10981*/
10982WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
10983{
10984  MagickBooleanType
10985    status;
10986
10987  assert(wand != (MagickWand *) NULL);
10988  assert(wand->signature == WandSignature);
10989  if (wand->debug != MagickFalse)
10990    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10991  if (wand->images == (Image *) NULL)
10992    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10993  status=StripImage(wand->images);
10994  if (status == MagickFalse)
10995    InheritException(wand->exception,&wand->images->exception);
10996  return(status);
10997}
10998
10999/*
11000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11001%                                                                             %
11002%                                                                             %
11003%                                                                             %
11004%   M a g i c k S w i r l I m a g e                                           %
11005%                                                                             %
11006%                                                                             %
11007%                                                                             %
11008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11009%
11010%  MagickSwirlImage() swirls the pixels about the center of the image, where
11011%  degrees indicates the sweep of the arc through which each pixel is moved.
11012%  You get a more dramatic effect as the degrees move from 1 to 360.
11013%
11014%  The format of the MagickSwirlImage method is:
11015%
11016%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11017%
11018%  A description of each parameter follows:
11019%
11020%    o wand: the magick wand.
11021%
11022%    o degrees: Define the tightness of the swirling effect.
11023%
11024*/
11025WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11026  const double degrees)
11027{
11028  Image
11029    *swirl_image;
11030
11031  assert(wand != (MagickWand *) NULL);
11032  assert(wand->signature == WandSignature);
11033  if (wand->debug != MagickFalse)
11034    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11035  if (wand->images == (Image *) NULL)
11036    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11037  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11038  if (swirl_image == (Image *) NULL)
11039    return(MagickFalse);
11040  ReplaceImageInList(&wand->images,swirl_image);
11041  return(MagickTrue);
11042}
11043
11044/*
11045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11046%                                                                             %
11047%                                                                             %
11048%                                                                             %
11049%   M a g i c k T e x t u r e I m a g e                                       %
11050%                                                                             %
11051%                                                                             %
11052%                                                                             %
11053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11054%
11055%  MagickTextureImage() repeatedly tiles the texture image across and down the
11056%  image canvas.
11057%
11058%  The format of the MagickTextureImage method is:
11059%
11060%      MagickWand *MagickTextureImage(MagickWand *wand,
11061%        const MagickWand *texture_wand)
11062%
11063%  A description of each parameter follows:
11064%
11065%    o wand: the magick wand.
11066%
11067%    o texture_wand: the texture wand
11068%
11069*/
11070WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11071  const MagickWand *texture_wand)
11072{
11073  Image
11074    *texture_image;
11075
11076  MagickBooleanType
11077    status;
11078
11079  assert(wand != (MagickWand *) NULL);
11080  assert(wand->signature == WandSignature);
11081  if (wand->debug != MagickFalse)
11082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11083  if ((wand->images == (Image *) NULL) ||
11084      (texture_wand->images == (Image *) NULL))
11085    {
11086      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11087        "ContainsNoImages","`%s'",wand->name);
11088      return((MagickWand *) NULL);
11089    }
11090  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11091  if (texture_image == (Image *) NULL)
11092    return((MagickWand *) NULL);
11093  status=TextureImage(texture_image,texture_wand->images);
11094  if (status == MagickFalse)
11095    {
11096      InheritException(wand->exception,&texture_image->exception);
11097      texture_image=DestroyImage(texture_image);
11098      return((MagickWand *) NULL);
11099    }
11100  return(CloneMagickWandFromImages(wand,texture_image));
11101}
11102
11103/*
11104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11105%                                                                             %
11106%                                                                             %
11107%                                                                             %
11108%   M a g i c k T h r e s h o l d I m a g e                                   %
11109%                                                                             %
11110%                                                                             %
11111%                                                                             %
11112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11113%
11114%  MagickThresholdImage() changes the value of individual pixels based on
11115%  the intensity of each pixel compared to threshold.  The result is a
11116%  high-contrast, two color image.
11117%
11118%  The format of the MagickThresholdImage method is:
11119%
11120%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11121%        const double threshold)
11122%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11123%        const ChannelType channel,const double threshold)
11124%
11125%  A description of each parameter follows:
11126%
11127%    o wand: the magick wand.
11128%
11129%    o channel: the image channel(s).
11130%
11131%    o threshold: Define the threshold value.
11132%
11133*/
11134WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11135  const double threshold)
11136{
11137  MagickBooleanType
11138    status;
11139
11140  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11141  return(status);
11142}
11143
11144WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11145  const ChannelType channel,const double threshold)
11146{
11147  MagickBooleanType
11148    status;
11149
11150  assert(wand != (MagickWand *) NULL);
11151  assert(wand->signature == WandSignature);
11152  if (wand->debug != MagickFalse)
11153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11154  if (wand->images == (Image *) NULL)
11155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11156  status=BilevelImage(wand->images,threshold);
11157  if (status == MagickFalse)
11158    InheritException(wand->exception,&wand->images->exception);
11159  return(status);
11160}
11161
11162/*
11163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11164%                                                                             %
11165%                                                                             %
11166%                                                                             %
11167%   M a g i c k T h u m b n a i l I m a g e                                   %
11168%                                                                             %
11169%                                                                             %
11170%                                                                             %
11171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11172%
11173%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11174%  and removes any associated profiles.  The goal is to produce small low cost
11175%  thumbnail images suited for display on the Web.
11176%
11177%  The format of the MagickThumbnailImage method is:
11178%
11179%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11180%        const size_t columns,const size_t rows)
11181%
11182%  A description of each parameter follows:
11183%
11184%    o wand: the magick wand.
11185%
11186%    o columns: the number of columns in the scaled image.
11187%
11188%    o rows: the number of rows in the scaled image.
11189%
11190*/
11191WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11192  const size_t columns,const size_t rows)
11193{
11194  Image
11195    *thumbnail_image;
11196
11197  assert(wand != (MagickWand *) NULL);
11198  assert(wand->signature == WandSignature);
11199  if (wand->debug != MagickFalse)
11200    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11201  if (wand->images == (Image *) NULL)
11202    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11203  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11204  if (thumbnail_image == (Image *) NULL)
11205    return(MagickFalse);
11206  ReplaceImageInList(&wand->images,thumbnail_image);
11207  return(MagickTrue);
11208}
11209
11210/*
11211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11212%                                                                             %
11213%                                                                             %
11214%                                                                             %
11215%   M a g i c k T i n t I m a g e                                             %
11216%                                                                             %
11217%                                                                             %
11218%                                                                             %
11219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11220%
11221%  MagickTintImage() applies a color vector to each pixel in the image.  The
11222%  length of the vector is 0 for black and white and at its maximum for the
11223%  midtones.  The vector weighting function is
11224%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11225%
11226%  The format of the MagickTintImage method is:
11227%
11228%      MagickBooleanType MagickTintImage(MagickWand *wand,
11229%        const PixelWand *tint,const PixelWand *opacity)
11230%
11231%  A description of each parameter follows:
11232%
11233%    o wand: the magick wand.
11234%
11235%    o tint: the tint pixel wand.
11236%
11237%    o opacity: the opacity pixel wand.
11238%
11239*/
11240WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11241  const PixelWand *tint,const PixelWand *opacity)
11242{
11243  char
11244    percent_opaque[MaxTextExtent];
11245
11246  Image
11247    *tint_image;
11248
11249  PixelPacket
11250    target;
11251
11252  assert(wand != (MagickWand *) NULL);
11253  assert(wand->signature == WandSignature);
11254  if (wand->debug != MagickFalse)
11255    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11256  if (wand->images == (Image *) NULL)
11257    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11258  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11259    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11260    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11261    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11262    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11263    PixelGetOpacityQuantum(opacity)));
11264  PixelGetQuantumPacket(tint,&target);
11265  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11266  if (tint_image == (Image *) NULL)
11267    return(MagickFalse);
11268  ReplaceImageInList(&wand->images,tint_image);
11269  return(MagickTrue);
11270}
11271
11272/*
11273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11274%                                                                             %
11275%                                                                             %
11276%                                                                             %
11277%   M a g i c k T r a n s f o r m I m a g e                                   %
11278%                                                                             %
11279%                                                                             %
11280%                                                                             %
11281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11282%
11283%  MagickTransformImage() is a convenience method that behaves like
11284%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11285%  information as a region geometry specification.  If the operation fails,
11286%  a NULL image handle is returned.
11287%
11288%  The format of the MagickTransformImage method is:
11289%
11290%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11291%        const char *geometry)
11292%
11293%  A description of each parameter follows:
11294%
11295%    o wand: the magick wand.
11296%
11297%    o crop: A crop geometry string.  This geometry defines a subregion of the
11298%      image to crop.
11299%
11300%    o geometry: An image geometry string.  This geometry defines the final
11301%      size of the image.
11302%
11303*/
11304WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11305  const char *crop,const char *geometry)
11306{
11307  Image
11308    *transform_image;
11309
11310  MagickBooleanType
11311    status;
11312
11313  assert(wand != (MagickWand *) NULL);
11314  assert(wand->signature == WandSignature);
11315  if (wand->debug != MagickFalse)
11316    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11317  if (wand->images == (Image *) NULL)
11318    return((MagickWand *) NULL);
11319  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11320  if (transform_image == (Image *) NULL)
11321    return((MagickWand *) NULL);
11322  status=TransformImage(&transform_image,crop,geometry);
11323  if (status == MagickFalse)
11324    {
11325      InheritException(wand->exception,&transform_image->exception);
11326      transform_image=DestroyImage(transform_image);
11327      return((MagickWand *) NULL);
11328    }
11329  return(CloneMagickWandFromImages(wand,transform_image));
11330}
11331
11332/*
11333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334%                                                                             %
11335%                                                                             %
11336%                                                                             %
11337%   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               %
11338%                                                                             %
11339%                                                                             %
11340%                                                                             %
11341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11342%
11343%  MagickTransformImageColorspace() transform the image colorspace.
11344%
11345%  The format of the MagickTransformImageColorspace method is:
11346%
11347%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11348%        const ColorspaceType colorspace)
11349%
11350%  A description of each parameter follows:
11351%
11352%    o wand: the magick wand.
11353%
11354%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11355%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11356%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11357%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11358%      HSLColorspace, or HWBColorspace.
11359%
11360*/
11361WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11362  const ColorspaceType colorspace)
11363{
11364  assert(wand != (MagickWand *) NULL);
11365  assert(wand->signature == WandSignature);
11366  if (wand->debug != MagickFalse)
11367    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11368  if (wand->images == (Image *) NULL)
11369    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11370  return(TransformImageColorspace(wand->images,colorspace));
11371}
11372
11373/*
11374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11375%                                                                             %
11376%                                                                             %
11377%                                                                             %
11378%   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                     %
11379%                                                                             %
11380%                                                                             %
11381%                                                                             %
11382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11383%
11384%  MagickTransparentPaintImage() changes any pixel that matches color with the
11385%  color defined by fill.
11386%
11387%  The format of the MagickTransparentPaintImage method is:
11388%
11389%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11390%        const PixelWand *target,const double alpha,const double fuzz,
11391%        const MagickBooleanType invert)
11392%
11393%  A description of each parameter follows:
11394%
11395%    o wand: the magick wand.
11396%
11397%    o target: Change this target color to specified opacity value within
11398%      the image.
11399%
11400%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11401%      transparent.
11402%
11403%    o fuzz: By default target must match a particular pixel color
11404%      exactly.  However, in many cases two colors may differ by a small amount.
11405%      The fuzz member of image defines how much tolerance is acceptable to
11406%      consider two colors as the same.  For example, set fuzz to 10 and the
11407%      color red at intensities of 100 and 102 respectively are now interpreted
11408%      as the same color for the purposes of the floodfill.
11409%
11410%    o invert: paint any pixel that does not match the target color.
11411%
11412*/
11413WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11414  const PixelWand *target,const double alpha,const double fuzz,
11415  const MagickBooleanType invert)
11416{
11417  MagickBooleanType
11418    status;
11419
11420  PixelInfo
11421    target_pixel;
11422
11423  assert(wand != (MagickWand *) NULL);
11424  assert(wand->signature == WandSignature);
11425  if (wand->debug != MagickFalse)
11426    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11427  if (wand->images == (Image *) NULL)
11428    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11429  PixelGetMagickColor(target,&target_pixel);
11430  wand->images->fuzz=fuzz;
11431  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11432    QuantumRange*alpha),invert,&wand->images->exception);
11433  return(status);
11434}
11435
11436/*
11437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11438%                                                                             %
11439%                                                                             %
11440%                                                                             %
11441%   M a g i c k T r a n s p o s e I m a g e                                   %
11442%                                                                             %
11443%                                                                             %
11444%                                                                             %
11445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11446%
11447%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11448%  pixels around the central x-axis while rotating them 90-degrees.
11449%
11450%  The format of the MagickTransposeImage method is:
11451%
11452%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11453%
11454%  A description of each parameter follows:
11455%
11456%    o wand: the magick wand.
11457%
11458*/
11459WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11460{
11461  Image
11462    *transpose_image;
11463
11464  assert(wand != (MagickWand *) NULL);
11465  assert(wand->signature == WandSignature);
11466  if (wand->debug != MagickFalse)
11467    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11468  if (wand->images == (Image *) NULL)
11469    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11470  transpose_image=TransposeImage(wand->images,wand->exception);
11471  if (transpose_image == (Image *) NULL)
11472    return(MagickFalse);
11473  ReplaceImageInList(&wand->images,transpose_image);
11474  return(MagickTrue);
11475}
11476
11477/*
11478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11479%                                                                             %
11480%                                                                             %
11481%                                                                             %
11482%   M a g i c k T r a n s v e r s e I m a g e                                 %
11483%                                                                             %
11484%                                                                             %
11485%                                                                             %
11486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11487%
11488%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11489%  pixels around the central y-axis while rotating them 270-degrees.
11490%
11491%  The format of the MagickTransverseImage method is:
11492%
11493%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11494%
11495%  A description of each parameter follows:
11496%
11497%    o wand: the magick wand.
11498%
11499*/
11500WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11501{
11502  Image
11503    *transverse_image;
11504
11505  assert(wand != (MagickWand *) NULL);
11506  assert(wand->signature == WandSignature);
11507  if (wand->debug != MagickFalse)
11508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11509  if (wand->images == (Image *) NULL)
11510    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11511  transverse_image=TransverseImage(wand->images,wand->exception);
11512  if (transverse_image == (Image *) NULL)
11513    return(MagickFalse);
11514  ReplaceImageInList(&wand->images,transverse_image);
11515  return(MagickTrue);
11516}
11517
11518/*
11519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11520%                                                                             %
11521%                                                                             %
11522%                                                                             %
11523%   M a g i c k T r i m I m a g e                                             %
11524%                                                                             %
11525%                                                                             %
11526%                                                                             %
11527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11528%
11529%  MagickTrimImage() remove edges that are the background color from the image.
11530%
11531%  The format of the MagickTrimImage method is:
11532%
11533%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11534%
11535%  A description of each parameter follows:
11536%
11537%    o wand: the magick wand.
11538%
11539%    o fuzz: By default target must match a particular pixel color
11540%      exactly.  However, in many cases two colors may differ by a small amount.
11541%      The fuzz member of image defines how much tolerance is acceptable to
11542%      consider two colors as the same.  For example, set fuzz to 10 and the
11543%      color red at intensities of 100 and 102 respectively are now interpreted
11544%      as the same color for the purposes of the floodfill.
11545%
11546*/
11547WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11548{
11549  Image
11550    *trim_image;
11551
11552  assert(wand != (MagickWand *) NULL);
11553  assert(wand->signature == WandSignature);
11554  if (wand->debug != MagickFalse)
11555    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11556  if (wand->images == (Image *) NULL)
11557    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11558  wand->images->fuzz=fuzz;
11559  trim_image=TrimImage(wand->images,wand->exception);
11560  if (trim_image == (Image *) NULL)
11561    return(MagickFalse);
11562  ReplaceImageInList(&wand->images,trim_image);
11563  return(MagickTrue);
11564}
11565
11566/*
11567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11568%                                                                             %
11569%                                                                             %
11570%                                                                             %
11571%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11572%                                                                             %
11573%                                                                             %
11574%                                                                             %
11575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11576%
11577%  MagickUniqueImageColors() discards all but one of any pixel color.
11578%
11579%  The format of the MagickUniqueImageColors method is:
11580%
11581%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11582%
11583%  A description of each parameter follows:
11584%
11585%    o wand: the magick wand.
11586%
11587*/
11588WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11589{
11590  Image
11591    *unique_image;
11592
11593  assert(wand != (MagickWand *) NULL);
11594  assert(wand->signature == WandSignature);
11595  if (wand->debug != MagickFalse)
11596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11597  if (wand->images == (Image *) NULL)
11598    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11599  unique_image=UniqueImageColors(wand->images,wand->exception);
11600  if (unique_image == (Image *) NULL)
11601    return(MagickFalse);
11602  ReplaceImageInList(&wand->images,unique_image);
11603  return(MagickTrue);
11604}
11605
11606/*
11607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11608%                                                                             %
11609%                                                                             %
11610%                                                                             %
11611%   M a g i c k U n s h a r p M a s k I m a g e                               %
11612%                                                                             %
11613%                                                                             %
11614%                                                                             %
11615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11616%
11617%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11618%  Gaussian operator of the given radius and standard deviation (sigma).
11619%  For reasonable results, radius should be larger than sigma.  Use a radius
11620%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11621%
11622%  The format of the MagickUnsharpMaskImage method is:
11623%
11624%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11625%        const double radius,const double sigma,const double amount,
11626%        const double threshold)
11627%
11628%  A description of each parameter follows:
11629%
11630%    o wand: the magick wand.
11631%
11632%    o radius: the radius of the Gaussian, in pixels, not counting the center
11633%      pixel.
11634%
11635%    o sigma: the standard deviation of the Gaussian, in pixels.
11636%
11637%    o amount: the percentage of the difference between the original and the
11638%      blur image that is added back into the original.
11639%
11640%    o threshold: the threshold in pixels needed to apply the diffence amount.
11641%
11642*/
11643WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11644  const double radius,const double sigma,const double amount,
11645  const double threshold)
11646{
11647  Image
11648    *unsharp_image;
11649
11650  assert(wand != (MagickWand *) NULL);
11651  assert(wand->signature == WandSignature);
11652  if (wand->debug != MagickFalse)
11653    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11654  if (wand->images == (Image *) NULL)
11655    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11656  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11657    wand->exception);
11658  if (unsharp_image == (Image *) NULL)
11659    return(MagickFalse);
11660  ReplaceImageInList(&wand->images,unsharp_image);
11661  return(MagickTrue);
11662}
11663
11664/*
11665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11666%                                                                             %
11667%                                                                             %
11668%                                                                             %
11669%   M a g i c k V i g n e t t e I m a g e                                     %
11670%                                                                             %
11671%                                                                             %
11672%                                                                             %
11673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11674%
11675%  MagickVignetteImage() softens the edges of the image in vignette style.
11676%
11677%  The format of the MagickVignetteImage method is:
11678%
11679%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11680%        const double black_point,const double white_point,const ssize_t x,
11681%        const ssize_t y)
11682%
11683%  A description of each parameter follows:
11684%
11685%    o wand: the magick wand.
11686%
11687%    o black_point: the black point.
11688%
11689%    o white_point: the white point.
11690%
11691%    o x, y:  Define the x and y ellipse offset.
11692%
11693*/
11694WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11695  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11696{
11697  Image
11698    *vignette_image;
11699
11700  assert(wand != (MagickWand *) NULL);
11701  assert(wand->signature == WandSignature);
11702  if (wand->debug != MagickFalse)
11703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11704  if (wand->images == (Image *) NULL)
11705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11706  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11707    wand->exception);
11708  if (vignette_image == (Image *) NULL)
11709    return(MagickFalse);
11710  ReplaceImageInList(&wand->images,vignette_image);
11711  return(MagickTrue);
11712}
11713
11714/*
11715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11716%                                                                             %
11717%                                                                             %
11718%                                                                             %
11719%   M a g i c k W a v e I m a g e                                             %
11720%                                                                             %
11721%                                                                             %
11722%                                                                             %
11723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11724%
11725%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11726%  the pixels vertically along a sine wave whose amplitude and wavelength
11727%  is specified by the given parameters.
11728%
11729%  The format of the MagickWaveImage method is:
11730%
11731%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11732%        const double wave_length)
11733%
11734%  A description of each parameter follows:
11735%
11736%    o wand: the magick wand.
11737%
11738%    o amplitude, wave_length:  Define the amplitude and wave length of the
11739%      sine wave.
11740%
11741*/
11742WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11743  const double amplitude,const double wave_length)
11744{
11745  Image
11746    *wave_image;
11747
11748  assert(wand != (MagickWand *) NULL);
11749  assert(wand->signature == WandSignature);
11750  if (wand->debug != MagickFalse)
11751    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11752  if (wand->images == (Image *) NULL)
11753    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11754  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11755  if (wave_image == (Image *) NULL)
11756    return(MagickFalse);
11757  ReplaceImageInList(&wand->images,wave_image);
11758  return(MagickTrue);
11759}
11760
11761/*
11762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11763%                                                                             %
11764%                                                                             %
11765%                                                                             %
11766%   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                         %
11767%                                                                             %
11768%                                                                             %
11769%                                                                             %
11770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11771%
11772%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11773%  above the threshold into white while leaving all pixels below the threshold
11774%  unchanged.
11775%
11776%  The format of the MagickWhiteThresholdImage method is:
11777%
11778%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11779%        const PixelWand *threshold)
11780%
11781%  A description of each parameter follows:
11782%
11783%    o wand: the magick wand.
11784%
11785%    o threshold: the pixel wand.
11786%
11787*/
11788WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11789  const PixelWand *threshold)
11790{
11791  char
11792    thresholds[MaxTextExtent];
11793
11794  MagickBooleanType
11795    status;
11796
11797  assert(wand != (MagickWand *) NULL);
11798  assert(wand->signature == WandSignature);
11799  if (wand->debug != MagickFalse)
11800    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11801  if (wand->images == (Image *) NULL)
11802    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11803  (void) FormatLocaleString(thresholds,MaxTextExtent,
11804    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11805    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11806    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11807  status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11808  if (status == MagickFalse)
11809    InheritException(wand->exception,&wand->images->exception);
11810  return(status);
11811}
11812
11813/*
11814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11815%                                                                             %
11816%                                                                             %
11817%                                                                             %
11818%   M a g i c k W r i t e I m a g e                                           %
11819%                                                                             %
11820%                                                                             %
11821%                                                                             %
11822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11823%
11824%  MagickWriteImage() writes an image to the specified filename.  If the
11825%  filename parameter is NULL, the image is written to the filename set
11826%  by MagickReadImage() or MagickSetImageFilename().
11827%
11828%  The format of the MagickWriteImage method is:
11829%
11830%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11831%        const char *filename)
11832%
11833%  A description of each parameter follows:
11834%
11835%    o wand: the magick wand.
11836%
11837%    o filename: the image filename.
11838%
11839%
11840*/
11841WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11842  const char *filename)
11843{
11844  Image
11845    *image;
11846
11847  ImageInfo
11848    *write_info;
11849
11850  MagickBooleanType
11851    status;
11852
11853  assert(wand != (MagickWand *) NULL);
11854  assert(wand->signature == WandSignature);
11855  if (wand->debug != MagickFalse)
11856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11857  if (wand->images == (Image *) NULL)
11858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11859  if (filename != (const char *) NULL)
11860    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11861  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11862  if (image == (Image *) NULL)
11863    return(MagickFalse);
11864  write_info=CloneImageInfo(wand->image_info);
11865  write_info->adjoin=MagickTrue;
11866  status=WriteImage(write_info,image,&image->exception);
11867  image=DestroyImage(image);
11868  write_info=DestroyImageInfo(write_info);
11869  return(status);
11870}
11871
11872/*
11873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11874%                                                                             %
11875%                                                                             %
11876%                                                                             %
11877%   M a g i c k W r i t e I m a g e F i l e                                   %
11878%                                                                             %
11879%                                                                             %
11880%                                                                             %
11881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11882%
11883%  MagickWriteImageFile() writes an image to an open file descriptor.
11884%
11885%  The format of the MagickWriteImageFile method is:
11886%
11887%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11888%
11889%  A description of each parameter follows:
11890%
11891%    o wand: the magick wand.
11892%
11893%    o file: the file descriptor.
11894%
11895*/
11896WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11897{
11898  Image
11899    *image;
11900
11901  ImageInfo
11902    *write_info;
11903
11904  MagickBooleanType
11905    status;
11906
11907  assert(wand != (MagickWand *) NULL);
11908  assert(wand->signature == WandSignature);
11909  assert(file != (FILE *) NULL);
11910  if (wand->debug != MagickFalse)
11911    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11912  if (wand->images == (Image *) NULL)
11913    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11914  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11915  if (image == (Image *) NULL)
11916    return(MagickFalse);
11917  write_info=CloneImageInfo(wand->image_info);
11918  SetImageInfoFile(write_info,file);
11919  write_info->adjoin=MagickTrue;
11920  status=WriteImage(write_info,image,&image->exception);
11921  write_info=DestroyImageInfo(write_info);
11922  image=DestroyImage(image);
11923  return(status);
11924}
11925
11926/*
11927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11928%                                                                             %
11929%                                                                             %
11930%                                                                             %
11931%   M a g i c k W r i t e I m a g e s                                         %
11932%                                                                             %
11933%                                                                             %
11934%                                                                             %
11935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11936%
11937%  MagickWriteImages() writes an image or image sequence.
11938%
11939%  The format of the MagickWriteImages method is:
11940%
11941%      MagickBooleanType MagickWriteImages(MagickWand *wand,
11942%        const char *filename,const MagickBooleanType adjoin)
11943%
11944%  A description of each parameter follows:
11945%
11946%    o wand: the magick wand.
11947%
11948%    o filename: the image filename.
11949%
11950%    o adjoin: join images into a single multi-image file.
11951%
11952*/
11953WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11954  const char *filename,const MagickBooleanType adjoin)
11955{
11956  ImageInfo
11957    *write_info;
11958
11959  MagickBooleanType
11960    status;
11961
11962  assert(wand != (MagickWand *) NULL);
11963  assert(wand->signature == WandSignature);
11964  if (wand->debug != MagickFalse)
11965    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11966  if (wand->images == (Image *) NULL)
11967    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11968  write_info=CloneImageInfo(wand->image_info);
11969  write_info->adjoin=adjoin;
11970  status=WriteImages(write_info,wand->images,filename,wand->exception);
11971  if (status == MagickFalse)
11972    InheritException(wand->exception,&wand->images->exception);
11973  write_info=DestroyImageInfo(write_info);
11974  return(status);
11975}
11976
11977/*
11978%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11979%                                                                             %
11980%                                                                             %
11981%                                                                             %
11982%   M a g i c k W r i t e I m a g e s F i l e                                 %
11983%                                                                             %
11984%                                                                             %
11985%                                                                             %
11986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11987%
11988%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
11989%
11990%  The format of the MagickWriteImagesFile method is:
11991%
11992%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
11993%
11994%  A description of each parameter follows:
11995%
11996%    o wand: the magick wand.
11997%
11998%    o file: the file descriptor.
11999%
12000*/
12001WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12002{
12003  ImageInfo
12004    *write_info;
12005
12006  MagickBooleanType
12007    status;
12008
12009  assert(wand != (MagickWand *) NULL);
12010  assert(wand->signature == WandSignature);
12011  if (wand->debug != MagickFalse)
12012    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12013  if (wand->images == (Image *) NULL)
12014    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12015  write_info=CloneImageInfo(wand->image_info);
12016  SetImageInfoFile(write_info,file);
12017  write_info->adjoin=MagickTrue;
12018  status=WriteImages(write_info,wand->images,(const char *) NULL,
12019    wand->exception);
12020  write_info=DestroyImageInfo(write_info);
12021  if (status == MagickFalse)
12022    InheritException(wand->exception,&wand->images->exception);
12023  return(status);
12024}
12025