magick-image.c revision f7ef02502877113afdb1955eb9bf16e3cc9e414f
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%        const double bias)
6575%
6576%  A description of each parameter follows:
6577%
6578%    o wand: the magick wand.
6579%
6580%    o radius: the radius of the Gaussian, in pixels, not counting
6581%      the center pixel.
6582%
6583%    o sigma: the standard deviation of the Gaussian, in pixels.
6584%
6585%    o angle: Apply the effect along this angle.
6586%
6587*/
6588WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6589  const double radius,const double sigma,const double angle,const double bias)
6590{
6591  Image
6592    *blur_image;
6593
6594  assert(wand != (MagickWand *) NULL);
6595  assert(wand->signature == WandSignature);
6596  if (wand->debug != MagickFalse)
6597    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6598  if (wand->images == (Image *) NULL)
6599    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6600  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6601    wand->exception);
6602  if (blur_image == (Image *) NULL)
6603    return(MagickFalse);
6604  ReplaceImageInList(&wand->images,blur_image);
6605  return(MagickTrue);
6606}
6607
6608/*
6609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6610%                                                                             %
6611%                                                                             %
6612%                                                                             %
6613%   M a g i c k N e g a t e I m a g e                                         %
6614%                                                                             %
6615%                                                                             %
6616%                                                                             %
6617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6618%
6619%  MagickNegateImage() negates the colors in the reference image.  The
6620%  Grayscale option means that only grayscale values within the image are
6621%  negated.
6622%
6623%  You can also reduce the influence of a particular channel with a gamma
6624%  value of 0.
6625%
6626%  The format of the MagickNegateImage method is:
6627%
6628%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6629%        const MagickBooleanType gray)
6630%
6631%  A description of each parameter follows:
6632%
6633%    o wand: the magick wand.
6634%
6635%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6636%
6637*/
6638WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6639  const MagickBooleanType gray)
6640{
6641  MagickBooleanType
6642    status;
6643
6644  assert(wand != (MagickWand *) NULL);
6645  assert(wand->signature == WandSignature);
6646  if (wand->debug != MagickFalse)
6647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6648  if (wand->images == (Image *) NULL)
6649    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6650  status=NegateImage(wand->images,gray,wand->exception);
6651  return(status);
6652}
6653
6654/*
6655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6656%                                                                             %
6657%                                                                             %
6658%                                                                             %
6659%   M a g i c k N e w I m a g e                                               %
6660%                                                                             %
6661%                                                                             %
6662%                                                                             %
6663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6664%
6665%  MagickNewImage() adds a blank image canvas of the specified size and
6666%  background color to the wand.
6667%
6668%  The format of the MagickNewImage method is:
6669%
6670%      MagickBooleanType MagickNewImage(MagickWand *wand,
6671%        const size_t columns,const size_t rows,
6672%        const PixelWand *background)
6673%
6674%  A description of each parameter follows:
6675%
6676%    o wand: the magick wand.
6677%
6678%    o width: the image width.
6679%
6680%    o height: the image height.
6681%
6682%    o background: the image color.
6683%
6684*/
6685WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6686  const size_t width,const size_t height,
6687  const PixelWand *background)
6688{
6689  Image
6690    *images;
6691
6692  PixelInfo
6693    pixel;
6694
6695  assert(wand != (MagickWand *) NULL);
6696  assert(wand->signature == WandSignature);
6697  if (wand->debug != MagickFalse)
6698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6699  PixelGetMagickColor(background,&pixel);
6700  images=NewMagickImage(wand->image_info,width,height,&pixel);
6701  if (images == (Image *) NULL)
6702    return(MagickFalse);
6703  if (images->exception.severity != UndefinedException)
6704    InheritException(wand->exception,&images->exception);
6705  return(InsertImageInWand(wand,images));
6706}
6707
6708/*
6709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6710%                                                                             %
6711%                                                                             %
6712%                                                                             %
6713%   M a g i c k N e x t I m a g e                                             %
6714%                                                                             %
6715%                                                                             %
6716%                                                                             %
6717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718%
6719%  MagickNextImage() associates the next image in the image list with a magick
6720%  wand.
6721%
6722%  The format of the MagickNextImage method is:
6723%
6724%      MagickBooleanType MagickNextImage(MagickWand *wand)
6725%
6726%  A description of each parameter follows:
6727%
6728%    o wand: the magick wand.
6729%
6730*/
6731WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6732{
6733  assert(wand != (MagickWand *) NULL);
6734  assert(wand->signature == WandSignature);
6735  if (wand->debug != MagickFalse)
6736    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6737  if (wand->images == (Image *) NULL)
6738    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6739  if (wand->pend != MagickFalse)
6740    {
6741      wand->pend=MagickFalse;
6742      return(MagickTrue);
6743    }
6744  if (GetNextImageInList(wand->images) == (Image *) NULL)
6745    {
6746      wand->pend=MagickTrue;
6747      return(MagickFalse);
6748    }
6749  wand->images=GetNextImageInList(wand->images);
6750  return(MagickTrue);
6751}
6752
6753/*
6754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6755%                                                                             %
6756%                                                                             %
6757%                                                                             %
6758%   M a g i c k N o r m a l i z e I m a g e                                   %
6759%                                                                             %
6760%                                                                             %
6761%                                                                             %
6762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6763%
6764%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6765%  the pixels color to span the entire range of colors available
6766%
6767%  You can also reduce the influence of a particular channel with a gamma
6768%  value of 0.
6769%
6770%  The format of the MagickNormalizeImage method is:
6771%
6772%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6773%
6774%  A description of each parameter follows:
6775%
6776%    o wand: the magick wand.
6777%
6778*/
6779WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6780{
6781  MagickBooleanType
6782    status;
6783
6784  assert(wand != (MagickWand *) NULL);
6785  assert(wand->signature == WandSignature);
6786  if (wand->debug != MagickFalse)
6787    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6788  if (wand->images == (Image *) NULL)
6789    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6790  status=NormalizeImage(wand->images,&wand->images->exception);
6791  return(status);
6792}
6793
6794/*
6795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6796%                                                                             %
6797%                                                                             %
6798%                                                                             %
6799%   M a g i c k O i l P a i n t I m a g e                                     %
6800%                                                                             %
6801%                                                                             %
6802%                                                                             %
6803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6804%
6805%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6806%  painting.  Each pixel is replaced by the most frequent color occurring
6807%  in a circular region defined by radius.
6808%
6809%  The format of the MagickOilPaintImage method is:
6810%
6811%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6812%        const double radius,const double sigma)
6813%
6814%  A description of each parameter follows:
6815%
6816%    o wand: the magick wand.
6817%
6818%    o radius: the radius of the circular neighborhood.
6819%
6820%    o sigma: the standard deviation of the Gaussian, in pixels.
6821%
6822*/
6823WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6824  const double radius,const double sigma)
6825{
6826  Image
6827    *paint_image;
6828
6829  assert(wand != (MagickWand *) NULL);
6830  assert(wand->signature == WandSignature);
6831  if (wand->debug != MagickFalse)
6832    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6833  if (wand->images == (Image *) NULL)
6834    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6835  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6836  if (paint_image == (Image *) NULL)
6837    return(MagickFalse);
6838  ReplaceImageInList(&wand->images,paint_image);
6839  return(MagickTrue);
6840}
6841
6842/*
6843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6844%                                                                             %
6845%                                                                             %
6846%                                                                             %
6847%   M a g i c k O p a q u e P a i n t I m a g e                               %
6848%                                                                             %
6849%                                                                             %
6850%                                                                             %
6851%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6852%
6853%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6854%  defined by fill.
6855%
6856%  The format of the MagickOpaquePaintImage method is:
6857%
6858%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6859%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6860%        const MagickBooleanType invert)
6861%
6862%  A description of each parameter follows:
6863%
6864%    o wand: the magick wand.
6865%
6866%    o target: Change this target color to the fill color within the image.
6867%
6868%    o fill: the fill pixel wand.
6869%
6870%    o fuzz: By default target must match a particular pixel color
6871%      exactly.  However, in many cases two colors may differ by a small amount.
6872%      The fuzz member of image defines how much tolerance is acceptable to
6873%      consider two colors as the same.  For example, set fuzz to 10 and the
6874%      color red at intensities of 100 and 102 respectively are now interpreted
6875%      as the same color for the purposes of the floodfill.
6876%
6877%    o invert: paint any pixel that does not match the target color.
6878%
6879*/
6880WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6881  const PixelWand *target,const PixelWand *fill,const double fuzz,
6882  const MagickBooleanType invert)
6883{
6884  MagickBooleanType
6885    status;
6886
6887  PixelInfo
6888    fill_pixel,
6889    target_pixel;
6890
6891  assert(wand != (MagickWand *) NULL);
6892  assert(wand->signature == WandSignature);
6893  if (wand->debug != MagickFalse)
6894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6895  if (wand->images == (Image *) NULL)
6896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6897  PixelGetMagickColor(target,&target_pixel);
6898  PixelGetMagickColor(fill,&fill_pixel);
6899  wand->images->fuzz=fuzz;
6900  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6901    &wand->images->exception);
6902  return(status);
6903}
6904
6905/*
6906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6907%                                                                             %
6908%                                                                             %
6909%                                                                             %
6910%   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                         %
6911%                                                                             %
6912%                                                                             %
6913%                                                                             %
6914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6915%
6916%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6917%  previous image in the sequence.  From this it attempts to select the
6918%  smallest cropped image to replace each frame, while preserving the results
6919%  of the animation.
6920%
6921%  The format of the MagickOptimizeImageLayers method is:
6922%
6923%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6924%
6925%  A description of each parameter follows:
6926%
6927%    o wand: the magick wand.
6928%
6929*/
6930WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6931{
6932  Image
6933    *optimize_image;
6934
6935  assert(wand != (MagickWand *) NULL);
6936  assert(wand->signature == WandSignature);
6937  if (wand->debug != MagickFalse)
6938    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6939  if (wand->images == (Image *) NULL)
6940    return((MagickWand *) NULL);
6941  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6942  if (optimize_image == (Image *) NULL)
6943    return((MagickWand *) NULL);
6944  return(CloneMagickWandFromImages(wand,optimize_image));
6945}
6946
6947/*
6948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6949%                                                                             %
6950%                                                                             %
6951%                                                                             %
6952%     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                   %
6953%                                                                             %
6954%                                                                             %
6955%                                                                             %
6956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6957%
6958%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6959%  of pre-defined dithering threshold maps, but over multiple intensity levels,
6960%  which can be different for different channels, according to the input
6961%  arguments.
6962%
6963%  The format of the MagickOrderedPosterizeImage method is:
6964%
6965%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6966%        const char *threshold_map)
6967%
6968%  A description of each parameter follows:
6969%
6970%    o image: the image.
6971%
6972%    o threshold_map: A string containing the name of the threshold dither
6973%      map to use, followed by zero or more numbers representing the number of
6974%      color levels tho dither between.
6975%
6976%      Any level number less than 2 is equivalent to 2, and means only binary
6977%      dithering will be applied to each color channel.
6978%
6979%      No numbers also means a 2 level (bitmap) dither will be applied to all
6980%      channels, while a single number is the number of levels applied to each
6981%      channel in sequence.  More numbers will be applied in turn to each of
6982%      the color channels.
6983%
6984%      For example: "o3x3,6" generates a 6 level posterization of the image
6985%      with a ordered 3x3 diffused pixel dither being applied between each
6986%      level. While checker,8,8,4 will produce a 332 colormaped image with
6987%      only a single checkerboard hash pattern (50% grey) between each color
6988%      level, to basically double the number of color levels with a bare
6989%      minimim of dithering.
6990%
6991*/
6992WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6993  const char *threshold_map)
6994{
6995  MagickBooleanType
6996    status;
6997
6998  assert(wand != (MagickWand *) NULL);
6999  assert(wand->signature == WandSignature);
7000  if (wand->debug != MagickFalse)
7001    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7002  if (wand->images == (Image *) NULL)
7003    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7004  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7005  return(status);
7006}
7007
7008/*
7009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7010%                                                                             %
7011%                                                                             %
7012%                                                                             %
7013%   M a g i c k P i n g I m a g e                                             %
7014%                                                                             %
7015%                                                                             %
7016%                                                                             %
7017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7018%
7019%  MagickPingImage() is like MagickReadImage() except the only valid
7020%  information returned is the image width, height, size, and format.  It
7021%  is designed to efficiently obtain this information from a file without
7022%  reading the entire image sequence into memory.
7023%
7024%  The format of the MagickPingImage method is:
7025%
7026%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7027%
7028%  A description of each parameter follows:
7029%
7030%    o wand: the magick wand.
7031%
7032%    o filename: the image filename.
7033%
7034*/
7035WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7036  const char *filename)
7037{
7038  Image
7039    *images;
7040
7041  ImageInfo
7042    *ping_info;
7043
7044  assert(wand != (MagickWand *) NULL);
7045  assert(wand->signature == WandSignature);
7046  if (wand->debug != MagickFalse)
7047    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7048  ping_info=CloneImageInfo(wand->image_info);
7049  if (filename != (const char *) NULL)
7050    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7051  images=PingImage(ping_info,wand->exception);
7052  ping_info=DestroyImageInfo(ping_info);
7053  if (images == (Image *) NULL)
7054    return(MagickFalse);
7055  return(InsertImageInWand(wand,images));
7056}
7057
7058/*
7059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7060%                                                                             %
7061%                                                                             %
7062%                                                                             %
7063%   M a g i c k P i n g I m a g e B l o b                                     %
7064%                                                                             %
7065%                                                                             %
7066%                                                                             %
7067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7068%
7069%  MagickPingImageBlob() pings an image or image sequence from a blob.
7070%
7071%  The format of the MagickPingImageBlob method is:
7072%
7073%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7074%        const void *blob,const size_t length)
7075%
7076%  A description of each parameter follows:
7077%
7078%    o wand: the magick wand.
7079%
7080%    o blob: the blob.
7081%
7082%    o length: the blob length.
7083%
7084*/
7085WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7086  const void *blob,const size_t length)
7087{
7088  Image
7089    *images;
7090
7091  ImageInfo
7092    *read_info;
7093
7094  assert(wand != (MagickWand *) NULL);
7095  assert(wand->signature == WandSignature);
7096  if (wand->debug != MagickFalse)
7097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7098  read_info=CloneImageInfo(wand->image_info);
7099  SetImageInfoBlob(read_info,blob,length);
7100  images=PingImage(read_info,wand->exception);
7101  read_info=DestroyImageInfo(read_info);
7102  if (images == (Image *) NULL)
7103    return(MagickFalse);
7104  return(InsertImageInWand(wand,images));
7105}
7106
7107/*
7108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7109%                                                                             %
7110%                                                                             %
7111%                                                                             %
7112%   M a g i c k P i n g I m a g e F i l e                                     %
7113%                                                                             %
7114%                                                                             %
7115%                                                                             %
7116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7117%
7118%  MagickPingImageFile() pings an image or image sequence from an open file
7119%  descriptor.
7120%
7121%  The format of the MagickPingImageFile method is:
7122%
7123%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7124%
7125%  A description of each parameter follows:
7126%
7127%    o wand: the magick wand.
7128%
7129%    o file: the file descriptor.
7130%
7131*/
7132WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7133{
7134  Image
7135    *images;
7136
7137  ImageInfo
7138    *read_info;
7139
7140  assert(wand != (MagickWand *) NULL);
7141  assert(wand->signature == WandSignature);
7142  assert(file != (FILE *) NULL);
7143  if (wand->debug != MagickFalse)
7144    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7145  read_info=CloneImageInfo(wand->image_info);
7146  SetImageInfoFile(read_info,file);
7147  images=PingImage(read_info,wand->exception);
7148  read_info=DestroyImageInfo(read_info);
7149  if (images == (Image *) NULL)
7150    return(MagickFalse);
7151  return(InsertImageInWand(wand,images));
7152}
7153
7154/*
7155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7156%                                                                             %
7157%                                                                             %
7158%                                                                             %
7159%   M a g i c k P o l a r o i d I m a g e                                     %
7160%                                                                             %
7161%                                                                             %
7162%                                                                             %
7163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7164%
7165%  MagickPolaroidImage() simulates a Polaroid picture.
7166%
7167%  The format of the MagickPolaroidImage method is:
7168%
7169%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7170%        const DrawingWand *drawing_wand,const double angle)
7171%
7172%  A description of each parameter follows:
7173%
7174%    o wand: the magick wand.
7175%
7176%    o drawing_wand: the draw wand.
7177%
7178%    o angle: Apply the effect along this angle.
7179%
7180*/
7181WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7182  const DrawingWand *drawing_wand,const double angle)
7183{
7184  DrawInfo
7185    *draw_info;
7186
7187  Image
7188    *polaroid_image;
7189
7190  assert(wand != (MagickWand *) NULL);
7191  assert(wand->signature == WandSignature);
7192  if (wand->debug != MagickFalse)
7193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7194  if (wand->images == (Image *) NULL)
7195    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7196  draw_info=PeekDrawingWand(drawing_wand);
7197  if (draw_info == (DrawInfo *) NULL)
7198    return(MagickFalse);
7199  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7200  if (polaroid_image == (Image *) NULL)
7201    return(MagickFalse);
7202  ReplaceImageInList(&wand->images,polaroid_image);
7203  return(MagickTrue);
7204}
7205
7206/*
7207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7208%                                                                             %
7209%                                                                             %
7210%                                                                             %
7211%   M a g i c k P o s t e r i z e I m a g e                                   %
7212%                                                                             %
7213%                                                                             %
7214%                                                                             %
7215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7216%
7217%  MagickPosterizeImage() reduces the image to a limited number of color level.
7218%
7219%  The format of the MagickPosterizeImage method is:
7220%
7221%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7222%        const unsigned levels,const MagickBooleanType dither)
7223%
7224%  A description of each parameter follows:
7225%
7226%    o wand: the magick wand.
7227%
7228%    o levels: Number of color levels allowed in each channel.  Very low values
7229%      (2, 3, or 4) have the most visible effect.
7230%
7231%    o dither: Set this integer value to something other than zero to dither
7232%      the mapped image.
7233%
7234*/
7235WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7236  const size_t levels,const MagickBooleanType dither)
7237{
7238  MagickBooleanType
7239    status;
7240
7241  assert(wand != (MagickWand *) NULL);
7242  assert(wand->signature == WandSignature);
7243  if (wand->debug != MagickFalse)
7244    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7245  if (wand->images == (Image *) NULL)
7246    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7247  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7248  return(status);
7249}
7250
7251/*
7252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7253%                                                                             %
7254%                                                                             %
7255%                                                                             %
7256%   M a g i c k P r e v i e w I m a g e s                                     %
7257%                                                                             %
7258%                                                                             %
7259%                                                                             %
7260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7261%
7262%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7263%  image processing operation applied at varying strengths.  This helpful
7264%  to quickly pin-point an appropriate parameter for an image processing
7265%  operation.
7266%
7267%  The format of the MagickPreviewImages method is:
7268%
7269%      MagickWand *MagickPreviewImages(MagickWand *wand,
7270%        const PreviewType preview)
7271%
7272%  A description of each parameter follows:
7273%
7274%    o wand: the magick wand.
7275%
7276%    o preview: the preview type.
7277%
7278*/
7279WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7280  const PreviewType preview)
7281{
7282  Image
7283    *preview_image;
7284
7285  assert(wand != (MagickWand *) NULL);
7286  assert(wand->signature == WandSignature);
7287  if (wand->debug != MagickFalse)
7288    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7289  if (wand->images == (Image *) NULL)
7290    return((MagickWand *) NULL);
7291  preview_image=PreviewImage(wand->images,preview,wand->exception);
7292  if (preview_image == (Image *) NULL)
7293    return((MagickWand *) NULL);
7294  return(CloneMagickWandFromImages(wand,preview_image));
7295}
7296
7297/*
7298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7299%                                                                             %
7300%                                                                             %
7301%                                                                             %
7302%   M a g i c k P r e v i o u s I m a g e                                     %
7303%                                                                             %
7304%                                                                             %
7305%                                                                             %
7306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7307%
7308%  MagickPreviousImage() assocates the previous image in an image list with
7309%  the magick wand.
7310%
7311%  The format of the MagickPreviousImage method is:
7312%
7313%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7314%
7315%  A description of each parameter follows:
7316%
7317%    o wand: the magick wand.
7318%
7319*/
7320WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7321{
7322  assert(wand != (MagickWand *) NULL);
7323  assert(wand->signature == WandSignature);
7324  if (wand->debug != MagickFalse)
7325    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7326  if (wand->images == (Image *) NULL)
7327    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7328  if (wand->pend != MagickFalse)
7329    {
7330      wand->pend=MagickFalse;
7331      return(MagickTrue);
7332    }
7333  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7334    {
7335      wand->pend=MagickTrue;
7336      return(MagickFalse);
7337    }
7338  wand->images=GetPreviousImageInList(wand->images);
7339  return(MagickTrue);
7340}
7341
7342/*
7343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7344%                                                                             %
7345%                                                                             %
7346%                                                                             %
7347%   M a g i c k Q u a n t i z e I m a g e                                     %
7348%                                                                             %
7349%                                                                             %
7350%                                                                             %
7351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7352%
7353%  MagickQuantizeImage() analyzes the colors within a reference image and
7354%  chooses a fixed number of colors to represent the image.  The goal of the
7355%  algorithm is to minimize the color difference between the input and output
7356%  image while minimizing the processing time.
7357%
7358%  The format of the MagickQuantizeImage method is:
7359%
7360%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7361%        const size_t number_colors,const ColorspaceType colorspace,
7362%        const size_t treedepth,const MagickBooleanType dither,
7363%        const MagickBooleanType measure_error)
7364%
7365%  A description of each parameter follows:
7366%
7367%    o wand: the magick wand.
7368%
7369%    o number_colors: the number of colors.
7370%
7371%    o colorspace: Perform color reduction in this colorspace, typically
7372%      RGBColorspace.
7373%
7374%    o treedepth: Normally, this integer value is zero or one.  A zero or
7375%      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
7376%      reference image with the least amount of memory and the fastest
7377%      computational speed.  In some cases, such as an image with low color
7378%      dispersion (a few number of colors), a value other than
7379%      Log4(number_colors) is required.  To expand the color tree completely,
7380%      use a value of 8.
7381%
7382%    o dither: A value other than zero distributes the difference between an
7383%      original image and the corresponding color reduced image to
7384%      neighboring pixels along a Hilbert curve.
7385%
7386%    o measure_error: A value other than zero measures the difference between
7387%      the original and quantized images.  This difference is the total
7388%      quantization error.  The error is computed by summing over all pixels
7389%      in an image the distance squared in RGB space between each reference
7390%      pixel value and its quantized value.
7391%
7392*/
7393WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7394  const size_t number_colors,const ColorspaceType colorspace,
7395  const size_t treedepth,const MagickBooleanType dither,
7396  const MagickBooleanType measure_error)
7397{
7398  MagickBooleanType
7399    status;
7400
7401  QuantizeInfo
7402    *quantize_info;
7403
7404  assert(wand != (MagickWand *) NULL);
7405  assert(wand->signature == WandSignature);
7406  if (wand->debug != MagickFalse)
7407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7408  if (wand->images == (Image *) NULL)
7409    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7410  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7411  quantize_info->number_colors=number_colors;
7412  quantize_info->dither=dither;
7413  quantize_info->tree_depth=treedepth;
7414  quantize_info->colorspace=colorspace;
7415  quantize_info->measure_error=measure_error;
7416  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7417  quantize_info=DestroyQuantizeInfo(quantize_info);
7418  return(status);
7419}
7420
7421/*
7422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7423%                                                                             %
7424%                                                                             %
7425%                                                                             %
7426%   M a g i c k Q u a n t i z e I m a g e s                                   %
7427%                                                                             %
7428%                                                                             %
7429%                                                                             %
7430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7431%
7432%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7433%  chooses a fixed number of colors to represent the image.  The goal of the
7434%  algorithm is to minimize the color difference between the input and output
7435%  image while minimizing the processing time.
7436%
7437%  The format of the MagickQuantizeImages method is:
7438%
7439%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7440%        const size_t number_colors,const ColorspaceType colorspace,
7441%        const size_t treedepth,const MagickBooleanType dither,
7442%        const MagickBooleanType measure_error)
7443%
7444%  A description of each parameter follows:
7445%
7446%    o wand: the magick wand.
7447%
7448%    o number_colors: the number of colors.
7449%
7450%    o colorspace: Perform color reduction in this colorspace, typically
7451%      RGBColorspace.
7452%
7453%    o treedepth: Normally, this integer value is zero or one.  A zero or
7454%      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
7455%      reference image with the least amount of memory and the fastest
7456%      computational speed.  In some cases, such as an image with low color
7457%      dispersion (a few number of colors), a value other than
7458%      Log4(number_colors) is required.  To expand the color tree completely,
7459%      use a value of 8.
7460%
7461%    o dither: A value other than zero distributes the difference between an
7462%      original image and the corresponding color reduced algorithm to
7463%      neighboring pixels along a Hilbert curve.
7464%
7465%    o measure_error: A value other than zero measures the difference between
7466%      the original and quantized images.  This difference is the total
7467%      quantization error.  The error is computed by summing over all pixels
7468%      in an image the distance squared in RGB space between each reference
7469%      pixel value and its quantized value.
7470%
7471*/
7472WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7473  const size_t number_colors,const ColorspaceType colorspace,
7474  const size_t treedepth,const MagickBooleanType dither,
7475  const MagickBooleanType measure_error)
7476{
7477  MagickBooleanType
7478    status;
7479
7480  QuantizeInfo
7481    *quantize_info;
7482
7483  assert(wand != (MagickWand *) NULL);
7484  assert(wand->signature == WandSignature);
7485  if (wand->debug != MagickFalse)
7486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7487  if (wand->images == (Image *) NULL)
7488    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7489  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7490  quantize_info->number_colors=number_colors;
7491  quantize_info->dither=dither;
7492  quantize_info->tree_depth=treedepth;
7493  quantize_info->colorspace=colorspace;
7494  quantize_info->measure_error=measure_error;
7495  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7496  quantize_info=DestroyQuantizeInfo(quantize_info);
7497  return(status);
7498}
7499
7500/*
7501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7502%                                                                             %
7503%                                                                             %
7504%                                                                             %
7505%   M a g i c k R a d i a l B l u r I m a g e                                 %
7506%                                                                             %
7507%                                                                             %
7508%                                                                             %
7509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7510%
7511%  MagickRadialBlurImage() radial blurs an image.
7512%
7513%  The format of the MagickRadialBlurImage method is:
7514%
7515%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7516%        const double angle)
7517%
7518%  A description of each parameter follows:
7519%
7520%    o wand: the magick wand.
7521%
7522%    o angle: the angle of the blur in degrees.
7523%
7524*/
7525WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7526  const double angle)
7527{
7528  Image
7529    *blur_image;
7530
7531  assert(wand != (MagickWand *) NULL);
7532  assert(wand->signature == WandSignature);
7533  if (wand->debug != MagickFalse)
7534    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7535  if (wand->images == (Image *) NULL)
7536    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7537  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7538  if (blur_image == (Image *) NULL)
7539    return(MagickFalse);
7540  ReplaceImageInList(&wand->images,blur_image);
7541  return(MagickTrue);
7542}
7543
7544/*
7545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7546%                                                                             %
7547%                                                                             %
7548%                                                                             %
7549%   M a g i c k R a i s e I m a g e                                           %
7550%                                                                             %
7551%                                                                             %
7552%                                                                             %
7553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7554%
7555%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7556%  by lightening and darkening the edges of the image.  Members width and
7557%  height of raise_info define the width of the vertical and horizontal
7558%  edge of the effect.
7559%
7560%  The format of the MagickRaiseImage method is:
7561%
7562%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7563%        const size_t width,const size_t height,const ssize_t x,
7564%        const ssize_t y,const MagickBooleanType raise)
7565%
7566%  A description of each parameter follows:
7567%
7568%    o wand: the magick wand.
7569%
7570%    o width,height,x,y:  Define the dimensions of the area to raise.
7571%
7572%    o raise: A value other than zero creates a 3-D raise effect,
7573%      otherwise it has a lowered effect.
7574%
7575*/
7576WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7577  const size_t width,const size_t height,const ssize_t x,
7578  const ssize_t y,const MagickBooleanType raise)
7579{
7580  MagickBooleanType
7581    status;
7582
7583  RectangleInfo
7584    raise_info;
7585
7586  assert(wand != (MagickWand *) NULL);
7587  assert(wand->signature == WandSignature);
7588  if (wand->debug != MagickFalse)
7589    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7590  if (wand->images == (Image *) NULL)
7591    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7592  raise_info.width=width;
7593  raise_info.height=height;
7594  raise_info.x=x;
7595  raise_info.y=y;
7596  status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7597  return(status);
7598}
7599
7600/*
7601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7602%                                                                             %
7603%                                                                             %
7604%                                                                             %
7605%   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                       %
7606%                                                                             %
7607%                                                                             %
7608%                                                                             %
7609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7610%
7611%  MagickRandomThresholdImage() changes the value of individual pixels based on
7612%  the intensity of each pixel compared to threshold.  The result is a
7613%  high-contrast, two color image.
7614%
7615%  The format of the MagickRandomThresholdImage method is:
7616%
7617%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7618%        const double low,const double high)
7619%
7620%  A description of each parameter follows:
7621%
7622%    o wand: the magick wand.
7623%
7624%    o low,high: Specify the high and low thresholds.  These values range from
7625%      0 to QuantumRange.
7626%
7627*/
7628WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7629  const double low,const double high)
7630{
7631  char
7632    threshold[MaxTextExtent];
7633
7634  MagickBooleanType
7635    status;
7636
7637  assert(wand != (MagickWand *) NULL);
7638  assert(wand->signature == WandSignature);
7639  if (wand->debug != MagickFalse)
7640    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7641  if (wand->images == (Image *) NULL)
7642    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7643  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7644  status=RandomThresholdImage(wand->images,threshold,wand->exception);
7645  if (status == MagickFalse)
7646    InheritException(wand->exception,&wand->images->exception);
7647  return(status);
7648}
7649
7650/*
7651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7652%                                                                             %
7653%                                                                             %
7654%                                                                             %
7655%   M a g i c k R e a d I m a g e                                             %
7656%                                                                             %
7657%                                                                             %
7658%                                                                             %
7659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7660%
7661%  MagickReadImage() reads an image or image sequence.  The images are inserted
7662%  at the current image pointer position.   Use MagickSetFirstIterator(),
7663%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7664%  image pointer position at the beginning of the image list, the end, or
7665%  anywhere in-between respectively.
7666%
7667%  The format of the MagickReadImage method is:
7668%
7669%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7670%
7671%  A description of each parameter follows:
7672%
7673%    o wand: the magick wand.
7674%
7675%    o filename: the image filename.
7676%
7677*/
7678WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7679  const char *filename)
7680{
7681  Image
7682    *images;
7683
7684  ImageInfo
7685    *read_info;
7686
7687  assert(wand != (MagickWand *) NULL);
7688  assert(wand->signature == WandSignature);
7689  if (wand->debug != MagickFalse)
7690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7691  read_info=CloneImageInfo(wand->image_info);
7692  if (filename != (const char *) NULL)
7693    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7694  images=ReadImage(read_info,wand->exception);
7695  read_info=DestroyImageInfo(read_info);
7696  if (images == (Image *) NULL)
7697    return(MagickFalse);
7698  return(InsertImageInWand(wand,images));
7699}
7700
7701/*
7702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7703%                                                                             %
7704%                                                                             %
7705%                                                                             %
7706%   M a g i c k R e a d I m a g e B l o b                                     %
7707%                                                                             %
7708%                                                                             %
7709%                                                                             %
7710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7711%
7712%  MagickReadImageBlob() reads an image or image sequence from a blob.
7713%
7714%  The format of the MagickReadImageBlob method is:
7715%
7716%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7717%        const void *blob,const size_t length)
7718%
7719%  A description of each parameter follows:
7720%
7721%    o wand: the magick wand.
7722%
7723%    o blob: the blob.
7724%
7725%    o length: the blob length.
7726%
7727*/
7728WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7729  const void *blob,const size_t length)
7730{
7731  Image
7732    *images;
7733
7734  assert(wand != (MagickWand *) NULL);
7735  assert(wand->signature == WandSignature);
7736  if (wand->debug != MagickFalse)
7737    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7738  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7739  if (images == (Image *) NULL)
7740    return(MagickFalse);
7741  return(InsertImageInWand(wand,images));
7742}
7743
7744/*
7745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7746%                                                                             %
7747%                                                                             %
7748%                                                                             %
7749%   M a g i c k R e a d I m a g e F i l e                                     %
7750%                                                                             %
7751%                                                                             %
7752%                                                                             %
7753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7754%
7755%  MagickReadImageFile() reads an image or image sequence from an open file
7756%  descriptor.
7757%
7758%  The format of the MagickReadImageFile method is:
7759%
7760%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7761%
7762%  A description of each parameter follows:
7763%
7764%    o wand: the magick wand.
7765%
7766%    o file: the file descriptor.
7767%
7768*/
7769WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7770{
7771  Image
7772    *images;
7773
7774  ImageInfo
7775    *read_info;
7776
7777  assert(wand != (MagickWand *) NULL);
7778  assert(wand->signature == WandSignature);
7779  assert(file != (FILE *) NULL);
7780  if (wand->debug != MagickFalse)
7781    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7782  read_info=CloneImageInfo(wand->image_info);
7783  SetImageInfoFile(read_info,file);
7784  images=ReadImage(read_info,wand->exception);
7785  read_info=DestroyImageInfo(read_info);
7786  if (images == (Image *) NULL)
7787    return(MagickFalse);
7788  return(InsertImageInWand(wand,images));
7789}
7790
7791/*
7792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7793%                                                                             %
7794%                                                                             %
7795%                                                                             %
7796%   M a g i c k R e m a p I m a g e                                           %
7797%                                                                             %
7798%                                                                             %
7799%                                                                             %
7800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7801%
7802%  MagickRemapImage() replaces the colors of an image with the closest color
7803%  from a reference image.
7804%
7805%  The format of the MagickRemapImage method is:
7806%
7807%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7808%        const MagickWand *remap_wand,const DitherMethod method)
7809%
7810%  A description of each parameter follows:
7811%
7812%    o wand: the magick wand.
7813%
7814%    o affinity: the affinity wand.
7815%
7816%    o method: choose from these dither methods: NoDitherMethod,
7817%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7818%
7819*/
7820WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7821  const MagickWand *remap_wand,const DitherMethod method)
7822{
7823  MagickBooleanType
7824    status;
7825
7826  QuantizeInfo
7827    *quantize_info;
7828
7829  assert(wand != (MagickWand *) NULL);
7830  assert(wand->signature == WandSignature);
7831  if (wand->debug != MagickFalse)
7832    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7833  if ((wand->images == (Image *) NULL) ||
7834      (remap_wand->images == (Image *) NULL))
7835    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7836  quantize_info=AcquireQuantizeInfo(wand->image_info);
7837  quantize_info->dither_method=method;
7838  if (method == NoDitherMethod)
7839    quantize_info->dither=MagickFalse;
7840  status=RemapImage(quantize_info,wand->images,remap_wand->images,
7841    wand->exception);
7842  quantize_info=DestroyQuantizeInfo(quantize_info);
7843  return(status);
7844}
7845
7846/*
7847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7848%                                                                             %
7849%                                                                             %
7850%                                                                             %
7851%   M a g i c k R e m o v e I m a g e                                         %
7852%                                                                             %
7853%                                                                             %
7854%                                                                             %
7855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7856%
7857%  MagickRemoveImage() removes an image from the image list.
7858%
7859%  The format of the MagickRemoveImage method is:
7860%
7861%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7862%
7863%  A description of each parameter follows:
7864%
7865%    o wand: the magick wand.
7866%
7867%    o insert: the splice wand.
7868%
7869*/
7870WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7871{
7872  assert(wand != (MagickWand *) NULL);
7873  assert(wand->signature == WandSignature);
7874  if (wand->debug != MagickFalse)
7875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7876  if (wand->images == (Image *) NULL)
7877    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7878  DeleteImageFromList(&wand->images);
7879  return(MagickTrue);
7880}
7881
7882/*
7883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7884%                                                                             %
7885%                                                                             %
7886%                                                                             %
7887%   M a g i c k R e s a m p l e I m a g e                                     %
7888%                                                                             %
7889%                                                                             %
7890%                                                                             %
7891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7892%
7893%  MagickResampleImage() resample image to desired resolution.
7894%
7895%    Bessel   Blackman   Box
7896%    Catrom   Cubic      Gaussian
7897%    Hanning  Hermite    Lanczos
7898%    Mitchell Point      Quandratic
7899%    Sinc     Triangle
7900%
7901%  Most of the filters are FIR (finite impulse response), however, Bessel,
7902%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7903%  are windowed (brought down to zero) with the Blackman filter.
7904%
7905%  The format of the MagickResampleImage method is:
7906%
7907%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7908%        const double x_resolution,const double y_resolution,
7909%        const FilterTypes filter,const double blur)
7910%
7911%  A description of each parameter follows:
7912%
7913%    o wand: the magick wand.
7914%
7915%    o x_resolution: the new image x resolution.
7916%
7917%    o y_resolution: the new image y resolution.
7918%
7919%    o filter: Image filter to use.
7920%
7921%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7922%
7923*/
7924WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7925  const double x_resolution,const double y_resolution,const FilterTypes filter,
7926  const double blur)
7927{
7928  Image
7929    *resample_image;
7930
7931  assert(wand != (MagickWand *) NULL);
7932  assert(wand->signature == WandSignature);
7933  if (wand->debug != MagickFalse)
7934    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7935  if (wand->images == (Image *) NULL)
7936    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7937  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7938    blur,wand->exception);
7939  if (resample_image == (Image *) NULL)
7940    return(MagickFalse);
7941  ReplaceImageInList(&wand->images,resample_image);
7942  return(MagickTrue);
7943}
7944
7945/*
7946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7947%                                                                             %
7948%                                                                             %
7949%                                                                             %
7950%   M a g i c k R e s e t I m a g e P a g e                                   %
7951%                                                                             %
7952%                                                                             %
7953%                                                                             %
7954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7955%
7956%  MagickResetImagePage() resets the Wand page canvas and position.
7957%
7958%  The format of the MagickResetImagePage method is:
7959%
7960%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7961%        const char *page)
7962%
7963%  A description of each parameter follows:
7964%
7965%    o wand: the magick wand.
7966%
7967%    o page: the relative page specification.
7968%
7969*/
7970WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7971  const char *page)
7972{
7973  assert(wand != (MagickWand *) NULL);
7974  assert(wand->signature == WandSignature);
7975  if (wand->debug != MagickFalse)
7976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7977  if (wand->images == (Image *) NULL)
7978    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7979  if ((page == (char *) NULL) || (*page == '\0'))
7980    {
7981      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
7982      return(MagickTrue);
7983    }
7984  return(ResetImagePage(wand->images,page));
7985}
7986
7987/*
7988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7989%                                                                             %
7990%                                                                             %
7991%                                                                             %
7992%   M a g i c k R e s i z e I m a g e                                         %
7993%                                                                             %
7994%                                                                             %
7995%                                                                             %
7996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7997%
7998%  MagickResizeImage() scales an image to the desired dimensions with one of
7999%  these filters:
8000%
8001%    Bessel   Blackman   Box
8002%    Catrom   Cubic      Gaussian
8003%    Hanning  Hermite    Lanczos
8004%    Mitchell Point      Quandratic
8005%    Sinc     Triangle
8006%
8007%  Most of the filters are FIR (finite impulse response), however, Bessel,
8008%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8009%  are windowed (brought down to zero) with the Blackman filter.
8010%
8011%  The format of the MagickResizeImage method is:
8012%
8013%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8014%        const size_t columns,const size_t rows,
8015%        const FilterTypes filter,const double blur)
8016%
8017%  A description of each parameter follows:
8018%
8019%    o wand: the magick wand.
8020%
8021%    o columns: the number of columns in the scaled image.
8022%
8023%    o rows: the number of rows in the scaled image.
8024%
8025%    o filter: Image filter to use.
8026%
8027%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8028%
8029*/
8030WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8031  const size_t columns,const size_t rows,const FilterTypes filter,
8032  const double blur)
8033{
8034  Image
8035    *resize_image;
8036
8037  assert(wand != (MagickWand *) NULL);
8038  assert(wand->signature == WandSignature);
8039  if (wand->debug != MagickFalse)
8040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8041  if (wand->images == (Image *) NULL)
8042    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8043  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8044    wand->exception);
8045  if (resize_image == (Image *) NULL)
8046    return(MagickFalse);
8047  ReplaceImageInList(&wand->images,resize_image);
8048  return(MagickTrue);
8049}
8050
8051/*
8052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8053%                                                                             %
8054%                                                                             %
8055%                                                                             %
8056%   M a g i c k R o l l I m a g e                                             %
8057%                                                                             %
8058%                                                                             %
8059%                                                                             %
8060%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8061%
8062%  MagickRollImage() offsets an image as defined by x and y.
8063%
8064%  The format of the MagickRollImage method is:
8065%
8066%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8067%        const size_t y)
8068%
8069%  A description of each parameter follows:
8070%
8071%    o wand: the magick wand.
8072%
8073%    o x: the x offset.
8074%
8075%    o y: the y offset.
8076%
8077%
8078*/
8079WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8080  const ssize_t x,const ssize_t y)
8081{
8082  Image
8083    *roll_image;
8084
8085  assert(wand != (MagickWand *) NULL);
8086  assert(wand->signature == WandSignature);
8087  if (wand->debug != MagickFalse)
8088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8089  if (wand->images == (Image *) NULL)
8090    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8091  roll_image=RollImage(wand->images,x,y,wand->exception);
8092  if (roll_image == (Image *) NULL)
8093    return(MagickFalse);
8094  ReplaceImageInList(&wand->images,roll_image);
8095  return(MagickTrue);
8096}
8097
8098/*
8099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8100%                                                                             %
8101%                                                                             %
8102%                                                                             %
8103%   M a g i c k R o t a t e I m a g e                                         %
8104%                                                                             %
8105%                                                                             %
8106%                                                                             %
8107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8108%
8109%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8110%  triangles left over from rotating the image are filled with the
8111%  background color.
8112%
8113%  The format of the MagickRotateImage method is:
8114%
8115%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8116%        const PixelWand *background,const double degrees)
8117%
8118%  A description of each parameter follows:
8119%
8120%    o wand: the magick wand.
8121%
8122%    o background: the background pixel wand.
8123%
8124%    o degrees: the number of degrees to rotate the image.
8125%
8126%
8127*/
8128WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8129  const PixelWand *background,const double degrees)
8130{
8131  Image
8132    *rotate_image;
8133
8134  assert(wand != (MagickWand *) NULL);
8135  assert(wand->signature == WandSignature);
8136  if (wand->debug != MagickFalse)
8137    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8138  if (wand->images == (Image *) NULL)
8139    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8140  PixelGetQuantumPacket(background,&wand->images->background_color);
8141  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8142  if (rotate_image == (Image *) NULL)
8143    return(MagickFalse);
8144  ReplaceImageInList(&wand->images,rotate_image);
8145  return(MagickTrue);
8146}
8147
8148/*
8149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8150%                                                                             %
8151%                                                                             %
8152%                                                                             %
8153%   M a g i c k S a m p l e I m a g e                                         %
8154%                                                                             %
8155%                                                                             %
8156%                                                                             %
8157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8158%
8159%  MagickSampleImage() scales an image to the desired dimensions with pixel
8160%  sampling.  Unlike other scaling methods, this method does not introduce
8161%  any additional color into the scaled image.
8162%
8163%  The format of the MagickSampleImage method is:
8164%
8165%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8166%        const size_t columns,const size_t rows)
8167%
8168%  A description of each parameter follows:
8169%
8170%    o wand: the magick wand.
8171%
8172%    o columns: the number of columns in the scaled image.
8173%
8174%    o rows: the number of rows in the scaled image.
8175%
8176%
8177*/
8178WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8179  const size_t columns,const size_t rows)
8180{
8181  Image
8182    *sample_image;
8183
8184  assert(wand != (MagickWand *) NULL);
8185  assert(wand->signature == WandSignature);
8186  if (wand->debug != MagickFalse)
8187    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8188  if (wand->images == (Image *) NULL)
8189    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8190  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8191  if (sample_image == (Image *) NULL)
8192    return(MagickFalse);
8193  ReplaceImageInList(&wand->images,sample_image);
8194  return(MagickTrue);
8195}
8196
8197/*
8198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8199%                                                                             %
8200%                                                                             %
8201%                                                                             %
8202%   M a g i c k S c a l e I m a g e                                           %
8203%                                                                             %
8204%                                                                             %
8205%                                                                             %
8206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8207%
8208%  MagickScaleImage() scales the size of an image to the given dimensions.
8209%
8210%  The format of the MagickScaleImage method is:
8211%
8212%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8213%        const size_t columns,const size_t rows)
8214%
8215%  A description of each parameter follows:
8216%
8217%    o wand: the magick wand.
8218%
8219%    o columns: the number of columns in the scaled image.
8220%
8221%    o rows: the number of rows in the scaled image.
8222%
8223%
8224*/
8225WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8226  const size_t columns,const size_t rows)
8227{
8228  Image
8229    *scale_image;
8230
8231  assert(wand != (MagickWand *) NULL);
8232  assert(wand->signature == WandSignature);
8233  if (wand->debug != MagickFalse)
8234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8235  if (wand->images == (Image *) NULL)
8236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8237  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8238  if (scale_image == (Image *) NULL)
8239    return(MagickFalse);
8240  ReplaceImageInList(&wand->images,scale_image);
8241  return(MagickTrue);
8242}
8243
8244/*
8245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8246%                                                                             %
8247%                                                                             %
8248%                                                                             %
8249%   M a g i c k S e g m e n t I m a g e                                       %
8250%                                                                             %
8251%                                                                             %
8252%                                                                             %
8253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8254%
8255%  MagickSegmentImage() segments an image by analyzing the histograms of the
8256%  color components and identifying units that are homogeneous with the fuzzy
8257%  C-means technique.
8258%
8259%  The format of the SegmentImage method is:
8260%
8261%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8262%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8263%        const double cluster_threshold,const double smooth_threshold)
8264%
8265%  A description of each parameter follows.
8266%
8267%    o wand: the wand.
8268%
8269%    o colorspace: the image colorspace.
8270%
8271%    o verbose:  Set to MagickTrue to print detailed information about the
8272%      identified classes.
8273%
8274%    o cluster_threshold:  This represents the minimum number of pixels
8275%      contained in a hexahedra before it can be considered valid (expressed as
8276%      a percentage).
8277%
8278%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8279%      derivative of the histogram.  As the value is increased, you can expect a
8280%      smoother second derivative.
8281%
8282*/
8283MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8284  const ColorspaceType colorspace,const MagickBooleanType verbose,
8285  const double cluster_threshold,const double smooth_threshold)
8286{
8287  MagickBooleanType
8288    status;
8289
8290  assert(wand != (MagickWand *) NULL);
8291  assert(wand->signature == WandSignature);
8292  if (wand->debug != MagickFalse)
8293    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8294  if (wand->images == (Image *) NULL)
8295    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8296  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8297    smooth_threshold,wand->exception);
8298  return(status);
8299}
8300
8301/*
8302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8303%                                                                             %
8304%                                                                             %
8305%                                                                             %
8306%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8307%                                                                             %
8308%                                                                             %
8309%                                                                             %
8310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8311%
8312%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8313%  threshold. It is similar to the unsharpen mask that sharpens everything with
8314%  contrast above a certain threshold.
8315%
8316%  The format of the MagickSelectiveBlurImage method is:
8317%
8318%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8319%        const double radius,const double sigma,const double threshold)
8320%
8321%  A description of each parameter follows:
8322%
8323%    o wand: the magick wand.
8324%
8325%    o radius: the radius of the gaussian, in pixels, not counting the center
8326%      pixel.
8327%
8328%    o sigma: the standard deviation of the gaussian, in pixels.
8329%
8330%    o threshold: only pixels within this contrast threshold are included
8331%      in the blur operation.
8332%
8333*/
8334WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8335  const double radius,const double sigma,const double threshold)
8336{
8337  Image
8338    *blur_image;
8339
8340  assert(wand != (MagickWand *) NULL);
8341  assert(wand->signature == WandSignature);
8342  if (wand->debug != MagickFalse)
8343    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8344  if (wand->images == (Image *) NULL)
8345    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8346  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8347    wand->exception);
8348  if (blur_image == (Image *) NULL)
8349    return(MagickFalse);
8350  ReplaceImageInList(&wand->images,blur_image);
8351  return(MagickTrue);
8352}
8353
8354/*
8355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8356%                                                                             %
8357%                                                                             %
8358%                                                                             %
8359%   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                       %
8360%                                                                             %
8361%                                                                             %
8362%                                                                             %
8363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8364%
8365%  MagickSeparateImage() separates a channel from the image and returns a
8366%  grayscale image.  A channel is a particular color component of each pixel
8367%  in the image.
8368%
8369%  The format of the MagickSeparateImage method is:
8370%
8371%      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8372%
8373%  A description of each parameter follows:
8374%
8375%    o wand: the magick wand.
8376%
8377*/
8378WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8379{
8380  MagickBooleanType
8381    status;
8382
8383  assert(wand != (MagickWand *) NULL);
8384  assert(wand->signature == WandSignature);
8385  if (wand->debug != MagickFalse)
8386    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8387  if (wand->images == (Image *) NULL)
8388    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8389  status=SeparateImage(wand->images);
8390  if (status == MagickFalse)
8391    InheritException(wand->exception,&wand->images->exception);
8392  return(status);
8393}
8394
8395/*
8396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8397%                                                                             %
8398%                                                                             %
8399%                                                                             %
8400%     M a g i c k S e p i a T o n e I m a g e                                 %
8401%                                                                             %
8402%                                                                             %
8403%                                                                             %
8404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8405%
8406%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8407%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8408%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8409%  threshold of 80% is a good starting point for a reasonable tone.
8410%
8411%  The format of the MagickSepiaToneImage method is:
8412%
8413%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8414%        const double threshold)
8415%
8416%  A description of each parameter follows:
8417%
8418%    o wand: the magick wand.
8419%
8420%    o threshold:  Define the extent of the sepia toning.
8421%
8422*/
8423WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8424  const double threshold)
8425{
8426  Image
8427    *sepia_image;
8428
8429  assert(wand != (MagickWand *) NULL);
8430  assert(wand->signature == WandSignature);
8431  if (wand->debug != MagickFalse)
8432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8433  if (wand->images == (Image *) NULL)
8434    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8435  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8436  if (sepia_image == (Image *) NULL)
8437    return(MagickFalse);
8438  ReplaceImageInList(&wand->images,sepia_image);
8439  return(MagickTrue);
8440}
8441
8442/*
8443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8444%                                                                             %
8445%                                                                             %
8446%                                                                             %
8447%   M a g i c k S e t I m a g e                                               %
8448%                                                                             %
8449%                                                                             %
8450%                                                                             %
8451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8452%
8453%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8454%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8455%  wand.
8456%
8457%  The format of the MagickSetImage method is:
8458%
8459%      MagickBooleanType MagickSetImage(MagickWand *wand,
8460%        const MagickWand *set_wand)
8461%
8462%  A description of each parameter follows:
8463%
8464%    o wand: the magick wand.
8465%
8466%    o set_wand: the set_wand wand.
8467%
8468*/
8469WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8470  const MagickWand *set_wand)
8471{
8472  Image
8473    *images;
8474
8475  assert(wand != (MagickWand *) NULL);
8476  assert(wand->signature == WandSignature);
8477  if (wand->debug != MagickFalse)
8478    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8479  assert(set_wand != (MagickWand *) NULL);
8480  assert(set_wand->signature == WandSignature);
8481  if (wand->debug != MagickFalse)
8482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8483  if (set_wand->images == (Image *) NULL)
8484    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8485  images=CloneImageList(set_wand->images,wand->exception);
8486  if (images == (Image *) NULL)
8487    return(MagickFalse);
8488  ReplaceImageInList(&wand->images,images);
8489  return(MagickTrue);
8490}
8491
8492/*
8493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8494%                                                                             %
8495%                                                                             %
8496%                                                                             %
8497%   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                       %
8498%                                                                             %
8499%                                                                             %
8500%                                                                             %
8501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8502%
8503%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8504%  alpha channel.
8505%
8506%  The format of the MagickSetImageAlphaChannel method is:
8507%
8508%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8509%        const AlphaChannelType alpha_type)
8510%
8511%  A description of each parameter follows:
8512%
8513%    o wand: the magick wand.
8514%
8515%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8516%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8517%
8518*/
8519WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8520  const AlphaChannelType alpha_type)
8521{
8522  assert(wand != (MagickWand *) NULL);
8523  assert(wand->signature == WandSignature);
8524  if (wand->debug != MagickFalse)
8525    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8526  if (wand->images == (Image *) NULL)
8527    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8528  return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8529}
8530
8531/*
8532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8533%                                                                             %
8534%                                                                             %
8535%                                                                             %
8536%   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                 %
8537%                                                                             %
8538%                                                                             %
8539%                                                                             %
8540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8541%
8542%  MagickSetImageBackgroundColor() sets the image background color.
8543%
8544%  The format of the MagickSetImageBackgroundColor method is:
8545%
8546%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8547%        const PixelWand *background)
8548%
8549%  A description of each parameter follows:
8550%
8551%    o wand: the magick wand.
8552%
8553%    o background: the background pixel wand.
8554%
8555*/
8556WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8557  const PixelWand *background)
8558{
8559  assert(wand != (MagickWand *) NULL);
8560  assert(wand->signature == WandSignature);
8561  if (wand->debug != MagickFalse)
8562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8563  if (wand->images == (Image *) NULL)
8564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8565  PixelGetQuantumPacket(background,&wand->images->background_color);
8566  return(MagickTrue);
8567}
8568
8569/*
8570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8571%                                                                             %
8572%                                                                             %
8573%                                                                             %
8574%   M a g i c k S e t I m a g e B i a s                                       %
8575%                                                                             %
8576%                                                                             %
8577%                                                                             %
8578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8579%
8580%  MagickSetImageBias() sets the image bias for any method that convolves an
8581%  image (e.g. MagickConvolveImage()).
8582%
8583%  The format of the MagickSetImageBias method is:
8584%
8585%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8586%        const double bias)
8587%
8588%  A description of each parameter follows:
8589%
8590%    o wand: the magick wand.
8591%
8592%    o bias: the image bias.
8593%
8594*/
8595WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8596  const double bias)
8597{
8598  assert(wand != (MagickWand *) NULL);
8599  assert(wand->signature == WandSignature);
8600  if (wand->debug != MagickFalse)
8601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8602  if (wand->images == (Image *) NULL)
8603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8604  wand->images->bias=bias;
8605  return(MagickTrue);
8606}
8607
8608/*
8609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8610%                                                                             %
8611%                                                                             %
8612%                                                                             %
8613%   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                         %
8614%                                                                             %
8615%                                                                             %
8616%                                                                             %
8617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8618%
8619%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8620%
8621%  The format of the MagickSetImageBluePrimary method is:
8622%
8623%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8624%        const double x,const double y)
8625%
8626%  A description of each parameter follows:
8627%
8628%    o wand: the magick wand.
8629%
8630%    o x: the blue primary x-point.
8631%
8632%    o y: the blue primary y-point.
8633%
8634*/
8635WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8636  const double x,const double y)
8637{
8638  assert(wand != (MagickWand *) NULL);
8639  assert(wand->signature == WandSignature);
8640  if (wand->debug != MagickFalse)
8641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8642  if (wand->images == (Image *) NULL)
8643    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8644  wand->images->chromaticity.blue_primary.x=x;
8645  wand->images->chromaticity.blue_primary.y=y;
8646  return(MagickTrue);
8647}
8648
8649/*
8650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8651%                                                                             %
8652%                                                                             %
8653%                                                                             %
8654%   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                         %
8655%                                                                             %
8656%                                                                             %
8657%                                                                             %
8658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8659%
8660%  MagickSetImageBorderColor() sets the image border color.
8661%
8662%  The format of the MagickSetImageBorderColor method is:
8663%
8664%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8665%        const PixelWand *border)
8666%
8667%  A description of each parameter follows:
8668%
8669%    o wand: the magick wand.
8670%
8671%    o border: the border pixel wand.
8672%
8673*/
8674WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8675  const PixelWand *border)
8676{
8677  assert(wand != (MagickWand *) NULL);
8678  assert(wand->signature == WandSignature);
8679  if (wand->debug != MagickFalse)
8680    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8681  if (wand->images == (Image *) NULL)
8682    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8683  PixelGetQuantumPacket(border,&wand->images->border_color);
8684  return(MagickTrue);
8685}
8686
8687/*
8688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%   M a g i c k S e t I m a g e C l i p M a s k                               %
8693%                                                                             %
8694%                                                                             %
8695%                                                                             %
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%
8698%  MagickSetImageClipMask() sets image clip mask.
8699%
8700%  The format of the MagickSetImageClipMask method is:
8701%
8702%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8703%        const MagickWand *clip_mask)
8704%
8705%  A description of each parameter follows:
8706%
8707%    o wand: the magick wand.
8708%
8709%    o clip_mask: the clip_mask wand.
8710%
8711*/
8712WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8713  const MagickWand *clip_mask)
8714{
8715  assert(wand != (MagickWand *) NULL);
8716  assert(wand->signature == WandSignature);
8717  if (wand->debug != MagickFalse)
8718    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8719  assert(clip_mask != (MagickWand *) NULL);
8720  assert(clip_mask->signature == WandSignature);
8721  if (wand->debug != MagickFalse)
8722    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8723  if (clip_mask->images == (Image *) NULL)
8724    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8725  return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8726}
8727
8728/*
8729%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8730%                                                                             %
8731%                                                                             %
8732%                                                                             %
8733%   M a g i c k S e t I m a g e C o l o r                                     %
8734%                                                                             %
8735%                                                                             %
8736%                                                                             %
8737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8738%
8739%  MagickSetImageColor() set the entire wand canvas to the specified color.
8740%
8741%  The format of the MagickSetImageColor method is:
8742%
8743%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8744%        const PixelWand *color)
8745%
8746%  A description of each parameter follows:
8747%
8748%    o wand: the magick wand.
8749%
8750%    o background: the image color.
8751%
8752*/
8753WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8754  const PixelWand *color)
8755{
8756  MagickBooleanType
8757    status;
8758
8759  PixelInfo
8760    pixel;
8761
8762  assert(wand != (MagickWand *) NULL);
8763  assert(wand->signature == WandSignature);
8764  if (wand->debug != MagickFalse)
8765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8766  PixelGetMagickColor(color,&pixel);
8767  status=SetImageColor(wand->images,&pixel);
8768  if (status == MagickFalse)
8769    InheritException(wand->exception,&wand->images->exception);
8770  return(status);
8771}
8772
8773/*
8774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8775%                                                                             %
8776%                                                                             %
8777%                                                                             %
8778%   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                     %
8779%                                                                             %
8780%                                                                             %
8781%                                                                             %
8782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8783%
8784%  MagickSetImageColormapColor() sets the color of the specified colormap
8785%  index.
8786%
8787%  The format of the MagickSetImageColormapColor method is:
8788%
8789%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8790%        const size_t index,const PixelWand *color)
8791%
8792%  A description of each parameter follows:
8793%
8794%    o wand: the magick wand.
8795%
8796%    o index: the offset into the image colormap.
8797%
8798%    o color: Return the colormap color in this wand.
8799%
8800*/
8801WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8802  const size_t index,const PixelWand *color)
8803{
8804  assert(wand != (MagickWand *) NULL);
8805  assert(wand->signature == WandSignature);
8806  if (wand->debug != MagickFalse)
8807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8808  if (wand->images == (Image *) NULL)
8809    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8810  if ((wand->images->colormap == (PixelPacket *) NULL) ||
8811      (index >= wand->images->colors))
8812    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8813  PixelGetQuantumPacket(color,wand->images->colormap+index);
8814  return(SyncImage(wand->images));
8815}
8816
8817/*
8818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8819%                                                                             %
8820%                                                                             %
8821%                                                                             %
8822%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8823%                                                                             %
8824%                                                                             %
8825%                                                                             %
8826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8827%
8828%  MagickSetImageColorspace() sets the image colorspace.
8829%
8830%  The format of the MagickSetImageColorspace method is:
8831%
8832%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8833%        const ColorspaceType colorspace)
8834%
8835%  A description of each parameter follows:
8836%
8837%    o wand: the magick wand.
8838%
8839%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8840%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8841%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8842%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8843%      HSLColorspace, or HWBColorspace.
8844%
8845*/
8846WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8847  const ColorspaceType colorspace)
8848{
8849  assert(wand != (MagickWand *) NULL);
8850  assert(wand->signature == WandSignature);
8851  if (wand->debug != MagickFalse)
8852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8853  if (wand->images == (Image *) NULL)
8854    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8855  return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8856}
8857
8858/*
8859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8860%                                                                             %
8861%                                                                             %
8862%                                                                             %
8863%   M a g i c k S e t I m a g e C o m p o s e                                 %
8864%                                                                             %
8865%                                                                             %
8866%                                                                             %
8867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8868%
8869%  MagickSetImageCompose() sets the image composite operator, useful for
8870%  specifying how to composite the image thumbnail when using the
8871%  MagickMontageImage() method.
8872%
8873%  The format of the MagickSetImageCompose method is:
8874%
8875%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8876%        const CompositeOperator compose)
8877%
8878%  A description of each parameter follows:
8879%
8880%    o wand: the magick wand.
8881%
8882%    o compose: the image composite operator.
8883%
8884*/
8885WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8886  const CompositeOperator compose)
8887{
8888  assert(wand != (MagickWand *) NULL);
8889  assert(wand->signature == WandSignature);
8890  if (wand->debug != MagickFalse)
8891    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8892  if (wand->images == (Image *) NULL)
8893    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8894  wand->images->compose=compose;
8895  return(MagickTrue);
8896}
8897
8898/*
8899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8900%                                                                             %
8901%                                                                             %
8902%                                                                             %
8903%   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                         %
8904%                                                                             %
8905%                                                                             %
8906%                                                                             %
8907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8908%
8909%  MagickSetImageCompression() sets the image compression.
8910%
8911%  The format of the MagickSetImageCompression method is:
8912%
8913%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8914%        const CompressionType compression)
8915%
8916%  A description of each parameter follows:
8917%
8918%    o wand: the magick wand.
8919%
8920%    o compression: the image compression type.
8921%
8922*/
8923WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8924  const CompressionType compression)
8925{
8926  assert(wand != (MagickWand *) NULL);
8927  assert(wand->signature == WandSignature);
8928  if (wand->debug != MagickFalse)
8929    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8930  if (wand->images == (Image *) NULL)
8931    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8932  wand->images->compression=compression;
8933  return(MagickTrue);
8934}
8935
8936/*
8937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8938%                                                                             %
8939%                                                                             %
8940%                                                                             %
8941%   M a g i c k S e t I m a g e C o m p r e s s i o n Q u a l i t y           %
8942%                                                                             %
8943%                                                                             %
8944%                                                                             %
8945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8946%
8947%  MagickSetImageCompressionQuality() sets the image compression quality.
8948%
8949%  The format of the MagickSetImageCompressionQuality method is:
8950%
8951%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8952%        const size_t quality)
8953%
8954%  A description of each parameter follows:
8955%
8956%    o wand: the magick wand.
8957%
8958%    o quality: the image compression tlityype.
8959%
8960*/
8961WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8962  const size_t quality)
8963{
8964  assert(wand != (MagickWand *) NULL);
8965  assert(wand->signature == WandSignature);
8966  if (wand->debug != MagickFalse)
8967    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8968  if (wand->images == (Image *) NULL)
8969    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8970  wand->images->quality=quality;
8971  return(MagickTrue);
8972}
8973
8974/*
8975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8976%                                                                             %
8977%                                                                             %
8978%                                                                             %
8979%   M a g i c k S e t I m a g e D e l a y                                     %
8980%                                                                             %
8981%                                                                             %
8982%                                                                             %
8983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8984%
8985%  MagickSetImageDelay() sets the image delay.
8986%
8987%  The format of the MagickSetImageDelay method is:
8988%
8989%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
8990%        const size_t delay)
8991%
8992%  A description of each parameter follows:
8993%
8994%    o wand: the magick wand.
8995%
8996%    o delay: the image delay in ticks-per-second units.
8997%
8998*/
8999WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9000  const size_t delay)
9001{
9002  assert(wand != (MagickWand *) NULL);
9003  assert(wand->signature == WandSignature);
9004  if (wand->debug != MagickFalse)
9005    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9006  if (wand->images == (Image *) NULL)
9007    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9008  wand->images->delay=delay;
9009  return(MagickTrue);
9010}
9011
9012/*
9013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9014%                                                                             %
9015%                                                                             %
9016%                                                                             %
9017%   M a g i c k S e t I m a g e D e p t h                                     %
9018%                                                                             %
9019%                                                                             %
9020%                                                                             %
9021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9022%
9023%  MagickSetImageDepth() sets the image depth.
9024%
9025%  The format of the MagickSetImageDepth method is:
9026%
9027%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9028%        const size_t depth)
9029%
9030%  A description of each parameter follows:
9031%
9032%    o wand: the magick wand.
9033%
9034%    o depth: the image depth in bits: 8, 16, or 32.
9035%
9036*/
9037WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9038  const size_t depth)
9039{
9040  assert(wand != (MagickWand *) NULL);
9041  assert(wand->signature == WandSignature);
9042  if (wand->debug != MagickFalse)
9043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9044  if (wand->images == (Image *) NULL)
9045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9046  return(SetImageDepth(wand->images,depth));
9047}
9048
9049/*
9050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9051%                                                                             %
9052%                                                                             %
9053%                                                                             %
9054%   M a g i c k S e t I m a g e D i s p o s e                                 %
9055%                                                                             %
9056%                                                                             %
9057%                                                                             %
9058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9059%
9060%  MagickSetImageDispose() sets the image disposal method.
9061%
9062%  The format of the MagickSetImageDispose method is:
9063%
9064%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9065%        const DisposeType dispose)
9066%
9067%  A description of each parameter follows:
9068%
9069%    o wand: the magick wand.
9070%
9071%    o dispose: the image disposeal type.
9072%
9073*/
9074WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9075  const DisposeType dispose)
9076{
9077  assert(wand != (MagickWand *) NULL);
9078  assert(wand->signature == WandSignature);
9079  if (wand->debug != MagickFalse)
9080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9081  if (wand->images == (Image *) NULL)
9082    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9083  wand->images->dispose=dispose;
9084  return(MagickTrue);
9085}
9086
9087/*
9088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9089%                                                                             %
9090%                                                                             %
9091%                                                                             %
9092%   M a g i c k S e t I m a g e E x t e n t                                   %
9093%                                                                             %
9094%                                                                             %
9095%                                                                             %
9096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9097%
9098%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9099%
9100%  The format of the MagickSetImageExtent method is:
9101%
9102%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9103%        const size_t columns,const unsigned rows)
9104%
9105%  A description of each parameter follows:
9106%
9107%    o wand: the magick wand.
9108%
9109%    o columns:  The image width in pixels.
9110%
9111%    o rows:  The image height in pixels.
9112%
9113*/
9114WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9115  const size_t columns,const size_t rows)
9116{
9117  assert(wand != (MagickWand *) NULL);
9118  assert(wand->signature == WandSignature);
9119  if (wand->debug != MagickFalse)
9120    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9121  if (wand->images == (Image *) NULL)
9122    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9123  return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9124}
9125
9126/*
9127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9128%                                                                             %
9129%                                                                             %
9130%                                                                             %
9131%   M a g i c k S e t I m a g e F i l e n a m e                               %
9132%                                                                             %
9133%                                                                             %
9134%                                                                             %
9135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9136%
9137%  MagickSetImageFilename() sets the filename of a particular image in a
9138%  sequence.
9139%
9140%  The format of the MagickSetImageFilename method is:
9141%
9142%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9143%        const char *filename)
9144%
9145%  A description of each parameter follows:
9146%
9147%    o wand: the magick wand.
9148%
9149%    o filename: the image filename.
9150%
9151*/
9152WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9153  const char *filename)
9154{
9155  assert(wand != (MagickWand *) NULL);
9156  assert(wand->signature == WandSignature);
9157  if (wand->debug != MagickFalse)
9158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9159  if (wand->images == (Image *) NULL)
9160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9161  if (filename != (const char *) NULL)
9162    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9163  return(MagickTrue);
9164}
9165
9166/*
9167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9168%                                                                             %
9169%                                                                             %
9170%                                                                             %
9171%   M a g i c k S e t I m a g e F o r m a t                                   %
9172%                                                                             %
9173%                                                                             %
9174%                                                                             %
9175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9176%
9177%  MagickSetImageFormat() sets the format of a particular image in a
9178%  sequence.
9179%
9180%  The format of the MagickSetImageFormat method is:
9181%
9182%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9183%        const char *format)
9184%
9185%  A description of each parameter follows:
9186%
9187%    o wand: the magick wand.
9188%
9189%    o format: the image format.
9190%
9191*/
9192WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9193  const char *format)
9194{
9195  const MagickInfo
9196    *magick_info;
9197
9198  assert(wand != (MagickWand *) NULL);
9199  assert(wand->signature == WandSignature);
9200  if (wand->debug != MagickFalse)
9201    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9202  if (wand->images == (Image *) NULL)
9203    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9204  if ((format == (char *) NULL) || (*format == '\0'))
9205    {
9206      *wand->images->magick='\0';
9207      return(MagickTrue);
9208    }
9209  magick_info=GetMagickInfo(format,wand->exception);
9210  if (magick_info == (const MagickInfo *) NULL)
9211    return(MagickFalse);
9212  ClearMagickException(wand->exception);
9213  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9214  return(MagickTrue);
9215}
9216
9217/*
9218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9219%                                                                             %
9220%                                                                             %
9221%                                                                             %
9222%   M a g i c k S e t I m a g e F u z z                                       %
9223%                                                                             %
9224%                                                                             %
9225%                                                                             %
9226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9227%
9228%  MagickSetImageFuzz() sets the image fuzz.
9229%
9230%  The format of the MagickSetImageFuzz method is:
9231%
9232%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9233%        const double fuzz)
9234%
9235%  A description of each parameter follows:
9236%
9237%    o wand: the magick wand.
9238%
9239%    o fuzz: the image fuzz.
9240%
9241*/
9242WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9243  const double fuzz)
9244{
9245  assert(wand != (MagickWand *) NULL);
9246  assert(wand->signature == WandSignature);
9247  if (wand->debug != MagickFalse)
9248    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9249  if (wand->images == (Image *) NULL)
9250    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9251  wand->images->fuzz=fuzz;
9252  return(MagickTrue);
9253}
9254
9255/*
9256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9257%                                                                             %
9258%                                                                             %
9259%                                                                             %
9260%   M a g i c k S e t I m a g e G a m m a                                     %
9261%                                                                             %
9262%                                                                             %
9263%                                                                             %
9264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9265%
9266%  MagickSetImageGamma() sets the image gamma.
9267%
9268%  The format of the MagickSetImageGamma method is:
9269%
9270%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9271%        const double gamma)
9272%
9273%  A description of each parameter follows:
9274%
9275%    o wand: the magick wand.
9276%
9277%    o gamma: the image gamma.
9278%
9279*/
9280WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9281  const double gamma)
9282{
9283  assert(wand != (MagickWand *) NULL);
9284  assert(wand->signature == WandSignature);
9285  if (wand->debug != MagickFalse)
9286    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9287  if (wand->images == (Image *) NULL)
9288    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9289  wand->images->gamma=gamma;
9290  return(MagickTrue);
9291}
9292
9293/*
9294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9295%                                                                             %
9296%                                                                             %
9297%                                                                             %
9298%   M a g i c k S e t I m a g e G r a v i t y                                 %
9299%                                                                             %
9300%                                                                             %
9301%                                                                             %
9302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9303%
9304%  MagickSetImageGravity() sets the image gravity type.
9305%
9306%  The format of the MagickSetImageGravity method is:
9307%
9308%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9309%        const GravityType gravity)
9310%
9311%  A description of each parameter follows:
9312%
9313%    o wand: the magick wand.
9314%
9315%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9316%      PlaneInterlace, PartitionInterlace.
9317%
9318*/
9319WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9320  const GravityType gravity)
9321{
9322  assert(wand != (MagickWand *) NULL);
9323  assert(wand->signature == WandSignature);
9324  if (wand->debug != MagickFalse)
9325    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9326  if (wand->images == (Image *) NULL)
9327    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9328  wand->images->gravity=gravity;
9329  return(MagickTrue);
9330}
9331
9332/*
9333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9334%                                                                             %
9335%                                                                             %
9336%                                                                             %
9337%   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                       %
9338%                                                                             %
9339%                                                                             %
9340%                                                                             %
9341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9342%
9343%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9344%  point.
9345%
9346%  The format of the MagickSetImageGreenPrimary method is:
9347%
9348%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9349%        const double x,const double y)
9350%
9351%  A description of each parameter follows:
9352%
9353%    o wand: the magick wand.
9354%
9355%    o x: the green primary x-point.
9356%
9357%    o y: the green primary y-point.
9358%
9359%
9360*/
9361WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9362  const double x,const double y)
9363{
9364  assert(wand != (MagickWand *) NULL);
9365  assert(wand->signature == WandSignature);
9366  if (wand->debug != MagickFalse)
9367    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9368  if (wand->images == (Image *) NULL)
9369    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9370  wand->images->chromaticity.green_primary.x=x;
9371  wand->images->chromaticity.green_primary.y=y;
9372  return(MagickTrue);
9373}
9374
9375/*
9376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9377%                                                                             %
9378%                                                                             %
9379%                                                                             %
9380%   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                 %
9381%                                                                             %
9382%                                                                             %
9383%                                                                             %
9384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9385%
9386%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9387%
9388%  The format of the MagickSetImageInterlaceScheme method is:
9389%
9390%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9391%        const InterlaceType interlace)
9392%
9393%  A description of each parameter follows:
9394%
9395%    o wand: the magick wand.
9396%
9397%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9398%      PlaneInterlace, PartitionInterlace.
9399%
9400*/
9401WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9402  const InterlaceType interlace)
9403{
9404  assert(wand != (MagickWand *) NULL);
9405  assert(wand->signature == WandSignature);
9406  if (wand->debug != MagickFalse)
9407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9408  if (wand->images == (Image *) NULL)
9409    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9410  wand->images->interlace=interlace;
9411  return(MagickTrue);
9412}
9413
9414/*
9415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9416%                                                                             %
9417%                                                                             %
9418%                                                                             %
9419%   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             %
9420%                                                                             %
9421%                                                                             %
9422%                                                                             %
9423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9424%
9425%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9426%
9427%  The format of the MagickSetImageInterpolateMethod method is:
9428%
9429%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9430%        const InterpolatePixelMethod method)
9431%
9432%  A description of each parameter follows:
9433%
9434%    o wand: the magick wand.
9435%
9436%    o method: the image interpole pixel methods: choose from Undefined,
9437%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9438%
9439*/
9440WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9441  const InterpolatePixelMethod method)
9442{
9443  assert(wand != (MagickWand *) NULL);
9444  assert(wand->signature == WandSignature);
9445  if (wand->debug != MagickFalse)
9446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9447  if (wand->images == (Image *) NULL)
9448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9449  wand->images->interpolate=method;
9450  return(MagickTrue);
9451}
9452
9453/*
9454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9455%                                                                             %
9456%                                                                             %
9457%                                                                             %
9458%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9459%                                                                             %
9460%                                                                             %
9461%                                                                             %
9462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9463%
9464%  MagickSetImageIterations() sets the image iterations.
9465%
9466%  The format of the MagickSetImageIterations method is:
9467%
9468%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9469%        const size_t iterations)
9470%
9471%  A description of each parameter follows:
9472%
9473%    o wand: the magick wand.
9474%
9475%    o delay: the image delay in 1/100th of a second.
9476%
9477*/
9478WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9479  const size_t iterations)
9480{
9481  assert(wand != (MagickWand *) NULL);
9482  assert(wand->signature == WandSignature);
9483  if (wand->debug != MagickFalse)
9484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9485  if (wand->images == (Image *) NULL)
9486    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9487  wand->images->iterations=iterations;
9488  return(MagickTrue);
9489}
9490
9491/*
9492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9493%                                                                             %
9494%                                                                             %
9495%                                                                             %
9496%   M a g i c k S e t I m a g e M a t t e                                     %
9497%                                                                             %
9498%                                                                             %
9499%                                                                             %
9500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9501%
9502%  MagickSetImageMatte() sets the image matte channel.
9503%
9504%  The format of the MagickSetImageMatteColor method is:
9505%
9506%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9507%        const MagickBooleanType *matte)
9508%
9509%  A description of each parameter follows:
9510%
9511%    o wand: the magick wand.
9512%
9513%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9514%      MagickFalse.
9515%
9516*/
9517WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9518  const MagickBooleanType matte)
9519{
9520  assert(wand != (MagickWand *) NULL);
9521  assert(wand->signature == WandSignature);
9522  if (wand->debug != MagickFalse)
9523    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9524  if (wand->images == (Image *) NULL)
9525    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9526  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9527    (void) SetImageOpacity(wand->images,OpaqueAlpha);
9528  wand->images->matte=matte;
9529  return(MagickTrue);
9530}
9531
9532/*
9533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9534%                                                                             %
9535%                                                                             %
9536%                                                                             %
9537%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9538%                                                                             %
9539%                                                                             %
9540%                                                                             %
9541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9542%
9543%  MagickSetImageMatteColor() sets the image matte color.
9544%
9545%  The format of the MagickSetImageMatteColor method is:
9546%
9547%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9548%        const PixelWand *matte)
9549%
9550%  A description of each parameter follows:
9551%
9552%    o wand: the magick wand.
9553%
9554%    o matte: the matte pixel wand.
9555%
9556*/
9557WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9558  const PixelWand *matte)
9559{
9560  assert(wand != (MagickWand *) NULL);
9561  assert(wand->signature == WandSignature);
9562  if (wand->debug != MagickFalse)
9563    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9564  if (wand->images == (Image *) NULL)
9565    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9566  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9567  return(MagickTrue);
9568}
9569
9570/*
9571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9572%                                                                             %
9573%                                                                             %
9574%                                                                             %
9575%   M a g i c k S e t I m a g e O p a c i t y                                 %
9576%                                                                             %
9577%                                                                             %
9578%                                                                             %
9579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580%
9581%  MagickSetImageOpacity() sets the image to the specified opacity level.
9582%
9583%  The format of the MagickSetImageOpacity method is:
9584%
9585%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9586%        const double alpha)
9587%
9588%  A description of each parameter follows:
9589%
9590%    o wand: the magick wand.
9591%
9592%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9593%      transparent.
9594%
9595*/
9596WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9597  const double alpha)
9598{
9599  MagickBooleanType
9600    status;
9601
9602  assert(wand != (MagickWand *) NULL);
9603  assert(wand->signature == WandSignature);
9604  if (wand->debug != MagickFalse)
9605    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9606  if (wand->images == (Image *) NULL)
9607    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9608  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9609  if (status == MagickFalse)
9610    InheritException(wand->exception,&wand->images->exception);
9611  return(status);
9612}
9613
9614/*
9615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9616%                                                                             %
9617%                                                                             %
9618%                                                                             %
9619%   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                         %
9620%                                                                             %
9621%                                                                             %
9622%                                                                             %
9623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9624%
9625%  MagickSetImageOrientation() sets the image orientation.
9626%
9627%  The format of the MagickSetImageOrientation method is:
9628%
9629%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9630%        const OrientationType orientation)
9631%
9632%  A description of each parameter follows:
9633%
9634%    o wand: the magick wand.
9635%
9636%    o orientation: the image orientation type.
9637%
9638*/
9639WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9640  const OrientationType orientation)
9641{
9642  assert(wand != (MagickWand *) NULL);
9643  assert(wand->signature == WandSignature);
9644  if (wand->debug != MagickFalse)
9645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9646  if (wand->images == (Image *) NULL)
9647    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9648  wand->images->orientation=orientation;
9649  return(MagickTrue);
9650}
9651
9652/*
9653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9654%                                                                             %
9655%                                                                             %
9656%                                                                             %
9657%   M a g i c k S e t I m a g e P a g e                                       %
9658%                                                                             %
9659%                                                                             %
9660%                                                                             %
9661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9662%
9663%  MagickSetImagePage() sets the page geometry of the image.
9664%
9665%  The format of the MagickSetImagePage method is:
9666%
9667%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9668%        const size_t width,const size_t height,const ssize_t x,
9669%        const ssize_t y)
9670%
9671%  A description of each parameter follows:
9672%
9673%    o wand: the magick wand.
9674%
9675%    o width: the page width.
9676%
9677%    o height: the page height.
9678%
9679%    o x: the page x-offset.
9680%
9681%    o y: the page y-offset.
9682%
9683*/
9684WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9685  const size_t width,const size_t height,const ssize_t x,
9686  const ssize_t y)
9687{
9688  assert(wand != (MagickWand *) NULL);
9689  assert(wand->signature == WandSignature);
9690  if (wand->debug != MagickFalse)
9691    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9692  if (wand->images == (Image *) NULL)
9693    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9694  wand->images->page.width=width;
9695  wand->images->page.height=height;
9696  wand->images->page.x=x;
9697  wand->images->page.y=y;
9698  return(MagickTrue);
9699}
9700
9701/*
9702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9703%                                                                             %
9704%                                                                             %
9705%                                                                             %
9706%   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                 %
9707%                                                                             %
9708%                                                                             %
9709%                                                                             %
9710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9711%
9712%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9713%  specified method and returns the previous progress monitor if any.  The
9714%  progress monitor method looks like this:
9715%
9716%    MagickBooleanType MagickProgressMonitor(const char *text,
9717%      const MagickOffsetType offset,const MagickSizeType span,
9718%      void *client_data)
9719%
9720%  If the progress monitor returns MagickFalse, the current operation is
9721%  interrupted.
9722%
9723%  The format of the MagickSetImageProgressMonitor method is:
9724%
9725%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9726%        const MagickProgressMonitor progress_monitor,void *client_data)
9727%
9728%  A description of each parameter follows:
9729%
9730%    o wand: the magick wand.
9731%
9732%    o progress_monitor: Specifies a pointer to a method to monitor progress
9733%      of an image operation.
9734%
9735%    o client_data: Specifies a pointer to any client data.
9736%
9737*/
9738WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9739  const MagickProgressMonitor progress_monitor,void *client_data)
9740{
9741  MagickProgressMonitor
9742    previous_monitor;
9743
9744  assert(wand != (MagickWand *) NULL);
9745  assert(wand->signature == WandSignature);
9746  if (wand->debug != MagickFalse)
9747    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9748  if (wand->images == (Image *) NULL)
9749    {
9750      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9751        "ContainsNoImages","`%s'",wand->name);
9752      return((MagickProgressMonitor) NULL);
9753    }
9754  previous_monitor=SetImageProgressMonitor(wand->images,
9755    progress_monitor,client_data);
9756  return(previous_monitor);
9757}
9758
9759/*
9760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9761%                                                                             %
9762%                                                                             %
9763%                                                                             %
9764%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9765%                                                                             %
9766%                                                                             %
9767%                                                                             %
9768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769%
9770%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9771%
9772%  The format of the MagickSetImageRedPrimary method is:
9773%
9774%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9775%        const double x,const double y)
9776%
9777%  A description of each parameter follows:
9778%
9779%    o wand: the magick wand.
9780%
9781%    o x: the red primary x-point.
9782%
9783%    o y: the red primary y-point.
9784%
9785*/
9786WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9787  const double x,const double y)
9788{
9789  assert(wand != (MagickWand *) NULL);
9790  assert(wand->signature == WandSignature);
9791  if (wand->debug != MagickFalse)
9792    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9793  if (wand->images == (Image *) NULL)
9794    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9795  wand->images->chromaticity.red_primary.x=x;
9796  wand->images->chromaticity.red_primary.y=y;
9797  return(MagickTrue);
9798}
9799
9800/*
9801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9802%                                                                             %
9803%                                                                             %
9804%                                                                             %
9805%   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                 %
9806%                                                                             %
9807%                                                                             %
9808%                                                                             %
9809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9810%
9811%  MagickSetImageRenderingIntent() sets the image rendering intent.
9812%
9813%  The format of the MagickSetImageRenderingIntent method is:
9814%
9815%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9816%        const RenderingIntent rendering_intent)
9817%
9818%  A description of each parameter follows:
9819%
9820%    o wand: the magick wand.
9821%
9822%    o rendering_intent: the image rendering intent: UndefinedIntent,
9823%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9824%
9825*/
9826WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9827  const RenderingIntent rendering_intent)
9828{
9829  assert(wand != (MagickWand *) NULL);
9830  assert(wand->signature == WandSignature);
9831  if (wand->debug != MagickFalse)
9832    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9833  if (wand->images == (Image *) NULL)
9834    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9835  wand->images->rendering_intent=rendering_intent;
9836  return(MagickTrue);
9837}
9838
9839/*
9840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9841%                                                                             %
9842%                                                                             %
9843%                                                                             %
9844%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9845%                                                                             %
9846%                                                                             %
9847%                                                                             %
9848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9849%
9850%  MagickSetImageResolution() sets the image resolution.
9851%
9852%  The format of the MagickSetImageResolution method is:
9853%
9854%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9855%        const double x_resolution,const doubtl y_resolution)
9856%
9857%  A description of each parameter follows:
9858%
9859%    o wand: the magick wand.
9860%
9861%    o x_resolution: the image x resolution.
9862%
9863%    o y_resolution: the image y resolution.
9864%
9865*/
9866WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9867  const double x_resolution,const double y_resolution)
9868{
9869  assert(wand != (MagickWand *) NULL);
9870  assert(wand->signature == WandSignature);
9871  if (wand->debug != MagickFalse)
9872    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9873  if (wand->images == (Image *) NULL)
9874    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9875  wand->images->x_resolution=x_resolution;
9876  wand->images->y_resolution=y_resolution;
9877  return(MagickTrue);
9878}
9879
9880/*
9881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9882%                                                                             %
9883%                                                                             %
9884%                                                                             %
9885%   M a g i c k S e t I m a g e S c e n e                                     %
9886%                                                                             %
9887%                                                                             %
9888%                                                                             %
9889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9890%
9891%  MagickSetImageScene() sets the image scene.
9892%
9893%  The format of the MagickSetImageScene method is:
9894%
9895%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9896%        const size_t scene)
9897%
9898%  A description of each parameter follows:
9899%
9900%    o wand: the magick wand.
9901%
9902%    o delay: the image scene number.
9903%
9904*/
9905WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9906  const size_t scene)
9907{
9908  assert(wand != (MagickWand *) NULL);
9909  assert(wand->signature == WandSignature);
9910  if (wand->debug != MagickFalse)
9911    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9912  if (wand->images == (Image *) NULL)
9913    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9914  wand->images->scene=scene;
9915  return(MagickTrue);
9916}
9917
9918/*
9919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9920%                                                                             %
9921%                                                                             %
9922%                                                                             %
9923%   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                   %
9924%                                                                             %
9925%                                                                             %
9926%                                                                             %
9927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9928%
9929%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9930%
9931%  The format of the MagickSetImageTicksPerSecond method is:
9932%
9933%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9934%        const ssize_t ticks_per-second)
9935%
9936%  A description of each parameter follows:
9937%
9938%    o wand: the magick wand.
9939%
9940%    o ticks_per_second: the units to use for the image delay.
9941%
9942*/
9943WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9944  const ssize_t ticks_per_second)
9945{
9946  assert(wand != (MagickWand *) NULL);
9947  assert(wand->signature == WandSignature);
9948  if (wand->debug != MagickFalse)
9949    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9950  if (wand->images == (Image *) NULL)
9951    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9952  wand->images->ticks_per_second=ticks_per_second;
9953  return(MagickTrue);
9954}
9955
9956/*
9957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9958%                                                                             %
9959%                                                                             %
9960%                                                                             %
9961%   M a g i c k S e t I m a g e T y p e                                       %
9962%                                                                             %
9963%                                                                             %
9964%                                                                             %
9965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9966%
9967%  MagickSetImageType() sets the image type.
9968%
9969%  The format of the MagickSetImageType method is:
9970%
9971%      MagickBooleanType MagickSetImageType(MagickWand *wand,
9972%        const ImageType image_type)
9973%
9974%  A description of each parameter follows:
9975%
9976%    o wand: the magick wand.
9977%
9978%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
9979%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
9980%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
9981%      or OptimizeType.
9982%
9983*/
9984WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
9985  const ImageType image_type)
9986{
9987  assert(wand != (MagickWand *) NULL);
9988  assert(wand->signature == WandSignature);
9989  if (wand->debug != MagickFalse)
9990    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9991  if (wand->images == (Image *) NULL)
9992    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9993  return(SetImageType(wand->images,image_type,wand->exception));
9994}
9995
9996/*
9997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9998%                                                                             %
9999%                                                                             %
10000%                                                                             %
10001%   M a g i c k S e t I m a g e U n i t s                                     %
10002%                                                                             %
10003%                                                                             %
10004%                                                                             %
10005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10006%
10007%  MagickSetImageUnits() sets the image units of resolution.
10008%
10009%  The format of the MagickSetImageUnits method is:
10010%
10011%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10012%        const ResolutionType units)
10013%
10014%  A description of each parameter follows:
10015%
10016%    o wand: the magick wand.
10017%
10018%    o units: the image units of resolution : UndefinedResolution,
10019%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10020%
10021*/
10022WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10023  const ResolutionType units)
10024{
10025  assert(wand != (MagickWand *) NULL);
10026  assert(wand->signature == WandSignature);
10027  if (wand->debug != MagickFalse)
10028    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10029  if (wand->images == (Image *) NULL)
10030    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10031  wand->images->units=units;
10032  return(MagickTrue);
10033}
10034
10035/*
10036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10037%                                                                             %
10038%                                                                             %
10039%                                                                             %
10040%   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           %
10041%                                                                             %
10042%                                                                             %
10043%                                                                             %
10044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10045%
10046%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10047%
10048%  The format of the MagickSetImageVirtualPixelMethod method is:
10049%
10050%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10051%        const VirtualPixelMethod method)
10052%
10053%  A description of each parameter follows:
10054%
10055%    o wand: the magick wand.
10056%
10057%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10058%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10059%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10060%
10061*/
10062WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10063  const VirtualPixelMethod method)
10064{
10065  assert(wand != (MagickWand *) NULL);
10066  assert(wand->signature == WandSignature);
10067  if (wand->debug != MagickFalse)
10068    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10069  if (wand->images == (Image *) NULL)
10070    return(UndefinedVirtualPixelMethod);
10071  return(SetImageVirtualPixelMethod(wand->images,method));
10072}
10073
10074/*
10075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10076%                                                                             %
10077%                                                                             %
10078%                                                                             %
10079%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10080%                                                                             %
10081%                                                                             %
10082%                                                                             %
10083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10084%
10085%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10086%
10087%  The format of the MagickSetImageWhitePoint method is:
10088%
10089%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10090%        const double x,const double y)
10091%
10092%  A description of each parameter follows:
10093%
10094%    o wand: the magick wand.
10095%
10096%    o x: the white x-point.
10097%
10098%    o y: the white y-point.
10099%
10100*/
10101WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10102  const double x,const double y)
10103{
10104  assert(wand != (MagickWand *) NULL);
10105  assert(wand->signature == WandSignature);
10106  if (wand->debug != MagickFalse)
10107    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10108  if (wand->images == (Image *) NULL)
10109    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10110  wand->images->chromaticity.white_point.x=x;
10111  wand->images->chromaticity.white_point.y=y;
10112  return(MagickTrue);
10113}
10114
10115/*
10116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10117%                                                                             %
10118%                                                                             %
10119%                                                                             %
10120%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10121%                                                                             %
10122%                                                                             %
10123%                                                                             %
10124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10125%
10126%  MagickShadeImage() shines a distant light on an image to create a
10127%  three-dimensional effect. You control the positioning of the light with
10128%  azimuth and elevation; azimuth is measured in degrees off the x axis
10129%  and elevation is measured in pixels above the Z axis.
10130%
10131%  The format of the MagickShadeImage method is:
10132%
10133%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10134%        const MagickBooleanType gray,const double azimuth,
10135%        const double elevation)
10136%
10137%  A description of each parameter follows:
10138%
10139%    o wand: the magick wand.
10140%
10141%    o gray: A value other than zero shades the intensity of each pixel.
10142%
10143%    o azimuth, elevation:  Define the light source direction.
10144%
10145*/
10146WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10147  const MagickBooleanType gray,const double asimuth,const double elevation)
10148{
10149  Image
10150    *shade_image;
10151
10152  assert(wand != (MagickWand *) NULL);
10153  assert(wand->signature == WandSignature);
10154  if (wand->debug != MagickFalse)
10155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10156  if (wand->images == (Image *) NULL)
10157    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10158  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10159  if (shade_image == (Image *) NULL)
10160    return(MagickFalse);
10161  ReplaceImageInList(&wand->images,shade_image);
10162  return(MagickTrue);
10163}
10164
10165/*
10166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10167%                                                                             %
10168%                                                                             %
10169%                                                                             %
10170%   M a g i c k S h a d o w I m a g e                                         %
10171%                                                                             %
10172%                                                                             %
10173%                                                                             %
10174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10175%
10176%  MagickShadowImage() simulates an image shadow.
10177%
10178%  The format of the MagickShadowImage method is:
10179%
10180%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10181%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10182%
10183%  A description of each parameter follows:
10184%
10185%    o wand: the magick wand.
10186%
10187%    o opacity: percentage transparency.
10188%
10189%    o sigma: the standard deviation of the Gaussian, in pixels.
10190%
10191%    o x: the shadow x-offset.
10192%
10193%    o y: the shadow y-offset.
10194%
10195*/
10196WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10197  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10198{
10199  Image
10200    *shadow_image;
10201
10202  assert(wand != (MagickWand *) NULL);
10203  assert(wand->signature == WandSignature);
10204  if (wand->debug != MagickFalse)
10205    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10206  if (wand->images == (Image *) NULL)
10207    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10208  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10209  if (shadow_image == (Image *) NULL)
10210    return(MagickFalse);
10211  ReplaceImageInList(&wand->images,shadow_image);
10212  return(MagickTrue);
10213}
10214
10215/*
10216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10217%                                                                             %
10218%                                                                             %
10219%                                                                             %
10220%   M a g i c k S h a r p e n I m a g e                                       %
10221%                                                                             %
10222%                                                                             %
10223%                                                                             %
10224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10225%
10226%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10227%  Gaussian operator of the given radius and standard deviation (sigma).
10228%  For reasonable results, the radius should be larger than sigma.  Use a
10229%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10230%
10231%  The format of the MagickSharpenImage method is:
10232%
10233%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10234%        const double radius,const double sigma,const double bias)
10235%
10236%  A description of each parameter follows:
10237%
10238%    o wand: the magick wand.
10239%
10240%    o radius: the radius of the Gaussian, in pixels, not counting the center
10241%      pixel.
10242%
10243%    o sigma: the standard deviation of the Gaussian, in pixels.
10244%
10245%    o bias: the bias.
10246%
10247*/
10248WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10249  const double radius,const double sigma,const double bias)
10250{
10251  Image
10252    *sharp_image;
10253
10254  assert(wand != (MagickWand *) NULL);
10255  assert(wand->signature == WandSignature);
10256  if (wand->debug != MagickFalse)
10257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10258  if (wand->images == (Image *) NULL)
10259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10260  sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10261  if (sharp_image == (Image *) NULL)
10262    return(MagickFalse);
10263  ReplaceImageInList(&wand->images,sharp_image);
10264  return(MagickTrue);
10265}
10266
10267/*
10268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10269%                                                                             %
10270%                                                                             %
10271%                                                                             %
10272%   M a g i c k S h a v e I m a g e                                           %
10273%                                                                             %
10274%                                                                             %
10275%                                                                             %
10276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10277%
10278%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10279%  memory necessary for the new Image structure and returns a pointer to the
10280%  new image.
10281%
10282%  The format of the MagickShaveImage method is:
10283%
10284%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10285%        const size_t columns,const size_t rows)
10286%
10287%  A description of each parameter follows:
10288%
10289%    o wand: the magick wand.
10290%
10291%    o columns: the number of columns in the scaled image.
10292%
10293%    o rows: the number of rows in the scaled image.
10294%
10295%
10296*/
10297WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10298  const size_t columns,const size_t rows)
10299{
10300  Image
10301    *shave_image;
10302
10303  RectangleInfo
10304    shave_info;
10305
10306  assert(wand != (MagickWand *) NULL);
10307  assert(wand->signature == WandSignature);
10308  if (wand->debug != MagickFalse)
10309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10310  if (wand->images == (Image *) NULL)
10311    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10312  shave_info.width=columns;
10313  shave_info.height=rows;
10314  shave_info.x=0;
10315  shave_info.y=0;
10316  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10317  if (shave_image == (Image *) NULL)
10318    return(MagickFalse);
10319  ReplaceImageInList(&wand->images,shave_image);
10320  return(MagickTrue);
10321}
10322
10323/*
10324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10325%                                                                             %
10326%                                                                             %
10327%                                                                             %
10328%   M a g i c k S h e a r I m a g e                                           %
10329%                                                                             %
10330%                                                                             %
10331%                                                                             %
10332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10333%
10334%  MagickShearImage() slides one edge of an image along the X or Y axis,
10335%  creating a parallelogram.  An X direction shear slides an edge along the X
10336%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10337%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10338%  is measured relative to the Y axis, and similarly, for Y direction shears
10339%  y_shear is measured relative to the X axis.  Empty triangles left over from
10340%  shearing the image are filled with the background color.
10341%
10342%  The format of the MagickShearImage method is:
10343%
10344%      MagickBooleanType MagickShearImage(MagickWand *wand,
10345%        const PixelWand *background,const double x_shear,onst double y_shear)
10346%
10347%  A description of each parameter follows:
10348%
10349%    o wand: the magick wand.
10350%
10351%    o background: the background pixel wand.
10352%
10353%    o x_shear: the number of degrees to shear the image.
10354%
10355%    o y_shear: the number of degrees to shear the image.
10356%
10357*/
10358WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10359  const PixelWand *background,const double x_shear,const double y_shear)
10360{
10361  Image
10362    *shear_image;
10363
10364  assert(wand != (MagickWand *) NULL);
10365  assert(wand->signature == WandSignature);
10366  if (wand->debug != MagickFalse)
10367    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10368  if (wand->images == (Image *) NULL)
10369    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10370  PixelGetQuantumPacket(background,&wand->images->background_color);
10371  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10372  if (shear_image == (Image *) NULL)
10373    return(MagickFalse);
10374  ReplaceImageInList(&wand->images,shear_image);
10375  return(MagickTrue);
10376}
10377
10378/*
10379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10380%                                                                             %
10381%                                                                             %
10382%                                                                             %
10383%   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                   %
10384%                                                                             %
10385%                                                                             %
10386%                                                                             %
10387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10388%
10389%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10390%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10391%  image using a sigmoidal transfer function without saturating highlights or
10392%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10393%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10394%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10395%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10396%  is reduced.
10397%
10398%  The format of the MagickSigmoidalContrastImage method is:
10399%
10400%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10401%        const MagickBooleanType sharpen,const double alpha,const double beta)
10402%
10403%  A description of each parameter follows:
10404%
10405%    o wand: the magick wand.
10406%
10407%    o sharpen: Increase or decrease image contrast.
10408%
10409%    o alpha: strength of the contrast, the larger the number the more
10410%      'threshold-like' it becomes.
10411%
10412%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10413%
10414*/
10415WandExport MagickBooleanType MagickSigmoidalContrastImage(
10416  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10417  const double beta)
10418{
10419  MagickBooleanType
10420    status;
10421
10422  assert(wand != (MagickWand *) NULL);
10423  assert(wand->signature == WandSignature);
10424  if (wand->debug != MagickFalse)
10425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10426  if (wand->images == (Image *) NULL)
10427    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10428  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10429    &wand->images->exception);
10430  return(status);
10431}
10432
10433/*
10434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10435%                                                                             %
10436%                                                                             %
10437%                                                                             %
10438%   M a g i c k S i m i l a r i t y I m a g e                                 %
10439%                                                                             %
10440%                                                                             %
10441%                                                                             %
10442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10443%
10444%  MagickSimilarityImage() compares the reference image of the image and
10445%  returns the best match offset.  In addition, it returns a similarity image
10446%  such that an exact match location is completely white and if none of the
10447%  pixels match, black, otherwise some gray level in-between.
10448%
10449%  The format of the MagickSimilarityImage method is:
10450%
10451%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10452%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10453%
10454%  A description of each parameter follows:
10455%
10456%    o wand: the magick wand.
10457%
10458%    o reference: the reference wand.
10459%
10460%    o offset: the best match offset of the reference image within the image.
10461%
10462%    o similarity: the computed similarity between the images.
10463%
10464*/
10465WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10466  const MagickWand *reference,RectangleInfo *offset,double *similarity)
10467{
10468  Image
10469    *similarity_image;
10470
10471  assert(wand != (MagickWand *) NULL);
10472  assert(wand->signature == WandSignature);
10473  if (wand->debug != MagickFalse)
10474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10475  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10476    {
10477      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10478        "ContainsNoImages","`%s'",wand->name);
10479      return((MagickWand *) NULL);
10480    }
10481  similarity_image=SimilarityImage(wand->images,reference->images,offset,
10482    similarity,&wand->images->exception);
10483  if (similarity_image == (Image *) NULL)
10484    return((MagickWand *) NULL);
10485  return(CloneMagickWandFromImages(wand,similarity_image));
10486}
10487
10488/*
10489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10490%                                                                             %
10491%                                                                             %
10492%                                                                             %
10493%   M a g i c k S k e t c h I m a g e                                         %
10494%                                                                             %
10495%                                                                             %
10496%                                                                             %
10497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10498%
10499%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10500%  a Gaussian operator of the given radius and standard deviation (sigma).
10501%  For reasonable results, radius should be larger than sigma.  Use a
10502%  radius of 0 and SketchImage() selects a suitable radius for you.
10503%  Angle gives the angle of the blurring motion.
10504%
10505%  The format of the MagickSketchImage method is:
10506%
10507%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10508%        const double radius,const double sigma,const double angle,
10509%        const double bias)
10510%
10511%  A description of each parameter follows:
10512%
10513%    o wand: the magick wand.
10514%
10515%    o radius: the radius of the Gaussian, in pixels, not counting
10516%      the center pixel.
10517%
10518%    o sigma: the standard deviation of the Gaussian, in pixels.
10519%
10520%    o angle: apply the effect along this angle.
10521%
10522%    o bias: the bias.
10523%
10524*/
10525WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10526  const double radius,const double sigma,const double angle,const double bias)
10527{
10528  Image
10529    *sketch_image;
10530
10531  assert(wand != (MagickWand *) NULL);
10532  assert(wand->signature == WandSignature);
10533  if (wand->debug != MagickFalse)
10534    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10535  if (wand->images == (Image *) NULL)
10536    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10537  sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10538    wand->exception);
10539  if (sketch_image == (Image *) NULL)
10540    return(MagickFalse);
10541  ReplaceImageInList(&wand->images,sketch_image);
10542  return(MagickTrue);
10543}
10544
10545/*
10546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10547%                                                                             %
10548%                                                                             %
10549%                                                                             %
10550%   M a g i c k S m u s h I m a g e s                                         %
10551%                                                                             %
10552%                                                                             %
10553%                                                                             %
10554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10555%
10556%  MagickSmushImages() takes all images from the current image pointer to the
10557%  end of the image list and smushs them to each other top-to-bottom if the
10558%  stack parameter is true, otherwise left-to-right.
10559%
10560%  The format of the MagickSmushImages method is:
10561%
10562%      MagickWand *MagickSmushImages(MagickWand *wand,
10563%        const MagickBooleanType stack,const ssize_t offset)
10564%
10565%  A description of each parameter follows:
10566%
10567%    o wand: the magick wand.
10568%
10569%    o stack: By default, images are stacked left-to-right. Set stack to
10570%      MagickTrue to stack them top-to-bottom.
10571%
10572%    o offset: minimum distance in pixels between images.
10573%
10574*/
10575WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10576  const MagickBooleanType stack,const ssize_t offset)
10577{
10578  Image
10579    *smush_image;
10580
10581  assert(wand != (MagickWand *) NULL);
10582  assert(wand->signature == WandSignature);
10583  if (wand->debug != MagickFalse)
10584    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10585  if (wand->images == (Image *) NULL)
10586    return((MagickWand *) NULL);
10587  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10588  if (smush_image == (Image *) NULL)
10589    return((MagickWand *) NULL);
10590  return(CloneMagickWandFromImages(wand,smush_image));
10591}
10592
10593/*
10594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10595%                                                                             %
10596%                                                                             %
10597%                                                                             %
10598%     M a g i c k S o l a r i z e I m a g e                                   %
10599%                                                                             %
10600%                                                                             %
10601%                                                                             %
10602%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10603%
10604%  MagickSolarizeImage() applies a special effect to the image, similar to the
10605%  effect achieved in a photo darkroom by selectively exposing areas of photo
10606%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10607%  measure of the extent of the solarization.
10608%
10609%  The format of the MagickSolarizeImage method is:
10610%
10611%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10612%        const double threshold)
10613%
10614%  A description of each parameter follows:
10615%
10616%    o wand: the magick wand.
10617%
10618%    o threshold:  Define the extent of the solarization.
10619%
10620*/
10621WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10622  const double threshold)
10623{
10624  MagickBooleanType
10625    status;
10626
10627  assert(wand != (MagickWand *) NULL);
10628  assert(wand->signature == WandSignature);
10629  if (wand->debug != MagickFalse)
10630    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10631  if (wand->images == (Image *) NULL)
10632    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10633  status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10634  return(status);
10635}
10636
10637/*
10638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10639%                                                                             %
10640%                                                                             %
10641%                                                                             %
10642%   M a g i c k S p a r s e C o l o r I m a g e                               %
10643%                                                                             %
10644%                                                                             %
10645%                                                                             %
10646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10647%
10648%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10649%  colors found at those coordinates, across the whole image, using various
10650%  methods.
10651%
10652%  The format of the MagickSparseColorImage method is:
10653%
10654%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10655%        const SparseColorMethod method,const size_t number_arguments,
10656%        const double *arguments)
10657%
10658%  A description of each parameter follows:
10659%
10660%    o image: the image to be sparseed.
10661%
10662%    o method: the method of image sparseion.
10663%
10664%        ArcSparseColorion will always ignore source image offset, and always
10665%        'bestfit' the destination image with the top left corner offset
10666%        relative to the polar mapping center.
10667%
10668%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10669%        style of image sparseion.
10670%
10671%        Affine, Perspective, and Bilinear, will do least squares fitting of
10672%        the distrotion when more than the minimum number of control point
10673%        pairs are provided.
10674%
10675%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10676%        less than 4 control point pairs are provided. While Affine sparseions
10677%        will let you use any number of control point pairs, that is Zero pairs
10678%        is a No-Op (viewport only) distrotion, one pair is a translation and
10679%        two pairs of control points will do a scale-rotate-translate, without
10680%        any shearing.
10681%
10682%    o number_arguments: the number of arguments given for this sparseion
10683%      method.
10684%
10685%    o arguments: the arguments for this sparseion method.
10686%
10687*/
10688WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10689  const SparseColorMethod method,const size_t number_arguments,
10690  const double *arguments)
10691{
10692  Image
10693    *sparse_image;
10694
10695  assert(wand != (MagickWand *) NULL);
10696  assert(wand->signature == WandSignature);
10697  if (wand->debug != MagickFalse)
10698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10699  if (wand->images == (Image *) NULL)
10700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10701  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10702    wand->exception);
10703  if (sparse_image == (Image *) NULL)
10704    return(MagickFalse);
10705  ReplaceImageInList(&wand->images,sparse_image);
10706  return(MagickTrue);
10707}
10708
10709/*
10710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10711%                                                                             %
10712%                                                                             %
10713%                                                                             %
10714%   M a g i c k S p l i c e I m a g e                                         %
10715%                                                                             %
10716%                                                                             %
10717%                                                                             %
10718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10719%
10720%  MagickSpliceImage() splices a solid color into the image.
10721%
10722%  The format of the MagickSpliceImage method is:
10723%
10724%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10725%        const size_t width,const size_t height,const ssize_t x,
10726%        const ssize_t y)
10727%
10728%  A description of each parameter follows:
10729%
10730%    o wand: the magick wand.
10731%
10732%    o width: the region width.
10733%
10734%    o height: the region height.
10735%
10736%    o x: the region x offset.
10737%
10738%    o y: the region y offset.
10739%
10740*/
10741WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10742  const size_t width,const size_t height,const ssize_t x,
10743  const ssize_t y)
10744{
10745  Image
10746    *splice_image;
10747
10748  RectangleInfo
10749    splice;
10750
10751  assert(wand != (MagickWand *) NULL);
10752  assert(wand->signature == WandSignature);
10753  if (wand->debug != MagickFalse)
10754    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10755  if (wand->images == (Image *) NULL)
10756    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10757  splice.width=width;
10758  splice.height=height;
10759  splice.x=x;
10760  splice.y=y;
10761  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10762  if (splice_image == (Image *) NULL)
10763    return(MagickFalse);
10764  ReplaceImageInList(&wand->images,splice_image);
10765  return(MagickTrue);
10766}
10767
10768/*
10769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10770%                                                                             %
10771%                                                                             %
10772%                                                                             %
10773%   M a g i c k S p r e a d I m a g e                                         %
10774%                                                                             %
10775%                                                                             %
10776%                                                                             %
10777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10778%
10779%  MagickSpreadImage() is a special effects method that randomly displaces each
10780%  pixel in a block defined by the radius parameter.
10781%
10782%  The format of the MagickSpreadImage method is:
10783%
10784%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10785%
10786%  A description of each parameter follows:
10787%
10788%    o wand: the magick wand.
10789%
10790%    o radius:  Choose a random pixel in a neighborhood of this extent.
10791%
10792*/
10793WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10794  const double radius)
10795{
10796  Image
10797    *spread_image;
10798
10799  assert(wand != (MagickWand *) NULL);
10800  assert(wand->signature == WandSignature);
10801  if (wand->debug != MagickFalse)
10802    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10803  if (wand->images == (Image *) NULL)
10804    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10805  spread_image=SpreadImage(wand->images,radius,wand->exception);
10806  if (spread_image == (Image *) NULL)
10807    return(MagickFalse);
10808  ReplaceImageInList(&wand->images,spread_image);
10809  return(MagickTrue);
10810}
10811
10812/*
10813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10814%                                                                             %
10815%                                                                             %
10816%                                                                             %
10817%   M a g i c k S t a t i s t i c I m a g e                                   %
10818%                                                                             %
10819%                                                                             %
10820%                                                                             %
10821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10822%
10823%  MagickStatisticImage() replace each pixel with corresponding statistic from
10824%  the neighborhood of the specified width and height.
10825%
10826%  The format of the MagickStatisticImage method is:
10827%
10828%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10829%        const StatisticType type,const double width,const size_t height)
10830%
10831%  A description of each parameter follows:
10832%
10833%    o wand: the magick wand.
10834%
10835%    o type: the statistic type (e.g. median, mode, etc.).
10836%
10837%    o width: the width of the pixel neighborhood.
10838%
10839%    o height: the height of the pixel neighborhood.
10840%
10841*/
10842WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10843  const StatisticType type,const size_t width,const size_t height)
10844{
10845  Image
10846    *statistic_image;
10847
10848  assert(wand != (MagickWand *) NULL);
10849  assert(wand->signature == WandSignature);
10850  if (wand->debug != MagickFalse)
10851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10852  if (wand->images == (Image *) NULL)
10853    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10854  statistic_image=StatisticImage(wand->images,type,width,height,
10855    wand->exception);
10856  if (statistic_image == (Image *) NULL)
10857    return(MagickFalse);
10858  ReplaceImageInList(&wand->images,statistic_image);
10859  return(MagickTrue);
10860}
10861
10862/*
10863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10864%                                                                             %
10865%                                                                             %
10866%                                                                             %
10867%   M a g i c k S t e g a n o I m a g e                                       %
10868%                                                                             %
10869%                                                                             %
10870%                                                                             %
10871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10872%
10873%  MagickSteganoImage() hides a digital watermark within the image.
10874%  Recover the hidden watermark later to prove that the authenticity of
10875%  an image.  Offset defines the start position within the image to hide
10876%  the watermark.
10877%
10878%  The format of the MagickSteganoImage method is:
10879%
10880%      MagickWand *MagickSteganoImage(MagickWand *wand,
10881%        const MagickWand *watermark_wand,const ssize_t offset)
10882%
10883%  A description of each parameter follows:
10884%
10885%    o wand: the magick wand.
10886%
10887%    o watermark_wand: the watermark wand.
10888%
10889%    o offset: Start hiding at this offset into the image.
10890%
10891*/
10892WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10893  const MagickWand *watermark_wand,const ssize_t offset)
10894{
10895  Image
10896    *stegano_image;
10897
10898  assert(wand != (MagickWand *) NULL);
10899  assert(wand->signature == WandSignature);
10900  if (wand->debug != MagickFalse)
10901    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10902  if ((wand->images == (Image *) NULL) ||
10903      (watermark_wand->images == (Image *) NULL))
10904    {
10905      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10906        "ContainsNoImages","`%s'",wand->name);
10907      return((MagickWand *) NULL);
10908    }
10909  wand->images->offset=offset;
10910  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10911    wand->exception);
10912  if (stegano_image == (Image *) NULL)
10913    return((MagickWand *) NULL);
10914  return(CloneMagickWandFromImages(wand,stegano_image));
10915}
10916
10917/*
10918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10919%                                                                             %
10920%                                                                             %
10921%                                                                             %
10922%   M a g i c k S t e r e o I m a g e                                         %
10923%                                                                             %
10924%                                                                             %
10925%                                                                             %
10926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10927%
10928%  MagickStereoImage() composites two images and produces a single image that
10929%  is the composite of a left and right image of a stereo pair
10930%
10931%  The format of the MagickStereoImage method is:
10932%
10933%      MagickWand *MagickStereoImage(MagickWand *wand,
10934%        const MagickWand *offset_wand)
10935%
10936%  A description of each parameter follows:
10937%
10938%    o wand: the magick wand.
10939%
10940%    o offset_wand: Another image wand.
10941%
10942*/
10943WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10944  const MagickWand *offset_wand)
10945{
10946  Image
10947    *stereo_image;
10948
10949  assert(wand != (MagickWand *) NULL);
10950  assert(wand->signature == WandSignature);
10951  if (wand->debug != MagickFalse)
10952    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10953  if ((wand->images == (Image *) NULL) ||
10954      (offset_wand->images == (Image *) NULL))
10955    {
10956      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10957        "ContainsNoImages","`%s'",wand->name);
10958      return((MagickWand *) NULL);
10959    }
10960  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10961  if (stereo_image == (Image *) NULL)
10962    return((MagickWand *) NULL);
10963  return(CloneMagickWandFromImages(wand,stereo_image));
10964}
10965
10966/*
10967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10968%                                                                             %
10969%                                                                             %
10970%                                                                             %
10971%   M a g i c k S t r i p I m a g e                                           %
10972%                                                                             %
10973%                                                                             %
10974%                                                                             %
10975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10976%
10977%  MagickStripImage() strips an image of all profiles and comments.
10978%
10979%  The format of the MagickStripImage method is:
10980%
10981%      MagickBooleanType MagickStripImage(MagickWand *wand)
10982%
10983%  A description of each parameter follows:
10984%
10985%    o wand: the magick wand.
10986%
10987*/
10988WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
10989{
10990  MagickBooleanType
10991    status;
10992
10993  assert(wand != (MagickWand *) NULL);
10994  assert(wand->signature == WandSignature);
10995  if (wand->debug != MagickFalse)
10996    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10997  if (wand->images == (Image *) NULL)
10998    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10999  status=StripImage(wand->images);
11000  if (status == MagickFalse)
11001    InheritException(wand->exception,&wand->images->exception);
11002  return(status);
11003}
11004
11005/*
11006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11007%                                                                             %
11008%                                                                             %
11009%                                                                             %
11010%   M a g i c k S w i r l I m a g e                                           %
11011%                                                                             %
11012%                                                                             %
11013%                                                                             %
11014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11015%
11016%  MagickSwirlImage() swirls the pixels about the center of the image, where
11017%  degrees indicates the sweep of the arc through which each pixel is moved.
11018%  You get a more dramatic effect as the degrees move from 1 to 360.
11019%
11020%  The format of the MagickSwirlImage method is:
11021%
11022%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11023%
11024%  A description of each parameter follows:
11025%
11026%    o wand: the magick wand.
11027%
11028%    o degrees: Define the tightness of the swirling effect.
11029%
11030*/
11031WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11032  const double degrees)
11033{
11034  Image
11035    *swirl_image;
11036
11037  assert(wand != (MagickWand *) NULL);
11038  assert(wand->signature == WandSignature);
11039  if (wand->debug != MagickFalse)
11040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11041  if (wand->images == (Image *) NULL)
11042    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11043  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11044  if (swirl_image == (Image *) NULL)
11045    return(MagickFalse);
11046  ReplaceImageInList(&wand->images,swirl_image);
11047  return(MagickTrue);
11048}
11049
11050/*
11051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11052%                                                                             %
11053%                                                                             %
11054%                                                                             %
11055%   M a g i c k T e x t u r e I m a g e                                       %
11056%                                                                             %
11057%                                                                             %
11058%                                                                             %
11059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11060%
11061%  MagickTextureImage() repeatedly tiles the texture image across and down the
11062%  image canvas.
11063%
11064%  The format of the MagickTextureImage method is:
11065%
11066%      MagickWand *MagickTextureImage(MagickWand *wand,
11067%        const MagickWand *texture_wand)
11068%
11069%  A description of each parameter follows:
11070%
11071%    o wand: the magick wand.
11072%
11073%    o texture_wand: the texture wand
11074%
11075*/
11076WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11077  const MagickWand *texture_wand)
11078{
11079  Image
11080    *texture_image;
11081
11082  MagickBooleanType
11083    status;
11084
11085  assert(wand != (MagickWand *) NULL);
11086  assert(wand->signature == WandSignature);
11087  if (wand->debug != MagickFalse)
11088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11089  if ((wand->images == (Image *) NULL) ||
11090      (texture_wand->images == (Image *) NULL))
11091    {
11092      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11093        "ContainsNoImages","`%s'",wand->name);
11094      return((MagickWand *) NULL);
11095    }
11096  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11097  if (texture_image == (Image *) NULL)
11098    return((MagickWand *) NULL);
11099  status=TextureImage(texture_image,texture_wand->images);
11100  if (status == MagickFalse)
11101    {
11102      InheritException(wand->exception,&texture_image->exception);
11103      texture_image=DestroyImage(texture_image);
11104      return((MagickWand *) NULL);
11105    }
11106  return(CloneMagickWandFromImages(wand,texture_image));
11107}
11108
11109/*
11110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11111%                                                                             %
11112%                                                                             %
11113%                                                                             %
11114%   M a g i c k T h r e s h o l d I m a g e                                   %
11115%                                                                             %
11116%                                                                             %
11117%                                                                             %
11118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11119%
11120%  MagickThresholdImage() changes the value of individual pixels based on
11121%  the intensity of each pixel compared to threshold.  The result is a
11122%  high-contrast, two color image.
11123%
11124%  The format of the MagickThresholdImage method is:
11125%
11126%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11127%        const double threshold)
11128%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11129%        const ChannelType channel,const double threshold)
11130%
11131%  A description of each parameter follows:
11132%
11133%    o wand: the magick wand.
11134%
11135%    o channel: the image channel(s).
11136%
11137%    o threshold: Define the threshold value.
11138%
11139*/
11140WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11141  const double threshold)
11142{
11143  MagickBooleanType
11144    status;
11145
11146  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11147  return(status);
11148}
11149
11150WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11151  const ChannelType channel,const double threshold)
11152{
11153  MagickBooleanType
11154    status;
11155
11156  assert(wand != (MagickWand *) NULL);
11157  assert(wand->signature == WandSignature);
11158  if (wand->debug != MagickFalse)
11159    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11160  if (wand->images == (Image *) NULL)
11161    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11162  status=BilevelImage(wand->images,threshold);
11163  if (status == MagickFalse)
11164    InheritException(wand->exception,&wand->images->exception);
11165  return(status);
11166}
11167
11168/*
11169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11170%                                                                             %
11171%                                                                             %
11172%                                                                             %
11173%   M a g i c k T h u m b n a i l I m a g e                                   %
11174%                                                                             %
11175%                                                                             %
11176%                                                                             %
11177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11178%
11179%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11180%  and removes any associated profiles.  The goal is to produce small low cost
11181%  thumbnail images suited for display on the Web.
11182%
11183%  The format of the MagickThumbnailImage method is:
11184%
11185%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11186%        const size_t columns,const size_t rows)
11187%
11188%  A description of each parameter follows:
11189%
11190%    o wand: the magick wand.
11191%
11192%    o columns: the number of columns in the scaled image.
11193%
11194%    o rows: the number of rows in the scaled image.
11195%
11196*/
11197WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11198  const size_t columns,const size_t rows)
11199{
11200  Image
11201    *thumbnail_image;
11202
11203  assert(wand != (MagickWand *) NULL);
11204  assert(wand->signature == WandSignature);
11205  if (wand->debug != MagickFalse)
11206    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11207  if (wand->images == (Image *) NULL)
11208    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11209  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11210  if (thumbnail_image == (Image *) NULL)
11211    return(MagickFalse);
11212  ReplaceImageInList(&wand->images,thumbnail_image);
11213  return(MagickTrue);
11214}
11215
11216/*
11217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11218%                                                                             %
11219%                                                                             %
11220%                                                                             %
11221%   M a g i c k T i n t I m a g e                                             %
11222%                                                                             %
11223%                                                                             %
11224%                                                                             %
11225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11226%
11227%  MagickTintImage() applies a color vector to each pixel in the image.  The
11228%  length of the vector is 0 for black and white and at its maximum for the
11229%  midtones.  The vector weighting function is
11230%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11231%
11232%  The format of the MagickTintImage method is:
11233%
11234%      MagickBooleanType MagickTintImage(MagickWand *wand,
11235%        const PixelWand *tint,const PixelWand *opacity)
11236%
11237%  A description of each parameter follows:
11238%
11239%    o wand: the magick wand.
11240%
11241%    o tint: the tint pixel wand.
11242%
11243%    o opacity: the opacity pixel wand.
11244%
11245*/
11246WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11247  const PixelWand *tint,const PixelWand *opacity)
11248{
11249  char
11250    percent_opaque[MaxTextExtent];
11251
11252  Image
11253    *tint_image;
11254
11255  PixelPacket
11256    target;
11257
11258  assert(wand != (MagickWand *) NULL);
11259  assert(wand->signature == WandSignature);
11260  if (wand->debug != MagickFalse)
11261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11262  if (wand->images == (Image *) NULL)
11263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11264  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11265    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11266    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11267    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11268    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11269    PixelGetOpacityQuantum(opacity)));
11270  PixelGetQuantumPacket(tint,&target);
11271  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11272  if (tint_image == (Image *) NULL)
11273    return(MagickFalse);
11274  ReplaceImageInList(&wand->images,tint_image);
11275  return(MagickTrue);
11276}
11277
11278/*
11279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11280%                                                                             %
11281%                                                                             %
11282%                                                                             %
11283%   M a g i c k T r a n s f o r m I m a g e                                   %
11284%                                                                             %
11285%                                                                             %
11286%                                                                             %
11287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11288%
11289%  MagickTransformImage() is a convenience method that behaves like
11290%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11291%  information as a region geometry specification.  If the operation fails,
11292%  a NULL image handle is returned.
11293%
11294%  The format of the MagickTransformImage method is:
11295%
11296%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11297%        const char *geometry)
11298%
11299%  A description of each parameter follows:
11300%
11301%    o wand: the magick wand.
11302%
11303%    o crop: A crop geometry string.  This geometry defines a subregion of the
11304%      image to crop.
11305%
11306%    o geometry: An image geometry string.  This geometry defines the final
11307%      size of the image.
11308%
11309*/
11310WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11311  const char *crop,const char *geometry)
11312{
11313  Image
11314    *transform_image;
11315
11316  MagickBooleanType
11317    status;
11318
11319  assert(wand != (MagickWand *) NULL);
11320  assert(wand->signature == WandSignature);
11321  if (wand->debug != MagickFalse)
11322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11323  if (wand->images == (Image *) NULL)
11324    return((MagickWand *) NULL);
11325  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11326  if (transform_image == (Image *) NULL)
11327    return((MagickWand *) NULL);
11328  status=TransformImage(&transform_image,crop,geometry);
11329  if (status == MagickFalse)
11330    {
11331      InheritException(wand->exception,&transform_image->exception);
11332      transform_image=DestroyImage(transform_image);
11333      return((MagickWand *) NULL);
11334    }
11335  return(CloneMagickWandFromImages(wand,transform_image));
11336}
11337
11338/*
11339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11340%                                                                             %
11341%                                                                             %
11342%                                                                             %
11343%   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               %
11344%                                                                             %
11345%                                                                             %
11346%                                                                             %
11347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11348%
11349%  MagickTransformImageColorspace() transform the image colorspace.
11350%
11351%  The format of the MagickTransformImageColorspace method is:
11352%
11353%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11354%        const ColorspaceType colorspace)
11355%
11356%  A description of each parameter follows:
11357%
11358%    o wand: the magick wand.
11359%
11360%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11361%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11362%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11363%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11364%      HSLColorspace, or HWBColorspace.
11365%
11366*/
11367WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11368  const ColorspaceType colorspace)
11369{
11370  assert(wand != (MagickWand *) NULL);
11371  assert(wand->signature == WandSignature);
11372  if (wand->debug != MagickFalse)
11373    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11374  if (wand->images == (Image *) NULL)
11375    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11376  return(TransformImageColorspace(wand->images,colorspace));
11377}
11378
11379/*
11380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11381%                                                                             %
11382%                                                                             %
11383%                                                                             %
11384%   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                     %
11385%                                                                             %
11386%                                                                             %
11387%                                                                             %
11388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11389%
11390%  MagickTransparentPaintImage() changes any pixel that matches color with the
11391%  color defined by fill.
11392%
11393%  The format of the MagickTransparentPaintImage method is:
11394%
11395%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11396%        const PixelWand *target,const double alpha,const double fuzz,
11397%        const MagickBooleanType invert)
11398%
11399%  A description of each parameter follows:
11400%
11401%    o wand: the magick wand.
11402%
11403%    o target: Change this target color to specified opacity value within
11404%      the image.
11405%
11406%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11407%      transparent.
11408%
11409%    o fuzz: By default target must match a particular pixel color
11410%      exactly.  However, in many cases two colors may differ by a small amount.
11411%      The fuzz member of image defines how much tolerance is acceptable to
11412%      consider two colors as the same.  For example, set fuzz to 10 and the
11413%      color red at intensities of 100 and 102 respectively are now interpreted
11414%      as the same color for the purposes of the floodfill.
11415%
11416%    o invert: paint any pixel that does not match the target color.
11417%
11418*/
11419WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11420  const PixelWand *target,const double alpha,const double fuzz,
11421  const MagickBooleanType invert)
11422{
11423  MagickBooleanType
11424    status;
11425
11426  PixelInfo
11427    target_pixel;
11428
11429  assert(wand != (MagickWand *) NULL);
11430  assert(wand->signature == WandSignature);
11431  if (wand->debug != MagickFalse)
11432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11433  if (wand->images == (Image *) NULL)
11434    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11435  PixelGetMagickColor(target,&target_pixel);
11436  wand->images->fuzz=fuzz;
11437  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11438    QuantumRange*alpha),invert,&wand->images->exception);
11439  return(status);
11440}
11441
11442/*
11443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11444%                                                                             %
11445%                                                                             %
11446%                                                                             %
11447%   M a g i c k T r a n s p o s e I m a g e                                   %
11448%                                                                             %
11449%                                                                             %
11450%                                                                             %
11451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11452%
11453%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11454%  pixels around the central x-axis while rotating them 90-degrees.
11455%
11456%  The format of the MagickTransposeImage method is:
11457%
11458%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11459%
11460%  A description of each parameter follows:
11461%
11462%    o wand: the magick wand.
11463%
11464*/
11465WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11466{
11467  Image
11468    *transpose_image;
11469
11470  assert(wand != (MagickWand *) NULL);
11471  assert(wand->signature == WandSignature);
11472  if (wand->debug != MagickFalse)
11473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11474  if (wand->images == (Image *) NULL)
11475    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11476  transpose_image=TransposeImage(wand->images,wand->exception);
11477  if (transpose_image == (Image *) NULL)
11478    return(MagickFalse);
11479  ReplaceImageInList(&wand->images,transpose_image);
11480  return(MagickTrue);
11481}
11482
11483/*
11484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11485%                                                                             %
11486%                                                                             %
11487%                                                                             %
11488%   M a g i c k T r a n s v e r s e I m a g e                                 %
11489%                                                                             %
11490%                                                                             %
11491%                                                                             %
11492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11493%
11494%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11495%  pixels around the central y-axis while rotating them 270-degrees.
11496%
11497%  The format of the MagickTransverseImage method is:
11498%
11499%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11500%
11501%  A description of each parameter follows:
11502%
11503%    o wand: the magick wand.
11504%
11505*/
11506WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11507{
11508  Image
11509    *transverse_image;
11510
11511  assert(wand != (MagickWand *) NULL);
11512  assert(wand->signature == WandSignature);
11513  if (wand->debug != MagickFalse)
11514    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11515  if (wand->images == (Image *) NULL)
11516    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11517  transverse_image=TransverseImage(wand->images,wand->exception);
11518  if (transverse_image == (Image *) NULL)
11519    return(MagickFalse);
11520  ReplaceImageInList(&wand->images,transverse_image);
11521  return(MagickTrue);
11522}
11523
11524/*
11525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11526%                                                                             %
11527%                                                                             %
11528%                                                                             %
11529%   M a g i c k T r i m I m a g e                                             %
11530%                                                                             %
11531%                                                                             %
11532%                                                                             %
11533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11534%
11535%  MagickTrimImage() remove edges that are the background color from the image.
11536%
11537%  The format of the MagickTrimImage method is:
11538%
11539%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11540%
11541%  A description of each parameter follows:
11542%
11543%    o wand: the magick wand.
11544%
11545%    o fuzz: By default target must match a particular pixel color
11546%      exactly.  However, in many cases two colors may differ by a small amount.
11547%      The fuzz member of image defines how much tolerance is acceptable to
11548%      consider two colors as the same.  For example, set fuzz to 10 and the
11549%      color red at intensities of 100 and 102 respectively are now interpreted
11550%      as the same color for the purposes of the floodfill.
11551%
11552*/
11553WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11554{
11555  Image
11556    *trim_image;
11557
11558  assert(wand != (MagickWand *) NULL);
11559  assert(wand->signature == WandSignature);
11560  if (wand->debug != MagickFalse)
11561    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11562  if (wand->images == (Image *) NULL)
11563    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11564  wand->images->fuzz=fuzz;
11565  trim_image=TrimImage(wand->images,wand->exception);
11566  if (trim_image == (Image *) NULL)
11567    return(MagickFalse);
11568  ReplaceImageInList(&wand->images,trim_image);
11569  return(MagickTrue);
11570}
11571
11572/*
11573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11574%                                                                             %
11575%                                                                             %
11576%                                                                             %
11577%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11578%                                                                             %
11579%                                                                             %
11580%                                                                             %
11581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11582%
11583%  MagickUniqueImageColors() discards all but one of any pixel color.
11584%
11585%  The format of the MagickUniqueImageColors method is:
11586%
11587%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11588%
11589%  A description of each parameter follows:
11590%
11591%    o wand: the magick wand.
11592%
11593*/
11594WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11595{
11596  Image
11597    *unique_image;
11598
11599  assert(wand != (MagickWand *) NULL);
11600  assert(wand->signature == WandSignature);
11601  if (wand->debug != MagickFalse)
11602    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11603  if (wand->images == (Image *) NULL)
11604    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11605  unique_image=UniqueImageColors(wand->images,wand->exception);
11606  if (unique_image == (Image *) NULL)
11607    return(MagickFalse);
11608  ReplaceImageInList(&wand->images,unique_image);
11609  return(MagickTrue);
11610}
11611
11612/*
11613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11614%                                                                             %
11615%                                                                             %
11616%                                                                             %
11617%   M a g i c k U n s h a r p M a s k I m a g e                               %
11618%                                                                             %
11619%                                                                             %
11620%                                                                             %
11621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11622%
11623%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11624%  Gaussian operator of the given radius and standard deviation (sigma).
11625%  For reasonable results, radius should be larger than sigma.  Use a radius
11626%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11627%
11628%  The format of the MagickUnsharpMaskImage method is:
11629%
11630%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11631%        const double radius,const double sigma,const double amount,
11632%        const double threshold)
11633%
11634%  A description of each parameter follows:
11635%
11636%    o wand: the magick wand.
11637%
11638%    o radius: the radius of the Gaussian, in pixels, not counting the center
11639%      pixel.
11640%
11641%    o sigma: the standard deviation of the Gaussian, in pixels.
11642%
11643%    o amount: the percentage of the difference between the original and the
11644%      blur image that is added back into the original.
11645%
11646%    o threshold: the threshold in pixels needed to apply the diffence amount.
11647%
11648*/
11649WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11650  const double radius,const double sigma,const double amount,
11651  const double threshold)
11652{
11653  Image
11654    *unsharp_image;
11655
11656  assert(wand != (MagickWand *) NULL);
11657  assert(wand->signature == WandSignature);
11658  if (wand->debug != MagickFalse)
11659    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11660  if (wand->images == (Image *) NULL)
11661    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11662  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11663    wand->exception);
11664  if (unsharp_image == (Image *) NULL)
11665    return(MagickFalse);
11666  ReplaceImageInList(&wand->images,unsharp_image);
11667  return(MagickTrue);
11668}
11669
11670/*
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672%                                                                             %
11673%                                                                             %
11674%                                                                             %
11675%   M a g i c k V i g n e t t e I m a g e                                     %
11676%                                                                             %
11677%                                                                             %
11678%                                                                             %
11679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680%
11681%  MagickVignetteImage() softens the edges of the image in vignette style.
11682%
11683%  The format of the MagickVignetteImage method is:
11684%
11685%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11686%        const double black_point,const double white_point,const ssize_t x,
11687%        const ssize_t y)
11688%
11689%  A description of each parameter follows:
11690%
11691%    o wand: the magick wand.
11692%
11693%    o black_point: the black point.
11694%
11695%    o white_point: the white point.
11696%
11697%    o x, y:  Define the x and y ellipse offset.
11698%
11699*/
11700WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11701  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11702{
11703  Image
11704    *vignette_image;
11705
11706  assert(wand != (MagickWand *) NULL);
11707  assert(wand->signature == WandSignature);
11708  if (wand->debug != MagickFalse)
11709    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11710  if (wand->images == (Image *) NULL)
11711    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11712  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11713    wand->exception);
11714  if (vignette_image == (Image *) NULL)
11715    return(MagickFalse);
11716  ReplaceImageInList(&wand->images,vignette_image);
11717  return(MagickTrue);
11718}
11719
11720/*
11721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11722%                                                                             %
11723%                                                                             %
11724%                                                                             %
11725%   M a g i c k W a v e I m a g e                                             %
11726%                                                                             %
11727%                                                                             %
11728%                                                                             %
11729%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11730%
11731%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11732%  the pixels vertically along a sine wave whose amplitude and wavelength
11733%  is specified by the given parameters.
11734%
11735%  The format of the MagickWaveImage method is:
11736%
11737%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11738%        const double wave_length)
11739%
11740%  A description of each parameter follows:
11741%
11742%    o wand: the magick wand.
11743%
11744%    o amplitude, wave_length:  Define the amplitude and wave length of the
11745%      sine wave.
11746%
11747*/
11748WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11749  const double amplitude,const double wave_length)
11750{
11751  Image
11752    *wave_image;
11753
11754  assert(wand != (MagickWand *) NULL);
11755  assert(wand->signature == WandSignature);
11756  if (wand->debug != MagickFalse)
11757    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11758  if (wand->images == (Image *) NULL)
11759    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11760  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11761  if (wave_image == (Image *) NULL)
11762    return(MagickFalse);
11763  ReplaceImageInList(&wand->images,wave_image);
11764  return(MagickTrue);
11765}
11766
11767/*
11768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11769%                                                                             %
11770%                                                                             %
11771%                                                                             %
11772%   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                         %
11773%                                                                             %
11774%                                                                             %
11775%                                                                             %
11776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11777%
11778%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11779%  above the threshold into white while leaving all pixels below the threshold
11780%  unchanged.
11781%
11782%  The format of the MagickWhiteThresholdImage method is:
11783%
11784%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11785%        const PixelWand *threshold)
11786%
11787%  A description of each parameter follows:
11788%
11789%    o wand: the magick wand.
11790%
11791%    o threshold: the pixel wand.
11792%
11793*/
11794WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11795  const PixelWand *threshold)
11796{
11797  char
11798    thresholds[MaxTextExtent];
11799
11800  MagickBooleanType
11801    status;
11802
11803  assert(wand != (MagickWand *) NULL);
11804  assert(wand->signature == WandSignature);
11805  if (wand->debug != MagickFalse)
11806    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11807  if (wand->images == (Image *) NULL)
11808    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11809  (void) FormatLocaleString(thresholds,MaxTextExtent,
11810    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11811    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11812    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11813  status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11814  if (status == MagickFalse)
11815    InheritException(wand->exception,&wand->images->exception);
11816  return(status);
11817}
11818
11819/*
11820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11821%                                                                             %
11822%                                                                             %
11823%                                                                             %
11824%   M a g i c k W r i t e I m a g e                                           %
11825%                                                                             %
11826%                                                                             %
11827%                                                                             %
11828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11829%
11830%  MagickWriteImage() writes an image to the specified filename.  If the
11831%  filename parameter is NULL, the image is written to the filename set
11832%  by MagickReadImage() or MagickSetImageFilename().
11833%
11834%  The format of the MagickWriteImage method is:
11835%
11836%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11837%        const char *filename)
11838%
11839%  A description of each parameter follows:
11840%
11841%    o wand: the magick wand.
11842%
11843%    o filename: the image filename.
11844%
11845%
11846*/
11847WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11848  const char *filename)
11849{
11850  Image
11851    *image;
11852
11853  ImageInfo
11854    *write_info;
11855
11856  MagickBooleanType
11857    status;
11858
11859  assert(wand != (MagickWand *) NULL);
11860  assert(wand->signature == WandSignature);
11861  if (wand->debug != MagickFalse)
11862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11863  if (wand->images == (Image *) NULL)
11864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11865  if (filename != (const char *) NULL)
11866    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11867  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11868  if (image == (Image *) NULL)
11869    return(MagickFalse);
11870  write_info=CloneImageInfo(wand->image_info);
11871  write_info->adjoin=MagickTrue;
11872  status=WriteImage(write_info,image,&image->exception);
11873  image=DestroyImage(image);
11874  write_info=DestroyImageInfo(write_info);
11875  return(status);
11876}
11877
11878/*
11879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11880%                                                                             %
11881%                                                                             %
11882%                                                                             %
11883%   M a g i c k W r i t e I m a g e F i l e                                   %
11884%                                                                             %
11885%                                                                             %
11886%                                                                             %
11887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11888%
11889%  MagickWriteImageFile() writes an image to an open file descriptor.
11890%
11891%  The format of the MagickWriteImageFile method is:
11892%
11893%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11894%
11895%  A description of each parameter follows:
11896%
11897%    o wand: the magick wand.
11898%
11899%    o file: the file descriptor.
11900%
11901*/
11902WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11903{
11904  Image
11905    *image;
11906
11907  ImageInfo
11908    *write_info;
11909
11910  MagickBooleanType
11911    status;
11912
11913  assert(wand != (MagickWand *) NULL);
11914  assert(wand->signature == WandSignature);
11915  assert(file != (FILE *) NULL);
11916  if (wand->debug != MagickFalse)
11917    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11918  if (wand->images == (Image *) NULL)
11919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11920  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11921  if (image == (Image *) NULL)
11922    return(MagickFalse);
11923  write_info=CloneImageInfo(wand->image_info);
11924  SetImageInfoFile(write_info,file);
11925  write_info->adjoin=MagickTrue;
11926  status=WriteImage(write_info,image,&image->exception);
11927  write_info=DestroyImageInfo(write_info);
11928  image=DestroyImage(image);
11929  return(status);
11930}
11931
11932/*
11933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11934%                                                                             %
11935%                                                                             %
11936%                                                                             %
11937%   M a g i c k W r i t e I m a g e s                                         %
11938%                                                                             %
11939%                                                                             %
11940%                                                                             %
11941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11942%
11943%  MagickWriteImages() writes an image or image sequence.
11944%
11945%  The format of the MagickWriteImages method is:
11946%
11947%      MagickBooleanType MagickWriteImages(MagickWand *wand,
11948%        const char *filename,const MagickBooleanType adjoin)
11949%
11950%  A description of each parameter follows:
11951%
11952%    o wand: the magick wand.
11953%
11954%    o filename: the image filename.
11955%
11956%    o adjoin: join images into a single multi-image file.
11957%
11958*/
11959WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11960  const char *filename,const MagickBooleanType adjoin)
11961{
11962  ImageInfo
11963    *write_info;
11964
11965  MagickBooleanType
11966    status;
11967
11968  assert(wand != (MagickWand *) NULL);
11969  assert(wand->signature == WandSignature);
11970  if (wand->debug != MagickFalse)
11971    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11972  if (wand->images == (Image *) NULL)
11973    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11974  write_info=CloneImageInfo(wand->image_info);
11975  write_info->adjoin=adjoin;
11976  status=WriteImages(write_info,wand->images,filename,wand->exception);
11977  if (status == MagickFalse)
11978    InheritException(wand->exception,&wand->images->exception);
11979  write_info=DestroyImageInfo(write_info);
11980  return(status);
11981}
11982
11983/*
11984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11985%                                                                             %
11986%                                                                             %
11987%                                                                             %
11988%   M a g i c k W r i t e I m a g e s F i l e                                 %
11989%                                                                             %
11990%                                                                             %
11991%                                                                             %
11992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11993%
11994%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
11995%
11996%  The format of the MagickWriteImagesFile method is:
11997%
11998%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
11999%
12000%  A description of each parameter follows:
12001%
12002%    o wand: the magick wand.
12003%
12004%    o file: the file descriptor.
12005%
12006*/
12007WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12008{
12009  ImageInfo
12010    *write_info;
12011
12012  MagickBooleanType
12013    status;
12014
12015  assert(wand != (MagickWand *) NULL);
12016  assert(wand->signature == WandSignature);
12017  if (wand->debug != MagickFalse)
12018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12019  if (wand->images == (Image *) NULL)
12020    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12021  write_info=CloneImageInfo(wand->image_info);
12022  SetImageInfoFile(write_info,file);
12023  write_info->adjoin=MagickTrue;
12024  status=WriteImages(write_info,wand->images,(const char *) NULL,
12025    wand->exception);
12026  write_info=DestroyImageInfo(write_info);
12027  if (status == MagickFalse)
12028    InheritException(wand->exception,&wand->images->exception);
12029  return(status);
12030}
12031