magick-image.c revision 9ee6094d071d578bc97ad9dd4d22ccb70dfbc3db
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7%                 MM MM  A   A  G        I    C      K  K                     %
8%                 M M M  AAAAA  G GGG    I    C      KKK                      %
9%                 M   M  A   A  G   G    I    C      K  K                     %
10%                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11%                                                                             %
12%                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13%                       I    MM MM  A   A  G      E                           %
14%                       I    M M M  AAAAA  G  GG  EEE                         %
15%                       I    M   M  A   A  G   G  E                           %
16%                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17%                                                                             %
18%                                                                             %
19%                          MagickWand Image Methods                           %
20%                                                                             %
21%                               Software Design                               %
22%                                 John Cristy                                 %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
27%  dedicated to making software imaging solutions freely available.           %
28%                                                                             %
29%  You may not use this file except in compliance with the License.  You may  %
30%  obtain a copy of the License at                                            %
31%                                                                             %
32%    http://www.imagemagick.org/script/license.php                            %
33%                                                                             %
34%  Unless required by applicable law or agreed to in writing, software        %
35%  distributed under the License is distributed on an "AS IS" BASIS,          %
36%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37%  See the License for the specific language governing permissions and        %
38%  limitations under the License.                                             %
39%                                                                             %
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41%
42%
43%
44*/
45
46/*
47  Include declarations.
48*/
49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
54
55/*
56  Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60  (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61    tag,"`%s'",context); \
62  return(MagickFalse); \
63}
64#define MagickWandId  "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68%                                                                             %
69%                                                                             %
70%                                                                             %
71+   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72%                                                                             %
73%                                                                             %
74%                                                                             %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78%  list.
79%
80%  The format of the CloneMagickWandFromImages method is:
81%
82%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83%        Image *images)
84%
85%  A description of each parameter follows:
86%
87%    o wand: the magick wand.
88%
89%    o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93  Image *images)
94{
95  MagickWand
96    *clone_wand;
97
98  assert(wand != (MagickWand *) NULL);
99  assert(wand->signature == WandSignature);
100  if (wand->debug != MagickFalse)
101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103  if (clone_wand == (MagickWand *) NULL)
104    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105      images->filename);
106  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107  clone_wand->id=AcquireWandId();
108  (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109    MagickWandId,(double) clone_wand->id);
110  clone_wand->exception=AcquireExceptionInfo();
111  InheritException(clone_wand->exception,wand->exception);
112  clone_wand->image_info=CloneImageInfo(wand->image_info);
113  clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114  clone_wand->images=images;
115  clone_wand->debug=IsEventLogging();
116  if (clone_wand->debug != MagickFalse)
117    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118  clone_wand->signature=WandSignature;
119  return(clone_wand);
120}
121
122/*
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124%                                                                             %
125%                                                                             %
126%                                                                             %
127%   G e t I m a g e F r o m M a g i c k W a n d                               %
128%                                                                             %
129%                                                                             %
130%                                                                             %
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132%
133%  GetImageFromMagickWand() returns the current image from the magick wand.
134%
135%  The format of the GetImageFromMagickWand method is:
136%
137%      Image *GetImageFromMagickWand(const MagickWand *wand)
138%
139%  A description of each parameter follows:
140%
141%    o wand: the magick wand.
142%
143*/
144WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145{
146  assert(wand != (MagickWand *) NULL);
147  assert(wand->signature == WandSignature);
148  if (wand->debug != MagickFalse)
149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150  if (wand->images == (Image *) NULL)
151    {
152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153        "ContainsNoImages","`%s'",wand->name);
154      return((Image *) NULL);
155    }
156  return(wand->images);
157}
158
159/*
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161%                                                                             %
162%                                                                             %
163%                                                                             %
164%   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165%                                                                             %
166%                                                                             %
167%                                                                             %
168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169%
170%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171%  less intensely near image edges and more intensely far from edges. We
172%  blur the image with a Gaussian operator of the given radius and standard
173%  deviation (sigma).  For reasonable results, radius should be larger than
174%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175%  suitable radius for you.
176%
177%  The format of the MagickAdaptiveBlurImage method is:
178%
179%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180%        const double radius,const double sigma)
181%      MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
182%        const ChannelType channel,const double radius,const double sigma)
183%
184%  A description of each parameter follows:
185%
186%    o wand: the magick wand.
187%
188%    o channel: the image channel(s).
189%
190%    o radius: the radius of the Gaussian, in pixels, not counting the center
191%      pixel.
192%
193%    o sigma: the standard deviation of the Gaussian, in pixels.
194%
195*/
196
197WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
198  const double radius,const double sigma)
199{
200  MagickBooleanType
201    status;
202
203  status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
204  return(status);
205}
206
207WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
208  const ChannelType channel,const double radius,const double sigma)
209{
210  Image
211    *sharp_image;
212
213  assert(wand != (MagickWand *) NULL);
214  assert(wand->signature == WandSignature);
215  if (wand->debug != MagickFalse)
216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
217  if (wand->images == (Image *) NULL)
218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
219  sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
220    wand->exception);
221  if (sharp_image == (Image *) NULL)
222    return(MagickFalse);
223  ReplaceImageInList(&wand->images,sharp_image);
224  return(MagickTrue);
225}
226
227/*
228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229%                                                                             %
230%                                                                             %
231%                                                                             %
232%   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                         %
233%                                                                             %
234%                                                                             %
235%                                                                             %
236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
237%
238%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
239%  triangulation.
240%
241%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
242%        const size_t columns,const size_t rows)
243%
244%  A description of each parameter follows:
245%
246%    o wand: the magick wand.
247%
248%    o columns: the number of columns in the scaled image.
249%
250%    o rows: the number of rows in the scaled image.
251%
252*/
253WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
254  const size_t columns,const size_t rows)
255{
256  Image
257    *resize_image;
258
259  assert(wand != (MagickWand *) NULL);
260  assert(wand->signature == WandSignature);
261  if (wand->debug != MagickFalse)
262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
263  if (wand->images == (Image *) NULL)
264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
265  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
266  if (resize_image == (Image *) NULL)
267    return(MagickFalse);
268  ReplaceImageInList(&wand->images,resize_image);
269  return(MagickTrue);
270}
271
272/*
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274%                                                                             %
275%                                                                             %
276%                                                                             %
277%   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                       %
278%                                                                             %
279%                                                                             %
280%                                                                             %
281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282%
283%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
284%  more intensely near image edges and less intensely far from edges. We
285%  sharpen the image with a Gaussian operator of the given radius and standard
286%  deviation (sigma).  For reasonable results, radius should be larger than
287%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
288%  suitable radius for you.
289%
290%  The format of the MagickAdaptiveSharpenImage method is:
291%
292%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293%        const double radius,const double sigma)
294%      MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
295%        const ChannelType channel,const double radius,const double sigma)
296%
297%  A description of each parameter follows:
298%
299%    o wand: the magick wand.
300%
301%    o channel: the image channel(s).
302%
303%    o radius: the radius of the Gaussian, in pixels, not counting the center
304%      pixel.
305%
306%    o sigma: the standard deviation of the Gaussian, in pixels.
307%
308*/
309
310WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
311  const double radius,const double sigma)
312{
313  MagickBooleanType
314    status;
315
316  status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
317  return(status);
318}
319
320WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
321  const ChannelType channel,const double radius,const double sigma)
322{
323  Image
324    *sharp_image;
325
326  assert(wand != (MagickWand *) NULL);
327  assert(wand->signature == WandSignature);
328  if (wand->debug != MagickFalse)
329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
330  if (wand->images == (Image *) NULL)
331    ThrowWandException(WandError,"ContainsNoImages",wand->name);
332  sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
333    wand->exception);
334  if (sharp_image == (Image *) NULL)
335    return(MagickFalse);
336  ReplaceImageInList(&wand->images,sharp_image);
337  return(MagickTrue);
338}
339
340/*
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342%                                                                             %
343%                                                                             %
344%                                                                             %
345%   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                   %
346%                                                                             %
347%                                                                             %
348%                                                                             %
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350%
351%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
352%  based on the range of intensity values in its local neighborhood.  This
353%  allows for thresholding of an image whose global intensity histogram
354%  doesn't contain distinctive peaks.
355%
356%  The format of the AdaptiveThresholdImage method is:
357%
358%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
359%        const size_t width,const size_t height,const ssize_t offset)
360%
361%  A description of each parameter follows:
362%
363%    o wand: the magick wand.
364%
365%    o width: the width of the local neighborhood.
366%
367%    o height: the height of the local neighborhood.
368%
369%    o offset: the mean offset.
370%
371*/
372WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
373  const size_t width,const size_t height,const ssize_t offset)
374{
375  Image
376    *threshold_image;
377
378  assert(wand != (MagickWand *) NULL);
379  assert(wand->signature == WandSignature);
380  if (wand->debug != MagickFalse)
381    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
382  if (wand->images == (Image *) NULL)
383    ThrowWandException(WandError,"ContainsNoImages",wand->name);
384  threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
385    wand->exception);
386  if (threshold_image == (Image *) NULL)
387    return(MagickFalse);
388  ReplaceImageInList(&wand->images,threshold_image);
389  return(MagickTrue);
390}
391
392/*
393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394%                                                                             %
395%                                                                             %
396%                                                                             %
397%   M a g i c k A d d I m a g e                                               %
398%                                                                             %
399%                                                                             %
400%                                                                             %
401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402%
403%  MagickAddImage() adds the specified images at the current image location.
404%
405%  The format of the MagickAddImage method is:
406%
407%      MagickBooleanType MagickAddImage(MagickWand *wand,
408%        const MagickWand *add_wand)
409%
410%  A description of each parameter follows:
411%
412%    o wand: the magick wand.
413%
414%    o add_wand: A wand that contains images to add at the current image
415%      location.
416%
417*/
418
419static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
420  Image *images)
421{
422  Image
423    *sentinel;
424
425  sentinel=wand->images;
426  if (sentinel == (Image *) NULL)
427    {
428      wand->images=GetFirstImageInList(images);
429      return(MagickTrue);
430    }
431  if (wand->active == MagickFalse)
432    {
433      if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
434        {
435          AppendImageToList(&sentinel,images);
436          wand->images=GetLastImageInList(images);
437          return(MagickTrue);
438        }
439      if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
440        {
441          PrependImageToList(&sentinel,images);
442          wand->images=GetFirstImageInList(images);
443          return(MagickTrue);
444        }
445    }
446  if (sentinel->next == (Image *) NULL)
447    {
448      InsertImageInList(&sentinel,images);
449      wand->images=GetLastImageInList(images);
450      return(MagickTrue);
451    }
452  InsertImageInList(&sentinel,images);
453  wand->images=GetFirstImageInList(images);
454  return(MagickTrue);
455}
456
457WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458  const MagickWand *add_wand)
459{
460  Image
461    *images;
462
463  assert(wand != (MagickWand *) NULL);
464  assert(wand->signature == WandSignature);
465  if (wand->debug != MagickFalse)
466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467  assert(add_wand != (MagickWand *) NULL);
468  assert(add_wand->signature == WandSignature);
469  if (add_wand->images == (Image *) NULL)
470    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
471  images=CloneImageList(add_wand->images,wand->exception);
472  if (images == (Image *) NULL)
473    return(MagickFalse);
474  return(InsertImageInWand(wand,images));
475}
476
477/*
478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
479%                                                                             %
480%                                                                             %
481%                                                                             %
482%     M a g i c k A d d N o i s e I m a g e                                   %
483%                                                                             %
484%                                                                             %
485%                                                                             %
486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487%
488%  MagickAddNoiseImage() adds random noise to the image.
489%
490%  The format of the MagickAddNoiseImage method is:
491%
492%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
493%        const NoiseType noise_type)
494%      MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
495%        const ChannelType channel,const NoiseType noise_type)
496%
497%  A description of each parameter follows:
498%
499%    o wand: the magick wand.
500%
501%    o channel: the image channel(s).
502%
503%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
504%      Impulse, Laplacian, or Poisson.
505%
506*/
507
508WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
509  const NoiseType noise_type)
510{
511  MagickBooleanType
512    status;
513
514  status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
515  return(status);
516}
517
518WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
519  const ChannelType channel,const NoiseType noise_type)
520{
521  Image
522    *noise_image;
523
524  assert(wand != (MagickWand *) NULL);
525  assert(wand->signature == WandSignature);
526  if (wand->debug != MagickFalse)
527    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
528  if (wand->images == (Image *) NULL)
529    ThrowWandException(WandError,"ContainsNoImages",wand->name);
530  noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
531    wand->exception);
532  if (noise_image == (Image *) NULL)
533    return(MagickFalse);
534  ReplaceImageInList(&wand->images,noise_image);
535  return(MagickTrue);
536}
537
538/*
539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
540%                                                                             %
541%                                                                             %
542%                                                                             %
543%   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                       %
544%                                                                             %
545%                                                                             %
546%                                                                             %
547%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
548%
549%  MagickAffineTransformImage() transforms an image as dictated by the affine
550%  matrix of the drawing wand.
551%
552%  The format of the MagickAffineTransformImage method is:
553%
554%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
555%        const DrawingWand *drawing_wand)
556%
557%  A description of each parameter follows:
558%
559%    o wand: the magick wand.
560%
561%    o drawing_wand: the draw wand.
562%
563*/
564WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
565  const DrawingWand *drawing_wand)
566{
567  DrawInfo
568    *draw_info;
569
570  Image
571    *affine_image;
572
573  assert(wand != (MagickWand *) NULL);
574  assert(wand->signature == WandSignature);
575  if (wand->debug != MagickFalse)
576    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
577  if (wand->images == (Image *) NULL)
578    ThrowWandException(WandError,"ContainsNoImages",wand->name);
579  draw_info=PeekDrawingWand(drawing_wand);
580  if (draw_info == (DrawInfo *) NULL)
581    return(MagickFalse);
582  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
583    wand->exception);
584  draw_info=DestroyDrawInfo(draw_info);
585  if (affine_image == (Image *) NULL)
586    return(MagickFalse);
587  ReplaceImageInList(&wand->images,affine_image);
588  return(MagickTrue);
589}
590
591/*
592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
593%                                                                             %
594%                                                                             %
595%                                                                             %
596%   M a g i c k A n n o t a t e I m a g e                                     %
597%                                                                             %
598%                                                                             %
599%                                                                             %
600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
601%
602%  MagickAnnotateImage() annotates an image with text.
603%
604%  The format of the MagickAnnotateImage method is:
605%
606%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
607%        const DrawingWand *drawing_wand,const double x,const double y,
608%        const double angle,const char *text)
609%
610%  A description of each parameter follows:
611%
612%    o wand: the magick wand.
613%
614%    o drawing_wand: the draw wand.
615%
616%    o x: x ordinate to left of text
617%
618%    o y: y ordinate to text baseline
619%
620%    o angle: rotate text relative to this angle.
621%
622%    o text: text to draw
623%
624*/
625WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
626  const DrawingWand *drawing_wand,const double x,const double y,
627  const double angle,const char *text)
628{
629  char
630    geometry[MaxTextExtent];
631
632  DrawInfo
633    *draw_info;
634
635  MagickBooleanType
636    status;
637
638  assert(wand != (MagickWand *) NULL);
639  assert(wand->signature == WandSignature);
640  if (wand->debug != MagickFalse)
641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
642  if (wand->images == (Image *) NULL)
643    ThrowWandException(WandError,"ContainsNoImages",wand->name);
644  draw_info=PeekDrawingWand(drawing_wand);
645  if (draw_info == (DrawInfo *) NULL)
646    return(MagickFalse);
647  (void) CloneString(&draw_info->text,text);
648  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
649  draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
650  draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
651  draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
652  draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
653  (void) CloneString(&draw_info->geometry,geometry);
654  status=AnnotateImage(wand->images,draw_info);
655  draw_info=DestroyDrawInfo(draw_info);
656  if (status == MagickFalse)
657    InheritException(wand->exception,&wand->images->exception);
658  return(status);
659}
660
661/*
662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663%                                                                             %
664%                                                                             %
665%                                                                             %
666%   M a g i c k A n i m a t e I m a g e s                                     %
667%                                                                             %
668%                                                                             %
669%                                                                             %
670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
671%
672%  MagickAnimateImages() animates an image or image sequence.
673%
674%  The format of the MagickAnimateImages method is:
675%
676%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
677%        const char *server_name)
678%
679%  A description of each parameter follows:
680%
681%    o wand: the magick wand.
682%
683%    o server_name: the X server name.
684%
685*/
686WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
687  const char *server_name)
688{
689  MagickBooleanType
690    status;
691
692  assert(wand != (MagickWand *) NULL);
693  assert(wand->signature == WandSignature);
694  if (wand->debug != MagickFalse)
695    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
696  (void) CloneString(&wand->image_info->server_name,server_name);
697  status=AnimateImages(wand->image_info,wand->images);
698  if (status == MagickFalse)
699    InheritException(wand->exception,&wand->images->exception);
700  return(status);
701}
702
703/*
704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
705%                                                                             %
706%                                                                             %
707%                                                                             %
708%   M a g i c k A p p e n d I m a g e s                                       %
709%                                                                             %
710%                                                                             %
711%                                                                             %
712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
713%
714%  MagickAppendImages() append a set of images.
715%
716%  The format of the MagickAppendImages method is:
717%
718%      MagickWand *MagickAppendImages(MagickWand *wand,
719%        const MagickBooleanType stack)
720%
721%  A description of each parameter follows:
722%
723%    o wand: the magick wand.
724%
725%    o stack: By default, images are stacked left-to-right. Set stack to
726%      MagickTrue to stack them top-to-bottom.
727%
728*/
729WandExport MagickWand *MagickAppendImages(MagickWand *wand,
730  const MagickBooleanType stack)
731{
732  Image
733    *append_image;
734
735  assert(wand != (MagickWand *) NULL);
736  assert(wand->signature == WandSignature);
737  if (wand->debug != MagickFalse)
738    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
739  if (wand->images == (Image *) NULL)
740    return((MagickWand *) NULL);
741  append_image=AppendImages(wand->images,stack,wand->exception);
742  if (append_image == (Image *) NULL)
743    return((MagickWand *) NULL);
744  return(CloneMagickWandFromImages(wand,append_image));
745}
746
747/*
748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749%                                                                             %
750%                                                                             %
751%                                                                             %
752%   M a g i c k A u t o G a m m a I m a g e                                   %
753%                                                                             %
754%                                                                             %
755%                                                                             %
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757%
758%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
759%  image to try make set its gamma appropriatally.
760%
761%  The format of the MagickAutoGammaImage method is:
762%
763%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
764%
765%  A description of each parameter follows:
766%
767%    o wand: the magick wand.
768%
769*/
770WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
771{
772  MagickBooleanType
773    status;
774
775  assert(wand != (MagickWand *) NULL);
776  assert(wand->signature == WandSignature);
777  if (wand->debug != MagickFalse)
778    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
779  if (wand->images == (Image *) NULL)
780    ThrowWandException(WandError,"ContainsNoImages",wand->name);
781  status=AutoGammaImage(wand->images);
782  if (status == MagickFalse)
783    InheritException(wand->exception,&wand->images->exception);
784  return(status);
785}
786
787/*
788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
789%                                                                             %
790%                                                                             %
791%                                                                             %
792%   M a g i c k A u t o L e v e l I m a g e                                   %
793%                                                                             %
794%                                                                             %
795%                                                                             %
796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797%
798%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
799%  scaling the minimum and maximum values to the full quantum range.
800%
801%  The format of the MagickAutoLevelImage method is:
802%
803%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
804%
805%  A description of each parameter follows:
806%
807%    o wand: the magick wand.
808%
809*/
810WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
811{
812  MagickBooleanType
813    status;
814
815  assert(wand != (MagickWand *) NULL);
816  assert(wand->signature == WandSignature);
817  if (wand->debug != MagickFalse)
818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
819  if (wand->images == (Image *) NULL)
820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
821  status=AutoLevelImage(wand->images);
822  if (status == MagickFalse)
823    InheritException(wand->exception,&wand->images->exception);
824  return(status);
825}
826
827/*
828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
829%                                                                             %
830%                                                                             %
831%                                                                             %
832%   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                         %
833%                                                                             %
834%                                                                             %
835%                                                                             %
836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837%
838%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
839%  pixels below the threshold into black while leaving all pixels above the
840%  threshold unchanged.
841%
842%  The format of the MagickBlackThresholdImage method is:
843%
844%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
845%        const PixelWand *threshold)
846%
847%  A description of each parameter follows:
848%
849%    o wand: the magick wand.
850%
851%    o threshold: the pixel wand.
852%
853*/
854WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
855  const PixelWand *threshold)
856{
857  char
858    thresholds[MaxTextExtent];
859
860  MagickBooleanType
861    status;
862
863  assert(wand != (MagickWand *) NULL);
864  assert(wand->signature == WandSignature);
865  if (wand->debug != MagickFalse)
866    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
867  if (wand->images == (Image *) NULL)
868    ThrowWandException(WandError,"ContainsNoImages",wand->name);
869  (void) FormatLocaleString(thresholds,MaxTextExtent,
870    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
871    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
872    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
873  status=BlackThresholdImage(wand->images,thresholds);
874  if (status == MagickFalse)
875    InheritException(wand->exception,&wand->images->exception);
876  return(status);
877}
878
879/*
880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
881%                                                                             %
882%                                                                             %
883%                                                                             %
884%   M a g i c k B l u e S h i f t I m a g e                                   %
885%                                                                             %
886%                                                                             %
887%                                                                             %
888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
889%
890%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
891%  nighttime in the moonlight.
892%
893%  The format of the MagickBlueShiftImage method is:
894%
895%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
896%        const double factor)
897%
898%  A description of each parameter follows:
899%
900%    o wand: the magick wand.
901%
902%    o factor: the blue shift factor (default 1.5)
903%
904*/
905WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
906  const double factor)
907{
908  Image
909    *shift_image;
910
911  assert(wand != (MagickWand *) NULL);
912  assert(wand->signature == WandSignature);
913  if (wand->debug != MagickFalse)
914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
915  if (wand->images == (Image *) NULL)
916    ThrowWandException(WandError,"ContainsNoImages",wand->name);
917  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
918  if (shift_image == (Image *) NULL)
919    return(MagickFalse);
920  ReplaceImageInList(&wand->images,shift_image);
921  return(MagickTrue);
922}
923
924/*
925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
926%                                                                             %
927%                                                                             %
928%                                                                             %
929%   M a g i c k B l u r I m a g e                                             %
930%                                                                             %
931%                                                                             %
932%                                                                             %
933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
934%
935%  MagickBlurImage() blurs an image.  We convolve the image with a
936%  gaussian operator of the given radius and standard deviation (sigma).
937%  For reasonable results, the radius should be larger than sigma.  Use a
938%  radius of 0 and BlurImage() selects a suitable radius for you.
939%
940%  The format of the MagickBlurImage method is:
941%
942%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
943%        const double sigma)
944%      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
945%        const ChannelType channel,const double radius,const double sigma)
946%
947%  A description of each parameter follows:
948%
949%    o wand: the magick wand.
950%
951%    o channel: the image channel(s).
952%
953%    o radius: the radius of the , in pixels, not counting the center
954%      pixel.
955%
956%    o sigma: the standard deviation of the , in pixels.
957%
958*/
959
960WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
961  const double radius,const double sigma)
962{
963  MagickBooleanType
964    status;
965
966  status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
967  return(status);
968}
969
970WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
971  const ChannelType channel,const double radius,const double sigma)
972{
973  Image
974    *blur_image;
975
976  assert(wand != (MagickWand *) NULL);
977  assert(wand->signature == WandSignature);
978  if (wand->debug != MagickFalse)
979    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
980  if (wand->images == (Image *) NULL)
981    ThrowWandException(WandError,"ContainsNoImages",wand->name);
982  blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
983    wand->exception);
984  if (blur_image == (Image *) NULL)
985    return(MagickFalse);
986  ReplaceImageInList(&wand->images,blur_image);
987  return(MagickTrue);
988}
989
990/*
991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
992%                                                                             %
993%                                                                             %
994%                                                                             %
995%   M a g i c k B o r d e r I m a g e                                         %
996%                                                                             %
997%                                                                             %
998%                                                                             %
999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1000%
1001%  MagickBorderImage() surrounds the image with a border of the color defined
1002%  by the bordercolor pixel wand.
1003%
1004%  The format of the MagickBorderImage method is:
1005%
1006%      MagickBooleanType MagickBorderImage(MagickWand *wand,
1007%        const PixelWand *bordercolor,const size_t width,
1008%        const size_t height)
1009%
1010%  A description of each parameter follows:
1011%
1012%    o wand: the magick wand.
1013%
1014%    o bordercolor: the border color pixel wand.
1015%
1016%    o width: the border width.
1017%
1018%    o height: the border height.
1019%
1020*/
1021WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1022  const PixelWand *bordercolor,const size_t width,
1023  const size_t height)
1024{
1025  Image
1026    *border_image;
1027
1028  RectangleInfo
1029    border_info;
1030
1031  assert(wand != (MagickWand *) NULL);
1032  assert(wand->signature == WandSignature);
1033  if (wand->debug != MagickFalse)
1034    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1035  if (wand->images == (Image *) NULL)
1036    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1037  border_info.width=width;
1038  border_info.height=height;
1039  border_info.x=0;
1040  border_info.y=0;
1041  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1042  border_image=BorderImage(wand->images,&border_info,wand->exception);
1043  if (border_image == (Image *) NULL)
1044    return(MagickFalse);
1045  ReplaceImageInList(&wand->images,border_image);
1046  return(MagickTrue);
1047}
1048
1049/*
1050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1051%                                                                             %
1052%                                                                             %
1053%                                                                             %
1054%   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   %
1055%                                                                             %
1056%                                                                             %
1057%                                                                             %
1058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1059%
1060%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1061%  of an image.  It converts the brightness and contrast parameters into slope
1062%  and intercept and calls a polynomical function to apply to the image.
1063
1064%
1065%  The format of the MagickBrightnessContrastImage method is:
1066%
1067%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1068%        const double brightness,const double contrast)
1069%
1070%  A description of each parameter follows:
1071%
1072%    o wand: the magick wand.
1073%
1074%    o brightness: the brightness percent (-100 .. 100).
1075%
1076%    o contrast: the contrast percent (-100 .. 100).
1077%
1078*/
1079WandExport MagickBooleanType MagickBrightnessContrastImage(
1080  MagickWand *wand,const double brightness,const double contrast)
1081{
1082  MagickBooleanType
1083    status;
1084
1085  assert(wand != (MagickWand *) NULL);
1086  assert(wand->signature == WandSignature);
1087  if (wand->debug != MagickFalse)
1088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1089  if (wand->images == (Image *) NULL)
1090    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1091  status=BrightnessContrastImage(wand->images,brightness,contrast);
1092  if (status == MagickFalse)
1093    InheritException(wand->exception,&wand->images->exception);
1094  return(status);
1095}
1096
1097/*
1098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099%                                                                             %
1100%                                                                             %
1101%                                                                             %
1102%   M a g i c k C h a r c o a l I m a g e                                     %
1103%                                                                             %
1104%                                                                             %
1105%                                                                             %
1106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1107%
1108%  MagickCharcoalImage() simulates a charcoal drawing.
1109%
1110%  The format of the MagickCharcoalImage method is:
1111%
1112%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1113%        const double radius,const double sigma)
1114%
1115%  A description of each parameter follows:
1116%
1117%    o wand: the magick wand.
1118%
1119%    o radius: the radius of the Gaussian, in pixels, not counting the center
1120%      pixel.
1121%
1122%    o sigma: the standard deviation of the Gaussian, in pixels.
1123%
1124*/
1125WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1126  const double radius,const double sigma)
1127{
1128  Image
1129    *charcoal_image;
1130
1131  assert(wand != (MagickWand *) NULL);
1132  assert(wand->signature == WandSignature);
1133  if (wand->debug != MagickFalse)
1134    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1135  if (wand->images == (Image *) NULL)
1136    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1137  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1138  if (charcoal_image == (Image *) NULL)
1139    return(MagickFalse);
1140  ReplaceImageInList(&wand->images,charcoal_image);
1141  return(MagickTrue);
1142}
1143
1144/*
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%                                                                             %
1147%                                                                             %
1148%                                                                             %
1149%   M a g i c k C h o p I m a g e                                             %
1150%                                                                             %
1151%                                                                             %
1152%                                                                             %
1153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154%
1155%  MagickChopImage() removes a region of an image and collapses the image to
1156%  occupy the removed portion
1157%
1158%  The format of the MagickChopImage method is:
1159%
1160%      MagickBooleanType MagickChopImage(MagickWand *wand,
1161%        const size_t width,const size_t height,const ssize_t x,
1162%        const ssize_t y)
1163%
1164%  A description of each parameter follows:
1165%
1166%    o wand: the magick wand.
1167%
1168%    o width: the region width.
1169%
1170%    o height: the region height.
1171%
1172%    o x: the region x offset.
1173%
1174%    o y: the region y offset.
1175%
1176%
1177*/
1178WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1179  const size_t width,const size_t height,const ssize_t x,
1180  const ssize_t y)
1181{
1182  Image
1183    *chop_image;
1184
1185  RectangleInfo
1186    chop;
1187
1188  assert(wand != (MagickWand *) NULL);
1189  assert(wand->signature == WandSignature);
1190  if (wand->debug != MagickFalse)
1191    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1192  if (wand->images == (Image *) NULL)
1193    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1194  chop.width=width;
1195  chop.height=height;
1196  chop.x=x;
1197  chop.y=y;
1198  chop_image=ChopImage(wand->images,&chop,wand->exception);
1199  if (chop_image == (Image *) NULL)
1200    return(MagickFalse);
1201  ReplaceImageInList(&wand->images,chop_image);
1202  return(MagickTrue);
1203}
1204
1205/*
1206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1207%                                                                             %
1208%                                                                             %
1209%                                                                             %
1210%   M a g i c k C l a m p I m a g e                                           %
1211%                                                                             %
1212%                                                                             %
1213%                                                                             %
1214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1215%
1216%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1217%
1218%  The format of the MagickClampImage method is:
1219%
1220%      MagickBooleanType MagickClampImage(MagickWand *wand)
1221%      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1222%        const ChannelType channel)
1223%
1224%  A description of each parameter follows:
1225%
1226%    o wand: the magick wand.
1227%
1228%    o channel: the channel.
1229%
1230*/
1231
1232WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1233{
1234  MagickBooleanType
1235    status;
1236
1237  status=MagickClampImageChannel(wand,DefaultChannels);
1238  return(status);
1239}
1240
1241WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1242  const ChannelType channel)
1243{
1244  MagickBooleanType
1245    status;
1246
1247  assert(wand != (MagickWand *) NULL);
1248  assert(wand->signature == WandSignature);
1249  if (wand->debug != MagickFalse)
1250    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1251  if (wand->images == (Image *) NULL)
1252    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1253  status=ClampImageChannel(wand->images,channel);
1254  if (status == MagickFalse)
1255    InheritException(wand->exception,&wand->images->exception);
1256  return(status);
1257}
1258
1259/*
1260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1261%                                                                             %
1262%                                                                             %
1263%                                                                             %
1264%   M a g i c k C l i p I m a g e                                             %
1265%                                                                             %
1266%                                                                             %
1267%                                                                             %
1268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1269%
1270%  MagickClipImage() clips along the first path from the 8BIM profile, if
1271%  present.
1272%
1273%  The format of the MagickClipImage method is:
1274%
1275%      MagickBooleanType MagickClipImage(MagickWand *wand)
1276%
1277%  A description of each parameter follows:
1278%
1279%    o wand: the magick wand.
1280%
1281*/
1282WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1283{
1284  MagickBooleanType
1285    status;
1286
1287  assert(wand != (MagickWand *) NULL);
1288  assert(wand->signature == WandSignature);
1289  if (wand->debug != MagickFalse)
1290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1291  if (wand->images == (Image *) NULL)
1292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1293  status=ClipImage(wand->images);
1294  if (status == MagickFalse)
1295    InheritException(wand->exception,&wand->images->exception);
1296  return(status);
1297}
1298
1299/*
1300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1301%                                                                             %
1302%                                                                             %
1303%                                                                             %
1304%   M a g i c k C l i p I m a g e P a t h                                     %
1305%                                                                             %
1306%                                                                             %
1307%                                                                             %
1308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1309%
1310%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1311%  present. Later operations take effect inside the path.  Id may be a number
1312%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1313%  path.
1314%
1315%  The format of the MagickClipImagePath method is:
1316%
1317%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1318%        const char *pathname,const MagickBooleanType inside)
1319%
1320%  A description of each parameter follows:
1321%
1322%    o wand: the magick wand.
1323%
1324%    o pathname: name of clipping path resource. If name is preceded by #, use
1325%      clipping path numbered by name.
1326%
1327%    o inside: if non-zero, later operations take effect inside clipping path.
1328%      Otherwise later operations take effect outside clipping path.
1329%
1330*/
1331WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1332  const char *pathname,const MagickBooleanType inside)
1333{
1334  MagickBooleanType
1335    status;
1336
1337  assert(wand != (MagickWand *) NULL);
1338  assert(wand->signature == WandSignature);
1339  if (wand->debug != MagickFalse)
1340    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1341  if (wand->images == (Image *) NULL)
1342    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1343  status=ClipImagePath(wand->images,pathname,inside);
1344  if (status == MagickFalse)
1345    InheritException(wand->exception,&wand->images->exception);
1346  return(status);
1347}
1348
1349/*
1350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1351%                                                                             %
1352%                                                                             %
1353%                                                                             %
1354%   M a g i c k C l u t I m a g e                                             %
1355%                                                                             %
1356%                                                                             %
1357%                                                                             %
1358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1359%
1360%  MagickClutImage() replaces colors in the image from a color lookup table.
1361%
1362%  The format of the MagickClutImage method is:
1363%
1364%      MagickBooleanType MagickClutImage(MagickWand *wand,
1365%        const MagickWand *clut_wand)
1366%      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1367%        const ChannelType channel,const MagickWand *clut_wand)
1368%
1369%  A description of each parameter follows:
1370%
1371%    o wand: the magick wand.
1372%
1373%    o clut_image: the clut image.
1374%
1375*/
1376
1377WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1378  const MagickWand *clut_wand)
1379{
1380  MagickBooleanType
1381    status;
1382
1383  status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1384  return(status);
1385}
1386
1387WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1388  const ChannelType channel,const MagickWand *clut_wand)
1389{
1390  MagickBooleanType
1391    status;
1392
1393  assert(wand != (MagickWand *) NULL);
1394  assert(wand->signature == WandSignature);
1395  if (wand->debug != MagickFalse)
1396    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1397  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1398    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1399  status=ClutImageChannel(wand->images,channel,clut_wand->images);
1400  if (status == MagickFalse)
1401    InheritException(wand->exception,&wand->images->exception);
1402  return(status);
1403}
1404
1405/*
1406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1407%                                                                             %
1408%                                                                             %
1409%                                                                             %
1410%   M a g i c k C o a l e s c e I m a g e s                                   %
1411%                                                                             %
1412%                                                                             %
1413%                                                                             %
1414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1415%
1416%  MagickCoalesceImages() composites a set of images while respecting any page
1417%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1418%  typically start with an image background and each subsequent image
1419%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1420%  where each image in the sequence is the same size as the first and
1421%  composited with the next image in the sequence.
1422%
1423%  The format of the MagickCoalesceImages method is:
1424%
1425%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1426%
1427%  A description of each parameter follows:
1428%
1429%    o wand: the magick wand.
1430%
1431*/
1432WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1433{
1434  Image
1435    *coalesce_image;
1436
1437  assert(wand != (MagickWand *) NULL);
1438  assert(wand->signature == WandSignature);
1439  if (wand->debug != MagickFalse)
1440    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1441  if (wand->images == (Image *) NULL)
1442    return((MagickWand *) NULL);
1443  coalesce_image=CoalesceImages(wand->images,wand->exception);
1444  if (coalesce_image == (Image *) NULL)
1445    return((MagickWand *) NULL);
1446  return(CloneMagickWandFromImages(wand,coalesce_image));
1447}
1448
1449/*
1450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1451%                                                                             %
1452%                                                                             %
1453%                                                                             %
1454%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1455%                                                                             %
1456%                                                                             %
1457%                                                                             %
1458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1459%
1460%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1461%  Collection (CCC) file which solely contains one or more color corrections
1462%  and applies the color correction to the image.  Here is a sample CCC file:
1463%
1464%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1465%          <ColorCorrection id="cc03345">
1466%                <SOPNode>
1467%                     <Slope> 0.9 1.2 0.5 </Slope>
1468%                     <Offset> 0.4 -0.5 0.6 </Offset>
1469%                     <Power> 1.0 0.8 1.5 </Power>
1470%                </SOPNode>
1471%                <SATNode>
1472%                     <Saturation> 0.85 </Saturation>
1473%                </SATNode>
1474%          </ColorCorrection>
1475%    </ColorCorrectionCollection>
1476%
1477%  which includes the offset, slope, and power for each of the RGB channels
1478%  as well as the saturation.
1479%
1480%  The format of the MagickColorDecisionListImage method is:
1481%
1482%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1483%        const double gamma)
1484%
1485%  A description of each parameter follows:
1486%
1487%    o wand: the magick wand.
1488%
1489%    o color_correction_collection: the color correction collection in XML.
1490%
1491*/
1492WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1493  const char *color_correction_collection)
1494{
1495  MagickBooleanType
1496    status;
1497
1498  assert(wand != (MagickWand *) NULL);
1499  assert(wand->signature == WandSignature);
1500  if (wand->debug != MagickFalse)
1501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1502  if (wand->images == (Image *) NULL)
1503    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1504  status=ColorDecisionListImage(wand->images,color_correction_collection);
1505  if (status == MagickFalse)
1506    InheritException(wand->exception,&wand->images->exception);
1507  return(status);
1508}
1509
1510/*
1511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512%                                                                             %
1513%                                                                             %
1514%                                                                             %
1515%   M a g i c k C o l o r i z e I m a g e                                     %
1516%                                                                             %
1517%                                                                             %
1518%                                                                             %
1519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520%
1521%  MagickColorizeImage() blends the fill color with each pixel in the image.
1522%
1523%  The format of the MagickColorizeImage method is:
1524%
1525%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1526%        const PixelWand *colorize,const PixelWand *opacity)
1527%
1528%  A description of each parameter follows:
1529%
1530%    o wand: the magick wand.
1531%
1532%    o colorize: the colorize pixel wand.
1533%
1534%    o opacity: the opacity pixel wand.
1535%
1536*/
1537WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1538  const PixelWand *colorize,const PixelWand *opacity)
1539{
1540  char
1541    percent_opaque[MaxTextExtent];
1542
1543  Image
1544    *colorize_image;
1545
1546  PixelPacket
1547    target;
1548
1549  assert(wand != (MagickWand *) NULL);
1550  assert(wand->signature == WandSignature);
1551  if (wand->debug != MagickFalse)
1552    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1553  if (wand->images == (Image *) NULL)
1554    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1555  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1556    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1557    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1558    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1559    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1560    PixelGetOpacityQuantum(opacity)));
1561  PixelGetQuantumPacket(colorize,&target);
1562  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1563    wand->exception);
1564  if (colorize_image == (Image *) NULL)
1565    return(MagickFalse);
1566  ReplaceImageInList(&wand->images,colorize_image);
1567  return(MagickTrue);
1568}
1569
1570/*
1571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572%                                                                             %
1573%                                                                             %
1574%                                                                             %
1575%   M a g i c k C o l o r M a t r i x I m a g e                               %
1576%                                                                             %
1577%                                                                             %
1578%                                                                             %
1579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1580%
1581%  MagickColorMatrixImage() apply color transformation to an image. The method
1582%  permits saturation changes, hue rotation, luminance to alpha, and various
1583%  other effects.  Although variable-sized transformation matrices can be used,
1584%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1585%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1586%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1587%  and offsets are normalized (divide Flash offset by 255).
1588%
1589%  The format of the MagickColorMatrixImage method is:
1590%
1591%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1592%        const KernelInfo *color_matrix)
1593%
1594%  A description of each parameter follows:
1595%
1596%    o wand: the magick wand.
1597%
1598%    o color_matrix:  the color matrix.
1599%
1600*/
1601WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1602  const KernelInfo *color_matrix)
1603{
1604  Image
1605    *color_image;
1606
1607  assert(wand != (MagickWand *) NULL);
1608  assert(wand->signature == WandSignature);
1609  if (wand->debug != MagickFalse)
1610    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1611  if (color_matrix == (const KernelInfo *) NULL)
1612    return(MagickFalse);
1613  if (wand->images == (Image *) NULL)
1614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1615  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1616  if (color_image == (Image *) NULL)
1617    return(MagickFalse);
1618  ReplaceImageInList(&wand->images,color_image);
1619  return(MagickTrue);
1620}
1621
1622/*
1623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1624%                                                                             %
1625%                                                                             %
1626%                                                                             %
1627%   M a g i c k C o m b i n e I m a g e s                                     %
1628%                                                                             %
1629%                                                                             %
1630%                                                                             %
1631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1632%
1633%  MagickCombineImages() combines one or more images into a single image.  The
1634%  grayscale value of the pixels of each image in the sequence is assigned in
1635%  order to the specified  hannels of the combined image.   The typical
1636%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1637%
1638%  The format of the MagickCombineImages method is:
1639%
1640%      MagickWand *MagickCombineImages(MagickWand *wand,
1641%        const ChannelType channel)
1642%
1643%  A description of each parameter follows:
1644%
1645%    o wand: the magick wand.
1646%
1647%    o channel: the channel.
1648%
1649*/
1650WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1651  const ChannelType channel)
1652{
1653  Image
1654    *combine_image;
1655
1656  assert(wand != (MagickWand *) NULL);
1657  assert(wand->signature == WandSignature);
1658  if (wand->debug != MagickFalse)
1659    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1660  if (wand->images == (Image *) NULL)
1661    return((MagickWand *) NULL);
1662  combine_image=CombineImages(wand->images,channel,wand->exception);
1663  if (combine_image == (Image *) NULL)
1664    return((MagickWand *) NULL);
1665  return(CloneMagickWandFromImages(wand,combine_image));
1666}
1667
1668/*
1669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1670%                                                                             %
1671%                                                                             %
1672%                                                                             %
1673%   M a g i c k C o m m e n t I m a g e                                       %
1674%                                                                             %
1675%                                                                             %
1676%                                                                             %
1677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1678%
1679%  MagickCommentImage() adds a comment to your image.
1680%
1681%  The format of the MagickCommentImage method is:
1682%
1683%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1684%        const char *comment)
1685%
1686%  A description of each parameter follows:
1687%
1688%    o wand: the magick wand.
1689%
1690%    o comment: the image comment.
1691%
1692*/
1693WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1694  const char *comment)
1695{
1696  MagickBooleanType
1697    status;
1698
1699  assert(wand != (MagickWand *) NULL);
1700  assert(wand->signature == WandSignature);
1701  if (wand->debug != MagickFalse)
1702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1703  if (wand->images == (Image *) NULL)
1704    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1705  status=SetImageProperty(wand->images,"comment",comment);
1706  if (status == MagickFalse)
1707    InheritException(wand->exception,&wand->images->exception);
1708  return(status);
1709}
1710
1711/*
1712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1713%                                                                             %
1714%                                                                             %
1715%                                                                             %
1716%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1717%                                                                             %
1718%                                                                             %
1719%                                                                             %
1720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1721%
1722%  MagickCompareImagesLayers() compares each image with the next in a sequence
1723%  and returns the maximum bounding region of any pixel differences it
1724%  discovers.
1725%
1726%  The format of the MagickCompareImagesLayers method is:
1727%
1728%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1729%        const ImageLayerMethod method)
1730%
1731%  A description of each parameter follows:
1732%
1733%    o wand: the magick wand.
1734%
1735%    o method: the compare method.
1736%
1737*/
1738WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1739  const ImageLayerMethod method)
1740{
1741  Image
1742    *layers_image;
1743
1744  assert(wand != (MagickWand *) NULL);
1745  assert(wand->signature == WandSignature);
1746  if (wand->debug != MagickFalse)
1747    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1748  if (wand->images == (Image *) NULL)
1749    return((MagickWand *) NULL);
1750  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1751  if (layers_image == (Image *) NULL)
1752    return((MagickWand *) NULL);
1753  return(CloneMagickWandFromImages(wand,layers_image));
1754}
1755
1756/*
1757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1758%                                                                             %
1759%                                                                             %
1760%                                                                             %
1761%   M a g i c k C o m p a r e I m a g e s                                     %
1762%                                                                             %
1763%                                                                             %
1764%                                                                             %
1765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1766%
1767%  MagickCompareImages() compares an image to a reconstructed image and returns
1768%  the specified difference image.
1769%
1770%  The format of the MagickCompareImages method is:
1771%
1772%      MagickWand *MagickCompareImages(MagickWand *wand,
1773%        const MagickWand *reference,const MetricType metric,
1774%        double *distortion)
1775%
1776%  A description of each parameter follows:
1777%
1778%    o wand: the magick wand.
1779%
1780%    o reference: the reference wand.
1781%
1782%    o metric: the metric.
1783%
1784%    o distortion: the computed distortion between the images.
1785%
1786*/
1787WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1788  const MagickWand *reference,const MetricType metric,double *distortion)
1789{
1790  Image
1791    *compare_image;
1792
1793
1794  assert(wand != (MagickWand *) NULL);
1795  assert(wand->signature == WandSignature);
1796  if (wand->debug != MagickFalse)
1797    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1798  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1799    {
1800      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1801        "ContainsNoImages","`%s'",wand->name);
1802      return((MagickWand *) NULL);
1803    }
1804  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1805    &wand->images->exception);
1806  if (compare_image == (Image *) NULL)
1807    return((MagickWand *) NULL);
1808  return(CloneMagickWandFromImages(wand,compare_image));
1809}
1810
1811/*
1812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1813%                                                                             %
1814%                                                                             %
1815%                                                                             %
1816%   M a g i c k C o m p o s i t e I m a g e                                   %
1817%                                                                             %
1818%                                                                             %
1819%                                                                             %
1820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1821%
1822%  MagickCompositeImage() composite one image onto another at the specified
1823%  offset.
1824%
1825%  The format of the MagickCompositeImage method is:
1826%
1827%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1828%        const MagickWand *composite_wand,const CompositeOperator compose,
1829%        const ssize_t x,const ssize_t y)
1830%      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1831%        const ChannelType channel,const MagickWand *composite_wand,
1832%        const CompositeOperator compose,const ssize_t x,const ssize_t y)
1833%
1834%  A description of each parameter follows:
1835%
1836%    o wand: the magick wand.
1837%
1838%    o composite_image: the composite image.
1839%
1840%    o compose: This operator affects how the composite is applied to the
1841%      image.  The default is Over.  Choose from these operators:
1842%
1843%        OverCompositeOp       InCompositeOp         OutCompositeOp
1844%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1845%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1846%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1847%        DisplaceCompositeOp
1848%
1849%    o x: the column offset of the composited image.
1850%
1851%    o y: the row offset of the composited image.
1852%
1853*/
1854
1855WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1856  const MagickWand *composite_wand,const CompositeOperator compose,const ssize_t x,
1857  const ssize_t y)
1858{
1859  MagickBooleanType
1860    status;
1861
1862  status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1863    compose,x,y);
1864  return(status);
1865}
1866
1867WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1868  const ChannelType channel,const MagickWand *composite_wand,
1869  const CompositeOperator compose,const ssize_t x,const ssize_t y)
1870{
1871  MagickBooleanType
1872    status;
1873
1874  assert(wand != (MagickWand *) NULL);
1875  assert(wand->signature == WandSignature);
1876  if (wand->debug != MagickFalse)
1877    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1878  if ((wand->images == (Image *) NULL) ||
1879      (composite_wand->images == (Image *) NULL))
1880    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1881  status=CompositeImageChannel(wand->images,channel,compose,
1882    composite_wand->images,x,y);
1883  if (status == MagickFalse)
1884    InheritException(wand->exception,&wand->images->exception);
1885  return(status);
1886}
1887
1888/*
1889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1890%                                                                             %
1891%                                                                             %
1892%                                                                             %
1893%   M a g i c k C o n t r a s t I m a g e                                     %
1894%                                                                             %
1895%                                                                             %
1896%                                                                             %
1897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1898%
1899%  MagickContrastImage() enhances the intensity differences between the lighter
1900%  and darker elements of the image.  Set sharpen to a value other than 0 to
1901%  increase the image contrast otherwise the contrast is reduced.
1902%
1903%  The format of the MagickContrastImage method is:
1904%
1905%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1906%        const MagickBooleanType sharpen)
1907%
1908%  A description of each parameter follows:
1909%
1910%    o wand: the magick wand.
1911%
1912%    o sharpen: Increase or decrease image contrast.
1913%
1914%
1915*/
1916WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1917  const MagickBooleanType sharpen)
1918{
1919  MagickBooleanType
1920    status;
1921
1922  assert(wand != (MagickWand *) NULL);
1923  assert(wand->signature == WandSignature);
1924  if (wand->debug != MagickFalse)
1925    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1926  if (wand->images == (Image *) NULL)
1927    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1928  status=ContrastImage(wand->images,sharpen);
1929  if (status == MagickFalse)
1930    InheritException(wand->exception,&wand->images->exception);
1931  return(status);
1932}
1933
1934/*
1935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1936%                                                                             %
1937%                                                                             %
1938%                                                                             %
1939%   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                       %
1940%                                                                             %
1941%                                                                             %
1942%                                                                             %
1943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1944%
1945%  MagickContrastStretchImage() enhances the contrast of a color image by
1946%  adjusting the pixels color to span the entire range of colors available.
1947%  You can also reduce the influence of a particular channel with a gamma
1948%  value of 0.
1949%
1950%  The format of the MagickContrastStretchImage method is:
1951%
1952%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1953%        const double black_point,const double white_point)
1954%      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
1955%        const ChannelType channel,const double black_point,
1956%        const double white_point)
1957%
1958%  A description of each parameter follows:
1959%
1960%    o wand: the magick wand.
1961%
1962%    o channel: the image channel(s).
1963%
1964%    o black_point: the black point.
1965%
1966%    o white_point: the white point.
1967%
1968*/
1969
1970WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1971  const double black_point,const double white_point)
1972{
1973  MagickBooleanType
1974    status;
1975
1976  status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
1977    white_point);
1978  return(status);
1979}
1980
1981WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
1982  const ChannelType channel,const double black_point,const double white_point)
1983{
1984  MagickBooleanType
1985    status;
1986
1987  assert(wand != (MagickWand *) NULL);
1988  assert(wand->signature == WandSignature);
1989  if (wand->debug != MagickFalse)
1990    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1991  if (wand->images == (Image *) NULL)
1992    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1993  status=ContrastStretchImageChannel(wand->images,channel,black_point,
1994    white_point);
1995  if (status == MagickFalse)
1996    InheritException(wand->exception,&wand->images->exception);
1997  return(status);
1998}
1999
2000/*
2001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2002%                                                                             %
2003%                                                                             %
2004%                                                                             %
2005%   M a g i c k C o n v o l v e I m a g e                                     %
2006%                                                                             %
2007%                                                                             %
2008%                                                                             %
2009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010%
2011%  MagickConvolveImage() applies a custom convolution kernel to the image.
2012%
2013%  The format of the MagickConvolveImage method is:
2014%
2015%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2016%        const size_t order,const double *kernel)
2017%      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2018%        const ChannelType channel,const size_t order,
2019%        const double *kernel)
2020%
2021%  A description of each parameter follows:
2022%
2023%    o wand: the magick wand.
2024%
2025%    o channel: the image channel(s).
2026%
2027%    o order: the number of columns and rows in the filter kernel.
2028%
2029%    o kernel: An array of doubles representing the convolution kernel.
2030%
2031*/
2032
2033WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2034  const size_t order,const double *kernel)
2035{
2036  MagickBooleanType
2037    status;
2038
2039  status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2040  return(status);
2041}
2042
2043WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2044  const ChannelType channel,const size_t order,const double *kernel)
2045{
2046  Image
2047    *convolve_image;
2048
2049  assert(wand != (MagickWand *) NULL);
2050  assert(wand->signature == WandSignature);
2051  if (wand->debug != MagickFalse)
2052    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2053  if (kernel == (const double *) NULL)
2054    return(MagickFalse);
2055  if (wand->images == (Image *) NULL)
2056    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2057  convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2058    wand->exception);
2059  if (convolve_image == (Image *) NULL)
2060    return(MagickFalse);
2061  ReplaceImageInList(&wand->images,convolve_image);
2062  return(MagickTrue);
2063}
2064
2065/*
2066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2067%                                                                             %
2068%                                                                             %
2069%                                                                             %
2070%   M a g i c k C r o p I m a g e                                             %
2071%                                                                             %
2072%                                                                             %
2073%                                                                             %
2074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2075%
2076%  MagickCropImage() extracts a region of the image.
2077%
2078%  The format of the MagickCropImage method is:
2079%
2080%      MagickBooleanType MagickCropImage(MagickWand *wand,
2081%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2082%
2083%  A description of each parameter follows:
2084%
2085%    o wand: the magick wand.
2086%
2087%    o width: the region width.
2088%
2089%    o height: the region height.
2090%
2091%    o x: the region x-offset.
2092%
2093%    o y: the region y-offset.
2094%
2095*/
2096WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2097  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2098{
2099  Image
2100    *crop_image;
2101
2102  RectangleInfo
2103    crop;
2104
2105  assert(wand != (MagickWand *) NULL);
2106  assert(wand->signature == WandSignature);
2107  if (wand->debug != MagickFalse)
2108    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2109  if (wand->images == (Image *) NULL)
2110    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2111  crop.width=width;
2112  crop.height=height;
2113  crop.x=x;
2114  crop.y=y;
2115  crop_image=CropImage(wand->images,&crop,wand->exception);
2116  if (crop_image == (Image *) NULL)
2117    return(MagickFalse);
2118  ReplaceImageInList(&wand->images,crop_image);
2119  return(MagickTrue);
2120}
2121
2122/*
2123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2124%                                                                             %
2125%                                                                             %
2126%                                                                             %
2127%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2128%                                                                             %
2129%                                                                             %
2130%                                                                             %
2131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2132%
2133%  MagickCycleColormapImage() displaces an image's colormap by a given number
2134%  of positions.  If you cycle the colormap a number of times you can produce
2135%  a psychodelic effect.
2136%
2137%  The format of the MagickCycleColormapImage method is:
2138%
2139%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2140%        const ssize_t displace)
2141%
2142%  A description of each parameter follows:
2143%
2144%    o wand: the magick wand.
2145%
2146%    o pixel_wand: the pixel wand.
2147%
2148*/
2149WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2150  const ssize_t displace)
2151{
2152  MagickBooleanType
2153    status;
2154
2155  assert(wand != (MagickWand *) NULL);
2156  assert(wand->signature == WandSignature);
2157  if (wand->debug != MagickFalse)
2158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2159  if (wand->images == (Image *) NULL)
2160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2161  status=CycleColormapImage(wand->images,displace);
2162  if (status == MagickFalse)
2163    InheritException(wand->exception,&wand->images->exception);
2164  return(status);
2165}
2166
2167/*
2168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169%                                                                             %
2170%                                                                             %
2171%                                                                             %
2172%   M a g i c k C o n s t i t u t e I m a g e                                 %
2173%                                                                             %
2174%                                                                             %
2175%                                                                             %
2176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177%
2178%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2179%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2180%  The data can be char, short int, int, float, or double.  Float and double
2181%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2182%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2183%  example, to create a 640x480 image from unsigned red-green-blue character
2184%  data, use
2185%
2186%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2187%
2188%  The format of the MagickConstituteImage method is:
2189%
2190%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2191%        const size_t columns,const size_t rows,const char *map,
2192%        const StorageType storage,void *pixels)
2193%
2194%  A description of each parameter follows:
2195%
2196%    o wand: the magick wand.
2197%
2198%    o columns: width in pixels of the image.
2199%
2200%    o rows: height in pixels of the image.
2201%
2202%    o map:  This string reflects the expected ordering of the pixel array.
2203%      It can be any combination or order of R = red, G = green, B = blue,
2204%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2205%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2206%      P = pad.
2207%
2208%    o storage: Define the data type of the pixels.  Float and double types are
2209%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2210%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2211%      LongPixel, QuantumPixel, or ShortPixel.
2212%
2213%    o pixels: This array of values contain the pixel components as defined by
2214%      map and type.  You must preallocate this array where the expected
2215%      length varies depending on the values of width, height, map, and type.
2216%
2217%
2218*/
2219WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2220  const size_t columns,const size_t rows,const char *map,
2221  const StorageType storage,const void *pixels)
2222{
2223  Image
2224    *images;
2225
2226  assert(wand != (MagickWand *) NULL);
2227  assert(wand->signature == WandSignature);
2228  if (wand->debug != MagickFalse)
2229    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2230  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2231  if (images == (Image *) NULL)
2232    return(MagickFalse);
2233  return(InsertImageInWand(wand,images));
2234}
2235
2236/*
2237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2238%                                                                             %
2239%                                                                             %
2240%                                                                             %
2241%   M a g i c k D e c i p h e r I m a g e                                     %
2242%                                                                             %
2243%                                                                             %
2244%                                                                             %
2245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246%
2247%  MagickDecipherImage() converts cipher pixels to plain pixels.
2248%
2249%  The format of the MagickDecipherImage method is:
2250%
2251%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2252%        const char *passphrase)
2253%
2254%  A description of each parameter follows:
2255%
2256%    o wand: the magick wand.
2257%
2258%    o passphrase: the passphrase.
2259%
2260*/
2261WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2262  const char *passphrase)
2263{
2264  assert(wand != (MagickWand *) NULL);
2265  assert(wand->signature == WandSignature);
2266  if (wand->debug != MagickFalse)
2267    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2268  if (wand->images == (Image *) NULL)
2269    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2270  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2271}
2272
2273/*
2274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2275%                                                                             %
2276%                                                                             %
2277%                                                                             %
2278%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2279%                                                                             %
2280%                                                                             %
2281%                                                                             %
2282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2283%
2284%  MagickDeconstructImages() compares each image with the next in a sequence
2285%  and returns the maximum bounding region of any pixel differences it
2286%  discovers.
2287%
2288%  The format of the MagickDeconstructImages method is:
2289%
2290%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2291%
2292%  A description of each parameter follows:
2293%
2294%    o wand: the magick wand.
2295%
2296*/
2297WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2298{
2299  Image
2300    *deconstruct_image;
2301
2302  assert(wand != (MagickWand *) NULL);
2303  assert(wand->signature == WandSignature);
2304  if (wand->debug != MagickFalse)
2305    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2306  if (wand->images == (Image *) NULL)
2307    return((MagickWand *) NULL);
2308  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2309    wand->exception);
2310  if (deconstruct_image == (Image *) NULL)
2311    return((MagickWand *) NULL);
2312  return(CloneMagickWandFromImages(wand,deconstruct_image));
2313}
2314
2315/*
2316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2317%                                                                             %
2318%                                                                             %
2319%                                                                             %
2320%     M a g i c k D e s k e w I m a g e                                       %
2321%                                                                             %
2322%                                                                             %
2323%                                                                             %
2324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2325%
2326%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2327%  occurs in scanned images because of the camera being misaligned,
2328%  imperfections in the scanning or surface, or simply because the paper was
2329%  not placed completely flat when scanned.
2330%
2331%  The format of the MagickDeskewImage method is:
2332%
2333%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2334%        const double threshold)
2335%
2336%  A description of each parameter follows:
2337%
2338%    o wand: the magick wand.
2339%
2340%    o threshold: separate background from foreground.
2341%
2342*/
2343WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2344  const double threshold)
2345{
2346  Image
2347    *sepia_image;
2348
2349  assert(wand != (MagickWand *) NULL);
2350  assert(wand->signature == WandSignature);
2351  if (wand->debug != MagickFalse)
2352    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2353  if (wand->images == (Image *) NULL)
2354    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2355  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2356  if (sepia_image == (Image *) NULL)
2357    return(MagickFalse);
2358  ReplaceImageInList(&wand->images,sepia_image);
2359  return(MagickTrue);
2360}
2361
2362/*
2363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2364%                                                                             %
2365%                                                                             %
2366%                                                                             %
2367%     M a g i c k D e s p e c k l e I m a g e                                 %
2368%                                                                             %
2369%                                                                             %
2370%                                                                             %
2371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2372%
2373%  MagickDespeckleImage() reduces the speckle noise in an image while
2374%  perserving the edges of the original image.
2375%
2376%  The format of the MagickDespeckleImage method is:
2377%
2378%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2379%
2380%  A description of each parameter follows:
2381%
2382%    o wand: the magick wand.
2383%
2384*/
2385WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2386{
2387  Image
2388    *despeckle_image;
2389
2390  assert(wand != (MagickWand *) NULL);
2391  assert(wand->signature == WandSignature);
2392  if (wand->debug != MagickFalse)
2393    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2394  if (wand->images == (Image *) NULL)
2395    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2396  despeckle_image=DespeckleImage(wand->images,wand->exception);
2397  if (despeckle_image == (Image *) NULL)
2398    return(MagickFalse);
2399  ReplaceImageInList(&wand->images,despeckle_image);
2400  return(MagickTrue);
2401}
2402
2403/*
2404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2405%                                                                             %
2406%                                                                             %
2407%                                                                             %
2408%   M a g i c k D e s t r o y I m a g e                                       %
2409%                                                                             %
2410%                                                                             %
2411%                                                                             %
2412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2413%
2414%  MagickDestroyImage() dereferences an image, deallocating memory associated
2415%  with the image if the reference count becomes zero.
2416%
2417%  The format of the MagickDestroyImage method is:
2418%
2419%      Image *MagickDestroyImage(Image *image)
2420%
2421%  A description of each parameter follows:
2422%
2423%    o image: the image.
2424%
2425*/
2426WandExport Image *MagickDestroyImage(Image *image)
2427{
2428  return(DestroyImage(image));
2429}
2430
2431/*
2432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2433%                                                                             %
2434%                                                                             %
2435%                                                                             %
2436%   M a g i c k D i s p l a y I m a g e                                       %
2437%                                                                             %
2438%                                                                             %
2439%                                                                             %
2440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2441%
2442%  MagickDisplayImage() displays an image.
2443%
2444%  The format of the MagickDisplayImage method is:
2445%
2446%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2447%        const char *server_name)
2448%
2449%  A description of each parameter follows:
2450%
2451%    o wand: the magick wand.
2452%
2453%    o server_name: the X server name.
2454%
2455*/
2456WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2457  const char *server_name)
2458{
2459  Image
2460    *image;
2461
2462  MagickBooleanType
2463    status;
2464
2465  assert(wand != (MagickWand *) NULL);
2466  assert(wand->signature == WandSignature);
2467  if (wand->debug != MagickFalse)
2468    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2469  if (wand->images == (Image *) NULL)
2470    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2471  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2472  if (image == (Image *) NULL)
2473    return(MagickFalse);
2474  (void) CloneString(&wand->image_info->server_name,server_name);
2475  status=DisplayImages(wand->image_info,image);
2476  if (status == MagickFalse)
2477    InheritException(wand->exception,&image->exception);
2478  image=DestroyImage(image);
2479  return(status);
2480}
2481
2482/*
2483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2484%                                                                             %
2485%                                                                             %
2486%                                                                             %
2487%   M a g i c k D i s p l a y I m a g e s                                     %
2488%                                                                             %
2489%                                                                             %
2490%                                                                             %
2491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2492%
2493%  MagickDisplayImages() displays an image or image sequence.
2494%
2495%  The format of the MagickDisplayImages method is:
2496%
2497%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2498%        const char *server_name)
2499%
2500%  A description of each parameter follows:
2501%
2502%    o wand: the magick wand.
2503%
2504%    o server_name: the X server name.
2505%
2506*/
2507WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2508  const char *server_name)
2509{
2510  MagickBooleanType
2511    status;
2512
2513  assert(wand != (MagickWand *) NULL);
2514  assert(wand->signature == WandSignature);
2515  if (wand->debug != MagickFalse)
2516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2517  (void) CloneString(&wand->image_info->server_name,server_name);
2518  status=DisplayImages(wand->image_info,wand->images);
2519  if (status == MagickFalse)
2520    InheritException(wand->exception,&wand->images->exception);
2521  return(status);
2522}
2523
2524/*
2525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2526%                                                                             %
2527%                                                                             %
2528%                                                                             %
2529%   M a g i c k D i s t o r t I m a g e                                       %
2530%                                                                             %
2531%                                                                             %
2532%                                                                             %
2533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2534%
2535%  MagickDistortImage() distorts an image using various distortion methods, by
2536%  mapping color lookups of the source image to a new destination image
2537%  usally of the same size as the source image, unless 'bestfit' is set to
2538%  true.
2539%
2540%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2541%  adjusted to ensure the whole source 'image' will just fit within the final
2542%  destination image, which will be sized and offset accordingly.  Also in
2543%  many cases the virtual offset of the source image will be taken into
2544%  account in the mapping.
2545%
2546%  The format of the MagickDistortImage method is:
2547%
2548%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2549%        const DistortImageMethod method,const size_t number_arguments,
2550%        const double *arguments,const MagickBooleanType bestfit)
2551%
2552%  A description of each parameter follows:
2553%
2554%    o image: the image to be distorted.
2555%
2556%    o method: the method of image distortion.
2557%
2558%        ArcDistortion always ignores the source image offset, and always
2559%        'bestfit' the destination image with the top left corner offset
2560%        relative to the polar mapping center.
2561%
2562%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2563%        style of image distortion.
2564%
2565%        Affine, Perspective, and Bilinear, do least squares fitting of the
2566%        distortion when more than the minimum number of control point pairs
2567%        are provided.
2568%
2569%        Perspective, and Bilinear, falls back to a Affine distortion when less
2570%        that 4 control point pairs are provided. While Affine distortions let
2571%        you use any number of control point pairs, that is Zero pairs is a
2572%        no-Op (viewport only) distrotion, one pair is a translation and two
2573%        pairs of control points do a scale-rotate-translate, without any
2574%        shearing.
2575%
2576%    o number_arguments: the number of arguments given for this distortion
2577%      method.
2578%
2579%    o arguments: the arguments for this distortion method.
2580%
2581%    o bestfit: Attempt to resize destination to fit distorted source.
2582%
2583*/
2584WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2585  const DistortImageMethod method,const size_t number_arguments,
2586  const double *arguments,const MagickBooleanType bestfit)
2587{
2588  Image
2589    *distort_image;
2590
2591  assert(wand != (MagickWand *) NULL);
2592  assert(wand->signature == WandSignature);
2593  if (wand->debug != MagickFalse)
2594    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2595  if (wand->images == (Image *) NULL)
2596    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2597  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2598    bestfit,wand->exception);
2599  if (distort_image == (Image *) NULL)
2600    return(MagickFalse);
2601  ReplaceImageInList(&wand->images,distort_image);
2602  return(MagickTrue);
2603}
2604
2605/*
2606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2607%                                                                             %
2608%                                                                             %
2609%                                                                             %
2610%   M a g i c k D r a w I m a g e                                             %
2611%                                                                             %
2612%                                                                             %
2613%                                                                             %
2614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2615%
2616%  MagickDrawImage() renders the drawing wand on the current image.
2617%
2618%  The format of the MagickDrawImage method is:
2619%
2620%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2621%        const DrawingWand *drawing_wand)
2622%
2623%  A description of each parameter follows:
2624%
2625%    o wand: the magick wand.
2626%
2627%    o drawing_wand: the draw wand.
2628%
2629*/
2630WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2631  const DrawingWand *drawing_wand)
2632{
2633  char
2634    *primitive;
2635
2636  DrawInfo
2637    *draw_info;
2638
2639  MagickBooleanType
2640    status;
2641
2642  assert(wand != (MagickWand *) NULL);
2643  assert(wand->signature == WandSignature);
2644  if (wand->debug != MagickFalse)
2645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2646  if (wand->images == (Image *) NULL)
2647    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2648  draw_info=PeekDrawingWand(drawing_wand);
2649  if ((draw_info == (DrawInfo *) NULL) ||
2650      (draw_info->primitive == (char *) NULL))
2651    return(MagickFalse);
2652  primitive=AcquireString(draw_info->primitive);
2653  draw_info=DestroyDrawInfo(draw_info);
2654  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2655  draw_info->primitive=primitive;
2656  status=DrawImage(wand->images,draw_info);
2657  if (status == MagickFalse)
2658    InheritException(wand->exception,&wand->images->exception);
2659  draw_info=DestroyDrawInfo(draw_info);
2660  return(status);
2661}
2662
2663/*
2664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2665%                                                                             %
2666%                                                                             %
2667%                                                                             %
2668%   M a g i c k E d g e I m a g e                                             %
2669%                                                                             %
2670%                                                                             %
2671%                                                                             %
2672%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2673%
2674%  MagickEdgeImage() enhance edges within the image with a convolution filter
2675%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2676%  radius for you.
2677%
2678%  The format of the MagickEdgeImage method is:
2679%
2680%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2681%
2682%  A description of each parameter follows:
2683%
2684%    o wand: the magick wand.
2685%
2686%    o radius: the radius of the pixel neighborhood.
2687%
2688*/
2689WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2690  const double radius)
2691{
2692  Image
2693    *edge_image;
2694
2695  assert(wand != (MagickWand *) NULL);
2696  assert(wand->signature == WandSignature);
2697  if (wand->debug != MagickFalse)
2698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2699  if (wand->images == (Image *) NULL)
2700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2701  edge_image=EdgeImage(wand->images,radius,wand->exception);
2702  if (edge_image == (Image *) NULL)
2703    return(MagickFalse);
2704  ReplaceImageInList(&wand->images,edge_image);
2705  return(MagickTrue);
2706}
2707
2708/*
2709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710%                                                                             %
2711%                                                                             %
2712%                                                                             %
2713%   M a g i c k E m b o s s I m a g e                                         %
2714%                                                                             %
2715%                                                                             %
2716%                                                                             %
2717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2718%
2719%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2720%  effect.  We convolve the image with a Gaussian operator of the given radius
2721%  and standard deviation (sigma).  For reasonable results, radius should be
2722%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2723%  radius for you.
2724%
2725%  The format of the MagickEmbossImage method is:
2726%
2727%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2728%        const double sigma)
2729%
2730%  A description of each parameter follows:
2731%
2732%    o wand: the magick wand.
2733%
2734%    o radius: the radius of the Gaussian, in pixels, not counting the center
2735%      pixel.
2736%
2737%    o sigma: the standard deviation of the Gaussian, in pixels.
2738%
2739*/
2740WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2741  const double radius,const double sigma)
2742{
2743  Image
2744    *emboss_image;
2745
2746  assert(wand != (MagickWand *) NULL);
2747  assert(wand->signature == WandSignature);
2748  if (wand->debug != MagickFalse)
2749    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2750  if (wand->images == (Image *) NULL)
2751    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2752  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2753  if (emboss_image == (Image *) NULL)
2754    return(MagickFalse);
2755  ReplaceImageInList(&wand->images,emboss_image);
2756  return(MagickTrue);
2757}
2758
2759/*
2760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2761%                                                                             %
2762%                                                                             %
2763%                                                                             %
2764%   M a g i c k E n c i p h e r I m a g e                                     %
2765%                                                                             %
2766%                                                                             %
2767%                                                                             %
2768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2769%
2770%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2771%
2772%  The format of the MagickEncipherImage method is:
2773%
2774%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2775%        const char *passphrase)
2776%
2777%  A description of each parameter follows:
2778%
2779%    o wand: the magick wand.
2780%
2781%    o passphrase: the passphrase.
2782%
2783*/
2784WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2785  const char *passphrase)
2786{
2787  assert(wand != (MagickWand *) NULL);
2788  assert(wand->signature == WandSignature);
2789  if (wand->debug != MagickFalse)
2790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2791  if (wand->images == (Image *) NULL)
2792    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2793  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2794}
2795
2796/*
2797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2798%                                                                             %
2799%                                                                             %
2800%                                                                             %
2801%   M a g i c k E n h a n c e I m a g e                                       %
2802%                                                                             %
2803%                                                                             %
2804%                                                                             %
2805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2806%
2807%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2808%  noisy image.
2809%
2810%  The format of the MagickEnhanceImage method is:
2811%
2812%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2813%
2814%  A description of each parameter follows:
2815%
2816%    o wand: the magick wand.
2817%
2818*/
2819WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2820{
2821  Image
2822    *enhance_image;
2823
2824  assert(wand != (MagickWand *) NULL);
2825  assert(wand->signature == WandSignature);
2826  if (wand->debug != MagickFalse)
2827    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2828  if (wand->images == (Image *) NULL)
2829    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2830  enhance_image=EnhanceImage(wand->images,wand->exception);
2831  if (enhance_image == (Image *) NULL)
2832    return(MagickFalse);
2833  ReplaceImageInList(&wand->images,enhance_image);
2834  return(MagickTrue);
2835}
2836
2837/*
2838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2839%                                                                             %
2840%                                                                             %
2841%                                                                             %
2842%   M a g i c k E q u a l i z e I m a g e                                     %
2843%                                                                             %
2844%                                                                             %
2845%                                                                             %
2846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2847%
2848%  MagickEqualizeImage() equalizes the image histogram.
2849%
2850%  The format of the MagickEqualizeImage method is:
2851%
2852%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2853%      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2854%        const ChannelType channel)
2855%
2856%  A description of each parameter follows:
2857%
2858%    o wand: the magick wand.
2859%
2860%    o channel: the image channel(s).
2861%
2862*/
2863
2864WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2865{
2866  MagickBooleanType
2867    status;
2868
2869  status=MagickEqualizeImageChannel(wand,DefaultChannels);
2870  return(status);
2871}
2872
2873WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2874  const ChannelType channel)
2875{
2876  MagickBooleanType
2877    status;
2878
2879  assert(wand != (MagickWand *) NULL);
2880  assert(wand->signature == WandSignature);
2881  if (wand->debug != MagickFalse)
2882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2883  if (wand->images == (Image *) NULL)
2884    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2885  status=EqualizeImageChannel(wand->images,channel);
2886  if (status == MagickFalse)
2887    InheritException(wand->exception,&wand->images->exception);
2888  return(status);
2889}
2890
2891/*
2892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2893%                                                                             %
2894%                                                                             %
2895%                                                                             %
2896%   M a g i c k E v a l u a t e I m a g e                                     %
2897%                                                                             %
2898%                                                                             %
2899%                                                                             %
2900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2901%
2902%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2903%  expression to an image.  Use these operators to lighten or darken an image,
2904%  to increase or decrease contrast in an image, or to produce the "negative"
2905%  of an image.
2906%
2907%  The format of the MagickEvaluateImage method is:
2908%
2909%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2910%        const MagickEvaluateOperator operator,const double value)
2911%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2912%        const MagickEvaluateOperator operator)
2913%      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2914%        const ChannelType channel,const MagickEvaluateOperator op,
2915%        const double value)
2916%
2917%  A description of each parameter follows:
2918%
2919%    o wand: the magick wand.
2920%
2921%    o channel: the channel(s).
2922%
2923%    o op: A channel operator.
2924%
2925%    o value: A value value.
2926%
2927*/
2928
2929WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2930  const MagickEvaluateOperator op,const double value)
2931{
2932  MagickBooleanType
2933    status;
2934
2935  assert(wand != (MagickWand *) NULL);
2936  assert(wand->signature == WandSignature);
2937  if (wand->debug != MagickFalse)
2938    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2939  if (wand->images == (Image *) NULL)
2940    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2941  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2942  if (status == MagickFalse)
2943    InheritException(wand->exception,&wand->images->exception);
2944  return(status);
2945}
2946
2947WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2948  const MagickEvaluateOperator op)
2949{
2950  Image
2951    *evaluate_image;
2952
2953  assert(wand != (MagickWand *) NULL);
2954  assert(wand->signature == WandSignature);
2955  if (wand->debug != MagickFalse)
2956    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2957  if (wand->images == (Image *) NULL)
2958    return((MagickWand *) NULL);
2959  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2960  if (evaluate_image == (Image *) NULL)
2961    return((MagickWand *) NULL);
2962  return(CloneMagickWandFromImages(wand,evaluate_image));
2963}
2964
2965WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2966  const ChannelType channel,const MagickEvaluateOperator op,const double value)
2967{
2968  MagickBooleanType
2969    status;
2970
2971  assert(wand != (MagickWand *) NULL);
2972  assert(wand->signature == WandSignature);
2973  if (wand->debug != MagickFalse)
2974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2975  if (wand->images == (Image *) NULL)
2976    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2977  status=EvaluateImageChannel(wand->images,channel,op,value,
2978    &wand->images->exception);
2979  return(status);
2980}
2981
2982/*
2983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2984%                                                                             %
2985%                                                                             %
2986%                                                                             %
2987%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2988%                                                                             %
2989%                                                                             %
2990%                                                                             %
2991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2992%
2993%  MagickExportImagePixels() extracts pixel data from an image and returns it
2994%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2995%  an error is encountered.  The data is returned as char, short int, int,
2996%  ssize_t, float, or double in the order specified by map.
2997%
2998%  Suppose you want to extract the first scanline of a 640x480 image as
2999%  character data in red-green-blue order:
3000%
3001%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3002%
3003%  The format of the MagickExportImagePixels method is:
3004%
3005%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3006%        const ssize_t x,const ssize_t y,const size_t columns,
3007%        const size_t rows,const char *map,const StorageType storage,
3008%        void *pixels)
3009%
3010%  A description of each parameter follows:
3011%
3012%    o wand: the magick wand.
3013%
3014%    o x, y, columns, rows:  These values define the perimeter
3015%      of a region of pixels you want to extract.
3016%
3017%    o map:  This string reflects the expected ordering of the pixel array.
3018%      It can be any combination or order of R = red, G = green, B = blue,
3019%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3020%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3021%      P = pad.
3022%
3023%    o storage: Define the data type of the pixels.  Float and double types are
3024%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3025%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3026%      LongPixel, QuantumPixel, or ShortPixel.
3027%
3028%    o pixels: This array of values contain the pixel components as defined by
3029%      map and type.  You must preallocate this array where the expected
3030%      length varies depending on the values of width, height, map, and type.
3031%
3032*/
3033WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3034  const ssize_t x,const ssize_t y,const size_t columns,
3035  const size_t rows,const char *map,const StorageType storage,
3036  void *pixels)
3037{
3038  MagickBooleanType
3039    status;
3040
3041  assert(wand != (MagickWand *) NULL);
3042  assert(wand->signature == WandSignature);
3043  if (wand->debug != MagickFalse)
3044    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3045  if (wand->images == (Image *) NULL)
3046    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3047  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3048    storage,pixels,wand->exception);
3049  if (status == MagickFalse)
3050    InheritException(wand->exception,&wand->images->exception);
3051  return(status);
3052}
3053
3054/*
3055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3056%                                                                             %
3057%                                                                             %
3058%                                                                             %
3059%   M a g i c k E x t e n t I m a g e                                         %
3060%                                                                             %
3061%                                                                             %
3062%                                                                             %
3063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3064%
3065%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3066%  and wand background color.  Set the (x,y) offset of the geometry to move
3067%  the original wand relative to the extended wand.
3068%
3069%  The format of the MagickExtentImage method is:
3070%
3071%      MagickBooleanType MagickExtentImage(MagickWand *wand,
3072%        const size_t width,const size_t height,const ssize_t x,
3073%        const ssize_t y)
3074%
3075%  A description of each parameter follows:
3076%
3077%    o wand: the magick wand.
3078%
3079%    o width: the region width.
3080%
3081%    o height: the region height.
3082%
3083%    o x: the region x offset.
3084%
3085%    o y: the region y offset.
3086%
3087*/
3088WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3089  const size_t width,const size_t height,const ssize_t x,
3090  const ssize_t y)
3091{
3092  Image
3093    *extent_image;
3094
3095  RectangleInfo
3096    extent;
3097
3098  assert(wand != (MagickWand *) NULL);
3099  assert(wand->signature == WandSignature);
3100  if (wand->debug != MagickFalse)
3101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3102  if (wand->images == (Image *) NULL)
3103    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3104  extent.width=width;
3105  extent.height=height;
3106  extent.x=x;
3107  extent.y=y;
3108  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3109  if (extent_image == (Image *) NULL)
3110    return(MagickFalse);
3111  ReplaceImageInList(&wand->images,extent_image);
3112  return(MagickTrue);
3113}
3114
3115/*
3116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117%                                                                             %
3118%                                                                             %
3119%                                                                             %
3120%   M a g i c k F i l t e r I m a g e                                         %
3121%                                                                             %
3122%                                                                             %
3123%                                                                             %
3124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3125%
3126%  MagickFilterImage() applies a custom convolution kernel to the image.
3127%
3128%  The format of the MagickFilterImage method is:
3129%
3130%      MagickBooleanType MagickFilterImage(MagickWand *wand,
3131%        const KernelInfo *kernel)
3132%      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3133%        const ChannelType channel,const KernelInfo *kernel)
3134%
3135%  A description of each parameter follows:
3136%
3137%    o wand: the magick wand.
3138%
3139%    o channel: the image channel(s).
3140%
3141%    o kernel: An array of doubles representing the convolution kernel.
3142%
3143*/
3144
3145WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3146  const KernelInfo *kernel)
3147{
3148  MagickBooleanType
3149    status;
3150
3151  status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3152  return(status);
3153}
3154
3155WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3156  const ChannelType channel,const KernelInfo *kernel)
3157{
3158  Image
3159    *filter_image;
3160
3161  assert(wand != (MagickWand *) NULL);
3162  assert(wand->signature == WandSignature);
3163  if (wand->debug != MagickFalse)
3164    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3165  if (kernel == (const KernelInfo *) NULL)
3166    return(MagickFalse);
3167  if (wand->images == (Image *) NULL)
3168    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3169  filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3170  if (filter_image == (Image *) NULL)
3171    return(MagickFalse);
3172  ReplaceImageInList(&wand->images,filter_image);
3173  return(MagickTrue);
3174}
3175
3176/*
3177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3178%                                                                             %
3179%                                                                             %
3180%                                                                             %
3181%   M a g i c k F l i p I m a g e                                             %
3182%                                                                             %
3183%                                                                             %
3184%                                                                             %
3185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3186%
3187%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3188%  around the central x-axis.
3189%
3190%  The format of the MagickFlipImage method is:
3191%
3192%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3193%
3194%  A description of each parameter follows:
3195%
3196%    o wand: the magick wand.
3197%
3198*/
3199WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3200{
3201  Image
3202    *flip_image;
3203
3204  assert(wand != (MagickWand *) NULL);
3205  assert(wand->signature == WandSignature);
3206  if (wand->debug != MagickFalse)
3207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3208  if (wand->images == (Image *) NULL)
3209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3210  flip_image=FlipImage(wand->images,wand->exception);
3211  if (flip_image == (Image *) NULL)
3212    return(MagickFalse);
3213  ReplaceImageInList(&wand->images,flip_image);
3214  return(MagickTrue);
3215}
3216
3217/*
3218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3219%                                                                             %
3220%                                                                             %
3221%                                                                             %
3222%   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                         %
3223%                                                                             %
3224%                                                                             %
3225%                                                                             %
3226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3227%
3228%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3229%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3230%  specified, the color value is changed for any neighbor pixel that does not
3231%  match the bordercolor member of image.
3232%
3233%  The format of the MagickFloodfillPaintImage method is:
3234%
3235%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3236%        const ChannelType channel,const PixelWand *fill,const double fuzz,
3237%        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3238%        const MagickBooleanType invert)
3239%
3240%  A description of each parameter follows:
3241%
3242%    o wand: the magick wand.
3243%
3244%    o channel: the channel(s).
3245%
3246%    o fill: the floodfill color pixel wand.
3247%
3248%    o fuzz: By default target must match a particular pixel color
3249%      exactly.  However, in many cases two colors may differ by a small amount.
3250%      The fuzz member of image defines how much tolerance is acceptable to
3251%      consider two colors as the same.  For example, set fuzz to 10 and the
3252%      color red at intensities of 100 and 102 respectively are now interpreted
3253%      as the same color for the purposes of the floodfill.
3254%
3255%    o bordercolor: the border color pixel wand.
3256%
3257%    o x,y: the starting location of the operation.
3258%
3259%    o invert: paint any pixel that does not match the target color.
3260%
3261*/
3262WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3263  const ChannelType channel,const PixelWand *fill,const double fuzz,
3264  const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3265  const MagickBooleanType invert)
3266{
3267  DrawInfo
3268    *draw_info;
3269
3270  MagickBooleanType
3271    status;
3272
3273  PixelInfo
3274    target;
3275
3276  assert(wand != (MagickWand *) NULL);
3277  assert(wand->signature == WandSignature);
3278  if (wand->debug != MagickFalse)
3279    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3280  if (wand->images == (Image *) NULL)
3281    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3282  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3283  PixelGetQuantumPacket(fill,&draw_info->fill);
3284  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3285    y % wand->images->rows,&target,wand->exception);
3286  if (bordercolor != (PixelWand *) NULL)
3287    PixelGetMagickColor(bordercolor,&target);
3288  wand->images->fuzz=fuzz;
3289  status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3290    invert);
3291  if (status == MagickFalse)
3292    InheritException(wand->exception,&wand->images->exception);
3293  draw_info=DestroyDrawInfo(draw_info);
3294  return(status);
3295}
3296
3297/*
3298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3299%                                                                             %
3300%                                                                             %
3301%                                                                             %
3302%   M a g i c k F l o p I m a g e                                             %
3303%                                                                             %
3304%                                                                             %
3305%                                                                             %
3306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3307%
3308%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3309%  around the central y-axis.
3310%
3311%  The format of the MagickFlopImage method is:
3312%
3313%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3314%
3315%  A description of each parameter follows:
3316%
3317%    o wand: the magick wand.
3318%
3319*/
3320WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3321{
3322  Image
3323    *flop_image;
3324
3325  assert(wand != (MagickWand *) NULL);
3326  assert(wand->signature == WandSignature);
3327  if (wand->debug != MagickFalse)
3328    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3329  if (wand->images == (Image *) NULL)
3330    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3331  flop_image=FlopImage(wand->images,wand->exception);
3332  if (flop_image == (Image *) NULL)
3333    return(MagickFalse);
3334  ReplaceImageInList(&wand->images,flop_image);
3335  return(MagickTrue);
3336}
3337
3338/*
3339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3340%                                                                             %
3341%                                                                             %
3342%                                                                             %
3343%   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                     %
3344%                                                                             %
3345%                                                                             %
3346%                                                                             %
3347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3348%
3349%  MagickForwardFourierTransformImage() implements the discrete Fourier
3350%  transform (DFT) of the image either as a magnitude / phase or real /
3351%  imaginary image pair.
3352%
3353%  The format of the MagickForwardFourierTransformImage method is:
3354%
3355%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3356%        const MagickBooleanType magnitude)
3357%
3358%  A description of each parameter follows:
3359%
3360%    o wand: the magick wand.
3361%
3362%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3363%      imaginary image pair.
3364%
3365*/
3366WandExport MagickBooleanType MagickForwardFourierTransformImage(
3367  MagickWand *wand,const MagickBooleanType magnitude)
3368{
3369  Image
3370    *forward_image;
3371
3372  assert(wand != (MagickWand *) NULL);
3373  assert(wand->signature == WandSignature);
3374  if (wand->debug != MagickFalse)
3375    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3376  if (wand->images == (Image *) NULL)
3377    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3378  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3379    wand->exception);
3380  if (forward_image == (Image *) NULL)
3381    return(MagickFalse);
3382  ReplaceImageInList(&wand->images,forward_image);
3383  return(MagickTrue);
3384}
3385
3386/*
3387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3388%                                                                             %
3389%                                                                             %
3390%                                                                             %
3391%   M a g i c k F r a m e I m a g e                                           %
3392%                                                                             %
3393%                                                                             %
3394%                                                                             %
3395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3396%
3397%  MagickFrameImage() adds a simulated three-dimensional border around the
3398%  image.  The width and height specify the border width of the vertical and
3399%  horizontal sides of the frame.  The inner and outer bevels indicate the
3400%  width of the inner and outer shadows of the frame.
3401%
3402%  The format of the MagickFrameImage method is:
3403%
3404%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3405%        const PixelWand *matte_color,const size_t width,
3406%        const size_t height,const ssize_t inner_bevel,
3407%        const ssize_t outer_bevel)
3408%
3409%  A description of each parameter follows:
3410%
3411%    o wand: the magick wand.
3412%
3413%    o matte_color: the frame color pixel wand.
3414%
3415%    o width: the border width.
3416%
3417%    o height: the border height.
3418%
3419%    o inner_bevel: the inner bevel width.
3420%
3421%    o outer_bevel: the outer bevel width.
3422%
3423*/
3424WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3425  const PixelWand *matte_color,const size_t width,
3426  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3427{
3428  Image
3429    *frame_image;
3430
3431  FrameInfo
3432    frame_info;
3433
3434  assert(wand != (MagickWand *) NULL);
3435  assert(wand->signature == WandSignature);
3436  if (wand->debug != MagickFalse)
3437    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3438  if (wand->images == (Image *) NULL)
3439    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3440  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3441  frame_info.width=wand->images->columns+2*width;
3442  frame_info.height=wand->images->rows+2*height;
3443  frame_info.x=(ssize_t) width;
3444  frame_info.y=(ssize_t) height;
3445  frame_info.inner_bevel=inner_bevel;
3446  frame_info.outer_bevel=outer_bevel;
3447  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3448  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3449  if (frame_image == (Image *) NULL)
3450    return(MagickFalse);
3451  ReplaceImageInList(&wand->images,frame_image);
3452  return(MagickTrue);
3453}
3454
3455/*
3456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457%                                                                             %
3458%                                                                             %
3459%                                                                             %
3460%   M a g i c k F u n c t i o n I m a g e                                     %
3461%                                                                             %
3462%                                                                             %
3463%                                                                             %
3464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3465%
3466%  MagickFunctionImage() applys an arithmetic, relational, or logical
3467%  expression to an image.  Use these operators to lighten or darken an image,
3468%  to increase or decrease contrast in an image, or to produce the "negative"
3469%  of an image.
3470%
3471%  The format of the MagickFunctionImage method is:
3472%
3473%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3474%        const MagickFunction function,const size_t number_arguments,
3475%        const double *arguments)
3476%      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3477%        const ChannelType channel,const MagickFunction function,
3478%        const size_t number_arguments,const double *arguments)
3479%
3480%  A description of each parameter follows:
3481%
3482%    o wand: the magick wand.
3483%
3484%    o channel: the channel(s).
3485%
3486%    o function: the image function.
3487%
3488%    o number_arguments: the number of function arguments.
3489%
3490%    o arguments: the function arguments.
3491%
3492*/
3493
3494WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3495  const MagickFunction function,const size_t number_arguments,
3496  const double *arguments)
3497{
3498  MagickBooleanType
3499    status;
3500
3501  assert(wand != (MagickWand *) NULL);
3502  assert(wand->signature == WandSignature);
3503  if (wand->debug != MagickFalse)
3504    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3505  if (wand->images == (Image *) NULL)
3506    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3507  status=FunctionImage(wand->images,function,number_arguments,arguments,
3508    &wand->images->exception);
3509  if (status == MagickFalse)
3510    InheritException(wand->exception,&wand->images->exception);
3511  return(status);
3512}
3513
3514WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3515  const ChannelType channel,const MagickFunction function,
3516  const size_t number_arguments,const double *arguments)
3517{
3518  MagickBooleanType
3519    status;
3520
3521  assert(wand != (MagickWand *) NULL);
3522  assert(wand->signature == WandSignature);
3523  if (wand->debug != MagickFalse)
3524    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3525  if (wand->images == (Image *) NULL)
3526    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3527  status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3528    arguments,&wand->images->exception);
3529  return(status);
3530}
3531
3532/*
3533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3534%                                                                             %
3535%                                                                             %
3536%                                                                             %
3537%   M a g i c k F x I m a g e                                                 %
3538%                                                                             %
3539%                                                                             %
3540%                                                                             %
3541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3542%
3543%  MagickFxImage() evaluate expression for each pixel in the image.
3544%
3545%  The format of the MagickFxImage method is:
3546%
3547%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3548%      MagickWand *MagickFxImageChannel(MagickWand *wand,
3549%        const ChannelType channel,const char *expression)
3550%
3551%  A description of each parameter follows:
3552%
3553%    o wand: the magick wand.
3554%
3555%    o channel: the image channel(s).
3556%
3557%    o expression: the expression.
3558%
3559*/
3560
3561WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3562{
3563  MagickWand
3564    *fx_wand;
3565
3566  fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3567  return(fx_wand);
3568}
3569
3570WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3571  const ChannelType channel,const char *expression)
3572{
3573  Image
3574    *fx_image;
3575
3576  assert(wand != (MagickWand *) NULL);
3577  assert(wand->signature == WandSignature);
3578  if (wand->debug != MagickFalse)
3579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3580  if (wand->images == (Image *) NULL)
3581    return((MagickWand *) NULL);
3582  fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3583  if (fx_image == (Image *) NULL)
3584    return((MagickWand *) NULL);
3585  return(CloneMagickWandFromImages(wand,fx_image));
3586}
3587
3588/*
3589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3590%                                                                             %
3591%                                                                             %
3592%                                                                             %
3593%   M a g i c k G a m m a I m a g e                                           %
3594%                                                                             %
3595%                                                                             %
3596%                                                                             %
3597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3598%
3599%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3600%  different devices will have perceptual differences in the way the image's
3601%  intensities are represented on the screen.  Specify individual gamma levels
3602%  for the red, green, and blue channels, or adjust all three with the gamma
3603%  parameter.  Values typically range from 0.8 to 2.3.
3604%
3605%  You can also reduce the influence of a particular channel with a gamma
3606%  value of 0.
3607%
3608%  The format of the MagickGammaImage method is:
3609%
3610%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3611%      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3612%        const ChannelType channel,const double gamma)
3613%
3614%  A description of each parameter follows:
3615%
3616%    o wand: the magick wand.
3617%
3618%    o channel: the channel.
3619%
3620%    o level: Define the level of gamma correction.
3621%
3622*/
3623
3624WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3625  const double gamma)
3626{
3627  MagickBooleanType
3628    status;
3629
3630  status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3631  return(status);
3632}
3633
3634WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3635  const ChannelType channel,const double gamma)
3636{
3637  MagickBooleanType
3638    status;
3639
3640  assert(wand != (MagickWand *) NULL);
3641  assert(wand->signature == WandSignature);
3642  if (wand->debug != MagickFalse)
3643    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3644  if (wand->images == (Image *) NULL)
3645    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3646  status=GammaImageChannel(wand->images,channel,gamma);
3647  if (status == MagickFalse)
3648    InheritException(wand->exception,&wand->images->exception);
3649  return(status);
3650}
3651
3652/*
3653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3654%                                                                             %
3655%                                                                             %
3656%                                                                             %
3657%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3658%                                                                             %
3659%                                                                             %
3660%                                                                             %
3661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3662%
3663%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3664%  Gaussian operator of the given radius and standard deviation (sigma).
3665%  For reasonable results, the radius should be larger than sigma.  Use a
3666%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3667%
3668%  The format of the MagickGaussianBlurImage method is:
3669%
3670%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3671%        const double radius,const double sigma)
3672%      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3673%        const ChannelType channel,const double radius,const double sigma)
3674%
3675%  A description of each parameter follows:
3676%
3677%    o wand: the magick wand.
3678%
3679%    o channel: the image channel(s).
3680%
3681%    o radius: the radius of the Gaussian, in pixels, not counting the center
3682%      pixel.
3683%
3684%    o sigma: the standard deviation of the Gaussian, in pixels.
3685%
3686*/
3687
3688WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3689  const double radius,const double sigma)
3690{
3691  MagickBooleanType
3692    status;
3693
3694  status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3695  return(status);
3696}
3697
3698WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3699  const ChannelType channel,const double radius,const double sigma)
3700{
3701  Image
3702    *blur_image;
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  blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3711    wand->exception);
3712  if (blur_image == (Image *) NULL)
3713    return(MagickFalse);
3714  ReplaceImageInList(&wand->images,blur_image);
3715  return(MagickTrue);
3716}
3717
3718/*
3719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3720%                                                                             %
3721%                                                                             %
3722%                                                                             %
3723%   M a g i c k G e t I m a g e                                               %
3724%                                                                             %
3725%                                                                             %
3726%                                                                             %
3727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3728%
3729%  MagickGetImage() gets the image at the current image index.
3730%
3731%  The format of the MagickGetImage method is:
3732%
3733%      MagickWand *MagickGetImage(MagickWand *wand)
3734%
3735%  A description of each parameter follows:
3736%
3737%    o wand: the magick wand.
3738%
3739*/
3740WandExport MagickWand *MagickGetImage(MagickWand *wand)
3741{
3742  Image
3743    *image;
3744
3745  assert(wand != (MagickWand *) NULL);
3746  assert(wand->signature == WandSignature);
3747  if (wand->debug != MagickFalse)
3748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3749  if (wand->images == (Image *) NULL)
3750    {
3751      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3752        "ContainsNoImages","`%s'",wand->name);
3753      return((MagickWand *) NULL);
3754    }
3755  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3756  if (image == (Image *) NULL)
3757    return((MagickWand *) NULL);
3758  return(CloneMagickWandFromImages(wand,image));
3759}
3760
3761/*
3762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3763%                                                                             %
3764%                                                                             %
3765%                                                                             %
3766%   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                       %
3767%                                                                             %
3768%                                                                             %
3769%                                                                             %
3770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3771%
3772%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3773%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3774%  than CMYKA.
3775%
3776%  The format of the MagickGetImageAlphaChannel method is:
3777%
3778%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3779%
3780%  A description of each parameter follows:
3781%
3782%    o wand: the magick wand.
3783%
3784*/
3785WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3786{
3787  assert(wand != (MagickWand *) NULL);
3788  assert(wand->signature == WandSignature);
3789  if (wand->debug != MagickFalse)
3790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3791  if (wand->images == (Image *) NULL)
3792    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3793  return(GetImageAlphaChannel(wand->images));
3794}
3795
3796/*
3797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3798%                                                                             %
3799%                                                                             %
3800%                                                                             %
3801%   M a g i c k G e t I m a g e C l i p M a s k                               %
3802%                                                                             %
3803%                                                                             %
3804%                                                                             %
3805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3806%
3807%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3808%
3809%  The format of the MagickGetImageClipMask method is:
3810%
3811%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3812%
3813%  A description of each parameter follows:
3814%
3815%    o wand: the magick wand.
3816%
3817*/
3818WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3819{
3820  Image
3821    *image;
3822
3823  assert(wand != (MagickWand *) NULL);
3824  assert(wand->signature == WandSignature);
3825  if (wand->debug != MagickFalse)
3826    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3827  if (wand->images == (Image *) NULL)
3828    {
3829      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3830        "ContainsNoImages","`%s'",wand->name);
3831      return((MagickWand *) NULL);
3832    }
3833  image=GetImageClipMask(wand->images,wand->exception);
3834  if (image == (Image *) NULL)
3835    return((MagickWand *) NULL);
3836  return(CloneMagickWandFromImages(wand,image));
3837}
3838
3839/*
3840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3841%                                                                             %
3842%                                                                             %
3843%                                                                             %
3844%   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                 %
3845%                                                                             %
3846%                                                                             %
3847%                                                                             %
3848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3849%
3850%  MagickGetImageBackgroundColor() returns the image background color.
3851%
3852%  The format of the MagickGetImageBackgroundColor method is:
3853%
3854%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3855%        PixelWand *background_color)
3856%
3857%  A description of each parameter follows:
3858%
3859%    o wand: the magick wand.
3860%
3861%    o background_color: Return the background color.
3862%
3863*/
3864WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3865  PixelWand *background_color)
3866{
3867  assert(wand != (MagickWand *) NULL);
3868  assert(wand->signature == WandSignature);
3869  if (wand->debug != MagickFalse)
3870    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3871  if (wand->images == (Image *) NULL)
3872    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3873  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3874  return(MagickTrue);
3875}
3876
3877/*
3878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3879%                                                                             %
3880%                                                                             %
3881%                                                                             %
3882%   M a g i c k G e t I m a g e B l o b                                       %
3883%                                                                             %
3884%                                                                             %
3885%                                                                             %
3886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3887%
3888%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3889%  the image as a blob (a formatted "file" in memory) and its length, starting
3890%  from the current position in the image sequence.  Use MagickSetImageFormat()
3891%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3892%
3893%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3894%  the image sequence.
3895%
3896%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3897%
3898%  The format of the MagickGetImageBlob method is:
3899%
3900%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3901%
3902%  A description of each parameter follows:
3903%
3904%    o wand: the magick wand.
3905%
3906%    o length: the length of the blob.
3907%
3908*/
3909WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3910{
3911  assert(wand != (MagickWand *) NULL);
3912  assert(wand->signature == WandSignature);
3913  if (wand->debug != MagickFalse)
3914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3915  if (wand->images == (Image *) NULL)
3916    {
3917      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3918        "ContainsNoImages","`%s'",wand->name);
3919      return((unsigned char *) NULL);
3920    }
3921  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3922}
3923
3924/*
3925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3926%                                                                             %
3927%                                                                             %
3928%                                                                             %
3929%   M a g i c k G e t I m a g e s B l o b                                     %
3930%                                                                             %
3931%                                                                             %
3932%                                                                             %
3933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3934%
3935%  MagickGetImageBlob() implements direct to memory image formats.  It
3936%  returns the image sequence as a blob and its length.  The format of the image
3937%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3938%  return a different image format, use MagickSetImageFormat().
3939%
3940%  Note, some image formats do not permit multiple images to the same image
3941%  stream (e.g. JPEG).  in this instance, just the first image of the
3942%  sequence is returned as a blob.
3943%
3944%  The format of the MagickGetImagesBlob method is:
3945%
3946%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3947%
3948%  A description of each parameter follows:
3949%
3950%    o wand: the magick wand.
3951%
3952%    o length: the length of the blob.
3953%
3954*/
3955WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3956{
3957  unsigned char
3958    *blob;
3959
3960  assert(wand != (MagickWand *) NULL);
3961  assert(wand->signature == WandSignature);
3962  if (wand->debug != MagickFalse)
3963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3964  if (wand->images == (Image *) NULL)
3965    {
3966      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3967        "ContainsNoImages","`%s'",wand->name);
3968      return((unsigned char *) NULL);
3969    }
3970  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3971    wand->exception);
3972  return(blob);
3973}
3974
3975/*
3976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3977%                                                                             %
3978%                                                                             %
3979%                                                                             %
3980%   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                         %
3981%                                                                             %
3982%                                                                             %
3983%                                                                             %
3984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3985%
3986%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3987%  image.
3988%
3989%  The format of the MagickGetImageBluePrimary method is:
3990%
3991%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3992%        double *y)
3993%
3994%  A description of each parameter follows:
3995%
3996%    o wand: the magick wand.
3997%
3998%    o x: the chromaticity blue primary x-point.
3999%
4000%    o y: the chromaticity blue primary y-point.
4001%
4002*/
4003WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4004  double *x,double *y)
4005{
4006  assert(wand != (MagickWand *) NULL);
4007  assert(wand->signature == WandSignature);
4008  if (wand->debug != MagickFalse)
4009    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4010  if (wand->images == (Image *) NULL)
4011    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4012  *x=wand->images->chromaticity.blue_primary.x;
4013  *y=wand->images->chromaticity.blue_primary.y;
4014  return(MagickTrue);
4015}
4016
4017/*
4018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4019%                                                                             %
4020%                                                                             %
4021%                                                                             %
4022%   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                         %
4023%                                                                             %
4024%                                                                             %
4025%                                                                             %
4026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4027%
4028%  MagickGetImageBorderColor() returns the image border color.
4029%
4030%  The format of the MagickGetImageBorderColor method is:
4031%
4032%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4033%        PixelWand *border_color)
4034%
4035%  A description of each parameter follows:
4036%
4037%    o wand: the magick wand.
4038%
4039%    o border_color: Return the border color.
4040%
4041*/
4042WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4043  PixelWand *border_color)
4044{
4045  assert(wand != (MagickWand *) NULL);
4046  assert(wand->signature == WandSignature);
4047  if (wand->debug != MagickFalse)
4048    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4049  if (wand->images == (Image *) NULL)
4050    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4051  PixelSetQuantumPacket(border_color,&wand->images->border_color);
4052  return(MagickTrue);
4053}
4054
4055/*
4056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4057%                                                                             %
4058%                                                                             %
4059%                                                                             %
4060%   M a g i c k G e t I m a g e C h a n n e l F e a t u r e s                 %
4061%                                                                             %
4062%                                                                             %
4063%                                                                             %
4064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4065%
4066%  MagickGetImageChannelFeatures() returns features for each channel in the
4067%  image in each of four directions (horizontal, vertical, left and right
4068%  diagonals) for the specified distance.  The features include the angular
4069%  second moment, contrast, correlation, sum of squares: variance, inverse
4070%  difference moment, sum average, sum varience, sum entropy, entropy,
4071%  difference variance, difference entropy, information measures of
4072%  correlation 1, information measures of correlation 2, and maximum
4073%  correlation coefficient.  You can access the red channel contrast, for
4074%  example, like this:
4075%
4076%      channel_features=MagickGetImageChannelFeatures(wand,1);
4077%      contrast=channel_features[RedChannel].contrast[0];
4078%
4079%  Use MagickRelinquishMemory() to free the statistics buffer.
4080%
4081%  The format of the MagickGetImageChannelFeatures method is:
4082%
4083%      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4084%        const size_t distance)
4085%
4086%  A description of each parameter follows:
4087%
4088%    o wand: the magick wand.
4089%
4090%    o distance: the distance.
4091%
4092*/
4093WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4094  const size_t distance)
4095{
4096  assert(wand != (MagickWand *) NULL);
4097  assert(wand->signature == WandSignature);
4098  if (wand->debug != MagickFalse)
4099    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4100  if (wand->images == (Image *) NULL)
4101    {
4102      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4103        "ContainsNoImages","`%s'",wand->name);
4104      return((ChannelFeatures *) NULL);
4105    }
4106  return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4107}
4108
4109/*
4110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4111%                                                                             %
4112%                                                                             %
4113%                                                                             %
4114%   M a g i c k G e t I m a g e C h a n n e l K u r t o s i s                 %
4115%                                                                             %
4116%                                                                             %
4117%                                                                             %
4118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4119%
4120%  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4121%  more image channels.
4122%
4123%  The format of the MagickGetImageChannelKurtosis method is:
4124%
4125%      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4126%        const ChannelType channel,double *kurtosis,double *skewness)
4127%
4128%  A description of each parameter follows:
4129%
4130%    o wand: the magick wand.
4131%
4132%    o channel: the image channel(s).
4133%
4134%    o kurtosis:  The kurtosis for the specified channel(s).
4135%
4136%    o skewness:  The skewness for the specified channel(s).
4137%
4138*/
4139WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4140  const ChannelType channel,double *kurtosis,double *skewness)
4141{
4142  MagickBooleanType
4143    status;
4144
4145  assert(wand != (MagickWand *) NULL);
4146  assert(wand->signature == WandSignature);
4147  if (wand->debug != MagickFalse)
4148    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4149  if (wand->images == (Image *) NULL)
4150    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4151  status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4152    wand->exception);
4153  return(status);
4154}
4155
4156/*
4157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4158%                                                                             %
4159%                                                                             %
4160%                                                                             %
4161%   M a g i c k G e t I m a g e C h a n n e l M e a n                         %
4162%                                                                             %
4163%                                                                             %
4164%                                                                             %
4165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4166%
4167%  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4168%  more image channels.
4169%
4170%  The format of the MagickGetImageChannelMean method is:
4171%
4172%      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4173%        const ChannelType channel,double *mean,double *standard_deviation)
4174%
4175%  A description of each parameter follows:
4176%
4177%    o wand: the magick wand.
4178%
4179%    o channel: the image channel(s).
4180%
4181%    o mean:  The mean pixel value for the specified channel(s).
4182%
4183%    o standard_deviation:  The standard deviation for the specified channel(s).
4184%
4185*/
4186WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4187  const ChannelType channel,double *mean,double *standard_deviation)
4188{
4189  MagickBooleanType
4190    status;
4191
4192  assert(wand != (MagickWand *) NULL);
4193  assert(wand->signature == WandSignature);
4194  if (wand->debug != MagickFalse)
4195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4196  if (wand->images == (Image *) NULL)
4197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4198  status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4199    wand->exception);
4200  return(status);
4201}
4202
4203/*
4204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4205%                                                                             %
4206%                                                                             %
4207%                                                                             %
4208%   M a g i c k G e t I m a g e C h a n n e l R a n g e                       %
4209%                                                                             %
4210%                                                                             %
4211%                                                                             %
4212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4213%
4214%  MagickGetImageChannelRange() gets the range for one or more image channels.
4215%
4216%  The format of the MagickGetImageChannelRange method is:
4217%
4218%      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4219%        const ChannelType channel,double *minima,double *maxima)
4220%
4221%  A description of each parameter follows:
4222%
4223%    o wand: the magick wand.
4224%
4225%    o channel: the image channel(s).
4226%
4227%    o minima:  The minimum pixel value for the specified channel(s).
4228%
4229%    o maxima:  The maximum pixel value for the specified channel(s).
4230%
4231*/
4232WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4233  const ChannelType channel,double *minima,double *maxima)
4234{
4235  MagickBooleanType
4236    status;
4237
4238  assert(wand != (MagickWand *) NULL);
4239  assert(wand->signature == WandSignature);
4240  if (wand->debug != MagickFalse)
4241    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4242  if (wand->images == (Image *) NULL)
4243    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4244  status=GetImageChannelRange(wand->images,channel,minima,maxima,
4245    wand->exception);
4246  return(status);
4247}
4248
4249/*
4250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4251%                                                                             %
4252%                                                                             %
4253%                                                                             %
4254%   M a g i c k G e t I m a g e C h a n n e l S t a t i s t i c s             %
4255%                                                                             %
4256%                                                                             %
4257%                                                                             %
4258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259%
4260%  MagickGetImageChannelStatistics() returns statistics for each channel in the
4261%  image.  The statistics include the channel depth, its minima and
4262%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4263%  You can access the red channel mean, for example, like this:
4264%
4265%      channel_statistics=MagickGetImageChannelStatistics(wand);
4266%      red_mean=channel_statistics[RedChannel].mean;
4267%
4268%  Use MagickRelinquishMemory() to free the statistics buffer.
4269%
4270%  The format of the MagickGetImageChannelStatistics method is:
4271%
4272%      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4273%
4274%  A description of each parameter follows:
4275%
4276%    o wand: the magick wand.
4277%
4278*/
4279WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4280{
4281  assert(wand != (MagickWand *) NULL);
4282  assert(wand->signature == WandSignature);
4283  if (wand->debug != MagickFalse)
4284    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4285  if (wand->images == (Image *) NULL)
4286    {
4287      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4288        "ContainsNoImages","`%s'",wand->name);
4289      return((ChannelStatistics *) NULL);
4290    }
4291  return(GetImageChannelStatistics(wand->images,wand->exception));
4292}
4293
4294/*
4295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296%                                                                             %
4297%                                                                             %
4298%                                                                             %
4299%   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                     %
4300%                                                                             %
4301%                                                                             %
4302%                                                                             %
4303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304%
4305%  MagickGetImageColormapColor() returns the color of the specified colormap
4306%  index.
4307%
4308%  The format of the MagickGetImageColormapColor method is:
4309%
4310%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4311%        const size_t index,PixelWand *color)
4312%
4313%  A description of each parameter follows:
4314%
4315%    o wand: the magick wand.
4316%
4317%    o index: the offset into the image colormap.
4318%
4319%    o color: Return the colormap color in this wand.
4320%
4321*/
4322WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4323  const size_t index,PixelWand *color)
4324{
4325  assert(wand != (MagickWand *) NULL);
4326  assert(wand->signature == WandSignature);
4327  if (wand->debug != MagickFalse)
4328    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4329  if (wand->images == (Image *) NULL)
4330    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4331  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4332      (index >= wand->images->colors))
4333    {
4334      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4335        "InvalidColormapIndex","`%s'",wand->name);
4336      return(MagickFalse);
4337    }
4338  PixelSetQuantumPacket(color,wand->images->colormap+index);
4339  return(MagickTrue);
4340}
4341
4342/*
4343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4344%                                                                             %
4345%                                                                             %
4346%                                                                             %
4347%   M a g i c k G e t I m a g e C o l o r s                                   %
4348%                                                                             %
4349%                                                                             %
4350%                                                                             %
4351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4352%
4353%  MagickGetImageColors() gets the number of unique colors in the image.
4354%
4355%  The format of the MagickGetImageColors method is:
4356%
4357%      size_t MagickGetImageColors(MagickWand *wand)
4358%
4359%  A description of each parameter follows:
4360%
4361%    o wand: the magick wand.
4362%
4363*/
4364WandExport size_t MagickGetImageColors(MagickWand *wand)
4365{
4366  assert(wand != (MagickWand *) NULL);
4367  assert(wand->signature == WandSignature);
4368  if (wand->debug != MagickFalse)
4369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4370  if (wand->images == (Image *) NULL)
4371    {
4372      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4373        "ContainsNoImages","`%s'",wand->name);
4374      return(0);
4375    }
4376  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4377}
4378
4379/*
4380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381%                                                                             %
4382%                                                                             %
4383%                                                                             %
4384%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4385%                                                                             %
4386%                                                                             %
4387%                                                                             %
4388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4389%
4390%  MagickGetImageColorspace() gets the image colorspace.
4391%
4392%  The format of the MagickGetImageColorspace method is:
4393%
4394%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4395%
4396%  A description of each parameter follows:
4397%
4398%    o wand: the magick wand.
4399%
4400*/
4401WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4402{
4403  assert(wand != (MagickWand *) NULL);
4404  assert(wand->signature == WandSignature);
4405  if (wand->debug != MagickFalse)
4406    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4407  if (wand->images == (Image *) NULL)
4408    {
4409      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4410        "ContainsNoImages","`%s'",wand->name);
4411      return(UndefinedColorspace);
4412    }
4413  return(wand->images->colorspace);
4414}
4415
4416/*
4417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4418%                                                                             %
4419%                                                                             %
4420%                                                                             %
4421%   M a g i c k G e t I m a g e C o m p o s e                                 %
4422%                                                                             %
4423%                                                                             %
4424%                                                                             %
4425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4426%
4427%  MagickGetImageCompose() returns the composite operator associated with the
4428%  image.
4429%
4430%  The format of the MagickGetImageCompose method is:
4431%
4432%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4433%
4434%  A description of each parameter follows:
4435%
4436%    o wand: the magick wand.
4437%
4438*/
4439WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4440{
4441  assert(wand != (MagickWand *) NULL);
4442  assert(wand->signature == WandSignature);
4443  if (wand->debug != MagickFalse)
4444    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4445  if (wand->images == (Image *) NULL)
4446    {
4447      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4448        "ContainsNoImages","`%s'",wand->name);
4449      return(UndefinedCompositeOp);
4450    }
4451  return(wand->images->compose);
4452}
4453
4454/*
4455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4456%                                                                             %
4457%                                                                             %
4458%                                                                             %
4459%   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                         %
4460%                                                                             %
4461%                                                                             %
4462%                                                                             %
4463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4464%
4465%  MagickGetImageCompression() gets the image compression.
4466%
4467%  The format of the MagickGetImageCompression method is:
4468%
4469%      CompressionType MagickGetImageCompression(MagickWand *wand)
4470%
4471%  A description of each parameter follows:
4472%
4473%    o wand: the magick wand.
4474%
4475*/
4476WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4477{
4478  assert(wand != (MagickWand *) NULL);
4479  assert(wand->signature == WandSignature);
4480  if (wand->debug != MagickFalse)
4481    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4482  if (wand->images == (Image *) NULL)
4483    {
4484      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4485        "ContainsNoImages","`%s'",wand->name);
4486      return(UndefinedCompression);
4487    }
4488  return(wand->images->compression);
4489}
4490
4491/*
4492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4493%                                                                             %
4494%                                                                             %
4495%                                                                             %
4496%   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           %
4497%                                                                             %
4498%                                                                             %
4499%                                                                             %
4500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4501%
4502%  MagickGetImageCompression() gets the image compression quality.
4503%
4504%  The format of the MagickGetImageCompression method is:
4505%
4506%      size_t MagickGetImageCompression(MagickWand *wand)
4507%
4508%  A description of each parameter follows:
4509%
4510%    o wand: the magick wand.
4511%
4512*/
4513WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4514{
4515  assert(wand != (MagickWand *) NULL);
4516  assert(wand->signature == WandSignature);
4517  if (wand->debug != MagickFalse)
4518    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4519  if (wand->images == (Image *) NULL)
4520    {
4521      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4522        "ContainsNoImages","`%s'",wand->name);
4523      return(0UL);
4524    }
4525  return(wand->images->quality);
4526}
4527
4528/*
4529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530%                                                                             %
4531%                                                                             %
4532%                                                                             %
4533%   M a g i c k G e t I m a g e D e l a y                                     %
4534%                                                                             %
4535%                                                                             %
4536%                                                                             %
4537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538%
4539%  MagickGetImageDelay() gets the image delay.
4540%
4541%  The format of the MagickGetImageDelay method is:
4542%
4543%      size_t MagickGetImageDelay(MagickWand *wand)
4544%
4545%  A description of each parameter follows:
4546%
4547%    o wand: the magick wand.
4548%
4549*/
4550WandExport size_t MagickGetImageDelay(MagickWand *wand)
4551{
4552  assert(wand != (MagickWand *) NULL);
4553  assert(wand->signature == WandSignature);
4554  if (wand->debug != MagickFalse)
4555    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556  if (wand->images == (Image *) NULL)
4557    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4558  return(wand->images->delay);
4559}
4560
4561/*
4562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4563%                                                                             %
4564%                                                                             %
4565%                                                                             %
4566%   M a g i c k G e t I m a g e D e p t h                                     %
4567%                                                                             %
4568%                                                                             %
4569%                                                                             %
4570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571%
4572%  MagickGetImageDepth() gets the image depth.
4573%
4574%  The format of the MagickGetImageDepth method is:
4575%
4576%      size_t MagickGetImageDepth(MagickWand *wand)
4577%
4578%  A description of each parameter follows:
4579%
4580%    o wand: the magick wand.
4581%
4582*/
4583WandExport size_t MagickGetImageDepth(MagickWand *wand)
4584{
4585  assert(wand != (MagickWand *) NULL);
4586  assert(wand->signature == WandSignature);
4587  if (wand->debug != MagickFalse)
4588    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4589  if (wand->images == (Image *) NULL)
4590    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4591  return(GetImageDepth(wand->images,wand->exception));
4592}
4593
4594/*
4595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4596%                                                                             %
4597%                                                                             %
4598%                                                                             %
4599%   M a g i c k G e t I m a g e D i s p o s e                                 %
4600%                                                                             %
4601%                                                                             %
4602%                                                                             %
4603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4604%
4605%  MagickGetImageDispose() gets the image disposal method.
4606%
4607%  The format of the MagickGetImageDispose method is:
4608%
4609%      DisposeType MagickGetImageDispose(MagickWand *wand)
4610%
4611%  A description of each parameter follows:
4612%
4613%    o wand: the magick wand.
4614%
4615*/
4616WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4617{
4618  assert(wand != (MagickWand *) NULL);
4619  assert(wand->signature == WandSignature);
4620  if (wand->debug != MagickFalse)
4621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4622  if (wand->images == (Image *) NULL)
4623    {
4624      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4625        "ContainsNoImages","`%s'",wand->name);
4626      return(UndefinedDispose);
4627    }
4628  return((DisposeType) wand->images->dispose);
4629}
4630
4631/*
4632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4633%                                                                             %
4634%                                                                             %
4635%                                                                             %
4636%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4637%                                                                             %
4638%                                                                             %
4639%                                                                             %
4640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4641%
4642%  MagickGetImageDistortion() compares an image to a reconstructed image and
4643%  returns the specified distortion metric.
4644%
4645%  The format of the MagickGetImageDistortion method is:
4646%
4647%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4648%        const MagickWand *reference,const MetricType metric,
4649%        double *distortion)
4650%
4651%  A description of each parameter follows:
4652%
4653%    o wand: the magick wand.
4654%
4655%    o reference: the reference wand.
4656%
4657%    o metric: the metric.
4658%
4659%    o distortion: the computed distortion between the images.
4660%
4661*/
4662WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4663  const MagickWand *reference,const MetricType metric,double *distortion)
4664{
4665  MagickBooleanType
4666    status;
4667
4668  assert(wand != (MagickWand *) NULL);
4669  assert(wand->signature == WandSignature);
4670  if (wand->debug != MagickFalse)
4671    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4672  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4673    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4674  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4675    &wand->images->exception);
4676  return(status);
4677}
4678
4679/*
4680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4681%                                                                             %
4682%                                                                             %
4683%                                                                             %
4684%   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                         %
4685%                                                                             %
4686%                                                                             %
4687%                                                                             %
4688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4689%
4690%  MagickGetImageDistortions() compares one or more pixel channels of an
4691%  image to a reconstructed image and returns the specified distortion metrics.
4692%
4693%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4694%
4695%  The format of the MagickGetImageDistortion method is:
4696%
4697%      double *MagickGetImageDistortion(MagickWand *wand,
4698%        const MagickWand *reference,const MetricType metric)
4699%
4700%  A description of each parameter follows:
4701%
4702%    o wand: the magick wand.
4703%
4704%    o reference: the reference wand.
4705%
4706%    o metric: the metric.
4707%
4708*/
4709WandExport double *MagickGetImageDistortions(MagickWand *wand,
4710  const MagickWand *reference,const MetricType metric)
4711{
4712  double
4713    *channel_distortion;
4714
4715  assert(wand != (MagickWand *) NULL);
4716  assert(wand->signature == WandSignature);
4717  if (wand->debug != MagickFalse)
4718    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4719  assert(reference != (MagickWand *) NULL);
4720  assert(reference->signature == WandSignature);
4721  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4722    {
4723      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4724        "ContainsNoImages","`%s'",wand->name);
4725      return((double *) NULL);
4726    }
4727  channel_distortion=GetImageDistortions(wand->images,reference->images,
4728    metric,&wand->images->exception);
4729  return(channel_distortion);
4730}
4731
4732/*
4733%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4734%                                                                             %
4735%                                                                             %
4736%                                                                             %
4737%   M a g i c k G e t I m a g e F i l e n a m e                               %
4738%                                                                             %
4739%                                                                             %
4740%                                                                             %
4741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4742%
4743%  MagickGetImageFilename() returns the filename of a particular image in a
4744%  sequence.
4745%
4746%  The format of the MagickGetImageFilename method is:
4747%
4748%      char *MagickGetImageFilename(MagickWand *wand)
4749%
4750%  A description of each parameter follows:
4751%
4752%    o wand: the magick wand.
4753%
4754*/
4755WandExport char *MagickGetImageFilename(MagickWand *wand)
4756{
4757  assert(wand != (MagickWand *) NULL);
4758  assert(wand->signature == WandSignature);
4759  if (wand->debug != MagickFalse)
4760    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4761  if (wand->images == (Image *) NULL)
4762    {
4763      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4764        "ContainsNoImages","`%s'",wand->name);
4765      return((char *) NULL);
4766    }
4767  return(AcquireString(wand->images->filename));
4768}
4769
4770/*
4771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772%                                                                             %
4773%                                                                             %
4774%                                                                             %
4775%   M a g i c k G e t I m a g e F o r m a t                                   %
4776%                                                                             %
4777%                                                                             %
4778%                                                                             %
4779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4780%
4781%  MagickGetImageFormat() returns the format of a particular image in a
4782%  sequence.
4783%
4784%  The format of the MagickGetImageFormat method is:
4785%
4786%      const char *MagickGetImageFormat(MagickWand *wand)
4787%
4788%  A description of each parameter follows:
4789%
4790%    o wand: the magick wand.
4791%
4792*/
4793WandExport char *MagickGetImageFormat(MagickWand *wand)
4794{
4795  assert(wand != (MagickWand *) NULL);
4796  assert(wand->signature == WandSignature);
4797  if (wand->debug != MagickFalse)
4798    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4799  if (wand->images == (Image *) NULL)
4800    {
4801      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4802        "ContainsNoImages","`%s'",wand->name);
4803      return((char *) NULL);
4804    }
4805  return(AcquireString(wand->images->magick));
4806}
4807
4808/*
4809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4810%                                                                             %
4811%                                                                             %
4812%                                                                             %
4813%   M a g i c k G e t I m a g e F u z z                                       %
4814%                                                                             %
4815%                                                                             %
4816%                                                                             %
4817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4818%
4819%  MagickGetImageFuzz() gets the image fuzz.
4820%
4821%  The format of the MagickGetImageFuzz method is:
4822%
4823%      double MagickGetImageFuzz(MagickWand *wand)
4824%
4825%  A description of each parameter follows:
4826%
4827%    o wand: the magick wand.
4828%
4829*/
4830WandExport double MagickGetImageFuzz(MagickWand *wand)
4831{
4832  assert(wand != (MagickWand *) NULL);
4833  assert(wand->signature == WandSignature);
4834  if (wand->debug != MagickFalse)
4835    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4836  if (wand->images == (Image *) NULL)
4837    {
4838      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4839        "ContainsNoImages","`%s'",wand->name);
4840      return(0.0);
4841    }
4842  return(wand->images->fuzz);
4843}
4844
4845/*
4846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4847%                                                                             %
4848%                                                                             %
4849%                                                                             %
4850%   M a g i c k G e t I m a g e G a m m a                                     %
4851%                                                                             %
4852%                                                                             %
4853%                                                                             %
4854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4855%
4856%  MagickGetImageGamma() gets the image gamma.
4857%
4858%  The format of the MagickGetImageGamma method is:
4859%
4860%      double MagickGetImageGamma(MagickWand *wand)
4861%
4862%  A description of each parameter follows:
4863%
4864%    o wand: the magick wand.
4865%
4866*/
4867WandExport double MagickGetImageGamma(MagickWand *wand)
4868{
4869  assert(wand != (MagickWand *) NULL);
4870  assert(wand->signature == WandSignature);
4871  if (wand->debug != MagickFalse)
4872    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4873  if (wand->images == (Image *) NULL)
4874    {
4875      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4876        "ContainsNoImages","`%s'",wand->name);
4877      return(0.0);
4878    }
4879  return(wand->images->gamma);
4880}
4881
4882/*
4883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884%                                                                             %
4885%                                                                             %
4886%                                                                             %
4887%   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                 %
4888%                                                                             %
4889%                                                                             %
4890%                                                                             %
4891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892%
4893%  MagickGetImageGravity() gets the image gravity.
4894%
4895%  The format of the MagickGetImageGravity method is:
4896%
4897%      GravityType MagickGetImageGravity(MagickWand *wand)
4898%
4899%  A description of each parameter follows:
4900%
4901%    o wand: the magick wand.
4902%
4903*/
4904WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4905{
4906  assert(wand != (MagickWand *) NULL);
4907  assert(wand->signature == WandSignature);
4908  if (wand->debug != MagickFalse)
4909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4910  if (wand->images == (Image *) NULL)
4911    {
4912      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4913        "ContainsNoImages","`%s'",wand->name);
4914      return(UndefinedGravity);
4915    }
4916  return(wand->images->gravity);
4917}
4918
4919/*
4920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4921%                                                                             %
4922%                                                                             %
4923%                                                                             %
4924%   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                       %
4925%                                                                             %
4926%                                                                             %
4927%                                                                             %
4928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4929%
4930%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4931%
4932%  The format of the MagickGetImageGreenPrimary method is:
4933%
4934%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4935%        double *y)
4936%
4937%  A description of each parameter follows:
4938%
4939%    o wand: the magick wand.
4940%
4941%    o x: the chromaticity green primary x-point.
4942%
4943%    o y: the chromaticity green primary y-point.
4944%
4945*/
4946WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4947  double *x,double *y)
4948{
4949  assert(wand != (MagickWand *) NULL);
4950  assert(wand->signature == WandSignature);
4951  if (wand->debug != MagickFalse)
4952    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4953  if (wand->images == (Image *) NULL)
4954    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4955  *x=wand->images->chromaticity.green_primary.x;
4956  *y=wand->images->chromaticity.green_primary.y;
4957  return(MagickTrue);
4958}
4959
4960/*
4961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4962%                                                                             %
4963%                                                                             %
4964%                                                                             %
4965%   M a g i c k G e t I m a g e H e i g h t                                   %
4966%                                                                             %
4967%                                                                             %
4968%                                                                             %
4969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4970%
4971%  MagickGetImageHeight() returns the image height.
4972%
4973%  The format of the MagickGetImageHeight method is:
4974%
4975%      size_t MagickGetImageHeight(MagickWand *wand)
4976%
4977%  A description of each parameter follows:
4978%
4979%    o wand: the magick wand.
4980%
4981*/
4982WandExport size_t MagickGetImageHeight(MagickWand *wand)
4983{
4984  assert(wand != (MagickWand *) NULL);
4985  assert(wand->signature == WandSignature);
4986  if (wand->debug != MagickFalse)
4987    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4988  if (wand->images == (Image *) NULL)
4989    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4990  return(wand->images->rows);
4991}
4992
4993/*
4994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4995%                                                                             %
4996%                                                                             %
4997%                                                                             %
4998%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4999%                                                                             %
5000%                                                                             %
5001%                                                                             %
5002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5003%
5004%  MagickGetImageHistogram() returns the image histogram as an array of
5005%  PixelWand wands.
5006%
5007%  The format of the MagickGetImageHistogram method is:
5008%
5009%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5010%        size_t *number_colors)
5011%
5012%  A description of each parameter follows:
5013%
5014%    o wand: the magick wand.
5015%
5016%    o number_colors: the number of unique colors in the image and the number
5017%      of pixel wands returned.
5018%
5019*/
5020WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5021  size_t *number_colors)
5022{
5023  PixelPacket
5024    *histogram;
5025
5026  PixelWand
5027    **pixel_wands;
5028
5029  register ssize_t
5030    i;
5031
5032  assert(wand != (MagickWand *) NULL);
5033  assert(wand->signature == WandSignature);
5034  if (wand->debug != MagickFalse)
5035    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5036  if (wand->images == (Image *) NULL)
5037    {
5038      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5039        "ContainsNoImages","`%s'",wand->name);
5040      return((PixelWand **) NULL);
5041    }
5042  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5043  if (histogram == (PixelPacket *) NULL)
5044    return((PixelWand **) NULL);
5045  pixel_wands=NewPixelWands(*number_colors);
5046  for (i=0; i < (ssize_t) *number_colors; i++)
5047  {
5048    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
5049    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5050  }
5051  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
5052  return(pixel_wands);
5053}
5054
5055/*
5056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5057%                                                                             %
5058%                                                                             %
5059%                                                                             %
5060%   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                 %
5061%                                                                             %
5062%                                                                             %
5063%                                                                             %
5064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5065%
5066%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5067%
5068%  The format of the MagickGetImageInterlaceScheme method is:
5069%
5070%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5071%
5072%  A description of each parameter follows:
5073%
5074%    o wand: the magick wand.
5075%
5076*/
5077WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5078{
5079  assert(wand != (MagickWand *) NULL);
5080  assert(wand->signature == WandSignature);
5081  if (wand->debug != MagickFalse)
5082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5083  if (wand->images == (Image *) NULL)
5084    {
5085      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5086        "ContainsNoImages","`%s'",wand->name);
5087      return(UndefinedInterlace);
5088    }
5089  return(wand->images->interlace);
5090}
5091
5092/*
5093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5094%                                                                             %
5095%                                                                             %
5096%                                                                             %
5097%   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             %
5098%                                                                             %
5099%                                                                             %
5100%                                                                             %
5101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5102%
5103%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5104%  sepcified image.
5105%
5106%  The format of the MagickGetImageInterpolateMethod method is:
5107%
5108%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5109%
5110%  A description of each parameter follows:
5111%
5112%    o wand: the magick wand.
5113%
5114*/
5115WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5116  MagickWand *wand)
5117{
5118  assert(wand != (MagickWand *) NULL);
5119  assert(wand->signature == WandSignature);
5120  if (wand->debug != MagickFalse)
5121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5122  if (wand->images == (Image *) NULL)
5123    {
5124      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5125        "ContainsNoImages","`%s'",wand->name);
5126      return(UndefinedInterpolatePixel);
5127    }
5128  return(wand->images->interpolate);
5129}
5130
5131/*
5132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5133%                                                                             %
5134%                                                                             %
5135%                                                                             %
5136%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5137%                                                                             %
5138%                                                                             %
5139%                                                                             %
5140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5141%
5142%  MagickGetImageIterations() gets the image iterations.
5143%
5144%  The format of the MagickGetImageIterations method is:
5145%
5146%      size_t MagickGetImageIterations(MagickWand *wand)
5147%
5148%  A description of each parameter follows:
5149%
5150%    o wand: the magick wand.
5151%
5152*/
5153WandExport size_t MagickGetImageIterations(MagickWand *wand)
5154{
5155  assert(wand != (MagickWand *) NULL);
5156  assert(wand->signature == WandSignature);
5157  if (wand->debug != MagickFalse)
5158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5159  if (wand->images == (Image *) NULL)
5160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5161  return(wand->images->iterations);
5162}
5163
5164/*
5165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5166%                                                                             %
5167%                                                                             %
5168%                                                                             %
5169%   M a g i c k G e t I m a g e L e n g t h                                   %
5170%                                                                             %
5171%                                                                             %
5172%                                                                             %
5173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5174%
5175%  MagickGetImageLength() returns the image length in bytes.
5176%
5177%  The format of the MagickGetImageLength method is:
5178%
5179%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5180%        MagickSizeType *length)
5181%
5182%  A description of each parameter follows:
5183%
5184%    o wand: the magick wand.
5185%
5186%    o length: the image length in bytes.
5187%
5188*/
5189WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5190  MagickSizeType *length)
5191{
5192  assert(wand != (MagickWand *) NULL);
5193  assert(wand->signature == WandSignature);
5194  if (wand->debug != MagickFalse)
5195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5196  if (wand->images == (Image *) NULL)
5197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5198  *length=GetBlobSize(wand->images);
5199  return(MagickTrue);
5200}
5201
5202/*
5203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5204%                                                                             %
5205%                                                                             %
5206%                                                                             %
5207%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5208%                                                                             %
5209%                                                                             %
5210%                                                                             %
5211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5212%
5213%  MagickGetImageMatteColor() returns the image matte color.
5214%
5215%  The format of the MagickGetImageMatteColor method is:
5216%
5217%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5218%        PixelWand *matte_color)
5219%
5220%  A description of each parameter follows:
5221%
5222%    o wand: the magick wand.
5223%
5224%    o matte_color: Return the matte color.
5225%
5226*/
5227WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5228  PixelWand *matte_color)
5229{
5230  assert(wand != (MagickWand *) NULL);
5231  assert(wand->signature == WandSignature);
5232  if (wand->debug != MagickFalse)
5233    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5234  if (wand->images == (Image *) NULL)
5235    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5236  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
5237  return(MagickTrue);
5238}
5239
5240/*
5241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5242%                                                                             %
5243%                                                                             %
5244%                                                                             %
5245%   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                         %
5246%                                                                             %
5247%                                                                             %
5248%                                                                             %
5249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5250%
5251%  MagickGetImageOrientation() returns the image orientation.
5252%
5253%  The format of the MagickGetImageOrientation method is:
5254%
5255%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5256%
5257%  A description of each parameter follows:
5258%
5259%    o wand: the magick wand.
5260%
5261*/
5262WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5263{
5264  assert(wand != (MagickWand *) NULL);
5265  assert(wand->signature == WandSignature);
5266  if (wand->debug != MagickFalse)
5267    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5268  if (wand->images == (Image *) NULL)
5269    {
5270      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5271        "ContainsNoImages","`%s'",wand->name);
5272      return(UndefinedOrientation);
5273    }
5274  return(wand->images->orientation);
5275}
5276
5277/*
5278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279%                                                                             %
5280%                                                                             %
5281%                                                                             %
5282%   M a g i c k G e t I m a g e P a g e                                       %
5283%                                                                             %
5284%                                                                             %
5285%                                                                             %
5286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5287%
5288%  MagickGetImagePage() returns the page geometry associated with the image.
5289%
5290%  The format of the MagickGetImagePage method is:
5291%
5292%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5293%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5294%
5295%  A description of each parameter follows:
5296%
5297%    o wand: the magick wand.
5298%
5299%    o width: the page width.
5300%
5301%    o height: the page height.
5302%
5303%    o x: the page x-offset.
5304%
5305%    o y: the page y-offset.
5306%
5307*/
5308WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5309  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5310{
5311  assert(wand != (const MagickWand *) NULL);
5312  assert(wand->signature == WandSignature);
5313  if (wand->debug != MagickFalse)
5314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5315  if (wand->images == (Image *) NULL)
5316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5317  *width=wand->images->page.width;
5318  *height=wand->images->page.height;
5319  *x=wand->images->page.x;
5320  *y=wand->images->page.y;
5321  return(MagickTrue);
5322}
5323
5324/*
5325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5326%                                                                             %
5327%                                                                             %
5328%                                                                             %
5329%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5330%                                                                             %
5331%                                                                             %
5332%                                                                             %
5333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5334%
5335%  MagickGetImagePixelColor() returns the color of the specified pixel.
5336%
5337%  The format of the MagickGetImagePixelColor method is:
5338%
5339%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5340%        const ssize_t x,const ssize_t y,PixelWand *color)
5341%
5342%  A description of each parameter follows:
5343%
5344%    o wand: the magick wand.
5345%
5346%    o x,y: the pixel offset into the image.
5347%
5348%    o color: Return the colormap color in this wand.
5349%
5350*/
5351WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5352  const ssize_t x,const ssize_t y,PixelWand *color)
5353{
5354  register const Quantum
5355    *p;
5356
5357  CacheView
5358    *image_view;
5359
5360  assert(wand != (MagickWand *) NULL);
5361  assert(wand->signature == WandSignature);
5362  if (wand->debug != MagickFalse)
5363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5364  if (wand->images == (Image *) NULL)
5365    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5366  image_view=AcquireCacheView(wand->images);
5367  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5368  if (p == (const Quantum *) NULL)
5369    {
5370      image_view=DestroyCacheView(image_view);
5371      return(MagickFalse);
5372    }
5373  PixelSetQuantumPixel(wand->images,p,color);
5374  image_view=DestroyCacheView(image_view);
5375  return(MagickTrue);
5376}
5377
5378/*
5379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5380%                                                                             %
5381%                                                                             %
5382%                                                                             %
5383+   M a g i c k G e t I m a g e R a n g e                                     %
5384%                                                                             %
5385%                                                                             %
5386%                                                                             %
5387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5388%
5389%  MagickGetImageRange() gets the pixel range for the image.
5390%
5391%  The format of the MagickGetImageRange method is:
5392%
5393%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5394%        double *maxima)
5395%
5396%  A description of each parameter follows:
5397%
5398%    o wand: the magick wand.
5399%
5400%    o minima:  The minimum pixel value for the specified channel(s).
5401%
5402%    o maxima:  The maximum pixel value for the specified channel(s).
5403%
5404*/
5405WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5406  double *minima,double *maxima)
5407{
5408  MagickBooleanType
5409    status;
5410
5411  assert(wand != (MagickWand *) NULL);
5412  assert(wand->signature == WandSignature);
5413  if (wand->debug != MagickFalse)
5414    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5415  if (wand->images == (Image *) NULL)
5416    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5417  status=GetImageRange(wand->images,minima,maxima,wand->exception);
5418  return(status);
5419}
5420
5421/*
5422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5423%                                                                             %
5424%                                                                             %
5425%                                                                             %
5426%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5427%                                                                             %
5428%                                                                             %
5429%                                                                             %
5430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5431%
5432%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5433%
5434%  The format of the MagickGetImageRedPrimary method is:
5435%
5436%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5437%        double *y)
5438%
5439%  A description of each parameter follows:
5440%
5441%    o wand: the magick wand.
5442%
5443%    o x: the chromaticity red primary x-point.
5444%
5445%    o y: the chromaticity red primary y-point.
5446%
5447*/
5448WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5449  double *x,double *y)
5450{
5451  assert(wand != (MagickWand *) NULL);
5452  assert(wand->signature == WandSignature);
5453  if (wand->debug != MagickFalse)
5454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5455  if (wand->images == (Image *) NULL)
5456    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5457  *x=wand->images->chromaticity.red_primary.x;
5458  *y=wand->images->chromaticity.red_primary.y;
5459  return(MagickTrue);
5460}
5461
5462/*
5463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5464%                                                                             %
5465%                                                                             %
5466%                                                                             %
5467%   M a g i c k G e t I m a g e R e g i o n                                   %
5468%                                                                             %
5469%                                                                             %
5470%                                                                             %
5471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5472%
5473%  MagickGetImageRegion() extracts a region of the image and returns it as a
5474%  a new wand.
5475%
5476%  The format of the MagickGetImageRegion method is:
5477%
5478%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5479%        const size_t width,const size_t height,const ssize_t x,
5480%        const ssize_t y)
5481%
5482%  A description of each parameter follows:
5483%
5484%    o wand: the magick wand.
5485%
5486%    o width: the region width.
5487%
5488%    o height: the region height.
5489%
5490%    o x: the region x offset.
5491%
5492%    o y: the region y offset.
5493%
5494*/
5495WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5496  const size_t width,const size_t height,const ssize_t x,
5497  const ssize_t y)
5498{
5499  Image
5500    *region_image;
5501
5502  RectangleInfo
5503    region;
5504
5505  assert(wand != (MagickWand *) NULL);
5506  assert(wand->signature == WandSignature);
5507  if (wand->debug != MagickFalse)
5508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5509  if (wand->images == (Image *) NULL)
5510    return((MagickWand *) NULL);
5511  region.width=width;
5512  region.height=height;
5513  region.x=x;
5514  region.y=y;
5515  region_image=CropImage(wand->images,&region,wand->exception);
5516  if (region_image == (Image *) NULL)
5517    return((MagickWand *) NULL);
5518  return(CloneMagickWandFromImages(wand,region_image));
5519}
5520
5521/*
5522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523%                                                                             %
5524%                                                                             %
5525%                                                                             %
5526%   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                 %
5527%                                                                             %
5528%                                                                             %
5529%                                                                             %
5530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5531%
5532%  MagickGetImageRenderingIntent() gets the image rendering intent.
5533%
5534%  The format of the MagickGetImageRenderingIntent method is:
5535%
5536%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5537%
5538%  A description of each parameter follows:
5539%
5540%    o wand: the magick wand.
5541%
5542*/
5543WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5544{
5545  assert(wand != (MagickWand *) NULL);
5546  assert(wand->signature == WandSignature);
5547  if (wand->debug != MagickFalse)
5548    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5549  if (wand->images == (Image *) NULL)
5550    {
5551      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5552        "ContainsNoImages","`%s'",wand->name);
5553      return(UndefinedIntent);
5554    }
5555  return((RenderingIntent) wand->images->rendering_intent);
5556}
5557
5558/*
5559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5560%                                                                             %
5561%                                                                             %
5562%                                                                             %
5563%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5564%                                                                             %
5565%                                                                             %
5566%                                                                             %
5567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5568%
5569%  MagickGetImageResolution() gets the image X and Y resolution.
5570%
5571%  The format of the MagickGetImageResolution method is:
5572%
5573%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5574%        double *y)
5575%
5576%  A description of each parameter follows:
5577%
5578%    o wand: the magick wand.
5579%
5580%    o x: the image x-resolution.
5581%
5582%    o y: the image y-resolution.
5583%
5584*/
5585WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5586  double *x,double *y)
5587{
5588  assert(wand != (MagickWand *) NULL);
5589  assert(wand->signature == WandSignature);
5590  if (wand->debug != MagickFalse)
5591    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5592  if (wand->images == (Image *) NULL)
5593    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5594  *x=wand->images->x_resolution;
5595  *y=wand->images->y_resolution;
5596  return(MagickTrue);
5597}
5598
5599/*
5600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601%                                                                             %
5602%                                                                             %
5603%                                                                             %
5604%   M a g i c k G e t I m a g e S c e n e                                     %
5605%                                                                             %
5606%                                                                             %
5607%                                                                             %
5608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609%
5610%  MagickGetImageScene() gets the image scene.
5611%
5612%  The format of the MagickGetImageScene method is:
5613%
5614%      size_t MagickGetImageScene(MagickWand *wand)
5615%
5616%  A description of each parameter follows:
5617%
5618%    o wand: the magick wand.
5619%
5620*/
5621WandExport size_t MagickGetImageScene(MagickWand *wand)
5622{
5623  assert(wand != (MagickWand *) NULL);
5624  assert(wand->signature == WandSignature);
5625  if (wand->debug != MagickFalse)
5626    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5627  if (wand->images == (Image *) NULL)
5628    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5629  return(wand->images->scene);
5630}
5631
5632/*
5633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634%                                                                             %
5635%                                                                             %
5636%                                                                             %
5637%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5638%                                                                             %
5639%                                                                             %
5640%                                                                             %
5641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642%
5643%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5644%  pixel stream.
5645%
5646%  The format of the MagickGetImageSignature method is:
5647%
5648%      const char MagickGetImageSignature(MagickWand *wand)
5649%
5650%  A description of each parameter follows:
5651%
5652%    o wand: the magick wand.
5653%
5654*/
5655WandExport char *MagickGetImageSignature(MagickWand *wand)
5656{
5657  const char
5658    *value;
5659
5660  MagickBooleanType
5661    status;
5662
5663  assert(wand != (MagickWand *) NULL);
5664  assert(wand->signature == WandSignature);
5665  if (wand->debug != MagickFalse)
5666    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5667  if (wand->images == (Image *) NULL)
5668    {
5669      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5670        "ContainsNoImages","`%s'",wand->name);
5671      return((char *) NULL);
5672    }
5673  status=SignatureImage(wand->images);
5674  if (status == MagickFalse)
5675    InheritException(wand->exception,&wand->images->exception);
5676  value=GetImageProperty(wand->images,"signature");
5677  if (value != (const char *) NULL)
5678    return(AcquireString(value));
5679  InheritException(wand->exception,&wand->images->exception);
5680  return((char *) NULL);
5681}
5682
5683/*
5684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5685%                                                                             %
5686%                                                                             %
5687%                                                                             %
5688%   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                   %
5689%                                                                             %
5690%                                                                             %
5691%                                                                             %
5692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5693%
5694%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5695%
5696%  The format of the MagickGetImageTicksPerSecond method is:
5697%
5698%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5699%
5700%  A description of each parameter follows:
5701%
5702%    o wand: the magick wand.
5703%
5704*/
5705WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5706{
5707  assert(wand != (MagickWand *) NULL);
5708  assert(wand->signature == WandSignature);
5709  if (wand->debug != MagickFalse)
5710    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5711  if (wand->images == (Image *) NULL)
5712    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5713  return((size_t) wand->images->ticks_per_second);
5714}
5715
5716/*
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%                                                                             %
5719%                                                                             %
5720%                                                                             %
5721%   M a g i c k G e t I m a g e T y p e                                       %
5722%                                                                             %
5723%                                                                             %
5724%                                                                             %
5725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5726%
5727%  MagickGetImageType() gets the potential image type:
5728%
5729%        Bilevel        Grayscale       GrayscaleMatte
5730%        Palette        PaletteMatte    TrueColor
5731%        TrueColorMatte ColorSeparation ColorSeparationMatte
5732%
5733%  To ensure the image type matches its potential, use MagickSetImageType():
5734%
5735%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5736%
5737%  The format of the MagickGetImageType method is:
5738%
5739%      ImageType MagickGetImageType(MagickWand *wand)
5740%
5741%  A description of each parameter follows:
5742%
5743%    o wand: the magick wand.
5744%
5745*/
5746WandExport ImageType MagickGetImageType(MagickWand *wand)
5747{
5748  assert(wand != (MagickWand *) NULL);
5749  assert(wand->signature == WandSignature);
5750  if (wand->debug != MagickFalse)
5751    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5752  if (wand->images == (Image *) NULL)
5753    {
5754      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5755        "ContainsNoImages","`%s'",wand->name);
5756      return(UndefinedType);
5757    }
5758  return(GetImageType(wand->images,wand->exception));
5759}
5760
5761/*
5762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5763%                                                                             %
5764%                                                                             %
5765%                                                                             %
5766%   M a g i c k G e t I m a g e U n i t s                                     %
5767%                                                                             %
5768%                                                                             %
5769%                                                                             %
5770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5771%
5772%  MagickGetImageUnits() gets the image units of resolution.
5773%
5774%  The format of the MagickGetImageUnits method is:
5775%
5776%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5777%
5778%  A description of each parameter follows:
5779%
5780%    o wand: the magick wand.
5781%
5782*/
5783WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5784{
5785  assert(wand != (MagickWand *) NULL);
5786  assert(wand->signature == WandSignature);
5787  if (wand->debug != MagickFalse)
5788    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5789  if (wand->images == (Image *) NULL)
5790    {
5791      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5792        "ContainsNoImages","`%s'",wand->name);
5793      return(UndefinedResolution);
5794    }
5795  return(wand->images->units);
5796}
5797
5798/*
5799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5800%                                                                             %
5801%                                                                             %
5802%                                                                             %
5803%   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           %
5804%                                                                             %
5805%                                                                             %
5806%                                                                             %
5807%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5808%
5809%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5810%  sepcified image.
5811%
5812%  The format of the MagickGetImageVirtualPixelMethod method is:
5813%
5814%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5815%
5816%  A description of each parameter follows:
5817%
5818%    o wand: the magick wand.
5819%
5820*/
5821WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5822{
5823  assert(wand != (MagickWand *) NULL);
5824  assert(wand->signature == WandSignature);
5825  if (wand->debug != MagickFalse)
5826    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5827  if (wand->images == (Image *) NULL)
5828    {
5829      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5830        "ContainsNoImages","`%s'",wand->name);
5831      return(UndefinedVirtualPixelMethod);
5832    }
5833  return(GetImageVirtualPixelMethod(wand->images));
5834}
5835
5836/*
5837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838%                                                                             %
5839%                                                                             %
5840%                                                                             %
5841%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5842%                                                                             %
5843%                                                                             %
5844%                                                                             %
5845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5846%
5847%  MagickGetImageWhitePoint() returns the chromaticy white point.
5848%
5849%  The format of the MagickGetImageWhitePoint method is:
5850%
5851%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5852%        double *y)
5853%
5854%  A description of each parameter follows:
5855%
5856%    o wand: the magick wand.
5857%
5858%    o x: the chromaticity white x-point.
5859%
5860%    o y: the chromaticity white y-point.
5861%
5862*/
5863WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5864  double *x,double *y)
5865{
5866  assert(wand != (MagickWand *) NULL);
5867  assert(wand->signature == WandSignature);
5868  if (wand->debug != MagickFalse)
5869    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5870  if (wand->images == (Image *) NULL)
5871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5872  *x=wand->images->chromaticity.white_point.x;
5873  *y=wand->images->chromaticity.white_point.y;
5874  return(MagickTrue);
5875}
5876
5877/*
5878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5879%                                                                             %
5880%                                                                             %
5881%                                                                             %
5882%   M a g i c k G e t I m a g e W i d t h                                     %
5883%                                                                             %
5884%                                                                             %
5885%                                                                             %
5886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5887%
5888%  MagickGetImageWidth() returns the image width.
5889%
5890%  The format of the MagickGetImageWidth method is:
5891%
5892%      size_t MagickGetImageWidth(MagickWand *wand)
5893%
5894%  A description of each parameter follows:
5895%
5896%    o wand: the magick wand.
5897%
5898*/
5899WandExport size_t MagickGetImageWidth(MagickWand *wand)
5900{
5901  assert(wand != (MagickWand *) NULL);
5902  assert(wand->signature == WandSignature);
5903  if (wand->debug != MagickFalse)
5904    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5905  if (wand->images == (Image *) NULL)
5906    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5907  return(wand->images->columns);
5908}
5909
5910/*
5911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5912%                                                                             %
5913%                                                                             %
5914%                                                                             %
5915%   M a g i c k G e t N u m b e r I m a g e s                                 %
5916%                                                                             %
5917%                                                                             %
5918%                                                                             %
5919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5920%
5921%  MagickGetNumberImages() returns the number of images associated with a
5922%  magick wand.
5923%
5924%  The format of the MagickGetNumberImages method is:
5925%
5926%      size_t MagickGetNumberImages(MagickWand *wand)
5927%
5928%  A description of each parameter follows:
5929%
5930%    o wand: the magick wand.
5931%
5932*/
5933WandExport size_t MagickGetNumberImages(MagickWand *wand)
5934{
5935  assert(wand != (MagickWand *) NULL);
5936  assert(wand->signature == WandSignature);
5937  if (wand->debug != MagickFalse)
5938    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5939  return(GetImageListLength(wand->images));
5940}
5941
5942/*
5943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5944%                                                                             %
5945%                                                                             %
5946%                                                                             %
5947%   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                 %
5948%                                                                             %
5949%                                                                             %
5950%                                                                             %
5951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5952%
5953%  MagickGetImageTotalInkDensity() gets the image total ink density.
5954%
5955%  The format of the MagickGetImageTotalInkDensity method is:
5956%
5957%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5958%
5959%  A description of each parameter follows:
5960%
5961%    o wand: the magick wand.
5962%
5963*/
5964WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5965{
5966  assert(wand != (MagickWand *) NULL);
5967  assert(wand->signature == WandSignature);
5968  if (wand->debug != MagickFalse)
5969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5970  if (wand->images == (Image *) NULL)
5971    {
5972      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5973        "ContainsNoImages","`%s'",wand->name);
5974      return(0.0);
5975    }
5976  return(GetImageTotalInkDensity(wand->images));
5977}
5978
5979/*
5980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5981%                                                                             %
5982%                                                                             %
5983%                                                                             %
5984%   M a g i c k H a l d C l u t I m a g e                                     %
5985%                                                                             %
5986%                                                                             %
5987%                                                                             %
5988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5989%
5990%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5991%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5992%  dimensions.  Create it with the HALD coder.  You can apply any color
5993%  transformation to the Hald image and then use this method to apply the
5994%  transform to the image.
5995%
5996%  The format of the MagickHaldClutImage method is:
5997%
5998%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5999%        const MagickWand *hald_wand)
6000%      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6001%        const ChannelType channel,const MagickWand *hald_wand)
6002%
6003%  A description of each parameter follows:
6004%
6005%    o wand: the magick wand.
6006%
6007%    o hald_image: the hald CLUT image.
6008%
6009*/
6010
6011WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6012  const MagickWand *hald_wand)
6013{
6014  MagickBooleanType
6015    status;
6016
6017  status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6018  return(status);
6019}
6020
6021WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6022  const ChannelType channel,const MagickWand *hald_wand)
6023{
6024  MagickBooleanType
6025    status;
6026
6027  assert(wand != (MagickWand *) NULL);
6028  assert(wand->signature == WandSignature);
6029  if (wand->debug != MagickFalse)
6030    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6031  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6032    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6033  status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6034  if (status == MagickFalse)
6035    InheritException(wand->exception,&wand->images->exception);
6036  return(status);
6037}
6038
6039/*
6040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6041%                                                                             %
6042%                                                                             %
6043%                                                                             %
6044%   M a g i c k H a s N e x t I m a g e                                       %
6045%                                                                             %
6046%                                                                             %
6047%                                                                             %
6048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6049%
6050%  MagickHasNextImage() returns MagickTrue if the wand has more images when
6051%  traversing the list in the forward direction
6052%
6053%  The format of the MagickHasNextImage method is:
6054%
6055%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6056%
6057%  A description of each parameter follows:
6058%
6059%    o wand: the magick wand.
6060%
6061*/
6062WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6063{
6064  assert(wand != (MagickWand *) NULL);
6065  assert(wand->signature == WandSignature);
6066  if (wand->debug != MagickFalse)
6067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6068  if (wand->images == (Image *) NULL)
6069    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6070  if (GetNextImageInList(wand->images) == (Image *) NULL)
6071    return(MagickFalse);
6072  return(MagickTrue);
6073}
6074
6075/*
6076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6077%                                                                             %
6078%                                                                             %
6079%                                                                             %
6080%   M a g i c k H a s P r e v i o u s I m a g e                               %
6081%                                                                             %
6082%                                                                             %
6083%                                                                             %
6084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6085%
6086%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6087%  traversing the list in the reverse direction
6088%
6089%  The format of the MagickHasPreviousImage method is:
6090%
6091%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6092%
6093%  A description of each parameter follows:
6094%
6095%    o wand: the magick wand.
6096%
6097*/
6098WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6099{
6100  assert(wand != (MagickWand *) NULL);
6101  assert(wand->signature == WandSignature);
6102  if (wand->debug != MagickFalse)
6103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6104  if (wand->images == (Image *) NULL)
6105    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6106  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6107    return(MagickFalse);
6108  return(MagickTrue);
6109}
6110
6111/*
6112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6113%                                                                             %
6114%                                                                             %
6115%                                                                             %
6116%   M a g i c k I d e n t i f y I m a g e                                     %
6117%                                                                             %
6118%                                                                             %
6119%                                                                             %
6120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6121%
6122%  MagickIdentifyImage() identifies an image by printing its attributes to the
6123%  file.  Attributes include the image width, height, size, and others.
6124%
6125%  The format of the MagickIdentifyImage method is:
6126%
6127%      const char *MagickIdentifyImage(MagickWand *wand)
6128%
6129%  A description of each parameter follows:
6130%
6131%    o wand: the magick wand.
6132%
6133*/
6134WandExport char *MagickIdentifyImage(MagickWand *wand)
6135{
6136  char
6137    *description,
6138    filename[MaxTextExtent];
6139
6140  FILE
6141    *file;
6142
6143  int
6144    unique_file;
6145
6146  assert(wand != (MagickWand *) NULL);
6147  assert(wand->signature == WandSignature);
6148  if (wand->debug != MagickFalse)
6149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6150  if (wand->images == (Image *) NULL)
6151    {
6152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6153        "ContainsNoImages","`%s'",wand->name);
6154      return((char *) NULL);
6155    }
6156  description=(char *) NULL;
6157  unique_file=AcquireUniqueFileResource(filename);
6158  file=(FILE *) NULL;
6159  if (unique_file != -1)
6160    file=fdopen(unique_file,"wb");
6161  if ((unique_file == -1) || (file == (FILE *) NULL))
6162    {
6163      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6164        "UnableToCreateTemporaryFile","`%s'",wand->name);
6165      return((char *) NULL);
6166    }
6167  (void) IdentifyImage(wand->images,file,MagickTrue);
6168  (void) fclose(file);
6169  description=FileToString(filename,~0,wand->exception);
6170  (void) RelinquishUniqueFileResource(filename);
6171  return(description);
6172}
6173
6174/*
6175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6176%                                                                             %
6177%                                                                             %
6178%                                                                             %
6179%   M a g i c k I m p l o d e I m a g e                                       %
6180%                                                                             %
6181%                                                                             %
6182%                                                                             %
6183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6184%
6185%  MagickImplodeImage() creates a new image that is a copy of an existing
6186%  one with the image pixels "implode" by the specified percentage.  It
6187%  allocates the memory necessary for the new Image structure and returns a
6188%  pointer to the new image.
6189%
6190%  The format of the MagickImplodeImage method is:
6191%
6192%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6193%        const double radius)
6194%
6195%  A description of each parameter follows:
6196%
6197%    o wand: the magick wand.
6198%
6199%    o amount: Define the extent of the implosion.
6200%
6201*/
6202WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6203  const double amount)
6204{
6205  Image
6206    *implode_image;
6207
6208  assert(wand != (MagickWand *) NULL);
6209  assert(wand->signature == WandSignature);
6210  if (wand->debug != MagickFalse)
6211    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6212  if (wand->images == (Image *) NULL)
6213    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6214  implode_image=ImplodeImage(wand->images,amount,wand->exception);
6215  if (implode_image == (Image *) NULL)
6216    return(MagickFalse);
6217  ReplaceImageInList(&wand->images,implode_image);
6218  return(MagickTrue);
6219}
6220
6221/*
6222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6223%                                                                             %
6224%                                                                             %
6225%                                                                             %
6226%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6227%                                                                             %
6228%                                                                             %
6229%                                                                             %
6230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6231%
6232%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6233%  location you specify.  The method returns MagickFalse on success otherwise
6234%  MagickTrue if an error is encountered.  The pixel data can be either char,
6235%  short int, int, ssize_t, float, or double in the order specified by map.
6236%
6237%  Suppose your want to upload the first scanline of a 640x480 image from
6238%  character data in red-green-blue order:
6239%
6240%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6241%
6242%  The format of the MagickImportImagePixels method is:
6243%
6244%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6245%        const ssize_t x,const ssize_t y,const size_t columns,
6246%        const size_t rows,const char *map,const StorageType storage,
6247%        const void *pixels)
6248%
6249%  A description of each parameter follows:
6250%
6251%    o wand: the magick wand.
6252%
6253%    o x, y, columns, rows:  These values define the perimeter of a region
6254%      of pixels you want to define.
6255%
6256%    o map:  This string reflects the expected ordering of the pixel array.
6257%      It can be any combination or order of R = red, G = green, B = blue,
6258%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6259%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6260%      P = pad.
6261%
6262%    o storage: Define the data type of the pixels.  Float and double types are
6263%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6264%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6265%      or DoublePixel.
6266%
6267%    o pixels: This array of values contain the pixel components as defined by
6268%      map and type.  You must preallocate this array where the expected
6269%      length varies depending on the values of width, height, map, and type.
6270%
6271*/
6272WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6273  const ssize_t x,const ssize_t y,const size_t columns,
6274  const size_t rows,const char *map,const StorageType storage,
6275  const void *pixels)
6276{
6277  MagickBooleanType
6278    status;
6279
6280  assert(wand != (MagickWand *) NULL);
6281  assert(wand->signature == WandSignature);
6282  if (wand->debug != MagickFalse)
6283    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6284  if (wand->images == (Image *) NULL)
6285    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6286  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6287  if (status == MagickFalse)
6288    InheritException(wand->exception,&wand->images->exception);
6289  return(status);
6290}
6291
6292/*
6293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6294%                                                                             %
6295%                                                                             %
6296%                                                                             %
6297%   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       %
6298%                                                                             %
6299%                                                                             %
6300%                                                                             %
6301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6302%
6303%  MagickInverseFourierTransformImage() implements the inverse discrete
6304%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6305%  imaginary image pair.
6306%
6307%  The format of the MagickInverseFourierTransformImage method is:
6308%
6309%      MagickBooleanType MagickInverseFourierTransformImage(
6310%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6311%        const MagickBooleanType magnitude)
6312%
6313%  A description of each parameter follows:
6314%
6315%    o magnitude_wand: the magnitude or real wand.
6316%
6317%    o phase_wand: the phase or imaginary wand.
6318%
6319%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6320%      imaginary image pair.
6321%
6322*/
6323WandExport MagickBooleanType MagickInverseFourierTransformImage(
6324  MagickWand *magnitude_wand,MagickWand *phase_wand,
6325  const MagickBooleanType magnitude)
6326{
6327  Image
6328    *inverse_image;
6329
6330  MagickWand
6331    *wand;
6332
6333  assert(magnitude_wand != (MagickWand *) NULL);
6334  assert(magnitude_wand->signature == WandSignature);
6335  if (magnitude_wand->debug != MagickFalse)
6336    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6337      magnitude_wand->name);
6338  wand=magnitude_wand;
6339  if (magnitude_wand->images == (Image *) NULL)
6340    ThrowWandException(WandError,"ContainsNoImages",
6341      magnitude_wand->name);
6342  assert(phase_wand != (MagickWand *) NULL);
6343  assert(phase_wand->signature == WandSignature);
6344  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6345    phase_wand->images,magnitude,wand->exception);
6346  if (inverse_image == (Image *) NULL)
6347    return(MagickFalse);
6348  ReplaceImageInList(&wand->images,inverse_image);
6349  return(MagickTrue);
6350}
6351
6352/*
6353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6354%                                                                             %
6355%                                                                             %
6356%                                                                             %
6357%   M a g i c k L a b e l I m a g e                                           %
6358%                                                                             %
6359%                                                                             %
6360%                                                                             %
6361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6362%
6363%  MagickLabelImage() adds a label to your image.
6364%
6365%  The format of the MagickLabelImage method is:
6366%
6367%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6368%
6369%  A description of each parameter follows:
6370%
6371%    o wand: the magick wand.
6372%
6373%    o label: the image label.
6374%
6375*/
6376WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6377  const char *label)
6378{
6379  MagickBooleanType
6380    status;
6381
6382  assert(wand != (MagickWand *) NULL);
6383  assert(wand->signature == WandSignature);
6384  if (wand->debug != MagickFalse)
6385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6386  if (wand->images == (Image *) NULL)
6387    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6388  status=SetImageProperty(wand->images,"label",label);
6389  if (status == MagickFalse)
6390    InheritException(wand->exception,&wand->images->exception);
6391  return(status);
6392}
6393
6394/*
6395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6396%                                                                             %
6397%                                                                             %
6398%                                                                             %
6399%   M a g i c k L e v e l I m a g e                                           %
6400%                                                                             %
6401%                                                                             %
6402%                                                                             %
6403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6404%
6405%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6406%  falling between specified white and black points to the full available
6407%  quantum range. The parameters provided represent the black, mid, and white
6408%  points. The black point specifies the darkest color in the image. Colors
6409%  darker than the black point are set to zero. Mid point specifies a gamma
6410%  correction to apply to the image.  White point specifies the lightest color
6411%  in the image. Colors brighter than the white point are set to the maximum
6412%  quantum value.
6413%
6414%  The format of the MagickLevelImage method is:
6415%
6416%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6417%        const double black_point,const double gamma,const double white_point)
6418%      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6419%        const ChannelType channel,const double black_point,const double gamma,
6420%        const double white_point)
6421%
6422%  A description of each parameter follows:
6423%
6424%    o wand: the magick wand.
6425%
6426%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6427%
6428%    o black_point: the black point.
6429%
6430%    o gamma: the gamma.
6431%
6432%    o white_point: the white point.
6433%
6434*/
6435
6436WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6437  const double black_point,const double gamma,const double white_point)
6438{
6439  MagickBooleanType
6440    status;
6441
6442  status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6443    white_point);
6444  return(status);
6445}
6446
6447WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6448  const ChannelType channel,const double black_point,const double gamma,
6449  const double white_point)
6450{
6451  MagickBooleanType
6452    status;
6453
6454  assert(wand != (MagickWand *) NULL);
6455  assert(wand->signature == WandSignature);
6456  if (wand->debug != MagickFalse)
6457    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6458  if (wand->images == (Image *) NULL)
6459    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6460  status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6461  if (status == MagickFalse)
6462    InheritException(wand->exception,&wand->images->exception);
6463  return(status);
6464}
6465
6466/*
6467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6468%                                                                             %
6469%                                                                             %
6470%                                                                             %
6471%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6472%                                                                             %
6473%                                                                             %
6474%                                                                             %
6475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6476%
6477%  MagickLinearStretchImage() stretches with saturation the image intensity.
6478%
6479%  You can also reduce the influence of a particular channel with a gamma
6480%  value of 0.
6481%
6482%  The format of the MagickLinearStretchImage method is:
6483%
6484%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6485%        const double black_point,const double white_point)
6486%
6487%  A description of each parameter follows:
6488%
6489%    o wand: the magick wand.
6490%
6491%    o black_point: the black point.
6492%
6493%    o white_point: the white point.
6494%
6495*/
6496WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6497  const double black_point,const double white_point)
6498{
6499  MagickBooleanType
6500    status;
6501
6502  assert(wand != (MagickWand *) NULL);
6503  assert(wand->signature == WandSignature);
6504  if (wand->debug != MagickFalse)
6505    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6506  if (wand->images == (Image *) NULL)
6507    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6508  status=LinearStretchImage(wand->images,black_point,white_point);
6509  if (status == MagickFalse)
6510    InheritException(wand->exception,&wand->images->exception);
6511  return(status);
6512}
6513
6514/*
6515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6516%                                                                             %
6517%                                                                             %
6518%                                                                             %
6519%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6520%                                                                             %
6521%                                                                             %
6522%                                                                             %
6523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6524%
6525%  MagickLiquidRescaleImage() rescales image with seam carving.
6526%
6527%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6528%        const size_t columns,const size_t rows,
6529%        const double delta_x,const double rigidity)
6530%
6531%  A description of each parameter follows:
6532%
6533%    o wand: the magick wand.
6534%
6535%    o columns: the number of columns in the scaled image.
6536%
6537%    o rows: the number of rows in the scaled image.
6538%
6539%    o delta_x: maximum seam transversal step (0 means straight seams).
6540%
6541%    o rigidity: introduce a bias for non-straight seams (typically 0).
6542%
6543*/
6544WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6545  const size_t columns,const size_t rows,const double delta_x,
6546  const double rigidity)
6547{
6548  Image
6549    *rescale_image;
6550
6551  assert(wand != (MagickWand *) NULL);
6552  assert(wand->signature == WandSignature);
6553  if (wand->debug != MagickFalse)
6554    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6555  if (wand->images == (Image *) NULL)
6556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6557  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6558    rigidity,wand->exception);
6559  if (rescale_image == (Image *) NULL)
6560    return(MagickFalse);
6561  ReplaceImageInList(&wand->images,rescale_image);
6562  return(MagickTrue);
6563}
6564
6565/*
6566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6567%                                                                             %
6568%                                                                             %
6569%                                                                             %
6570%   M a g i c k M a g n i f y I m a g e                                       %
6571%                                                                             %
6572%                                                                             %
6573%                                                                             %
6574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6575%
6576%  MagickMagnifyImage() is a convenience method that scales an image
6577%  proportionally to twice its original size.
6578%
6579%  The format of the MagickMagnifyImage method is:
6580%
6581%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6582%
6583%  A description of each parameter follows:
6584%
6585%    o wand: the magick wand.
6586%
6587*/
6588WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6589{
6590  Image
6591    *magnify_image;
6592
6593  assert(wand != (MagickWand *) NULL);
6594  assert(wand->signature == WandSignature);
6595  if (wand->debug != MagickFalse)
6596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6597  if (wand->images == (Image *) NULL)
6598    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6599  magnify_image=MagnifyImage(wand->images,wand->exception);
6600  if (magnify_image == (Image *) NULL)
6601    return(MagickFalse);
6602  ReplaceImageInList(&wand->images,magnify_image);
6603  return(MagickTrue);
6604}
6605
6606/*
6607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6608%                                                                             %
6609%                                                                             %
6610%                                                                             %
6611%   M a g i c k M e r g e I m a g e L a y e r s                               %
6612%                                                                             %
6613%                                                                             %
6614%                                                                             %
6615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6616%
6617%  MagickMergeImageLayers() composes all the image layers from the current
6618%  given image onward to produce a single image of the merged layers.
6619%
6620%  The inital canvas's size depends on the given ImageLayerMethod, and is
6621%  initialized using the first images background color.  The images
6622%  are then compositied onto that image in sequence using the given
6623%  composition that has been assigned to each individual image.
6624%
6625%  The format of the MagickMergeImageLayers method is:
6626%
6627%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6628%        const ImageLayerMethod method)
6629%
6630%  A description of each parameter follows:
6631%
6632%    o wand: the magick wand.
6633%
6634%    o method: the method of selecting the size of the initial canvas.
6635%
6636%        MergeLayer: Merge all layers onto a canvas just large enough
6637%           to hold all the actual images. The virtual canvas of the
6638%           first image is preserved but otherwise ignored.
6639%
6640%        FlattenLayer: Use the virtual canvas size of first image.
6641%           Images which fall outside this canvas is clipped.
6642%           This can be used to 'fill out' a given virtual canvas.
6643%
6644%        MosaicLayer: Start with the virtual canvas of the first image,
6645%           enlarging left and right edges to contain all images.
6646%           Images with negative offsets will be clipped.
6647%
6648*/
6649WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6650  const ImageLayerMethod method)
6651{
6652  Image
6653    *mosaic_image;
6654
6655  assert(wand != (MagickWand *) NULL);
6656  assert(wand->signature == WandSignature);
6657  if (wand->debug != MagickFalse)
6658    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6659  if (wand->images == (Image *) NULL)
6660    return((MagickWand *) NULL);
6661  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6662  if (mosaic_image == (Image *) NULL)
6663    return((MagickWand *) NULL);
6664  return(CloneMagickWandFromImages(wand,mosaic_image));
6665}
6666
6667/*
6668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6669%                                                                             %
6670%                                                                             %
6671%                                                                             %
6672%   M a g i c k M i n i f y I m a g e                                         %
6673%                                                                             %
6674%                                                                             %
6675%                                                                             %
6676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6677%
6678%  MagickMinifyImage() is a convenience method that scales an image
6679%  proportionally to one-half its original size
6680%
6681%  The format of the MagickMinifyImage method is:
6682%
6683%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6684%
6685%  A description of each parameter follows:
6686%
6687%    o wand: the magick wand.
6688%
6689*/
6690WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6691{
6692  Image
6693    *minify_image;
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  if (wand->images == (Image *) NULL)
6700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6701  minify_image=MinifyImage(wand->images,wand->exception);
6702  if (minify_image == (Image *) NULL)
6703    return(MagickFalse);
6704  ReplaceImageInList(&wand->images,minify_image);
6705  return(MagickTrue);
6706}
6707
6708/*
6709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6710%                                                                             %
6711%                                                                             %
6712%                                                                             %
6713%   M a g i c k M o d u l a t e I m a g e                                     %
6714%                                                                             %
6715%                                                                             %
6716%                                                                             %
6717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718%
6719%  MagickModulateImage() lets you control the brightness, saturation, and hue
6720%  of an image.  Hue is the percentage of absolute rotation from the current
6721%  position.  For example 50 results in a counter-clockwise rotation of 90
6722%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6723%  both resulting in a rotation of 180 degrees.
6724%
6725%  To increase the color brightness by 20% and decrease the color saturation by
6726%  10% and leave the hue unchanged, use: 120,90,100.
6727%
6728%  The format of the MagickModulateImage method is:
6729%
6730%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6731%        const double brightness,const double saturation,const double hue)
6732%
6733%  A description of each parameter follows:
6734%
6735%    o wand: the magick wand.
6736%
6737%    o brightness: the percent change in brighness.
6738%
6739%    o saturation: the percent change in saturation.
6740%
6741%    o hue: the percent change in hue.
6742%
6743*/
6744WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6745  const double brightness,const double saturation,const double hue)
6746{
6747  char
6748    modulate[MaxTextExtent];
6749
6750  MagickBooleanType
6751    status;
6752
6753  assert(wand != (MagickWand *) NULL);
6754  assert(wand->signature == WandSignature);
6755  if (wand->debug != MagickFalse)
6756    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6757  if (wand->images == (Image *) NULL)
6758    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6759  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6760    brightness,saturation,hue);
6761  status=ModulateImage(wand->images,modulate);
6762  if (status == MagickFalse)
6763    InheritException(wand->exception,&wand->images->exception);
6764  return(status);
6765}
6766
6767/*
6768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6769%                                                                             %
6770%                                                                             %
6771%                                                                             %
6772%   M a g i c k M o n t a g e I m a g e                                       %
6773%                                                                             %
6774%                                                                             %
6775%                                                                             %
6776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6777%
6778%  MagickMontageImage() creates a composite image by combining several
6779%  separate images. The images are tiled on the composite image with the name
6780%  of the image optionally appearing just below the individual tile.
6781%
6782%  The format of the MagickMontageImage method is:
6783%
6784%      MagickWand *MagickMontageImage(MagickWand *wand,
6785%        const DrawingWand drawing_wand,const char *tile_geometry,
6786%        const char *thumbnail_geometry,const MontageMode mode,
6787%        const char *frame)
6788%
6789%  A description of each parameter follows:
6790%
6791%    o wand: the magick wand.
6792%
6793%    o drawing_wand: the drawing wand.  The font name, size, and color are
6794%      obtained from this wand.
6795%
6796%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6797%
6798%    o thumbnail_geometry: Preferred image size and border size of each
6799%      thumbnail (e.g. 120x120+4+3>).
6800%
6801%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6802%
6803%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6804%      The frame color is that of the thumbnail's matte color.
6805%
6806*/
6807WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6808  const DrawingWand *drawing_wand,const char *tile_geometry,
6809  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6810{
6811  char
6812    *font;
6813
6814  Image
6815    *montage_image;
6816
6817  MontageInfo
6818    *montage_info;
6819
6820  PixelWand
6821    *pixel_wand;
6822
6823  assert(wand != (MagickWand *) NULL);
6824  assert(wand->signature == WandSignature);
6825  if (wand->debug != MagickFalse)
6826    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6827  if (wand->images == (Image *) NULL)
6828    return((MagickWand *) NULL);
6829  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6830  switch (mode)
6831  {
6832    case FrameMode:
6833    {
6834      (void) CloneString(&montage_info->frame,"15x15+3+3");
6835      montage_info->shadow=MagickTrue;
6836      break;
6837    }
6838    case UnframeMode:
6839    {
6840      montage_info->frame=(char *) NULL;
6841      montage_info->shadow=MagickFalse;
6842      montage_info->border_width=0;
6843      break;
6844    }
6845    case ConcatenateMode:
6846    {
6847      montage_info->frame=(char *) NULL;
6848      montage_info->shadow=MagickFalse;
6849      (void) CloneString(&montage_info->geometry,"+0+0");
6850      montage_info->border_width=0;
6851      break;
6852    }
6853    default:
6854      break;
6855  }
6856  font=DrawGetFont(drawing_wand);
6857  if (font != (char *) NULL)
6858    (void) CloneString(&montage_info->font,font);
6859  if (frame != (char *) NULL)
6860    (void) CloneString(&montage_info->frame,frame);
6861  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6862  pixel_wand=NewPixelWand();
6863  DrawGetFillColor(drawing_wand,pixel_wand);
6864  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6865  DrawGetStrokeColor(drawing_wand,pixel_wand);
6866  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6867  pixel_wand=DestroyPixelWand(pixel_wand);
6868  if (thumbnail_geometry != (char *) NULL)
6869    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6870  if (tile_geometry != (char *) NULL)
6871    (void) CloneString(&montage_info->tile,tile_geometry);
6872  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6873    wand->exception);
6874  montage_info=DestroyMontageInfo(montage_info);
6875  if (montage_image == (Image *) NULL)
6876    return((MagickWand *) NULL);
6877  return(CloneMagickWandFromImages(wand,montage_image));
6878}
6879
6880/*
6881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6882%                                                                             %
6883%                                                                             %
6884%                                                                             %
6885%   M a g i c k M o r p h I m a g e s                                         %
6886%                                                                             %
6887%                                                                             %
6888%                                                                             %
6889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6890%
6891%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6892%  and size are linearly interpolated to give the appearance of a
6893%  meta-morphosis from one image to the next.
6894%
6895%  The format of the MagickMorphImages method is:
6896%
6897%      MagickWand *MagickMorphImages(MagickWand *wand,
6898%        const size_t number_frames)
6899%
6900%  A description of each parameter follows:
6901%
6902%    o wand: the magick wand.
6903%
6904%    o number_frames: the number of in-between images to generate.
6905%
6906*/
6907WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6908  const size_t number_frames)
6909{
6910  Image
6911    *morph_image;
6912
6913  assert(wand != (MagickWand *) NULL);
6914  assert(wand->signature == WandSignature);
6915  if (wand->debug != MagickFalse)
6916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6917  if (wand->images == (Image *) NULL)
6918    return((MagickWand *) NULL);
6919  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6920  if (morph_image == (Image *) NULL)
6921    return((MagickWand *) NULL);
6922  return(CloneMagickWandFromImages(wand,morph_image));
6923}
6924
6925/*
6926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6927%                                                                             %
6928%                                                                             %
6929%                                                                             %
6930%   M a g i c k M o r p h o l o g y I m a g e                                 %
6931%                                                                             %
6932%                                                                             %
6933%                                                                             %
6934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6935%
6936%  MagickMorphologyImage() applies a user supplied kernel to the image
6937%  according to the given mophology method.
6938%
6939%  The format of the MagickMorphologyImage method is:
6940%
6941%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6942%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6943%      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
6944%        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
6945%        KernelInfo *kernel)
6946%
6947%  A description of each parameter follows:
6948%
6949%    o wand: the magick wand.
6950%
6951%    o channel: the image channel(s).
6952%
6953%    o method: the morphology method to be applied.
6954%
6955%    o iterations: apply the operation this many times (or no change).
6956%      A value of -1 means loop until no change found.  How this is applied
6957%      may depend on the morphology method.  Typically this is a value of 1.
6958%
6959%    o kernel: An array of doubles representing the morphology kernel.
6960%
6961*/
6962
6963WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6964  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6965{
6966  MagickBooleanType
6967    status;
6968
6969  status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
6970    kernel);
6971  return(status);
6972}
6973
6974WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
6975  const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
6976  KernelInfo *kernel)
6977{
6978  Image
6979    *morphology_image;
6980
6981  assert(wand != (MagickWand *) NULL);
6982  assert(wand->signature == WandSignature);
6983  if (wand->debug != MagickFalse)
6984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6985  if (kernel == (const KernelInfo *) NULL)
6986    return(MagickFalse);
6987  if (wand->images == (Image *) NULL)
6988    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6989  morphology_image=MorphologyImageChannel(wand->images,channel,method,
6990    iterations,kernel,wand->exception);
6991  if (morphology_image == (Image *) NULL)
6992    return(MagickFalse);
6993  ReplaceImageInList(&wand->images,morphology_image);
6994  return(MagickTrue);
6995}
6996
6997/*
6998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6999%                                                                             %
7000%                                                                             %
7001%                                                                             %
7002%   M a g i c k M o t i o n B l u r I m a g e                                 %
7003%                                                                             %
7004%                                                                             %
7005%                                                                             %
7006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7007%
7008%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7009%  Gaussian operator of the given radius and standard deviation (sigma).
7010%  For reasonable results, radius should be larger than sigma.  Use a
7011%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7012%  Angle gives the angle of the blurring motion.
7013%
7014%  The format of the MagickMotionBlurImage method is:
7015%
7016%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7017%        const double radius,const double sigma,const double angle)
7018%      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7019%        const ChannelType channel,const double radius,const double sigma,
7020%        const double angle)
7021%
7022%  A description of each parameter follows:
7023%
7024%    o wand: the magick wand.
7025%
7026%    o channel: the image channel(s).
7027%
7028%    o radius: the radius of the Gaussian, in pixels, not counting
7029%      the center pixel.
7030%
7031%    o sigma: the standard deviation of the Gaussian, in pixels.
7032%
7033%    o angle: Apply the effect along this angle.
7034%
7035*/
7036
7037WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7038  const double radius,const double sigma,const double angle)
7039{
7040  MagickBooleanType
7041    status;
7042
7043  status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7044  return(status);
7045}
7046
7047WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7048  const ChannelType channel,const double radius,const double sigma,
7049  const double angle)
7050{
7051  Image
7052    *blur_image;
7053
7054  assert(wand != (MagickWand *) NULL);
7055  assert(wand->signature == WandSignature);
7056  if (wand->debug != MagickFalse)
7057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7058  if (wand->images == (Image *) NULL)
7059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7060  blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7061    wand->exception);
7062  if (blur_image == (Image *) NULL)
7063    return(MagickFalse);
7064  ReplaceImageInList(&wand->images,blur_image);
7065  return(MagickTrue);
7066}
7067
7068/*
7069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7070%                                                                             %
7071%                                                                             %
7072%                                                                             %
7073%   M a g i c k N e g a t e I m a g e                                         %
7074%                                                                             %
7075%                                                                             %
7076%                                                                             %
7077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7078%
7079%  MagickNegateImage() negates the colors in the reference image.  The
7080%  Grayscale option means that only grayscale values within the image are
7081%  negated.
7082%
7083%  You can also reduce the influence of a particular channel with a gamma
7084%  value of 0.
7085%
7086%  The format of the MagickNegateImage method is:
7087%
7088%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7089%        const MagickBooleanType gray)
7090%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7091%        const ChannelType channel,const MagickBooleanType gray)
7092%
7093%  A description of each parameter follows:
7094%
7095%    o wand: the magick wand.
7096%
7097%    o channel: the image channel(s).
7098%
7099%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7100%
7101*/
7102
7103WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7104  const MagickBooleanType gray)
7105{
7106  MagickBooleanType
7107    status;
7108
7109  status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7110  return(status);
7111}
7112
7113WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7114  const ChannelType channel,const MagickBooleanType gray)
7115{
7116  MagickBooleanType
7117    status;
7118
7119  assert(wand != (MagickWand *) NULL);
7120  assert(wand->signature == WandSignature);
7121  if (wand->debug != MagickFalse)
7122    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7123  if (wand->images == (Image *) NULL)
7124    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7125  status=NegateImageChannel(wand->images,channel,gray);
7126  if (status == MagickFalse)
7127    InheritException(wand->exception,&wand->images->exception);
7128  return(status);
7129}
7130
7131/*
7132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7133%                                                                             %
7134%                                                                             %
7135%                                                                             %
7136%   M a g i c k N e w I m a g e                                               %
7137%                                                                             %
7138%                                                                             %
7139%                                                                             %
7140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7141%
7142%  MagickNewImage() adds a blank image canvas of the specified size and
7143%  background color to the wand.
7144%
7145%  The format of the MagickNewImage method is:
7146%
7147%      MagickBooleanType MagickNewImage(MagickWand *wand,
7148%        const size_t columns,const size_t rows,
7149%        const PixelWand *background)
7150%
7151%  A description of each parameter follows:
7152%
7153%    o wand: the magick wand.
7154%
7155%    o width: the image width.
7156%
7157%    o height: the image height.
7158%
7159%    o background: the image color.
7160%
7161*/
7162WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7163  const size_t width,const size_t height,
7164  const PixelWand *background)
7165{
7166  Image
7167    *images;
7168
7169  PixelInfo
7170    pixel;
7171
7172  assert(wand != (MagickWand *) NULL);
7173  assert(wand->signature == WandSignature);
7174  if (wand->debug != MagickFalse)
7175    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7176  PixelGetMagickColor(background,&pixel);
7177  images=NewMagickImage(wand->image_info,width,height,&pixel);
7178  if (images == (Image *) NULL)
7179    return(MagickFalse);
7180  if (images->exception.severity != UndefinedException)
7181    InheritException(wand->exception,&images->exception);
7182  return(InsertImageInWand(wand,images));
7183}
7184
7185/*
7186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7187%                                                                             %
7188%                                                                             %
7189%                                                                             %
7190%   M a g i c k N e x t I m a g e                                             %
7191%                                                                             %
7192%                                                                             %
7193%                                                                             %
7194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7195%
7196%  MagickNextImage() associates the next image in the image list with a magick
7197%  wand.
7198%
7199%  The format of the MagickNextImage method is:
7200%
7201%      MagickBooleanType MagickNextImage(MagickWand *wand)
7202%
7203%  A description of each parameter follows:
7204%
7205%    o wand: the magick wand.
7206%
7207*/
7208WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7209{
7210  assert(wand != (MagickWand *) NULL);
7211  assert(wand->signature == WandSignature);
7212  if (wand->debug != MagickFalse)
7213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7214  if (wand->images == (Image *) NULL)
7215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7216  if (wand->pend != MagickFalse)
7217    {
7218      wand->pend=MagickFalse;
7219      return(MagickTrue);
7220    }
7221  if (GetNextImageInList(wand->images) == (Image *) NULL)
7222    {
7223      wand->pend=MagickTrue;
7224      return(MagickFalse);
7225    }
7226  wand->images=GetNextImageInList(wand->images);
7227  return(MagickTrue);
7228}
7229
7230/*
7231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232%                                                                             %
7233%                                                                             %
7234%                                                                             %
7235%   M a g i c k N o r m a l i z e I m a g e                                   %
7236%                                                                             %
7237%                                                                             %
7238%                                                                             %
7239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240%
7241%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7242%  the pixels color to span the entire range of colors available
7243%
7244%  You can also reduce the influence of a particular channel with a gamma
7245%  value of 0.
7246%
7247%  The format of the MagickNormalizeImage method is:
7248%
7249%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7250%      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7251%        const ChannelType channel)
7252%
7253%  A description of each parameter follows:
7254%
7255%    o wand: the magick wand.
7256%
7257%    o channel: the image channel(s).
7258%
7259*/
7260
7261WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7262{
7263  MagickBooleanType
7264    status;
7265
7266  status=MagickNormalizeImageChannel(wand,DefaultChannels);
7267  return(status);
7268}
7269
7270WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7271  const ChannelType channel)
7272{
7273  MagickBooleanType
7274    status;
7275
7276  assert(wand != (MagickWand *) NULL);
7277  assert(wand->signature == WandSignature);
7278  if (wand->debug != MagickFalse)
7279    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7280  if (wand->images == (Image *) NULL)
7281    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7282  status=NormalizeImageChannel(wand->images,channel);
7283  if (status == MagickFalse)
7284    InheritException(wand->exception,&wand->images->exception);
7285  return(status);
7286}
7287
7288/*
7289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7290%                                                                             %
7291%                                                                             %
7292%                                                                             %
7293%   M a g i c k O i l P a i n t I m a g e                                     %
7294%                                                                             %
7295%                                                                             %
7296%                                                                             %
7297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298%
7299%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7300%  painting.  Each pixel is replaced by the most frequent color occurring
7301%  in a circular region defined by radius.
7302%
7303%  The format of the MagickOilPaintImage method is:
7304%
7305%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7306%        const double radius)
7307%
7308%  A description of each parameter follows:
7309%
7310%    o wand: the magick wand.
7311%
7312%    o radius: the radius of the circular neighborhood.
7313%
7314*/
7315WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7316  const double radius)
7317{
7318  Image
7319    *paint_image;
7320
7321  assert(wand != (MagickWand *) NULL);
7322  assert(wand->signature == WandSignature);
7323  if (wand->debug != MagickFalse)
7324    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7325  if (wand->images == (Image *) NULL)
7326    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7327  paint_image=OilPaintImage(wand->images,radius,wand->exception);
7328  if (paint_image == (Image *) NULL)
7329    return(MagickFalse);
7330  ReplaceImageInList(&wand->images,paint_image);
7331  return(MagickTrue);
7332}
7333
7334/*
7335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7336%                                                                             %
7337%                                                                             %
7338%                                                                             %
7339%   M a g i c k O p a q u e P a i n t I m a g e                               %
7340%                                                                             %
7341%                                                                             %
7342%                                                                             %
7343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7344%
7345%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7346%  defined by fill.
7347%
7348%  The format of the MagickOpaquePaintImage method is:
7349%
7350%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7351%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7352%        const MagickBooleanType invert)
7353%      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7354%        const ChannelType channel,const PixelWand *target,
7355%        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7356%
7357%  A description of each parameter follows:
7358%
7359%    o wand: the magick wand.
7360%
7361%    o channel: the channel(s).
7362%
7363%    o target: Change this target color to the fill color within the image.
7364%
7365%    o fill: the fill pixel wand.
7366%
7367%    o fuzz: By default target must match a particular pixel color
7368%      exactly.  However, in many cases two colors may differ by a small amount.
7369%      The fuzz member of image defines how much tolerance is acceptable to
7370%      consider two colors as the same.  For example, set fuzz to 10 and the
7371%      color red at intensities of 100 and 102 respectively are now interpreted
7372%      as the same color for the purposes of the floodfill.
7373%
7374%    o invert: paint any pixel that does not match the target color.
7375%
7376*/
7377
7378WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7379  const PixelWand *target,const PixelWand *fill,const double fuzz,
7380  const MagickBooleanType invert)
7381{
7382  MagickBooleanType
7383    status;
7384
7385  status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7386    invert);
7387  return(status);
7388}
7389
7390WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7391  const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7392  const double fuzz,const MagickBooleanType invert)
7393{
7394  MagickBooleanType
7395    status;
7396
7397  PixelInfo
7398    fill_pixel,
7399    target_pixel;
7400
7401  assert(wand != (MagickWand *) NULL);
7402  assert(wand->signature == WandSignature);
7403  if (wand->debug != MagickFalse)
7404    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7405  if (wand->images == (Image *) NULL)
7406    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7407  PixelGetMagickColor(target,&target_pixel);
7408  PixelGetMagickColor(fill,&fill_pixel);
7409  wand->images->fuzz=fuzz;
7410  status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7411    &fill_pixel,invert);
7412  if (status == MagickFalse)
7413    InheritException(wand->exception,&wand->images->exception);
7414  return(status);
7415}
7416
7417/*
7418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7419%                                                                             %
7420%                                                                             %
7421%                                                                             %
7422%   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                         %
7423%                                                                             %
7424%                                                                             %
7425%                                                                             %
7426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7427%
7428%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7429%  previous image in the sequence.  From this it attempts to select the
7430%  smallest cropped image to replace each frame, while preserving the results
7431%  of the animation.
7432%
7433%  The format of the MagickOptimizeImageLayers method is:
7434%
7435%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7436%
7437%  A description of each parameter follows:
7438%
7439%    o wand: the magick wand.
7440%
7441*/
7442WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7443{
7444  Image
7445    *optimize_image;
7446
7447  assert(wand != (MagickWand *) NULL);
7448  assert(wand->signature == WandSignature);
7449  if (wand->debug != MagickFalse)
7450    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7451  if (wand->images == (Image *) NULL)
7452    return((MagickWand *) NULL);
7453  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7454  if (optimize_image == (Image *) NULL)
7455    return((MagickWand *) NULL);
7456  return(CloneMagickWandFromImages(wand,optimize_image));
7457}
7458
7459/*
7460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7461%                                                                             %
7462%                                                                             %
7463%                                                                             %
7464%     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                   %
7465%                                                                             %
7466%                                                                             %
7467%                                                                             %
7468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7469%
7470%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7471%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7472%  which can be different for different channels, according to the input
7473%  arguments.
7474%
7475%  The format of the MagickOrderedPosterizeImage method is:
7476%
7477%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7478%        const char *threshold_map)
7479%      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7480%        const ChannelType channel,const char *threshold_map)
7481%
7482%  A description of each parameter follows:
7483%
7484%    o image: the image.
7485%
7486%    o channel: the channel or channels to be thresholded.
7487%
7488%    o threshold_map: A string containing the name of the threshold dither
7489%      map to use, followed by zero or more numbers representing the number of
7490%      color levels tho dither between.
7491%
7492%      Any level number less than 2 is equivalent to 2, and means only binary
7493%      dithering will be applied to each color channel.
7494%
7495%      No numbers also means a 2 level (bitmap) dither will be applied to all
7496%      channels, while a single number is the number of levels applied to each
7497%      channel in sequence.  More numbers will be applied in turn to each of
7498%      the color channels.
7499%
7500%      For example: "o3x3,6" generates a 6 level posterization of the image
7501%      with a ordered 3x3 diffused pixel dither being applied between each
7502%      level. While checker,8,8,4 will produce a 332 colormaped image with
7503%      only a single checkerboard hash pattern (50% grey) between each color
7504%      level, to basically double the number of color levels with a bare
7505%      minimim of dithering.
7506%
7507*/
7508
7509WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7510  const char *threshold_map)
7511{
7512  MagickBooleanType
7513    status;
7514
7515  status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7516  return(status);
7517}
7518
7519WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7520  MagickWand *wand,const ChannelType channel,const char *threshold_map)
7521{
7522  MagickBooleanType
7523    status;
7524
7525  assert(wand != (MagickWand *) NULL);
7526  assert(wand->signature == WandSignature);
7527  if (wand->debug != MagickFalse)
7528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7529  if (wand->images == (Image *) NULL)
7530    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7531  status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7532    wand->exception);
7533  return(status);
7534}
7535
7536/*
7537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7538%                                                                             %
7539%                                                                             %
7540%                                                                             %
7541%   M a g i c k P i n g I m a g e                                             %
7542%                                                                             %
7543%                                                                             %
7544%                                                                             %
7545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7546%
7547%  MagickPingImage() is like MagickReadImage() except the only valid
7548%  information returned is the image width, height, size, and format.  It
7549%  is designed to efficiently obtain this information from a file without
7550%  reading the entire image sequence into memory.
7551%
7552%  The format of the MagickPingImage method is:
7553%
7554%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7555%
7556%  A description of each parameter follows:
7557%
7558%    o wand: the magick wand.
7559%
7560%    o filename: the image filename.
7561%
7562*/
7563WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7564  const char *filename)
7565{
7566  Image
7567    *images;
7568
7569  ImageInfo
7570    *ping_info;
7571
7572  assert(wand != (MagickWand *) NULL);
7573  assert(wand->signature == WandSignature);
7574  if (wand->debug != MagickFalse)
7575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7576  ping_info=CloneImageInfo(wand->image_info);
7577  if (filename != (const char *) NULL)
7578    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7579  images=PingImage(ping_info,wand->exception);
7580  ping_info=DestroyImageInfo(ping_info);
7581  if (images == (Image *) NULL)
7582    return(MagickFalse);
7583  return(InsertImageInWand(wand,images));
7584}
7585
7586/*
7587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7588%                                                                             %
7589%                                                                             %
7590%                                                                             %
7591%   M a g i c k P i n g I m a g e B l o b                                     %
7592%                                                                             %
7593%                                                                             %
7594%                                                                             %
7595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7596%
7597%  MagickPingImageBlob() pings an image or image sequence from a blob.
7598%
7599%  The format of the MagickPingImageBlob method is:
7600%
7601%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7602%        const void *blob,const size_t length)
7603%
7604%  A description of each parameter follows:
7605%
7606%    o wand: the magick wand.
7607%
7608%    o blob: the blob.
7609%
7610%    o length: the blob length.
7611%
7612*/
7613WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7614  const void *blob,const size_t length)
7615{
7616  Image
7617    *images;
7618
7619  ImageInfo
7620    *read_info;
7621
7622  assert(wand != (MagickWand *) NULL);
7623  assert(wand->signature == WandSignature);
7624  if (wand->debug != MagickFalse)
7625    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7626  read_info=CloneImageInfo(wand->image_info);
7627  SetImageInfoBlob(read_info,blob,length);
7628  images=PingImage(read_info,wand->exception);
7629  read_info=DestroyImageInfo(read_info);
7630  if (images == (Image *) NULL)
7631    return(MagickFalse);
7632  return(InsertImageInWand(wand,images));
7633}
7634
7635/*
7636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7637%                                                                             %
7638%                                                                             %
7639%                                                                             %
7640%   M a g i c k P i n g I m a g e F i l e                                     %
7641%                                                                             %
7642%                                                                             %
7643%                                                                             %
7644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7645%
7646%  MagickPingImageFile() pings an image or image sequence from an open file
7647%  descriptor.
7648%
7649%  The format of the MagickPingImageFile method is:
7650%
7651%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7652%
7653%  A description of each parameter follows:
7654%
7655%    o wand: the magick wand.
7656%
7657%    o file: the file descriptor.
7658%
7659*/
7660WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7661{
7662  Image
7663    *images;
7664
7665  ImageInfo
7666    *read_info;
7667
7668  assert(wand != (MagickWand *) NULL);
7669  assert(wand->signature == WandSignature);
7670  assert(file != (FILE *) NULL);
7671  if (wand->debug != MagickFalse)
7672    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7673  read_info=CloneImageInfo(wand->image_info);
7674  SetImageInfoFile(read_info,file);
7675  images=PingImage(read_info,wand->exception);
7676  read_info=DestroyImageInfo(read_info);
7677  if (images == (Image *) NULL)
7678    return(MagickFalse);
7679  return(InsertImageInWand(wand,images));
7680}
7681
7682/*
7683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7684%                                                                             %
7685%                                                                             %
7686%                                                                             %
7687%   M a g i c k P o l a r o i d I m a g e                                     %
7688%                                                                             %
7689%                                                                             %
7690%                                                                             %
7691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7692%
7693%  MagickPolaroidImage() simulates a Polaroid picture.
7694%
7695%  The format of the MagickPolaroidImage method is:
7696%
7697%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7698%        const DrawingWand *drawing_wand,const double angle)
7699%
7700%  A description of each parameter follows:
7701%
7702%    o wand: the magick wand.
7703%
7704%    o drawing_wand: the draw wand.
7705%
7706%    o angle: Apply the effect along this angle.
7707%
7708*/
7709WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7710  const DrawingWand *drawing_wand,const double angle)
7711{
7712  DrawInfo
7713    *draw_info;
7714
7715  Image
7716    *polaroid_image;
7717
7718  assert(wand != (MagickWand *) NULL);
7719  assert(wand->signature == WandSignature);
7720  if (wand->debug != MagickFalse)
7721    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7722  if (wand->images == (Image *) NULL)
7723    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7724  draw_info=PeekDrawingWand(drawing_wand);
7725  if (draw_info == (DrawInfo *) NULL)
7726    return(MagickFalse);
7727  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7728  if (polaroid_image == (Image *) NULL)
7729    return(MagickFalse);
7730  ReplaceImageInList(&wand->images,polaroid_image);
7731  return(MagickTrue);
7732}
7733
7734/*
7735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7736%                                                                             %
7737%                                                                             %
7738%                                                                             %
7739%   M a g i c k P o s t e r i z e I m a g e                                   %
7740%                                                                             %
7741%                                                                             %
7742%                                                                             %
7743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7744%
7745%  MagickPosterizeImage() reduces the image to a limited number of color level.
7746%
7747%  The format of the MagickPosterizeImage method is:
7748%
7749%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7750%        const unsigned levels,const MagickBooleanType dither)
7751%
7752%  A description of each parameter follows:
7753%
7754%    o wand: the magick wand.
7755%
7756%    o levels: Number of color levels allowed in each channel.  Very low values
7757%      (2, 3, or 4) have the most visible effect.
7758%
7759%    o dither: Set this integer value to something other than zero to dither
7760%      the mapped image.
7761%
7762*/
7763WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7764  const size_t levels,const MagickBooleanType dither)
7765{
7766  MagickBooleanType
7767    status;
7768
7769  assert(wand != (MagickWand *) NULL);
7770  assert(wand->signature == WandSignature);
7771  if (wand->debug != MagickFalse)
7772    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7773  if (wand->images == (Image *) NULL)
7774    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7775  status=PosterizeImage(wand->images,levels,dither);
7776  if (status == MagickFalse)
7777    InheritException(wand->exception,&wand->images->exception);
7778  return(status);
7779}
7780
7781/*
7782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7783%                                                                             %
7784%                                                                             %
7785%                                                                             %
7786%   M a g i c k P r e v i e w I m a g e s                                     %
7787%                                                                             %
7788%                                                                             %
7789%                                                                             %
7790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7791%
7792%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7793%  image processing operation applied at varying strengths.  This helpful
7794%  to quickly pin-point an appropriate parameter for an image processing
7795%  operation.
7796%
7797%  The format of the MagickPreviewImages method is:
7798%
7799%      MagickWand *MagickPreviewImages(MagickWand *wand,
7800%        const PreviewType preview)
7801%
7802%  A description of each parameter follows:
7803%
7804%    o wand: the magick wand.
7805%
7806%    o preview: the preview type.
7807%
7808*/
7809WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7810  const PreviewType preview)
7811{
7812  Image
7813    *preview_image;
7814
7815  assert(wand != (MagickWand *) NULL);
7816  assert(wand->signature == WandSignature);
7817  if (wand->debug != MagickFalse)
7818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7819  if (wand->images == (Image *) NULL)
7820    return((MagickWand *) NULL);
7821  preview_image=PreviewImage(wand->images,preview,wand->exception);
7822  if (preview_image == (Image *) NULL)
7823    return((MagickWand *) NULL);
7824  return(CloneMagickWandFromImages(wand,preview_image));
7825}
7826
7827/*
7828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7829%                                                                             %
7830%                                                                             %
7831%                                                                             %
7832%   M a g i c k P r e v i o u s I m a g e                                     %
7833%                                                                             %
7834%                                                                             %
7835%                                                                             %
7836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7837%
7838%  MagickPreviousImage() assocates the previous image in an image list with
7839%  the magick wand.
7840%
7841%  The format of the MagickPreviousImage method is:
7842%
7843%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7844%
7845%  A description of each parameter follows:
7846%
7847%    o wand: the magick wand.
7848%
7849*/
7850WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7851{
7852  assert(wand != (MagickWand *) NULL);
7853  assert(wand->signature == WandSignature);
7854  if (wand->debug != MagickFalse)
7855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7856  if (wand->images == (Image *) NULL)
7857    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7858  if (wand->pend != MagickFalse)
7859    {
7860      wand->pend=MagickFalse;
7861      return(MagickTrue);
7862    }
7863  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7864    {
7865      wand->pend=MagickTrue;
7866      return(MagickFalse);
7867    }
7868  wand->images=GetPreviousImageInList(wand->images);
7869  return(MagickTrue);
7870}
7871
7872/*
7873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7874%                                                                             %
7875%                                                                             %
7876%                                                                             %
7877%   M a g i c k Q u a n t i z e I m a g e                                     %
7878%                                                                             %
7879%                                                                             %
7880%                                                                             %
7881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7882%
7883%  MagickQuantizeImage() analyzes the colors within a reference image and
7884%  chooses a fixed number of colors to represent the image.  The goal of the
7885%  algorithm is to minimize the color difference between the input and output
7886%  image while minimizing the processing time.
7887%
7888%  The format of the MagickQuantizeImage method is:
7889%
7890%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7891%        const size_t number_colors,const ColorspaceType colorspace,
7892%        const size_t treedepth,const MagickBooleanType dither,
7893%        const MagickBooleanType measure_error)
7894%
7895%  A description of each parameter follows:
7896%
7897%    o wand: the magick wand.
7898%
7899%    o number_colors: the number of colors.
7900%
7901%    o colorspace: Perform color reduction in this colorspace, typically
7902%      RGBColorspace.
7903%
7904%    o treedepth: Normally, this integer value is zero or one.  A zero or
7905%      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
7906%      reference image with the least amount of memory and the fastest
7907%      computational speed.  In some cases, such as an image with low color
7908%      dispersion (a few number of colors), a value other than
7909%      Log4(number_colors) is required.  To expand the color tree completely,
7910%      use a value of 8.
7911%
7912%    o dither: A value other than zero distributes the difference between an
7913%      original image and the corresponding color reduced image to
7914%      neighboring pixels along a Hilbert curve.
7915%
7916%    o measure_error: A value other than zero measures the difference between
7917%      the original and quantized images.  This difference is the total
7918%      quantization error.  The error is computed by summing over all pixels
7919%      in an image the distance squared in RGB space between each reference
7920%      pixel value and its quantized value.
7921%
7922*/
7923WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7924  const size_t number_colors,const ColorspaceType colorspace,
7925  const size_t treedepth,const MagickBooleanType dither,
7926  const MagickBooleanType measure_error)
7927{
7928  MagickBooleanType
7929    status;
7930
7931  QuantizeInfo
7932    *quantize_info;
7933
7934  assert(wand != (MagickWand *) NULL);
7935  assert(wand->signature == WandSignature);
7936  if (wand->debug != MagickFalse)
7937    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7938  if (wand->images == (Image *) NULL)
7939    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7940  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7941  quantize_info->number_colors=number_colors;
7942  quantize_info->dither=dither;
7943  quantize_info->tree_depth=treedepth;
7944  quantize_info->colorspace=colorspace;
7945  quantize_info->measure_error=measure_error;
7946  status=QuantizeImage(quantize_info,wand->images);
7947  if (status == MagickFalse)
7948    InheritException(wand->exception,&wand->images->exception);
7949  quantize_info=DestroyQuantizeInfo(quantize_info);
7950  return(status);
7951}
7952
7953/*
7954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7955%                                                                             %
7956%                                                                             %
7957%                                                                             %
7958%   M a g i c k Q u a n t i z e I m a g e s                                   %
7959%                                                                             %
7960%                                                                             %
7961%                                                                             %
7962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7963%
7964%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7965%  chooses a fixed number of colors to represent the image.  The goal of the
7966%  algorithm is to minimize the color difference between the input and output
7967%  image while minimizing the processing time.
7968%
7969%  The format of the MagickQuantizeImages method is:
7970%
7971%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7972%        const size_t number_colors,const ColorspaceType colorspace,
7973%        const size_t treedepth,const MagickBooleanType dither,
7974%        const MagickBooleanType measure_error)
7975%
7976%  A description of each parameter follows:
7977%
7978%    o wand: the magick wand.
7979%
7980%    o number_colors: the number of colors.
7981%
7982%    o colorspace: Perform color reduction in this colorspace, typically
7983%      RGBColorspace.
7984%
7985%    o treedepth: Normally, this integer value is zero or one.  A zero or
7986%      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
7987%      reference image with the least amount of memory and the fastest
7988%      computational speed.  In some cases, such as an image with low color
7989%      dispersion (a few number of colors), a value other than
7990%      Log4(number_colors) is required.  To expand the color tree completely,
7991%      use a value of 8.
7992%
7993%    o dither: A value other than zero distributes the difference between an
7994%      original image and the corresponding color reduced algorithm to
7995%      neighboring pixels along a Hilbert curve.
7996%
7997%    o measure_error: A value other than zero measures the difference between
7998%      the original and quantized images.  This difference is the total
7999%      quantization error.  The error is computed by summing over all pixels
8000%      in an image the distance squared in RGB space between each reference
8001%      pixel value and its quantized value.
8002%
8003*/
8004WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8005  const size_t number_colors,const ColorspaceType colorspace,
8006  const size_t treedepth,const MagickBooleanType dither,
8007  const MagickBooleanType measure_error)
8008{
8009  MagickBooleanType
8010    status;
8011
8012  QuantizeInfo
8013    *quantize_info;
8014
8015  assert(wand != (MagickWand *) NULL);
8016  assert(wand->signature == WandSignature);
8017  if (wand->debug != MagickFalse)
8018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8019  if (wand->images == (Image *) NULL)
8020    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8021  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8022  quantize_info->number_colors=number_colors;
8023  quantize_info->dither=dither;
8024  quantize_info->tree_depth=treedepth;
8025  quantize_info->colorspace=colorspace;
8026  quantize_info->measure_error=measure_error;
8027  status=QuantizeImages(quantize_info,wand->images);
8028  if (status == MagickFalse)
8029    InheritException(wand->exception,&wand->images->exception);
8030  quantize_info=DestroyQuantizeInfo(quantize_info);
8031  return(status);
8032}
8033
8034/*
8035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8036%                                                                             %
8037%                                                                             %
8038%                                                                             %
8039%   M a g i c k R a d i a l B l u r I m a g e                                 %
8040%                                                                             %
8041%                                                                             %
8042%                                                                             %
8043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8044%
8045%  MagickRadialBlurImage() radial blurs an image.
8046%
8047%  The format of the MagickRadialBlurImage method is:
8048%
8049%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8050%        const double angle)
8051%      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8052%        const ChannelType channel,const double angle)
8053%
8054%  A description of each parameter follows:
8055%
8056%    o wand: the magick wand.
8057%
8058%    o channel: the image channel(s).
8059%
8060%    o angle: the angle of the blur in degrees.
8061%
8062*/
8063WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8064  const double angle)
8065{
8066  MagickBooleanType
8067    status;
8068
8069  status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8070  return(status);
8071}
8072
8073WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8074  const ChannelType channel,const double angle)
8075{
8076  Image
8077    *blur_image;
8078
8079  assert(wand != (MagickWand *) NULL);
8080  assert(wand->signature == WandSignature);
8081  if (wand->debug != MagickFalse)
8082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8083  if (wand->images == (Image *) NULL)
8084    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8085  blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8086    wand->exception);
8087  if (blur_image == (Image *) NULL)
8088    return(MagickFalse);
8089  ReplaceImageInList(&wand->images,blur_image);
8090  return(MagickTrue);
8091}
8092
8093/*
8094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8095%                                                                             %
8096%                                                                             %
8097%                                                                             %
8098%   M a g i c k R a i s e I m a g e                                           %
8099%                                                                             %
8100%                                                                             %
8101%                                                                             %
8102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8103%
8104%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8105%  by lightening and darkening the edges of the image.  Members width and
8106%  height of raise_info define the width of the vertical and horizontal
8107%  edge of the effect.
8108%
8109%  The format of the MagickRaiseImage method is:
8110%
8111%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8112%        const size_t width,const size_t height,const ssize_t x,
8113%        const ssize_t y,const MagickBooleanType raise)
8114%
8115%  A description of each parameter follows:
8116%
8117%    o wand: the magick wand.
8118%
8119%    o width,height,x,y:  Define the dimensions of the area to raise.
8120%
8121%    o raise: A value other than zero creates a 3-D raise effect,
8122%      otherwise it has a lowered effect.
8123%
8124*/
8125WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8126  const size_t width,const size_t height,const ssize_t x,
8127  const ssize_t y,const MagickBooleanType raise)
8128{
8129  MagickBooleanType
8130    status;
8131
8132  RectangleInfo
8133    raise_info;
8134
8135  assert(wand != (MagickWand *) NULL);
8136  assert(wand->signature == WandSignature);
8137  if (wand->debug != MagickFalse)
8138    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8139  if (wand->images == (Image *) NULL)
8140    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8141  raise_info.width=width;
8142  raise_info.height=height;
8143  raise_info.x=x;
8144  raise_info.y=y;
8145  status=RaiseImage(wand->images,&raise_info,raise);
8146  if (status == MagickFalse)
8147    InheritException(wand->exception,&wand->images->exception);
8148  return(status);
8149}
8150
8151/*
8152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8153%                                                                             %
8154%                                                                             %
8155%                                                                             %
8156%   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                       %
8157%                                                                             %
8158%                                                                             %
8159%                                                                             %
8160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8161%
8162%  MagickRandomThresholdImage() changes the value of individual pixels based on
8163%  the intensity of each pixel compared to threshold.  The result is a
8164%  high-contrast, two color image.
8165%
8166%  The format of the MagickRandomThresholdImage method is:
8167%
8168%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8169%        const double low,const double high)
8170%      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8171%        const ChannelType channel,const double low,const double high)
8172%
8173%  A description of each parameter follows:
8174%
8175%    o wand: the magick wand.
8176%
8177%    o channel: the image channel(s).
8178%
8179%    o low,high: Specify the high and low thresholds.  These values range from
8180%      0 to QuantumRange.
8181%
8182*/
8183
8184WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8185  const double low,const double high)
8186{
8187  MagickBooleanType
8188    status;
8189
8190  status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8191  return(status);
8192}
8193
8194WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8195  MagickWand *wand,const ChannelType channel,const double low,
8196  const double high)
8197{
8198  char
8199    threshold[MaxTextExtent];
8200
8201  MagickBooleanType
8202    status;
8203
8204  assert(wand != (MagickWand *) NULL);
8205  assert(wand->signature == WandSignature);
8206  if (wand->debug != MagickFalse)
8207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8208  if (wand->images == (Image *) NULL)
8209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8210  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8211  status=RandomThresholdImageChannel(wand->images,channel,threshold,
8212    wand->exception);
8213  if (status == MagickFalse)
8214    InheritException(wand->exception,&wand->images->exception);
8215  return(status);
8216}
8217
8218/*
8219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8220%                                                                             %
8221%                                                                             %
8222%                                                                             %
8223%   M a g i c k R e a d I m a g e                                             %
8224%                                                                             %
8225%                                                                             %
8226%                                                                             %
8227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8228%
8229%  MagickReadImage() reads an image or image sequence.  The images are inserted
8230%  at the current image pointer position.   Use MagickSetFirstIterator(),
8231%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8232%  image pointer position at the beginning of the image list, the end, or
8233%  anywhere in-between respectively.
8234%
8235%  The format of the MagickReadImage method is:
8236%
8237%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8238%
8239%  A description of each parameter follows:
8240%
8241%    o wand: the magick wand.
8242%
8243%    o filename: the image filename.
8244%
8245*/
8246WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8247  const char *filename)
8248{
8249  Image
8250    *images;
8251
8252  ImageInfo
8253    *read_info;
8254
8255  assert(wand != (MagickWand *) NULL);
8256  assert(wand->signature == WandSignature);
8257  if (wand->debug != MagickFalse)
8258    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8259  read_info=CloneImageInfo(wand->image_info);
8260  if (filename != (const char *) NULL)
8261    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8262  images=ReadImage(read_info,wand->exception);
8263  read_info=DestroyImageInfo(read_info);
8264  if (images == (Image *) NULL)
8265    return(MagickFalse);
8266  return(InsertImageInWand(wand,images));
8267}
8268
8269/*
8270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8271%                                                                             %
8272%                                                                             %
8273%                                                                             %
8274%   M a g i c k R e a d I m a g e B l o b                                     %
8275%                                                                             %
8276%                                                                             %
8277%                                                                             %
8278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8279%
8280%  MagickReadImageBlob() reads an image or image sequence from a blob.
8281%
8282%  The format of the MagickReadImageBlob method is:
8283%
8284%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8285%        const void *blob,const size_t length)
8286%
8287%  A description of each parameter follows:
8288%
8289%    o wand: the magick wand.
8290%
8291%    o blob: the blob.
8292%
8293%    o length: the blob length.
8294%
8295*/
8296WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8297  const void *blob,const size_t length)
8298{
8299  Image
8300    *images;
8301
8302  assert(wand != (MagickWand *) NULL);
8303  assert(wand->signature == WandSignature);
8304  if (wand->debug != MagickFalse)
8305    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8306  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8307  if (images == (Image *) NULL)
8308    return(MagickFalse);
8309  return(InsertImageInWand(wand,images));
8310}
8311
8312/*
8313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8314%                                                                             %
8315%                                                                             %
8316%                                                                             %
8317%   M a g i c k R e a d I m a g e F i l e                                     %
8318%                                                                             %
8319%                                                                             %
8320%                                                                             %
8321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8322%
8323%  MagickReadImageFile() reads an image or image sequence from an open file
8324%  descriptor.
8325%
8326%  The format of the MagickReadImageFile method is:
8327%
8328%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8329%
8330%  A description of each parameter follows:
8331%
8332%    o wand: the magick wand.
8333%
8334%    o file: the file descriptor.
8335%
8336*/
8337WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8338{
8339  Image
8340    *images;
8341
8342  ImageInfo
8343    *read_info;
8344
8345  assert(wand != (MagickWand *) NULL);
8346  assert(wand->signature == WandSignature);
8347  assert(file != (FILE *) NULL);
8348  if (wand->debug != MagickFalse)
8349    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8350  read_info=CloneImageInfo(wand->image_info);
8351  SetImageInfoFile(read_info,file);
8352  images=ReadImage(read_info,wand->exception);
8353  read_info=DestroyImageInfo(read_info);
8354  if (images == (Image *) NULL)
8355    return(MagickFalse);
8356  return(InsertImageInWand(wand,images));
8357}
8358
8359/*
8360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8361%                                                                             %
8362%                                                                             %
8363%                                                                             %
8364%   M a g i c k R e m a p I m a g e                                           %
8365%                                                                             %
8366%                                                                             %
8367%                                                                             %
8368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8369%
8370%  MagickRemapImage() replaces the colors of an image with the closest color
8371%  from a reference image.
8372%
8373%  The format of the MagickRemapImage method is:
8374%
8375%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8376%        const MagickWand *remap_wand,const DitherMethod method)
8377%
8378%  A description of each parameter follows:
8379%
8380%    o wand: the magick wand.
8381%
8382%    o affinity: the affinity wand.
8383%
8384%    o method: choose from these dither methods: NoDitherMethod,
8385%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8386%
8387*/
8388WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8389  const MagickWand *remap_wand,const DitherMethod method)
8390{
8391  MagickBooleanType
8392    status;
8393
8394  QuantizeInfo
8395    *quantize_info;
8396
8397  assert(wand != (MagickWand *) NULL);
8398  assert(wand->signature == WandSignature);
8399  if (wand->debug != MagickFalse)
8400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8401  if ((wand->images == (Image *) NULL) ||
8402      (remap_wand->images == (Image *) NULL))
8403    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8404  quantize_info=AcquireQuantizeInfo(wand->image_info);
8405  quantize_info->dither_method=method;
8406  if (method == NoDitherMethod)
8407    quantize_info->dither=MagickFalse;
8408  status=RemapImage(quantize_info,wand->images,remap_wand->images);
8409  quantize_info=DestroyQuantizeInfo(quantize_info);
8410  if (status == MagickFalse)
8411    InheritException(wand->exception,&wand->images->exception);
8412  return(status);
8413}
8414
8415/*
8416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8417%                                                                             %
8418%                                                                             %
8419%                                                                             %
8420%   M a g i c k R e m o v e I m a g e                                         %
8421%                                                                             %
8422%                                                                             %
8423%                                                                             %
8424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8425%
8426%  MagickRemoveImage() removes an image from the image list.
8427%
8428%  The format of the MagickRemoveImage method is:
8429%
8430%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8431%
8432%  A description of each parameter follows:
8433%
8434%    o wand: the magick wand.
8435%
8436%    o insert: the splice wand.
8437%
8438*/
8439WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8440{
8441  assert(wand != (MagickWand *) NULL);
8442  assert(wand->signature == WandSignature);
8443  if (wand->debug != MagickFalse)
8444    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8445  if (wand->images == (Image *) NULL)
8446    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8447  DeleteImageFromList(&wand->images);
8448  return(MagickTrue);
8449}
8450
8451/*
8452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8453%                                                                             %
8454%                                                                             %
8455%                                                                             %
8456%   M a g i c k R e s a m p l e I m a g e                                     %
8457%                                                                             %
8458%                                                                             %
8459%                                                                             %
8460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8461%
8462%  MagickResampleImage() resample image to desired resolution.
8463%
8464%    Bessel   Blackman   Box
8465%    Catrom   Cubic      Gaussian
8466%    Hanning  Hermite    Lanczos
8467%    Mitchell Point      Quandratic
8468%    Sinc     Triangle
8469%
8470%  Most of the filters are FIR (finite impulse response), however, Bessel,
8471%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8472%  are windowed (brought down to zero) with the Blackman filter.
8473%
8474%  The format of the MagickResampleImage method is:
8475%
8476%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8477%        const double x_resolution,const double y_resolution,
8478%        const FilterTypes filter,const double blur)
8479%
8480%  A description of each parameter follows:
8481%
8482%    o wand: the magick wand.
8483%
8484%    o x_resolution: the new image x resolution.
8485%
8486%    o y_resolution: the new image y resolution.
8487%
8488%    o filter: Image filter to use.
8489%
8490%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8491%
8492*/
8493WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8494  const double x_resolution,const double y_resolution,const FilterTypes filter,
8495  const double blur)
8496{
8497  Image
8498    *resample_image;
8499
8500  assert(wand != (MagickWand *) NULL);
8501  assert(wand->signature == WandSignature);
8502  if (wand->debug != MagickFalse)
8503    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8504  if (wand->images == (Image *) NULL)
8505    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8506  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8507    blur,wand->exception);
8508  if (resample_image == (Image *) NULL)
8509    return(MagickFalse);
8510  ReplaceImageInList(&wand->images,resample_image);
8511  return(MagickTrue);
8512}
8513
8514/*
8515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8516%                                                                             %
8517%                                                                             %
8518%                                                                             %
8519%   M a g i c k R e s e t I m a g e P a g e                                   %
8520%                                                                             %
8521%                                                                             %
8522%                                                                             %
8523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8524%
8525%  MagickResetImagePage() resets the Wand page canvas and position.
8526%
8527%  The format of the MagickResetImagePage method is:
8528%
8529%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8530%        const char *page)
8531%
8532%  A description of each parameter follows:
8533%
8534%    o wand: the magick wand.
8535%
8536%    o page: the relative page specification.
8537%
8538*/
8539WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8540  const char *page)
8541{
8542  assert(wand != (MagickWand *) NULL);
8543  assert(wand->signature == WandSignature);
8544  if (wand->debug != MagickFalse)
8545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8546  if (wand->images == (Image *) NULL)
8547    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8548  if ((page == (char *) NULL) || (*page == '\0'))
8549    {
8550      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8551      return(MagickTrue);
8552    }
8553  return(ResetImagePage(wand->images,page));
8554}
8555
8556/*
8557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8558%                                                                             %
8559%                                                                             %
8560%                                                                             %
8561%   M a g i c k R e s i z e I m a g e                                         %
8562%                                                                             %
8563%                                                                             %
8564%                                                                             %
8565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8566%
8567%  MagickResizeImage() scales an image to the desired dimensions with one of
8568%  these filters:
8569%
8570%    Bessel   Blackman   Box
8571%    Catrom   Cubic      Gaussian
8572%    Hanning  Hermite    Lanczos
8573%    Mitchell Point      Quandratic
8574%    Sinc     Triangle
8575%
8576%  Most of the filters are FIR (finite impulse response), however, Bessel,
8577%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8578%  are windowed (brought down to zero) with the Blackman filter.
8579%
8580%  The format of the MagickResizeImage method is:
8581%
8582%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8583%        const size_t columns,const size_t rows,
8584%        const FilterTypes filter,const double blur)
8585%
8586%  A description of each parameter follows:
8587%
8588%    o wand: the magick wand.
8589%
8590%    o columns: the number of columns in the scaled image.
8591%
8592%    o rows: the number of rows in the scaled image.
8593%
8594%    o filter: Image filter to use.
8595%
8596%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8597%
8598*/
8599WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8600  const size_t columns,const size_t rows,const FilterTypes filter,
8601  const double blur)
8602{
8603  Image
8604    *resize_image;
8605
8606  assert(wand != (MagickWand *) NULL);
8607  assert(wand->signature == WandSignature);
8608  if (wand->debug != MagickFalse)
8609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8610  if (wand->images == (Image *) NULL)
8611    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8612  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8613    wand->exception);
8614  if (resize_image == (Image *) NULL)
8615    return(MagickFalse);
8616  ReplaceImageInList(&wand->images,resize_image);
8617  return(MagickTrue);
8618}
8619
8620/*
8621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8622%                                                                             %
8623%                                                                             %
8624%                                                                             %
8625%   M a g i c k R o l l I m a g e                                             %
8626%                                                                             %
8627%                                                                             %
8628%                                                                             %
8629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8630%
8631%  MagickRollImage() offsets an image as defined by x and y.
8632%
8633%  The format of the MagickRollImage method is:
8634%
8635%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8636%        const size_t y)
8637%
8638%  A description of each parameter follows:
8639%
8640%    o wand: the magick wand.
8641%
8642%    o x: the x offset.
8643%
8644%    o y: the y offset.
8645%
8646%
8647*/
8648WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8649  const ssize_t x,const ssize_t y)
8650{
8651  Image
8652    *roll_image;
8653
8654  assert(wand != (MagickWand *) NULL);
8655  assert(wand->signature == WandSignature);
8656  if (wand->debug != MagickFalse)
8657    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8658  if (wand->images == (Image *) NULL)
8659    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8660  roll_image=RollImage(wand->images,x,y,wand->exception);
8661  if (roll_image == (Image *) NULL)
8662    return(MagickFalse);
8663  ReplaceImageInList(&wand->images,roll_image);
8664  return(MagickTrue);
8665}
8666
8667/*
8668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8669%                                                                             %
8670%                                                                             %
8671%                                                                             %
8672%   M a g i c k R o t a t e I m a g e                                         %
8673%                                                                             %
8674%                                                                             %
8675%                                                                             %
8676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8677%
8678%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8679%  triangles left over from rotating the image are filled with the
8680%  background color.
8681%
8682%  The format of the MagickRotateImage method is:
8683%
8684%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8685%        const PixelWand *background,const double degrees)
8686%
8687%  A description of each parameter follows:
8688%
8689%    o wand: the magick wand.
8690%
8691%    o background: the background pixel wand.
8692%
8693%    o degrees: the number of degrees to rotate the image.
8694%
8695%
8696*/
8697WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8698  const PixelWand *background,const double degrees)
8699{
8700  Image
8701    *rotate_image;
8702
8703  assert(wand != (MagickWand *) NULL);
8704  assert(wand->signature == WandSignature);
8705  if (wand->debug != MagickFalse)
8706    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8707  if (wand->images == (Image *) NULL)
8708    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8709  PixelGetQuantumPacket(background,&wand->images->background_color);
8710  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8711  if (rotate_image == (Image *) NULL)
8712    return(MagickFalse);
8713  ReplaceImageInList(&wand->images,rotate_image);
8714  return(MagickTrue);
8715}
8716
8717/*
8718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8719%                                                                             %
8720%                                                                             %
8721%                                                                             %
8722%   M a g i c k S a m p l e I m a g e                                         %
8723%                                                                             %
8724%                                                                             %
8725%                                                                             %
8726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8727%
8728%  MagickSampleImage() scales an image to the desired dimensions with pixel
8729%  sampling.  Unlike other scaling methods, this method does not introduce
8730%  any additional color into the scaled image.
8731%
8732%  The format of the MagickSampleImage method is:
8733%
8734%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8735%        const size_t columns,const size_t rows)
8736%
8737%  A description of each parameter follows:
8738%
8739%    o wand: the magick wand.
8740%
8741%    o columns: the number of columns in the scaled image.
8742%
8743%    o rows: the number of rows in the scaled image.
8744%
8745%
8746*/
8747WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8748  const size_t columns,const size_t rows)
8749{
8750  Image
8751    *sample_image;
8752
8753  assert(wand != (MagickWand *) NULL);
8754  assert(wand->signature == WandSignature);
8755  if (wand->debug != MagickFalse)
8756    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8757  if (wand->images == (Image *) NULL)
8758    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8759  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8760  if (sample_image == (Image *) NULL)
8761    return(MagickFalse);
8762  ReplaceImageInList(&wand->images,sample_image);
8763  return(MagickTrue);
8764}
8765
8766/*
8767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8768%                                                                             %
8769%                                                                             %
8770%                                                                             %
8771%   M a g i c k S c a l e I m a g e                                           %
8772%                                                                             %
8773%                                                                             %
8774%                                                                             %
8775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8776%
8777%  MagickScaleImage() scales the size of an image to the given dimensions.
8778%
8779%  The format of the MagickScaleImage method is:
8780%
8781%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8782%        const size_t columns,const size_t rows)
8783%
8784%  A description of each parameter follows:
8785%
8786%    o wand: the magick wand.
8787%
8788%    o columns: the number of columns in the scaled image.
8789%
8790%    o rows: the number of rows in the scaled image.
8791%
8792%
8793*/
8794WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8795  const size_t columns,const size_t rows)
8796{
8797  Image
8798    *scale_image;
8799
8800  assert(wand != (MagickWand *) NULL);
8801  assert(wand->signature == WandSignature);
8802  if (wand->debug != MagickFalse)
8803    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8804  if (wand->images == (Image *) NULL)
8805    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8806  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8807  if (scale_image == (Image *) NULL)
8808    return(MagickFalse);
8809  ReplaceImageInList(&wand->images,scale_image);
8810  return(MagickTrue);
8811}
8812
8813/*
8814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8815%                                                                             %
8816%                                                                             %
8817%                                                                             %
8818%   M a g i c k S e g m e n t I m a g e                                       %
8819%                                                                             %
8820%                                                                             %
8821%                                                                             %
8822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8823%
8824%  MagickSegmentImage() segments an image by analyzing the histograms of the
8825%  color components and identifying units that are homogeneous with the fuzzy
8826%  C-means technique.
8827%
8828%  The format of the SegmentImage method is:
8829%
8830%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8831%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8832%        const double cluster_threshold,const double smooth_threshold)
8833%
8834%  A description of each parameter follows.
8835%
8836%    o wand: the wand.
8837%
8838%    o colorspace: the image colorspace.
8839%
8840%    o verbose:  Set to MagickTrue to print detailed information about the
8841%      identified classes.
8842%
8843%    o cluster_threshold:  This represents the minimum number of pixels
8844%      contained in a hexahedra before it can be considered valid (expressed as
8845%      a percentage).
8846%
8847%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8848%      derivative of the histogram.  As the value is increased, you can expect a
8849%      smoother second derivative.
8850%
8851*/
8852MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8853  const ColorspaceType colorspace,const MagickBooleanType verbose,
8854  const double cluster_threshold,const double smooth_threshold)
8855{
8856  MagickBooleanType
8857    status;
8858
8859  assert(wand != (MagickWand *) NULL);
8860  assert(wand->signature == WandSignature);
8861  if (wand->debug != MagickFalse)
8862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8863  if (wand->images == (Image *) NULL)
8864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8865  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8866    smooth_threshold);
8867  if (status == MagickFalse)
8868    InheritException(wand->exception,&wand->images->exception);
8869  return(status);
8870}
8871
8872/*
8873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8874%                                                                             %
8875%                                                                             %
8876%                                                                             %
8877%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8878%                                                                             %
8879%                                                                             %
8880%                                                                             %
8881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8882%
8883%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8884%  threshold. It is similar to the unsharpen mask that sharpens everything with
8885%  contrast above a certain threshold.
8886%
8887%  The format of the MagickSelectiveBlurImage method is:
8888%
8889%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8890%        const double radius,const double sigma,const double threshold)
8891%      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8892%        const ChannelType channel,const double radius,const double sigma,
8893%        const double threshold)
8894%
8895%  A description of each parameter follows:
8896%
8897%    o wand: the magick wand.
8898%
8899%    o channel: the image channel(s).
8900%
8901%    o radius: the radius of the gaussian, in pixels, not counting the center
8902%      pixel.
8903%
8904%    o sigma: the standard deviation of the gaussian, in pixels.
8905%
8906%    o threshold: only pixels within this contrast threshold are included
8907%      in the blur operation.
8908%
8909*/
8910
8911WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8912  const double radius,const double sigma,const double threshold)
8913{
8914  MagickBooleanType
8915    status;
8916
8917  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
8918    threshold);
8919  return(status);
8920}
8921
8922WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8923  const ChannelType channel,const double radius,const double sigma,
8924  const double threshold)
8925{
8926  Image
8927    *blur_image;
8928
8929  assert(wand != (MagickWand *) NULL);
8930  assert(wand->signature == WandSignature);
8931  if (wand->debug != MagickFalse)
8932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8933  if (wand->images == (Image *) NULL)
8934    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8935  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
8936    threshold,wand->exception);
8937  if (blur_image == (Image *) NULL)
8938    return(MagickFalse);
8939  ReplaceImageInList(&wand->images,blur_image);
8940  return(MagickTrue);
8941}
8942
8943/*
8944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8945%                                                                             %
8946%                                                                             %
8947%                                                                             %
8948%   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                       %
8949%                                                                             %
8950%                                                                             %
8951%                                                                             %
8952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8953%
8954%  MagickSeparateImageChannel() separates a channel from the image and returns a
8955%  grayscale image.  A channel is a particular color component of each pixel
8956%  in the image.
8957%
8958%  The format of the MagickSeparateImageChannel method is:
8959%
8960%      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
8961%        const ChannelType channel)
8962%
8963%  A description of each parameter follows:
8964%
8965%    o wand: the magick wand.
8966%
8967%    o channel: the image channel(s).
8968%
8969*/
8970WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
8971  const ChannelType channel)
8972{
8973  MagickBooleanType
8974    status;
8975
8976  assert(wand != (MagickWand *) NULL);
8977  assert(wand->signature == WandSignature);
8978  if (wand->debug != MagickFalse)
8979    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8980  if (wand->images == (Image *) NULL)
8981    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8982  status=SeparateImageChannel(wand->images,channel);
8983  if (status == MagickFalse)
8984    InheritException(wand->exception,&wand->images->exception);
8985  return(status);
8986}
8987
8988/*
8989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8990%                                                                             %
8991%                                                                             %
8992%                                                                             %
8993%     M a g i c k S e p i a T o n e I m a g e                                 %
8994%                                                                             %
8995%                                                                             %
8996%                                                                             %
8997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8998%
8999%  MagickSepiaToneImage() applies a special effect to the image, similar to the
9000%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9001%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9002%  threshold of 80% is a good starting point for a reasonable tone.
9003%
9004%  The format of the MagickSepiaToneImage method is:
9005%
9006%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9007%        const double threshold)
9008%
9009%  A description of each parameter follows:
9010%
9011%    o wand: the magick wand.
9012%
9013%    o threshold:  Define the extent of the sepia toning.
9014%
9015*/
9016WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9017  const double threshold)
9018{
9019  Image
9020    *sepia_image;
9021
9022  assert(wand != (MagickWand *) NULL);
9023  assert(wand->signature == WandSignature);
9024  if (wand->debug != MagickFalse)
9025    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9026  if (wand->images == (Image *) NULL)
9027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9028  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9029  if (sepia_image == (Image *) NULL)
9030    return(MagickFalse);
9031  ReplaceImageInList(&wand->images,sepia_image);
9032  return(MagickTrue);
9033}
9034
9035/*
9036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9037%                                                                             %
9038%                                                                             %
9039%                                                                             %
9040%   M a g i c k S e t I m a g e                                               %
9041%                                                                             %
9042%                                                                             %
9043%                                                                             %
9044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9045%
9046%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9047%  MagickNextImage(), MagickPreviousImage() with the images from the specified
9048%  wand.
9049%
9050%  The format of the MagickSetImage method is:
9051%
9052%      MagickBooleanType MagickSetImage(MagickWand *wand,
9053%        const MagickWand *set_wand)
9054%
9055%  A description of each parameter follows:
9056%
9057%    o wand: the magick wand.
9058%
9059%    o set_wand: the set_wand wand.
9060%
9061*/
9062WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9063  const MagickWand *set_wand)
9064{
9065  Image
9066    *images;
9067
9068  assert(wand != (MagickWand *) NULL);
9069  assert(wand->signature == WandSignature);
9070  if (wand->debug != MagickFalse)
9071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9072  assert(set_wand != (MagickWand *) NULL);
9073  assert(set_wand->signature == WandSignature);
9074  if (wand->debug != MagickFalse)
9075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9076  if (set_wand->images == (Image *) NULL)
9077    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9078  images=CloneImageList(set_wand->images,wand->exception);
9079  if (images == (Image *) NULL)
9080    return(MagickFalse);
9081  ReplaceImageInList(&wand->images,images);
9082  return(MagickTrue);
9083}
9084
9085/*
9086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9087%                                                                             %
9088%                                                                             %
9089%                                                                             %
9090%   M a g i c k S e t I m a g e A l p h a C h a n n e l                       %
9091%                                                                             %
9092%                                                                             %
9093%                                                                             %
9094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9095%
9096%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9097%  alpha channel.
9098%
9099%  The format of the MagickSetImageAlphaChannel method is:
9100%
9101%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9102%        const AlphaChannelType alpha_type)
9103%
9104%  A description of each parameter follows:
9105%
9106%    o wand: the magick wand.
9107%
9108%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9109%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9110%
9111*/
9112WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9113  const AlphaChannelType alpha_type)
9114{
9115  assert(wand != (MagickWand *) NULL);
9116  assert(wand->signature == WandSignature);
9117  if (wand->debug != MagickFalse)
9118    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9119  if (wand->images == (Image *) NULL)
9120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9121  return(SetImageAlphaChannel(wand->images,alpha_type));
9122}
9123
9124/*
9125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9126%                                                                             %
9127%                                                                             %
9128%                                                                             %
9129%   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                 %
9130%                                                                             %
9131%                                                                             %
9132%                                                                             %
9133%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9134%
9135%  MagickSetImageBackgroundColor() sets the image background color.
9136%
9137%  The format of the MagickSetImageBackgroundColor method is:
9138%
9139%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9140%        const PixelWand *background)
9141%
9142%  A description of each parameter follows:
9143%
9144%    o wand: the magick wand.
9145%
9146%    o background: the background pixel wand.
9147%
9148*/
9149WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9150  const PixelWand *background)
9151{
9152  assert(wand != (MagickWand *) NULL);
9153  assert(wand->signature == WandSignature);
9154  if (wand->debug != MagickFalse)
9155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9156  if (wand->images == (Image *) NULL)
9157    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9158  PixelGetQuantumPacket(background,&wand->images->background_color);
9159  return(MagickTrue);
9160}
9161
9162/*
9163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9164%                                                                             %
9165%                                                                             %
9166%                                                                             %
9167%   M a g i c k S e t I m a g e B i a s                                       %
9168%                                                                             %
9169%                                                                             %
9170%                                                                             %
9171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9172%
9173%  MagickSetImageBias() sets the image bias for any method that convolves an
9174%  image (e.g. MagickConvolveImage()).
9175%
9176%  The format of the MagickSetImageBias method is:
9177%
9178%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9179%        const double bias)
9180%
9181%  A description of each parameter follows:
9182%
9183%    o wand: the magick wand.
9184%
9185%    o bias: the image bias.
9186%
9187*/
9188WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9189  const double bias)
9190{
9191  assert(wand != (MagickWand *) NULL);
9192  assert(wand->signature == WandSignature);
9193  if (wand->debug != MagickFalse)
9194    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9195  if (wand->images == (Image *) NULL)
9196    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9197  wand->images->bias=bias;
9198  return(MagickTrue);
9199}
9200
9201/*
9202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9203%                                                                             %
9204%                                                                             %
9205%                                                                             %
9206%   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                         %
9207%                                                                             %
9208%                                                                             %
9209%                                                                             %
9210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9211%
9212%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9213%
9214%  The format of the MagickSetImageBluePrimary method is:
9215%
9216%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9217%        const double x,const double y)
9218%
9219%  A description of each parameter follows:
9220%
9221%    o wand: the magick wand.
9222%
9223%    o x: the blue primary x-point.
9224%
9225%    o y: the blue primary y-point.
9226%
9227*/
9228WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9229  const double x,const double y)
9230{
9231  assert(wand != (MagickWand *) NULL);
9232  assert(wand->signature == WandSignature);
9233  if (wand->debug != MagickFalse)
9234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9235  if (wand->images == (Image *) NULL)
9236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9237  wand->images->chromaticity.blue_primary.x=x;
9238  wand->images->chromaticity.blue_primary.y=y;
9239  return(MagickTrue);
9240}
9241
9242/*
9243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9244%                                                                             %
9245%                                                                             %
9246%                                                                             %
9247%   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                         %
9248%                                                                             %
9249%                                                                             %
9250%                                                                             %
9251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9252%
9253%  MagickSetImageBorderColor() sets the image border color.
9254%
9255%  The format of the MagickSetImageBorderColor method is:
9256%
9257%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9258%        const PixelWand *border)
9259%
9260%  A description of each parameter follows:
9261%
9262%    o wand: the magick wand.
9263%
9264%    o border: the border pixel wand.
9265%
9266*/
9267WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9268  const PixelWand *border)
9269{
9270  assert(wand != (MagickWand *) NULL);
9271  assert(wand->signature == WandSignature);
9272  if (wand->debug != MagickFalse)
9273    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9274  if (wand->images == (Image *) NULL)
9275    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9276  PixelGetQuantumPacket(border,&wand->images->border_color);
9277  return(MagickTrue);
9278}
9279
9280/*
9281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282%                                                                             %
9283%                                                                             %
9284%                                                                             %
9285%   M a g i c k S e t I m a g e C l i p M a s k                               %
9286%                                                                             %
9287%                                                                             %
9288%                                                                             %
9289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9290%
9291%  MagickSetImageClipMask() sets image clip mask.
9292%
9293%  The format of the MagickSetImageClipMask method is:
9294%
9295%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9296%        const MagickWand *clip_mask)
9297%
9298%  A description of each parameter follows:
9299%
9300%    o wand: the magick wand.
9301%
9302%    o clip_mask: the clip_mask wand.
9303%
9304*/
9305WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9306  const MagickWand *clip_mask)
9307{
9308  assert(wand != (MagickWand *) NULL);
9309  assert(wand->signature == WandSignature);
9310  if (wand->debug != MagickFalse)
9311    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9312  assert(clip_mask != (MagickWand *) NULL);
9313  assert(clip_mask->signature == WandSignature);
9314  if (wand->debug != MagickFalse)
9315    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9316  if (clip_mask->images == (Image *) NULL)
9317    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9318  return(SetImageClipMask(wand->images,clip_mask->images));
9319}
9320
9321/*
9322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9323%                                                                             %
9324%                                                                             %
9325%                                                                             %
9326%   M a g i c k S e t I m a g e C o l o r                                     %
9327%                                                                             %
9328%                                                                             %
9329%                                                                             %
9330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9331%
9332%  MagickSetImageColor() set the entire wand canvas to the specified color.
9333%
9334%  The format of the MagickSetImageColor method is:
9335%
9336%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9337%        const PixelWand *color)
9338%
9339%  A description of each parameter follows:
9340%
9341%    o wand: the magick wand.
9342%
9343%    o background: the image color.
9344%
9345*/
9346WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9347  const PixelWand *color)
9348{
9349  MagickBooleanType
9350    status;
9351
9352  PixelInfo
9353    pixel;
9354
9355  assert(wand != (MagickWand *) NULL);
9356  assert(wand->signature == WandSignature);
9357  if (wand->debug != MagickFalse)
9358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9359  PixelGetMagickColor(color,&pixel);
9360  status=SetImageColor(wand->images,&pixel);
9361  if (status == MagickFalse)
9362    InheritException(wand->exception,&wand->images->exception);
9363  return(status);
9364}
9365
9366/*
9367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9368%                                                                             %
9369%                                                                             %
9370%                                                                             %
9371%   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                     %
9372%                                                                             %
9373%                                                                             %
9374%                                                                             %
9375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9376%
9377%  MagickSetImageColormapColor() sets the color of the specified colormap
9378%  index.
9379%
9380%  The format of the MagickSetImageColormapColor method is:
9381%
9382%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9383%        const size_t index,const PixelWand *color)
9384%
9385%  A description of each parameter follows:
9386%
9387%    o wand: the magick wand.
9388%
9389%    o index: the offset into the image colormap.
9390%
9391%    o color: Return the colormap color in this wand.
9392%
9393*/
9394WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9395  const size_t index,const PixelWand *color)
9396{
9397  assert(wand != (MagickWand *) NULL);
9398  assert(wand->signature == WandSignature);
9399  if (wand->debug != MagickFalse)
9400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9401  if (wand->images == (Image *) NULL)
9402    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9403  if ((wand->images->colormap == (PixelPacket *) NULL) ||
9404      (index >= wand->images->colors))
9405    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9406  PixelGetQuantumPacket(color,wand->images->colormap+index);
9407  return(SyncImage(wand->images));
9408}
9409
9410/*
9411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9412%                                                                             %
9413%                                                                             %
9414%                                                                             %
9415%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9416%                                                                             %
9417%                                                                             %
9418%                                                                             %
9419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420%
9421%  MagickSetImageColorspace() sets the image colorspace.
9422%
9423%  The format of the MagickSetImageColorspace method is:
9424%
9425%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9426%        const ColorspaceType colorspace)
9427%
9428%  A description of each parameter follows:
9429%
9430%    o wand: the magick wand.
9431%
9432%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9433%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9434%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9435%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9436%      HSLColorspace, or HWBColorspace.
9437%
9438*/
9439WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9440  const ColorspaceType colorspace)
9441{
9442  assert(wand != (MagickWand *) NULL);
9443  assert(wand->signature == WandSignature);
9444  if (wand->debug != MagickFalse)
9445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9446  if (wand->images == (Image *) NULL)
9447    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9448  return(SetImageColorspace(wand->images,colorspace));
9449}
9450
9451/*
9452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9453%                                                                             %
9454%                                                                             %
9455%                                                                             %
9456%   M a g i c k S e t I m a g e C o m p o s e                                 %
9457%                                                                             %
9458%                                                                             %
9459%                                                                             %
9460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9461%
9462%  MagickSetImageCompose() sets the image composite operator, useful for
9463%  specifying how to composite the image thumbnail when using the
9464%  MagickMontageImage() method.
9465%
9466%  The format of the MagickSetImageCompose method is:
9467%
9468%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9469%        const CompositeOperator compose)
9470%
9471%  A description of each parameter follows:
9472%
9473%    o wand: the magick wand.
9474%
9475%    o compose: the image composite operator.
9476%
9477*/
9478WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9479  const CompositeOperator compose)
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->compose=compose;
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 C o m p r e s s i o n                         %
9497%                                                                             %
9498%                                                                             %
9499%                                                                             %
9500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9501%
9502%  MagickSetImageCompression() sets the image compression.
9503%
9504%  The format of the MagickSetImageCompression method is:
9505%
9506%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9507%        const CompressionType compression)
9508%
9509%  A description of each parameter follows:
9510%
9511%    o wand: the magick wand.
9512%
9513%    o compression: the image compression type.
9514%
9515*/
9516WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9517  const CompressionType compression)
9518{
9519  assert(wand != (MagickWand *) NULL);
9520  assert(wand->signature == WandSignature);
9521  if (wand->debug != MagickFalse)
9522    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9523  if (wand->images == (Image *) NULL)
9524    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9525  wand->images->compression=compression;
9526  return(MagickTrue);
9527}
9528
9529/*
9530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9531%                                                                             %
9532%                                                                             %
9533%                                                                             %
9534%   M a g i c k S e t I m a g e C o m p r e s s i o n Q u a l i t y           %
9535%                                                                             %
9536%                                                                             %
9537%                                                                             %
9538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9539%
9540%  MagickSetImageCompressionQuality() sets the image compression quality.
9541%
9542%  The format of the MagickSetImageCompressionQuality method is:
9543%
9544%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9545%        const size_t quality)
9546%
9547%  A description of each parameter follows:
9548%
9549%    o wand: the magick wand.
9550%
9551%    o quality: the image compression tlityype.
9552%
9553*/
9554WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9555  const size_t quality)
9556{
9557  assert(wand != (MagickWand *) NULL);
9558  assert(wand->signature == WandSignature);
9559  if (wand->debug != MagickFalse)
9560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9561  if (wand->images == (Image *) NULL)
9562    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9563  wand->images->quality=quality;
9564  return(MagickTrue);
9565}
9566
9567/*
9568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9569%                                                                             %
9570%                                                                             %
9571%                                                                             %
9572%   M a g i c k S e t I m a g e D e l a y                                     %
9573%                                                                             %
9574%                                                                             %
9575%                                                                             %
9576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9577%
9578%  MagickSetImageDelay() sets the image delay.
9579%
9580%  The format of the MagickSetImageDelay method is:
9581%
9582%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9583%        const size_t delay)
9584%
9585%  A description of each parameter follows:
9586%
9587%    o wand: the magick wand.
9588%
9589%    o delay: the image delay in ticks-per-second units.
9590%
9591*/
9592WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9593  const size_t delay)
9594{
9595  assert(wand != (MagickWand *) NULL);
9596  assert(wand->signature == WandSignature);
9597  if (wand->debug != MagickFalse)
9598    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9599  if (wand->images == (Image *) NULL)
9600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9601  wand->images->delay=delay;
9602  return(MagickTrue);
9603}
9604
9605/*
9606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9607%                                                                             %
9608%                                                                             %
9609%                                                                             %
9610%   M a g i c k S e t I m a g e D e p t h                                     %
9611%                                                                             %
9612%                                                                             %
9613%                                                                             %
9614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9615%
9616%  MagickSetImageDepth() sets the image depth.
9617%
9618%  The format of the MagickSetImageDepth method is:
9619%
9620%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9621%        const size_t depth)
9622%
9623%  A description of each parameter follows:
9624%
9625%    o wand: the magick wand.
9626%
9627%    o depth: the image depth in bits: 8, 16, or 32.
9628%
9629*/
9630WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9631  const size_t depth)
9632{
9633  assert(wand != (MagickWand *) NULL);
9634  assert(wand->signature == WandSignature);
9635  if (wand->debug != MagickFalse)
9636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9637  if (wand->images == (Image *) NULL)
9638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9639  return(SetImageDepth(wand->images,depth));
9640}
9641
9642/*
9643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9644%                                                                             %
9645%                                                                             %
9646%                                                                             %
9647%   M a g i c k S e t I m a g e D i s p o s e                                 %
9648%                                                                             %
9649%                                                                             %
9650%                                                                             %
9651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9652%
9653%  MagickSetImageDispose() sets the image disposal method.
9654%
9655%  The format of the MagickSetImageDispose method is:
9656%
9657%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9658%        const DisposeType dispose)
9659%
9660%  A description of each parameter follows:
9661%
9662%    o wand: the magick wand.
9663%
9664%    o dispose: the image disposeal type.
9665%
9666*/
9667WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9668  const DisposeType dispose)
9669{
9670  assert(wand != (MagickWand *) NULL);
9671  assert(wand->signature == WandSignature);
9672  if (wand->debug != MagickFalse)
9673    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9674  if (wand->images == (Image *) NULL)
9675    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9676  wand->images->dispose=dispose;
9677  return(MagickTrue);
9678}
9679
9680/*
9681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9682%                                                                             %
9683%                                                                             %
9684%                                                                             %
9685%   M a g i c k S e t I m a g e E x t e n t                                   %
9686%                                                                             %
9687%                                                                             %
9688%                                                                             %
9689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9690%
9691%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9692%
9693%  The format of the MagickSetImageExtent method is:
9694%
9695%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9696%        const size_t columns,const unsigned rows)
9697%
9698%  A description of each parameter follows:
9699%
9700%    o wand: the magick wand.
9701%
9702%    o columns:  The image width in pixels.
9703%
9704%    o rows:  The image height in pixels.
9705%
9706*/
9707WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9708  const size_t columns,const size_t rows)
9709{
9710  assert(wand != (MagickWand *) NULL);
9711  assert(wand->signature == WandSignature);
9712  if (wand->debug != MagickFalse)
9713    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9714  if (wand->images == (Image *) NULL)
9715    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9716  return(SetImageExtent(wand->images,columns,rows));
9717}
9718
9719/*
9720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9721%                                                                             %
9722%                                                                             %
9723%                                                                             %
9724%   M a g i c k S e t I m a g e F i l e n a m e                               %
9725%                                                                             %
9726%                                                                             %
9727%                                                                             %
9728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9729%
9730%  MagickSetImageFilename() sets the filename of a particular image in a
9731%  sequence.
9732%
9733%  The format of the MagickSetImageFilename method is:
9734%
9735%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9736%        const char *filename)
9737%
9738%  A description of each parameter follows:
9739%
9740%    o wand: the magick wand.
9741%
9742%    o filename: the image filename.
9743%
9744*/
9745WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9746  const char *filename)
9747{
9748  assert(wand != (MagickWand *) NULL);
9749  assert(wand->signature == WandSignature);
9750  if (wand->debug != MagickFalse)
9751    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9752  if (wand->images == (Image *) NULL)
9753    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9754  if (filename != (const char *) NULL)
9755    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9756  return(MagickTrue);
9757}
9758
9759/*
9760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9761%                                                                             %
9762%                                                                             %
9763%                                                                             %
9764%   M a g i c k S e t I m a g e F o r m a t                                   %
9765%                                                                             %
9766%                                                                             %
9767%                                                                             %
9768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769%
9770%  MagickSetImageFormat() sets the format of a particular image in a
9771%  sequence.
9772%
9773%  The format of the MagickSetImageFormat method is:
9774%
9775%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9776%        const char *format)
9777%
9778%  A description of each parameter follows:
9779%
9780%    o wand: the magick wand.
9781%
9782%    o format: the image format.
9783%
9784*/
9785WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9786  const char *format)
9787{
9788  const MagickInfo
9789    *magick_info;
9790
9791  assert(wand != (MagickWand *) NULL);
9792  assert(wand->signature == WandSignature);
9793  if (wand->debug != MagickFalse)
9794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9795  if (wand->images == (Image *) NULL)
9796    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9797  if ((format == (char *) NULL) || (*format == '\0'))
9798    {
9799      *wand->images->magick='\0';
9800      return(MagickTrue);
9801    }
9802  magick_info=GetMagickInfo(format,wand->exception);
9803  if (magick_info == (const MagickInfo *) NULL)
9804    return(MagickFalse);
9805  ClearMagickException(wand->exception);
9806  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9807  return(MagickTrue);
9808}
9809
9810/*
9811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9812%                                                                             %
9813%                                                                             %
9814%                                                                             %
9815%   M a g i c k S e t I m a g e F u z z                                       %
9816%                                                                             %
9817%                                                                             %
9818%                                                                             %
9819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9820%
9821%  MagickSetImageFuzz() sets the image fuzz.
9822%
9823%  The format of the MagickSetImageFuzz method is:
9824%
9825%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9826%        const double fuzz)
9827%
9828%  A description of each parameter follows:
9829%
9830%    o wand: the magick wand.
9831%
9832%    o fuzz: the image fuzz.
9833%
9834*/
9835WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9836  const double fuzz)
9837{
9838  assert(wand != (MagickWand *) NULL);
9839  assert(wand->signature == WandSignature);
9840  if (wand->debug != MagickFalse)
9841    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9842  if (wand->images == (Image *) NULL)
9843    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9844  wand->images->fuzz=fuzz;
9845  return(MagickTrue);
9846}
9847
9848/*
9849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9850%                                                                             %
9851%                                                                             %
9852%                                                                             %
9853%   M a g i c k S e t I m a g e G a m m a                                     %
9854%                                                                             %
9855%                                                                             %
9856%                                                                             %
9857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9858%
9859%  MagickSetImageGamma() sets the image gamma.
9860%
9861%  The format of the MagickSetImageGamma method is:
9862%
9863%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9864%        const double gamma)
9865%
9866%  A description of each parameter follows:
9867%
9868%    o wand: the magick wand.
9869%
9870%    o gamma: the image gamma.
9871%
9872*/
9873WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9874  const double gamma)
9875{
9876  assert(wand != (MagickWand *) NULL);
9877  assert(wand->signature == WandSignature);
9878  if (wand->debug != MagickFalse)
9879    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9880  if (wand->images == (Image *) NULL)
9881    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9882  wand->images->gamma=gamma;
9883  return(MagickTrue);
9884}
9885
9886/*
9887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9888%                                                                             %
9889%                                                                             %
9890%                                                                             %
9891%   M a g i c k S e t I m a g e G r a v i t y                                 %
9892%                                                                             %
9893%                                                                             %
9894%                                                                             %
9895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9896%
9897%  MagickSetImageGravity() sets the image gravity type.
9898%
9899%  The format of the MagickSetImageGravity method is:
9900%
9901%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9902%        const GravityType gravity)
9903%
9904%  A description of each parameter follows:
9905%
9906%    o wand: the magick wand.
9907%
9908%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9909%      PlaneInterlace, PartitionInterlace.
9910%
9911*/
9912WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9913  const GravityType gravity)
9914{
9915  assert(wand != (MagickWand *) NULL);
9916  assert(wand->signature == WandSignature);
9917  if (wand->debug != MagickFalse)
9918    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9919  if (wand->images == (Image *) NULL)
9920    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9921  wand->images->gravity=gravity;
9922  return(MagickTrue);
9923}
9924
9925/*
9926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9927%                                                                             %
9928%                                                                             %
9929%                                                                             %
9930%   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                       %
9931%                                                                             %
9932%                                                                             %
9933%                                                                             %
9934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9935%
9936%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9937%  point.
9938%
9939%  The format of the MagickSetImageGreenPrimary method is:
9940%
9941%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9942%        const double x,const double y)
9943%
9944%  A description of each parameter follows:
9945%
9946%    o wand: the magick wand.
9947%
9948%    o x: the green primary x-point.
9949%
9950%    o y: the green primary y-point.
9951%
9952%
9953*/
9954WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9955  const double x,const double y)
9956{
9957  assert(wand != (MagickWand *) NULL);
9958  assert(wand->signature == WandSignature);
9959  if (wand->debug != MagickFalse)
9960    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9961  if (wand->images == (Image *) NULL)
9962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9963  wand->images->chromaticity.green_primary.x=x;
9964  wand->images->chromaticity.green_primary.y=y;
9965  return(MagickTrue);
9966}
9967
9968/*
9969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9970%                                                                             %
9971%                                                                             %
9972%                                                                             %
9973%   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                 %
9974%                                                                             %
9975%                                                                             %
9976%                                                                             %
9977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9978%
9979%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9980%
9981%  The format of the MagickSetImageInterlaceScheme method is:
9982%
9983%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9984%        const InterlaceType interlace)
9985%
9986%  A description of each parameter follows:
9987%
9988%    o wand: the magick wand.
9989%
9990%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9991%      PlaneInterlace, PartitionInterlace.
9992%
9993*/
9994WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9995  const InterlaceType interlace)
9996{
9997  assert(wand != (MagickWand *) NULL);
9998  assert(wand->signature == WandSignature);
9999  if (wand->debug != MagickFalse)
10000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10001  if (wand->images == (Image *) NULL)
10002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10003  wand->images->interlace=interlace;
10004  return(MagickTrue);
10005}
10006
10007/*
10008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10009%                                                                             %
10010%                                                                             %
10011%                                                                             %
10012%   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             %
10013%                                                                             %
10014%                                                                             %
10015%                                                                             %
10016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10017%
10018%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10019%
10020%  The format of the MagickSetImageInterpolateMethod method is:
10021%
10022%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10023%        const InterpolatePixelMethod method)
10024%
10025%  A description of each parameter follows:
10026%
10027%    o wand: the magick wand.
10028%
10029%    o method: the image interpole pixel methods: choose from Undefined,
10030%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10031%
10032*/
10033WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10034  const InterpolatePixelMethod method)
10035{
10036  assert(wand != (MagickWand *) NULL);
10037  assert(wand->signature == WandSignature);
10038  if (wand->debug != MagickFalse)
10039    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10040  if (wand->images == (Image *) NULL)
10041    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10042  wand->images->interpolate=method;
10043  return(MagickTrue);
10044}
10045
10046/*
10047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10048%                                                                             %
10049%                                                                             %
10050%                                                                             %
10051%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10052%                                                                             %
10053%                                                                             %
10054%                                                                             %
10055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10056%
10057%  MagickSetImageIterations() sets the image iterations.
10058%
10059%  The format of the MagickSetImageIterations method is:
10060%
10061%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10062%        const size_t iterations)
10063%
10064%  A description of each parameter follows:
10065%
10066%    o wand: the magick wand.
10067%
10068%    o delay: the image delay in 1/100th of a second.
10069%
10070*/
10071WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10072  const size_t iterations)
10073{
10074  assert(wand != (MagickWand *) NULL);
10075  assert(wand->signature == WandSignature);
10076  if (wand->debug != MagickFalse)
10077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10078  if (wand->images == (Image *) NULL)
10079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10080  wand->images->iterations=iterations;
10081  return(MagickTrue);
10082}
10083
10084/*
10085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10086%                                                                             %
10087%                                                                             %
10088%                                                                             %
10089%   M a g i c k S e t I m a g e M a t t e                                     %
10090%                                                                             %
10091%                                                                             %
10092%                                                                             %
10093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10094%
10095%  MagickSetImageMatte() sets the image matte channel.
10096%
10097%  The format of the MagickSetImageMatteColor method is:
10098%
10099%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10100%        const MagickBooleanType *matte)
10101%
10102%  A description of each parameter follows:
10103%
10104%    o wand: the magick wand.
10105%
10106%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10107%      MagickFalse.
10108%
10109*/
10110WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10111  const MagickBooleanType matte)
10112{
10113  assert(wand != (MagickWand *) NULL);
10114  assert(wand->signature == WandSignature);
10115  if (wand->debug != MagickFalse)
10116    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10117  if (wand->images == (Image *) NULL)
10118    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10119  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10120    (void) SetImageOpacity(wand->images,OpaqueAlpha);
10121  wand->images->matte=matte;
10122  return(MagickTrue);
10123}
10124
10125/*
10126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10127%                                                                             %
10128%                                                                             %
10129%                                                                             %
10130%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10131%                                                                             %
10132%                                                                             %
10133%                                                                             %
10134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10135%
10136%  MagickSetImageMatteColor() sets the image matte color.
10137%
10138%  The format of the MagickSetImageMatteColor method is:
10139%
10140%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10141%        const PixelWand *matte)
10142%
10143%  A description of each parameter follows:
10144%
10145%    o wand: the magick wand.
10146%
10147%    o matte: the matte pixel wand.
10148%
10149*/
10150WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10151  const PixelWand *matte)
10152{
10153  assert(wand != (MagickWand *) NULL);
10154  assert(wand->signature == WandSignature);
10155  if (wand->debug != MagickFalse)
10156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10157  if (wand->images == (Image *) NULL)
10158    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10159  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10160  return(MagickTrue);
10161}
10162
10163/*
10164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10165%                                                                             %
10166%                                                                             %
10167%                                                                             %
10168%   M a g i c k S e t I m a g e O p a c i t y                                 %
10169%                                                                             %
10170%                                                                             %
10171%                                                                             %
10172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10173%
10174%  MagickSetImageOpacity() sets the image to the specified opacity level.
10175%
10176%  The format of the MagickSetImageOpacity method is:
10177%
10178%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10179%        const double alpha)
10180%
10181%  A description of each parameter follows:
10182%
10183%    o wand: the magick wand.
10184%
10185%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10186%      transparent.
10187%
10188*/
10189WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10190  const double alpha)
10191{
10192  MagickBooleanType
10193    status;
10194
10195  assert(wand != (MagickWand *) NULL);
10196  assert(wand->signature == WandSignature);
10197  if (wand->debug != MagickFalse)
10198    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10199  if (wand->images == (Image *) NULL)
10200    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10201  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
10202  if (status == MagickFalse)
10203    InheritException(wand->exception,&wand->images->exception);
10204  return(status);
10205}
10206
10207/*
10208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10209%                                                                             %
10210%                                                                             %
10211%                                                                             %
10212%   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                         %
10213%                                                                             %
10214%                                                                             %
10215%                                                                             %
10216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10217%
10218%  MagickSetImageOrientation() sets the image orientation.
10219%
10220%  The format of the MagickSetImageOrientation method is:
10221%
10222%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10223%        const OrientationType orientation)
10224%
10225%  A description of each parameter follows:
10226%
10227%    o wand: the magick wand.
10228%
10229%    o orientation: the image orientation type.
10230%
10231*/
10232WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10233  const OrientationType orientation)
10234{
10235  assert(wand != (MagickWand *) NULL);
10236  assert(wand->signature == WandSignature);
10237  if (wand->debug != MagickFalse)
10238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10239  if (wand->images == (Image *) NULL)
10240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10241  wand->images->orientation=orientation;
10242  return(MagickTrue);
10243}
10244
10245/*
10246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10247%                                                                             %
10248%                                                                             %
10249%                                                                             %
10250%   M a g i c k S e t I m a g e P a g e                                       %
10251%                                                                             %
10252%                                                                             %
10253%                                                                             %
10254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10255%
10256%  MagickSetImagePage() sets the page geometry of the image.
10257%
10258%  The format of the MagickSetImagePage method is:
10259%
10260%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10261%        const size_t width,const size_t height,const ssize_t x,
10262%        const ssize_t y)
10263%
10264%  A description of each parameter follows:
10265%
10266%    o wand: the magick wand.
10267%
10268%    o width: the page width.
10269%
10270%    o height: the page height.
10271%
10272%    o x: the page x-offset.
10273%
10274%    o y: the page y-offset.
10275%
10276*/
10277WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10278  const size_t width,const size_t height,const ssize_t x,
10279  const ssize_t y)
10280{
10281  assert(wand != (MagickWand *) NULL);
10282  assert(wand->signature == WandSignature);
10283  if (wand->debug != MagickFalse)
10284    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10285  if (wand->images == (Image *) NULL)
10286    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10287  wand->images->page.width=width;
10288  wand->images->page.height=height;
10289  wand->images->page.x=x;
10290  wand->images->page.y=y;
10291  return(MagickTrue);
10292}
10293
10294/*
10295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10296%                                                                             %
10297%                                                                             %
10298%                                                                             %
10299%   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                 %
10300%                                                                             %
10301%                                                                             %
10302%                                                                             %
10303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10304%
10305%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10306%  specified method and returns the previous progress monitor if any.  The
10307%  progress monitor method looks like this:
10308%
10309%    MagickBooleanType MagickProgressMonitor(const char *text,
10310%      const MagickOffsetType offset,const MagickSizeType span,
10311%      void *client_data)
10312%
10313%  If the progress monitor returns MagickFalse, the current operation is
10314%  interrupted.
10315%
10316%  The format of the MagickSetImageProgressMonitor method is:
10317%
10318%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10319%        const MagickProgressMonitor progress_monitor,void *client_data)
10320%
10321%  A description of each parameter follows:
10322%
10323%    o wand: the magick wand.
10324%
10325%    o progress_monitor: Specifies a pointer to a method to monitor progress
10326%      of an image operation.
10327%
10328%    o client_data: Specifies a pointer to any client data.
10329%
10330*/
10331WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10332  const MagickProgressMonitor progress_monitor,void *client_data)
10333{
10334  MagickProgressMonitor
10335    previous_monitor;
10336
10337  assert(wand != (MagickWand *) NULL);
10338  assert(wand->signature == WandSignature);
10339  if (wand->debug != MagickFalse)
10340    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10341  if (wand->images == (Image *) NULL)
10342    {
10343      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10344        "ContainsNoImages","`%s'",wand->name);
10345      return((MagickProgressMonitor) NULL);
10346    }
10347  previous_monitor=SetImageProgressMonitor(wand->images,
10348    progress_monitor,client_data);
10349  return(previous_monitor);
10350}
10351
10352/*
10353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10354%                                                                             %
10355%                                                                             %
10356%                                                                             %
10357%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10358%                                                                             %
10359%                                                                             %
10360%                                                                             %
10361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10362%
10363%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10364%
10365%  The format of the MagickSetImageRedPrimary method is:
10366%
10367%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10368%        const double x,const double y)
10369%
10370%  A description of each parameter follows:
10371%
10372%    o wand: the magick wand.
10373%
10374%    o x: the red primary x-point.
10375%
10376%    o y: the red primary y-point.
10377%
10378*/
10379WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10380  const double x,const double y)
10381{
10382  assert(wand != (MagickWand *) NULL);
10383  assert(wand->signature == WandSignature);
10384  if (wand->debug != MagickFalse)
10385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10386  if (wand->images == (Image *) NULL)
10387    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10388  wand->images->chromaticity.red_primary.x=x;
10389  wand->images->chromaticity.red_primary.y=y;
10390  return(MagickTrue);
10391}
10392
10393/*
10394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10395%                                                                             %
10396%                                                                             %
10397%                                                                             %
10398%   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                 %
10399%                                                                             %
10400%                                                                             %
10401%                                                                             %
10402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10403%
10404%  MagickSetImageRenderingIntent() sets the image rendering intent.
10405%
10406%  The format of the MagickSetImageRenderingIntent method is:
10407%
10408%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10409%        const RenderingIntent rendering_intent)
10410%
10411%  A description of each parameter follows:
10412%
10413%    o wand: the magick wand.
10414%
10415%    o rendering_intent: the image rendering intent: UndefinedIntent,
10416%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10417%
10418*/
10419WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10420  const RenderingIntent rendering_intent)
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  wand->images->rendering_intent=rendering_intent;
10429  return(MagickTrue);
10430}
10431
10432/*
10433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10434%                                                                             %
10435%                                                                             %
10436%                                                                             %
10437%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10438%                                                                             %
10439%                                                                             %
10440%                                                                             %
10441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10442%
10443%  MagickSetImageResolution() sets the image resolution.
10444%
10445%  The format of the MagickSetImageResolution method is:
10446%
10447%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10448%        const double x_resolution,const doubtl y_resolution)
10449%
10450%  A description of each parameter follows:
10451%
10452%    o wand: the magick wand.
10453%
10454%    o x_resolution: the image x resolution.
10455%
10456%    o y_resolution: the image y resolution.
10457%
10458*/
10459WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10460  const double x_resolution,const double y_resolution)
10461{
10462  assert(wand != (MagickWand *) NULL);
10463  assert(wand->signature == WandSignature);
10464  if (wand->debug != MagickFalse)
10465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10466  if (wand->images == (Image *) NULL)
10467    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10468  wand->images->x_resolution=x_resolution;
10469  wand->images->y_resolution=y_resolution;
10470  return(MagickTrue);
10471}
10472
10473/*
10474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10475%                                                                             %
10476%                                                                             %
10477%                                                                             %
10478%   M a g i c k S e t I m a g e S c e n e                                     %
10479%                                                                             %
10480%                                                                             %
10481%                                                                             %
10482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10483%
10484%  MagickSetImageScene() sets the image scene.
10485%
10486%  The format of the MagickSetImageScene method is:
10487%
10488%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10489%        const size_t scene)
10490%
10491%  A description of each parameter follows:
10492%
10493%    o wand: the magick wand.
10494%
10495%    o delay: the image scene number.
10496%
10497*/
10498WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10499  const size_t scene)
10500{
10501  assert(wand != (MagickWand *) NULL);
10502  assert(wand->signature == WandSignature);
10503  if (wand->debug != MagickFalse)
10504    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10505  if (wand->images == (Image *) NULL)
10506    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10507  wand->images->scene=scene;
10508  return(MagickTrue);
10509}
10510
10511/*
10512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10513%                                                                             %
10514%                                                                             %
10515%                                                                             %
10516%   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                   %
10517%                                                                             %
10518%                                                                             %
10519%                                                                             %
10520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10521%
10522%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10523%
10524%  The format of the MagickSetImageTicksPerSecond method is:
10525%
10526%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10527%        const ssize_t ticks_per-second)
10528%
10529%  A description of each parameter follows:
10530%
10531%    o wand: the magick wand.
10532%
10533%    o ticks_per_second: the units to use for the image delay.
10534%
10535*/
10536WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10537  const ssize_t ticks_per_second)
10538{
10539  assert(wand != (MagickWand *) NULL);
10540  assert(wand->signature == WandSignature);
10541  if (wand->debug != MagickFalse)
10542    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10543  if (wand->images == (Image *) NULL)
10544    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10545  wand->images->ticks_per_second=ticks_per_second;
10546  return(MagickTrue);
10547}
10548
10549/*
10550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10551%                                                                             %
10552%                                                                             %
10553%                                                                             %
10554%   M a g i c k S e t I m a g e T y p e                                       %
10555%                                                                             %
10556%                                                                             %
10557%                                                                             %
10558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10559%
10560%  MagickSetImageType() sets the image type.
10561%
10562%  The format of the MagickSetImageType method is:
10563%
10564%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10565%        const ImageType image_type)
10566%
10567%  A description of each parameter follows:
10568%
10569%    o wand: the magick wand.
10570%
10571%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10572%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10573%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10574%      or OptimizeType.
10575%
10576*/
10577WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10578  const ImageType image_type)
10579{
10580  assert(wand != (MagickWand *) NULL);
10581  assert(wand->signature == WandSignature);
10582  if (wand->debug != MagickFalse)
10583    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10584  if (wand->images == (Image *) NULL)
10585    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10586  return(SetImageType(wand->images,image_type));
10587}
10588
10589/*
10590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10591%                                                                             %
10592%                                                                             %
10593%                                                                             %
10594%   M a g i c k S e t I m a g e U n i t s                                     %
10595%                                                                             %
10596%                                                                             %
10597%                                                                             %
10598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10599%
10600%  MagickSetImageUnits() sets the image units of resolution.
10601%
10602%  The format of the MagickSetImageUnits method is:
10603%
10604%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10605%        const ResolutionType units)
10606%
10607%  A description of each parameter follows:
10608%
10609%    o wand: the magick wand.
10610%
10611%    o units: the image units of resolution : UndefinedResolution,
10612%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10613%
10614*/
10615WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10616  const ResolutionType units)
10617{
10618  assert(wand != (MagickWand *) NULL);
10619  assert(wand->signature == WandSignature);
10620  if (wand->debug != MagickFalse)
10621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10622  if (wand->images == (Image *) NULL)
10623    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10624  wand->images->units=units;
10625  return(MagickTrue);
10626}
10627
10628/*
10629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10630%                                                                             %
10631%                                                                             %
10632%                                                                             %
10633%   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           %
10634%                                                                             %
10635%                                                                             %
10636%                                                                             %
10637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10638%
10639%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10640%
10641%  The format of the MagickSetImageVirtualPixelMethod method is:
10642%
10643%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10644%        const VirtualPixelMethod method)
10645%
10646%  A description of each parameter follows:
10647%
10648%    o wand: the magick wand.
10649%
10650%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10651%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10652%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10653%
10654*/
10655WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10656  const VirtualPixelMethod method)
10657{
10658  assert(wand != (MagickWand *) NULL);
10659  assert(wand->signature == WandSignature);
10660  if (wand->debug != MagickFalse)
10661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10662  if (wand->images == (Image *) NULL)
10663    return(UndefinedVirtualPixelMethod);
10664  return(SetImageVirtualPixelMethod(wand->images,method));
10665}
10666
10667/*
10668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10669%                                                                             %
10670%                                                                             %
10671%                                                                             %
10672%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10673%                                                                             %
10674%                                                                             %
10675%                                                                             %
10676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10677%
10678%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10679%
10680%  The format of the MagickSetImageWhitePoint method is:
10681%
10682%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10683%        const double x,const double y)
10684%
10685%  A description of each parameter follows:
10686%
10687%    o wand: the magick wand.
10688%
10689%    o x: the white x-point.
10690%
10691%    o y: the white y-point.
10692%
10693*/
10694WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10695  const double x,const double y)
10696{
10697  assert(wand != (MagickWand *) NULL);
10698  assert(wand->signature == WandSignature);
10699  if (wand->debug != MagickFalse)
10700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10701  if (wand->images == (Image *) NULL)
10702    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10703  wand->images->chromaticity.white_point.x=x;
10704  wand->images->chromaticity.white_point.y=y;
10705  return(MagickTrue);
10706}
10707
10708/*
10709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10710%                                                                             %
10711%                                                                             %
10712%                                                                             %
10713%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10714%                                                                             %
10715%                                                                             %
10716%                                                                             %
10717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10718%
10719%  MagickShadeImage() shines a distant light on an image to create a
10720%  three-dimensional effect. You control the positioning of the light with
10721%  azimuth and elevation; azimuth is measured in degrees off the x axis
10722%  and elevation is measured in pixels above the Z axis.
10723%
10724%  The format of the MagickShadeImage method is:
10725%
10726%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10727%        const MagickBooleanType gray,const double azimuth,
10728%        const double elevation)
10729%
10730%  A description of each parameter follows:
10731%
10732%    o wand: the magick wand.
10733%
10734%    o gray: A value other than zero shades the intensity of each pixel.
10735%
10736%    o azimuth, elevation:  Define the light source direction.
10737%
10738*/
10739WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10740  const MagickBooleanType gray,const double asimuth,const double elevation)
10741{
10742  Image
10743    *shade_image;
10744
10745  assert(wand != (MagickWand *) NULL);
10746  assert(wand->signature == WandSignature);
10747  if (wand->debug != MagickFalse)
10748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10749  if (wand->images == (Image *) NULL)
10750    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10751  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10752  if (shade_image == (Image *) NULL)
10753    return(MagickFalse);
10754  ReplaceImageInList(&wand->images,shade_image);
10755  return(MagickTrue);
10756}
10757
10758/*
10759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10760%                                                                             %
10761%                                                                             %
10762%                                                                             %
10763%   M a g i c k S h a d o w I m a g e                                         %
10764%                                                                             %
10765%                                                                             %
10766%                                                                             %
10767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10768%
10769%  MagickShadowImage() simulates an image shadow.
10770%
10771%  The format of the MagickShadowImage method is:
10772%
10773%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10774%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10775%
10776%  A description of each parameter follows:
10777%
10778%    o wand: the magick wand.
10779%
10780%    o opacity: percentage transparency.
10781%
10782%    o sigma: the standard deviation of the Gaussian, in pixels.
10783%
10784%    o x: the shadow x-offset.
10785%
10786%    o y: the shadow y-offset.
10787%
10788*/
10789WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10790  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10791{
10792  Image
10793    *shadow_image;
10794
10795  assert(wand != (MagickWand *) NULL);
10796  assert(wand->signature == WandSignature);
10797  if (wand->debug != MagickFalse)
10798    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10799  if (wand->images == (Image *) NULL)
10800    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10801  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10802  if (shadow_image == (Image *) NULL)
10803    return(MagickFalse);
10804  ReplaceImageInList(&wand->images,shadow_image);
10805  return(MagickTrue);
10806}
10807
10808/*
10809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10810%                                                                             %
10811%                                                                             %
10812%                                                                             %
10813%   M a g i c k S h a r p e n I m a g e                                       %
10814%                                                                             %
10815%                                                                             %
10816%                                                                             %
10817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10818%
10819%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10820%  Gaussian operator of the given radius and standard deviation (sigma).
10821%  For reasonable results, the radius should be larger than sigma.  Use a
10822%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10823%
10824%  The format of the MagickSharpenImage method is:
10825%
10826%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10827%        const double radius,const double sigma)
10828%      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10829%        const ChannelType channel,const double radius,const double sigma)
10830%
10831%  A description of each parameter follows:
10832%
10833%    o wand: the magick wand.
10834%
10835%    o channel: the image channel(s).
10836%
10837%    o radius: the radius of the Gaussian, in pixels, not counting the center
10838%      pixel.
10839%
10840%    o sigma: the standard deviation of the Gaussian, in pixels.
10841%
10842*/
10843
10844WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10845  const double radius,const double sigma)
10846{
10847  MagickBooleanType
10848    status;
10849
10850  status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
10851  return(status);
10852}
10853
10854WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10855  const ChannelType channel,const double radius,const double sigma)
10856{
10857  Image
10858    *sharp_image;
10859
10860  assert(wand != (MagickWand *) NULL);
10861  assert(wand->signature == WandSignature);
10862  if (wand->debug != MagickFalse)
10863    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10864  if (wand->images == (Image *) NULL)
10865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10866  sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
10867    wand->exception);
10868  if (sharp_image == (Image *) NULL)
10869    return(MagickFalse);
10870  ReplaceImageInList(&wand->images,sharp_image);
10871  return(MagickTrue);
10872}
10873
10874/*
10875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10876%                                                                             %
10877%                                                                             %
10878%                                                                             %
10879%   M a g i c k S h a v e I m a g e                                           %
10880%                                                                             %
10881%                                                                             %
10882%                                                                             %
10883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10884%
10885%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10886%  memory necessary for the new Image structure and returns a pointer to the
10887%  new image.
10888%
10889%  The format of the MagickShaveImage method is:
10890%
10891%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10892%        const size_t columns,const size_t rows)
10893%
10894%  A description of each parameter follows:
10895%
10896%    o wand: the magick wand.
10897%
10898%    o columns: the number of columns in the scaled image.
10899%
10900%    o rows: the number of rows in the scaled image.
10901%
10902%
10903*/
10904WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10905  const size_t columns,const size_t rows)
10906{
10907  Image
10908    *shave_image;
10909
10910  RectangleInfo
10911    shave_info;
10912
10913  assert(wand != (MagickWand *) NULL);
10914  assert(wand->signature == WandSignature);
10915  if (wand->debug != MagickFalse)
10916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10917  if (wand->images == (Image *) NULL)
10918    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10919  shave_info.width=columns;
10920  shave_info.height=rows;
10921  shave_info.x=0;
10922  shave_info.y=0;
10923  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10924  if (shave_image == (Image *) NULL)
10925    return(MagickFalse);
10926  ReplaceImageInList(&wand->images,shave_image);
10927  return(MagickTrue);
10928}
10929
10930/*
10931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10932%                                                                             %
10933%                                                                             %
10934%                                                                             %
10935%   M a g i c k S h e a r I m a g e                                           %
10936%                                                                             %
10937%                                                                             %
10938%                                                                             %
10939%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10940%
10941%  MagickShearImage() slides one edge of an image along the X or Y axis,
10942%  creating a parallelogram.  An X direction shear slides an edge along the X
10943%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10944%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10945%  is measured relative to the Y axis, and similarly, for Y direction shears
10946%  y_shear is measured relative to the X axis.  Empty triangles left over from
10947%  shearing the image are filled with the background color.
10948%
10949%  The format of the MagickShearImage method is:
10950%
10951%      MagickBooleanType MagickShearImage(MagickWand *wand,
10952%        const PixelWand *background,const double x_shear,onst double y_shear)
10953%
10954%  A description of each parameter follows:
10955%
10956%    o wand: the magick wand.
10957%
10958%    o background: the background pixel wand.
10959%
10960%    o x_shear: the number of degrees to shear the image.
10961%
10962%    o y_shear: the number of degrees to shear the image.
10963%
10964*/
10965WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10966  const PixelWand *background,const double x_shear,const double y_shear)
10967{
10968  Image
10969    *shear_image;
10970
10971  assert(wand != (MagickWand *) NULL);
10972  assert(wand->signature == WandSignature);
10973  if (wand->debug != MagickFalse)
10974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10975  if (wand->images == (Image *) NULL)
10976    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10977  PixelGetQuantumPacket(background,&wand->images->background_color);
10978  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10979  if (shear_image == (Image *) NULL)
10980    return(MagickFalse);
10981  ReplaceImageInList(&wand->images,shear_image);
10982  return(MagickTrue);
10983}
10984
10985/*
10986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10987%                                                                             %
10988%                                                                             %
10989%                                                                             %
10990%   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                   %
10991%                                                                             %
10992%                                                                             %
10993%                                                                             %
10994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10995%
10996%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10997%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10998%  image using a sigmoidal transfer function without saturating highlights or
10999%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11000%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11001%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11002%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11003%  is reduced.
11004%
11005%  The format of the MagickSigmoidalContrastImage method is:
11006%
11007%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11008%        const MagickBooleanType sharpen,const double alpha,const double beta)
11009%
11010%  A description of each parameter follows:
11011%
11012%    o wand: the magick wand.
11013%
11014%    o sharpen: Increase or decrease image contrast.
11015%
11016%    o alpha: strength of the contrast, the larger the number the more
11017%      'threshold-like' it becomes.
11018%
11019%    o beta: midpoint of the function as a color value 0 to QuantumRange.
11020%
11021*/
11022WandExport MagickBooleanType MagickSigmoidalContrastImage(
11023  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
11024  const double beta)
11025{
11026  MagickBooleanType
11027    status;
11028
11029  assert(wand != (MagickWand *) NULL);
11030  assert(wand->signature == WandSignature);
11031  if (wand->debug != MagickFalse)
11032    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11033  if (wand->images == (Image *) NULL)
11034    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11035  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
11036  if (status == MagickFalse)
11037    InheritException(wand->exception,&wand->images->exception);
11038  return(status);
11039}
11040
11041/*
11042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11043%                                                                             %
11044%                                                                             %
11045%                                                                             %
11046%   M a g i c k S i m i l a r i t y I m a g e                                 %
11047%                                                                             %
11048%                                                                             %
11049%                                                                             %
11050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11051%
11052%  MagickSimilarityImage() compares the reference image of the image and
11053%  returns the best match offset.  In addition, it returns a similarity image
11054%  such that an exact match location is completely white and if none of the
11055%  pixels match, black, otherwise some gray level in-between.
11056%
11057%  The format of the MagickSimilarityImage method is:
11058%
11059%      MagickWand *MagickSimilarityImage(MagickWand *wand,
11060%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11061%
11062%  A description of each parameter follows:
11063%
11064%    o wand: the magick wand.
11065%
11066%    o reference: the reference wand.
11067%
11068%    o offset: the best match offset of the reference image within the image.
11069%
11070%    o similarity: the computed similarity between the images.
11071%
11072*/
11073WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11074  const MagickWand *reference,RectangleInfo *offset,double *similarity)
11075{
11076  Image
11077    *similarity_image;
11078
11079  assert(wand != (MagickWand *) NULL);
11080  assert(wand->signature == WandSignature);
11081  if (wand->debug != MagickFalse)
11082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11083  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11084    {
11085      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11086        "ContainsNoImages","`%s'",wand->name);
11087      return((MagickWand *) NULL);
11088    }
11089  similarity_image=SimilarityImage(wand->images,reference->images,offset,
11090    similarity,&wand->images->exception);
11091  if (similarity_image == (Image *) NULL)
11092    return((MagickWand *) NULL);
11093  return(CloneMagickWandFromImages(wand,similarity_image));
11094}
11095
11096/*
11097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098%                                                                             %
11099%                                                                             %
11100%                                                                             %
11101%   M a g i c k S k e t c h I m a g e                                         %
11102%                                                                             %
11103%                                                                             %
11104%                                                                             %
11105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106%
11107%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11108%  a Gaussian operator of the given radius and standard deviation (sigma).
11109%  For reasonable results, radius should be larger than sigma.  Use a
11110%  radius of 0 and SketchImage() selects a suitable radius for you.
11111%  Angle gives the angle of the blurring motion.
11112%
11113%  The format of the MagickSketchImage method is:
11114%
11115%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11116%        const double radius,const double sigma,const double angle)
11117%
11118%  A description of each parameter follows:
11119%
11120%    o wand: the magick wand.
11121%
11122%    o radius: the radius of the Gaussian, in pixels, not counting
11123%      the center pixel.
11124%
11125%    o sigma: the standard deviation of the Gaussian, in pixels.
11126%
11127%    o angle: Apply the effect along this angle.
11128%
11129*/
11130WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11131  const double radius,const double sigma,const double angle)
11132{
11133  Image
11134    *sketch_image;
11135
11136  assert(wand != (MagickWand *) NULL);
11137  assert(wand->signature == WandSignature);
11138  if (wand->debug != MagickFalse)
11139    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11140  if (wand->images == (Image *) NULL)
11141    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11142  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11143  if (sketch_image == (Image *) NULL)
11144    return(MagickFalse);
11145  ReplaceImageInList(&wand->images,sketch_image);
11146  return(MagickTrue);
11147}
11148
11149/*
11150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11151%                                                                             %
11152%                                                                             %
11153%                                                                             %
11154%   M a g i c k S m u s h I m a g e s                                         %
11155%                                                                             %
11156%                                                                             %
11157%                                                                             %
11158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11159%
11160%  MagickSmushImages() takes all images from the current image pointer to the
11161%  end of the image list and smushs them to each other top-to-bottom if the
11162%  stack parameter is true, otherwise left-to-right.
11163%
11164%  The format of the MagickSmushImages method is:
11165%
11166%      MagickWand *MagickSmushImages(MagickWand *wand,
11167%        const MagickBooleanType stack,const ssize_t offset)
11168%
11169%  A description of each parameter follows:
11170%
11171%    o wand: the magick wand.
11172%
11173%    o stack: By default, images are stacked left-to-right. Set stack to
11174%      MagickTrue to stack them top-to-bottom.
11175%
11176%    o offset: minimum distance in pixels between images.
11177%
11178*/
11179WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11180  const MagickBooleanType stack,const ssize_t offset)
11181{
11182  Image
11183    *smush_image;
11184
11185  assert(wand != (MagickWand *) NULL);
11186  assert(wand->signature == WandSignature);
11187  if (wand->debug != MagickFalse)
11188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11189  if (wand->images == (Image *) NULL)
11190    return((MagickWand *) NULL);
11191  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11192  if (smush_image == (Image *) NULL)
11193    return((MagickWand *) NULL);
11194  return(CloneMagickWandFromImages(wand,smush_image));
11195}
11196
11197/*
11198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11199%                                                                             %
11200%                                                                             %
11201%                                                                             %
11202%     M a g i c k S o l a r i z e I m a g e                                   %
11203%                                                                             %
11204%                                                                             %
11205%                                                                             %
11206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11207%
11208%  MagickSolarizeImage() applies a special effect to the image, similar to the
11209%  effect achieved in a photo darkroom by selectively exposing areas of photo
11210%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11211%  measure of the extent of the solarization.
11212%
11213%  The format of the MagickSolarizeImage method is:
11214%
11215%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11216%        const double threshold)
11217%
11218%  A description of each parameter follows:
11219%
11220%    o wand: the magick wand.
11221%
11222%    o threshold:  Define the extent of the solarization.
11223%
11224*/
11225WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11226  const double threshold)
11227{
11228  MagickBooleanType
11229    status;
11230
11231  assert(wand != (MagickWand *) NULL);
11232  assert(wand->signature == WandSignature);
11233  if (wand->debug != MagickFalse)
11234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11235  if (wand->images == (Image *) NULL)
11236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11237  status=SolarizeImage(wand->images,threshold);
11238  if (status == MagickFalse)
11239    InheritException(wand->exception,&wand->images->exception);
11240  return(status);
11241}
11242
11243/*
11244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11245%                                                                             %
11246%                                                                             %
11247%                                                                             %
11248%   M a g i c k S p a r s e C o l o r I m a g e                               %
11249%                                                                             %
11250%                                                                             %
11251%                                                                             %
11252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11253%
11254%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11255%  colors found at those coordinates, across the whole image, using various
11256%  methods.
11257%
11258%  The format of the MagickSparseColorImage method is:
11259%
11260%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11261%        const ChannelType channel,const SparseColorMethod method,
11262%        const size_t number_arguments,const double *arguments)
11263%
11264%  A description of each parameter follows:
11265%
11266%    o image: the image to be sparseed.
11267%
11268%    o method: the method of image sparseion.
11269%
11270%        ArcSparseColorion will always ignore source image offset, and always
11271%        'bestfit' the destination image with the top left corner offset
11272%        relative to the polar mapping center.
11273%
11274%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11275%        style of image sparseion.
11276%
11277%        Affine, Perspective, and Bilinear, will do least squares fitting of
11278%        the distrotion when more than the minimum number of control point
11279%        pairs are provided.
11280%
11281%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11282%        less than 4 control point pairs are provided. While Affine sparseions
11283%        will let you use any number of control point pairs, that is Zero pairs
11284%        is a No-Op (viewport only) distrotion, one pair is a translation and
11285%        two pairs of control points will do a scale-rotate-translate, without
11286%        any shearing.
11287%
11288%    o number_arguments: the number of arguments given for this sparseion
11289%      method.
11290%
11291%    o arguments: the arguments for this sparseion method.
11292%
11293*/
11294WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11295  const ChannelType channel,const SparseColorMethod method,
11296  const size_t number_arguments,const double *arguments)
11297{
11298  Image
11299    *sparse_image;
11300
11301  assert(wand != (MagickWand *) NULL);
11302  assert(wand->signature == WandSignature);
11303  if (wand->debug != MagickFalse)
11304    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11305  if (wand->images == (Image *) NULL)
11306    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11307  sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11308    arguments,wand->exception);
11309  if (sparse_image == (Image *) NULL)
11310    return(MagickFalse);
11311  ReplaceImageInList(&wand->images,sparse_image);
11312  return(MagickTrue);
11313}
11314
11315/*
11316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11317%                                                                             %
11318%                                                                             %
11319%                                                                             %
11320%   M a g i c k S p l i c e I m a g e                                         %
11321%                                                                             %
11322%                                                                             %
11323%                                                                             %
11324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11325%
11326%  MagickSpliceImage() splices a solid color into the image.
11327%
11328%  The format of the MagickSpliceImage method is:
11329%
11330%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11331%        const size_t width,const size_t height,const ssize_t x,
11332%        const ssize_t y)
11333%
11334%  A description of each parameter follows:
11335%
11336%    o wand: the magick wand.
11337%
11338%    o width: the region width.
11339%
11340%    o height: the region height.
11341%
11342%    o x: the region x offset.
11343%
11344%    o y: the region y offset.
11345%
11346*/
11347WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11348  const size_t width,const size_t height,const ssize_t x,
11349  const ssize_t y)
11350{
11351  Image
11352    *splice_image;
11353
11354  RectangleInfo
11355    splice;
11356
11357  assert(wand != (MagickWand *) NULL);
11358  assert(wand->signature == WandSignature);
11359  if (wand->debug != MagickFalse)
11360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11361  if (wand->images == (Image *) NULL)
11362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11363  splice.width=width;
11364  splice.height=height;
11365  splice.x=x;
11366  splice.y=y;
11367  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11368  if (splice_image == (Image *) NULL)
11369    return(MagickFalse);
11370  ReplaceImageInList(&wand->images,splice_image);
11371  return(MagickTrue);
11372}
11373
11374/*
11375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11376%                                                                             %
11377%                                                                             %
11378%                                                                             %
11379%   M a g i c k S p r e a d I m a g e                                         %
11380%                                                                             %
11381%                                                                             %
11382%                                                                             %
11383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11384%
11385%  MagickSpreadImage() is a special effects method that randomly displaces each
11386%  pixel in a block defined by the radius parameter.
11387%
11388%  The format of the MagickSpreadImage method is:
11389%
11390%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11391%
11392%  A description of each parameter follows:
11393%
11394%    o wand: the magick wand.
11395%
11396%    o radius:  Choose a random pixel in a neighborhood of this extent.
11397%
11398*/
11399WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11400  const double radius)
11401{
11402  Image
11403    *spread_image;
11404
11405  assert(wand != (MagickWand *) NULL);
11406  assert(wand->signature == WandSignature);
11407  if (wand->debug != MagickFalse)
11408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11409  if (wand->images == (Image *) NULL)
11410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11411  spread_image=SpreadImage(wand->images,radius,wand->exception);
11412  if (spread_image == (Image *) NULL)
11413    return(MagickFalse);
11414  ReplaceImageInList(&wand->images,spread_image);
11415  return(MagickTrue);
11416}
11417
11418/*
11419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11420%                                                                             %
11421%                                                                             %
11422%                                                                             %
11423%   M a g i c k S t a t i s t i c I m a g e                                   %
11424%                                                                             %
11425%                                                                             %
11426%                                                                             %
11427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11428%
11429%  MagickStatisticImage() replace each pixel with corresponding statistic from
11430%  the neighborhood of the specified width and height.
11431%
11432%  The format of the MagickStatisticImage method is:
11433%
11434%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11435%        const StatisticType type,const double width,const size_t height)
11436%      MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
11437%        const ChannelType channel,const StatisticType type,const double width,
11438%        const size_t height)
11439%
11440%  A description of each parameter follows:
11441%
11442%    o wand: the magick wand.
11443%
11444%    o channel: the image channel(s).
11445%
11446%    o type: the statistic type (e.g. median, mode, etc.).
11447%
11448%    o width: the width of the pixel neighborhood.
11449%
11450%    o height: the height of the pixel neighborhood.
11451%
11452*/
11453WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11454  const ChannelType channel,const StatisticType type,const size_t width,
11455  const size_t height)
11456{
11457  Image
11458    *statistic_image;
11459
11460  assert(wand != (MagickWand *) NULL);
11461  assert(wand->signature == WandSignature);
11462  if (wand->debug != MagickFalse)
11463    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11464  if (wand->images == (Image *) NULL)
11465    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11466  statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
11467    wand->exception);
11468  if (statistic_image == (Image *) NULL)
11469    return(MagickFalse);
11470  ReplaceImageInList(&wand->images,statistic_image);
11471  return(MagickTrue);
11472}
11473
11474/*
11475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11476%                                                                             %
11477%                                                                             %
11478%                                                                             %
11479%   M a g i c k S t e g a n o I m a g e                                       %
11480%                                                                             %
11481%                                                                             %
11482%                                                                             %
11483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11484%
11485%  MagickSteganoImage() hides a digital watermark within the image.
11486%  Recover the hidden watermark later to prove that the authenticity of
11487%  an image.  Offset defines the start position within the image to hide
11488%  the watermark.
11489%
11490%  The format of the MagickSteganoImage method is:
11491%
11492%      MagickWand *MagickSteganoImage(MagickWand *wand,
11493%        const MagickWand *watermark_wand,const ssize_t offset)
11494%
11495%  A description of each parameter follows:
11496%
11497%    o wand: the magick wand.
11498%
11499%    o watermark_wand: the watermark wand.
11500%
11501%    o offset: Start hiding at this offset into the image.
11502%
11503*/
11504WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11505  const MagickWand *watermark_wand,const ssize_t offset)
11506{
11507  Image
11508    *stegano_image;
11509
11510  assert(wand != (MagickWand *) NULL);
11511  assert(wand->signature == WandSignature);
11512  if (wand->debug != MagickFalse)
11513    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11514  if ((wand->images == (Image *) NULL) ||
11515      (watermark_wand->images == (Image *) NULL))
11516    {
11517      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11518        "ContainsNoImages","`%s'",wand->name);
11519      return((MagickWand *) NULL);
11520    }
11521  wand->images->offset=offset;
11522  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11523    wand->exception);
11524  if (stegano_image == (Image *) NULL)
11525    return((MagickWand *) NULL);
11526  return(CloneMagickWandFromImages(wand,stegano_image));
11527}
11528
11529/*
11530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11531%                                                                             %
11532%                                                                             %
11533%                                                                             %
11534%   M a g i c k S t e r e o I m a g e                                         %
11535%                                                                             %
11536%                                                                             %
11537%                                                                             %
11538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11539%
11540%  MagickStereoImage() composites two images and produces a single image that
11541%  is the composite of a left and right image of a stereo pair
11542%
11543%  The format of the MagickStereoImage method is:
11544%
11545%      MagickWand *MagickStereoImage(MagickWand *wand,
11546%        const MagickWand *offset_wand)
11547%
11548%  A description of each parameter follows:
11549%
11550%    o wand: the magick wand.
11551%
11552%    o offset_wand: Another image wand.
11553%
11554*/
11555WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11556  const MagickWand *offset_wand)
11557{
11558  Image
11559    *stereo_image;
11560
11561  assert(wand != (MagickWand *) NULL);
11562  assert(wand->signature == WandSignature);
11563  if (wand->debug != MagickFalse)
11564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11565  if ((wand->images == (Image *) NULL) ||
11566      (offset_wand->images == (Image *) NULL))
11567    {
11568      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11569        "ContainsNoImages","`%s'",wand->name);
11570      return((MagickWand *) NULL);
11571    }
11572  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11573  if (stereo_image == (Image *) NULL)
11574    return((MagickWand *) NULL);
11575  return(CloneMagickWandFromImages(wand,stereo_image));
11576}
11577
11578/*
11579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11580%                                                                             %
11581%                                                                             %
11582%                                                                             %
11583%   M a g i c k S t r i p I m a g e                                           %
11584%                                                                             %
11585%                                                                             %
11586%                                                                             %
11587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11588%
11589%  MagickStripImage() strips an image of all profiles and comments.
11590%
11591%  The format of the MagickStripImage method is:
11592%
11593%      MagickBooleanType MagickStripImage(MagickWand *wand)
11594%
11595%  A description of each parameter follows:
11596%
11597%    o wand: the magick wand.
11598%
11599*/
11600WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11601{
11602  MagickBooleanType
11603    status;
11604
11605  assert(wand != (MagickWand *) NULL);
11606  assert(wand->signature == WandSignature);
11607  if (wand->debug != MagickFalse)
11608    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11609  if (wand->images == (Image *) NULL)
11610    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11611  status=StripImage(wand->images);
11612  if (status == MagickFalse)
11613    InheritException(wand->exception,&wand->images->exception);
11614  return(status);
11615}
11616
11617/*
11618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11619%                                                                             %
11620%                                                                             %
11621%                                                                             %
11622%   M a g i c k S w i r l I m a g e                                           %
11623%                                                                             %
11624%                                                                             %
11625%                                                                             %
11626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11627%
11628%  MagickSwirlImage() swirls the pixels about the center of the image, where
11629%  degrees indicates the sweep of the arc through which each pixel is moved.
11630%  You get a more dramatic effect as the degrees move from 1 to 360.
11631%
11632%  The format of the MagickSwirlImage method is:
11633%
11634%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11635%
11636%  A description of each parameter follows:
11637%
11638%    o wand: the magick wand.
11639%
11640%    o degrees: Define the tightness of the swirling effect.
11641%
11642*/
11643WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11644  const double degrees)
11645{
11646  Image
11647    *swirl_image;
11648
11649  assert(wand != (MagickWand *) NULL);
11650  assert(wand->signature == WandSignature);
11651  if (wand->debug != MagickFalse)
11652    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11653  if (wand->images == (Image *) NULL)
11654    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11655  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11656  if (swirl_image == (Image *) NULL)
11657    return(MagickFalse);
11658  ReplaceImageInList(&wand->images,swirl_image);
11659  return(MagickTrue);
11660}
11661
11662/*
11663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11664%                                                                             %
11665%                                                                             %
11666%                                                                             %
11667%   M a g i c k T e x t u r e I m a g e                                       %
11668%                                                                             %
11669%                                                                             %
11670%                                                                             %
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672%
11673%  MagickTextureImage() repeatedly tiles the texture image across and down the
11674%  image canvas.
11675%
11676%  The format of the MagickTextureImage method is:
11677%
11678%      MagickWand *MagickTextureImage(MagickWand *wand,
11679%        const MagickWand *texture_wand)
11680%
11681%  A description of each parameter follows:
11682%
11683%    o wand: the magick wand.
11684%
11685%    o texture_wand: the texture wand
11686%
11687*/
11688WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11689  const MagickWand *texture_wand)
11690{
11691  Image
11692    *texture_image;
11693
11694  MagickBooleanType
11695    status;
11696
11697  assert(wand != (MagickWand *) NULL);
11698  assert(wand->signature == WandSignature);
11699  if (wand->debug != MagickFalse)
11700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11701  if ((wand->images == (Image *) NULL) ||
11702      (texture_wand->images == (Image *) NULL))
11703    {
11704      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11705        "ContainsNoImages","`%s'",wand->name);
11706      return((MagickWand *) NULL);
11707    }
11708  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11709  if (texture_image == (Image *) NULL)
11710    return((MagickWand *) NULL);
11711  status=TextureImage(texture_image,texture_wand->images);
11712  if (status == MagickFalse)
11713    {
11714      InheritException(wand->exception,&texture_image->exception);
11715      texture_image=DestroyImage(texture_image);
11716      return((MagickWand *) NULL);
11717    }
11718  return(CloneMagickWandFromImages(wand,texture_image));
11719}
11720
11721/*
11722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11723%                                                                             %
11724%                                                                             %
11725%                                                                             %
11726%   M a g i c k T h r e s h o l d I m a g e                                   %
11727%                                                                             %
11728%                                                                             %
11729%                                                                             %
11730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11731%
11732%  MagickThresholdImage() changes the value of individual pixels based on
11733%  the intensity of each pixel compared to threshold.  The result is a
11734%  high-contrast, two color image.
11735%
11736%  The format of the MagickThresholdImage method is:
11737%
11738%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11739%        const double threshold)
11740%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11741%        const ChannelType channel,const double threshold)
11742%
11743%  A description of each parameter follows:
11744%
11745%    o wand: the magick wand.
11746%
11747%    o channel: the image channel(s).
11748%
11749%    o threshold: Define the threshold value.
11750%
11751*/
11752WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11753  const double threshold)
11754{
11755  MagickBooleanType
11756    status;
11757
11758  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11759  return(status);
11760}
11761
11762WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11763  const ChannelType channel,const double threshold)
11764{
11765  MagickBooleanType
11766    status;
11767
11768  assert(wand != (MagickWand *) NULL);
11769  assert(wand->signature == WandSignature);
11770  if (wand->debug != MagickFalse)
11771    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11772  if (wand->images == (Image *) NULL)
11773    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11774  status=BilevelImageChannel(wand->images,channel,threshold);
11775  if (status == MagickFalse)
11776    InheritException(wand->exception,&wand->images->exception);
11777  return(status);
11778}
11779
11780/*
11781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11782%                                                                             %
11783%                                                                             %
11784%                                                                             %
11785%   M a g i c k T h u m b n a i l I m a g e                                   %
11786%                                                                             %
11787%                                                                             %
11788%                                                                             %
11789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11790%
11791%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11792%  and removes any associated profiles.  The goal is to produce small low cost
11793%  thumbnail images suited for display on the Web.
11794%
11795%  The format of the MagickThumbnailImage method is:
11796%
11797%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11798%        const size_t columns,const size_t rows)
11799%
11800%  A description of each parameter follows:
11801%
11802%    o wand: the magick wand.
11803%
11804%    o columns: the number of columns in the scaled image.
11805%
11806%    o rows: the number of rows in the scaled image.
11807%
11808*/
11809WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11810  const size_t columns,const size_t rows)
11811{
11812  Image
11813    *thumbnail_image;
11814
11815  assert(wand != (MagickWand *) NULL);
11816  assert(wand->signature == WandSignature);
11817  if (wand->debug != MagickFalse)
11818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11819  if (wand->images == (Image *) NULL)
11820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11821  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11822  if (thumbnail_image == (Image *) NULL)
11823    return(MagickFalse);
11824  ReplaceImageInList(&wand->images,thumbnail_image);
11825  return(MagickTrue);
11826}
11827
11828/*
11829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11830%                                                                             %
11831%                                                                             %
11832%                                                                             %
11833%   M a g i c k T i n t I m a g e                                             %
11834%                                                                             %
11835%                                                                             %
11836%                                                                             %
11837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11838%
11839%  MagickTintImage() applies a color vector to each pixel in the image.  The
11840%  length of the vector is 0 for black and white and at its maximum for the
11841%  midtones.  The vector weighting function is
11842%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11843%
11844%  The format of the MagickTintImage method is:
11845%
11846%      MagickBooleanType MagickTintImage(MagickWand *wand,
11847%        const PixelWand *tint,const PixelWand *opacity)
11848%
11849%  A description of each parameter follows:
11850%
11851%    o wand: the magick wand.
11852%
11853%    o tint: the tint pixel wand.
11854%
11855%    o opacity: the opacity pixel wand.
11856%
11857*/
11858WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11859  const PixelWand *tint,const PixelWand *opacity)
11860{
11861  char
11862    percent_opaque[MaxTextExtent];
11863
11864  Image
11865    *tint_image;
11866
11867  PixelPacket
11868    target;
11869
11870  assert(wand != (MagickWand *) NULL);
11871  assert(wand->signature == WandSignature);
11872  if (wand->debug != MagickFalse)
11873    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11874  if (wand->images == (Image *) NULL)
11875    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11876  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11877    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11878    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11879    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11880    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11881    PixelGetOpacityQuantum(opacity)));
11882  PixelGetQuantumPacket(tint,&target);
11883  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11884  if (tint_image == (Image *) NULL)
11885    return(MagickFalse);
11886  ReplaceImageInList(&wand->images,tint_image);
11887  return(MagickTrue);
11888}
11889
11890/*
11891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11892%                                                                             %
11893%                                                                             %
11894%                                                                             %
11895%   M a g i c k T r a n s f o r m I m a g e                                   %
11896%                                                                             %
11897%                                                                             %
11898%                                                                             %
11899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11900%
11901%  MagickTransformImage() is a convenience method that behaves like
11902%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11903%  information as a region geometry specification.  If the operation fails,
11904%  a NULL image handle is returned.
11905%
11906%  The format of the MagickTransformImage method is:
11907%
11908%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11909%        const char *geometry)
11910%
11911%  A description of each parameter follows:
11912%
11913%    o wand: the magick wand.
11914%
11915%    o crop: A crop geometry string.  This geometry defines a subregion of the
11916%      image to crop.
11917%
11918%    o geometry: An image geometry string.  This geometry defines the final
11919%      size of the image.
11920%
11921*/
11922WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11923  const char *crop,const char *geometry)
11924{
11925  Image
11926    *transform_image;
11927
11928  MagickBooleanType
11929    status;
11930
11931  assert(wand != (MagickWand *) NULL);
11932  assert(wand->signature == WandSignature);
11933  if (wand->debug != MagickFalse)
11934    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11935  if (wand->images == (Image *) NULL)
11936    return((MagickWand *) NULL);
11937  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11938  if (transform_image == (Image *) NULL)
11939    return((MagickWand *) NULL);
11940  status=TransformImage(&transform_image,crop,geometry);
11941  if (status == MagickFalse)
11942    {
11943      InheritException(wand->exception,&transform_image->exception);
11944      transform_image=DestroyImage(transform_image);
11945      return((MagickWand *) NULL);
11946    }
11947  return(CloneMagickWandFromImages(wand,transform_image));
11948}
11949
11950/*
11951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11952%                                                                             %
11953%                                                                             %
11954%                                                                             %
11955%   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               %
11956%                                                                             %
11957%                                                                             %
11958%                                                                             %
11959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11960%
11961%  MagickTransformImageColorspace() transform the image colorspace.
11962%
11963%  The format of the MagickTransformImageColorspace method is:
11964%
11965%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11966%        const ColorspaceType colorspace)
11967%
11968%  A description of each parameter follows:
11969%
11970%    o wand: the magick wand.
11971%
11972%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11973%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11974%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11975%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11976%      HSLColorspace, or HWBColorspace.
11977%
11978*/
11979WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11980  const ColorspaceType colorspace)
11981{
11982  assert(wand != (MagickWand *) NULL);
11983  assert(wand->signature == WandSignature);
11984  if (wand->debug != MagickFalse)
11985    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11986  if (wand->images == (Image *) NULL)
11987    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11988  return(TransformImageColorspace(wand->images,colorspace));
11989}
11990
11991/*
11992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11993%                                                                             %
11994%                                                                             %
11995%                                                                             %
11996%   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                     %
11997%                                                                             %
11998%                                                                             %
11999%                                                                             %
12000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12001%
12002%  MagickTransparentPaintImage() changes any pixel that matches color with the
12003%  color defined by fill.
12004%
12005%  The format of the MagickTransparentPaintImage method is:
12006%
12007%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12008%        const PixelWand *target,const double alpha,const double fuzz,
12009%        const MagickBooleanType invert)
12010%
12011%  A description of each parameter follows:
12012%
12013%    o wand: the magick wand.
12014%
12015%    o target: Change this target color to specified opacity value within
12016%      the image.
12017%
12018%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12019%      transparent.
12020%
12021%    o fuzz: By default target must match a particular pixel color
12022%      exactly.  However, in many cases two colors may differ by a small amount.
12023%      The fuzz member of image defines how much tolerance is acceptable to
12024%      consider two colors as the same.  For example, set fuzz to 10 and the
12025%      color red at intensities of 100 and 102 respectively are now interpreted
12026%      as the same color for the purposes of the floodfill.
12027%
12028%    o invert: paint any pixel that does not match the target color.
12029%
12030*/
12031WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12032  const PixelWand *target,const double alpha,const double fuzz,
12033  const MagickBooleanType invert)
12034{
12035  MagickBooleanType
12036    status;
12037
12038  PixelInfo
12039    target_pixel;
12040
12041  assert(wand != (MagickWand *) NULL);
12042  assert(wand->signature == WandSignature);
12043  if (wand->debug != MagickFalse)
12044    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12045  if (wand->images == (Image *) NULL)
12046    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12047  PixelGetMagickColor(target,&target_pixel);
12048  wand->images->fuzz=fuzz;
12049  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12050    QuantumRange*alpha),invert);
12051  if (status == MagickFalse)
12052    InheritException(wand->exception,&wand->images->exception);
12053  return(status);
12054}
12055
12056/*
12057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12058%                                                                             %
12059%                                                                             %
12060%                                                                             %
12061%   M a g i c k T r a n s p o s e I m a g e                                   %
12062%                                                                             %
12063%                                                                             %
12064%                                                                             %
12065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12066%
12067%  MagickTransposeImage() creates a vertical mirror image by reflecting the
12068%  pixels around the central x-axis while rotating them 90-degrees.
12069%
12070%  The format of the MagickTransposeImage method is:
12071%
12072%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12073%
12074%  A description of each parameter follows:
12075%
12076%    o wand: the magick wand.
12077%
12078*/
12079WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12080{
12081  Image
12082    *transpose_image;
12083
12084  assert(wand != (MagickWand *) NULL);
12085  assert(wand->signature == WandSignature);
12086  if (wand->debug != MagickFalse)
12087    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12088  if (wand->images == (Image *) NULL)
12089    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12090  transpose_image=TransposeImage(wand->images,wand->exception);
12091  if (transpose_image == (Image *) NULL)
12092    return(MagickFalse);
12093  ReplaceImageInList(&wand->images,transpose_image);
12094  return(MagickTrue);
12095}
12096
12097/*
12098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12099%                                                                             %
12100%                                                                             %
12101%                                                                             %
12102%   M a g i c k T r a n s v e r s e I m a g e                                 %
12103%                                                                             %
12104%                                                                             %
12105%                                                                             %
12106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12107%
12108%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12109%  pixels around the central y-axis while rotating them 270-degrees.
12110%
12111%  The format of the MagickTransverseImage method is:
12112%
12113%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12114%
12115%  A description of each parameter follows:
12116%
12117%    o wand: the magick wand.
12118%
12119*/
12120WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12121{
12122  Image
12123    *transverse_image;
12124
12125  assert(wand != (MagickWand *) NULL);
12126  assert(wand->signature == WandSignature);
12127  if (wand->debug != MagickFalse)
12128    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12129  if (wand->images == (Image *) NULL)
12130    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12131  transverse_image=TransverseImage(wand->images,wand->exception);
12132  if (transverse_image == (Image *) NULL)
12133    return(MagickFalse);
12134  ReplaceImageInList(&wand->images,transverse_image);
12135  return(MagickTrue);
12136}
12137
12138/*
12139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12140%                                                                             %
12141%                                                                             %
12142%                                                                             %
12143%   M a g i c k T r i m I m a g e                                             %
12144%                                                                             %
12145%                                                                             %
12146%                                                                             %
12147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12148%
12149%  MagickTrimImage() remove edges that are the background color from the image.
12150%
12151%  The format of the MagickTrimImage method is:
12152%
12153%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12154%
12155%  A description of each parameter follows:
12156%
12157%    o wand: the magick wand.
12158%
12159%    o fuzz: By default target must match a particular pixel color
12160%      exactly.  However, in many cases two colors may differ by a small amount.
12161%      The fuzz member of image defines how much tolerance is acceptable to
12162%      consider two colors as the same.  For example, set fuzz to 10 and the
12163%      color red at intensities of 100 and 102 respectively are now interpreted
12164%      as the same color for the purposes of the floodfill.
12165%
12166*/
12167WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12168{
12169  Image
12170    *trim_image;
12171
12172  assert(wand != (MagickWand *) NULL);
12173  assert(wand->signature == WandSignature);
12174  if (wand->debug != MagickFalse)
12175    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12176  if (wand->images == (Image *) NULL)
12177    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12178  wand->images->fuzz=fuzz;
12179  trim_image=TrimImage(wand->images,wand->exception);
12180  if (trim_image == (Image *) NULL)
12181    return(MagickFalse);
12182  ReplaceImageInList(&wand->images,trim_image);
12183  return(MagickTrue);
12184}
12185
12186/*
12187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12188%                                                                             %
12189%                                                                             %
12190%                                                                             %
12191%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12192%                                                                             %
12193%                                                                             %
12194%                                                                             %
12195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12196%
12197%  MagickUniqueImageColors() discards all but one of any pixel color.
12198%
12199%  The format of the MagickUniqueImageColors method is:
12200%
12201%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12202%
12203%  A description of each parameter follows:
12204%
12205%    o wand: the magick wand.
12206%
12207*/
12208WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12209{
12210  Image
12211    *unique_image;
12212
12213  assert(wand != (MagickWand *) NULL);
12214  assert(wand->signature == WandSignature);
12215  if (wand->debug != MagickFalse)
12216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12217  if (wand->images == (Image *) NULL)
12218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12219  unique_image=UniqueImageColors(wand->images,wand->exception);
12220  if (unique_image == (Image *) NULL)
12221    return(MagickFalse);
12222  ReplaceImageInList(&wand->images,unique_image);
12223  return(MagickTrue);
12224}
12225
12226/*
12227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12228%                                                                             %
12229%                                                                             %
12230%                                                                             %
12231%   M a g i c k U n s h a r p M a s k I m a g e                               %
12232%                                                                             %
12233%                                                                             %
12234%                                                                             %
12235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12236%
12237%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12238%  Gaussian operator of the given radius and standard deviation (sigma).
12239%  For reasonable results, radius should be larger than sigma.  Use a radius
12240%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12241%
12242%  The format of the MagickUnsharpMaskImage method is:
12243%
12244%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12245%        const double radius,const double sigma,const double amount,
12246%        const double threshold)
12247%      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12248%        const ChannelType channel,const double radius,const double sigma,
12249%        const double amount,const double threshold)
12250%
12251%  A description of each parameter follows:
12252%
12253%    o wand: the magick wand.
12254%
12255%    o channel: the image channel(s).
12256%
12257%    o radius: the radius of the Gaussian, in pixels, not counting the center
12258%      pixel.
12259%
12260%    o sigma: the standard deviation of the Gaussian, in pixels.
12261%
12262%    o amount: the percentage of the difference between the original and the
12263%      blur image that is added back into the original.
12264%
12265%    o threshold: the threshold in pixels needed to apply the diffence amount.
12266%
12267*/
12268
12269WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12270  const double radius,const double sigma,const double amount,
12271  const double threshold)
12272{
12273  MagickBooleanType
12274    status;
12275
12276  status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12277    amount,threshold);
12278  return(status);
12279}
12280
12281WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12282  const ChannelType channel,const double radius,const double sigma,
12283  const double amount,const double threshold)
12284{
12285  Image
12286    *unsharp_image;
12287
12288  assert(wand != (MagickWand *) NULL);
12289  assert(wand->signature == WandSignature);
12290  if (wand->debug != MagickFalse)
12291    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12292  if (wand->images == (Image *) NULL)
12293    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12294  unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12295    amount,threshold,wand->exception);
12296  if (unsharp_image == (Image *) NULL)
12297    return(MagickFalse);
12298  ReplaceImageInList(&wand->images,unsharp_image);
12299  return(MagickTrue);
12300}
12301
12302/*
12303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12304%                                                                             %
12305%                                                                             %
12306%                                                                             %
12307%   M a g i c k V i g n e t t e I m a g e                                     %
12308%                                                                             %
12309%                                                                             %
12310%                                                                             %
12311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12312%
12313%  MagickVignetteImage() softens the edges of the image in vignette style.
12314%
12315%  The format of the MagickVignetteImage method is:
12316%
12317%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12318%        const double black_point,const double white_point,const ssize_t x,
12319%        const ssize_t y)
12320%
12321%  A description of each parameter follows:
12322%
12323%    o wand: the magick wand.
12324%
12325%    o black_point: the black point.
12326%
12327%    o white_point: the white point.
12328%
12329%    o x, y:  Define the x and y ellipse offset.
12330%
12331*/
12332WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12333  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12334{
12335  Image
12336    *vignette_image;
12337
12338  assert(wand != (MagickWand *) NULL);
12339  assert(wand->signature == WandSignature);
12340  if (wand->debug != MagickFalse)
12341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12342  if (wand->images == (Image *) NULL)
12343    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12344  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12345    wand->exception);
12346  if (vignette_image == (Image *) NULL)
12347    return(MagickFalse);
12348  ReplaceImageInList(&wand->images,vignette_image);
12349  return(MagickTrue);
12350}
12351
12352/*
12353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12354%                                                                             %
12355%                                                                             %
12356%                                                                             %
12357%   M a g i c k W a v e I m a g e                                             %
12358%                                                                             %
12359%                                                                             %
12360%                                                                             %
12361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12362%
12363%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12364%  the pixels vertically along a sine wave whose amplitude and wavelength
12365%  is specified by the given parameters.
12366%
12367%  The format of the MagickWaveImage method is:
12368%
12369%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12370%        const double wave_length)
12371%
12372%  A description of each parameter follows:
12373%
12374%    o wand: the magick wand.
12375%
12376%    o amplitude, wave_length:  Define the amplitude and wave length of the
12377%      sine wave.
12378%
12379*/
12380WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12381  const double amplitude,const double wave_length)
12382{
12383  Image
12384    *wave_image;
12385
12386  assert(wand != (MagickWand *) NULL);
12387  assert(wand->signature == WandSignature);
12388  if (wand->debug != MagickFalse)
12389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12390  if (wand->images == (Image *) NULL)
12391    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12392  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12393  if (wave_image == (Image *) NULL)
12394    return(MagickFalse);
12395  ReplaceImageInList(&wand->images,wave_image);
12396  return(MagickTrue);
12397}
12398
12399/*
12400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12401%                                                                             %
12402%                                                                             %
12403%                                                                             %
12404%   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                         %
12405%                                                                             %
12406%                                                                             %
12407%                                                                             %
12408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12409%
12410%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12411%  above the threshold into white while leaving all pixels below the threshold
12412%  unchanged.
12413%
12414%  The format of the MagickWhiteThresholdImage method is:
12415%
12416%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12417%        const PixelWand *threshold)
12418%
12419%  A description of each parameter follows:
12420%
12421%    o wand: the magick wand.
12422%
12423%    o threshold: the pixel wand.
12424%
12425*/
12426WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12427  const PixelWand *threshold)
12428{
12429  char
12430    thresholds[MaxTextExtent];
12431
12432  MagickBooleanType
12433    status;
12434
12435  assert(wand != (MagickWand *) NULL);
12436  assert(wand->signature == WandSignature);
12437  if (wand->debug != MagickFalse)
12438    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12439  if (wand->images == (Image *) NULL)
12440    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12441  (void) FormatLocaleString(thresholds,MaxTextExtent,
12442    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12443    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12444    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12445  status=WhiteThresholdImage(wand->images,thresholds);
12446  if (status == MagickFalse)
12447    InheritException(wand->exception,&wand->images->exception);
12448  return(status);
12449}
12450
12451/*
12452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12453%                                                                             %
12454%                                                                             %
12455%                                                                             %
12456%   M a g i c k W r i t e I m a g e                                           %
12457%                                                                             %
12458%                                                                             %
12459%                                                                             %
12460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12461%
12462%  MagickWriteImage() writes an image to the specified filename.  If the
12463%  filename parameter is NULL, the image is written to the filename set
12464%  by MagickReadImage() or MagickSetImageFilename().
12465%
12466%  The format of the MagickWriteImage method is:
12467%
12468%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12469%        const char *filename)
12470%
12471%  A description of each parameter follows:
12472%
12473%    o wand: the magick wand.
12474%
12475%    o filename: the image filename.
12476%
12477%
12478*/
12479WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12480  const char *filename)
12481{
12482  Image
12483    *image;
12484
12485  ImageInfo
12486    *write_info;
12487
12488  MagickBooleanType
12489    status;
12490
12491  assert(wand != (MagickWand *) NULL);
12492  assert(wand->signature == WandSignature);
12493  if (wand->debug != MagickFalse)
12494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12495  if (wand->images == (Image *) NULL)
12496    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12497  if (filename != (const char *) NULL)
12498    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12499  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12500  if (image == (Image *) NULL)
12501    return(MagickFalse);
12502  write_info=CloneImageInfo(wand->image_info);
12503  write_info->adjoin=MagickTrue;
12504  status=WriteImage(write_info,image);
12505  if (status == MagickFalse)
12506    InheritException(wand->exception,&image->exception);
12507  image=DestroyImage(image);
12508  write_info=DestroyImageInfo(write_info);
12509  return(status);
12510}
12511
12512/*
12513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12514%                                                                             %
12515%                                                                             %
12516%                                                                             %
12517%   M a g i c k W r i t e I m a g e F i l e                                   %
12518%                                                                             %
12519%                                                                             %
12520%                                                                             %
12521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12522%
12523%  MagickWriteImageFile() writes an image to an open file descriptor.
12524%
12525%  The format of the MagickWriteImageFile method is:
12526%
12527%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12528%
12529%  A description of each parameter follows:
12530%
12531%    o wand: the magick wand.
12532%
12533%    o file: the file descriptor.
12534%
12535*/
12536WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12537{
12538  Image
12539    *image;
12540
12541  ImageInfo
12542    *write_info;
12543
12544  MagickBooleanType
12545    status;
12546
12547  assert(wand != (MagickWand *) NULL);
12548  assert(wand->signature == WandSignature);
12549  assert(file != (FILE *) NULL);
12550  if (wand->debug != MagickFalse)
12551    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12552  if (wand->images == (Image *) NULL)
12553    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12554  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12555  if (image == (Image *) NULL)
12556    return(MagickFalse);
12557  write_info=CloneImageInfo(wand->image_info);
12558  SetImageInfoFile(write_info,file);
12559  write_info->adjoin=MagickTrue;
12560  status=WriteImage(write_info,image);
12561  write_info=DestroyImageInfo(write_info);
12562  if (status == MagickFalse)
12563    InheritException(wand->exception,&image->exception);
12564  image=DestroyImage(image);
12565  return(status);
12566}
12567
12568/*
12569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12570%                                                                             %
12571%                                                                             %
12572%                                                                             %
12573%   M a g i c k W r i t e I m a g e s                                         %
12574%                                                                             %
12575%                                                                             %
12576%                                                                             %
12577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12578%
12579%  MagickWriteImages() writes an image or image sequence.
12580%
12581%  The format of the MagickWriteImages method is:
12582%
12583%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12584%        const char *filename,const MagickBooleanType adjoin)
12585%
12586%  A description of each parameter follows:
12587%
12588%    o wand: the magick wand.
12589%
12590%    o filename: the image filename.
12591%
12592%    o adjoin: join images into a single multi-image file.
12593%
12594*/
12595WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12596  const char *filename,const MagickBooleanType adjoin)
12597{
12598  ImageInfo
12599    *write_info;
12600
12601  MagickBooleanType
12602    status;
12603
12604  assert(wand != (MagickWand *) NULL);
12605  assert(wand->signature == WandSignature);
12606  if (wand->debug != MagickFalse)
12607    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12608  if (wand->images == (Image *) NULL)
12609    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12610  write_info=CloneImageInfo(wand->image_info);
12611  write_info->adjoin=adjoin;
12612  status=WriteImages(write_info,wand->images,filename,wand->exception);
12613  if (status == MagickFalse)
12614    InheritException(wand->exception,&wand->images->exception);
12615  write_info=DestroyImageInfo(write_info);
12616  return(status);
12617}
12618
12619/*
12620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12621%                                                                             %
12622%                                                                             %
12623%                                                                             %
12624%   M a g i c k W r i t e I m a g e s F i l e                                 %
12625%                                                                             %
12626%                                                                             %
12627%                                                                             %
12628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12629%
12630%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12631%
12632%  The format of the MagickWriteImagesFile method is:
12633%
12634%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12635%
12636%  A description of each parameter follows:
12637%
12638%    o wand: the magick wand.
12639%
12640%    o file: the file descriptor.
12641%
12642*/
12643WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12644{
12645  ImageInfo
12646    *write_info;
12647
12648  MagickBooleanType
12649    status;
12650
12651  assert(wand != (MagickWand *) NULL);
12652  assert(wand->signature == WandSignature);
12653  if (wand->debug != MagickFalse)
12654    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12655  if (wand->images == (Image *) NULL)
12656    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12657  write_info=CloneImageInfo(wand->image_info);
12658  SetImageInfoFile(write_info,file);
12659  write_info->adjoin=MagickTrue;
12660  status=WriteImages(write_info,wand->images,(const char *) NULL,
12661    wand->exception);
12662  write_info=DestroyImageInfo(write_info);
12663  if (status == MagickFalse)
12664    InheritException(wand->exception,&wand->images->exception);
12665  return(status);
12666}
12667