magick-image.c revision 5bc7a4ecec0642c893553e38692fc29d4dc4b4f6
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%      MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
765%        const ChannelType channel)
766%
767%  A description of each parameter follows:
768%
769%    o wand: the magick wand.
770%
771%    o channel: the image channel(s).
772%
773*/
774WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
775{
776  MagickBooleanType
777    status;
778
779  status=MagickAutoGammaImageChannel(wand,DefaultChannels);
780  return(status);
781}
782
783WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
784  const ChannelType channel)
785{
786  MagickBooleanType
787    status;
788
789  assert(wand != (MagickWand *) NULL);
790  assert(wand->signature == WandSignature);
791  if (wand->debug != MagickFalse)
792    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
793  if (wand->images == (Image *) NULL)
794    ThrowWandException(WandError,"ContainsNoImages",wand->name);
795  status=AutoGammaImageChannel(wand->images,channel);
796  if (status == MagickFalse)
797    InheritException(wand->exception,&wand->images->exception);
798  return(status);
799}
800
801/*
802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803%                                                                             %
804%                                                                             %
805%                                                                             %
806%   M a g i c k A u t o L e v e l I m a g e                                   %
807%                                                                             %
808%                                                                             %
809%                                                                             %
810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
811%
812%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
813%  scaling the minimum and maximum values to the full quantum range.
814%
815%  The format of the MagickAutoLevelImage method is:
816%
817%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
818%      MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
819%        const ChannelType channel)
820%
821%  A description of each parameter follows:
822%
823%    o wand: the magick wand.
824%
825%    o channel: the image channel(s).
826%
827*/
828WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
829{
830  MagickBooleanType
831    status;
832
833  status=MagickAutoLevelImageChannel(wand,DefaultChannels);
834  return(status);
835}
836
837WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
838  const ChannelType channel)
839{
840  MagickBooleanType
841    status;
842
843  assert(wand != (MagickWand *) NULL);
844  assert(wand->signature == WandSignature);
845  if (wand->debug != MagickFalse)
846    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847  if (wand->images == (Image *) NULL)
848    ThrowWandException(WandError,"ContainsNoImages",wand->name);
849  status=AutoLevelImageChannel(wand->images,channel);
850  if (status == MagickFalse)
851    InheritException(wand->exception,&wand->images->exception);
852  return(status);
853}
854
855/*
856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
857%                                                                             %
858%                                                                             %
859%                                                                             %
860%   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                         %
861%                                                                             %
862%                                                                             %
863%                                                                             %
864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
865%
866%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
867%  pixels below the threshold into black while leaving all pixels above the
868%  threshold unchanged.
869%
870%  The format of the MagickBlackThresholdImage method is:
871%
872%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
873%        const PixelWand *threshold)
874%
875%  A description of each parameter follows:
876%
877%    o wand: the magick wand.
878%
879%    o threshold: the pixel wand.
880%
881*/
882WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
883  const PixelWand *threshold)
884{
885  char
886    thresholds[MaxTextExtent];
887
888  MagickBooleanType
889    status;
890
891  assert(wand != (MagickWand *) NULL);
892  assert(wand->signature == WandSignature);
893  if (wand->debug != MagickFalse)
894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
895  if (wand->images == (Image *) NULL)
896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
897  (void) FormatLocaleString(thresholds,MaxTextExtent,
898    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
899    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
900    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
901  status=BlackThresholdImage(wand->images,thresholds);
902  if (status == MagickFalse)
903    InheritException(wand->exception,&wand->images->exception);
904  return(status);
905}
906
907/*
908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
909%                                                                             %
910%                                                                             %
911%                                                                             %
912%   M a g i c k B l u e S h i f t I m a g e                                   %
913%                                                                             %
914%                                                                             %
915%                                                                             %
916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
917%
918%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
919%  nighttime in the moonlight.
920%
921%  The format of the MagickBlueShiftImage method is:
922%
923%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
924%        const double factor)
925%
926%  A description of each parameter follows:
927%
928%    o wand: the magick wand.
929%
930%    o factor: the blue shift factor (default 1.5)
931%
932*/
933WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
934  const double factor)
935{
936  Image
937    *shift_image;
938
939  assert(wand != (MagickWand *) NULL);
940  assert(wand->signature == WandSignature);
941  if (wand->debug != MagickFalse)
942    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
943  if (wand->images == (Image *) NULL)
944    ThrowWandException(WandError,"ContainsNoImages",wand->name);
945  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
946  if (shift_image == (Image *) NULL)
947    return(MagickFalse);
948  ReplaceImageInList(&wand->images,shift_image);
949  return(MagickTrue);
950}
951
952/*
953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
954%                                                                             %
955%                                                                             %
956%                                                                             %
957%   M a g i c k B l u r I m a g e                                             %
958%                                                                             %
959%                                                                             %
960%                                                                             %
961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
962%
963%  MagickBlurImage() blurs an image.  We convolve the image with a
964%  gaussian operator of the given radius and standard deviation (sigma).
965%  For reasonable results, the radius should be larger than sigma.  Use a
966%  radius of 0 and BlurImage() selects a suitable radius for you.
967%
968%  The format of the MagickBlurImage method is:
969%
970%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
971%        const double sigma)
972%      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
973%        const ChannelType channel,const double radius,const double sigma)
974%
975%  A description of each parameter follows:
976%
977%    o wand: the magick wand.
978%
979%    o channel: the image channel(s).
980%
981%    o radius: the radius of the , in pixels, not counting the center
982%      pixel.
983%
984%    o sigma: the standard deviation of the , in pixels.
985%
986*/
987
988WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
989  const double radius,const double sigma)
990{
991  MagickBooleanType
992    status;
993
994  status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
995  return(status);
996}
997
998WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
999  const ChannelType channel,const double radius,const double sigma)
1000{
1001  Image
1002    *blur_image;
1003
1004  assert(wand != (MagickWand *) NULL);
1005  assert(wand->signature == WandSignature);
1006  if (wand->debug != MagickFalse)
1007    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1008  if (wand->images == (Image *) NULL)
1009    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1010  blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
1011    wand->exception);
1012  if (blur_image == (Image *) NULL)
1013    return(MagickFalse);
1014  ReplaceImageInList(&wand->images,blur_image);
1015  return(MagickTrue);
1016}
1017
1018/*
1019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1020%                                                                             %
1021%                                                                             %
1022%                                                                             %
1023%   M a g i c k B o r d e r I m a g e                                         %
1024%                                                                             %
1025%                                                                             %
1026%                                                                             %
1027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1028%
1029%  MagickBorderImage() surrounds the image with a border of the color defined
1030%  by the bordercolor pixel wand.
1031%
1032%  The format of the MagickBorderImage method is:
1033%
1034%      MagickBooleanType MagickBorderImage(MagickWand *wand,
1035%        const PixelWand *bordercolor,const size_t width,
1036%        const size_t height)
1037%
1038%  A description of each parameter follows:
1039%
1040%    o wand: the magick wand.
1041%
1042%    o bordercolor: the border color pixel wand.
1043%
1044%    o width: the border width.
1045%
1046%    o height: the border height.
1047%
1048*/
1049WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1050  const PixelWand *bordercolor,const size_t width,
1051  const size_t height)
1052{
1053  Image
1054    *border_image;
1055
1056  RectangleInfo
1057    border_info;
1058
1059  assert(wand != (MagickWand *) NULL);
1060  assert(wand->signature == WandSignature);
1061  if (wand->debug != MagickFalse)
1062    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1063  if (wand->images == (Image *) NULL)
1064    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1065  border_info.width=width;
1066  border_info.height=height;
1067  border_info.x=0;
1068  border_info.y=0;
1069  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1070  border_image=BorderImage(wand->images,&border_info,wand->exception);
1071  if (border_image == (Image *) NULL)
1072    return(MagickFalse);
1073  ReplaceImageInList(&wand->images,border_image);
1074  return(MagickTrue);
1075}
1076
1077/*
1078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1079%                                                                             %
1080%                                                                             %
1081%                                                                             %
1082%   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   %
1083%                                                                             %
1084%                                                                             %
1085%                                                                             %
1086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1087%
1088%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1089%  of an image.  It converts the brightness and contrast parameters into slope
1090%  and intercept and calls a polynomical function to apply to the image.
1091
1092%
1093%  The format of the MagickBrightnessContrastImage method is:
1094%
1095%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1096%        const double brightness,const double contrast)
1097%      MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,
1098%        const ChannelType channel,const double brightness,
1099%        const double contrast)
1100%
1101%  A description of each parameter follows:
1102%
1103%    o wand: the magick wand.
1104%
1105%    o channel: the image channel(s).
1106%
1107%    o brightness: the brightness percent (-100 .. 100).
1108%
1109%    o contrast: the contrast percent (-100 .. 100).
1110%
1111*/
1112
1113WandExport MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1114  const double brightness,const double contrast)
1115{
1116  MagickBooleanType
1117    status;
1118
1119  status=MagickBrightnessContrastImageChannel(wand,DefaultChannels,brightness,
1120    contrast);
1121  return(status);
1122}
1123
1124WandExport MagickBooleanType MagickBrightnessContrastImageChannel(
1125  MagickWand *wand,const ChannelType channel,const double brightness,
1126  const double contrast)
1127{
1128  MagickBooleanType
1129    status;
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  status=BrightnessContrastImageChannel(wand->images,channel,brightness,
1138    contrast);
1139  if (status == MagickFalse)
1140    InheritException(wand->exception,&wand->images->exception);
1141  return(status);
1142}
1143
1144/*
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%                                                                             %
1147%                                                                             %
1148%                                                                             %
1149%   M a g i c k C h a r c o a l I m a g e                                     %
1150%                                                                             %
1151%                                                                             %
1152%                                                                             %
1153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154%
1155%  MagickCharcoalImage() simulates a charcoal drawing.
1156%
1157%  The format of the MagickCharcoalImage method is:
1158%
1159%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160%        const double radius,const double sigma)
1161%
1162%  A description of each parameter follows:
1163%
1164%    o wand: the magick wand.
1165%
1166%    o radius: the radius of the Gaussian, in pixels, not counting the center
1167%      pixel.
1168%
1169%    o sigma: the standard deviation of the Gaussian, in pixels.
1170%
1171*/
1172WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173  const double radius,const double sigma)
1174{
1175  Image
1176    *charcoal_image;
1177
1178  assert(wand != (MagickWand *) NULL);
1179  assert(wand->signature == WandSignature);
1180  if (wand->debug != MagickFalse)
1181    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182  if (wand->images == (Image *) NULL)
1183    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185  if (charcoal_image == (Image *) NULL)
1186    return(MagickFalse);
1187  ReplaceImageInList(&wand->images,charcoal_image);
1188  return(MagickTrue);
1189}
1190
1191/*
1192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193%                                                                             %
1194%                                                                             %
1195%                                                                             %
1196%   M a g i c k C h o p I m a g e                                             %
1197%                                                                             %
1198%                                                                             %
1199%                                                                             %
1200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201%
1202%  MagickChopImage() removes a region of an image and collapses the image to
1203%  occupy the removed portion
1204%
1205%  The format of the MagickChopImage method is:
1206%
1207%      MagickBooleanType MagickChopImage(MagickWand *wand,
1208%        const size_t width,const size_t height,const ssize_t x,
1209%        const ssize_t y)
1210%
1211%  A description of each parameter follows:
1212%
1213%    o wand: the magick wand.
1214%
1215%    o width: the region width.
1216%
1217%    o height: the region height.
1218%
1219%    o x: the region x offset.
1220%
1221%    o y: the region y offset.
1222%
1223%
1224*/
1225WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226  const size_t width,const size_t height,const ssize_t x,
1227  const ssize_t y)
1228{
1229  Image
1230    *chop_image;
1231
1232  RectangleInfo
1233    chop;
1234
1235  assert(wand != (MagickWand *) NULL);
1236  assert(wand->signature == WandSignature);
1237  if (wand->debug != MagickFalse)
1238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239  if (wand->images == (Image *) NULL)
1240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241  chop.width=width;
1242  chop.height=height;
1243  chop.x=x;
1244  chop.y=y;
1245  chop_image=ChopImage(wand->images,&chop,wand->exception);
1246  if (chop_image == (Image *) NULL)
1247    return(MagickFalse);
1248  ReplaceImageInList(&wand->images,chop_image);
1249  return(MagickTrue);
1250}
1251
1252/*
1253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254%                                                                             %
1255%                                                                             %
1256%                                                                             %
1257%   M a g i c k C l a m p I m a g e                                           %
1258%                                                                             %
1259%                                                                             %
1260%                                                                             %
1261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262%
1263%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1264%
1265%  The format of the MagickClampImage method is:
1266%
1267%      MagickBooleanType MagickClampImage(MagickWand *wand)
1268%      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1269%        const ChannelType channel)
1270%
1271%  A description of each parameter follows:
1272%
1273%    o wand: the magick wand.
1274%
1275%    o channel: the channel.
1276%
1277*/
1278
1279WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1280{
1281  MagickBooleanType
1282    status;
1283
1284  status=MagickClampImageChannel(wand,DefaultChannels);
1285  return(status);
1286}
1287
1288WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1289  const ChannelType channel)
1290{
1291  MagickBooleanType
1292    status;
1293
1294  assert(wand != (MagickWand *) NULL);
1295  assert(wand->signature == WandSignature);
1296  if (wand->debug != MagickFalse)
1297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1298  if (wand->images == (Image *) NULL)
1299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1300  status=ClampImageChannel(wand->images,channel);
1301  if (status == MagickFalse)
1302    InheritException(wand->exception,&wand->images->exception);
1303  return(status);
1304}
1305
1306/*
1307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1308%                                                                             %
1309%                                                                             %
1310%                                                                             %
1311%   M a g i c k C l i p I m a g e                                             %
1312%                                                                             %
1313%                                                                             %
1314%                                                                             %
1315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1316%
1317%  MagickClipImage() clips along the first path from the 8BIM profile, if
1318%  present.
1319%
1320%  The format of the MagickClipImage method is:
1321%
1322%      MagickBooleanType MagickClipImage(MagickWand *wand)
1323%
1324%  A description of each parameter follows:
1325%
1326%    o wand: the magick wand.
1327%
1328*/
1329WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1330{
1331  MagickBooleanType
1332    status;
1333
1334  assert(wand != (MagickWand *) NULL);
1335  assert(wand->signature == WandSignature);
1336  if (wand->debug != MagickFalse)
1337    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1338  if (wand->images == (Image *) NULL)
1339    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1340  status=ClipImage(wand->images);
1341  if (status == MagickFalse)
1342    InheritException(wand->exception,&wand->images->exception);
1343  return(status);
1344}
1345
1346/*
1347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1348%                                                                             %
1349%                                                                             %
1350%                                                                             %
1351%   M a g i c k C l i p I m a g e P a t h                                     %
1352%                                                                             %
1353%                                                                             %
1354%                                                                             %
1355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1356%
1357%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1358%  present. Later operations take effect inside the path.  Id may be a number
1359%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1360%  path.
1361%
1362%  The format of the MagickClipImagePath method is:
1363%
1364%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1365%        const char *pathname,const MagickBooleanType inside)
1366%
1367%  A description of each parameter follows:
1368%
1369%    o wand: the magick wand.
1370%
1371%    o pathname: name of clipping path resource. If name is preceded by #, use
1372%      clipping path numbered by name.
1373%
1374%    o inside: if non-zero, later operations take effect inside clipping path.
1375%      Otherwise later operations take effect outside clipping path.
1376%
1377*/
1378WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1379  const char *pathname,const MagickBooleanType inside)
1380{
1381  MagickBooleanType
1382    status;
1383
1384  assert(wand != (MagickWand *) NULL);
1385  assert(wand->signature == WandSignature);
1386  if (wand->debug != MagickFalse)
1387    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1388  if (wand->images == (Image *) NULL)
1389    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1390  status=ClipImagePath(wand->images,pathname,inside);
1391  if (status == MagickFalse)
1392    InheritException(wand->exception,&wand->images->exception);
1393  return(status);
1394}
1395
1396/*
1397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1398%                                                                             %
1399%                                                                             %
1400%                                                                             %
1401%   M a g i c k C l u t I m a g e                                             %
1402%                                                                             %
1403%                                                                             %
1404%                                                                             %
1405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1406%
1407%  MagickClutImage() replaces colors in the image from a color lookup table.
1408%
1409%  The format of the MagickClutImage method is:
1410%
1411%      MagickBooleanType MagickClutImage(MagickWand *wand,
1412%        const MagickWand *clut_wand)
1413%      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1414%        const ChannelType channel,const MagickWand *clut_wand)
1415%
1416%  A description of each parameter follows:
1417%
1418%    o wand: the magick wand.
1419%
1420%    o clut_image: the clut image.
1421%
1422*/
1423
1424WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1425  const MagickWand *clut_wand)
1426{
1427  MagickBooleanType
1428    status;
1429
1430  status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1431  return(status);
1432}
1433
1434WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1435  const ChannelType channel,const MagickWand *clut_wand)
1436{
1437  MagickBooleanType
1438    status;
1439
1440  assert(wand != (MagickWand *) NULL);
1441  assert(wand->signature == WandSignature);
1442  if (wand->debug != MagickFalse)
1443    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1444  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1445    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1446  status=ClutImageChannel(wand->images,channel,clut_wand->images);
1447  if (status == MagickFalse)
1448    InheritException(wand->exception,&wand->images->exception);
1449  return(status);
1450}
1451
1452/*
1453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1454%                                                                             %
1455%                                                                             %
1456%                                                                             %
1457%   M a g i c k C o a l e s c e I m a g e s                                   %
1458%                                                                             %
1459%                                                                             %
1460%                                                                             %
1461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462%
1463%  MagickCoalesceImages() composites a set of images while respecting any page
1464%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1465%  typically start with an image background and each subsequent image
1466%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1467%  where each image in the sequence is the same size as the first and
1468%  composited with the next image in the sequence.
1469%
1470%  The format of the MagickCoalesceImages method is:
1471%
1472%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1473%
1474%  A description of each parameter follows:
1475%
1476%    o wand: the magick wand.
1477%
1478*/
1479WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1480{
1481  Image
1482    *coalesce_image;
1483
1484  assert(wand != (MagickWand *) NULL);
1485  assert(wand->signature == WandSignature);
1486  if (wand->debug != MagickFalse)
1487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1488  if (wand->images == (Image *) NULL)
1489    return((MagickWand *) NULL);
1490  coalesce_image=CoalesceImages(wand->images,wand->exception);
1491  if (coalesce_image == (Image *) NULL)
1492    return((MagickWand *) NULL);
1493  return(CloneMagickWandFromImages(wand,coalesce_image));
1494}
1495
1496/*
1497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1498%                                                                             %
1499%                                                                             %
1500%                                                                             %
1501%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1502%                                                                             %
1503%                                                                             %
1504%                                                                             %
1505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1506%
1507%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1508%  Collection (CCC) file which solely contains one or more color corrections
1509%  and applies the color correction to the image.  Here is a sample CCC file:
1510%
1511%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1512%          <ColorCorrection id="cc03345">
1513%                <SOPNode>
1514%                     <Slope> 0.9 1.2 0.5 </Slope>
1515%                     <Offset> 0.4 -0.5 0.6 </Offset>
1516%                     <Power> 1.0 0.8 1.5 </Power>
1517%                </SOPNode>
1518%                <SATNode>
1519%                     <Saturation> 0.85 </Saturation>
1520%                </SATNode>
1521%          </ColorCorrection>
1522%    </ColorCorrectionCollection>
1523%
1524%  which includes the offset, slope, and power for each of the RGB channels
1525%  as well as the saturation.
1526%
1527%  The format of the MagickColorDecisionListImage method is:
1528%
1529%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1530%        const double gamma)
1531%
1532%  A description of each parameter follows:
1533%
1534%    o wand: the magick wand.
1535%
1536%    o color_correction_collection: the color correction collection in XML.
1537%
1538*/
1539WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1540  const char *color_correction_collection)
1541{
1542  MagickBooleanType
1543    status;
1544
1545  assert(wand != (MagickWand *) NULL);
1546  assert(wand->signature == WandSignature);
1547  if (wand->debug != MagickFalse)
1548    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1549  if (wand->images == (Image *) NULL)
1550    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1551  status=ColorDecisionListImage(wand->images,color_correction_collection);
1552  if (status == MagickFalse)
1553    InheritException(wand->exception,&wand->images->exception);
1554  return(status);
1555}
1556
1557/*
1558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1559%                                                                             %
1560%                                                                             %
1561%                                                                             %
1562%   M a g i c k C o l o r i z e I m a g e                                     %
1563%                                                                             %
1564%                                                                             %
1565%                                                                             %
1566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1567%
1568%  MagickColorizeImage() blends the fill color with each pixel in the image.
1569%
1570%  The format of the MagickColorizeImage method is:
1571%
1572%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1573%        const PixelWand *colorize,const PixelWand *opacity)
1574%
1575%  A description of each parameter follows:
1576%
1577%    o wand: the magick wand.
1578%
1579%    o colorize: the colorize pixel wand.
1580%
1581%    o opacity: the opacity pixel wand.
1582%
1583*/
1584WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1585  const PixelWand *colorize,const PixelWand *opacity)
1586{
1587  char
1588    percent_opaque[MaxTextExtent];
1589
1590  Image
1591    *colorize_image;
1592
1593  PixelPacket
1594    target;
1595
1596  assert(wand != (MagickWand *) NULL);
1597  assert(wand->signature == WandSignature);
1598  if (wand->debug != MagickFalse)
1599    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1600  if (wand->images == (Image *) NULL)
1601    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1602  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1603    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1604    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1605    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1606    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1607    PixelGetOpacityQuantum(opacity)));
1608  PixelGetQuantumPacket(colorize,&target);
1609  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1610    wand->exception);
1611  if (colorize_image == (Image *) NULL)
1612    return(MagickFalse);
1613  ReplaceImageInList(&wand->images,colorize_image);
1614  return(MagickTrue);
1615}
1616
1617/*
1618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619%                                                                             %
1620%                                                                             %
1621%                                                                             %
1622%   M a g i c k C o l o r M a t r i x I m a g e                               %
1623%                                                                             %
1624%                                                                             %
1625%                                                                             %
1626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1627%
1628%  MagickColorMatrixImage() apply color transformation to an image. The method
1629%  permits saturation changes, hue rotation, luminance to alpha, and various
1630%  other effects.  Although variable-sized transformation matrices can be used,
1631%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1632%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1633%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1634%  and offsets are normalized (divide Flash offset by 255).
1635%
1636%  The format of the MagickColorMatrixImage method is:
1637%
1638%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1639%        const KernelInfo *color_matrix)
1640%
1641%  A description of each parameter follows:
1642%
1643%    o wand: the magick wand.
1644%
1645%    o color_matrix:  the color matrix.
1646%
1647*/
1648WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1649  const KernelInfo *color_matrix)
1650{
1651  Image
1652    *color_image;
1653
1654  assert(wand != (MagickWand *) NULL);
1655  assert(wand->signature == WandSignature);
1656  if (wand->debug != MagickFalse)
1657    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1658  if (color_matrix == (const KernelInfo *) NULL)
1659    return(MagickFalse);
1660  if (wand->images == (Image *) NULL)
1661    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1662  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1663  if (color_image == (Image *) NULL)
1664    return(MagickFalse);
1665  ReplaceImageInList(&wand->images,color_image);
1666  return(MagickTrue);
1667}
1668
1669/*
1670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1671%                                                                             %
1672%                                                                             %
1673%                                                                             %
1674%   M a g i c k C o m b i n e I m a g e s                                     %
1675%                                                                             %
1676%                                                                             %
1677%                                                                             %
1678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1679%
1680%  MagickCombineImages() combines one or more images into a single image.  The
1681%  grayscale value of the pixels of each image in the sequence is assigned in
1682%  order to the specified  hannels of the combined image.   The typical
1683%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1684%
1685%  The format of the MagickCombineImages method is:
1686%
1687%      MagickWand *MagickCombineImages(MagickWand *wand,
1688%        const ChannelType channel)
1689%
1690%  A description of each parameter follows:
1691%
1692%    o wand: the magick wand.
1693%
1694%    o channel: the channel.
1695%
1696*/
1697WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1698  const ChannelType channel)
1699{
1700  Image
1701    *combine_image;
1702
1703  assert(wand != (MagickWand *) NULL);
1704  assert(wand->signature == WandSignature);
1705  if (wand->debug != MagickFalse)
1706    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1707  if (wand->images == (Image *) NULL)
1708    return((MagickWand *) NULL);
1709  combine_image=CombineImages(wand->images,channel,wand->exception);
1710  if (combine_image == (Image *) NULL)
1711    return((MagickWand *) NULL);
1712  return(CloneMagickWandFromImages(wand,combine_image));
1713}
1714
1715/*
1716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1717%                                                                             %
1718%                                                                             %
1719%                                                                             %
1720%   M a g i c k C o m m e n t I m a g e                                       %
1721%                                                                             %
1722%                                                                             %
1723%                                                                             %
1724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1725%
1726%  MagickCommentImage() adds a comment to your image.
1727%
1728%  The format of the MagickCommentImage method is:
1729%
1730%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1731%        const char *comment)
1732%
1733%  A description of each parameter follows:
1734%
1735%    o wand: the magick wand.
1736%
1737%    o comment: the image comment.
1738%
1739*/
1740WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1741  const char *comment)
1742{
1743  MagickBooleanType
1744    status;
1745
1746  assert(wand != (MagickWand *) NULL);
1747  assert(wand->signature == WandSignature);
1748  if (wand->debug != MagickFalse)
1749    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1750  if (wand->images == (Image *) NULL)
1751    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1752  status=SetImageProperty(wand->images,"comment",comment);
1753  if (status == MagickFalse)
1754    InheritException(wand->exception,&wand->images->exception);
1755  return(status);
1756}
1757
1758/*
1759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1760%                                                                             %
1761%                                                                             %
1762%                                                                             %
1763%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1764%                                                                             %
1765%                                                                             %
1766%                                                                             %
1767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768%
1769%  MagickCompareImagesLayers() compares each image with the next in a sequence
1770%  and returns the maximum bounding region of any pixel differences it
1771%  discovers.
1772%
1773%  The format of the MagickCompareImagesLayers method is:
1774%
1775%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1776%        const ImageLayerMethod method)
1777%
1778%  A description of each parameter follows:
1779%
1780%    o wand: the magick wand.
1781%
1782%    o method: the compare method.
1783%
1784*/
1785WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1786  const ImageLayerMethod method)
1787{
1788  Image
1789    *layers_image;
1790
1791  assert(wand != (MagickWand *) NULL);
1792  assert(wand->signature == WandSignature);
1793  if (wand->debug != MagickFalse)
1794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1795  if (wand->images == (Image *) NULL)
1796    return((MagickWand *) NULL);
1797  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1798  if (layers_image == (Image *) NULL)
1799    return((MagickWand *) NULL);
1800  return(CloneMagickWandFromImages(wand,layers_image));
1801}
1802
1803/*
1804%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1805%                                                                             %
1806%                                                                             %
1807%                                                                             %
1808%   M a g i c k C o m p a r e I m a g e s                                     %
1809%                                                                             %
1810%                                                                             %
1811%                                                                             %
1812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1813%
1814%  MagickCompareImages() compares an image to a reconstructed image and returns
1815%  the specified difference image.
1816%
1817%  The format of the MagickCompareImages method is:
1818%
1819%      MagickWand *MagickCompareImages(MagickWand *wand,
1820%        const MagickWand *reference,const MetricType metric,
1821%        double *distortion)
1822%
1823%  A description of each parameter follows:
1824%
1825%    o wand: the magick wand.
1826%
1827%    o reference: the reference wand.
1828%
1829%    o metric: the metric.
1830%
1831%    o distortion: the computed distortion between the images.
1832%
1833*/
1834WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1835  const MagickWand *reference,const MetricType metric,double *distortion)
1836{
1837  Image
1838    *compare_image;
1839
1840
1841  assert(wand != (MagickWand *) NULL);
1842  assert(wand->signature == WandSignature);
1843  if (wand->debug != MagickFalse)
1844    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1845  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1846    {
1847      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1848        "ContainsNoImages","`%s'",wand->name);
1849      return((MagickWand *) NULL);
1850    }
1851  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1852    &wand->images->exception);
1853  if (compare_image == (Image *) NULL)
1854    return((MagickWand *) NULL);
1855  return(CloneMagickWandFromImages(wand,compare_image));
1856}
1857
1858/*
1859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1860%                                                                             %
1861%                                                                             %
1862%                                                                             %
1863%   M a g i c k C o m p o s i t e I m a g e                                   %
1864%                                                                             %
1865%                                                                             %
1866%                                                                             %
1867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1868%
1869%  MagickCompositeImage() composite one image onto another at the specified
1870%  offset.
1871%
1872%  The format of the MagickCompositeImage method is:
1873%
1874%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1875%        const MagickWand *composite_wand,const CompositeOperator compose,
1876%        const ssize_t x,const ssize_t y)
1877%
1878%  A description of each parameter follows:
1879%
1880%    o wand: the magick wand.
1881%
1882%    o composite_image: the composite image.
1883%
1884%    o compose: This operator affects how the composite is applied to the
1885%      image.  The default is Over.  Choose from these operators:
1886%
1887%        OverCompositeOp       InCompositeOp         OutCompositeOp
1888%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1889%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1890%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1891%        DisplaceCompositeOp
1892%
1893%    o x: the column offset of the composited image.
1894%
1895%    o y: the row offset of the composited image.
1896%
1897*/
1898WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1899  const MagickWand *composite_wand,const CompositeOperator compose,
1900  const ssize_t x,const ssize_t y)
1901{
1902  MagickBooleanType
1903    status;
1904
1905  assert(wand != (MagickWand *) NULL);
1906  assert(wand->signature == WandSignature);
1907  if (wand->debug != MagickFalse)
1908    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1909  if ((wand->images == (Image *) NULL) ||
1910      (composite_wand->images == (Image *) NULL))
1911    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1912  status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1913  if (status == MagickFalse)
1914    InheritException(wand->exception,&wand->images->exception);
1915  return(status);
1916}
1917
1918/*
1919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1920%                                                                             %
1921%                                                                             %
1922%                                                                             %
1923%   M a g i c k C o n t r a s t I m a g e                                     %
1924%                                                                             %
1925%                                                                             %
1926%                                                                             %
1927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1928%
1929%  MagickContrastImage() enhances the intensity differences between the lighter
1930%  and darker elements of the image.  Set sharpen to a value other than 0 to
1931%  increase the image contrast otherwise the contrast is reduced.
1932%
1933%  The format of the MagickContrastImage method is:
1934%
1935%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1936%        const MagickBooleanType sharpen)
1937%
1938%  A description of each parameter follows:
1939%
1940%    o wand: the magick wand.
1941%
1942%    o sharpen: Increase or decrease image contrast.
1943%
1944%
1945*/
1946WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1947  const MagickBooleanType sharpen)
1948{
1949  MagickBooleanType
1950    status;
1951
1952  assert(wand != (MagickWand *) NULL);
1953  assert(wand->signature == WandSignature);
1954  if (wand->debug != MagickFalse)
1955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1956  if (wand->images == (Image *) NULL)
1957    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1958  status=ContrastImage(wand->images,sharpen);
1959  if (status == MagickFalse)
1960    InheritException(wand->exception,&wand->images->exception);
1961  return(status);
1962}
1963
1964/*
1965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1966%                                                                             %
1967%                                                                             %
1968%                                                                             %
1969%   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                       %
1970%                                                                             %
1971%                                                                             %
1972%                                                                             %
1973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1974%
1975%  MagickContrastStretchImage() enhances the contrast of a color image by
1976%  adjusting the pixels color to span the entire range of colors available.
1977%  You can also reduce the influence of a particular channel with a gamma
1978%  value of 0.
1979%
1980%  The format of the MagickContrastStretchImage method is:
1981%
1982%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1983%        const double black_point,const double white_point)
1984%      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
1985%        const ChannelType channel,const double black_point,
1986%        const double white_point)
1987%
1988%  A description of each parameter follows:
1989%
1990%    o wand: the magick wand.
1991%
1992%    o channel: the image channel(s).
1993%
1994%    o black_point: the black point.
1995%
1996%    o white_point: the white point.
1997%
1998*/
1999
2000WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2001  const double black_point,const double white_point)
2002{
2003  MagickBooleanType
2004    status;
2005
2006  status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2007    white_point);
2008  return(status);
2009}
2010
2011WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2012  const ChannelType channel,const double black_point,const double white_point)
2013{
2014  MagickBooleanType
2015    status;
2016
2017  assert(wand != (MagickWand *) NULL);
2018  assert(wand->signature == WandSignature);
2019  if (wand->debug != MagickFalse)
2020    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2021  if (wand->images == (Image *) NULL)
2022    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2023  status=ContrastStretchImageChannel(wand->images,channel,black_point,
2024    white_point);
2025  if (status == MagickFalse)
2026    InheritException(wand->exception,&wand->images->exception);
2027  return(status);
2028}
2029
2030/*
2031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032%                                                                             %
2033%                                                                             %
2034%                                                                             %
2035%   M a g i c k C o n v o l v e I m a g e                                     %
2036%                                                                             %
2037%                                                                             %
2038%                                                                             %
2039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040%
2041%  MagickConvolveImage() applies a custom convolution kernel to the image.
2042%
2043%  The format of the MagickConvolveImage method is:
2044%
2045%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2046%        const size_t order,const double *kernel)
2047%      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2048%        const ChannelType channel,const size_t order,
2049%        const double *kernel)
2050%
2051%  A description of each parameter follows:
2052%
2053%    o wand: the magick wand.
2054%
2055%    o channel: the image channel(s).
2056%
2057%    o order: the number of columns and rows in the filter kernel.
2058%
2059%    o kernel: An array of doubles representing the convolution kernel.
2060%
2061*/
2062
2063WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2064  const size_t order,const double *kernel)
2065{
2066  MagickBooleanType
2067    status;
2068
2069  status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2070  return(status);
2071}
2072
2073WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2074  const ChannelType channel,const size_t order,const double *kernel)
2075{
2076  Image
2077    *convolve_image;
2078
2079  assert(wand != (MagickWand *) NULL);
2080  assert(wand->signature == WandSignature);
2081  if (wand->debug != MagickFalse)
2082    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2083  if (kernel == (const double *) NULL)
2084    return(MagickFalse);
2085  if (wand->images == (Image *) NULL)
2086    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2087  convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2088    wand->exception);
2089  if (convolve_image == (Image *) NULL)
2090    return(MagickFalse);
2091  ReplaceImageInList(&wand->images,convolve_image);
2092  return(MagickTrue);
2093}
2094
2095/*
2096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2097%                                                                             %
2098%                                                                             %
2099%                                                                             %
2100%   M a g i c k C r o p I m a g e                                             %
2101%                                                                             %
2102%                                                                             %
2103%                                                                             %
2104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2105%
2106%  MagickCropImage() extracts a region of the image.
2107%
2108%  The format of the MagickCropImage method is:
2109%
2110%      MagickBooleanType MagickCropImage(MagickWand *wand,
2111%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2112%
2113%  A description of each parameter follows:
2114%
2115%    o wand: the magick wand.
2116%
2117%    o width: the region width.
2118%
2119%    o height: the region height.
2120%
2121%    o x: the region x-offset.
2122%
2123%    o y: the region y-offset.
2124%
2125*/
2126WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2127  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2128{
2129  Image
2130    *crop_image;
2131
2132  RectangleInfo
2133    crop;
2134
2135  assert(wand != (MagickWand *) NULL);
2136  assert(wand->signature == WandSignature);
2137  if (wand->debug != MagickFalse)
2138    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2139  if (wand->images == (Image *) NULL)
2140    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2141  crop.width=width;
2142  crop.height=height;
2143  crop.x=x;
2144  crop.y=y;
2145  crop_image=CropImage(wand->images,&crop,wand->exception);
2146  if (crop_image == (Image *) NULL)
2147    return(MagickFalse);
2148  ReplaceImageInList(&wand->images,crop_image);
2149  return(MagickTrue);
2150}
2151
2152/*
2153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2154%                                                                             %
2155%                                                                             %
2156%                                                                             %
2157%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2158%                                                                             %
2159%                                                                             %
2160%                                                                             %
2161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2162%
2163%  MagickCycleColormapImage() displaces an image's colormap by a given number
2164%  of positions.  If you cycle the colormap a number of times you can produce
2165%  a psychodelic effect.
2166%
2167%  The format of the MagickCycleColormapImage method is:
2168%
2169%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2170%        const ssize_t displace)
2171%
2172%  A description of each parameter follows:
2173%
2174%    o wand: the magick wand.
2175%
2176%    o pixel_wand: the pixel wand.
2177%
2178*/
2179WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2180  const ssize_t displace)
2181{
2182  MagickBooleanType
2183    status;
2184
2185  assert(wand != (MagickWand *) NULL);
2186  assert(wand->signature == WandSignature);
2187  if (wand->debug != MagickFalse)
2188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2189  if (wand->images == (Image *) NULL)
2190    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2191  status=CycleColormapImage(wand->images,displace);
2192  if (status == MagickFalse)
2193    InheritException(wand->exception,&wand->images->exception);
2194  return(status);
2195}
2196
2197/*
2198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199%                                                                             %
2200%                                                                             %
2201%                                                                             %
2202%   M a g i c k C o n s t i t u t e I m a g e                                 %
2203%                                                                             %
2204%                                                                             %
2205%                                                                             %
2206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2207%
2208%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2209%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2210%  The data can be char, short int, int, float, or double.  Float and double
2211%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2212%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2213%  example, to create a 640x480 image from unsigned red-green-blue character
2214%  data, use
2215%
2216%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2217%
2218%  The format of the MagickConstituteImage method is:
2219%
2220%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2221%        const size_t columns,const size_t rows,const char *map,
2222%        const StorageType storage,void *pixels)
2223%
2224%  A description of each parameter follows:
2225%
2226%    o wand: the magick wand.
2227%
2228%    o columns: width in pixels of the image.
2229%
2230%    o rows: height in pixels of the image.
2231%
2232%    o map:  This string reflects the expected ordering of the pixel array.
2233%      It can be any combination or order of R = red, G = green, B = blue,
2234%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2235%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2236%      P = pad.
2237%
2238%    o storage: Define the data type of the pixels.  Float and double types are
2239%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2240%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2241%      LongPixel, QuantumPixel, or ShortPixel.
2242%
2243%    o pixels: This array of values contain the pixel components as defined by
2244%      map and type.  You must preallocate this array where the expected
2245%      length varies depending on the values of width, height, map, and type.
2246%
2247%
2248*/
2249WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2250  const size_t columns,const size_t rows,const char *map,
2251  const StorageType storage,const void *pixels)
2252{
2253  Image
2254    *images;
2255
2256  assert(wand != (MagickWand *) NULL);
2257  assert(wand->signature == WandSignature);
2258  if (wand->debug != MagickFalse)
2259    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2260  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2261  if (images == (Image *) NULL)
2262    return(MagickFalse);
2263  return(InsertImageInWand(wand,images));
2264}
2265
2266/*
2267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2268%                                                                             %
2269%                                                                             %
2270%                                                                             %
2271%   M a g i c k D e c i p h e r I m a g e                                     %
2272%                                                                             %
2273%                                                                             %
2274%                                                                             %
2275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2276%
2277%  MagickDecipherImage() converts cipher pixels to plain pixels.
2278%
2279%  The format of the MagickDecipherImage method is:
2280%
2281%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2282%        const char *passphrase)
2283%
2284%  A description of each parameter follows:
2285%
2286%    o wand: the magick wand.
2287%
2288%    o passphrase: the passphrase.
2289%
2290*/
2291WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2292  const char *passphrase)
2293{
2294  assert(wand != (MagickWand *) NULL);
2295  assert(wand->signature == WandSignature);
2296  if (wand->debug != MagickFalse)
2297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2298  if (wand->images == (Image *) NULL)
2299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2300  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2301}
2302
2303/*
2304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2305%                                                                             %
2306%                                                                             %
2307%                                                                             %
2308%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2309%                                                                             %
2310%                                                                             %
2311%                                                                             %
2312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2313%
2314%  MagickDeconstructImages() compares each image with the next in a sequence
2315%  and returns the maximum bounding region of any pixel differences it
2316%  discovers.
2317%
2318%  The format of the MagickDeconstructImages method is:
2319%
2320%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2321%
2322%  A description of each parameter follows:
2323%
2324%    o wand: the magick wand.
2325%
2326*/
2327WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2328{
2329  Image
2330    *deconstruct_image;
2331
2332  assert(wand != (MagickWand *) NULL);
2333  assert(wand->signature == WandSignature);
2334  if (wand->debug != MagickFalse)
2335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2336  if (wand->images == (Image *) NULL)
2337    return((MagickWand *) NULL);
2338  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2339    wand->exception);
2340  if (deconstruct_image == (Image *) NULL)
2341    return((MagickWand *) NULL);
2342  return(CloneMagickWandFromImages(wand,deconstruct_image));
2343}
2344
2345/*
2346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2347%                                                                             %
2348%                                                                             %
2349%                                                                             %
2350%     M a g i c k D e s k e w I m a g e                                       %
2351%                                                                             %
2352%                                                                             %
2353%                                                                             %
2354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2355%
2356%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2357%  occurs in scanned images because of the camera being misaligned,
2358%  imperfections in the scanning or surface, or simply because the paper was
2359%  not placed completely flat when scanned.
2360%
2361%  The format of the MagickDeskewImage method is:
2362%
2363%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2364%        const double threshold)
2365%
2366%  A description of each parameter follows:
2367%
2368%    o wand: the magick wand.
2369%
2370%    o threshold: separate background from foreground.
2371%
2372*/
2373WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2374  const double threshold)
2375{
2376  Image
2377    *sepia_image;
2378
2379  assert(wand != (MagickWand *) NULL);
2380  assert(wand->signature == WandSignature);
2381  if (wand->debug != MagickFalse)
2382    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2383  if (wand->images == (Image *) NULL)
2384    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2385  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2386  if (sepia_image == (Image *) NULL)
2387    return(MagickFalse);
2388  ReplaceImageInList(&wand->images,sepia_image);
2389  return(MagickTrue);
2390}
2391
2392/*
2393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2394%                                                                             %
2395%                                                                             %
2396%                                                                             %
2397%     M a g i c k D e s p e c k l e I m a g e                                 %
2398%                                                                             %
2399%                                                                             %
2400%                                                                             %
2401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2402%
2403%  MagickDespeckleImage() reduces the speckle noise in an image while
2404%  perserving the edges of the original image.
2405%
2406%  The format of the MagickDespeckleImage method is:
2407%
2408%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2409%
2410%  A description of each parameter follows:
2411%
2412%    o wand: the magick wand.
2413%
2414*/
2415WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2416{
2417  Image
2418    *despeckle_image;
2419
2420  assert(wand != (MagickWand *) NULL);
2421  assert(wand->signature == WandSignature);
2422  if (wand->debug != MagickFalse)
2423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2424  if (wand->images == (Image *) NULL)
2425    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2426  despeckle_image=DespeckleImage(wand->images,wand->exception);
2427  if (despeckle_image == (Image *) NULL)
2428    return(MagickFalse);
2429  ReplaceImageInList(&wand->images,despeckle_image);
2430  return(MagickTrue);
2431}
2432
2433/*
2434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2435%                                                                             %
2436%                                                                             %
2437%                                                                             %
2438%   M a g i c k D e s t r o y I m a g e                                       %
2439%                                                                             %
2440%                                                                             %
2441%                                                                             %
2442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2443%
2444%  MagickDestroyImage() dereferences an image, deallocating memory associated
2445%  with the image if the reference count becomes zero.
2446%
2447%  The format of the MagickDestroyImage method is:
2448%
2449%      Image *MagickDestroyImage(Image *image)
2450%
2451%  A description of each parameter follows:
2452%
2453%    o image: the image.
2454%
2455*/
2456WandExport Image *MagickDestroyImage(Image *image)
2457{
2458  return(DestroyImage(image));
2459}
2460
2461/*
2462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2463%                                                                             %
2464%                                                                             %
2465%                                                                             %
2466%   M a g i c k D i s p l a y I m a g e                                       %
2467%                                                                             %
2468%                                                                             %
2469%                                                                             %
2470%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2471%
2472%  MagickDisplayImage() displays an image.
2473%
2474%  The format of the MagickDisplayImage method is:
2475%
2476%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2477%        const char *server_name)
2478%
2479%  A description of each parameter follows:
2480%
2481%    o wand: the magick wand.
2482%
2483%    o server_name: the X server name.
2484%
2485*/
2486WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2487  const char *server_name)
2488{
2489  Image
2490    *image;
2491
2492  MagickBooleanType
2493    status;
2494
2495  assert(wand != (MagickWand *) NULL);
2496  assert(wand->signature == WandSignature);
2497  if (wand->debug != MagickFalse)
2498    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2499  if (wand->images == (Image *) NULL)
2500    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2501  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2502  if (image == (Image *) NULL)
2503    return(MagickFalse);
2504  (void) CloneString(&wand->image_info->server_name,server_name);
2505  status=DisplayImages(wand->image_info,image);
2506  if (status == MagickFalse)
2507    InheritException(wand->exception,&image->exception);
2508  image=DestroyImage(image);
2509  return(status);
2510}
2511
2512/*
2513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514%                                                                             %
2515%                                                                             %
2516%                                                                             %
2517%   M a g i c k D i s p l a y I m a g e s                                     %
2518%                                                                             %
2519%                                                                             %
2520%                                                                             %
2521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522%
2523%  MagickDisplayImages() displays an image or image sequence.
2524%
2525%  The format of the MagickDisplayImages method is:
2526%
2527%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2528%        const char *server_name)
2529%
2530%  A description of each parameter follows:
2531%
2532%    o wand: the magick wand.
2533%
2534%    o server_name: the X server name.
2535%
2536*/
2537WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2538  const char *server_name)
2539{
2540  MagickBooleanType
2541    status;
2542
2543  assert(wand != (MagickWand *) NULL);
2544  assert(wand->signature == WandSignature);
2545  if (wand->debug != MagickFalse)
2546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2547  (void) CloneString(&wand->image_info->server_name,server_name);
2548  status=DisplayImages(wand->image_info,wand->images);
2549  if (status == MagickFalse)
2550    InheritException(wand->exception,&wand->images->exception);
2551  return(status);
2552}
2553
2554/*
2555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2556%                                                                             %
2557%                                                                             %
2558%                                                                             %
2559%   M a g i c k D i s t o r t I m a g e                                       %
2560%                                                                             %
2561%                                                                             %
2562%                                                                             %
2563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2564%
2565%  MagickDistortImage() distorts an image using various distortion methods, by
2566%  mapping color lookups of the source image to a new destination image
2567%  usally of the same size as the source image, unless 'bestfit' is set to
2568%  true.
2569%
2570%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2571%  adjusted to ensure the whole source 'image' will just fit within the final
2572%  destination image, which will be sized and offset accordingly.  Also in
2573%  many cases the virtual offset of the source image will be taken into
2574%  account in the mapping.
2575%
2576%  The format of the MagickDistortImage method is:
2577%
2578%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2579%        const DistortImageMethod method,const size_t number_arguments,
2580%        const double *arguments,const MagickBooleanType bestfit)
2581%
2582%  A description of each parameter follows:
2583%
2584%    o image: the image to be distorted.
2585%
2586%    o method: the method of image distortion.
2587%
2588%        ArcDistortion always ignores the source image offset, and always
2589%        'bestfit' the destination image with the top left corner offset
2590%        relative to the polar mapping center.
2591%
2592%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2593%        style of image distortion.
2594%
2595%        Affine, Perspective, and Bilinear, do least squares fitting of the
2596%        distortion when more than the minimum number of control point pairs
2597%        are provided.
2598%
2599%        Perspective, and Bilinear, falls back to a Affine distortion when less
2600%        that 4 control point pairs are provided. While Affine distortions let
2601%        you use any number of control point pairs, that is Zero pairs is a
2602%        no-Op (viewport only) distrotion, one pair is a translation and two
2603%        pairs of control points do a scale-rotate-translate, without any
2604%        shearing.
2605%
2606%    o number_arguments: the number of arguments given for this distortion
2607%      method.
2608%
2609%    o arguments: the arguments for this distortion method.
2610%
2611%    o bestfit: Attempt to resize destination to fit distorted source.
2612%
2613*/
2614WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2615  const DistortImageMethod method,const size_t number_arguments,
2616  const double *arguments,const MagickBooleanType bestfit)
2617{
2618  Image
2619    *distort_image;
2620
2621  assert(wand != (MagickWand *) NULL);
2622  assert(wand->signature == WandSignature);
2623  if (wand->debug != MagickFalse)
2624    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2625  if (wand->images == (Image *) NULL)
2626    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2627  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2628    bestfit,wand->exception);
2629  if (distort_image == (Image *) NULL)
2630    return(MagickFalse);
2631  ReplaceImageInList(&wand->images,distort_image);
2632  return(MagickTrue);
2633}
2634
2635/*
2636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2637%                                                                             %
2638%                                                                             %
2639%                                                                             %
2640%   M a g i c k D r a w I m a g e                                             %
2641%                                                                             %
2642%                                                                             %
2643%                                                                             %
2644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2645%
2646%  MagickDrawImage() renders the drawing wand on the current image.
2647%
2648%  The format of the MagickDrawImage method is:
2649%
2650%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2651%        const DrawingWand *drawing_wand)
2652%
2653%  A description of each parameter follows:
2654%
2655%    o wand: the magick wand.
2656%
2657%    o drawing_wand: the draw wand.
2658%
2659*/
2660WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2661  const DrawingWand *drawing_wand)
2662{
2663  char
2664    *primitive;
2665
2666  DrawInfo
2667    *draw_info;
2668
2669  MagickBooleanType
2670    status;
2671
2672  assert(wand != (MagickWand *) NULL);
2673  assert(wand->signature == WandSignature);
2674  if (wand->debug != MagickFalse)
2675    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2676  if (wand->images == (Image *) NULL)
2677    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2678  draw_info=PeekDrawingWand(drawing_wand);
2679  if ((draw_info == (DrawInfo *) NULL) ||
2680      (draw_info->primitive == (char *) NULL))
2681    return(MagickFalse);
2682  primitive=AcquireString(draw_info->primitive);
2683  draw_info=DestroyDrawInfo(draw_info);
2684  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2685  draw_info->primitive=primitive;
2686  status=DrawImage(wand->images,draw_info);
2687  if (status == MagickFalse)
2688    InheritException(wand->exception,&wand->images->exception);
2689  draw_info=DestroyDrawInfo(draw_info);
2690  return(status);
2691}
2692
2693/*
2694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2695%                                                                             %
2696%                                                                             %
2697%                                                                             %
2698%   M a g i c k E d g e I m a g e                                             %
2699%                                                                             %
2700%                                                                             %
2701%                                                                             %
2702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703%
2704%  MagickEdgeImage() enhance edges within the image with a convolution filter
2705%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2706%  radius for you.
2707%
2708%  The format of the MagickEdgeImage method is:
2709%
2710%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2711%
2712%  A description of each parameter follows:
2713%
2714%    o wand: the magick wand.
2715%
2716%    o radius: the radius of the pixel neighborhood.
2717%
2718*/
2719WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2720  const double radius)
2721{
2722  Image
2723    *edge_image;
2724
2725  assert(wand != (MagickWand *) NULL);
2726  assert(wand->signature == WandSignature);
2727  if (wand->debug != MagickFalse)
2728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2729  if (wand->images == (Image *) NULL)
2730    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2731  edge_image=EdgeImage(wand->images,radius,wand->exception);
2732  if (edge_image == (Image *) NULL)
2733    return(MagickFalse);
2734  ReplaceImageInList(&wand->images,edge_image);
2735  return(MagickTrue);
2736}
2737
2738/*
2739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2740%                                                                             %
2741%                                                                             %
2742%                                                                             %
2743%   M a g i c k E m b o s s I m a g e                                         %
2744%                                                                             %
2745%                                                                             %
2746%                                                                             %
2747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2748%
2749%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2750%  effect.  We convolve the image with a Gaussian operator of the given radius
2751%  and standard deviation (sigma).  For reasonable results, radius should be
2752%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2753%  radius for you.
2754%
2755%  The format of the MagickEmbossImage method is:
2756%
2757%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2758%        const double sigma)
2759%
2760%  A description of each parameter follows:
2761%
2762%    o wand: the magick wand.
2763%
2764%    o radius: the radius of the Gaussian, in pixels, not counting the center
2765%      pixel.
2766%
2767%    o sigma: the standard deviation of the Gaussian, in pixels.
2768%
2769*/
2770WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2771  const double radius,const double sigma)
2772{
2773  Image
2774    *emboss_image;
2775
2776  assert(wand != (MagickWand *) NULL);
2777  assert(wand->signature == WandSignature);
2778  if (wand->debug != MagickFalse)
2779    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2780  if (wand->images == (Image *) NULL)
2781    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2782  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2783  if (emboss_image == (Image *) NULL)
2784    return(MagickFalse);
2785  ReplaceImageInList(&wand->images,emboss_image);
2786  return(MagickTrue);
2787}
2788
2789/*
2790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2791%                                                                             %
2792%                                                                             %
2793%                                                                             %
2794%   M a g i c k E n c i p h e r I m a g e                                     %
2795%                                                                             %
2796%                                                                             %
2797%                                                                             %
2798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2799%
2800%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2801%
2802%  The format of the MagickEncipherImage method is:
2803%
2804%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2805%        const char *passphrase)
2806%
2807%  A description of each parameter follows:
2808%
2809%    o wand: the magick wand.
2810%
2811%    o passphrase: the passphrase.
2812%
2813*/
2814WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2815  const char *passphrase)
2816{
2817  assert(wand != (MagickWand *) NULL);
2818  assert(wand->signature == WandSignature);
2819  if (wand->debug != MagickFalse)
2820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2821  if (wand->images == (Image *) NULL)
2822    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2823  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2824}
2825
2826/*
2827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2828%                                                                             %
2829%                                                                             %
2830%                                                                             %
2831%   M a g i c k E n h a n c e I m a g e                                       %
2832%                                                                             %
2833%                                                                             %
2834%                                                                             %
2835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2836%
2837%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2838%  noisy image.
2839%
2840%  The format of the MagickEnhanceImage method is:
2841%
2842%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2843%
2844%  A description of each parameter follows:
2845%
2846%    o wand: the magick wand.
2847%
2848*/
2849WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2850{
2851  Image
2852    *enhance_image;
2853
2854  assert(wand != (MagickWand *) NULL);
2855  assert(wand->signature == WandSignature);
2856  if (wand->debug != MagickFalse)
2857    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2858  if (wand->images == (Image *) NULL)
2859    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2860  enhance_image=EnhanceImage(wand->images,wand->exception);
2861  if (enhance_image == (Image *) NULL)
2862    return(MagickFalse);
2863  ReplaceImageInList(&wand->images,enhance_image);
2864  return(MagickTrue);
2865}
2866
2867/*
2868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2869%                                                                             %
2870%                                                                             %
2871%                                                                             %
2872%   M a g i c k E q u a l i z e I m a g e                                     %
2873%                                                                             %
2874%                                                                             %
2875%                                                                             %
2876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2877%
2878%  MagickEqualizeImage() equalizes the image histogram.
2879%
2880%  The format of the MagickEqualizeImage method is:
2881%
2882%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2883%      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2884%        const ChannelType channel)
2885%
2886%  A description of each parameter follows:
2887%
2888%    o wand: the magick wand.
2889%
2890%    o channel: the image channel(s).
2891%
2892*/
2893
2894WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2895{
2896  MagickBooleanType
2897    status;
2898
2899  status=MagickEqualizeImageChannel(wand,DefaultChannels);
2900  return(status);
2901}
2902
2903WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2904  const ChannelType channel)
2905{
2906  MagickBooleanType
2907    status;
2908
2909  assert(wand != (MagickWand *) NULL);
2910  assert(wand->signature == WandSignature);
2911  if (wand->debug != MagickFalse)
2912    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2913  if (wand->images == (Image *) NULL)
2914    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2915  status=EqualizeImageChannel(wand->images,channel);
2916  if (status == MagickFalse)
2917    InheritException(wand->exception,&wand->images->exception);
2918  return(status);
2919}
2920
2921/*
2922%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2923%                                                                             %
2924%                                                                             %
2925%                                                                             %
2926%   M a g i c k E v a l u a t e I m a g e                                     %
2927%                                                                             %
2928%                                                                             %
2929%                                                                             %
2930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2931%
2932%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2933%  expression to an image.  Use these operators to lighten or darken an image,
2934%  to increase or decrease contrast in an image, or to produce the "negative"
2935%  of an image.
2936%
2937%  The format of the MagickEvaluateImage method is:
2938%
2939%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2940%        const MagickEvaluateOperator operator,const double value)
2941%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2942%        const MagickEvaluateOperator operator)
2943%      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2944%        const ChannelType channel,const MagickEvaluateOperator op,
2945%        const double value)
2946%
2947%  A description of each parameter follows:
2948%
2949%    o wand: the magick wand.
2950%
2951%    o channel: the channel(s).
2952%
2953%    o op: A channel operator.
2954%
2955%    o value: A value value.
2956%
2957*/
2958
2959WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2960  const MagickEvaluateOperator op,const double value)
2961{
2962  MagickBooleanType
2963    status;
2964
2965  assert(wand != (MagickWand *) NULL);
2966  assert(wand->signature == WandSignature);
2967  if (wand->debug != MagickFalse)
2968    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2969  if (wand->images == (Image *) NULL)
2970    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2971  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2972  if (status == MagickFalse)
2973    InheritException(wand->exception,&wand->images->exception);
2974  return(status);
2975}
2976
2977WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2978  const MagickEvaluateOperator op)
2979{
2980  Image
2981    *evaluate_image;
2982
2983  assert(wand != (MagickWand *) NULL);
2984  assert(wand->signature == WandSignature);
2985  if (wand->debug != MagickFalse)
2986    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2987  if (wand->images == (Image *) NULL)
2988    return((MagickWand *) NULL);
2989  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2990  if (evaluate_image == (Image *) NULL)
2991    return((MagickWand *) NULL);
2992  return(CloneMagickWandFromImages(wand,evaluate_image));
2993}
2994
2995WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2996  const ChannelType channel,const MagickEvaluateOperator op,const double value)
2997{
2998  MagickBooleanType
2999    status;
3000
3001  assert(wand != (MagickWand *) NULL);
3002  assert(wand->signature == WandSignature);
3003  if (wand->debug != MagickFalse)
3004    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3005  if (wand->images == (Image *) NULL)
3006    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3007  status=EvaluateImageChannel(wand->images,channel,op,value,
3008    &wand->images->exception);
3009  return(status);
3010}
3011
3012/*
3013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3014%                                                                             %
3015%                                                                             %
3016%                                                                             %
3017%   M a g i c k E x p o r t I m a g e P i x e l s                             %
3018%                                                                             %
3019%                                                                             %
3020%                                                                             %
3021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3022%
3023%  MagickExportImagePixels() extracts pixel data from an image and returns it
3024%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3025%  an error is encountered.  The data is returned as char, short int, int,
3026%  ssize_t, float, or double in the order specified by map.
3027%
3028%  Suppose you want to extract the first scanline of a 640x480 image as
3029%  character data in red-green-blue order:
3030%
3031%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3032%
3033%  The format of the MagickExportImagePixels method is:
3034%
3035%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3036%        const ssize_t x,const ssize_t y,const size_t columns,
3037%        const size_t rows,const char *map,const StorageType storage,
3038%        void *pixels)
3039%
3040%  A description of each parameter follows:
3041%
3042%    o wand: the magick wand.
3043%
3044%    o x, y, columns, rows:  These values define the perimeter
3045%      of a region of pixels you want to extract.
3046%
3047%    o map:  This string reflects the expected ordering of the pixel array.
3048%      It can be any combination or order of R = red, G = green, B = blue,
3049%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3050%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3051%      P = pad.
3052%
3053%    o storage: Define the data type of the pixels.  Float and double types are
3054%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3055%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3056%      LongPixel, QuantumPixel, or ShortPixel.
3057%
3058%    o pixels: This array of values contain the pixel components as defined by
3059%      map and type.  You must preallocate this array where the expected
3060%      length varies depending on the values of width, height, map, and type.
3061%
3062*/
3063WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3064  const ssize_t x,const ssize_t y,const size_t columns,
3065  const size_t rows,const char *map,const StorageType storage,
3066  void *pixels)
3067{
3068  MagickBooleanType
3069    status;
3070
3071  assert(wand != (MagickWand *) NULL);
3072  assert(wand->signature == WandSignature);
3073  if (wand->debug != MagickFalse)
3074    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3075  if (wand->images == (Image *) NULL)
3076    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3077  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3078    storage,pixels,wand->exception);
3079  if (status == MagickFalse)
3080    InheritException(wand->exception,&wand->images->exception);
3081  return(status);
3082}
3083
3084/*
3085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3086%                                                                             %
3087%                                                                             %
3088%                                                                             %
3089%   M a g i c k E x t e n t I m a g e                                         %
3090%                                                                             %
3091%                                                                             %
3092%                                                                             %
3093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3094%
3095%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3096%  and wand background color.  Set the (x,y) offset of the geometry to move
3097%  the original wand relative to the extended wand.
3098%
3099%  The format of the MagickExtentImage method is:
3100%
3101%      MagickBooleanType MagickExtentImage(MagickWand *wand,
3102%        const size_t width,const size_t height,const ssize_t x,
3103%        const ssize_t y)
3104%
3105%  A description of each parameter follows:
3106%
3107%    o wand: the magick wand.
3108%
3109%    o width: the region width.
3110%
3111%    o height: the region height.
3112%
3113%    o x: the region x offset.
3114%
3115%    o y: the region y offset.
3116%
3117*/
3118WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3119  const size_t width,const size_t height,const ssize_t x,
3120  const ssize_t y)
3121{
3122  Image
3123    *extent_image;
3124
3125  RectangleInfo
3126    extent;
3127
3128  assert(wand != (MagickWand *) NULL);
3129  assert(wand->signature == WandSignature);
3130  if (wand->debug != MagickFalse)
3131    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3132  if (wand->images == (Image *) NULL)
3133    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3134  extent.width=width;
3135  extent.height=height;
3136  extent.x=x;
3137  extent.y=y;
3138  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3139  if (extent_image == (Image *) NULL)
3140    return(MagickFalse);
3141  ReplaceImageInList(&wand->images,extent_image);
3142  return(MagickTrue);
3143}
3144
3145/*
3146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3147%                                                                             %
3148%                                                                             %
3149%                                                                             %
3150%   M a g i c k F i l t e r I m a g e                                         %
3151%                                                                             %
3152%                                                                             %
3153%                                                                             %
3154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3155%
3156%  MagickFilterImage() applies a custom convolution kernel to the image.
3157%
3158%  The format of the MagickFilterImage method is:
3159%
3160%      MagickBooleanType MagickFilterImage(MagickWand *wand,
3161%        const KernelInfo *kernel)
3162%      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3163%        const ChannelType channel,const KernelInfo *kernel)
3164%
3165%  A description of each parameter follows:
3166%
3167%    o wand: the magick wand.
3168%
3169%    o channel: the image channel(s).
3170%
3171%    o kernel: An array of doubles representing the convolution kernel.
3172%
3173*/
3174
3175WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3176  const KernelInfo *kernel)
3177{
3178  MagickBooleanType
3179    status;
3180
3181  status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3182  return(status);
3183}
3184
3185WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3186  const ChannelType channel,const KernelInfo *kernel)
3187{
3188  Image
3189    *filter_image;
3190
3191  assert(wand != (MagickWand *) NULL);
3192  assert(wand->signature == WandSignature);
3193  if (wand->debug != MagickFalse)
3194    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3195  if (kernel == (const KernelInfo *) NULL)
3196    return(MagickFalse);
3197  if (wand->images == (Image *) NULL)
3198    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3199  filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3200  if (filter_image == (Image *) NULL)
3201    return(MagickFalse);
3202  ReplaceImageInList(&wand->images,filter_image);
3203  return(MagickTrue);
3204}
3205
3206/*
3207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3208%                                                                             %
3209%                                                                             %
3210%                                                                             %
3211%   M a g i c k F l i p I m a g e                                             %
3212%                                                                             %
3213%                                                                             %
3214%                                                                             %
3215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216%
3217%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3218%  around the central x-axis.
3219%
3220%  The format of the MagickFlipImage method is:
3221%
3222%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3223%
3224%  A description of each parameter follows:
3225%
3226%    o wand: the magick wand.
3227%
3228*/
3229WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3230{
3231  Image
3232    *flip_image;
3233
3234  assert(wand != (MagickWand *) NULL);
3235  assert(wand->signature == WandSignature);
3236  if (wand->debug != MagickFalse)
3237    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3238  if (wand->images == (Image *) NULL)
3239    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3240  flip_image=FlipImage(wand->images,wand->exception);
3241  if (flip_image == (Image *) NULL)
3242    return(MagickFalse);
3243  ReplaceImageInList(&wand->images,flip_image);
3244  return(MagickTrue);
3245}
3246
3247/*
3248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3249%                                                                             %
3250%                                                                             %
3251%                                                                             %
3252%   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                         %
3253%                                                                             %
3254%                                                                             %
3255%                                                                             %
3256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3257%
3258%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3259%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3260%  specified, the color value is changed for any neighbor pixel that does not
3261%  match the bordercolor member of image.
3262%
3263%  The format of the MagickFloodfillPaintImage method is:
3264%
3265%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3266%        const ChannelType channel,const PixelWand *fill,const double fuzz,
3267%        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3268%        const MagickBooleanType invert)
3269%
3270%  A description of each parameter follows:
3271%
3272%    o wand: the magick wand.
3273%
3274%    o channel: the channel(s).
3275%
3276%    o fill: the floodfill color pixel wand.
3277%
3278%    o fuzz: By default target must match a particular pixel color
3279%      exactly.  However, in many cases two colors may differ by a small amount.
3280%      The fuzz member of image defines how much tolerance is acceptable to
3281%      consider two colors as the same.  For example, set fuzz to 10 and the
3282%      color red at intensities of 100 and 102 respectively are now interpreted
3283%      as the same color for the purposes of the floodfill.
3284%
3285%    o bordercolor: the border color pixel wand.
3286%
3287%    o x,y: the starting location of the operation.
3288%
3289%    o invert: paint any pixel that does not match the target color.
3290%
3291*/
3292WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3293  const ChannelType channel,const PixelWand *fill,const double fuzz,
3294  const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3295  const MagickBooleanType invert)
3296{
3297  DrawInfo
3298    *draw_info;
3299
3300  MagickBooleanType
3301    status;
3302
3303  PixelInfo
3304    target;
3305
3306  assert(wand != (MagickWand *) NULL);
3307  assert(wand->signature == WandSignature);
3308  if (wand->debug != MagickFalse)
3309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3310  if (wand->images == (Image *) NULL)
3311    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3312  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3313  PixelGetQuantumPacket(fill,&draw_info->fill);
3314  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3315    y % wand->images->rows,&target,wand->exception);
3316  if (bordercolor != (PixelWand *) NULL)
3317    PixelGetMagickColor(bordercolor,&target);
3318  wand->images->fuzz=fuzz;
3319  status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3320    invert);
3321  if (status == MagickFalse)
3322    InheritException(wand->exception,&wand->images->exception);
3323  draw_info=DestroyDrawInfo(draw_info);
3324  return(status);
3325}
3326
3327/*
3328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3329%                                                                             %
3330%                                                                             %
3331%                                                                             %
3332%   M a g i c k F l o p I m a g e                                             %
3333%                                                                             %
3334%                                                                             %
3335%                                                                             %
3336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3337%
3338%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3339%  around the central y-axis.
3340%
3341%  The format of the MagickFlopImage method is:
3342%
3343%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3344%
3345%  A description of each parameter follows:
3346%
3347%    o wand: the magick wand.
3348%
3349*/
3350WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3351{
3352  Image
3353    *flop_image;
3354
3355  assert(wand != (MagickWand *) NULL);
3356  assert(wand->signature == WandSignature);
3357  if (wand->debug != MagickFalse)
3358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3359  if (wand->images == (Image *) NULL)
3360    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3361  flop_image=FlopImage(wand->images,wand->exception);
3362  if (flop_image == (Image *) NULL)
3363    return(MagickFalse);
3364  ReplaceImageInList(&wand->images,flop_image);
3365  return(MagickTrue);
3366}
3367
3368/*
3369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3370%                                                                             %
3371%                                                                             %
3372%                                                                             %
3373%   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                     %
3374%                                                                             %
3375%                                                                             %
3376%                                                                             %
3377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3378%
3379%  MagickForwardFourierTransformImage() implements the discrete Fourier
3380%  transform (DFT) of the image either as a magnitude / phase or real /
3381%  imaginary image pair.
3382%
3383%  The format of the MagickForwardFourierTransformImage method is:
3384%
3385%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3386%        const MagickBooleanType magnitude)
3387%
3388%  A description of each parameter follows:
3389%
3390%    o wand: the magick wand.
3391%
3392%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3393%      imaginary image pair.
3394%
3395*/
3396WandExport MagickBooleanType MagickForwardFourierTransformImage(
3397  MagickWand *wand,const MagickBooleanType magnitude)
3398{
3399  Image
3400    *forward_image;
3401
3402  assert(wand != (MagickWand *) NULL);
3403  assert(wand->signature == WandSignature);
3404  if (wand->debug != MagickFalse)
3405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3406  if (wand->images == (Image *) NULL)
3407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3408  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3409    wand->exception);
3410  if (forward_image == (Image *) NULL)
3411    return(MagickFalse);
3412  ReplaceImageInList(&wand->images,forward_image);
3413  return(MagickTrue);
3414}
3415
3416/*
3417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3418%                                                                             %
3419%                                                                             %
3420%                                                                             %
3421%   M a g i c k F r a m e I m a g e                                           %
3422%                                                                             %
3423%                                                                             %
3424%                                                                             %
3425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3426%
3427%  MagickFrameImage() adds a simulated three-dimensional border around the
3428%  image.  The width and height specify the border width of the vertical and
3429%  horizontal sides of the frame.  The inner and outer bevels indicate the
3430%  width of the inner and outer shadows of the frame.
3431%
3432%  The format of the MagickFrameImage method is:
3433%
3434%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3435%        const PixelWand *matte_color,const size_t width,
3436%        const size_t height,const ssize_t inner_bevel,
3437%        const ssize_t outer_bevel)
3438%
3439%  A description of each parameter follows:
3440%
3441%    o wand: the magick wand.
3442%
3443%    o matte_color: the frame color pixel wand.
3444%
3445%    o width: the border width.
3446%
3447%    o height: the border height.
3448%
3449%    o inner_bevel: the inner bevel width.
3450%
3451%    o outer_bevel: the outer bevel width.
3452%
3453*/
3454WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3455  const PixelWand *matte_color,const size_t width,
3456  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3457{
3458  Image
3459    *frame_image;
3460
3461  FrameInfo
3462    frame_info;
3463
3464  assert(wand != (MagickWand *) NULL);
3465  assert(wand->signature == WandSignature);
3466  if (wand->debug != MagickFalse)
3467    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3468  if (wand->images == (Image *) NULL)
3469    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3470  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3471  frame_info.width=wand->images->columns+2*width;
3472  frame_info.height=wand->images->rows+2*height;
3473  frame_info.x=(ssize_t) width;
3474  frame_info.y=(ssize_t) height;
3475  frame_info.inner_bevel=inner_bevel;
3476  frame_info.outer_bevel=outer_bevel;
3477  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3478  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3479  if (frame_image == (Image *) NULL)
3480    return(MagickFalse);
3481  ReplaceImageInList(&wand->images,frame_image);
3482  return(MagickTrue);
3483}
3484
3485/*
3486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3487%                                                                             %
3488%                                                                             %
3489%                                                                             %
3490%   M a g i c k F u n c t i o n I m a g e                                     %
3491%                                                                             %
3492%                                                                             %
3493%                                                                             %
3494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495%
3496%  MagickFunctionImage() applys an arithmetic, relational, or logical
3497%  expression to an image.  Use these operators to lighten or darken an image,
3498%  to increase or decrease contrast in an image, or to produce the "negative"
3499%  of an image.
3500%
3501%  The format of the MagickFunctionImage method is:
3502%
3503%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3504%        const MagickFunction function,const size_t number_arguments,
3505%        const double *arguments)
3506%      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3507%        const ChannelType channel,const MagickFunction function,
3508%        const size_t number_arguments,const double *arguments)
3509%
3510%  A description of each parameter follows:
3511%
3512%    o wand: the magick wand.
3513%
3514%    o channel: the channel(s).
3515%
3516%    o function: the image function.
3517%
3518%    o number_arguments: the number of function arguments.
3519%
3520%    o arguments: the function arguments.
3521%
3522*/
3523
3524WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3525  const MagickFunction function,const size_t number_arguments,
3526  const double *arguments)
3527{
3528  MagickBooleanType
3529    status;
3530
3531  assert(wand != (MagickWand *) NULL);
3532  assert(wand->signature == WandSignature);
3533  if (wand->debug != MagickFalse)
3534    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3535  if (wand->images == (Image *) NULL)
3536    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3537  status=FunctionImage(wand->images,function,number_arguments,arguments,
3538    &wand->images->exception);
3539  if (status == MagickFalse)
3540    InheritException(wand->exception,&wand->images->exception);
3541  return(status);
3542}
3543
3544WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3545  const ChannelType channel,const MagickFunction function,
3546  const size_t number_arguments,const double *arguments)
3547{
3548  MagickBooleanType
3549    status;
3550
3551  assert(wand != (MagickWand *) NULL);
3552  assert(wand->signature == WandSignature);
3553  if (wand->debug != MagickFalse)
3554    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3555  if (wand->images == (Image *) NULL)
3556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3557  status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3558    arguments,&wand->images->exception);
3559  return(status);
3560}
3561
3562/*
3563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3564%                                                                             %
3565%                                                                             %
3566%                                                                             %
3567%   M a g i c k F x I m a g e                                                 %
3568%                                                                             %
3569%                                                                             %
3570%                                                                             %
3571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3572%
3573%  MagickFxImage() evaluate expression for each pixel in the image.
3574%
3575%  The format of the MagickFxImage method is:
3576%
3577%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3578%      MagickWand *MagickFxImageChannel(MagickWand *wand,
3579%        const ChannelType channel,const char *expression)
3580%
3581%  A description of each parameter follows:
3582%
3583%    o wand: the magick wand.
3584%
3585%    o channel: the image channel(s).
3586%
3587%    o expression: the expression.
3588%
3589*/
3590
3591WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3592{
3593  MagickWand
3594    *fx_wand;
3595
3596  fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3597  return(fx_wand);
3598}
3599
3600WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3601  const ChannelType channel,const char *expression)
3602{
3603  Image
3604    *fx_image;
3605
3606  assert(wand != (MagickWand *) NULL);
3607  assert(wand->signature == WandSignature);
3608  if (wand->debug != MagickFalse)
3609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3610  if (wand->images == (Image *) NULL)
3611    return((MagickWand *) NULL);
3612  fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3613  if (fx_image == (Image *) NULL)
3614    return((MagickWand *) NULL);
3615  return(CloneMagickWandFromImages(wand,fx_image));
3616}
3617
3618/*
3619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3620%                                                                             %
3621%                                                                             %
3622%                                                                             %
3623%   M a g i c k G a m m a I m a g e                                           %
3624%                                                                             %
3625%                                                                             %
3626%                                                                             %
3627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3628%
3629%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3630%  different devices will have perceptual differences in the way the image's
3631%  intensities are represented on the screen.  Specify individual gamma levels
3632%  for the red, green, and blue channels, or adjust all three with the gamma
3633%  parameter.  Values typically range from 0.8 to 2.3.
3634%
3635%  You can also reduce the influence of a particular channel with a gamma
3636%  value of 0.
3637%
3638%  The format of the MagickGammaImage method is:
3639%
3640%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3641%      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3642%        const ChannelType channel,const double gamma)
3643%
3644%  A description of each parameter follows:
3645%
3646%    o wand: the magick wand.
3647%
3648%    o channel: the channel.
3649%
3650%    o level: Define the level of gamma correction.
3651%
3652*/
3653
3654WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3655  const double gamma)
3656{
3657  MagickBooleanType
3658    status;
3659
3660  status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3661  return(status);
3662}
3663
3664WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3665  const ChannelType channel,const double gamma)
3666{
3667  MagickBooleanType
3668    status;
3669
3670  assert(wand != (MagickWand *) NULL);
3671  assert(wand->signature == WandSignature);
3672  if (wand->debug != MagickFalse)
3673    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3674  if (wand->images == (Image *) NULL)
3675    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3676  status=GammaImageChannel(wand->images,channel,gamma);
3677  if (status == MagickFalse)
3678    InheritException(wand->exception,&wand->images->exception);
3679  return(status);
3680}
3681
3682/*
3683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684%                                                                             %
3685%                                                                             %
3686%                                                                             %
3687%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3688%                                                                             %
3689%                                                                             %
3690%                                                                             %
3691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3692%
3693%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3694%  Gaussian operator of the given radius and standard deviation (sigma).
3695%  For reasonable results, the radius should be larger than sigma.  Use a
3696%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3697%
3698%  The format of the MagickGaussianBlurImage method is:
3699%
3700%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3701%        const double radius,const double sigma)
3702%      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3703%        const ChannelType channel,const double radius,const double sigma)
3704%
3705%  A description of each parameter follows:
3706%
3707%    o wand: the magick wand.
3708%
3709%    o channel: the image channel(s).
3710%
3711%    o radius: the radius of the Gaussian, in pixels, not counting the center
3712%      pixel.
3713%
3714%    o sigma: the standard deviation of the Gaussian, in pixels.
3715%
3716*/
3717
3718WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3719  const double radius,const double sigma)
3720{
3721  MagickBooleanType
3722    status;
3723
3724  status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3725  return(status);
3726}
3727
3728WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3729  const ChannelType channel,const double radius,const double sigma)
3730{
3731  Image
3732    *blur_image;
3733
3734  assert(wand != (MagickWand *) NULL);
3735  assert(wand->signature == WandSignature);
3736  if (wand->debug != MagickFalse)
3737    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3738  if (wand->images == (Image *) NULL)
3739    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3740  blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3741    wand->exception);
3742  if (blur_image == (Image *) NULL)
3743    return(MagickFalse);
3744  ReplaceImageInList(&wand->images,blur_image);
3745  return(MagickTrue);
3746}
3747
3748/*
3749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3750%                                                                             %
3751%                                                                             %
3752%                                                                             %
3753%   M a g i c k G e t I m a g e                                               %
3754%                                                                             %
3755%                                                                             %
3756%                                                                             %
3757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3758%
3759%  MagickGetImage() gets the image at the current image index.
3760%
3761%  The format of the MagickGetImage method is:
3762%
3763%      MagickWand *MagickGetImage(MagickWand *wand)
3764%
3765%  A description of each parameter follows:
3766%
3767%    o wand: the magick wand.
3768%
3769*/
3770WandExport MagickWand *MagickGetImage(MagickWand *wand)
3771{
3772  Image
3773    *image;
3774
3775  assert(wand != (MagickWand *) NULL);
3776  assert(wand->signature == WandSignature);
3777  if (wand->debug != MagickFalse)
3778    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3779  if (wand->images == (Image *) NULL)
3780    {
3781      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3782        "ContainsNoImages","`%s'",wand->name);
3783      return((MagickWand *) NULL);
3784    }
3785  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3786  if (image == (Image *) NULL)
3787    return((MagickWand *) NULL);
3788  return(CloneMagickWandFromImages(wand,image));
3789}
3790
3791/*
3792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3793%                                                                             %
3794%                                                                             %
3795%                                                                             %
3796%   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                       %
3797%                                                                             %
3798%                                                                             %
3799%                                                                             %
3800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3801%
3802%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3803%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3804%  than CMYKA.
3805%
3806%  The format of the MagickGetImageAlphaChannel method is:
3807%
3808%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3809%
3810%  A description of each parameter follows:
3811%
3812%    o wand: the magick wand.
3813%
3814*/
3815WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3816{
3817  assert(wand != (MagickWand *) NULL);
3818  assert(wand->signature == WandSignature);
3819  if (wand->debug != MagickFalse)
3820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3821  if (wand->images == (Image *) NULL)
3822    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3823  return(GetImageAlphaChannel(wand->images));
3824}
3825
3826/*
3827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3828%                                                                             %
3829%                                                                             %
3830%                                                                             %
3831%   M a g i c k G e t I m a g e C l i p M a s k                               %
3832%                                                                             %
3833%                                                                             %
3834%                                                                             %
3835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3836%
3837%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3838%
3839%  The format of the MagickGetImageClipMask method is:
3840%
3841%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3842%
3843%  A description of each parameter follows:
3844%
3845%    o wand: the magick wand.
3846%
3847*/
3848WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3849{
3850  Image
3851    *image;
3852
3853  assert(wand != (MagickWand *) NULL);
3854  assert(wand->signature == WandSignature);
3855  if (wand->debug != MagickFalse)
3856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3857  if (wand->images == (Image *) NULL)
3858    {
3859      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3860        "ContainsNoImages","`%s'",wand->name);
3861      return((MagickWand *) NULL);
3862    }
3863  image=GetImageClipMask(wand->images,wand->exception);
3864  if (image == (Image *) NULL)
3865    return((MagickWand *) NULL);
3866  return(CloneMagickWandFromImages(wand,image));
3867}
3868
3869/*
3870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3871%                                                                             %
3872%                                                                             %
3873%                                                                             %
3874%   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                 %
3875%                                                                             %
3876%                                                                             %
3877%                                                                             %
3878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3879%
3880%  MagickGetImageBackgroundColor() returns the image background color.
3881%
3882%  The format of the MagickGetImageBackgroundColor method is:
3883%
3884%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3885%        PixelWand *background_color)
3886%
3887%  A description of each parameter follows:
3888%
3889%    o wand: the magick wand.
3890%
3891%    o background_color: Return the background color.
3892%
3893*/
3894WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3895  PixelWand *background_color)
3896{
3897  assert(wand != (MagickWand *) NULL);
3898  assert(wand->signature == WandSignature);
3899  if (wand->debug != MagickFalse)
3900    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3901  if (wand->images == (Image *) NULL)
3902    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3903  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3904  return(MagickTrue);
3905}
3906
3907/*
3908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3909%                                                                             %
3910%                                                                             %
3911%                                                                             %
3912%   M a g i c k G e t I m a g e B l o b                                       %
3913%                                                                             %
3914%                                                                             %
3915%                                                                             %
3916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3917%
3918%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3919%  the image as a blob (a formatted "file" in memory) and its length, starting
3920%  from the current position in the image sequence.  Use MagickSetImageFormat()
3921%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3922%
3923%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3924%  the image sequence.
3925%
3926%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3927%
3928%  The format of the MagickGetImageBlob method is:
3929%
3930%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3931%
3932%  A description of each parameter follows:
3933%
3934%    o wand: the magick wand.
3935%
3936%    o length: the length of the blob.
3937%
3938*/
3939WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3940{
3941  assert(wand != (MagickWand *) NULL);
3942  assert(wand->signature == WandSignature);
3943  if (wand->debug != MagickFalse)
3944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3945  if (wand->images == (Image *) NULL)
3946    {
3947      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3948        "ContainsNoImages","`%s'",wand->name);
3949      return((unsigned char *) NULL);
3950    }
3951  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3952}
3953
3954/*
3955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3956%                                                                             %
3957%                                                                             %
3958%                                                                             %
3959%   M a g i c k G e t I m a g e s B l o b                                     %
3960%                                                                             %
3961%                                                                             %
3962%                                                                             %
3963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3964%
3965%  MagickGetImageBlob() implements direct to memory image formats.  It
3966%  returns the image sequence as a blob and its length.  The format of the image
3967%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3968%  return a different image format, use MagickSetImageFormat().
3969%
3970%  Note, some image formats do not permit multiple images to the same image
3971%  stream (e.g. JPEG).  in this instance, just the first image of the
3972%  sequence is returned as a blob.
3973%
3974%  The format of the MagickGetImagesBlob method is:
3975%
3976%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3977%
3978%  A description of each parameter follows:
3979%
3980%    o wand: the magick wand.
3981%
3982%    o length: the length of the blob.
3983%
3984*/
3985WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3986{
3987  unsigned char
3988    *blob;
3989
3990  assert(wand != (MagickWand *) NULL);
3991  assert(wand->signature == WandSignature);
3992  if (wand->debug != MagickFalse)
3993    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3994  if (wand->images == (Image *) NULL)
3995    {
3996      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3997        "ContainsNoImages","`%s'",wand->name);
3998      return((unsigned char *) NULL);
3999    }
4000  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4001    wand->exception);
4002  return(blob);
4003}
4004
4005/*
4006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4007%                                                                             %
4008%                                                                             %
4009%                                                                             %
4010%   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                         %
4011%                                                                             %
4012%                                                                             %
4013%                                                                             %
4014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4015%
4016%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4017%  image.
4018%
4019%  The format of the MagickGetImageBluePrimary method is:
4020%
4021%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4022%        double *y)
4023%
4024%  A description of each parameter follows:
4025%
4026%    o wand: the magick wand.
4027%
4028%    o x: the chromaticity blue primary x-point.
4029%
4030%    o y: the chromaticity blue primary y-point.
4031%
4032*/
4033WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4034  double *x,double *y)
4035{
4036  assert(wand != (MagickWand *) NULL);
4037  assert(wand->signature == WandSignature);
4038  if (wand->debug != MagickFalse)
4039    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4040  if (wand->images == (Image *) NULL)
4041    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4042  *x=wand->images->chromaticity.blue_primary.x;
4043  *y=wand->images->chromaticity.blue_primary.y;
4044  return(MagickTrue);
4045}
4046
4047/*
4048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4049%                                                                             %
4050%                                                                             %
4051%                                                                             %
4052%   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                         %
4053%                                                                             %
4054%                                                                             %
4055%                                                                             %
4056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4057%
4058%  MagickGetImageBorderColor() returns the image border color.
4059%
4060%  The format of the MagickGetImageBorderColor method is:
4061%
4062%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4063%        PixelWand *border_color)
4064%
4065%  A description of each parameter follows:
4066%
4067%    o wand: the magick wand.
4068%
4069%    o border_color: Return the border color.
4070%
4071*/
4072WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4073  PixelWand *border_color)
4074{
4075  assert(wand != (MagickWand *) NULL);
4076  assert(wand->signature == WandSignature);
4077  if (wand->debug != MagickFalse)
4078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4079  if (wand->images == (Image *) NULL)
4080    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4081  PixelSetQuantumPacket(border_color,&wand->images->border_color);
4082  return(MagickTrue);
4083}
4084
4085/*
4086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4087%                                                                             %
4088%                                                                             %
4089%                                                                             %
4090%   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                 %
4091%                                                                             %
4092%                                                                             %
4093%                                                                             %
4094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4095%
4096%  MagickGetImageChannelFeatures() returns features for each channel in the
4097%  image in each of four directions (horizontal, vertical, left and right
4098%  diagonals) for the specified distance.  The features include the angular
4099%  second moment, contrast, correlation, sum of squares: variance, inverse
4100%  difference moment, sum average, sum varience, sum entropy, entropy,
4101%  difference variance, difference entropy, information measures of
4102%  correlation 1, information measures of correlation 2, and maximum
4103%  correlation coefficient.  You can access the red channel contrast, for
4104%  example, like this:
4105%
4106%      channel_features=MagickGetImageChannelFeatures(wand,1);
4107%      contrast=channel_features[RedChannel].contrast[0];
4108%
4109%  Use MagickRelinquishMemory() to free the statistics buffer.
4110%
4111%  The format of the MagickGetImageChannelFeatures method is:
4112%
4113%      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4114%        const size_t distance)
4115%
4116%  A description of each parameter follows:
4117%
4118%    o wand: the magick wand.
4119%
4120%    o distance: the distance.
4121%
4122*/
4123WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4124  const size_t distance)
4125{
4126  assert(wand != (MagickWand *) NULL);
4127  assert(wand->signature == WandSignature);
4128  if (wand->debug != MagickFalse)
4129    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4130  if (wand->images == (Image *) NULL)
4131    {
4132      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4133        "ContainsNoImages","`%s'",wand->name);
4134      return((ChannelFeatures *) NULL);
4135    }
4136  return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4137}
4138
4139/*
4140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4141%                                                                             %
4142%                                                                             %
4143%                                                                             %
4144%   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                 %
4145%                                                                             %
4146%                                                                             %
4147%                                                                             %
4148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4149%
4150%  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4151%  more image channels.
4152%
4153%  The format of the MagickGetImageChannelKurtosis method is:
4154%
4155%      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4156%        const ChannelType channel,double *kurtosis,double *skewness)
4157%
4158%  A description of each parameter follows:
4159%
4160%    o wand: the magick wand.
4161%
4162%    o channel: the image channel(s).
4163%
4164%    o kurtosis:  The kurtosis for the specified channel(s).
4165%
4166%    o skewness:  The skewness for the specified channel(s).
4167%
4168*/
4169WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4170  const ChannelType channel,double *kurtosis,double *skewness)
4171{
4172  MagickBooleanType
4173    status;
4174
4175  assert(wand != (MagickWand *) NULL);
4176  assert(wand->signature == WandSignature);
4177  if (wand->debug != MagickFalse)
4178    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4179  if (wand->images == (Image *) NULL)
4180    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4181  status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4182    wand->exception);
4183  return(status);
4184}
4185
4186/*
4187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4188%                                                                             %
4189%                                                                             %
4190%                                                                             %
4191%   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                         %
4192%                                                                             %
4193%                                                                             %
4194%                                                                             %
4195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4196%
4197%  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4198%  more image channels.
4199%
4200%  The format of the MagickGetImageChannelMean method is:
4201%
4202%      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4203%        const ChannelType channel,double *mean,double *standard_deviation)
4204%
4205%  A description of each parameter follows:
4206%
4207%    o wand: the magick wand.
4208%
4209%    o channel: the image channel(s).
4210%
4211%    o mean:  The mean pixel value for the specified channel(s).
4212%
4213%    o standard_deviation:  The standard deviation for the specified channel(s).
4214%
4215*/
4216WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4217  const ChannelType channel,double *mean,double *standard_deviation)
4218{
4219  MagickBooleanType
4220    status;
4221
4222  assert(wand != (MagickWand *) NULL);
4223  assert(wand->signature == WandSignature);
4224  if (wand->debug != MagickFalse)
4225    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4226  if (wand->images == (Image *) NULL)
4227    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4228  status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4229    wand->exception);
4230  return(status);
4231}
4232
4233/*
4234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4235%                                                                             %
4236%                                                                             %
4237%                                                                             %
4238%   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                       %
4239%                                                                             %
4240%                                                                             %
4241%                                                                             %
4242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4243%
4244%  MagickGetImageChannelRange() gets the range for one or more image channels.
4245%
4246%  The format of the MagickGetImageChannelRange method is:
4247%
4248%      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4249%        const ChannelType channel,double *minima,double *maxima)
4250%
4251%  A description of each parameter follows:
4252%
4253%    o wand: the magick wand.
4254%
4255%    o channel: the image channel(s).
4256%
4257%    o minima:  The minimum pixel value for the specified channel(s).
4258%
4259%    o maxima:  The maximum pixel value for the specified channel(s).
4260%
4261*/
4262WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4263  const ChannelType channel,double *minima,double *maxima)
4264{
4265  MagickBooleanType
4266    status;
4267
4268  assert(wand != (MagickWand *) NULL);
4269  assert(wand->signature == WandSignature);
4270  if (wand->debug != MagickFalse)
4271    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4272  if (wand->images == (Image *) NULL)
4273    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4274  status=GetImageChannelRange(wand->images,channel,minima,maxima,
4275    wand->exception);
4276  return(status);
4277}
4278
4279/*
4280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4281%                                                                             %
4282%                                                                             %
4283%                                                                             %
4284%   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             %
4285%                                                                             %
4286%                                                                             %
4287%                                                                             %
4288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4289%
4290%  MagickGetImageChannelStatistics() returns statistics for each channel in the
4291%  image.  The statistics include the channel depth, its minima and
4292%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4293%  You can access the red channel mean, for example, like this:
4294%
4295%      channel_statistics=MagickGetImageChannelStatistics(wand);
4296%      red_mean=channel_statistics[RedChannel].mean;
4297%
4298%  Use MagickRelinquishMemory() to free the statistics buffer.
4299%
4300%  The format of the MagickGetImageChannelStatistics method is:
4301%
4302%      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4303%
4304%  A description of each parameter follows:
4305%
4306%    o wand: the magick wand.
4307%
4308*/
4309WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4310{
4311  assert(wand != (MagickWand *) NULL);
4312  assert(wand->signature == WandSignature);
4313  if (wand->debug != MagickFalse)
4314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4315  if (wand->images == (Image *) NULL)
4316    {
4317      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4318        "ContainsNoImages","`%s'",wand->name);
4319      return((ChannelStatistics *) NULL);
4320    }
4321  return(GetImageChannelStatistics(wand->images,wand->exception));
4322}
4323
4324/*
4325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4326%                                                                             %
4327%                                                                             %
4328%                                                                             %
4329%   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                     %
4330%                                                                             %
4331%                                                                             %
4332%                                                                             %
4333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4334%
4335%  MagickGetImageColormapColor() returns the color of the specified colormap
4336%  index.
4337%
4338%  The format of the MagickGetImageColormapColor method is:
4339%
4340%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4341%        const size_t index,PixelWand *color)
4342%
4343%  A description of each parameter follows:
4344%
4345%    o wand: the magick wand.
4346%
4347%    o index: the offset into the image colormap.
4348%
4349%    o color: Return the colormap color in this wand.
4350%
4351*/
4352WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4353  const size_t index,PixelWand *color)
4354{
4355  assert(wand != (MagickWand *) NULL);
4356  assert(wand->signature == WandSignature);
4357  if (wand->debug != MagickFalse)
4358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4359  if (wand->images == (Image *) NULL)
4360    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4361  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4362      (index >= wand->images->colors))
4363    {
4364      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4365        "InvalidColormapIndex","`%s'",wand->name);
4366      return(MagickFalse);
4367    }
4368  PixelSetQuantumPacket(color,wand->images->colormap+index);
4369  return(MagickTrue);
4370}
4371
4372/*
4373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4374%                                                                             %
4375%                                                                             %
4376%                                                                             %
4377%   M a g i c k G e t I m a g e C o l o r s                                   %
4378%                                                                             %
4379%                                                                             %
4380%                                                                             %
4381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4382%
4383%  MagickGetImageColors() gets the number of unique colors in the image.
4384%
4385%  The format of the MagickGetImageColors method is:
4386%
4387%      size_t MagickGetImageColors(MagickWand *wand)
4388%
4389%  A description of each parameter follows:
4390%
4391%    o wand: the magick wand.
4392%
4393*/
4394WandExport size_t MagickGetImageColors(MagickWand *wand)
4395{
4396  assert(wand != (MagickWand *) NULL);
4397  assert(wand->signature == WandSignature);
4398  if (wand->debug != MagickFalse)
4399    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4400  if (wand->images == (Image *) NULL)
4401    {
4402      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4403        "ContainsNoImages","`%s'",wand->name);
4404      return(0);
4405    }
4406  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4407}
4408
4409/*
4410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4411%                                                                             %
4412%                                                                             %
4413%                                                                             %
4414%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4415%                                                                             %
4416%                                                                             %
4417%                                                                             %
4418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4419%
4420%  MagickGetImageColorspace() gets the image colorspace.
4421%
4422%  The format of the MagickGetImageColorspace method is:
4423%
4424%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4425%
4426%  A description of each parameter follows:
4427%
4428%    o wand: the magick wand.
4429%
4430*/
4431WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4432{
4433  assert(wand != (MagickWand *) NULL);
4434  assert(wand->signature == WandSignature);
4435  if (wand->debug != MagickFalse)
4436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4437  if (wand->images == (Image *) NULL)
4438    {
4439      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4440        "ContainsNoImages","`%s'",wand->name);
4441      return(UndefinedColorspace);
4442    }
4443  return(wand->images->colorspace);
4444}
4445
4446/*
4447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4448%                                                                             %
4449%                                                                             %
4450%                                                                             %
4451%   M a g i c k G e t I m a g e C o m p o s e                                 %
4452%                                                                             %
4453%                                                                             %
4454%                                                                             %
4455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4456%
4457%  MagickGetImageCompose() returns the composite operator associated with the
4458%  image.
4459%
4460%  The format of the MagickGetImageCompose method is:
4461%
4462%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4463%
4464%  A description of each parameter follows:
4465%
4466%    o wand: the magick wand.
4467%
4468*/
4469WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4470{
4471  assert(wand != (MagickWand *) NULL);
4472  assert(wand->signature == WandSignature);
4473  if (wand->debug != MagickFalse)
4474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4475  if (wand->images == (Image *) NULL)
4476    {
4477      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4478        "ContainsNoImages","`%s'",wand->name);
4479      return(UndefinedCompositeOp);
4480    }
4481  return(wand->images->compose);
4482}
4483
4484/*
4485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4486%                                                                             %
4487%                                                                             %
4488%                                                                             %
4489%   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                         %
4490%                                                                             %
4491%                                                                             %
4492%                                                                             %
4493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4494%
4495%  MagickGetImageCompression() gets the image compression.
4496%
4497%  The format of the MagickGetImageCompression method is:
4498%
4499%      CompressionType MagickGetImageCompression(MagickWand *wand)
4500%
4501%  A description of each parameter follows:
4502%
4503%    o wand: the magick wand.
4504%
4505*/
4506WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4507{
4508  assert(wand != (MagickWand *) NULL);
4509  assert(wand->signature == WandSignature);
4510  if (wand->debug != MagickFalse)
4511    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4512  if (wand->images == (Image *) NULL)
4513    {
4514      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4515        "ContainsNoImages","`%s'",wand->name);
4516      return(UndefinedCompression);
4517    }
4518  return(wand->images->compression);
4519}
4520
4521/*
4522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4523%                                                                             %
4524%                                                                             %
4525%                                                                             %
4526%   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           %
4527%                                                                             %
4528%                                                                             %
4529%                                                                             %
4530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4531%
4532%  MagickGetImageCompression() gets the image compression quality.
4533%
4534%  The format of the MagickGetImageCompression method is:
4535%
4536%      size_t MagickGetImageCompression(MagickWand *wand)
4537%
4538%  A description of each parameter follows:
4539%
4540%    o wand: the magick wand.
4541%
4542*/
4543WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4544{
4545  assert(wand != (MagickWand *) NULL);
4546  assert(wand->signature == WandSignature);
4547  if (wand->debug != MagickFalse)
4548    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4549  if (wand->images == (Image *) NULL)
4550    {
4551      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4552        "ContainsNoImages","`%s'",wand->name);
4553      return(0UL);
4554    }
4555  return(wand->images->quality);
4556}
4557
4558/*
4559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4560%                                                                             %
4561%                                                                             %
4562%                                                                             %
4563%   M a g i c k G e t I m a g e D e l a y                                     %
4564%                                                                             %
4565%                                                                             %
4566%                                                                             %
4567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4568%
4569%  MagickGetImageDelay() gets the image delay.
4570%
4571%  The format of the MagickGetImageDelay method is:
4572%
4573%      size_t MagickGetImageDelay(MagickWand *wand)
4574%
4575%  A description of each parameter follows:
4576%
4577%    o wand: the magick wand.
4578%
4579*/
4580WandExport size_t MagickGetImageDelay(MagickWand *wand)
4581{
4582  assert(wand != (MagickWand *) NULL);
4583  assert(wand->signature == WandSignature);
4584  if (wand->debug != MagickFalse)
4585    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4586  if (wand->images == (Image *) NULL)
4587    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4588  return(wand->images->delay);
4589}
4590
4591/*
4592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4593%                                                                             %
4594%                                                                             %
4595%                                                                             %
4596%   M a g i c k G e t I m a g e D e p t h                                     %
4597%                                                                             %
4598%                                                                             %
4599%                                                                             %
4600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4601%
4602%  MagickGetImageDepth() gets the image depth.
4603%
4604%  The format of the MagickGetImageDepth method is:
4605%
4606%      size_t MagickGetImageDepth(MagickWand *wand)
4607%
4608%  A description of each parameter follows:
4609%
4610%    o wand: the magick wand.
4611%
4612*/
4613WandExport size_t MagickGetImageDepth(MagickWand *wand)
4614{
4615  assert(wand != (MagickWand *) NULL);
4616  assert(wand->signature == WandSignature);
4617  if (wand->debug != MagickFalse)
4618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4619  if (wand->images == (Image *) NULL)
4620    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4621  return(GetImageDepth(wand->images,wand->exception));
4622}
4623
4624/*
4625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4626%                                                                             %
4627%                                                                             %
4628%                                                                             %
4629%   M a g i c k G e t I m a g e D i s p o s e                                 %
4630%                                                                             %
4631%                                                                             %
4632%                                                                             %
4633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4634%
4635%  MagickGetImageDispose() gets the image disposal method.
4636%
4637%  The format of the MagickGetImageDispose method is:
4638%
4639%      DisposeType MagickGetImageDispose(MagickWand *wand)
4640%
4641%  A description of each parameter follows:
4642%
4643%    o wand: the magick wand.
4644%
4645*/
4646WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4647{
4648  assert(wand != (MagickWand *) NULL);
4649  assert(wand->signature == WandSignature);
4650  if (wand->debug != MagickFalse)
4651    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4652  if (wand->images == (Image *) NULL)
4653    {
4654      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4655        "ContainsNoImages","`%s'",wand->name);
4656      return(UndefinedDispose);
4657    }
4658  return((DisposeType) wand->images->dispose);
4659}
4660
4661/*
4662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4663%                                                                             %
4664%                                                                             %
4665%                                                                             %
4666%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4667%                                                                             %
4668%                                                                             %
4669%                                                                             %
4670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4671%
4672%  MagickGetImageDistortion() compares an image to a reconstructed image and
4673%  returns the specified distortion metric.
4674%
4675%  The format of the MagickGetImageDistortion method is:
4676%
4677%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4678%        const MagickWand *reference,const MetricType metric,
4679%        double *distortion)
4680%
4681%  A description of each parameter follows:
4682%
4683%    o wand: the magick wand.
4684%
4685%    o reference: the reference wand.
4686%
4687%    o metric: the metric.
4688%
4689%    o distortion: the computed distortion between the images.
4690%
4691*/
4692WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4693  const MagickWand *reference,const MetricType metric,double *distortion)
4694{
4695  MagickBooleanType
4696    status;
4697
4698  assert(wand != (MagickWand *) NULL);
4699  assert(wand->signature == WandSignature);
4700  if (wand->debug != MagickFalse)
4701    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4702  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4703    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4704  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4705    &wand->images->exception);
4706  return(status);
4707}
4708
4709/*
4710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4711%                                                                             %
4712%                                                                             %
4713%                                                                             %
4714%   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                         %
4715%                                                                             %
4716%                                                                             %
4717%                                                                             %
4718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4719%
4720%  MagickGetImageDistortions() compares one or more pixel channels of an
4721%  image to a reconstructed image and returns the specified distortion metrics.
4722%
4723%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4724%
4725%  The format of the MagickGetImageDistortion method is:
4726%
4727%      double *MagickGetImageDistortion(MagickWand *wand,
4728%        const MagickWand *reference,const MetricType metric)
4729%
4730%  A description of each parameter follows:
4731%
4732%    o wand: the magick wand.
4733%
4734%    o reference: the reference wand.
4735%
4736%    o metric: the metric.
4737%
4738*/
4739WandExport double *MagickGetImageDistortions(MagickWand *wand,
4740  const MagickWand *reference,const MetricType metric)
4741{
4742  double
4743    *channel_distortion;
4744
4745  assert(wand != (MagickWand *) NULL);
4746  assert(wand->signature == WandSignature);
4747  if (wand->debug != MagickFalse)
4748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4749  assert(reference != (MagickWand *) NULL);
4750  assert(reference->signature == WandSignature);
4751  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4752    {
4753      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4754        "ContainsNoImages","`%s'",wand->name);
4755      return((double *) NULL);
4756    }
4757  channel_distortion=GetImageDistortions(wand->images,reference->images,
4758    metric,&wand->images->exception);
4759  return(channel_distortion);
4760}
4761
4762/*
4763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4764%                                                                             %
4765%                                                                             %
4766%                                                                             %
4767%   M a g i c k G e t I m a g e F i l e n a m e                               %
4768%                                                                             %
4769%                                                                             %
4770%                                                                             %
4771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772%
4773%  MagickGetImageFilename() returns the filename of a particular image in a
4774%  sequence.
4775%
4776%  The format of the MagickGetImageFilename method is:
4777%
4778%      char *MagickGetImageFilename(MagickWand *wand)
4779%
4780%  A description of each parameter follows:
4781%
4782%    o wand: the magick wand.
4783%
4784*/
4785WandExport char *MagickGetImageFilename(MagickWand *wand)
4786{
4787  assert(wand != (MagickWand *) NULL);
4788  assert(wand->signature == WandSignature);
4789  if (wand->debug != MagickFalse)
4790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4791  if (wand->images == (Image *) NULL)
4792    {
4793      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4794        "ContainsNoImages","`%s'",wand->name);
4795      return((char *) NULL);
4796    }
4797  return(AcquireString(wand->images->filename));
4798}
4799
4800/*
4801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802%                                                                             %
4803%                                                                             %
4804%                                                                             %
4805%   M a g i c k G e t I m a g e F o r m a t                                   %
4806%                                                                             %
4807%                                                                             %
4808%                                                                             %
4809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4810%
4811%  MagickGetImageFormat() returns the format of a particular image in a
4812%  sequence.
4813%
4814%  The format of the MagickGetImageFormat method is:
4815%
4816%      const char *MagickGetImageFormat(MagickWand *wand)
4817%
4818%  A description of each parameter follows:
4819%
4820%    o wand: the magick wand.
4821%
4822*/
4823WandExport char *MagickGetImageFormat(MagickWand *wand)
4824{
4825  assert(wand != (MagickWand *) NULL);
4826  assert(wand->signature == WandSignature);
4827  if (wand->debug != MagickFalse)
4828    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4829  if (wand->images == (Image *) NULL)
4830    {
4831      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4832        "ContainsNoImages","`%s'",wand->name);
4833      return((char *) NULL);
4834    }
4835  return(AcquireString(wand->images->magick));
4836}
4837
4838/*
4839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4840%                                                                             %
4841%                                                                             %
4842%                                                                             %
4843%   M a g i c k G e t I m a g e F u z z                                       %
4844%                                                                             %
4845%                                                                             %
4846%                                                                             %
4847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4848%
4849%  MagickGetImageFuzz() gets the image fuzz.
4850%
4851%  The format of the MagickGetImageFuzz method is:
4852%
4853%      double MagickGetImageFuzz(MagickWand *wand)
4854%
4855%  A description of each parameter follows:
4856%
4857%    o wand: the magick wand.
4858%
4859*/
4860WandExport double MagickGetImageFuzz(MagickWand *wand)
4861{
4862  assert(wand != (MagickWand *) NULL);
4863  assert(wand->signature == WandSignature);
4864  if (wand->debug != MagickFalse)
4865    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4866  if (wand->images == (Image *) NULL)
4867    {
4868      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4869        "ContainsNoImages","`%s'",wand->name);
4870      return(0.0);
4871    }
4872  return(wand->images->fuzz);
4873}
4874
4875/*
4876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4877%                                                                             %
4878%                                                                             %
4879%                                                                             %
4880%   M a g i c k G e t I m a g e G a m m a                                     %
4881%                                                                             %
4882%                                                                             %
4883%                                                                             %
4884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4885%
4886%  MagickGetImageGamma() gets the image gamma.
4887%
4888%  The format of the MagickGetImageGamma method is:
4889%
4890%      double MagickGetImageGamma(MagickWand *wand)
4891%
4892%  A description of each parameter follows:
4893%
4894%    o wand: the magick wand.
4895%
4896*/
4897WandExport double MagickGetImageGamma(MagickWand *wand)
4898{
4899  assert(wand != (MagickWand *) NULL);
4900  assert(wand->signature == WandSignature);
4901  if (wand->debug != MagickFalse)
4902    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4903  if (wand->images == (Image *) NULL)
4904    {
4905      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4906        "ContainsNoImages","`%s'",wand->name);
4907      return(0.0);
4908    }
4909  return(wand->images->gamma);
4910}
4911
4912/*
4913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4914%                                                                             %
4915%                                                                             %
4916%                                                                             %
4917%   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                 %
4918%                                                                             %
4919%                                                                             %
4920%                                                                             %
4921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4922%
4923%  MagickGetImageGravity() gets the image gravity.
4924%
4925%  The format of the MagickGetImageGravity method is:
4926%
4927%      GravityType MagickGetImageGravity(MagickWand *wand)
4928%
4929%  A description of each parameter follows:
4930%
4931%    o wand: the magick wand.
4932%
4933*/
4934WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4935{
4936  assert(wand != (MagickWand *) NULL);
4937  assert(wand->signature == WandSignature);
4938  if (wand->debug != MagickFalse)
4939    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4940  if (wand->images == (Image *) NULL)
4941    {
4942      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4943        "ContainsNoImages","`%s'",wand->name);
4944      return(UndefinedGravity);
4945    }
4946  return(wand->images->gravity);
4947}
4948
4949/*
4950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951%                                                                             %
4952%                                                                             %
4953%                                                                             %
4954%   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                       %
4955%                                                                             %
4956%                                                                             %
4957%                                                                             %
4958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4959%
4960%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4961%
4962%  The format of the MagickGetImageGreenPrimary method is:
4963%
4964%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4965%        double *y)
4966%
4967%  A description of each parameter follows:
4968%
4969%    o wand: the magick wand.
4970%
4971%    o x: the chromaticity green primary x-point.
4972%
4973%    o y: the chromaticity green primary y-point.
4974%
4975*/
4976WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4977  double *x,double *y)
4978{
4979  assert(wand != (MagickWand *) NULL);
4980  assert(wand->signature == WandSignature);
4981  if (wand->debug != MagickFalse)
4982    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4983  if (wand->images == (Image *) NULL)
4984    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4985  *x=wand->images->chromaticity.green_primary.x;
4986  *y=wand->images->chromaticity.green_primary.y;
4987  return(MagickTrue);
4988}
4989
4990/*
4991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4992%                                                                             %
4993%                                                                             %
4994%                                                                             %
4995%   M a g i c k G e t I m a g e H e i g h t                                   %
4996%                                                                             %
4997%                                                                             %
4998%                                                                             %
4999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5000%
5001%  MagickGetImageHeight() returns the image height.
5002%
5003%  The format of the MagickGetImageHeight method is:
5004%
5005%      size_t MagickGetImageHeight(MagickWand *wand)
5006%
5007%  A description of each parameter follows:
5008%
5009%    o wand: the magick wand.
5010%
5011*/
5012WandExport size_t MagickGetImageHeight(MagickWand *wand)
5013{
5014  assert(wand != (MagickWand *) NULL);
5015  assert(wand->signature == WandSignature);
5016  if (wand->debug != MagickFalse)
5017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5018  if (wand->images == (Image *) NULL)
5019    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5020  return(wand->images->rows);
5021}
5022
5023/*
5024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5025%                                                                             %
5026%                                                                             %
5027%                                                                             %
5028%   M a g i c k G e t I m a g e H i s t o g r a m                             %
5029%                                                                             %
5030%                                                                             %
5031%                                                                             %
5032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5033%
5034%  MagickGetImageHistogram() returns the image histogram as an array of
5035%  PixelWand wands.
5036%
5037%  The format of the MagickGetImageHistogram method is:
5038%
5039%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5040%        size_t *number_colors)
5041%
5042%  A description of each parameter follows:
5043%
5044%    o wand: the magick wand.
5045%
5046%    o number_colors: the number of unique colors in the image and the number
5047%      of pixel wands returned.
5048%
5049*/
5050WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5051  size_t *number_colors)
5052{
5053  PixelPacket
5054    *histogram;
5055
5056  PixelWand
5057    **pixel_wands;
5058
5059  register ssize_t
5060    i;
5061
5062  assert(wand != (MagickWand *) NULL);
5063  assert(wand->signature == WandSignature);
5064  if (wand->debug != MagickFalse)
5065    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5066  if (wand->images == (Image *) NULL)
5067    {
5068      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5069        "ContainsNoImages","`%s'",wand->name);
5070      return((PixelWand **) NULL);
5071    }
5072  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5073  if (histogram == (PixelPacket *) NULL)
5074    return((PixelWand **) NULL);
5075  pixel_wands=NewPixelWands(*number_colors);
5076  for (i=0; i < (ssize_t) *number_colors; i++)
5077  {
5078    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
5079    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5080  }
5081  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
5082  return(pixel_wands);
5083}
5084
5085/*
5086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5087%                                                                             %
5088%                                                                             %
5089%                                                                             %
5090%   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                 %
5091%                                                                             %
5092%                                                                             %
5093%                                                                             %
5094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5095%
5096%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5097%
5098%  The format of the MagickGetImageInterlaceScheme method is:
5099%
5100%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5101%
5102%  A description of each parameter follows:
5103%
5104%    o wand: the magick wand.
5105%
5106*/
5107WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5108{
5109  assert(wand != (MagickWand *) NULL);
5110  assert(wand->signature == WandSignature);
5111  if (wand->debug != MagickFalse)
5112    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5113  if (wand->images == (Image *) NULL)
5114    {
5115      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5116        "ContainsNoImages","`%s'",wand->name);
5117      return(UndefinedInterlace);
5118    }
5119  return(wand->images->interlace);
5120}
5121
5122/*
5123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5124%                                                                             %
5125%                                                                             %
5126%                                                                             %
5127%   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             %
5128%                                                                             %
5129%                                                                             %
5130%                                                                             %
5131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5132%
5133%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5134%  sepcified image.
5135%
5136%  The format of the MagickGetImageInterpolateMethod method is:
5137%
5138%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5139%
5140%  A description of each parameter follows:
5141%
5142%    o wand: the magick wand.
5143%
5144*/
5145WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5146  MagickWand *wand)
5147{
5148  assert(wand != (MagickWand *) NULL);
5149  assert(wand->signature == WandSignature);
5150  if (wand->debug != MagickFalse)
5151    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5152  if (wand->images == (Image *) NULL)
5153    {
5154      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5155        "ContainsNoImages","`%s'",wand->name);
5156      return(UndefinedInterpolatePixel);
5157    }
5158  return(wand->images->interpolate);
5159}
5160
5161/*
5162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5163%                                                                             %
5164%                                                                             %
5165%                                                                             %
5166%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5167%                                                                             %
5168%                                                                             %
5169%                                                                             %
5170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5171%
5172%  MagickGetImageIterations() gets the image iterations.
5173%
5174%  The format of the MagickGetImageIterations method is:
5175%
5176%      size_t MagickGetImageIterations(MagickWand *wand)
5177%
5178%  A description of each parameter follows:
5179%
5180%    o wand: the magick wand.
5181%
5182*/
5183WandExport size_t MagickGetImageIterations(MagickWand *wand)
5184{
5185  assert(wand != (MagickWand *) NULL);
5186  assert(wand->signature == WandSignature);
5187  if (wand->debug != MagickFalse)
5188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5189  if (wand->images == (Image *) NULL)
5190    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5191  return(wand->images->iterations);
5192}
5193
5194/*
5195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5196%                                                                             %
5197%                                                                             %
5198%                                                                             %
5199%   M a g i c k G e t I m a g e L e n g t h                                   %
5200%                                                                             %
5201%                                                                             %
5202%                                                                             %
5203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5204%
5205%  MagickGetImageLength() returns the image length in bytes.
5206%
5207%  The format of the MagickGetImageLength method is:
5208%
5209%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5210%        MagickSizeType *length)
5211%
5212%  A description of each parameter follows:
5213%
5214%    o wand: the magick wand.
5215%
5216%    o length: the image length in bytes.
5217%
5218*/
5219WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5220  MagickSizeType *length)
5221{
5222  assert(wand != (MagickWand *) NULL);
5223  assert(wand->signature == WandSignature);
5224  if (wand->debug != MagickFalse)
5225    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5226  if (wand->images == (Image *) NULL)
5227    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5228  *length=GetBlobSize(wand->images);
5229  return(MagickTrue);
5230}
5231
5232/*
5233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5234%                                                                             %
5235%                                                                             %
5236%                                                                             %
5237%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5238%                                                                             %
5239%                                                                             %
5240%                                                                             %
5241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5242%
5243%  MagickGetImageMatteColor() returns the image matte color.
5244%
5245%  The format of the MagickGetImageMatteColor method is:
5246%
5247%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5248%        PixelWand *matte_color)
5249%
5250%  A description of each parameter follows:
5251%
5252%    o wand: the magick wand.
5253%
5254%    o matte_color: Return the matte color.
5255%
5256*/
5257WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5258  PixelWand *matte_color)
5259{
5260  assert(wand != (MagickWand *) NULL);
5261  assert(wand->signature == WandSignature);
5262  if (wand->debug != MagickFalse)
5263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5264  if (wand->images == (Image *) NULL)
5265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5266  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
5267  return(MagickTrue);
5268}
5269
5270/*
5271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5272%                                                                             %
5273%                                                                             %
5274%                                                                             %
5275%   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                         %
5276%                                                                             %
5277%                                                                             %
5278%                                                                             %
5279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5280%
5281%  MagickGetImageOrientation() returns the image orientation.
5282%
5283%  The format of the MagickGetImageOrientation method is:
5284%
5285%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5286%
5287%  A description of each parameter follows:
5288%
5289%    o wand: the magick wand.
5290%
5291*/
5292WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5293{
5294  assert(wand != (MagickWand *) NULL);
5295  assert(wand->signature == WandSignature);
5296  if (wand->debug != MagickFalse)
5297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5298  if (wand->images == (Image *) NULL)
5299    {
5300      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5301        "ContainsNoImages","`%s'",wand->name);
5302      return(UndefinedOrientation);
5303    }
5304  return(wand->images->orientation);
5305}
5306
5307/*
5308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5309%                                                                             %
5310%                                                                             %
5311%                                                                             %
5312%   M a g i c k G e t I m a g e P a g e                                       %
5313%                                                                             %
5314%                                                                             %
5315%                                                                             %
5316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5317%
5318%  MagickGetImagePage() returns the page geometry associated with the image.
5319%
5320%  The format of the MagickGetImagePage method is:
5321%
5322%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5323%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5324%
5325%  A description of each parameter follows:
5326%
5327%    o wand: the magick wand.
5328%
5329%    o width: the page width.
5330%
5331%    o height: the page height.
5332%
5333%    o x: the page x-offset.
5334%
5335%    o y: the page y-offset.
5336%
5337*/
5338WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5339  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5340{
5341  assert(wand != (const MagickWand *) NULL);
5342  assert(wand->signature == WandSignature);
5343  if (wand->debug != MagickFalse)
5344    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5345  if (wand->images == (Image *) NULL)
5346    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5347  *width=wand->images->page.width;
5348  *height=wand->images->page.height;
5349  *x=wand->images->page.x;
5350  *y=wand->images->page.y;
5351  return(MagickTrue);
5352}
5353
5354/*
5355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5356%                                                                             %
5357%                                                                             %
5358%                                                                             %
5359%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5360%                                                                             %
5361%                                                                             %
5362%                                                                             %
5363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5364%
5365%  MagickGetImagePixelColor() returns the color of the specified pixel.
5366%
5367%  The format of the MagickGetImagePixelColor method is:
5368%
5369%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5370%        const ssize_t x,const ssize_t y,PixelWand *color)
5371%
5372%  A description of each parameter follows:
5373%
5374%    o wand: the magick wand.
5375%
5376%    o x,y: the pixel offset into the image.
5377%
5378%    o color: Return the colormap color in this wand.
5379%
5380*/
5381WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5382  const ssize_t x,const ssize_t y,PixelWand *color)
5383{
5384  register const Quantum
5385    *p;
5386
5387  CacheView
5388    *image_view;
5389
5390  assert(wand != (MagickWand *) NULL);
5391  assert(wand->signature == WandSignature);
5392  if (wand->debug != MagickFalse)
5393    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5394  if (wand->images == (Image *) NULL)
5395    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5396  image_view=AcquireCacheView(wand->images);
5397  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5398  if (p == (const Quantum *) NULL)
5399    {
5400      image_view=DestroyCacheView(image_view);
5401      return(MagickFalse);
5402    }
5403  PixelSetQuantumPixel(wand->images,p,color);
5404  image_view=DestroyCacheView(image_view);
5405  return(MagickTrue);
5406}
5407
5408/*
5409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5410%                                                                             %
5411%                                                                             %
5412%                                                                             %
5413+   M a g i c k G e t I m a g e R a n g e                                     %
5414%                                                                             %
5415%                                                                             %
5416%                                                                             %
5417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5418%
5419%  MagickGetImageRange() gets the pixel range for the image.
5420%
5421%  The format of the MagickGetImageRange method is:
5422%
5423%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5424%        double *maxima)
5425%
5426%  A description of each parameter follows:
5427%
5428%    o wand: the magick wand.
5429%
5430%    o minima:  The minimum pixel value for the specified channel(s).
5431%
5432%    o maxima:  The maximum pixel value for the specified channel(s).
5433%
5434*/
5435WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5436  double *minima,double *maxima)
5437{
5438  MagickBooleanType
5439    status;
5440
5441  assert(wand != (MagickWand *) NULL);
5442  assert(wand->signature == WandSignature);
5443  if (wand->debug != MagickFalse)
5444    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5445  if (wand->images == (Image *) NULL)
5446    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5447  status=GetImageRange(wand->images,minima,maxima,wand->exception);
5448  return(status);
5449}
5450
5451/*
5452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5453%                                                                             %
5454%                                                                             %
5455%                                                                             %
5456%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5457%                                                                             %
5458%                                                                             %
5459%                                                                             %
5460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5461%
5462%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5463%
5464%  The format of the MagickGetImageRedPrimary method is:
5465%
5466%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5467%        double *y)
5468%
5469%  A description of each parameter follows:
5470%
5471%    o wand: the magick wand.
5472%
5473%    o x: the chromaticity red primary x-point.
5474%
5475%    o y: the chromaticity red primary y-point.
5476%
5477*/
5478WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5479  double *x,double *y)
5480{
5481  assert(wand != (MagickWand *) NULL);
5482  assert(wand->signature == WandSignature);
5483  if (wand->debug != MagickFalse)
5484    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5485  if (wand->images == (Image *) NULL)
5486    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5487  *x=wand->images->chromaticity.red_primary.x;
5488  *y=wand->images->chromaticity.red_primary.y;
5489  return(MagickTrue);
5490}
5491
5492/*
5493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5494%                                                                             %
5495%                                                                             %
5496%                                                                             %
5497%   M a g i c k G e t I m a g e R e g i o n                                   %
5498%                                                                             %
5499%                                                                             %
5500%                                                                             %
5501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5502%
5503%  MagickGetImageRegion() extracts a region of the image and returns it as a
5504%  a new wand.
5505%
5506%  The format of the MagickGetImageRegion method is:
5507%
5508%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5509%        const size_t width,const size_t height,const ssize_t x,
5510%        const ssize_t y)
5511%
5512%  A description of each parameter follows:
5513%
5514%    o wand: the magick wand.
5515%
5516%    o width: the region width.
5517%
5518%    o height: the region height.
5519%
5520%    o x: the region x offset.
5521%
5522%    o y: the region y offset.
5523%
5524*/
5525WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5526  const size_t width,const size_t height,const ssize_t x,
5527  const ssize_t y)
5528{
5529  Image
5530    *region_image;
5531
5532  RectangleInfo
5533    region;
5534
5535  assert(wand != (MagickWand *) NULL);
5536  assert(wand->signature == WandSignature);
5537  if (wand->debug != MagickFalse)
5538    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5539  if (wand->images == (Image *) NULL)
5540    return((MagickWand *) NULL);
5541  region.width=width;
5542  region.height=height;
5543  region.x=x;
5544  region.y=y;
5545  region_image=CropImage(wand->images,&region,wand->exception);
5546  if (region_image == (Image *) NULL)
5547    return((MagickWand *) NULL);
5548  return(CloneMagickWandFromImages(wand,region_image));
5549}
5550
5551/*
5552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5553%                                                                             %
5554%                                                                             %
5555%                                                                             %
5556%   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                 %
5557%                                                                             %
5558%                                                                             %
5559%                                                                             %
5560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5561%
5562%  MagickGetImageRenderingIntent() gets the image rendering intent.
5563%
5564%  The format of the MagickGetImageRenderingIntent method is:
5565%
5566%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5567%
5568%  A description of each parameter follows:
5569%
5570%    o wand: the magick wand.
5571%
5572*/
5573WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5574{
5575  assert(wand != (MagickWand *) NULL);
5576  assert(wand->signature == WandSignature);
5577  if (wand->debug != MagickFalse)
5578    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5579  if (wand->images == (Image *) NULL)
5580    {
5581      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5582        "ContainsNoImages","`%s'",wand->name);
5583      return(UndefinedIntent);
5584    }
5585  return((RenderingIntent) wand->images->rendering_intent);
5586}
5587
5588/*
5589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5590%                                                                             %
5591%                                                                             %
5592%                                                                             %
5593%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5594%                                                                             %
5595%                                                                             %
5596%                                                                             %
5597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5598%
5599%  MagickGetImageResolution() gets the image X and Y resolution.
5600%
5601%  The format of the MagickGetImageResolution method is:
5602%
5603%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5604%        double *y)
5605%
5606%  A description of each parameter follows:
5607%
5608%    o wand: the magick wand.
5609%
5610%    o x: the image x-resolution.
5611%
5612%    o y: the image y-resolution.
5613%
5614*/
5615WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5616  double *x,double *y)
5617{
5618  assert(wand != (MagickWand *) NULL);
5619  assert(wand->signature == WandSignature);
5620  if (wand->debug != MagickFalse)
5621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5622  if (wand->images == (Image *) NULL)
5623    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5624  *x=wand->images->x_resolution;
5625  *y=wand->images->y_resolution;
5626  return(MagickTrue);
5627}
5628
5629/*
5630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5631%                                                                             %
5632%                                                                             %
5633%                                                                             %
5634%   M a g i c k G e t I m a g e S c e n e                                     %
5635%                                                                             %
5636%                                                                             %
5637%                                                                             %
5638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5639%
5640%  MagickGetImageScene() gets the image scene.
5641%
5642%  The format of the MagickGetImageScene method is:
5643%
5644%      size_t MagickGetImageScene(MagickWand *wand)
5645%
5646%  A description of each parameter follows:
5647%
5648%    o wand: the magick wand.
5649%
5650*/
5651WandExport size_t MagickGetImageScene(MagickWand *wand)
5652{
5653  assert(wand != (MagickWand *) NULL);
5654  assert(wand->signature == WandSignature);
5655  if (wand->debug != MagickFalse)
5656    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5657  if (wand->images == (Image *) NULL)
5658    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5659  return(wand->images->scene);
5660}
5661
5662/*
5663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5664%                                                                             %
5665%                                                                             %
5666%                                                                             %
5667%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5668%                                                                             %
5669%                                                                             %
5670%                                                                             %
5671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5672%
5673%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5674%  pixel stream.
5675%
5676%  The format of the MagickGetImageSignature method is:
5677%
5678%      const char MagickGetImageSignature(MagickWand *wand)
5679%
5680%  A description of each parameter follows:
5681%
5682%    o wand: the magick wand.
5683%
5684*/
5685WandExport char *MagickGetImageSignature(MagickWand *wand)
5686{
5687  const char
5688    *value;
5689
5690  MagickBooleanType
5691    status;
5692
5693  assert(wand != (MagickWand *) NULL);
5694  assert(wand->signature == WandSignature);
5695  if (wand->debug != MagickFalse)
5696    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5697  if (wand->images == (Image *) NULL)
5698    {
5699      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5700        "ContainsNoImages","`%s'",wand->name);
5701      return((char *) NULL);
5702    }
5703  status=SignatureImage(wand->images);
5704  if (status == MagickFalse)
5705    InheritException(wand->exception,&wand->images->exception);
5706  value=GetImageProperty(wand->images,"signature");
5707  if (value != (const char *) NULL)
5708    return(AcquireString(value));
5709  InheritException(wand->exception,&wand->images->exception);
5710  return((char *) NULL);
5711}
5712
5713/*
5714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5715%                                                                             %
5716%                                                                             %
5717%                                                                             %
5718%   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                   %
5719%                                                                             %
5720%                                                                             %
5721%                                                                             %
5722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5723%
5724%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5725%
5726%  The format of the MagickGetImageTicksPerSecond method is:
5727%
5728%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5729%
5730%  A description of each parameter follows:
5731%
5732%    o wand: the magick wand.
5733%
5734*/
5735WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5736{
5737  assert(wand != (MagickWand *) NULL);
5738  assert(wand->signature == WandSignature);
5739  if (wand->debug != MagickFalse)
5740    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5741  if (wand->images == (Image *) NULL)
5742    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5743  return((size_t) wand->images->ticks_per_second);
5744}
5745
5746/*
5747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5748%                                                                             %
5749%                                                                             %
5750%                                                                             %
5751%   M a g i c k G e t I m a g e T y p e                                       %
5752%                                                                             %
5753%                                                                             %
5754%                                                                             %
5755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5756%
5757%  MagickGetImageType() gets the potential image type:
5758%
5759%        Bilevel        Grayscale       GrayscaleMatte
5760%        Palette        PaletteMatte    TrueColor
5761%        TrueColorMatte ColorSeparation ColorSeparationMatte
5762%
5763%  To ensure the image type matches its potential, use MagickSetImageType():
5764%
5765%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5766%
5767%  The format of the MagickGetImageType method is:
5768%
5769%      ImageType MagickGetImageType(MagickWand *wand)
5770%
5771%  A description of each parameter follows:
5772%
5773%    o wand: the magick wand.
5774%
5775*/
5776WandExport ImageType MagickGetImageType(MagickWand *wand)
5777{
5778  assert(wand != (MagickWand *) NULL);
5779  assert(wand->signature == WandSignature);
5780  if (wand->debug != MagickFalse)
5781    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5782  if (wand->images == (Image *) NULL)
5783    {
5784      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5785        "ContainsNoImages","`%s'",wand->name);
5786      return(UndefinedType);
5787    }
5788  return(GetImageType(wand->images,wand->exception));
5789}
5790
5791/*
5792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5793%                                                                             %
5794%                                                                             %
5795%                                                                             %
5796%   M a g i c k G e t I m a g e U n i t s                                     %
5797%                                                                             %
5798%                                                                             %
5799%                                                                             %
5800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5801%
5802%  MagickGetImageUnits() gets the image units of resolution.
5803%
5804%  The format of the MagickGetImageUnits method is:
5805%
5806%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5807%
5808%  A description of each parameter follows:
5809%
5810%    o wand: the magick wand.
5811%
5812*/
5813WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5814{
5815  assert(wand != (MagickWand *) NULL);
5816  assert(wand->signature == WandSignature);
5817  if (wand->debug != MagickFalse)
5818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5819  if (wand->images == (Image *) NULL)
5820    {
5821      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5822        "ContainsNoImages","`%s'",wand->name);
5823      return(UndefinedResolution);
5824    }
5825  return(wand->images->units);
5826}
5827
5828/*
5829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5830%                                                                             %
5831%                                                                             %
5832%                                                                             %
5833%   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           %
5834%                                                                             %
5835%                                                                             %
5836%                                                                             %
5837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838%
5839%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5840%  sepcified image.
5841%
5842%  The format of the MagickGetImageVirtualPixelMethod method is:
5843%
5844%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5845%
5846%  A description of each parameter follows:
5847%
5848%    o wand: the magick wand.
5849%
5850*/
5851WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5852{
5853  assert(wand != (MagickWand *) NULL);
5854  assert(wand->signature == WandSignature);
5855  if (wand->debug != MagickFalse)
5856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5857  if (wand->images == (Image *) NULL)
5858    {
5859      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5860        "ContainsNoImages","`%s'",wand->name);
5861      return(UndefinedVirtualPixelMethod);
5862    }
5863  return(GetImageVirtualPixelMethod(wand->images));
5864}
5865
5866/*
5867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5868%                                                                             %
5869%                                                                             %
5870%                                                                             %
5871%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5872%                                                                             %
5873%                                                                             %
5874%                                                                             %
5875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5876%
5877%  MagickGetImageWhitePoint() returns the chromaticy white point.
5878%
5879%  The format of the MagickGetImageWhitePoint method is:
5880%
5881%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5882%        double *y)
5883%
5884%  A description of each parameter follows:
5885%
5886%    o wand: the magick wand.
5887%
5888%    o x: the chromaticity white x-point.
5889%
5890%    o y: the chromaticity white y-point.
5891%
5892*/
5893WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5894  double *x,double *y)
5895{
5896  assert(wand != (MagickWand *) NULL);
5897  assert(wand->signature == WandSignature);
5898  if (wand->debug != MagickFalse)
5899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5900  if (wand->images == (Image *) NULL)
5901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5902  *x=wand->images->chromaticity.white_point.x;
5903  *y=wand->images->chromaticity.white_point.y;
5904  return(MagickTrue);
5905}
5906
5907/*
5908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5909%                                                                             %
5910%                                                                             %
5911%                                                                             %
5912%   M a g i c k G e t I m a g e W i d t h                                     %
5913%                                                                             %
5914%                                                                             %
5915%                                                                             %
5916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5917%
5918%  MagickGetImageWidth() returns the image width.
5919%
5920%  The format of the MagickGetImageWidth method is:
5921%
5922%      size_t MagickGetImageWidth(MagickWand *wand)
5923%
5924%  A description of each parameter follows:
5925%
5926%    o wand: the magick wand.
5927%
5928*/
5929WandExport size_t MagickGetImageWidth(MagickWand *wand)
5930{
5931  assert(wand != (MagickWand *) NULL);
5932  assert(wand->signature == WandSignature);
5933  if (wand->debug != MagickFalse)
5934    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5935  if (wand->images == (Image *) NULL)
5936    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5937  return(wand->images->columns);
5938}
5939
5940/*
5941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5942%                                                                             %
5943%                                                                             %
5944%                                                                             %
5945%   M a g i c k G e t N u m b e r I m a g e s                                 %
5946%                                                                             %
5947%                                                                             %
5948%                                                                             %
5949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5950%
5951%  MagickGetNumberImages() returns the number of images associated with a
5952%  magick wand.
5953%
5954%  The format of the MagickGetNumberImages method is:
5955%
5956%      size_t MagickGetNumberImages(MagickWand *wand)
5957%
5958%  A description of each parameter follows:
5959%
5960%    o wand: the magick wand.
5961%
5962*/
5963WandExport size_t MagickGetNumberImages(MagickWand *wand)
5964{
5965  assert(wand != (MagickWand *) NULL);
5966  assert(wand->signature == WandSignature);
5967  if (wand->debug != MagickFalse)
5968    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5969  return(GetImageListLength(wand->images));
5970}
5971
5972/*
5973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5974%                                                                             %
5975%                                                                             %
5976%                                                                             %
5977%   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                 %
5978%                                                                             %
5979%                                                                             %
5980%                                                                             %
5981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982%
5983%  MagickGetImageTotalInkDensity() gets the image total ink density.
5984%
5985%  The format of the MagickGetImageTotalInkDensity method is:
5986%
5987%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5988%
5989%  A description of each parameter follows:
5990%
5991%    o wand: the magick wand.
5992%
5993*/
5994WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5995{
5996  assert(wand != (MagickWand *) NULL);
5997  assert(wand->signature == WandSignature);
5998  if (wand->debug != MagickFalse)
5999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6000  if (wand->images == (Image *) NULL)
6001    {
6002      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6003        "ContainsNoImages","`%s'",wand->name);
6004      return(0.0);
6005    }
6006  return(GetImageTotalInkDensity(wand->images));
6007}
6008
6009/*
6010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6011%                                                                             %
6012%                                                                             %
6013%                                                                             %
6014%   M a g i c k H a l d C l u t I m a g e                                     %
6015%                                                                             %
6016%                                                                             %
6017%                                                                             %
6018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6019%
6020%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6021%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6022%  dimensions.  Create it with the HALD coder.  You can apply any color
6023%  transformation to the Hald image and then use this method to apply the
6024%  transform to the image.
6025%
6026%  The format of the MagickHaldClutImage method is:
6027%
6028%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6029%        const MagickWand *hald_wand)
6030%      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6031%        const ChannelType channel,const MagickWand *hald_wand)
6032%
6033%  A description of each parameter follows:
6034%
6035%    o wand: the magick wand.
6036%
6037%    o hald_image: the hald CLUT image.
6038%
6039*/
6040
6041WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6042  const MagickWand *hald_wand)
6043{
6044  MagickBooleanType
6045    status;
6046
6047  status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6048  return(status);
6049}
6050
6051WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6052  const ChannelType channel,const MagickWand *hald_wand)
6053{
6054  MagickBooleanType
6055    status;
6056
6057  assert(wand != (MagickWand *) NULL);
6058  assert(wand->signature == WandSignature);
6059  if (wand->debug != MagickFalse)
6060    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6061  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6062    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6063  status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6064  if (status == MagickFalse)
6065    InheritException(wand->exception,&wand->images->exception);
6066  return(status);
6067}
6068
6069/*
6070%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6071%                                                                             %
6072%                                                                             %
6073%                                                                             %
6074%   M a g i c k H a s N e x t I m a g e                                       %
6075%                                                                             %
6076%                                                                             %
6077%                                                                             %
6078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6079%
6080%  MagickHasNextImage() returns MagickTrue if the wand has more images when
6081%  traversing the list in the forward direction
6082%
6083%  The format of the MagickHasNextImage method is:
6084%
6085%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6086%
6087%  A description of each parameter follows:
6088%
6089%    o wand: the magick wand.
6090%
6091*/
6092WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6093{
6094  assert(wand != (MagickWand *) NULL);
6095  assert(wand->signature == WandSignature);
6096  if (wand->debug != MagickFalse)
6097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6098  if (wand->images == (Image *) NULL)
6099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6100  if (GetNextImageInList(wand->images) == (Image *) NULL)
6101    return(MagickFalse);
6102  return(MagickTrue);
6103}
6104
6105/*
6106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6107%                                                                             %
6108%                                                                             %
6109%                                                                             %
6110%   M a g i c k H a s P r e v i o u s I m a g e                               %
6111%                                                                             %
6112%                                                                             %
6113%                                                                             %
6114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115%
6116%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6117%  traversing the list in the reverse direction
6118%
6119%  The format of the MagickHasPreviousImage method is:
6120%
6121%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6122%
6123%  A description of each parameter follows:
6124%
6125%    o wand: the magick wand.
6126%
6127*/
6128WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6129{
6130  assert(wand != (MagickWand *) NULL);
6131  assert(wand->signature == WandSignature);
6132  if (wand->debug != MagickFalse)
6133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6134  if (wand->images == (Image *) NULL)
6135    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6136  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6137    return(MagickFalse);
6138  return(MagickTrue);
6139}
6140
6141/*
6142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6143%                                                                             %
6144%                                                                             %
6145%                                                                             %
6146%   M a g i c k I d e n t i f y I m a g e                                     %
6147%                                                                             %
6148%                                                                             %
6149%                                                                             %
6150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6151%
6152%  MagickIdentifyImage() identifies an image by printing its attributes to the
6153%  file.  Attributes include the image width, height, size, and others.
6154%
6155%  The format of the MagickIdentifyImage method is:
6156%
6157%      const char *MagickIdentifyImage(MagickWand *wand)
6158%
6159%  A description of each parameter follows:
6160%
6161%    o wand: the magick wand.
6162%
6163*/
6164WandExport char *MagickIdentifyImage(MagickWand *wand)
6165{
6166  char
6167    *description,
6168    filename[MaxTextExtent];
6169
6170  FILE
6171    *file;
6172
6173  int
6174    unique_file;
6175
6176  assert(wand != (MagickWand *) NULL);
6177  assert(wand->signature == WandSignature);
6178  if (wand->debug != MagickFalse)
6179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6180  if (wand->images == (Image *) NULL)
6181    {
6182      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6183        "ContainsNoImages","`%s'",wand->name);
6184      return((char *) NULL);
6185    }
6186  description=(char *) NULL;
6187  unique_file=AcquireUniqueFileResource(filename);
6188  file=(FILE *) NULL;
6189  if (unique_file != -1)
6190    file=fdopen(unique_file,"wb");
6191  if ((unique_file == -1) || (file == (FILE *) NULL))
6192    {
6193      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6194        "UnableToCreateTemporaryFile","`%s'",wand->name);
6195      return((char *) NULL);
6196    }
6197  (void) IdentifyImage(wand->images,file,MagickTrue);
6198  (void) fclose(file);
6199  description=FileToString(filename,~0,wand->exception);
6200  (void) RelinquishUniqueFileResource(filename);
6201  return(description);
6202}
6203
6204/*
6205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6206%                                                                             %
6207%                                                                             %
6208%                                                                             %
6209%   M a g i c k I m p l o d e I m a g e                                       %
6210%                                                                             %
6211%                                                                             %
6212%                                                                             %
6213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6214%
6215%  MagickImplodeImage() creates a new image that is a copy of an existing
6216%  one with the image pixels "implode" by the specified percentage.  It
6217%  allocates the memory necessary for the new Image structure and returns a
6218%  pointer to the new image.
6219%
6220%  The format of the MagickImplodeImage method is:
6221%
6222%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6223%        const double radius)
6224%
6225%  A description of each parameter follows:
6226%
6227%    o wand: the magick wand.
6228%
6229%    o amount: Define the extent of the implosion.
6230%
6231*/
6232WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6233  const double amount)
6234{
6235  Image
6236    *implode_image;
6237
6238  assert(wand != (MagickWand *) NULL);
6239  assert(wand->signature == WandSignature);
6240  if (wand->debug != MagickFalse)
6241    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6242  if (wand->images == (Image *) NULL)
6243    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6244  implode_image=ImplodeImage(wand->images,amount,wand->exception);
6245  if (implode_image == (Image *) NULL)
6246    return(MagickFalse);
6247  ReplaceImageInList(&wand->images,implode_image);
6248  return(MagickTrue);
6249}
6250
6251/*
6252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6253%                                                                             %
6254%                                                                             %
6255%                                                                             %
6256%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6257%                                                                             %
6258%                                                                             %
6259%                                                                             %
6260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6261%
6262%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6263%  location you specify.  The method returns MagickFalse on success otherwise
6264%  MagickTrue if an error is encountered.  The pixel data can be either char,
6265%  short int, int, ssize_t, float, or double in the order specified by map.
6266%
6267%  Suppose your want to upload the first scanline of a 640x480 image from
6268%  character data in red-green-blue order:
6269%
6270%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6271%
6272%  The format of the MagickImportImagePixels method is:
6273%
6274%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6275%        const ssize_t x,const ssize_t y,const size_t columns,
6276%        const size_t rows,const char *map,const StorageType storage,
6277%        const void *pixels)
6278%
6279%  A description of each parameter follows:
6280%
6281%    o wand: the magick wand.
6282%
6283%    o x, y, columns, rows:  These values define the perimeter of a region
6284%      of pixels you want to define.
6285%
6286%    o map:  This string reflects the expected ordering of the pixel array.
6287%      It can be any combination or order of R = red, G = green, B = blue,
6288%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6289%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6290%      P = pad.
6291%
6292%    o storage: Define the data type of the pixels.  Float and double types are
6293%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6294%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6295%      or DoublePixel.
6296%
6297%    o pixels: This array of values contain the pixel components as defined by
6298%      map and type.  You must preallocate this array where the expected
6299%      length varies depending on the values of width, height, map, and type.
6300%
6301*/
6302WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6303  const ssize_t x,const ssize_t y,const size_t columns,
6304  const size_t rows,const char *map,const StorageType storage,
6305  const void *pixels)
6306{
6307  MagickBooleanType
6308    status;
6309
6310  assert(wand != (MagickWand *) NULL);
6311  assert(wand->signature == WandSignature);
6312  if (wand->debug != MagickFalse)
6313    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6314  if (wand->images == (Image *) NULL)
6315    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6316  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6317  if (status == MagickFalse)
6318    InheritException(wand->exception,&wand->images->exception);
6319  return(status);
6320}
6321
6322/*
6323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6324%                                                                             %
6325%                                                                             %
6326%                                                                             %
6327%   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       %
6328%                                                                             %
6329%                                                                             %
6330%                                                                             %
6331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6332%
6333%  MagickInverseFourierTransformImage() implements the inverse discrete
6334%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6335%  imaginary image pair.
6336%
6337%  The format of the MagickInverseFourierTransformImage method is:
6338%
6339%      MagickBooleanType MagickInverseFourierTransformImage(
6340%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6341%        const MagickBooleanType magnitude)
6342%
6343%  A description of each parameter follows:
6344%
6345%    o magnitude_wand: the magnitude or real wand.
6346%
6347%    o phase_wand: the phase or imaginary wand.
6348%
6349%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6350%      imaginary image pair.
6351%
6352*/
6353WandExport MagickBooleanType MagickInverseFourierTransformImage(
6354  MagickWand *magnitude_wand,MagickWand *phase_wand,
6355  const MagickBooleanType magnitude)
6356{
6357  Image
6358    *inverse_image;
6359
6360  MagickWand
6361    *wand;
6362
6363  assert(magnitude_wand != (MagickWand *) NULL);
6364  assert(magnitude_wand->signature == WandSignature);
6365  if (magnitude_wand->debug != MagickFalse)
6366    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6367      magnitude_wand->name);
6368  wand=magnitude_wand;
6369  if (magnitude_wand->images == (Image *) NULL)
6370    ThrowWandException(WandError,"ContainsNoImages",
6371      magnitude_wand->name);
6372  assert(phase_wand != (MagickWand *) NULL);
6373  assert(phase_wand->signature == WandSignature);
6374  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6375    phase_wand->images,magnitude,wand->exception);
6376  if (inverse_image == (Image *) NULL)
6377    return(MagickFalse);
6378  ReplaceImageInList(&wand->images,inverse_image);
6379  return(MagickTrue);
6380}
6381
6382/*
6383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6384%                                                                             %
6385%                                                                             %
6386%                                                                             %
6387%   M a g i c k L a b e l I m a g e                                           %
6388%                                                                             %
6389%                                                                             %
6390%                                                                             %
6391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6392%
6393%  MagickLabelImage() adds a label to your image.
6394%
6395%  The format of the MagickLabelImage method is:
6396%
6397%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6398%
6399%  A description of each parameter follows:
6400%
6401%    o wand: the magick wand.
6402%
6403%    o label: the image label.
6404%
6405*/
6406WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6407  const char *label)
6408{
6409  MagickBooleanType
6410    status;
6411
6412  assert(wand != (MagickWand *) NULL);
6413  assert(wand->signature == WandSignature);
6414  if (wand->debug != MagickFalse)
6415    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6416  if (wand->images == (Image *) NULL)
6417    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6418  status=SetImageProperty(wand->images,"label",label);
6419  if (status == MagickFalse)
6420    InheritException(wand->exception,&wand->images->exception);
6421  return(status);
6422}
6423
6424/*
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%                                                                             %
6427%                                                                             %
6428%                                                                             %
6429%   M a g i c k L e v e l I m a g e                                           %
6430%                                                                             %
6431%                                                                             %
6432%                                                                             %
6433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6434%
6435%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6436%  falling between specified white and black points to the full available
6437%  quantum range. The parameters provided represent the black, mid, and white
6438%  points. The black point specifies the darkest color in the image. Colors
6439%  darker than the black point are set to zero. Mid point specifies a gamma
6440%  correction to apply to the image.  White point specifies the lightest color
6441%  in the image. Colors brighter than the white point are set to the maximum
6442%  quantum value.
6443%
6444%  The format of the MagickLevelImage method is:
6445%
6446%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6447%        const double black_point,const double gamma,const double white_point)
6448%      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6449%        const ChannelType channel,const double black_point,const double gamma,
6450%        const double white_point)
6451%
6452%  A description of each parameter follows:
6453%
6454%    o wand: the magick wand.
6455%
6456%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6457%
6458%    o black_point: the black point.
6459%
6460%    o gamma: the gamma.
6461%
6462%    o white_point: the white point.
6463%
6464*/
6465
6466WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6467  const double black_point,const double gamma,const double white_point)
6468{
6469  MagickBooleanType
6470    status;
6471
6472  status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6473    white_point);
6474  return(status);
6475}
6476
6477WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6478  const ChannelType channel,const double black_point,const double gamma,
6479  const double white_point)
6480{
6481  MagickBooleanType
6482    status;
6483
6484  assert(wand != (MagickWand *) NULL);
6485  assert(wand->signature == WandSignature);
6486  if (wand->debug != MagickFalse)
6487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6488  if (wand->images == (Image *) NULL)
6489    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6490  status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6491  if (status == MagickFalse)
6492    InheritException(wand->exception,&wand->images->exception);
6493  return(status);
6494}
6495
6496/*
6497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6498%                                                                             %
6499%                                                                             %
6500%                                                                             %
6501%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6502%                                                                             %
6503%                                                                             %
6504%                                                                             %
6505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6506%
6507%  MagickLinearStretchImage() stretches with saturation the image intensity.
6508%
6509%  You can also reduce the influence of a particular channel with a gamma
6510%  value of 0.
6511%
6512%  The format of the MagickLinearStretchImage method is:
6513%
6514%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6515%        const double black_point,const double white_point)
6516%
6517%  A description of each parameter follows:
6518%
6519%    o wand: the magick wand.
6520%
6521%    o black_point: the black point.
6522%
6523%    o white_point: the white point.
6524%
6525*/
6526WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6527  const double black_point,const double white_point)
6528{
6529  MagickBooleanType
6530    status;
6531
6532  assert(wand != (MagickWand *) NULL);
6533  assert(wand->signature == WandSignature);
6534  if (wand->debug != MagickFalse)
6535    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6536  if (wand->images == (Image *) NULL)
6537    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6538  status=LinearStretchImage(wand->images,black_point,white_point);
6539  if (status == MagickFalse)
6540    InheritException(wand->exception,&wand->images->exception);
6541  return(status);
6542}
6543
6544/*
6545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6546%                                                                             %
6547%                                                                             %
6548%                                                                             %
6549%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6550%                                                                             %
6551%                                                                             %
6552%                                                                             %
6553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554%
6555%  MagickLiquidRescaleImage() rescales image with seam carving.
6556%
6557%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6558%        const size_t columns,const size_t rows,
6559%        const double delta_x,const double rigidity)
6560%
6561%  A description of each parameter follows:
6562%
6563%    o wand: the magick wand.
6564%
6565%    o columns: the number of columns in the scaled image.
6566%
6567%    o rows: the number of rows in the scaled image.
6568%
6569%    o delta_x: maximum seam transversal step (0 means straight seams).
6570%
6571%    o rigidity: introduce a bias for non-straight seams (typically 0).
6572%
6573*/
6574WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6575  const size_t columns,const size_t rows,const double delta_x,
6576  const double rigidity)
6577{
6578  Image
6579    *rescale_image;
6580
6581  assert(wand != (MagickWand *) NULL);
6582  assert(wand->signature == WandSignature);
6583  if (wand->debug != MagickFalse)
6584    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6585  if (wand->images == (Image *) NULL)
6586    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6587  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6588    rigidity,wand->exception);
6589  if (rescale_image == (Image *) NULL)
6590    return(MagickFalse);
6591  ReplaceImageInList(&wand->images,rescale_image);
6592  return(MagickTrue);
6593}
6594
6595/*
6596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6597%                                                                             %
6598%                                                                             %
6599%                                                                             %
6600%   M a g i c k M a g n i f y I m a g e                                       %
6601%                                                                             %
6602%                                                                             %
6603%                                                                             %
6604%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6605%
6606%  MagickMagnifyImage() is a convenience method that scales an image
6607%  proportionally to twice its original size.
6608%
6609%  The format of the MagickMagnifyImage method is:
6610%
6611%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6612%
6613%  A description of each parameter follows:
6614%
6615%    o wand: the magick wand.
6616%
6617*/
6618WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6619{
6620  Image
6621    *magnify_image;
6622
6623  assert(wand != (MagickWand *) NULL);
6624  assert(wand->signature == WandSignature);
6625  if (wand->debug != MagickFalse)
6626    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6627  if (wand->images == (Image *) NULL)
6628    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6629  magnify_image=MagnifyImage(wand->images,wand->exception);
6630  if (magnify_image == (Image *) NULL)
6631    return(MagickFalse);
6632  ReplaceImageInList(&wand->images,magnify_image);
6633  return(MagickTrue);
6634}
6635
6636/*
6637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6638%                                                                             %
6639%                                                                             %
6640%                                                                             %
6641%   M a g i c k M e r g e I m a g e L a y e r s                               %
6642%                                                                             %
6643%                                                                             %
6644%                                                                             %
6645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6646%
6647%  MagickMergeImageLayers() composes all the image layers from the current
6648%  given image onward to produce a single image of the merged layers.
6649%
6650%  The inital canvas's size depends on the given ImageLayerMethod, and is
6651%  initialized using the first images background color.  The images
6652%  are then compositied onto that image in sequence using the given
6653%  composition that has been assigned to each individual image.
6654%
6655%  The format of the MagickMergeImageLayers method is:
6656%
6657%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6658%        const ImageLayerMethod method)
6659%
6660%  A description of each parameter follows:
6661%
6662%    o wand: the magick wand.
6663%
6664%    o method: the method of selecting the size of the initial canvas.
6665%
6666%        MergeLayer: Merge all layers onto a canvas just large enough
6667%           to hold all the actual images. The virtual canvas of the
6668%           first image is preserved but otherwise ignored.
6669%
6670%        FlattenLayer: Use the virtual canvas size of first image.
6671%           Images which fall outside this canvas is clipped.
6672%           This can be used to 'fill out' a given virtual canvas.
6673%
6674%        MosaicLayer: Start with the virtual canvas of the first image,
6675%           enlarging left and right edges to contain all images.
6676%           Images with negative offsets will be clipped.
6677%
6678*/
6679WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6680  const ImageLayerMethod method)
6681{
6682  Image
6683    *mosaic_image;
6684
6685  assert(wand != (MagickWand *) NULL);
6686  assert(wand->signature == WandSignature);
6687  if (wand->debug != MagickFalse)
6688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6689  if (wand->images == (Image *) NULL)
6690    return((MagickWand *) NULL);
6691  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6692  if (mosaic_image == (Image *) NULL)
6693    return((MagickWand *) NULL);
6694  return(CloneMagickWandFromImages(wand,mosaic_image));
6695}
6696
6697/*
6698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6699%                                                                             %
6700%                                                                             %
6701%                                                                             %
6702%   M a g i c k M i n i f y I m a g e                                         %
6703%                                                                             %
6704%                                                                             %
6705%                                                                             %
6706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6707%
6708%  MagickMinifyImage() is a convenience method that scales an image
6709%  proportionally to one-half its original size
6710%
6711%  The format of the MagickMinifyImage method is:
6712%
6713%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6714%
6715%  A description of each parameter follows:
6716%
6717%    o wand: the magick wand.
6718%
6719*/
6720WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6721{
6722  Image
6723    *minify_image;
6724
6725  assert(wand != (MagickWand *) NULL);
6726  assert(wand->signature == WandSignature);
6727  if (wand->debug != MagickFalse)
6728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6729  if (wand->images == (Image *) NULL)
6730    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6731  minify_image=MinifyImage(wand->images,wand->exception);
6732  if (minify_image == (Image *) NULL)
6733    return(MagickFalse);
6734  ReplaceImageInList(&wand->images,minify_image);
6735  return(MagickTrue);
6736}
6737
6738/*
6739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6740%                                                                             %
6741%                                                                             %
6742%                                                                             %
6743%   M a g i c k M o d u l a t e I m a g e                                     %
6744%                                                                             %
6745%                                                                             %
6746%                                                                             %
6747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6748%
6749%  MagickModulateImage() lets you control the brightness, saturation, and hue
6750%  of an image.  Hue is the percentage of absolute rotation from the current
6751%  position.  For example 50 results in a counter-clockwise rotation of 90
6752%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6753%  both resulting in a rotation of 180 degrees.
6754%
6755%  To increase the color brightness by 20% and decrease the color saturation by
6756%  10% and leave the hue unchanged, use: 120,90,100.
6757%
6758%  The format of the MagickModulateImage method is:
6759%
6760%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6761%        const double brightness,const double saturation,const double hue)
6762%
6763%  A description of each parameter follows:
6764%
6765%    o wand: the magick wand.
6766%
6767%    o brightness: the percent change in brighness.
6768%
6769%    o saturation: the percent change in saturation.
6770%
6771%    o hue: the percent change in hue.
6772%
6773*/
6774WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6775  const double brightness,const double saturation,const double hue)
6776{
6777  char
6778    modulate[MaxTextExtent];
6779
6780  MagickBooleanType
6781    status;
6782
6783  assert(wand != (MagickWand *) NULL);
6784  assert(wand->signature == WandSignature);
6785  if (wand->debug != MagickFalse)
6786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6787  if (wand->images == (Image *) NULL)
6788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6789  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6790    brightness,saturation,hue);
6791  status=ModulateImage(wand->images,modulate);
6792  if (status == MagickFalse)
6793    InheritException(wand->exception,&wand->images->exception);
6794  return(status);
6795}
6796
6797/*
6798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6799%                                                                             %
6800%                                                                             %
6801%                                                                             %
6802%   M a g i c k M o n t a g e I m a g e                                       %
6803%                                                                             %
6804%                                                                             %
6805%                                                                             %
6806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6807%
6808%  MagickMontageImage() creates a composite image by combining several
6809%  separate images. The images are tiled on the composite image with the name
6810%  of the image optionally appearing just below the individual tile.
6811%
6812%  The format of the MagickMontageImage method is:
6813%
6814%      MagickWand *MagickMontageImage(MagickWand *wand,
6815%        const DrawingWand drawing_wand,const char *tile_geometry,
6816%        const char *thumbnail_geometry,const MontageMode mode,
6817%        const char *frame)
6818%
6819%  A description of each parameter follows:
6820%
6821%    o wand: the magick wand.
6822%
6823%    o drawing_wand: the drawing wand.  The font name, size, and color are
6824%      obtained from this wand.
6825%
6826%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6827%
6828%    o thumbnail_geometry: Preferred image size and border size of each
6829%      thumbnail (e.g. 120x120+4+3>).
6830%
6831%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6832%
6833%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6834%      The frame color is that of the thumbnail's matte color.
6835%
6836*/
6837WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6838  const DrawingWand *drawing_wand,const char *tile_geometry,
6839  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6840{
6841  char
6842    *font;
6843
6844  Image
6845    *montage_image;
6846
6847  MontageInfo
6848    *montage_info;
6849
6850  PixelWand
6851    *pixel_wand;
6852
6853  assert(wand != (MagickWand *) NULL);
6854  assert(wand->signature == WandSignature);
6855  if (wand->debug != MagickFalse)
6856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6857  if (wand->images == (Image *) NULL)
6858    return((MagickWand *) NULL);
6859  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6860  switch (mode)
6861  {
6862    case FrameMode:
6863    {
6864      (void) CloneString(&montage_info->frame,"15x15+3+3");
6865      montage_info->shadow=MagickTrue;
6866      break;
6867    }
6868    case UnframeMode:
6869    {
6870      montage_info->frame=(char *) NULL;
6871      montage_info->shadow=MagickFalse;
6872      montage_info->border_width=0;
6873      break;
6874    }
6875    case ConcatenateMode:
6876    {
6877      montage_info->frame=(char *) NULL;
6878      montage_info->shadow=MagickFalse;
6879      (void) CloneString(&montage_info->geometry,"+0+0");
6880      montage_info->border_width=0;
6881      break;
6882    }
6883    default:
6884      break;
6885  }
6886  font=DrawGetFont(drawing_wand);
6887  if (font != (char *) NULL)
6888    (void) CloneString(&montage_info->font,font);
6889  if (frame != (char *) NULL)
6890    (void) CloneString(&montage_info->frame,frame);
6891  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6892  pixel_wand=NewPixelWand();
6893  DrawGetFillColor(drawing_wand,pixel_wand);
6894  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6895  DrawGetStrokeColor(drawing_wand,pixel_wand);
6896  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6897  pixel_wand=DestroyPixelWand(pixel_wand);
6898  if (thumbnail_geometry != (char *) NULL)
6899    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6900  if (tile_geometry != (char *) NULL)
6901    (void) CloneString(&montage_info->tile,tile_geometry);
6902  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6903    wand->exception);
6904  montage_info=DestroyMontageInfo(montage_info);
6905  if (montage_image == (Image *) NULL)
6906    return((MagickWand *) NULL);
6907  return(CloneMagickWandFromImages(wand,montage_image));
6908}
6909
6910/*
6911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6912%                                                                             %
6913%                                                                             %
6914%                                                                             %
6915%   M a g i c k M o r p h I m a g e s                                         %
6916%                                                                             %
6917%                                                                             %
6918%                                                                             %
6919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6920%
6921%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6922%  and size are linearly interpolated to give the appearance of a
6923%  meta-morphosis from one image to the next.
6924%
6925%  The format of the MagickMorphImages method is:
6926%
6927%      MagickWand *MagickMorphImages(MagickWand *wand,
6928%        const size_t number_frames)
6929%
6930%  A description of each parameter follows:
6931%
6932%    o wand: the magick wand.
6933%
6934%    o number_frames: the number of in-between images to generate.
6935%
6936*/
6937WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6938  const size_t number_frames)
6939{
6940  Image
6941    *morph_image;
6942
6943  assert(wand != (MagickWand *) NULL);
6944  assert(wand->signature == WandSignature);
6945  if (wand->debug != MagickFalse)
6946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6947  if (wand->images == (Image *) NULL)
6948    return((MagickWand *) NULL);
6949  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6950  if (morph_image == (Image *) NULL)
6951    return((MagickWand *) NULL);
6952  return(CloneMagickWandFromImages(wand,morph_image));
6953}
6954
6955/*
6956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6957%                                                                             %
6958%                                                                             %
6959%                                                                             %
6960%   M a g i c k M o r p h o l o g y I m a g e                                 %
6961%                                                                             %
6962%                                                                             %
6963%                                                                             %
6964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6965%
6966%  MagickMorphologyImage() applies a user supplied kernel to the image
6967%  according to the given mophology method.
6968%
6969%  The format of the MagickMorphologyImage method is:
6970%
6971%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6972%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6973%      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
6974%        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
6975%        KernelInfo *kernel)
6976%
6977%  A description of each parameter follows:
6978%
6979%    o wand: the magick wand.
6980%
6981%    o channel: the image channel(s).
6982%
6983%    o method: the morphology method to be applied.
6984%
6985%    o iterations: apply the operation this many times (or no change).
6986%      A value of -1 means loop until no change found.  How this is applied
6987%      may depend on the morphology method.  Typically this is a value of 1.
6988%
6989%    o kernel: An array of doubles representing the morphology kernel.
6990%
6991*/
6992
6993WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6994  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6995{
6996  MagickBooleanType
6997    status;
6998
6999  status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7000    kernel);
7001  return(status);
7002}
7003
7004WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7005  const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7006  KernelInfo *kernel)
7007{
7008  Image
7009    *morphology_image;
7010
7011  assert(wand != (MagickWand *) NULL);
7012  assert(wand->signature == WandSignature);
7013  if (wand->debug != MagickFalse)
7014    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7015  if (kernel == (const KernelInfo *) NULL)
7016    return(MagickFalse);
7017  if (wand->images == (Image *) NULL)
7018    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7019  morphology_image=MorphologyImageChannel(wand->images,channel,method,
7020    iterations,kernel,wand->exception);
7021  if (morphology_image == (Image *) NULL)
7022    return(MagickFalse);
7023  ReplaceImageInList(&wand->images,morphology_image);
7024  return(MagickTrue);
7025}
7026
7027/*
7028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7029%                                                                             %
7030%                                                                             %
7031%                                                                             %
7032%   M a g i c k M o t i o n B l u r I m a g e                                 %
7033%                                                                             %
7034%                                                                             %
7035%                                                                             %
7036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7037%
7038%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7039%  Gaussian operator of the given radius and standard deviation (sigma).
7040%  For reasonable results, radius should be larger than sigma.  Use a
7041%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7042%  Angle gives the angle of the blurring motion.
7043%
7044%  The format of the MagickMotionBlurImage method is:
7045%
7046%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7047%        const double radius,const double sigma,const double angle)
7048%      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7049%        const ChannelType channel,const double radius,const double sigma,
7050%        const double angle)
7051%
7052%  A description of each parameter follows:
7053%
7054%    o wand: the magick wand.
7055%
7056%    o channel: the image channel(s).
7057%
7058%    o radius: the radius of the Gaussian, in pixels, not counting
7059%      the center pixel.
7060%
7061%    o sigma: the standard deviation of the Gaussian, in pixels.
7062%
7063%    o angle: Apply the effect along this angle.
7064%
7065*/
7066
7067WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7068  const double radius,const double sigma,const double angle)
7069{
7070  MagickBooleanType
7071    status;
7072
7073  status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7074  return(status);
7075}
7076
7077WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7078  const ChannelType channel,const double radius,const double sigma,
7079  const double angle)
7080{
7081  Image
7082    *blur_image;
7083
7084  assert(wand != (MagickWand *) NULL);
7085  assert(wand->signature == WandSignature);
7086  if (wand->debug != MagickFalse)
7087    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7088  if (wand->images == (Image *) NULL)
7089    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7090  blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7091    wand->exception);
7092  if (blur_image == (Image *) NULL)
7093    return(MagickFalse);
7094  ReplaceImageInList(&wand->images,blur_image);
7095  return(MagickTrue);
7096}
7097
7098/*
7099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7100%                                                                             %
7101%                                                                             %
7102%                                                                             %
7103%   M a g i c k N e g a t e I m a g e                                         %
7104%                                                                             %
7105%                                                                             %
7106%                                                                             %
7107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7108%
7109%  MagickNegateImage() negates the colors in the reference image.  The
7110%  Grayscale option means that only grayscale values within the image are
7111%  negated.
7112%
7113%  You can also reduce the influence of a particular channel with a gamma
7114%  value of 0.
7115%
7116%  The format of the MagickNegateImage method is:
7117%
7118%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7119%        const MagickBooleanType gray)
7120%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7121%        const ChannelType channel,const MagickBooleanType gray)
7122%
7123%  A description of each parameter follows:
7124%
7125%    o wand: the magick wand.
7126%
7127%    o channel: the image channel(s).
7128%
7129%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7130%
7131*/
7132
7133WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7134  const MagickBooleanType gray)
7135{
7136  MagickBooleanType
7137    status;
7138
7139  status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7140  return(status);
7141}
7142
7143WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7144  const ChannelType channel,const MagickBooleanType gray)
7145{
7146  MagickBooleanType
7147    status;
7148
7149  assert(wand != (MagickWand *) NULL);
7150  assert(wand->signature == WandSignature);
7151  if (wand->debug != MagickFalse)
7152    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7153  if (wand->images == (Image *) NULL)
7154    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7155  status=NegateImageChannel(wand->images,channel,gray);
7156  if (status == MagickFalse)
7157    InheritException(wand->exception,&wand->images->exception);
7158  return(status);
7159}
7160
7161/*
7162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7163%                                                                             %
7164%                                                                             %
7165%                                                                             %
7166%   M a g i c k N e w I m a g e                                               %
7167%                                                                             %
7168%                                                                             %
7169%                                                                             %
7170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7171%
7172%  MagickNewImage() adds a blank image canvas of the specified size and
7173%  background color to the wand.
7174%
7175%  The format of the MagickNewImage method is:
7176%
7177%      MagickBooleanType MagickNewImage(MagickWand *wand,
7178%        const size_t columns,const size_t rows,
7179%        const PixelWand *background)
7180%
7181%  A description of each parameter follows:
7182%
7183%    o wand: the magick wand.
7184%
7185%    o width: the image width.
7186%
7187%    o height: the image height.
7188%
7189%    o background: the image color.
7190%
7191*/
7192WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7193  const size_t width,const size_t height,
7194  const PixelWand *background)
7195{
7196  Image
7197    *images;
7198
7199  PixelInfo
7200    pixel;
7201
7202  assert(wand != (MagickWand *) NULL);
7203  assert(wand->signature == WandSignature);
7204  if (wand->debug != MagickFalse)
7205    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7206  PixelGetMagickColor(background,&pixel);
7207  images=NewMagickImage(wand->image_info,width,height,&pixel);
7208  if (images == (Image *) NULL)
7209    return(MagickFalse);
7210  if (images->exception.severity != UndefinedException)
7211    InheritException(wand->exception,&images->exception);
7212  return(InsertImageInWand(wand,images));
7213}
7214
7215/*
7216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7217%                                                                             %
7218%                                                                             %
7219%                                                                             %
7220%   M a g i c k N e x t I m a g e                                             %
7221%                                                                             %
7222%                                                                             %
7223%                                                                             %
7224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7225%
7226%  MagickNextImage() associates the next image in the image list with a magick
7227%  wand.
7228%
7229%  The format of the MagickNextImage method is:
7230%
7231%      MagickBooleanType MagickNextImage(MagickWand *wand)
7232%
7233%  A description of each parameter follows:
7234%
7235%    o wand: the magick wand.
7236%
7237*/
7238WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7239{
7240  assert(wand != (MagickWand *) NULL);
7241  assert(wand->signature == WandSignature);
7242  if (wand->debug != MagickFalse)
7243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7244  if (wand->images == (Image *) NULL)
7245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7246  if (wand->pend != MagickFalse)
7247    {
7248      wand->pend=MagickFalse;
7249      return(MagickTrue);
7250    }
7251  if (GetNextImageInList(wand->images) == (Image *) NULL)
7252    {
7253      wand->pend=MagickTrue;
7254      return(MagickFalse);
7255    }
7256  wand->images=GetNextImageInList(wand->images);
7257  return(MagickTrue);
7258}
7259
7260/*
7261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7262%                                                                             %
7263%                                                                             %
7264%                                                                             %
7265%   M a g i c k N o r m a l i z e I m a g e                                   %
7266%                                                                             %
7267%                                                                             %
7268%                                                                             %
7269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7270%
7271%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7272%  the pixels color to span the entire range of colors available
7273%
7274%  You can also reduce the influence of a particular channel with a gamma
7275%  value of 0.
7276%
7277%  The format of the MagickNormalizeImage method is:
7278%
7279%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7280%      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7281%        const ChannelType channel)
7282%
7283%  A description of each parameter follows:
7284%
7285%    o wand: the magick wand.
7286%
7287%    o channel: the image channel(s).
7288%
7289*/
7290
7291WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7292{
7293  MagickBooleanType
7294    status;
7295
7296  status=MagickNormalizeImageChannel(wand,DefaultChannels);
7297  return(status);
7298}
7299
7300WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7301  const ChannelType channel)
7302{
7303  MagickBooleanType
7304    status;
7305
7306  assert(wand != (MagickWand *) NULL);
7307  assert(wand->signature == WandSignature);
7308  if (wand->debug != MagickFalse)
7309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7310  if (wand->images == (Image *) NULL)
7311    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7312  status=NormalizeImageChannel(wand->images,channel);
7313  if (status == MagickFalse)
7314    InheritException(wand->exception,&wand->images->exception);
7315  return(status);
7316}
7317
7318/*
7319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7320%                                                                             %
7321%                                                                             %
7322%                                                                             %
7323%   M a g i c k O i l P a i n t I m a g e                                     %
7324%                                                                             %
7325%                                                                             %
7326%                                                                             %
7327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7328%
7329%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7330%  painting.  Each pixel is replaced by the most frequent color occurring
7331%  in a circular region defined by radius.
7332%
7333%  The format of the MagickOilPaintImage method is:
7334%
7335%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7336%        const double radius)
7337%
7338%  A description of each parameter follows:
7339%
7340%    o wand: the magick wand.
7341%
7342%    o radius: the radius of the circular neighborhood.
7343%
7344*/
7345WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7346  const double radius)
7347{
7348  Image
7349    *paint_image;
7350
7351  assert(wand != (MagickWand *) NULL);
7352  assert(wand->signature == WandSignature);
7353  if (wand->debug != MagickFalse)
7354    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7355  if (wand->images == (Image *) NULL)
7356    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7357  paint_image=OilPaintImage(wand->images,radius,wand->exception);
7358  if (paint_image == (Image *) NULL)
7359    return(MagickFalse);
7360  ReplaceImageInList(&wand->images,paint_image);
7361  return(MagickTrue);
7362}
7363
7364/*
7365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7366%                                                                             %
7367%                                                                             %
7368%                                                                             %
7369%   M a g i c k O p a q u e P a i n t I m a g e                               %
7370%                                                                             %
7371%                                                                             %
7372%                                                                             %
7373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7374%
7375%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7376%  defined by fill.
7377%
7378%  The format of the MagickOpaquePaintImage method is:
7379%
7380%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7381%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7382%        const MagickBooleanType invert)
7383%      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7384%        const ChannelType channel,const PixelWand *target,
7385%        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7386%
7387%  A description of each parameter follows:
7388%
7389%    o wand: the magick wand.
7390%
7391%    o channel: the channel(s).
7392%
7393%    o target: Change this target color to the fill color within the image.
7394%
7395%    o fill: the fill pixel wand.
7396%
7397%    o fuzz: By default target must match a particular pixel color
7398%      exactly.  However, in many cases two colors may differ by a small amount.
7399%      The fuzz member of image defines how much tolerance is acceptable to
7400%      consider two colors as the same.  For example, set fuzz to 10 and the
7401%      color red at intensities of 100 and 102 respectively are now interpreted
7402%      as the same color for the purposes of the floodfill.
7403%
7404%    o invert: paint any pixel that does not match the target color.
7405%
7406*/
7407
7408WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7409  const PixelWand *target,const PixelWand *fill,const double fuzz,
7410  const MagickBooleanType invert)
7411{
7412  MagickBooleanType
7413    status;
7414
7415  status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7416    invert);
7417  return(status);
7418}
7419
7420WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7421  const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7422  const double fuzz,const MagickBooleanType invert)
7423{
7424  MagickBooleanType
7425    status;
7426
7427  PixelInfo
7428    fill_pixel,
7429    target_pixel;
7430
7431  assert(wand != (MagickWand *) NULL);
7432  assert(wand->signature == WandSignature);
7433  if (wand->debug != MagickFalse)
7434    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7435  if (wand->images == (Image *) NULL)
7436    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7437  PixelGetMagickColor(target,&target_pixel);
7438  PixelGetMagickColor(fill,&fill_pixel);
7439  wand->images->fuzz=fuzz;
7440  status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7441    &fill_pixel,invert);
7442  if (status == MagickFalse)
7443    InheritException(wand->exception,&wand->images->exception);
7444  return(status);
7445}
7446
7447/*
7448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7449%                                                                             %
7450%                                                                             %
7451%                                                                             %
7452%   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                         %
7453%                                                                             %
7454%                                                                             %
7455%                                                                             %
7456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7457%
7458%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7459%  previous image in the sequence.  From this it attempts to select the
7460%  smallest cropped image to replace each frame, while preserving the results
7461%  of the animation.
7462%
7463%  The format of the MagickOptimizeImageLayers method is:
7464%
7465%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7466%
7467%  A description of each parameter follows:
7468%
7469%    o wand: the magick wand.
7470%
7471*/
7472WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7473{
7474  Image
7475    *optimize_image;
7476
7477  assert(wand != (MagickWand *) NULL);
7478  assert(wand->signature == WandSignature);
7479  if (wand->debug != MagickFalse)
7480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7481  if (wand->images == (Image *) NULL)
7482    return((MagickWand *) NULL);
7483  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7484  if (optimize_image == (Image *) NULL)
7485    return((MagickWand *) NULL);
7486  return(CloneMagickWandFromImages(wand,optimize_image));
7487}
7488
7489/*
7490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7491%                                                                             %
7492%                                                                             %
7493%                                                                             %
7494%     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                   %
7495%                                                                             %
7496%                                                                             %
7497%                                                                             %
7498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7499%
7500%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7501%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7502%  which can be different for different channels, according to the input
7503%  arguments.
7504%
7505%  The format of the MagickOrderedPosterizeImage method is:
7506%
7507%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7508%        const char *threshold_map)
7509%      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7510%        const ChannelType channel,const char *threshold_map)
7511%
7512%  A description of each parameter follows:
7513%
7514%    o image: the image.
7515%
7516%    o channel: the channel or channels to be thresholded.
7517%
7518%    o threshold_map: A string containing the name of the threshold dither
7519%      map to use, followed by zero or more numbers representing the number of
7520%      color levels tho dither between.
7521%
7522%      Any level number less than 2 is equivalent to 2, and means only binary
7523%      dithering will be applied to each color channel.
7524%
7525%      No numbers also means a 2 level (bitmap) dither will be applied to all
7526%      channels, while a single number is the number of levels applied to each
7527%      channel in sequence.  More numbers will be applied in turn to each of
7528%      the color channels.
7529%
7530%      For example: "o3x3,6" generates a 6 level posterization of the image
7531%      with a ordered 3x3 diffused pixel dither being applied between each
7532%      level. While checker,8,8,4 will produce a 332 colormaped image with
7533%      only a single checkerboard hash pattern (50% grey) between each color
7534%      level, to basically double the number of color levels with a bare
7535%      minimim of dithering.
7536%
7537*/
7538
7539WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7540  const char *threshold_map)
7541{
7542  MagickBooleanType
7543    status;
7544
7545  status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7546  return(status);
7547}
7548
7549WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7550  MagickWand *wand,const ChannelType channel,const char *threshold_map)
7551{
7552  MagickBooleanType
7553    status;
7554
7555  assert(wand != (MagickWand *) NULL);
7556  assert(wand->signature == WandSignature);
7557  if (wand->debug != MagickFalse)
7558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7559  if (wand->images == (Image *) NULL)
7560    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7561  status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7562    wand->exception);
7563  return(status);
7564}
7565
7566/*
7567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7568%                                                                             %
7569%                                                                             %
7570%                                                                             %
7571%   M a g i c k P i n g I m a g e                                             %
7572%                                                                             %
7573%                                                                             %
7574%                                                                             %
7575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7576%
7577%  MagickPingImage() is like MagickReadImage() except the only valid
7578%  information returned is the image width, height, size, and format.  It
7579%  is designed to efficiently obtain this information from a file without
7580%  reading the entire image sequence into memory.
7581%
7582%  The format of the MagickPingImage method is:
7583%
7584%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7585%
7586%  A description of each parameter follows:
7587%
7588%    o wand: the magick wand.
7589%
7590%    o filename: the image filename.
7591%
7592*/
7593WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7594  const char *filename)
7595{
7596  Image
7597    *images;
7598
7599  ImageInfo
7600    *ping_info;
7601
7602  assert(wand != (MagickWand *) NULL);
7603  assert(wand->signature == WandSignature);
7604  if (wand->debug != MagickFalse)
7605    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7606  ping_info=CloneImageInfo(wand->image_info);
7607  if (filename != (const char *) NULL)
7608    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7609  images=PingImage(ping_info,wand->exception);
7610  ping_info=DestroyImageInfo(ping_info);
7611  if (images == (Image *) NULL)
7612    return(MagickFalse);
7613  return(InsertImageInWand(wand,images));
7614}
7615
7616/*
7617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7618%                                                                             %
7619%                                                                             %
7620%                                                                             %
7621%   M a g i c k P i n g I m a g e B l o b                                     %
7622%                                                                             %
7623%                                                                             %
7624%                                                                             %
7625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7626%
7627%  MagickPingImageBlob() pings an image or image sequence from a blob.
7628%
7629%  The format of the MagickPingImageBlob method is:
7630%
7631%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7632%        const void *blob,const size_t length)
7633%
7634%  A description of each parameter follows:
7635%
7636%    o wand: the magick wand.
7637%
7638%    o blob: the blob.
7639%
7640%    o length: the blob length.
7641%
7642*/
7643WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7644  const void *blob,const size_t length)
7645{
7646  Image
7647    *images;
7648
7649  ImageInfo
7650    *read_info;
7651
7652  assert(wand != (MagickWand *) NULL);
7653  assert(wand->signature == WandSignature);
7654  if (wand->debug != MagickFalse)
7655    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7656  read_info=CloneImageInfo(wand->image_info);
7657  SetImageInfoBlob(read_info,blob,length);
7658  images=PingImage(read_info,wand->exception);
7659  read_info=DestroyImageInfo(read_info);
7660  if (images == (Image *) NULL)
7661    return(MagickFalse);
7662  return(InsertImageInWand(wand,images));
7663}
7664
7665/*
7666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7667%                                                                             %
7668%                                                                             %
7669%                                                                             %
7670%   M a g i c k P i n g I m a g e F i l e                                     %
7671%                                                                             %
7672%                                                                             %
7673%                                                                             %
7674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7675%
7676%  MagickPingImageFile() pings an image or image sequence from an open file
7677%  descriptor.
7678%
7679%  The format of the MagickPingImageFile method is:
7680%
7681%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7682%
7683%  A description of each parameter follows:
7684%
7685%    o wand: the magick wand.
7686%
7687%    o file: the file descriptor.
7688%
7689*/
7690WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7691{
7692  Image
7693    *images;
7694
7695  ImageInfo
7696    *read_info;
7697
7698  assert(wand != (MagickWand *) NULL);
7699  assert(wand->signature == WandSignature);
7700  assert(file != (FILE *) NULL);
7701  if (wand->debug != MagickFalse)
7702    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7703  read_info=CloneImageInfo(wand->image_info);
7704  SetImageInfoFile(read_info,file);
7705  images=PingImage(read_info,wand->exception);
7706  read_info=DestroyImageInfo(read_info);
7707  if (images == (Image *) NULL)
7708    return(MagickFalse);
7709  return(InsertImageInWand(wand,images));
7710}
7711
7712/*
7713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7714%                                                                             %
7715%                                                                             %
7716%                                                                             %
7717%   M a g i c k P o l a r o i d I m a g e                                     %
7718%                                                                             %
7719%                                                                             %
7720%                                                                             %
7721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7722%
7723%  MagickPolaroidImage() simulates a Polaroid picture.
7724%
7725%  The format of the MagickPolaroidImage method is:
7726%
7727%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7728%        const DrawingWand *drawing_wand,const double angle)
7729%
7730%  A description of each parameter follows:
7731%
7732%    o wand: the magick wand.
7733%
7734%    o drawing_wand: the draw wand.
7735%
7736%    o angle: Apply the effect along this angle.
7737%
7738*/
7739WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7740  const DrawingWand *drawing_wand,const double angle)
7741{
7742  DrawInfo
7743    *draw_info;
7744
7745  Image
7746    *polaroid_image;
7747
7748  assert(wand != (MagickWand *) NULL);
7749  assert(wand->signature == WandSignature);
7750  if (wand->debug != MagickFalse)
7751    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7752  if (wand->images == (Image *) NULL)
7753    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7754  draw_info=PeekDrawingWand(drawing_wand);
7755  if (draw_info == (DrawInfo *) NULL)
7756    return(MagickFalse);
7757  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7758  if (polaroid_image == (Image *) NULL)
7759    return(MagickFalse);
7760  ReplaceImageInList(&wand->images,polaroid_image);
7761  return(MagickTrue);
7762}
7763
7764/*
7765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7766%                                                                             %
7767%                                                                             %
7768%                                                                             %
7769%   M a g i c k P o s t e r i z e I m a g e                                   %
7770%                                                                             %
7771%                                                                             %
7772%                                                                             %
7773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7774%
7775%  MagickPosterizeImage() reduces the image to a limited number of color level.
7776%
7777%  The format of the MagickPosterizeImage method is:
7778%
7779%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7780%        const unsigned levels,const MagickBooleanType dither)
7781%
7782%  A description of each parameter follows:
7783%
7784%    o wand: the magick wand.
7785%
7786%    o levels: Number of color levels allowed in each channel.  Very low values
7787%      (2, 3, or 4) have the most visible effect.
7788%
7789%    o dither: Set this integer value to something other than zero to dither
7790%      the mapped image.
7791%
7792*/
7793WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7794  const size_t levels,const MagickBooleanType dither)
7795{
7796  MagickBooleanType
7797    status;
7798
7799  assert(wand != (MagickWand *) NULL);
7800  assert(wand->signature == WandSignature);
7801  if (wand->debug != MagickFalse)
7802    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7803  if (wand->images == (Image *) NULL)
7804    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7805  status=PosterizeImage(wand->images,levels,dither);
7806  if (status == MagickFalse)
7807    InheritException(wand->exception,&wand->images->exception);
7808  return(status);
7809}
7810
7811/*
7812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7813%                                                                             %
7814%                                                                             %
7815%                                                                             %
7816%   M a g i c k P r e v i e w I m a g e s                                     %
7817%                                                                             %
7818%                                                                             %
7819%                                                                             %
7820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7821%
7822%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7823%  image processing operation applied at varying strengths.  This helpful
7824%  to quickly pin-point an appropriate parameter for an image processing
7825%  operation.
7826%
7827%  The format of the MagickPreviewImages method is:
7828%
7829%      MagickWand *MagickPreviewImages(MagickWand *wand,
7830%        const PreviewType preview)
7831%
7832%  A description of each parameter follows:
7833%
7834%    o wand: the magick wand.
7835%
7836%    o preview: the preview type.
7837%
7838*/
7839WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7840  const PreviewType preview)
7841{
7842  Image
7843    *preview_image;
7844
7845  assert(wand != (MagickWand *) NULL);
7846  assert(wand->signature == WandSignature);
7847  if (wand->debug != MagickFalse)
7848    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7849  if (wand->images == (Image *) NULL)
7850    return((MagickWand *) NULL);
7851  preview_image=PreviewImage(wand->images,preview,wand->exception);
7852  if (preview_image == (Image *) NULL)
7853    return((MagickWand *) NULL);
7854  return(CloneMagickWandFromImages(wand,preview_image));
7855}
7856
7857/*
7858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7859%                                                                             %
7860%                                                                             %
7861%                                                                             %
7862%   M a g i c k P r e v i o u s I m a g e                                     %
7863%                                                                             %
7864%                                                                             %
7865%                                                                             %
7866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7867%
7868%  MagickPreviousImage() assocates the previous image in an image list with
7869%  the magick wand.
7870%
7871%  The format of the MagickPreviousImage method is:
7872%
7873%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7874%
7875%  A description of each parameter follows:
7876%
7877%    o wand: the magick wand.
7878%
7879*/
7880WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7881{
7882  assert(wand != (MagickWand *) NULL);
7883  assert(wand->signature == WandSignature);
7884  if (wand->debug != MagickFalse)
7885    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7886  if (wand->images == (Image *) NULL)
7887    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7888  if (wand->pend != MagickFalse)
7889    {
7890      wand->pend=MagickFalse;
7891      return(MagickTrue);
7892    }
7893  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7894    {
7895      wand->pend=MagickTrue;
7896      return(MagickFalse);
7897    }
7898  wand->images=GetPreviousImageInList(wand->images);
7899  return(MagickTrue);
7900}
7901
7902/*
7903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7904%                                                                             %
7905%                                                                             %
7906%                                                                             %
7907%   M a g i c k Q u a n t i z e I m a g e                                     %
7908%                                                                             %
7909%                                                                             %
7910%                                                                             %
7911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7912%
7913%  MagickQuantizeImage() analyzes the colors within a reference image and
7914%  chooses a fixed number of colors to represent the image.  The goal of the
7915%  algorithm is to minimize the color difference between the input and output
7916%  image while minimizing the processing time.
7917%
7918%  The format of the MagickQuantizeImage method is:
7919%
7920%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7921%        const size_t number_colors,const ColorspaceType colorspace,
7922%        const size_t treedepth,const MagickBooleanType dither,
7923%        const MagickBooleanType measure_error)
7924%
7925%  A description of each parameter follows:
7926%
7927%    o wand: the magick wand.
7928%
7929%    o number_colors: the number of colors.
7930%
7931%    o colorspace: Perform color reduction in this colorspace, typically
7932%      RGBColorspace.
7933%
7934%    o treedepth: Normally, this integer value is zero or one.  A zero or
7935%      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
7936%      reference image with the least amount of memory and the fastest
7937%      computational speed.  In some cases, such as an image with low color
7938%      dispersion (a few number of colors), a value other than
7939%      Log4(number_colors) is required.  To expand the color tree completely,
7940%      use a value of 8.
7941%
7942%    o dither: A value other than zero distributes the difference between an
7943%      original image and the corresponding color reduced image to
7944%      neighboring pixels along a Hilbert curve.
7945%
7946%    o measure_error: A value other than zero measures the difference between
7947%      the original and quantized images.  This difference is the total
7948%      quantization error.  The error is computed by summing over all pixels
7949%      in an image the distance squared in RGB space between each reference
7950%      pixel value and its quantized value.
7951%
7952*/
7953WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7954  const size_t number_colors,const ColorspaceType colorspace,
7955  const size_t treedepth,const MagickBooleanType dither,
7956  const MagickBooleanType measure_error)
7957{
7958  MagickBooleanType
7959    status;
7960
7961  QuantizeInfo
7962    *quantize_info;
7963
7964  assert(wand != (MagickWand *) NULL);
7965  assert(wand->signature == WandSignature);
7966  if (wand->debug != MagickFalse)
7967    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7968  if (wand->images == (Image *) NULL)
7969    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7970  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7971  quantize_info->number_colors=number_colors;
7972  quantize_info->dither=dither;
7973  quantize_info->tree_depth=treedepth;
7974  quantize_info->colorspace=colorspace;
7975  quantize_info->measure_error=measure_error;
7976  status=QuantizeImage(quantize_info,wand->images);
7977  if (status == MagickFalse)
7978    InheritException(wand->exception,&wand->images->exception);
7979  quantize_info=DestroyQuantizeInfo(quantize_info);
7980  return(status);
7981}
7982
7983/*
7984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7985%                                                                             %
7986%                                                                             %
7987%                                                                             %
7988%   M a g i c k Q u a n t i z e I m a g e s                                   %
7989%                                                                             %
7990%                                                                             %
7991%                                                                             %
7992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7993%
7994%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7995%  chooses a fixed number of colors to represent the image.  The goal of the
7996%  algorithm is to minimize the color difference between the input and output
7997%  image while minimizing the processing time.
7998%
7999%  The format of the MagickQuantizeImages method is:
8000%
8001%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8002%        const size_t number_colors,const ColorspaceType colorspace,
8003%        const size_t treedepth,const MagickBooleanType dither,
8004%        const MagickBooleanType measure_error)
8005%
8006%  A description of each parameter follows:
8007%
8008%    o wand: the magick wand.
8009%
8010%    o number_colors: the number of colors.
8011%
8012%    o colorspace: Perform color reduction in this colorspace, typically
8013%      RGBColorspace.
8014%
8015%    o treedepth: Normally, this integer value is zero or one.  A zero or
8016%      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
8017%      reference image with the least amount of memory and the fastest
8018%      computational speed.  In some cases, such as an image with low color
8019%      dispersion (a few number of colors), a value other than
8020%      Log4(number_colors) is required.  To expand the color tree completely,
8021%      use a value of 8.
8022%
8023%    o dither: A value other than zero distributes the difference between an
8024%      original image and the corresponding color reduced algorithm to
8025%      neighboring pixels along a Hilbert curve.
8026%
8027%    o measure_error: A value other than zero measures the difference between
8028%      the original and quantized images.  This difference is the total
8029%      quantization error.  The error is computed by summing over all pixels
8030%      in an image the distance squared in RGB space between each reference
8031%      pixel value and its quantized value.
8032%
8033*/
8034WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8035  const size_t number_colors,const ColorspaceType colorspace,
8036  const size_t treedepth,const MagickBooleanType dither,
8037  const MagickBooleanType measure_error)
8038{
8039  MagickBooleanType
8040    status;
8041
8042  QuantizeInfo
8043    *quantize_info;
8044
8045  assert(wand != (MagickWand *) NULL);
8046  assert(wand->signature == WandSignature);
8047  if (wand->debug != MagickFalse)
8048    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8049  if (wand->images == (Image *) NULL)
8050    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8051  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8052  quantize_info->number_colors=number_colors;
8053  quantize_info->dither=dither;
8054  quantize_info->tree_depth=treedepth;
8055  quantize_info->colorspace=colorspace;
8056  quantize_info->measure_error=measure_error;
8057  status=QuantizeImages(quantize_info,wand->images);
8058  if (status == MagickFalse)
8059    InheritException(wand->exception,&wand->images->exception);
8060  quantize_info=DestroyQuantizeInfo(quantize_info);
8061  return(status);
8062}
8063
8064/*
8065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8066%                                                                             %
8067%                                                                             %
8068%                                                                             %
8069%   M a g i c k R a d i a l B l u r I m a g e                                 %
8070%                                                                             %
8071%                                                                             %
8072%                                                                             %
8073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8074%
8075%  MagickRadialBlurImage() radial blurs an image.
8076%
8077%  The format of the MagickRadialBlurImage method is:
8078%
8079%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8080%        const double angle)
8081%      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8082%        const ChannelType channel,const double angle)
8083%
8084%  A description of each parameter follows:
8085%
8086%    o wand: the magick wand.
8087%
8088%    o channel: the image channel(s).
8089%
8090%    o angle: the angle of the blur in degrees.
8091%
8092*/
8093WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8094  const double angle)
8095{
8096  MagickBooleanType
8097    status;
8098
8099  status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8100  return(status);
8101}
8102
8103WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8104  const ChannelType channel,const double angle)
8105{
8106  Image
8107    *blur_image;
8108
8109  assert(wand != (MagickWand *) NULL);
8110  assert(wand->signature == WandSignature);
8111  if (wand->debug != MagickFalse)
8112    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8113  if (wand->images == (Image *) NULL)
8114    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8115  blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8116    wand->exception);
8117  if (blur_image == (Image *) NULL)
8118    return(MagickFalse);
8119  ReplaceImageInList(&wand->images,blur_image);
8120  return(MagickTrue);
8121}
8122
8123/*
8124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8125%                                                                             %
8126%                                                                             %
8127%                                                                             %
8128%   M a g i c k R a i s e I m a g e                                           %
8129%                                                                             %
8130%                                                                             %
8131%                                                                             %
8132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8133%
8134%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8135%  by lightening and darkening the edges of the image.  Members width and
8136%  height of raise_info define the width of the vertical and horizontal
8137%  edge of the effect.
8138%
8139%  The format of the MagickRaiseImage method is:
8140%
8141%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8142%        const size_t width,const size_t height,const ssize_t x,
8143%        const ssize_t y,const MagickBooleanType raise)
8144%
8145%  A description of each parameter follows:
8146%
8147%    o wand: the magick wand.
8148%
8149%    o width,height,x,y:  Define the dimensions of the area to raise.
8150%
8151%    o raise: A value other than zero creates a 3-D raise effect,
8152%      otherwise it has a lowered effect.
8153%
8154*/
8155WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8156  const size_t width,const size_t height,const ssize_t x,
8157  const ssize_t y,const MagickBooleanType raise)
8158{
8159  MagickBooleanType
8160    status;
8161
8162  RectangleInfo
8163    raise_info;
8164
8165  assert(wand != (MagickWand *) NULL);
8166  assert(wand->signature == WandSignature);
8167  if (wand->debug != MagickFalse)
8168    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8169  if (wand->images == (Image *) NULL)
8170    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8171  raise_info.width=width;
8172  raise_info.height=height;
8173  raise_info.x=x;
8174  raise_info.y=y;
8175  status=RaiseImage(wand->images,&raise_info,raise);
8176  if (status == MagickFalse)
8177    InheritException(wand->exception,&wand->images->exception);
8178  return(status);
8179}
8180
8181/*
8182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8183%                                                                             %
8184%                                                                             %
8185%                                                                             %
8186%   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                       %
8187%                                                                             %
8188%                                                                             %
8189%                                                                             %
8190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8191%
8192%  MagickRandomThresholdImage() changes the value of individual pixels based on
8193%  the intensity of each pixel compared to threshold.  The result is a
8194%  high-contrast, two color image.
8195%
8196%  The format of the MagickRandomThresholdImage method is:
8197%
8198%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8199%        const double low,const double high)
8200%      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8201%        const ChannelType channel,const double low,const double high)
8202%
8203%  A description of each parameter follows:
8204%
8205%    o wand: the magick wand.
8206%
8207%    o channel: the image channel(s).
8208%
8209%    o low,high: Specify the high and low thresholds.  These values range from
8210%      0 to QuantumRange.
8211%
8212*/
8213
8214WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8215  const double low,const double high)
8216{
8217  MagickBooleanType
8218    status;
8219
8220  status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8221  return(status);
8222}
8223
8224WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8225  MagickWand *wand,const ChannelType channel,const double low,
8226  const double high)
8227{
8228  char
8229    threshold[MaxTextExtent];
8230
8231  MagickBooleanType
8232    status;
8233
8234  assert(wand != (MagickWand *) NULL);
8235  assert(wand->signature == WandSignature);
8236  if (wand->debug != MagickFalse)
8237    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8238  if (wand->images == (Image *) NULL)
8239    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8240  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8241  status=RandomThresholdImageChannel(wand->images,channel,threshold,
8242    wand->exception);
8243  if (status == MagickFalse)
8244    InheritException(wand->exception,&wand->images->exception);
8245  return(status);
8246}
8247
8248/*
8249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8250%                                                                             %
8251%                                                                             %
8252%                                                                             %
8253%   M a g i c k R e a d I m a g e                                             %
8254%                                                                             %
8255%                                                                             %
8256%                                                                             %
8257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8258%
8259%  MagickReadImage() reads an image or image sequence.  The images are inserted
8260%  at the current image pointer position.   Use MagickSetFirstIterator(),
8261%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8262%  image pointer position at the beginning of the image list, the end, or
8263%  anywhere in-between respectively.
8264%
8265%  The format of the MagickReadImage method is:
8266%
8267%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8268%
8269%  A description of each parameter follows:
8270%
8271%    o wand: the magick wand.
8272%
8273%    o filename: the image filename.
8274%
8275*/
8276WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8277  const char *filename)
8278{
8279  Image
8280    *images;
8281
8282  ImageInfo
8283    *read_info;
8284
8285  assert(wand != (MagickWand *) NULL);
8286  assert(wand->signature == WandSignature);
8287  if (wand->debug != MagickFalse)
8288    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8289  read_info=CloneImageInfo(wand->image_info);
8290  if (filename != (const char *) NULL)
8291    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8292  images=ReadImage(read_info,wand->exception);
8293  read_info=DestroyImageInfo(read_info);
8294  if (images == (Image *) NULL)
8295    return(MagickFalse);
8296  return(InsertImageInWand(wand,images));
8297}
8298
8299/*
8300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8301%                                                                             %
8302%                                                                             %
8303%                                                                             %
8304%   M a g i c k R e a d I m a g e B l o b                                     %
8305%                                                                             %
8306%                                                                             %
8307%                                                                             %
8308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8309%
8310%  MagickReadImageBlob() reads an image or image sequence from a blob.
8311%
8312%  The format of the MagickReadImageBlob method is:
8313%
8314%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8315%        const void *blob,const size_t length)
8316%
8317%  A description of each parameter follows:
8318%
8319%    o wand: the magick wand.
8320%
8321%    o blob: the blob.
8322%
8323%    o length: the blob length.
8324%
8325*/
8326WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8327  const void *blob,const size_t length)
8328{
8329  Image
8330    *images;
8331
8332  assert(wand != (MagickWand *) NULL);
8333  assert(wand->signature == WandSignature);
8334  if (wand->debug != MagickFalse)
8335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8336  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8337  if (images == (Image *) NULL)
8338    return(MagickFalse);
8339  return(InsertImageInWand(wand,images));
8340}
8341
8342/*
8343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8344%                                                                             %
8345%                                                                             %
8346%                                                                             %
8347%   M a g i c k R e a d I m a g e F i l e                                     %
8348%                                                                             %
8349%                                                                             %
8350%                                                                             %
8351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8352%
8353%  MagickReadImageFile() reads an image or image sequence from an open file
8354%  descriptor.
8355%
8356%  The format of the MagickReadImageFile method is:
8357%
8358%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8359%
8360%  A description of each parameter follows:
8361%
8362%    o wand: the magick wand.
8363%
8364%    o file: the file descriptor.
8365%
8366*/
8367WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8368{
8369  Image
8370    *images;
8371
8372  ImageInfo
8373    *read_info;
8374
8375  assert(wand != (MagickWand *) NULL);
8376  assert(wand->signature == WandSignature);
8377  assert(file != (FILE *) NULL);
8378  if (wand->debug != MagickFalse)
8379    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8380  read_info=CloneImageInfo(wand->image_info);
8381  SetImageInfoFile(read_info,file);
8382  images=ReadImage(read_info,wand->exception);
8383  read_info=DestroyImageInfo(read_info);
8384  if (images == (Image *) NULL)
8385    return(MagickFalse);
8386  return(InsertImageInWand(wand,images));
8387}
8388
8389/*
8390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8391%                                                                             %
8392%                                                                             %
8393%                                                                             %
8394%   M a g i c k R e m a p I m a g e                                           %
8395%                                                                             %
8396%                                                                             %
8397%                                                                             %
8398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8399%
8400%  MagickRemapImage() replaces the colors of an image with the closest color
8401%  from a reference image.
8402%
8403%  The format of the MagickRemapImage method is:
8404%
8405%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8406%        const MagickWand *remap_wand,const DitherMethod method)
8407%
8408%  A description of each parameter follows:
8409%
8410%    o wand: the magick wand.
8411%
8412%    o affinity: the affinity wand.
8413%
8414%    o method: choose from these dither methods: NoDitherMethod,
8415%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8416%
8417*/
8418WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8419  const MagickWand *remap_wand,const DitherMethod method)
8420{
8421  MagickBooleanType
8422    status;
8423
8424  QuantizeInfo
8425    *quantize_info;
8426
8427  assert(wand != (MagickWand *) NULL);
8428  assert(wand->signature == WandSignature);
8429  if (wand->debug != MagickFalse)
8430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8431  if ((wand->images == (Image *) NULL) ||
8432      (remap_wand->images == (Image *) NULL))
8433    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8434  quantize_info=AcquireQuantizeInfo(wand->image_info);
8435  quantize_info->dither_method=method;
8436  if (method == NoDitherMethod)
8437    quantize_info->dither=MagickFalse;
8438  status=RemapImage(quantize_info,wand->images,remap_wand->images);
8439  quantize_info=DestroyQuantizeInfo(quantize_info);
8440  if (status == MagickFalse)
8441    InheritException(wand->exception,&wand->images->exception);
8442  return(status);
8443}
8444
8445/*
8446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8447%                                                                             %
8448%                                                                             %
8449%                                                                             %
8450%   M a g i c k R e m o v e I m a g e                                         %
8451%                                                                             %
8452%                                                                             %
8453%                                                                             %
8454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8455%
8456%  MagickRemoveImage() removes an image from the image list.
8457%
8458%  The format of the MagickRemoveImage method is:
8459%
8460%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8461%
8462%  A description of each parameter follows:
8463%
8464%    o wand: the magick wand.
8465%
8466%    o insert: the splice wand.
8467%
8468*/
8469WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8470{
8471  assert(wand != (MagickWand *) NULL);
8472  assert(wand->signature == WandSignature);
8473  if (wand->debug != MagickFalse)
8474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8475  if (wand->images == (Image *) NULL)
8476    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8477  DeleteImageFromList(&wand->images);
8478  return(MagickTrue);
8479}
8480
8481/*
8482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8483%                                                                             %
8484%                                                                             %
8485%                                                                             %
8486%   M a g i c k R e s a m p l e I m a g e                                     %
8487%                                                                             %
8488%                                                                             %
8489%                                                                             %
8490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8491%
8492%  MagickResampleImage() resample image to desired resolution.
8493%
8494%    Bessel   Blackman   Box
8495%    Catrom   Cubic      Gaussian
8496%    Hanning  Hermite    Lanczos
8497%    Mitchell Point      Quandratic
8498%    Sinc     Triangle
8499%
8500%  Most of the filters are FIR (finite impulse response), however, Bessel,
8501%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8502%  are windowed (brought down to zero) with the Blackman filter.
8503%
8504%  The format of the MagickResampleImage method is:
8505%
8506%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8507%        const double x_resolution,const double y_resolution,
8508%        const FilterTypes filter,const double blur)
8509%
8510%  A description of each parameter follows:
8511%
8512%    o wand: the magick wand.
8513%
8514%    o x_resolution: the new image x resolution.
8515%
8516%    o y_resolution: the new image y resolution.
8517%
8518%    o filter: Image filter to use.
8519%
8520%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8521%
8522*/
8523WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8524  const double x_resolution,const double y_resolution,const FilterTypes filter,
8525  const double blur)
8526{
8527  Image
8528    *resample_image;
8529
8530  assert(wand != (MagickWand *) NULL);
8531  assert(wand->signature == WandSignature);
8532  if (wand->debug != MagickFalse)
8533    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8534  if (wand->images == (Image *) NULL)
8535    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8536  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8537    blur,wand->exception);
8538  if (resample_image == (Image *) NULL)
8539    return(MagickFalse);
8540  ReplaceImageInList(&wand->images,resample_image);
8541  return(MagickTrue);
8542}
8543
8544/*
8545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8546%                                                                             %
8547%                                                                             %
8548%                                                                             %
8549%   M a g i c k R e s e t I m a g e P a g e                                   %
8550%                                                                             %
8551%                                                                             %
8552%                                                                             %
8553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554%
8555%  MagickResetImagePage() resets the Wand page canvas and position.
8556%
8557%  The format of the MagickResetImagePage method is:
8558%
8559%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8560%        const char *page)
8561%
8562%  A description of each parameter follows:
8563%
8564%    o wand: the magick wand.
8565%
8566%    o page: the relative page specification.
8567%
8568*/
8569WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8570  const char *page)
8571{
8572  assert(wand != (MagickWand *) NULL);
8573  assert(wand->signature == WandSignature);
8574  if (wand->debug != MagickFalse)
8575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8576  if (wand->images == (Image *) NULL)
8577    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8578  if ((page == (char *) NULL) || (*page == '\0'))
8579    {
8580      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8581      return(MagickTrue);
8582    }
8583  return(ResetImagePage(wand->images,page));
8584}
8585
8586/*
8587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8588%                                                                             %
8589%                                                                             %
8590%                                                                             %
8591%   M a g i c k R e s i z e I m a g e                                         %
8592%                                                                             %
8593%                                                                             %
8594%                                                                             %
8595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596%
8597%  MagickResizeImage() scales an image to the desired dimensions with one of
8598%  these filters:
8599%
8600%    Bessel   Blackman   Box
8601%    Catrom   Cubic      Gaussian
8602%    Hanning  Hermite    Lanczos
8603%    Mitchell Point      Quandratic
8604%    Sinc     Triangle
8605%
8606%  Most of the filters are FIR (finite impulse response), however, Bessel,
8607%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8608%  are windowed (brought down to zero) with the Blackman filter.
8609%
8610%  The format of the MagickResizeImage method is:
8611%
8612%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8613%        const size_t columns,const size_t rows,
8614%        const FilterTypes filter,const double blur)
8615%
8616%  A description of each parameter follows:
8617%
8618%    o wand: the magick wand.
8619%
8620%    o columns: the number of columns in the scaled image.
8621%
8622%    o rows: the number of rows in the scaled image.
8623%
8624%    o filter: Image filter to use.
8625%
8626%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8627%
8628*/
8629WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8630  const size_t columns,const size_t rows,const FilterTypes filter,
8631  const double blur)
8632{
8633  Image
8634    *resize_image;
8635
8636  assert(wand != (MagickWand *) NULL);
8637  assert(wand->signature == WandSignature);
8638  if (wand->debug != MagickFalse)
8639    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8640  if (wand->images == (Image *) NULL)
8641    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8642  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8643    wand->exception);
8644  if (resize_image == (Image *) NULL)
8645    return(MagickFalse);
8646  ReplaceImageInList(&wand->images,resize_image);
8647  return(MagickTrue);
8648}
8649
8650/*
8651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8652%                                                                             %
8653%                                                                             %
8654%                                                                             %
8655%   M a g i c k R o l l I m a g e                                             %
8656%                                                                             %
8657%                                                                             %
8658%                                                                             %
8659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8660%
8661%  MagickRollImage() offsets an image as defined by x and y.
8662%
8663%  The format of the MagickRollImage method is:
8664%
8665%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8666%        const size_t y)
8667%
8668%  A description of each parameter follows:
8669%
8670%    o wand: the magick wand.
8671%
8672%    o x: the x offset.
8673%
8674%    o y: the y offset.
8675%
8676%
8677*/
8678WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8679  const ssize_t x,const ssize_t y)
8680{
8681  Image
8682    *roll_image;
8683
8684  assert(wand != (MagickWand *) NULL);
8685  assert(wand->signature == WandSignature);
8686  if (wand->debug != MagickFalse)
8687    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8688  if (wand->images == (Image *) NULL)
8689    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8690  roll_image=RollImage(wand->images,x,y,wand->exception);
8691  if (roll_image == (Image *) NULL)
8692    return(MagickFalse);
8693  ReplaceImageInList(&wand->images,roll_image);
8694  return(MagickTrue);
8695}
8696
8697/*
8698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8699%                                                                             %
8700%                                                                             %
8701%                                                                             %
8702%   M a g i c k R o t a t e I m a g e                                         %
8703%                                                                             %
8704%                                                                             %
8705%                                                                             %
8706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8707%
8708%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8709%  triangles left over from rotating the image are filled with the
8710%  background color.
8711%
8712%  The format of the MagickRotateImage method is:
8713%
8714%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8715%        const PixelWand *background,const double degrees)
8716%
8717%  A description of each parameter follows:
8718%
8719%    o wand: the magick wand.
8720%
8721%    o background: the background pixel wand.
8722%
8723%    o degrees: the number of degrees to rotate the image.
8724%
8725%
8726*/
8727WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8728  const PixelWand *background,const double degrees)
8729{
8730  Image
8731    *rotate_image;
8732
8733  assert(wand != (MagickWand *) NULL);
8734  assert(wand->signature == WandSignature);
8735  if (wand->debug != MagickFalse)
8736    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8737  if (wand->images == (Image *) NULL)
8738    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8739  PixelGetQuantumPacket(background,&wand->images->background_color);
8740  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8741  if (rotate_image == (Image *) NULL)
8742    return(MagickFalse);
8743  ReplaceImageInList(&wand->images,rotate_image);
8744  return(MagickTrue);
8745}
8746
8747/*
8748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8749%                                                                             %
8750%                                                                             %
8751%                                                                             %
8752%   M a g i c k S a m p l e I m a g e                                         %
8753%                                                                             %
8754%                                                                             %
8755%                                                                             %
8756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8757%
8758%  MagickSampleImage() scales an image to the desired dimensions with pixel
8759%  sampling.  Unlike other scaling methods, this method does not introduce
8760%  any additional color into the scaled image.
8761%
8762%  The format of the MagickSampleImage method is:
8763%
8764%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8765%        const size_t columns,const size_t rows)
8766%
8767%  A description of each parameter follows:
8768%
8769%    o wand: the magick wand.
8770%
8771%    o columns: the number of columns in the scaled image.
8772%
8773%    o rows: the number of rows in the scaled image.
8774%
8775%
8776*/
8777WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8778  const size_t columns,const size_t rows)
8779{
8780  Image
8781    *sample_image;
8782
8783  assert(wand != (MagickWand *) NULL);
8784  assert(wand->signature == WandSignature);
8785  if (wand->debug != MagickFalse)
8786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8787  if (wand->images == (Image *) NULL)
8788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8789  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8790  if (sample_image == (Image *) NULL)
8791    return(MagickFalse);
8792  ReplaceImageInList(&wand->images,sample_image);
8793  return(MagickTrue);
8794}
8795
8796/*
8797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8798%                                                                             %
8799%                                                                             %
8800%                                                                             %
8801%   M a g i c k S c a l e I m a g e                                           %
8802%                                                                             %
8803%                                                                             %
8804%                                                                             %
8805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8806%
8807%  MagickScaleImage() scales the size of an image to the given dimensions.
8808%
8809%  The format of the MagickScaleImage method is:
8810%
8811%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8812%        const size_t columns,const size_t rows)
8813%
8814%  A description of each parameter follows:
8815%
8816%    o wand: the magick wand.
8817%
8818%    o columns: the number of columns in the scaled image.
8819%
8820%    o rows: the number of rows in the scaled image.
8821%
8822%
8823*/
8824WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8825  const size_t columns,const size_t rows)
8826{
8827  Image
8828    *scale_image;
8829
8830  assert(wand != (MagickWand *) NULL);
8831  assert(wand->signature == WandSignature);
8832  if (wand->debug != MagickFalse)
8833    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8834  if (wand->images == (Image *) NULL)
8835    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8836  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8837  if (scale_image == (Image *) NULL)
8838    return(MagickFalse);
8839  ReplaceImageInList(&wand->images,scale_image);
8840  return(MagickTrue);
8841}
8842
8843/*
8844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8845%                                                                             %
8846%                                                                             %
8847%                                                                             %
8848%   M a g i c k S e g m e n t I m a g e                                       %
8849%                                                                             %
8850%                                                                             %
8851%                                                                             %
8852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8853%
8854%  MagickSegmentImage() segments an image by analyzing the histograms of the
8855%  color components and identifying units that are homogeneous with the fuzzy
8856%  C-means technique.
8857%
8858%  The format of the SegmentImage method is:
8859%
8860%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8861%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8862%        const double cluster_threshold,const double smooth_threshold)
8863%
8864%  A description of each parameter follows.
8865%
8866%    o wand: the wand.
8867%
8868%    o colorspace: the image colorspace.
8869%
8870%    o verbose:  Set to MagickTrue to print detailed information about the
8871%      identified classes.
8872%
8873%    o cluster_threshold:  This represents the minimum number of pixels
8874%      contained in a hexahedra before it can be considered valid (expressed as
8875%      a percentage).
8876%
8877%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8878%      derivative of the histogram.  As the value is increased, you can expect a
8879%      smoother second derivative.
8880%
8881*/
8882MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8883  const ColorspaceType colorspace,const MagickBooleanType verbose,
8884  const double cluster_threshold,const double smooth_threshold)
8885{
8886  MagickBooleanType
8887    status;
8888
8889  assert(wand != (MagickWand *) NULL);
8890  assert(wand->signature == WandSignature);
8891  if (wand->debug != MagickFalse)
8892    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8893  if (wand->images == (Image *) NULL)
8894    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8895  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8896    smooth_threshold);
8897  if (status == MagickFalse)
8898    InheritException(wand->exception,&wand->images->exception);
8899  return(status);
8900}
8901
8902/*
8903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8904%                                                                             %
8905%                                                                             %
8906%                                                                             %
8907%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8908%                                                                             %
8909%                                                                             %
8910%                                                                             %
8911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8912%
8913%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8914%  threshold. It is similar to the unsharpen mask that sharpens everything with
8915%  contrast above a certain threshold.
8916%
8917%  The format of the MagickSelectiveBlurImage method is:
8918%
8919%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8920%        const double radius,const double sigma,const double threshold)
8921%      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8922%        const ChannelType channel,const double radius,const double sigma,
8923%        const double threshold)
8924%
8925%  A description of each parameter follows:
8926%
8927%    o wand: the magick wand.
8928%
8929%    o channel: the image channel(s).
8930%
8931%    o radius: the radius of the gaussian, in pixels, not counting the center
8932%      pixel.
8933%
8934%    o sigma: the standard deviation of the gaussian, in pixels.
8935%
8936%    o threshold: only pixels within this contrast threshold are included
8937%      in the blur operation.
8938%
8939*/
8940
8941WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8942  const double radius,const double sigma,const double threshold)
8943{
8944  MagickBooleanType
8945    status;
8946
8947  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
8948    threshold);
8949  return(status);
8950}
8951
8952WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8953  const ChannelType channel,const double radius,const double sigma,
8954  const double threshold)
8955{
8956  Image
8957    *blur_image;
8958
8959  assert(wand != (MagickWand *) NULL);
8960  assert(wand->signature == WandSignature);
8961  if (wand->debug != MagickFalse)
8962    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8963  if (wand->images == (Image *) NULL)
8964    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8965  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
8966    threshold,wand->exception);
8967  if (blur_image == (Image *) NULL)
8968    return(MagickFalse);
8969  ReplaceImageInList(&wand->images,blur_image);
8970  return(MagickTrue);
8971}
8972
8973/*
8974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8975%                                                                             %
8976%                                                                             %
8977%                                                                             %
8978%   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                       %
8979%                                                                             %
8980%                                                                             %
8981%                                                                             %
8982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8983%
8984%  MagickSeparateImageChannel() separates a channel from the image and returns a
8985%  grayscale image.  A channel is a particular color component of each pixel
8986%  in the image.
8987%
8988%  The format of the MagickSeparateImageChannel method is:
8989%
8990%      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
8991%        const ChannelType channel)
8992%
8993%  A description of each parameter follows:
8994%
8995%    o wand: the magick wand.
8996%
8997%    o channel: the image channel(s).
8998%
8999*/
9000WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9001  const ChannelType channel)
9002{
9003  MagickBooleanType
9004    status;
9005
9006  assert(wand != (MagickWand *) NULL);
9007  assert(wand->signature == WandSignature);
9008  if (wand->debug != MagickFalse)
9009    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9010  if (wand->images == (Image *) NULL)
9011    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9012  status=SeparateImageChannel(wand->images,channel);
9013  if (status == MagickFalse)
9014    InheritException(wand->exception,&wand->images->exception);
9015  return(status);
9016}
9017
9018/*
9019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9020%                                                                             %
9021%                                                                             %
9022%                                                                             %
9023%     M a g i c k S e p i a T o n e I m a g e                                 %
9024%                                                                             %
9025%                                                                             %
9026%                                                                             %
9027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9028%
9029%  MagickSepiaToneImage() applies a special effect to the image, similar to the
9030%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9031%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9032%  threshold of 80% is a good starting point for a reasonable tone.
9033%
9034%  The format of the MagickSepiaToneImage method is:
9035%
9036%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9037%        const double threshold)
9038%
9039%  A description of each parameter follows:
9040%
9041%    o wand: the magick wand.
9042%
9043%    o threshold:  Define the extent of the sepia toning.
9044%
9045*/
9046WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9047  const double threshold)
9048{
9049  Image
9050    *sepia_image;
9051
9052  assert(wand != (MagickWand *) NULL);
9053  assert(wand->signature == WandSignature);
9054  if (wand->debug != MagickFalse)
9055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9056  if (wand->images == (Image *) NULL)
9057    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9058  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9059  if (sepia_image == (Image *) NULL)
9060    return(MagickFalse);
9061  ReplaceImageInList(&wand->images,sepia_image);
9062  return(MagickTrue);
9063}
9064
9065/*
9066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9067%                                                                             %
9068%                                                                             %
9069%                                                                             %
9070%   M a g i c k S e t I m a g e                                               %
9071%                                                                             %
9072%                                                                             %
9073%                                                                             %
9074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9075%
9076%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9077%  MagickNextImage(), MagickPreviousImage() with the images from the specified
9078%  wand.
9079%
9080%  The format of the MagickSetImage method is:
9081%
9082%      MagickBooleanType MagickSetImage(MagickWand *wand,
9083%        const MagickWand *set_wand)
9084%
9085%  A description of each parameter follows:
9086%
9087%    o wand: the magick wand.
9088%
9089%    o set_wand: the set_wand wand.
9090%
9091*/
9092WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9093  const MagickWand *set_wand)
9094{
9095  Image
9096    *images;
9097
9098  assert(wand != (MagickWand *) NULL);
9099  assert(wand->signature == WandSignature);
9100  if (wand->debug != MagickFalse)
9101    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9102  assert(set_wand != (MagickWand *) NULL);
9103  assert(set_wand->signature == WandSignature);
9104  if (wand->debug != MagickFalse)
9105    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9106  if (set_wand->images == (Image *) NULL)
9107    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9108  images=CloneImageList(set_wand->images,wand->exception);
9109  if (images == (Image *) NULL)
9110    return(MagickFalse);
9111  ReplaceImageInList(&wand->images,images);
9112  return(MagickTrue);
9113}
9114
9115/*
9116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9117%                                                                             %
9118%                                                                             %
9119%                                                                             %
9120%   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                       %
9121%                                                                             %
9122%                                                                             %
9123%                                                                             %
9124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9125%
9126%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9127%  alpha channel.
9128%
9129%  The format of the MagickSetImageAlphaChannel method is:
9130%
9131%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9132%        const AlphaChannelType alpha_type)
9133%
9134%  A description of each parameter follows:
9135%
9136%    o wand: the magick wand.
9137%
9138%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9139%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9140%
9141*/
9142WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9143  const AlphaChannelType alpha_type)
9144{
9145  assert(wand != (MagickWand *) NULL);
9146  assert(wand->signature == WandSignature);
9147  if (wand->debug != MagickFalse)
9148    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9149  if (wand->images == (Image *) NULL)
9150    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9151  return(SetImageAlphaChannel(wand->images,alpha_type));
9152}
9153
9154/*
9155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9156%                                                                             %
9157%                                                                             %
9158%                                                                             %
9159%   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                 %
9160%                                                                             %
9161%                                                                             %
9162%                                                                             %
9163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9164%
9165%  MagickSetImageBackgroundColor() sets the image background color.
9166%
9167%  The format of the MagickSetImageBackgroundColor method is:
9168%
9169%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9170%        const PixelWand *background)
9171%
9172%  A description of each parameter follows:
9173%
9174%    o wand: the magick wand.
9175%
9176%    o background: the background pixel wand.
9177%
9178*/
9179WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9180  const PixelWand *background)
9181{
9182  assert(wand != (MagickWand *) NULL);
9183  assert(wand->signature == WandSignature);
9184  if (wand->debug != MagickFalse)
9185    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9186  if (wand->images == (Image *) NULL)
9187    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9188  PixelGetQuantumPacket(background,&wand->images->background_color);
9189  return(MagickTrue);
9190}
9191
9192/*
9193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9194%                                                                             %
9195%                                                                             %
9196%                                                                             %
9197%   M a g i c k S e t I m a g e B i a s                                       %
9198%                                                                             %
9199%                                                                             %
9200%                                                                             %
9201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9202%
9203%  MagickSetImageBias() sets the image bias for any method that convolves an
9204%  image (e.g. MagickConvolveImage()).
9205%
9206%  The format of the MagickSetImageBias method is:
9207%
9208%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9209%        const double bias)
9210%
9211%  A description of each parameter follows:
9212%
9213%    o wand: the magick wand.
9214%
9215%    o bias: the image bias.
9216%
9217*/
9218WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9219  const double bias)
9220{
9221  assert(wand != (MagickWand *) NULL);
9222  assert(wand->signature == WandSignature);
9223  if (wand->debug != MagickFalse)
9224    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9225  if (wand->images == (Image *) NULL)
9226    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9227  wand->images->bias=bias;
9228  return(MagickTrue);
9229}
9230
9231/*
9232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9233%                                                                             %
9234%                                                                             %
9235%                                                                             %
9236%   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                         %
9237%                                                                             %
9238%                                                                             %
9239%                                                                             %
9240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9241%
9242%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9243%
9244%  The format of the MagickSetImageBluePrimary method is:
9245%
9246%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9247%        const double x,const double y)
9248%
9249%  A description of each parameter follows:
9250%
9251%    o wand: the magick wand.
9252%
9253%    o x: the blue primary x-point.
9254%
9255%    o y: the blue primary y-point.
9256%
9257*/
9258WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9259  const double x,const double y)
9260{
9261  assert(wand != (MagickWand *) NULL);
9262  assert(wand->signature == WandSignature);
9263  if (wand->debug != MagickFalse)
9264    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9265  if (wand->images == (Image *) NULL)
9266    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9267  wand->images->chromaticity.blue_primary.x=x;
9268  wand->images->chromaticity.blue_primary.y=y;
9269  return(MagickTrue);
9270}
9271
9272/*
9273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9274%                                                                             %
9275%                                                                             %
9276%                                                                             %
9277%   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                         %
9278%                                                                             %
9279%                                                                             %
9280%                                                                             %
9281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282%
9283%  MagickSetImageBorderColor() sets the image border color.
9284%
9285%  The format of the MagickSetImageBorderColor method is:
9286%
9287%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9288%        const PixelWand *border)
9289%
9290%  A description of each parameter follows:
9291%
9292%    o wand: the magick wand.
9293%
9294%    o border: the border pixel wand.
9295%
9296*/
9297WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9298  const PixelWand *border)
9299{
9300  assert(wand != (MagickWand *) NULL);
9301  assert(wand->signature == WandSignature);
9302  if (wand->debug != MagickFalse)
9303    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9304  if (wand->images == (Image *) NULL)
9305    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9306  PixelGetQuantumPacket(border,&wand->images->border_color);
9307  return(MagickTrue);
9308}
9309
9310/*
9311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9312%                                                                             %
9313%                                                                             %
9314%                                                                             %
9315%   M a g i c k S e t I m a g e C l i p M a s k                               %
9316%                                                                             %
9317%                                                                             %
9318%                                                                             %
9319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9320%
9321%  MagickSetImageClipMask() sets image clip mask.
9322%
9323%  The format of the MagickSetImageClipMask method is:
9324%
9325%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9326%        const MagickWand *clip_mask)
9327%
9328%  A description of each parameter follows:
9329%
9330%    o wand: the magick wand.
9331%
9332%    o clip_mask: the clip_mask wand.
9333%
9334*/
9335WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9336  const MagickWand *clip_mask)
9337{
9338  assert(wand != (MagickWand *) NULL);
9339  assert(wand->signature == WandSignature);
9340  if (wand->debug != MagickFalse)
9341    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9342  assert(clip_mask != (MagickWand *) NULL);
9343  assert(clip_mask->signature == WandSignature);
9344  if (wand->debug != MagickFalse)
9345    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9346  if (clip_mask->images == (Image *) NULL)
9347    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9348  return(SetImageClipMask(wand->images,clip_mask->images));
9349}
9350
9351/*
9352%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9353%                                                                             %
9354%                                                                             %
9355%                                                                             %
9356%   M a g i c k S e t I m a g e C o l o r                                     %
9357%                                                                             %
9358%                                                                             %
9359%                                                                             %
9360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9361%
9362%  MagickSetImageColor() set the entire wand canvas to the specified color.
9363%
9364%  The format of the MagickSetImageColor method is:
9365%
9366%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9367%        const PixelWand *color)
9368%
9369%  A description of each parameter follows:
9370%
9371%    o wand: the magick wand.
9372%
9373%    o background: the image color.
9374%
9375*/
9376WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9377  const PixelWand *color)
9378{
9379  MagickBooleanType
9380    status;
9381
9382  PixelInfo
9383    pixel;
9384
9385  assert(wand != (MagickWand *) NULL);
9386  assert(wand->signature == WandSignature);
9387  if (wand->debug != MagickFalse)
9388    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9389  PixelGetMagickColor(color,&pixel);
9390  status=SetImageColor(wand->images,&pixel);
9391  if (status == MagickFalse)
9392    InheritException(wand->exception,&wand->images->exception);
9393  return(status);
9394}
9395
9396/*
9397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9398%                                                                             %
9399%                                                                             %
9400%                                                                             %
9401%   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                     %
9402%                                                                             %
9403%                                                                             %
9404%                                                                             %
9405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9406%
9407%  MagickSetImageColormapColor() sets the color of the specified colormap
9408%  index.
9409%
9410%  The format of the MagickSetImageColormapColor method is:
9411%
9412%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9413%        const size_t index,const PixelWand *color)
9414%
9415%  A description of each parameter follows:
9416%
9417%    o wand: the magick wand.
9418%
9419%    o index: the offset into the image colormap.
9420%
9421%    o color: Return the colormap color in this wand.
9422%
9423*/
9424WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9425  const size_t index,const PixelWand *color)
9426{
9427  assert(wand != (MagickWand *) NULL);
9428  assert(wand->signature == WandSignature);
9429  if (wand->debug != MagickFalse)
9430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9431  if (wand->images == (Image *) NULL)
9432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9433  if ((wand->images->colormap == (PixelPacket *) NULL) ||
9434      (index >= wand->images->colors))
9435    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9436  PixelGetQuantumPacket(color,wand->images->colormap+index);
9437  return(SyncImage(wand->images));
9438}
9439
9440/*
9441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9442%                                                                             %
9443%                                                                             %
9444%                                                                             %
9445%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9446%                                                                             %
9447%                                                                             %
9448%                                                                             %
9449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9450%
9451%  MagickSetImageColorspace() sets the image colorspace.
9452%
9453%  The format of the MagickSetImageColorspace method is:
9454%
9455%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9456%        const ColorspaceType colorspace)
9457%
9458%  A description of each parameter follows:
9459%
9460%    o wand: the magick wand.
9461%
9462%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9463%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9464%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9465%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9466%      HSLColorspace, or HWBColorspace.
9467%
9468*/
9469WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9470  const ColorspaceType colorspace)
9471{
9472  assert(wand != (MagickWand *) NULL);
9473  assert(wand->signature == WandSignature);
9474  if (wand->debug != MagickFalse)
9475    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9476  if (wand->images == (Image *) NULL)
9477    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9478  return(SetImageColorspace(wand->images,colorspace));
9479}
9480
9481/*
9482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9483%                                                                             %
9484%                                                                             %
9485%                                                                             %
9486%   M a g i c k S e t I m a g e C o m p o s e                                 %
9487%                                                                             %
9488%                                                                             %
9489%                                                                             %
9490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9491%
9492%  MagickSetImageCompose() sets the image composite operator, useful for
9493%  specifying how to composite the image thumbnail when using the
9494%  MagickMontageImage() method.
9495%
9496%  The format of the MagickSetImageCompose method is:
9497%
9498%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9499%        const CompositeOperator compose)
9500%
9501%  A description of each parameter follows:
9502%
9503%    o wand: the magick wand.
9504%
9505%    o compose: the image composite operator.
9506%
9507*/
9508WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9509  const CompositeOperator compose)
9510{
9511  assert(wand != (MagickWand *) NULL);
9512  assert(wand->signature == WandSignature);
9513  if (wand->debug != MagickFalse)
9514    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9515  if (wand->images == (Image *) NULL)
9516    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9517  wand->images->compose=compose;
9518  return(MagickTrue);
9519}
9520
9521/*
9522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9523%                                                                             %
9524%                                                                             %
9525%                                                                             %
9526%   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                         %
9527%                                                                             %
9528%                                                                             %
9529%                                                                             %
9530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9531%
9532%  MagickSetImageCompression() sets the image compression.
9533%
9534%  The format of the MagickSetImageCompression method is:
9535%
9536%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9537%        const CompressionType compression)
9538%
9539%  A description of each parameter follows:
9540%
9541%    o wand: the magick wand.
9542%
9543%    o compression: the image compression type.
9544%
9545*/
9546WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9547  const CompressionType compression)
9548{
9549  assert(wand != (MagickWand *) NULL);
9550  assert(wand->signature == WandSignature);
9551  if (wand->debug != MagickFalse)
9552    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9553  if (wand->images == (Image *) NULL)
9554    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9555  wand->images->compression=compression;
9556  return(MagickTrue);
9557}
9558
9559/*
9560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9561%                                                                             %
9562%                                                                             %
9563%                                                                             %
9564%   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           %
9565%                                                                             %
9566%                                                                             %
9567%                                                                             %
9568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9569%
9570%  MagickSetImageCompressionQuality() sets the image compression quality.
9571%
9572%  The format of the MagickSetImageCompressionQuality method is:
9573%
9574%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9575%        const size_t quality)
9576%
9577%  A description of each parameter follows:
9578%
9579%    o wand: the magick wand.
9580%
9581%    o quality: the image compression tlityype.
9582%
9583*/
9584WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9585  const size_t quality)
9586{
9587  assert(wand != (MagickWand *) NULL);
9588  assert(wand->signature == WandSignature);
9589  if (wand->debug != MagickFalse)
9590    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9591  if (wand->images == (Image *) NULL)
9592    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9593  wand->images->quality=quality;
9594  return(MagickTrue);
9595}
9596
9597/*
9598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9599%                                                                             %
9600%                                                                             %
9601%                                                                             %
9602%   M a g i c k S e t I m a g e D e l a y                                     %
9603%                                                                             %
9604%                                                                             %
9605%                                                                             %
9606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9607%
9608%  MagickSetImageDelay() sets the image delay.
9609%
9610%  The format of the MagickSetImageDelay method is:
9611%
9612%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9613%        const size_t delay)
9614%
9615%  A description of each parameter follows:
9616%
9617%    o wand: the magick wand.
9618%
9619%    o delay: the image delay in ticks-per-second units.
9620%
9621*/
9622WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9623  const size_t delay)
9624{
9625  assert(wand != (MagickWand *) NULL);
9626  assert(wand->signature == WandSignature);
9627  if (wand->debug != MagickFalse)
9628    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9629  if (wand->images == (Image *) NULL)
9630    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9631  wand->images->delay=delay;
9632  return(MagickTrue);
9633}
9634
9635/*
9636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9637%                                                                             %
9638%                                                                             %
9639%                                                                             %
9640%   M a g i c k S e t I m a g e D e p t h                                     %
9641%                                                                             %
9642%                                                                             %
9643%                                                                             %
9644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9645%
9646%  MagickSetImageDepth() sets the image depth.
9647%
9648%  The format of the MagickSetImageDepth method is:
9649%
9650%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9651%        const size_t depth)
9652%
9653%  A description of each parameter follows:
9654%
9655%    o wand: the magick wand.
9656%
9657%    o depth: the image depth in bits: 8, 16, or 32.
9658%
9659*/
9660WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9661  const size_t depth)
9662{
9663  assert(wand != (MagickWand *) NULL);
9664  assert(wand->signature == WandSignature);
9665  if (wand->debug != MagickFalse)
9666    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9667  if (wand->images == (Image *) NULL)
9668    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9669  return(SetImageDepth(wand->images,depth));
9670}
9671
9672/*
9673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9674%                                                                             %
9675%                                                                             %
9676%                                                                             %
9677%   M a g i c k S e t I m a g e D i s p o s e                                 %
9678%                                                                             %
9679%                                                                             %
9680%                                                                             %
9681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9682%
9683%  MagickSetImageDispose() sets the image disposal method.
9684%
9685%  The format of the MagickSetImageDispose method is:
9686%
9687%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9688%        const DisposeType dispose)
9689%
9690%  A description of each parameter follows:
9691%
9692%    o wand: the magick wand.
9693%
9694%    o dispose: the image disposeal type.
9695%
9696*/
9697WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9698  const DisposeType dispose)
9699{
9700  assert(wand != (MagickWand *) NULL);
9701  assert(wand->signature == WandSignature);
9702  if (wand->debug != MagickFalse)
9703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9704  if (wand->images == (Image *) NULL)
9705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9706  wand->images->dispose=dispose;
9707  return(MagickTrue);
9708}
9709
9710/*
9711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9712%                                                                             %
9713%                                                                             %
9714%                                                                             %
9715%   M a g i c k S e t I m a g e E x t e n t                                   %
9716%                                                                             %
9717%                                                                             %
9718%                                                                             %
9719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9720%
9721%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9722%
9723%  The format of the MagickSetImageExtent method is:
9724%
9725%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9726%        const size_t columns,const unsigned rows)
9727%
9728%  A description of each parameter follows:
9729%
9730%    o wand: the magick wand.
9731%
9732%    o columns:  The image width in pixels.
9733%
9734%    o rows:  The image height in pixels.
9735%
9736*/
9737WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9738  const size_t columns,const size_t rows)
9739{
9740  assert(wand != (MagickWand *) NULL);
9741  assert(wand->signature == WandSignature);
9742  if (wand->debug != MagickFalse)
9743    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9744  if (wand->images == (Image *) NULL)
9745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9746  return(SetImageExtent(wand->images,columns,rows));
9747}
9748
9749/*
9750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9751%                                                                             %
9752%                                                                             %
9753%                                                                             %
9754%   M a g i c k S e t I m a g e F i l e n a m e                               %
9755%                                                                             %
9756%                                                                             %
9757%                                                                             %
9758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9759%
9760%  MagickSetImageFilename() sets the filename of a particular image in a
9761%  sequence.
9762%
9763%  The format of the MagickSetImageFilename method is:
9764%
9765%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9766%        const char *filename)
9767%
9768%  A description of each parameter follows:
9769%
9770%    o wand: the magick wand.
9771%
9772%    o filename: the image filename.
9773%
9774*/
9775WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9776  const char *filename)
9777{
9778  assert(wand != (MagickWand *) NULL);
9779  assert(wand->signature == WandSignature);
9780  if (wand->debug != MagickFalse)
9781    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9782  if (wand->images == (Image *) NULL)
9783    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9784  if (filename != (const char *) NULL)
9785    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9786  return(MagickTrue);
9787}
9788
9789/*
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%                                                                             %
9792%                                                                             %
9793%                                                                             %
9794%   M a g i c k S e t I m a g e F o r m a t                                   %
9795%                                                                             %
9796%                                                                             %
9797%                                                                             %
9798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9799%
9800%  MagickSetImageFormat() sets the format of a particular image in a
9801%  sequence.
9802%
9803%  The format of the MagickSetImageFormat method is:
9804%
9805%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9806%        const char *format)
9807%
9808%  A description of each parameter follows:
9809%
9810%    o wand: the magick wand.
9811%
9812%    o format: the image format.
9813%
9814*/
9815WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9816  const char *format)
9817{
9818  const MagickInfo
9819    *magick_info;
9820
9821  assert(wand != (MagickWand *) NULL);
9822  assert(wand->signature == WandSignature);
9823  if (wand->debug != MagickFalse)
9824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9825  if (wand->images == (Image *) NULL)
9826    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9827  if ((format == (char *) NULL) || (*format == '\0'))
9828    {
9829      *wand->images->magick='\0';
9830      return(MagickTrue);
9831    }
9832  magick_info=GetMagickInfo(format,wand->exception);
9833  if (magick_info == (const MagickInfo *) NULL)
9834    return(MagickFalse);
9835  ClearMagickException(wand->exception);
9836  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9837  return(MagickTrue);
9838}
9839
9840/*
9841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9842%                                                                             %
9843%                                                                             %
9844%                                                                             %
9845%   M a g i c k S e t I m a g e F u z z                                       %
9846%                                                                             %
9847%                                                                             %
9848%                                                                             %
9849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9850%
9851%  MagickSetImageFuzz() sets the image fuzz.
9852%
9853%  The format of the MagickSetImageFuzz method is:
9854%
9855%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9856%        const double fuzz)
9857%
9858%  A description of each parameter follows:
9859%
9860%    o wand: the magick wand.
9861%
9862%    o fuzz: the image fuzz.
9863%
9864*/
9865WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9866  const double fuzz)
9867{
9868  assert(wand != (MagickWand *) NULL);
9869  assert(wand->signature == WandSignature);
9870  if (wand->debug != MagickFalse)
9871    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9872  if (wand->images == (Image *) NULL)
9873    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9874  wand->images->fuzz=fuzz;
9875  return(MagickTrue);
9876}
9877
9878/*
9879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9880%                                                                             %
9881%                                                                             %
9882%                                                                             %
9883%   M a g i c k S e t I m a g e G a m m a                                     %
9884%                                                                             %
9885%                                                                             %
9886%                                                                             %
9887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9888%
9889%  MagickSetImageGamma() sets the image gamma.
9890%
9891%  The format of the MagickSetImageGamma method is:
9892%
9893%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9894%        const double gamma)
9895%
9896%  A description of each parameter follows:
9897%
9898%    o wand: the magick wand.
9899%
9900%    o gamma: the image gamma.
9901%
9902*/
9903WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9904  const double gamma)
9905{
9906  assert(wand != (MagickWand *) NULL);
9907  assert(wand->signature == WandSignature);
9908  if (wand->debug != MagickFalse)
9909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9910  if (wand->images == (Image *) NULL)
9911    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9912  wand->images->gamma=gamma;
9913  return(MagickTrue);
9914}
9915
9916/*
9917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9918%                                                                             %
9919%                                                                             %
9920%                                                                             %
9921%   M a g i c k S e t I m a g e G r a v i t y                                 %
9922%                                                                             %
9923%                                                                             %
9924%                                                                             %
9925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9926%
9927%  MagickSetImageGravity() sets the image gravity type.
9928%
9929%  The format of the MagickSetImageGravity method is:
9930%
9931%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9932%        const GravityType gravity)
9933%
9934%  A description of each parameter follows:
9935%
9936%    o wand: the magick wand.
9937%
9938%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9939%      PlaneInterlace, PartitionInterlace.
9940%
9941*/
9942WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9943  const GravityType gravity)
9944{
9945  assert(wand != (MagickWand *) NULL);
9946  assert(wand->signature == WandSignature);
9947  if (wand->debug != MagickFalse)
9948    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9949  if (wand->images == (Image *) NULL)
9950    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9951  wand->images->gravity=gravity;
9952  return(MagickTrue);
9953}
9954
9955/*
9956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9957%                                                                             %
9958%                                                                             %
9959%                                                                             %
9960%   M a g i c k S e t I m a g e G r e e n P r i m a r y                       %
9961%                                                                             %
9962%                                                                             %
9963%                                                                             %
9964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9965%
9966%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9967%  point.
9968%
9969%  The format of the MagickSetImageGreenPrimary method is:
9970%
9971%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9972%        const double x,const double y)
9973%
9974%  A description of each parameter follows:
9975%
9976%    o wand: the magick wand.
9977%
9978%    o x: the green primary x-point.
9979%
9980%    o y: the green primary y-point.
9981%
9982%
9983*/
9984WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9985  const double x,const double y)
9986{
9987  assert(wand != (MagickWand *) NULL);
9988  assert(wand->signature == WandSignature);
9989  if (wand->debug != MagickFalse)
9990    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9991  if (wand->images == (Image *) NULL)
9992    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9993  wand->images->chromaticity.green_primary.x=x;
9994  wand->images->chromaticity.green_primary.y=y;
9995  return(MagickTrue);
9996}
9997
9998/*
9999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10000%                                                                             %
10001%                                                                             %
10002%                                                                             %
10003%   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                 %
10004%                                                                             %
10005%                                                                             %
10006%                                                                             %
10007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10008%
10009%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10010%
10011%  The format of the MagickSetImageInterlaceScheme method is:
10012%
10013%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10014%        const InterlaceType interlace)
10015%
10016%  A description of each parameter follows:
10017%
10018%    o wand: the magick wand.
10019%
10020%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10021%      PlaneInterlace, PartitionInterlace.
10022%
10023*/
10024WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10025  const InterlaceType interlace)
10026{
10027  assert(wand != (MagickWand *) NULL);
10028  assert(wand->signature == WandSignature);
10029  if (wand->debug != MagickFalse)
10030    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10031  if (wand->images == (Image *) NULL)
10032    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10033  wand->images->interlace=interlace;
10034  return(MagickTrue);
10035}
10036
10037/*
10038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10039%                                                                             %
10040%                                                                             %
10041%                                                                             %
10042%   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             %
10043%                                                                             %
10044%                                                                             %
10045%                                                                             %
10046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10047%
10048%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10049%
10050%  The format of the MagickSetImageInterpolateMethod method is:
10051%
10052%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10053%        const InterpolatePixelMethod method)
10054%
10055%  A description of each parameter follows:
10056%
10057%    o wand: the magick wand.
10058%
10059%    o method: the image interpole pixel methods: choose from Undefined,
10060%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10061%
10062*/
10063WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10064  const InterpolatePixelMethod method)
10065{
10066  assert(wand != (MagickWand *) NULL);
10067  assert(wand->signature == WandSignature);
10068  if (wand->debug != MagickFalse)
10069    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10070  if (wand->images == (Image *) NULL)
10071    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10072  wand->images->interpolate=method;
10073  return(MagickTrue);
10074}
10075
10076/*
10077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10078%                                                                             %
10079%                                                                             %
10080%                                                                             %
10081%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10082%                                                                             %
10083%                                                                             %
10084%                                                                             %
10085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10086%
10087%  MagickSetImageIterations() sets the image iterations.
10088%
10089%  The format of the MagickSetImageIterations method is:
10090%
10091%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10092%        const size_t iterations)
10093%
10094%  A description of each parameter follows:
10095%
10096%    o wand: the magick wand.
10097%
10098%    o delay: the image delay in 1/100th of a second.
10099%
10100*/
10101WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10102  const size_t iterations)
10103{
10104  assert(wand != (MagickWand *) NULL);
10105  assert(wand->signature == WandSignature);
10106  if (wand->debug != MagickFalse)
10107    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10108  if (wand->images == (Image *) NULL)
10109    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10110  wand->images->iterations=iterations;
10111  return(MagickTrue);
10112}
10113
10114/*
10115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10116%                                                                             %
10117%                                                                             %
10118%                                                                             %
10119%   M a g i c k S e t I m a g e M a t t e                                     %
10120%                                                                             %
10121%                                                                             %
10122%                                                                             %
10123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10124%
10125%  MagickSetImageMatte() sets the image matte channel.
10126%
10127%  The format of the MagickSetImageMatteColor method is:
10128%
10129%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10130%        const MagickBooleanType *matte)
10131%
10132%  A description of each parameter follows:
10133%
10134%    o wand: the magick wand.
10135%
10136%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10137%      MagickFalse.
10138%
10139*/
10140WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10141  const MagickBooleanType matte)
10142{
10143  assert(wand != (MagickWand *) NULL);
10144  assert(wand->signature == WandSignature);
10145  if (wand->debug != MagickFalse)
10146    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10147  if (wand->images == (Image *) NULL)
10148    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10149  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10150    (void) SetImageOpacity(wand->images,OpaqueAlpha);
10151  wand->images->matte=matte;
10152  return(MagickTrue);
10153}
10154
10155/*
10156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10157%                                                                             %
10158%                                                                             %
10159%                                                                             %
10160%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10161%                                                                             %
10162%                                                                             %
10163%                                                                             %
10164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10165%
10166%  MagickSetImageMatteColor() sets the image matte color.
10167%
10168%  The format of the MagickSetImageMatteColor method is:
10169%
10170%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10171%        const PixelWand *matte)
10172%
10173%  A description of each parameter follows:
10174%
10175%    o wand: the magick wand.
10176%
10177%    o matte: the matte pixel wand.
10178%
10179*/
10180WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10181  const PixelWand *matte)
10182{
10183  assert(wand != (MagickWand *) NULL);
10184  assert(wand->signature == WandSignature);
10185  if (wand->debug != MagickFalse)
10186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10187  if (wand->images == (Image *) NULL)
10188    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10189  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10190  return(MagickTrue);
10191}
10192
10193/*
10194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10195%                                                                             %
10196%                                                                             %
10197%                                                                             %
10198%   M a g i c k S e t I m a g e O p a c i t y                                 %
10199%                                                                             %
10200%                                                                             %
10201%                                                                             %
10202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10203%
10204%  MagickSetImageOpacity() sets the image to the specified opacity level.
10205%
10206%  The format of the MagickSetImageOpacity method is:
10207%
10208%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10209%        const double alpha)
10210%
10211%  A description of each parameter follows:
10212%
10213%    o wand: the magick wand.
10214%
10215%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10216%      transparent.
10217%
10218*/
10219WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10220  const double alpha)
10221{
10222  MagickBooleanType
10223    status;
10224
10225  assert(wand != (MagickWand *) NULL);
10226  assert(wand->signature == WandSignature);
10227  if (wand->debug != MagickFalse)
10228    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10229  if (wand->images == (Image *) NULL)
10230    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10231  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
10232  if (status == MagickFalse)
10233    InheritException(wand->exception,&wand->images->exception);
10234  return(status);
10235}
10236
10237/*
10238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10239%                                                                             %
10240%                                                                             %
10241%                                                                             %
10242%   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                         %
10243%                                                                             %
10244%                                                                             %
10245%                                                                             %
10246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10247%
10248%  MagickSetImageOrientation() sets the image orientation.
10249%
10250%  The format of the MagickSetImageOrientation method is:
10251%
10252%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10253%        const OrientationType orientation)
10254%
10255%  A description of each parameter follows:
10256%
10257%    o wand: the magick wand.
10258%
10259%    o orientation: the image orientation type.
10260%
10261*/
10262WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10263  const OrientationType orientation)
10264{
10265  assert(wand != (MagickWand *) NULL);
10266  assert(wand->signature == WandSignature);
10267  if (wand->debug != MagickFalse)
10268    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10269  if (wand->images == (Image *) NULL)
10270    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10271  wand->images->orientation=orientation;
10272  return(MagickTrue);
10273}
10274
10275/*
10276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10277%                                                                             %
10278%                                                                             %
10279%                                                                             %
10280%   M a g i c k S e t I m a g e P a g e                                       %
10281%                                                                             %
10282%                                                                             %
10283%                                                                             %
10284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10285%
10286%  MagickSetImagePage() sets the page geometry of the image.
10287%
10288%  The format of the MagickSetImagePage method is:
10289%
10290%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10291%        const size_t width,const size_t height,const ssize_t x,
10292%        const ssize_t y)
10293%
10294%  A description of each parameter follows:
10295%
10296%    o wand: the magick wand.
10297%
10298%    o width: the page width.
10299%
10300%    o height: the page height.
10301%
10302%    o x: the page x-offset.
10303%
10304%    o y: the page y-offset.
10305%
10306*/
10307WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10308  const size_t width,const size_t height,const ssize_t x,
10309  const ssize_t y)
10310{
10311  assert(wand != (MagickWand *) NULL);
10312  assert(wand->signature == WandSignature);
10313  if (wand->debug != MagickFalse)
10314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10315  if (wand->images == (Image *) NULL)
10316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10317  wand->images->page.width=width;
10318  wand->images->page.height=height;
10319  wand->images->page.x=x;
10320  wand->images->page.y=y;
10321  return(MagickTrue);
10322}
10323
10324/*
10325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10326%                                                                             %
10327%                                                                             %
10328%                                                                             %
10329%   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                 %
10330%                                                                             %
10331%                                                                             %
10332%                                                                             %
10333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10334%
10335%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10336%  specified method and returns the previous progress monitor if any.  The
10337%  progress monitor method looks like this:
10338%
10339%    MagickBooleanType MagickProgressMonitor(const char *text,
10340%      const MagickOffsetType offset,const MagickSizeType span,
10341%      void *client_data)
10342%
10343%  If the progress monitor returns MagickFalse, the current operation is
10344%  interrupted.
10345%
10346%  The format of the MagickSetImageProgressMonitor method is:
10347%
10348%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10349%        const MagickProgressMonitor progress_monitor,void *client_data)
10350%
10351%  A description of each parameter follows:
10352%
10353%    o wand: the magick wand.
10354%
10355%    o progress_monitor: Specifies a pointer to a method to monitor progress
10356%      of an image operation.
10357%
10358%    o client_data: Specifies a pointer to any client data.
10359%
10360*/
10361WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10362  const MagickProgressMonitor progress_monitor,void *client_data)
10363{
10364  MagickProgressMonitor
10365    previous_monitor;
10366
10367  assert(wand != (MagickWand *) NULL);
10368  assert(wand->signature == WandSignature);
10369  if (wand->debug != MagickFalse)
10370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10371  if (wand->images == (Image *) NULL)
10372    {
10373      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10374        "ContainsNoImages","`%s'",wand->name);
10375      return((MagickProgressMonitor) NULL);
10376    }
10377  previous_monitor=SetImageProgressMonitor(wand->images,
10378    progress_monitor,client_data);
10379  return(previous_monitor);
10380}
10381
10382/*
10383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10384%                                                                             %
10385%                                                                             %
10386%                                                                             %
10387%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10388%                                                                             %
10389%                                                                             %
10390%                                                                             %
10391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10392%
10393%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10394%
10395%  The format of the MagickSetImageRedPrimary method is:
10396%
10397%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10398%        const double x,const double y)
10399%
10400%  A description of each parameter follows:
10401%
10402%    o wand: the magick wand.
10403%
10404%    o x: the red primary x-point.
10405%
10406%    o y: the red primary y-point.
10407%
10408*/
10409WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10410  const double x,const double y)
10411{
10412  assert(wand != (MagickWand *) NULL);
10413  assert(wand->signature == WandSignature);
10414  if (wand->debug != MagickFalse)
10415    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10416  if (wand->images == (Image *) NULL)
10417    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10418  wand->images->chromaticity.red_primary.x=x;
10419  wand->images->chromaticity.red_primary.y=y;
10420  return(MagickTrue);
10421}
10422
10423/*
10424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10425%                                                                             %
10426%                                                                             %
10427%                                                                             %
10428%   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                 %
10429%                                                                             %
10430%                                                                             %
10431%                                                                             %
10432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10433%
10434%  MagickSetImageRenderingIntent() sets the image rendering intent.
10435%
10436%  The format of the MagickSetImageRenderingIntent method is:
10437%
10438%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10439%        const RenderingIntent rendering_intent)
10440%
10441%  A description of each parameter follows:
10442%
10443%    o wand: the magick wand.
10444%
10445%    o rendering_intent: the image rendering intent: UndefinedIntent,
10446%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10447%
10448*/
10449WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10450  const RenderingIntent rendering_intent)
10451{
10452  assert(wand != (MagickWand *) NULL);
10453  assert(wand->signature == WandSignature);
10454  if (wand->debug != MagickFalse)
10455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10456  if (wand->images == (Image *) NULL)
10457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10458  wand->images->rendering_intent=rendering_intent;
10459  return(MagickTrue);
10460}
10461
10462/*
10463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10464%                                                                             %
10465%                                                                             %
10466%                                                                             %
10467%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10468%                                                                             %
10469%                                                                             %
10470%                                                                             %
10471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10472%
10473%  MagickSetImageResolution() sets the image resolution.
10474%
10475%  The format of the MagickSetImageResolution method is:
10476%
10477%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10478%        const double x_resolution,const doubtl y_resolution)
10479%
10480%  A description of each parameter follows:
10481%
10482%    o wand: the magick wand.
10483%
10484%    o x_resolution: the image x resolution.
10485%
10486%    o y_resolution: the image y resolution.
10487%
10488*/
10489WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10490  const double x_resolution,const double y_resolution)
10491{
10492  assert(wand != (MagickWand *) NULL);
10493  assert(wand->signature == WandSignature);
10494  if (wand->debug != MagickFalse)
10495    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10496  if (wand->images == (Image *) NULL)
10497    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10498  wand->images->x_resolution=x_resolution;
10499  wand->images->y_resolution=y_resolution;
10500  return(MagickTrue);
10501}
10502
10503/*
10504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10505%                                                                             %
10506%                                                                             %
10507%                                                                             %
10508%   M a g i c k S e t I m a g e S c e n e                                     %
10509%                                                                             %
10510%                                                                             %
10511%                                                                             %
10512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10513%
10514%  MagickSetImageScene() sets the image scene.
10515%
10516%  The format of the MagickSetImageScene method is:
10517%
10518%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10519%        const size_t scene)
10520%
10521%  A description of each parameter follows:
10522%
10523%    o wand: the magick wand.
10524%
10525%    o delay: the image scene number.
10526%
10527*/
10528WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10529  const size_t scene)
10530{
10531  assert(wand != (MagickWand *) NULL);
10532  assert(wand->signature == WandSignature);
10533  if (wand->debug != MagickFalse)
10534    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10535  if (wand->images == (Image *) NULL)
10536    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10537  wand->images->scene=scene;
10538  return(MagickTrue);
10539}
10540
10541/*
10542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10543%                                                                             %
10544%                                                                             %
10545%                                                                             %
10546%   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                   %
10547%                                                                             %
10548%                                                                             %
10549%                                                                             %
10550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10551%
10552%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10553%
10554%  The format of the MagickSetImageTicksPerSecond method is:
10555%
10556%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10557%        const ssize_t ticks_per-second)
10558%
10559%  A description of each parameter follows:
10560%
10561%    o wand: the magick wand.
10562%
10563%    o ticks_per_second: the units to use for the image delay.
10564%
10565*/
10566WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10567  const ssize_t ticks_per_second)
10568{
10569  assert(wand != (MagickWand *) NULL);
10570  assert(wand->signature == WandSignature);
10571  if (wand->debug != MagickFalse)
10572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10573  if (wand->images == (Image *) NULL)
10574    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10575  wand->images->ticks_per_second=ticks_per_second;
10576  return(MagickTrue);
10577}
10578
10579/*
10580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10581%                                                                             %
10582%                                                                             %
10583%                                                                             %
10584%   M a g i c k S e t I m a g e T y p e                                       %
10585%                                                                             %
10586%                                                                             %
10587%                                                                             %
10588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10589%
10590%  MagickSetImageType() sets the image type.
10591%
10592%  The format of the MagickSetImageType method is:
10593%
10594%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10595%        const ImageType image_type)
10596%
10597%  A description of each parameter follows:
10598%
10599%    o wand: the magick wand.
10600%
10601%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10602%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10603%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10604%      or OptimizeType.
10605%
10606*/
10607WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10608  const ImageType image_type)
10609{
10610  assert(wand != (MagickWand *) NULL);
10611  assert(wand->signature == WandSignature);
10612  if (wand->debug != MagickFalse)
10613    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10614  if (wand->images == (Image *) NULL)
10615    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10616  return(SetImageType(wand->images,image_type));
10617}
10618
10619/*
10620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10621%                                                                             %
10622%                                                                             %
10623%                                                                             %
10624%   M a g i c k S e t I m a g e U n i t s                                     %
10625%                                                                             %
10626%                                                                             %
10627%                                                                             %
10628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10629%
10630%  MagickSetImageUnits() sets the image units of resolution.
10631%
10632%  The format of the MagickSetImageUnits method is:
10633%
10634%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10635%        const ResolutionType units)
10636%
10637%  A description of each parameter follows:
10638%
10639%    o wand: the magick wand.
10640%
10641%    o units: the image units of resolution : UndefinedResolution,
10642%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10643%
10644*/
10645WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10646  const ResolutionType units)
10647{
10648  assert(wand != (MagickWand *) NULL);
10649  assert(wand->signature == WandSignature);
10650  if (wand->debug != MagickFalse)
10651    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10652  if (wand->images == (Image *) NULL)
10653    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10654  wand->images->units=units;
10655  return(MagickTrue);
10656}
10657
10658/*
10659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10660%                                                                             %
10661%                                                                             %
10662%                                                                             %
10663%   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           %
10664%                                                                             %
10665%                                                                             %
10666%                                                                             %
10667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10668%
10669%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10670%
10671%  The format of the MagickSetImageVirtualPixelMethod method is:
10672%
10673%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10674%        const VirtualPixelMethod method)
10675%
10676%  A description of each parameter follows:
10677%
10678%    o wand: the magick wand.
10679%
10680%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10681%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10682%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10683%
10684*/
10685WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10686  const VirtualPixelMethod method)
10687{
10688  assert(wand != (MagickWand *) NULL);
10689  assert(wand->signature == WandSignature);
10690  if (wand->debug != MagickFalse)
10691    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10692  if (wand->images == (Image *) NULL)
10693    return(UndefinedVirtualPixelMethod);
10694  return(SetImageVirtualPixelMethod(wand->images,method));
10695}
10696
10697/*
10698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10699%                                                                             %
10700%                                                                             %
10701%                                                                             %
10702%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10703%                                                                             %
10704%                                                                             %
10705%                                                                             %
10706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10707%
10708%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10709%
10710%  The format of the MagickSetImageWhitePoint method is:
10711%
10712%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10713%        const double x,const double y)
10714%
10715%  A description of each parameter follows:
10716%
10717%    o wand: the magick wand.
10718%
10719%    o x: the white x-point.
10720%
10721%    o y: the white y-point.
10722%
10723*/
10724WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10725  const double x,const double y)
10726{
10727  assert(wand != (MagickWand *) NULL);
10728  assert(wand->signature == WandSignature);
10729  if (wand->debug != MagickFalse)
10730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10731  if (wand->images == (Image *) NULL)
10732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10733  wand->images->chromaticity.white_point.x=x;
10734  wand->images->chromaticity.white_point.y=y;
10735  return(MagickTrue);
10736}
10737
10738/*
10739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10740%                                                                             %
10741%                                                                             %
10742%                                                                             %
10743%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10744%                                                                             %
10745%                                                                             %
10746%                                                                             %
10747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10748%
10749%  MagickShadeImage() shines a distant light on an image to create a
10750%  three-dimensional effect. You control the positioning of the light with
10751%  azimuth and elevation; azimuth is measured in degrees off the x axis
10752%  and elevation is measured in pixels above the Z axis.
10753%
10754%  The format of the MagickShadeImage method is:
10755%
10756%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10757%        const MagickBooleanType gray,const double azimuth,
10758%        const double elevation)
10759%
10760%  A description of each parameter follows:
10761%
10762%    o wand: the magick wand.
10763%
10764%    o gray: A value other than zero shades the intensity of each pixel.
10765%
10766%    o azimuth, elevation:  Define the light source direction.
10767%
10768*/
10769WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10770  const MagickBooleanType gray,const double asimuth,const double elevation)
10771{
10772  Image
10773    *shade_image;
10774
10775  assert(wand != (MagickWand *) NULL);
10776  assert(wand->signature == WandSignature);
10777  if (wand->debug != MagickFalse)
10778    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10779  if (wand->images == (Image *) NULL)
10780    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10781  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10782  if (shade_image == (Image *) NULL)
10783    return(MagickFalse);
10784  ReplaceImageInList(&wand->images,shade_image);
10785  return(MagickTrue);
10786}
10787
10788/*
10789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10790%                                                                             %
10791%                                                                             %
10792%                                                                             %
10793%   M a g i c k S h a d o w I m a g e                                         %
10794%                                                                             %
10795%                                                                             %
10796%                                                                             %
10797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10798%
10799%  MagickShadowImage() simulates an image shadow.
10800%
10801%  The format of the MagickShadowImage method is:
10802%
10803%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10804%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10805%
10806%  A description of each parameter follows:
10807%
10808%    o wand: the magick wand.
10809%
10810%    o opacity: percentage transparency.
10811%
10812%    o sigma: the standard deviation of the Gaussian, in pixels.
10813%
10814%    o x: the shadow x-offset.
10815%
10816%    o y: the shadow y-offset.
10817%
10818*/
10819WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10820  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10821{
10822  Image
10823    *shadow_image;
10824
10825  assert(wand != (MagickWand *) NULL);
10826  assert(wand->signature == WandSignature);
10827  if (wand->debug != MagickFalse)
10828    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10829  if (wand->images == (Image *) NULL)
10830    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10831  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10832  if (shadow_image == (Image *) NULL)
10833    return(MagickFalse);
10834  ReplaceImageInList(&wand->images,shadow_image);
10835  return(MagickTrue);
10836}
10837
10838/*
10839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10840%                                                                             %
10841%                                                                             %
10842%                                                                             %
10843%   M a g i c k S h a r p e n I m a g e                                       %
10844%                                                                             %
10845%                                                                             %
10846%                                                                             %
10847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10848%
10849%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10850%  Gaussian operator of the given radius and standard deviation (sigma).
10851%  For reasonable results, the radius should be larger than sigma.  Use a
10852%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10853%
10854%  The format of the MagickSharpenImage method is:
10855%
10856%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10857%        const double radius,const double sigma)
10858%      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10859%        const ChannelType channel,const double radius,const double sigma)
10860%
10861%  A description of each parameter follows:
10862%
10863%    o wand: the magick wand.
10864%
10865%    o channel: the image channel(s).
10866%
10867%    o radius: the radius of the Gaussian, in pixels, not counting the center
10868%      pixel.
10869%
10870%    o sigma: the standard deviation of the Gaussian, in pixels.
10871%
10872*/
10873
10874WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10875  const double radius,const double sigma)
10876{
10877  MagickBooleanType
10878    status;
10879
10880  status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
10881  return(status);
10882}
10883
10884WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10885  const ChannelType channel,const double radius,const double sigma)
10886{
10887  Image
10888    *sharp_image;
10889
10890  assert(wand != (MagickWand *) NULL);
10891  assert(wand->signature == WandSignature);
10892  if (wand->debug != MagickFalse)
10893    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10894  if (wand->images == (Image *) NULL)
10895    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10896  sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
10897    wand->exception);
10898  if (sharp_image == (Image *) NULL)
10899    return(MagickFalse);
10900  ReplaceImageInList(&wand->images,sharp_image);
10901  return(MagickTrue);
10902}
10903
10904/*
10905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10906%                                                                             %
10907%                                                                             %
10908%                                                                             %
10909%   M a g i c k S h a v e I m a g e                                           %
10910%                                                                             %
10911%                                                                             %
10912%                                                                             %
10913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10914%
10915%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10916%  memory necessary for the new Image structure and returns a pointer to the
10917%  new image.
10918%
10919%  The format of the MagickShaveImage method is:
10920%
10921%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10922%        const size_t columns,const size_t rows)
10923%
10924%  A description of each parameter follows:
10925%
10926%    o wand: the magick wand.
10927%
10928%    o columns: the number of columns in the scaled image.
10929%
10930%    o rows: the number of rows in the scaled image.
10931%
10932%
10933*/
10934WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10935  const size_t columns,const size_t rows)
10936{
10937  Image
10938    *shave_image;
10939
10940  RectangleInfo
10941    shave_info;
10942
10943  assert(wand != (MagickWand *) NULL);
10944  assert(wand->signature == WandSignature);
10945  if (wand->debug != MagickFalse)
10946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10947  if (wand->images == (Image *) NULL)
10948    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10949  shave_info.width=columns;
10950  shave_info.height=rows;
10951  shave_info.x=0;
10952  shave_info.y=0;
10953  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10954  if (shave_image == (Image *) NULL)
10955    return(MagickFalse);
10956  ReplaceImageInList(&wand->images,shave_image);
10957  return(MagickTrue);
10958}
10959
10960/*
10961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10962%                                                                             %
10963%                                                                             %
10964%                                                                             %
10965%   M a g i c k S h e a r I m a g e                                           %
10966%                                                                             %
10967%                                                                             %
10968%                                                                             %
10969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10970%
10971%  MagickShearImage() slides one edge of an image along the X or Y axis,
10972%  creating a parallelogram.  An X direction shear slides an edge along the X
10973%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10974%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10975%  is measured relative to the Y axis, and similarly, for Y direction shears
10976%  y_shear is measured relative to the X axis.  Empty triangles left over from
10977%  shearing the image are filled with the background color.
10978%
10979%  The format of the MagickShearImage method is:
10980%
10981%      MagickBooleanType MagickShearImage(MagickWand *wand,
10982%        const PixelWand *background,const double x_shear,onst double y_shear)
10983%
10984%  A description of each parameter follows:
10985%
10986%    o wand: the magick wand.
10987%
10988%    o background: the background pixel wand.
10989%
10990%    o x_shear: the number of degrees to shear the image.
10991%
10992%    o y_shear: the number of degrees to shear the image.
10993%
10994*/
10995WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10996  const PixelWand *background,const double x_shear,const double y_shear)
10997{
10998  Image
10999    *shear_image;
11000
11001  assert(wand != (MagickWand *) NULL);
11002  assert(wand->signature == WandSignature);
11003  if (wand->debug != MagickFalse)
11004    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11005  if (wand->images == (Image *) NULL)
11006    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11007  PixelGetQuantumPacket(background,&wand->images->background_color);
11008  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11009  if (shear_image == (Image *) NULL)
11010    return(MagickFalse);
11011  ReplaceImageInList(&wand->images,shear_image);
11012  return(MagickTrue);
11013}
11014
11015/*
11016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11017%                                                                             %
11018%                                                                             %
11019%                                                                             %
11020%   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                   %
11021%                                                                             %
11022%                                                                             %
11023%                                                                             %
11024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11025%
11026%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11027%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11028%  image using a sigmoidal transfer function without saturating highlights or
11029%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11030%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11031%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11032%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11033%  is reduced.
11034%
11035%  The format of the MagickSigmoidalContrastImage method is:
11036%
11037%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11038%        const MagickBooleanType sharpen,const double alpha,const double beta)
11039%      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11040%        const ChannelType channel,const MagickBooleanType sharpen,
11041%        const double alpha,const double beta)
11042%
11043%  A description of each parameter follows:
11044%
11045%    o wand: the magick wand.
11046%
11047%    o channel: Identify which channel to level: RedChannel, GreenChannel,
11048%
11049%    o sharpen: Increase or decrease image contrast.
11050%
11051%    o alpha: strength of the contrast, the larger the number the more
11052%      'threshold-like' it becomes.
11053%
11054%    o beta: midpoint of the function as a color value 0 to QuantumRange.
11055%
11056*/
11057
11058WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11059  const MagickBooleanType sharpen,const double alpha,const double beta)
11060{
11061  MagickBooleanType
11062    status;
11063
11064  status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11065    alpha,beta);
11066  return(status);
11067}
11068
11069WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11070  MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11071  const double alpha,const double beta)
11072{
11073  MagickBooleanType
11074    status;
11075
11076  assert(wand != (MagickWand *) NULL);
11077  assert(wand->signature == WandSignature);
11078  if (wand->debug != MagickFalse)
11079    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11080  if (wand->images == (Image *) NULL)
11081    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11082  status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11083  if (status == MagickFalse)
11084    InheritException(wand->exception,&wand->images->exception);
11085  return(status);
11086}
11087
11088/*
11089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090%                                                                             %
11091%                                                                             %
11092%                                                                             %
11093%   M a g i c k S i m i l a r i t y I m a g e                                 %
11094%                                                                             %
11095%                                                                             %
11096%                                                                             %
11097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098%
11099%  MagickSimilarityImage() compares the reference image of the image and
11100%  returns the best match offset.  In addition, it returns a similarity image
11101%  such that an exact match location is completely white and if none of the
11102%  pixels match, black, otherwise some gray level in-between.
11103%
11104%  The format of the MagickSimilarityImage method is:
11105%
11106%      MagickWand *MagickSimilarityImage(MagickWand *wand,
11107%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11108%
11109%  A description of each parameter follows:
11110%
11111%    o wand: the magick wand.
11112%
11113%    o reference: the reference wand.
11114%
11115%    o offset: the best match offset of the reference image within the image.
11116%
11117%    o similarity: the computed similarity between the images.
11118%
11119*/
11120WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11121  const MagickWand *reference,RectangleInfo *offset,double *similarity)
11122{
11123  Image
11124    *similarity_image;
11125
11126  assert(wand != (MagickWand *) NULL);
11127  assert(wand->signature == WandSignature);
11128  if (wand->debug != MagickFalse)
11129    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11130  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11131    {
11132      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11133        "ContainsNoImages","`%s'",wand->name);
11134      return((MagickWand *) NULL);
11135    }
11136  similarity_image=SimilarityImage(wand->images,reference->images,offset,
11137    similarity,&wand->images->exception);
11138  if (similarity_image == (Image *) NULL)
11139    return((MagickWand *) NULL);
11140  return(CloneMagickWandFromImages(wand,similarity_image));
11141}
11142
11143/*
11144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11145%                                                                             %
11146%                                                                             %
11147%                                                                             %
11148%   M a g i c k S k e t c h I m a g e                                         %
11149%                                                                             %
11150%                                                                             %
11151%                                                                             %
11152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11153%
11154%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11155%  a Gaussian operator of the given radius and standard deviation (sigma).
11156%  For reasonable results, radius should be larger than sigma.  Use a
11157%  radius of 0 and SketchImage() selects a suitable radius for you.
11158%  Angle gives the angle of the blurring motion.
11159%
11160%  The format of the MagickSketchImage method is:
11161%
11162%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11163%        const double radius,const double sigma,const double angle)
11164%
11165%  A description of each parameter follows:
11166%
11167%    o wand: the magick wand.
11168%
11169%    o radius: the radius of the Gaussian, in pixels, not counting
11170%      the center pixel.
11171%
11172%    o sigma: the standard deviation of the Gaussian, in pixels.
11173%
11174%    o angle: Apply the effect along this angle.
11175%
11176*/
11177WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11178  const double radius,const double sigma,const double angle)
11179{
11180  Image
11181    *sketch_image;
11182
11183  assert(wand != (MagickWand *) NULL);
11184  assert(wand->signature == WandSignature);
11185  if (wand->debug != MagickFalse)
11186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11187  if (wand->images == (Image *) NULL)
11188    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11189  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11190  if (sketch_image == (Image *) NULL)
11191    return(MagickFalse);
11192  ReplaceImageInList(&wand->images,sketch_image);
11193  return(MagickTrue);
11194}
11195
11196/*
11197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11198%                                                                             %
11199%                                                                             %
11200%                                                                             %
11201%   M a g i c k S m u s h I m a g e s                                         %
11202%                                                                             %
11203%                                                                             %
11204%                                                                             %
11205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11206%
11207%  MagickSmushImages() takes all images from the current image pointer to the
11208%  end of the image list and smushs them to each other top-to-bottom if the
11209%  stack parameter is true, otherwise left-to-right.
11210%
11211%  The format of the MagickSmushImages method is:
11212%
11213%      MagickWand *MagickSmushImages(MagickWand *wand,
11214%        const MagickBooleanType stack,const ssize_t offset)
11215%
11216%  A description of each parameter follows:
11217%
11218%    o wand: the magick wand.
11219%
11220%    o stack: By default, images are stacked left-to-right. Set stack to
11221%      MagickTrue to stack them top-to-bottom.
11222%
11223%    o offset: minimum distance in pixels between images.
11224%
11225*/
11226WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11227  const MagickBooleanType stack,const ssize_t offset)
11228{
11229  Image
11230    *smush_image;
11231
11232  assert(wand != (MagickWand *) NULL);
11233  assert(wand->signature == WandSignature);
11234  if (wand->debug != MagickFalse)
11235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11236  if (wand->images == (Image *) NULL)
11237    return((MagickWand *) NULL);
11238  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11239  if (smush_image == (Image *) NULL)
11240    return((MagickWand *) NULL);
11241  return(CloneMagickWandFromImages(wand,smush_image));
11242}
11243
11244/*
11245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11246%                                                                             %
11247%                                                                             %
11248%                                                                             %
11249%     M a g i c k S o l a r i z e I m a g e                                   %
11250%                                                                             %
11251%                                                                             %
11252%                                                                             %
11253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254%
11255%  MagickSolarizeImage() applies a special effect to the image, similar to the
11256%  effect achieved in a photo darkroom by selectively exposing areas of photo
11257%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11258%  measure of the extent of the solarization.
11259%
11260%  The format of the MagickSolarizeImage method is:
11261%
11262%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11263%        const double threshold)
11264%
11265%  A description of each parameter follows:
11266%
11267%    o wand: the magick wand.
11268%
11269%    o threshold:  Define the extent of the solarization.
11270%
11271*/
11272WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11273  const double threshold)
11274{
11275  MagickBooleanType
11276    status;
11277
11278  assert(wand != (MagickWand *) NULL);
11279  assert(wand->signature == WandSignature);
11280  if (wand->debug != MagickFalse)
11281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11282  if (wand->images == (Image *) NULL)
11283    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11284  status=SolarizeImage(wand->images,threshold);
11285  if (status == MagickFalse)
11286    InheritException(wand->exception,&wand->images->exception);
11287  return(status);
11288}
11289
11290/*
11291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11292%                                                                             %
11293%                                                                             %
11294%                                                                             %
11295%   M a g i c k S p a r s e C o l o r I m a g e                               %
11296%                                                                             %
11297%                                                                             %
11298%                                                                             %
11299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11300%
11301%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11302%  colors found at those coordinates, across the whole image, using various
11303%  methods.
11304%
11305%  The format of the MagickSparseColorImage method is:
11306%
11307%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11308%        const ChannelType channel,const SparseColorMethod method,
11309%        const size_t number_arguments,const double *arguments)
11310%
11311%  A description of each parameter follows:
11312%
11313%    o image: the image to be sparseed.
11314%
11315%    o method: the method of image sparseion.
11316%
11317%        ArcSparseColorion will always ignore source image offset, and always
11318%        'bestfit' the destination image with the top left corner offset
11319%        relative to the polar mapping center.
11320%
11321%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11322%        style of image sparseion.
11323%
11324%        Affine, Perspective, and Bilinear, will do least squares fitting of
11325%        the distrotion when more than the minimum number of control point
11326%        pairs are provided.
11327%
11328%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11329%        less than 4 control point pairs are provided. While Affine sparseions
11330%        will let you use any number of control point pairs, that is Zero pairs
11331%        is a No-Op (viewport only) distrotion, one pair is a translation and
11332%        two pairs of control points will do a scale-rotate-translate, without
11333%        any shearing.
11334%
11335%    o number_arguments: the number of arguments given for this sparseion
11336%      method.
11337%
11338%    o arguments: the arguments for this sparseion method.
11339%
11340*/
11341WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11342  const ChannelType channel,const SparseColorMethod method,
11343  const size_t number_arguments,const double *arguments)
11344{
11345  Image
11346    *sparse_image;
11347
11348  assert(wand != (MagickWand *) NULL);
11349  assert(wand->signature == WandSignature);
11350  if (wand->debug != MagickFalse)
11351    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11352  if (wand->images == (Image *) NULL)
11353    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11354  sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11355    arguments,wand->exception);
11356  if (sparse_image == (Image *) NULL)
11357    return(MagickFalse);
11358  ReplaceImageInList(&wand->images,sparse_image);
11359  return(MagickTrue);
11360}
11361
11362/*
11363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11364%                                                                             %
11365%                                                                             %
11366%                                                                             %
11367%   M a g i c k S p l i c e I m a g e                                         %
11368%                                                                             %
11369%                                                                             %
11370%                                                                             %
11371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372%
11373%  MagickSpliceImage() splices a solid color into the image.
11374%
11375%  The format of the MagickSpliceImage method is:
11376%
11377%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11378%        const size_t width,const size_t height,const ssize_t x,
11379%        const ssize_t y)
11380%
11381%  A description of each parameter follows:
11382%
11383%    o wand: the magick wand.
11384%
11385%    o width: the region width.
11386%
11387%    o height: the region height.
11388%
11389%    o x: the region x offset.
11390%
11391%    o y: the region y offset.
11392%
11393*/
11394WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11395  const size_t width,const size_t height,const ssize_t x,
11396  const ssize_t y)
11397{
11398  Image
11399    *splice_image;
11400
11401  RectangleInfo
11402    splice;
11403
11404  assert(wand != (MagickWand *) NULL);
11405  assert(wand->signature == WandSignature);
11406  if (wand->debug != MagickFalse)
11407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11408  if (wand->images == (Image *) NULL)
11409    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11410  splice.width=width;
11411  splice.height=height;
11412  splice.x=x;
11413  splice.y=y;
11414  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11415  if (splice_image == (Image *) NULL)
11416    return(MagickFalse);
11417  ReplaceImageInList(&wand->images,splice_image);
11418  return(MagickTrue);
11419}
11420
11421/*
11422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11423%                                                                             %
11424%                                                                             %
11425%                                                                             %
11426%   M a g i c k S p r e a d I m a g e                                         %
11427%                                                                             %
11428%                                                                             %
11429%                                                                             %
11430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11431%
11432%  MagickSpreadImage() is a special effects method that randomly displaces each
11433%  pixel in a block defined by the radius parameter.
11434%
11435%  The format of the MagickSpreadImage method is:
11436%
11437%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11438%
11439%  A description of each parameter follows:
11440%
11441%    o wand: the magick wand.
11442%
11443%    o radius:  Choose a random pixel in a neighborhood of this extent.
11444%
11445*/
11446WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11447  const double radius)
11448{
11449  Image
11450    *spread_image;
11451
11452  assert(wand != (MagickWand *) NULL);
11453  assert(wand->signature == WandSignature);
11454  if (wand->debug != MagickFalse)
11455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11456  if (wand->images == (Image *) NULL)
11457    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11458  spread_image=SpreadImage(wand->images,radius,wand->exception);
11459  if (spread_image == (Image *) NULL)
11460    return(MagickFalse);
11461  ReplaceImageInList(&wand->images,spread_image);
11462  return(MagickTrue);
11463}
11464
11465/*
11466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11467%                                                                             %
11468%                                                                             %
11469%                                                                             %
11470%   M a g i c k S t a t i s t i c I m a g e                                   %
11471%                                                                             %
11472%                                                                             %
11473%                                                                             %
11474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11475%
11476%  MagickStatisticImage() replace each pixel with corresponding statistic from
11477%  the neighborhood of the specified width and height.
11478%
11479%  The format of the MagickStatisticImage method is:
11480%
11481%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11482%        const StatisticType type,const double width,const size_t height)
11483%      MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
11484%        const ChannelType channel,const StatisticType type,const double width,
11485%        const size_t height)
11486%
11487%  A description of each parameter follows:
11488%
11489%    o wand: the magick wand.
11490%
11491%    o channel: the image channel(s).
11492%
11493%    o type: the statistic type (e.g. median, mode, etc.).
11494%
11495%    o width: the width of the pixel neighborhood.
11496%
11497%    o height: the height of the pixel neighborhood.
11498%
11499*/
11500WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11501  const ChannelType channel,const StatisticType type,const size_t width,
11502  const size_t height)
11503{
11504  Image
11505    *statistic_image;
11506
11507  assert(wand != (MagickWand *) NULL);
11508  assert(wand->signature == WandSignature);
11509  if (wand->debug != MagickFalse)
11510    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11511  if (wand->images == (Image *) NULL)
11512    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11513  statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
11514    wand->exception);
11515  if (statistic_image == (Image *) NULL)
11516    return(MagickFalse);
11517  ReplaceImageInList(&wand->images,statistic_image);
11518  return(MagickTrue);
11519}
11520
11521/*
11522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11523%                                                                             %
11524%                                                                             %
11525%                                                                             %
11526%   M a g i c k S t e g a n o I m a g e                                       %
11527%                                                                             %
11528%                                                                             %
11529%                                                                             %
11530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11531%
11532%  MagickSteganoImage() hides a digital watermark within the image.
11533%  Recover the hidden watermark later to prove that the authenticity of
11534%  an image.  Offset defines the start position within the image to hide
11535%  the watermark.
11536%
11537%  The format of the MagickSteganoImage method is:
11538%
11539%      MagickWand *MagickSteganoImage(MagickWand *wand,
11540%        const MagickWand *watermark_wand,const ssize_t offset)
11541%
11542%  A description of each parameter follows:
11543%
11544%    o wand: the magick wand.
11545%
11546%    o watermark_wand: the watermark wand.
11547%
11548%    o offset: Start hiding at this offset into the image.
11549%
11550*/
11551WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11552  const MagickWand *watermark_wand,const ssize_t offset)
11553{
11554  Image
11555    *stegano_image;
11556
11557  assert(wand != (MagickWand *) NULL);
11558  assert(wand->signature == WandSignature);
11559  if (wand->debug != MagickFalse)
11560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11561  if ((wand->images == (Image *) NULL) ||
11562      (watermark_wand->images == (Image *) NULL))
11563    {
11564      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11565        "ContainsNoImages","`%s'",wand->name);
11566      return((MagickWand *) NULL);
11567    }
11568  wand->images->offset=offset;
11569  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11570    wand->exception);
11571  if (stegano_image == (Image *) NULL)
11572    return((MagickWand *) NULL);
11573  return(CloneMagickWandFromImages(wand,stegano_image));
11574}
11575
11576/*
11577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11578%                                                                             %
11579%                                                                             %
11580%                                                                             %
11581%   M a g i c k S t e r e o I m a g e                                         %
11582%                                                                             %
11583%                                                                             %
11584%                                                                             %
11585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11586%
11587%  MagickStereoImage() composites two images and produces a single image that
11588%  is the composite of a left and right image of a stereo pair
11589%
11590%  The format of the MagickStereoImage method is:
11591%
11592%      MagickWand *MagickStereoImage(MagickWand *wand,
11593%        const MagickWand *offset_wand)
11594%
11595%  A description of each parameter follows:
11596%
11597%    o wand: the magick wand.
11598%
11599%    o offset_wand: Another image wand.
11600%
11601*/
11602WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11603  const MagickWand *offset_wand)
11604{
11605  Image
11606    *stereo_image;
11607
11608  assert(wand != (MagickWand *) NULL);
11609  assert(wand->signature == WandSignature);
11610  if (wand->debug != MagickFalse)
11611    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11612  if ((wand->images == (Image *) NULL) ||
11613      (offset_wand->images == (Image *) NULL))
11614    {
11615      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11616        "ContainsNoImages","`%s'",wand->name);
11617      return((MagickWand *) NULL);
11618    }
11619  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11620  if (stereo_image == (Image *) NULL)
11621    return((MagickWand *) NULL);
11622  return(CloneMagickWandFromImages(wand,stereo_image));
11623}
11624
11625/*
11626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11627%                                                                             %
11628%                                                                             %
11629%                                                                             %
11630%   M a g i c k S t r i p I m a g e                                           %
11631%                                                                             %
11632%                                                                             %
11633%                                                                             %
11634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11635%
11636%  MagickStripImage() strips an image of all profiles and comments.
11637%
11638%  The format of the MagickStripImage method is:
11639%
11640%      MagickBooleanType MagickStripImage(MagickWand *wand)
11641%
11642%  A description of each parameter follows:
11643%
11644%    o wand: the magick wand.
11645%
11646*/
11647WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11648{
11649  MagickBooleanType
11650    status;
11651
11652  assert(wand != (MagickWand *) NULL);
11653  assert(wand->signature == WandSignature);
11654  if (wand->debug != MagickFalse)
11655    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11656  if (wand->images == (Image *) NULL)
11657    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11658  status=StripImage(wand->images);
11659  if (status == MagickFalse)
11660    InheritException(wand->exception,&wand->images->exception);
11661  return(status);
11662}
11663
11664/*
11665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11666%                                                                             %
11667%                                                                             %
11668%                                                                             %
11669%   M a g i c k S w i r l I m a g e                                           %
11670%                                                                             %
11671%                                                                             %
11672%                                                                             %
11673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11674%
11675%  MagickSwirlImage() swirls the pixels about the center of the image, where
11676%  degrees indicates the sweep of the arc through which each pixel is moved.
11677%  You get a more dramatic effect as the degrees move from 1 to 360.
11678%
11679%  The format of the MagickSwirlImage method is:
11680%
11681%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11682%
11683%  A description of each parameter follows:
11684%
11685%    o wand: the magick wand.
11686%
11687%    o degrees: Define the tightness of the swirling effect.
11688%
11689*/
11690WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11691  const double degrees)
11692{
11693  Image
11694    *swirl_image;
11695
11696  assert(wand != (MagickWand *) NULL);
11697  assert(wand->signature == WandSignature);
11698  if (wand->debug != MagickFalse)
11699    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11700  if (wand->images == (Image *) NULL)
11701    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11702  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11703  if (swirl_image == (Image *) NULL)
11704    return(MagickFalse);
11705  ReplaceImageInList(&wand->images,swirl_image);
11706  return(MagickTrue);
11707}
11708
11709/*
11710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11711%                                                                             %
11712%                                                                             %
11713%                                                                             %
11714%   M a g i c k T e x t u r e I m a g e                                       %
11715%                                                                             %
11716%                                                                             %
11717%                                                                             %
11718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11719%
11720%  MagickTextureImage() repeatedly tiles the texture image across and down the
11721%  image canvas.
11722%
11723%  The format of the MagickTextureImage method is:
11724%
11725%      MagickWand *MagickTextureImage(MagickWand *wand,
11726%        const MagickWand *texture_wand)
11727%
11728%  A description of each parameter follows:
11729%
11730%    o wand: the magick wand.
11731%
11732%    o texture_wand: the texture wand
11733%
11734*/
11735WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11736  const MagickWand *texture_wand)
11737{
11738  Image
11739    *texture_image;
11740
11741  MagickBooleanType
11742    status;
11743
11744  assert(wand != (MagickWand *) NULL);
11745  assert(wand->signature == WandSignature);
11746  if (wand->debug != MagickFalse)
11747    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11748  if ((wand->images == (Image *) NULL) ||
11749      (texture_wand->images == (Image *) NULL))
11750    {
11751      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11752        "ContainsNoImages","`%s'",wand->name);
11753      return((MagickWand *) NULL);
11754    }
11755  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11756  if (texture_image == (Image *) NULL)
11757    return((MagickWand *) NULL);
11758  status=TextureImage(texture_image,texture_wand->images);
11759  if (status == MagickFalse)
11760    {
11761      InheritException(wand->exception,&texture_image->exception);
11762      texture_image=DestroyImage(texture_image);
11763      return((MagickWand *) NULL);
11764    }
11765  return(CloneMagickWandFromImages(wand,texture_image));
11766}
11767
11768/*
11769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11770%                                                                             %
11771%                                                                             %
11772%                                                                             %
11773%   M a g i c k T h r e s h o l d I m a g e                                   %
11774%                                                                             %
11775%                                                                             %
11776%                                                                             %
11777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11778%
11779%  MagickThresholdImage() changes the value of individual pixels based on
11780%  the intensity of each pixel compared to threshold.  The result is a
11781%  high-contrast, two color image.
11782%
11783%  The format of the MagickThresholdImage method is:
11784%
11785%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11786%        const double threshold)
11787%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11788%        const ChannelType channel,const double threshold)
11789%
11790%  A description of each parameter follows:
11791%
11792%    o wand: the magick wand.
11793%
11794%    o channel: the image channel(s).
11795%
11796%    o threshold: Define the threshold value.
11797%
11798*/
11799WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11800  const double threshold)
11801{
11802  MagickBooleanType
11803    status;
11804
11805  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11806  return(status);
11807}
11808
11809WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11810  const ChannelType channel,const double threshold)
11811{
11812  MagickBooleanType
11813    status;
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  status=BilevelImageChannel(wand->images,channel,threshold);
11822  if (status == MagickFalse)
11823    InheritException(wand->exception,&wand->images->exception);
11824  return(status);
11825}
11826
11827/*
11828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11829%                                                                             %
11830%                                                                             %
11831%                                                                             %
11832%   M a g i c k T h u m b n a i l I m a g e                                   %
11833%                                                                             %
11834%                                                                             %
11835%                                                                             %
11836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11837%
11838%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11839%  and removes any associated profiles.  The goal is to produce small low cost
11840%  thumbnail images suited for display on the Web.
11841%
11842%  The format of the MagickThumbnailImage method is:
11843%
11844%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11845%        const size_t columns,const size_t rows)
11846%
11847%  A description of each parameter follows:
11848%
11849%    o wand: the magick wand.
11850%
11851%    o columns: the number of columns in the scaled image.
11852%
11853%    o rows: the number of rows in the scaled image.
11854%
11855*/
11856WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11857  const size_t columns,const size_t rows)
11858{
11859  Image
11860    *thumbnail_image;
11861
11862  assert(wand != (MagickWand *) NULL);
11863  assert(wand->signature == WandSignature);
11864  if (wand->debug != MagickFalse)
11865    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11866  if (wand->images == (Image *) NULL)
11867    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11868  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11869  if (thumbnail_image == (Image *) NULL)
11870    return(MagickFalse);
11871  ReplaceImageInList(&wand->images,thumbnail_image);
11872  return(MagickTrue);
11873}
11874
11875/*
11876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11877%                                                                             %
11878%                                                                             %
11879%                                                                             %
11880%   M a g i c k T i n t I m a g e                                             %
11881%                                                                             %
11882%                                                                             %
11883%                                                                             %
11884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11885%
11886%  MagickTintImage() applies a color vector to each pixel in the image.  The
11887%  length of the vector is 0 for black and white and at its maximum for the
11888%  midtones.  The vector weighting function is
11889%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11890%
11891%  The format of the MagickTintImage method is:
11892%
11893%      MagickBooleanType MagickTintImage(MagickWand *wand,
11894%        const PixelWand *tint,const PixelWand *opacity)
11895%
11896%  A description of each parameter follows:
11897%
11898%    o wand: the magick wand.
11899%
11900%    o tint: the tint pixel wand.
11901%
11902%    o opacity: the opacity pixel wand.
11903%
11904*/
11905WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11906  const PixelWand *tint,const PixelWand *opacity)
11907{
11908  char
11909    percent_opaque[MaxTextExtent];
11910
11911  Image
11912    *tint_image;
11913
11914  PixelPacket
11915    target;
11916
11917  assert(wand != (MagickWand *) NULL);
11918  assert(wand->signature == WandSignature);
11919  if (wand->debug != MagickFalse)
11920    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11921  if (wand->images == (Image *) NULL)
11922    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11923  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11924    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11925    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11926    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11927    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11928    PixelGetOpacityQuantum(opacity)));
11929  PixelGetQuantumPacket(tint,&target);
11930  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11931  if (tint_image == (Image *) NULL)
11932    return(MagickFalse);
11933  ReplaceImageInList(&wand->images,tint_image);
11934  return(MagickTrue);
11935}
11936
11937/*
11938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11939%                                                                             %
11940%                                                                             %
11941%                                                                             %
11942%   M a g i c k T r a n s f o r m I m a g e                                   %
11943%                                                                             %
11944%                                                                             %
11945%                                                                             %
11946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11947%
11948%  MagickTransformImage() is a convenience method that behaves like
11949%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11950%  information as a region geometry specification.  If the operation fails,
11951%  a NULL image handle is returned.
11952%
11953%  The format of the MagickTransformImage method is:
11954%
11955%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11956%        const char *geometry)
11957%
11958%  A description of each parameter follows:
11959%
11960%    o wand: the magick wand.
11961%
11962%    o crop: A crop geometry string.  This geometry defines a subregion of the
11963%      image to crop.
11964%
11965%    o geometry: An image geometry string.  This geometry defines the final
11966%      size of the image.
11967%
11968*/
11969WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11970  const char *crop,const char *geometry)
11971{
11972  Image
11973    *transform_image;
11974
11975  MagickBooleanType
11976    status;
11977
11978  assert(wand != (MagickWand *) NULL);
11979  assert(wand->signature == WandSignature);
11980  if (wand->debug != MagickFalse)
11981    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11982  if (wand->images == (Image *) NULL)
11983    return((MagickWand *) NULL);
11984  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11985  if (transform_image == (Image *) NULL)
11986    return((MagickWand *) NULL);
11987  status=TransformImage(&transform_image,crop,geometry);
11988  if (status == MagickFalse)
11989    {
11990      InheritException(wand->exception,&transform_image->exception);
11991      transform_image=DestroyImage(transform_image);
11992      return((MagickWand *) NULL);
11993    }
11994  return(CloneMagickWandFromImages(wand,transform_image));
11995}
11996
11997/*
11998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11999%                                                                             %
12000%                                                                             %
12001%                                                                             %
12002%   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               %
12003%                                                                             %
12004%                                                                             %
12005%                                                                             %
12006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12007%
12008%  MagickTransformImageColorspace() transform the image colorspace.
12009%
12010%  The format of the MagickTransformImageColorspace method is:
12011%
12012%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12013%        const ColorspaceType colorspace)
12014%
12015%  A description of each parameter follows:
12016%
12017%    o wand: the magick wand.
12018%
12019%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12020%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12021%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12022%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12023%      HSLColorspace, or HWBColorspace.
12024%
12025*/
12026WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12027  const ColorspaceType colorspace)
12028{
12029  assert(wand != (MagickWand *) NULL);
12030  assert(wand->signature == WandSignature);
12031  if (wand->debug != MagickFalse)
12032    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12033  if (wand->images == (Image *) NULL)
12034    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12035  return(TransformImageColorspace(wand->images,colorspace));
12036}
12037
12038/*
12039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12040%                                                                             %
12041%                                                                             %
12042%                                                                             %
12043%   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                     %
12044%                                                                             %
12045%                                                                             %
12046%                                                                             %
12047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12048%
12049%  MagickTransparentPaintImage() changes any pixel that matches color with the
12050%  color defined by fill.
12051%
12052%  The format of the MagickTransparentPaintImage method is:
12053%
12054%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12055%        const PixelWand *target,const double alpha,const double fuzz,
12056%        const MagickBooleanType invert)
12057%
12058%  A description of each parameter follows:
12059%
12060%    o wand: the magick wand.
12061%
12062%    o target: Change this target color to specified opacity value within
12063%      the image.
12064%
12065%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12066%      transparent.
12067%
12068%    o fuzz: By default target must match a particular pixel color
12069%      exactly.  However, in many cases two colors may differ by a small amount.
12070%      The fuzz member of image defines how much tolerance is acceptable to
12071%      consider two colors as the same.  For example, set fuzz to 10 and the
12072%      color red at intensities of 100 and 102 respectively are now interpreted
12073%      as the same color for the purposes of the floodfill.
12074%
12075%    o invert: paint any pixel that does not match the target color.
12076%
12077*/
12078WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12079  const PixelWand *target,const double alpha,const double fuzz,
12080  const MagickBooleanType invert)
12081{
12082  MagickBooleanType
12083    status;
12084
12085  PixelInfo
12086    target_pixel;
12087
12088  assert(wand != (MagickWand *) NULL);
12089  assert(wand->signature == WandSignature);
12090  if (wand->debug != MagickFalse)
12091    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12092  if (wand->images == (Image *) NULL)
12093    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12094  PixelGetMagickColor(target,&target_pixel);
12095  wand->images->fuzz=fuzz;
12096  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12097    QuantumRange*alpha),invert);
12098  if (status == MagickFalse)
12099    InheritException(wand->exception,&wand->images->exception);
12100  return(status);
12101}
12102
12103/*
12104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12105%                                                                             %
12106%                                                                             %
12107%                                                                             %
12108%   M a g i c k T r a n s p o s e I m a g e                                   %
12109%                                                                             %
12110%                                                                             %
12111%                                                                             %
12112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12113%
12114%  MagickTransposeImage() creates a vertical mirror image by reflecting the
12115%  pixels around the central x-axis while rotating them 90-degrees.
12116%
12117%  The format of the MagickTransposeImage method is:
12118%
12119%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12120%
12121%  A description of each parameter follows:
12122%
12123%    o wand: the magick wand.
12124%
12125*/
12126WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12127{
12128  Image
12129    *transpose_image;
12130
12131  assert(wand != (MagickWand *) NULL);
12132  assert(wand->signature == WandSignature);
12133  if (wand->debug != MagickFalse)
12134    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12135  if (wand->images == (Image *) NULL)
12136    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12137  transpose_image=TransposeImage(wand->images,wand->exception);
12138  if (transpose_image == (Image *) NULL)
12139    return(MagickFalse);
12140  ReplaceImageInList(&wand->images,transpose_image);
12141  return(MagickTrue);
12142}
12143
12144/*
12145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12146%                                                                             %
12147%                                                                             %
12148%                                                                             %
12149%   M a g i c k T r a n s v e r s e I m a g e                                 %
12150%                                                                             %
12151%                                                                             %
12152%                                                                             %
12153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12154%
12155%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12156%  pixels around the central y-axis while rotating them 270-degrees.
12157%
12158%  The format of the MagickTransverseImage method is:
12159%
12160%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12161%
12162%  A description of each parameter follows:
12163%
12164%    o wand: the magick wand.
12165%
12166*/
12167WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12168{
12169  Image
12170    *transverse_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  transverse_image=TransverseImage(wand->images,wand->exception);
12179  if (transverse_image == (Image *) NULL)
12180    return(MagickFalse);
12181  ReplaceImageInList(&wand->images,transverse_image);
12182  return(MagickTrue);
12183}
12184
12185/*
12186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12187%                                                                             %
12188%                                                                             %
12189%                                                                             %
12190%   M a g i c k T r i m I m a g e                                             %
12191%                                                                             %
12192%                                                                             %
12193%                                                                             %
12194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12195%
12196%  MagickTrimImage() remove edges that are the background color from the image.
12197%
12198%  The format of the MagickTrimImage method is:
12199%
12200%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12201%
12202%  A description of each parameter follows:
12203%
12204%    o wand: the magick wand.
12205%
12206%    o fuzz: By default target must match a particular pixel color
12207%      exactly.  However, in many cases two colors may differ by a small amount.
12208%      The fuzz member of image defines how much tolerance is acceptable to
12209%      consider two colors as the same.  For example, set fuzz to 10 and the
12210%      color red at intensities of 100 and 102 respectively are now interpreted
12211%      as the same color for the purposes of the floodfill.
12212%
12213*/
12214WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12215{
12216  Image
12217    *trim_image;
12218
12219  assert(wand != (MagickWand *) NULL);
12220  assert(wand->signature == WandSignature);
12221  if (wand->debug != MagickFalse)
12222    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12223  if (wand->images == (Image *) NULL)
12224    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12225  wand->images->fuzz=fuzz;
12226  trim_image=TrimImage(wand->images,wand->exception);
12227  if (trim_image == (Image *) NULL)
12228    return(MagickFalse);
12229  ReplaceImageInList(&wand->images,trim_image);
12230  return(MagickTrue);
12231}
12232
12233/*
12234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12235%                                                                             %
12236%                                                                             %
12237%                                                                             %
12238%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12239%                                                                             %
12240%                                                                             %
12241%                                                                             %
12242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12243%
12244%  MagickUniqueImageColors() discards all but one of any pixel color.
12245%
12246%  The format of the MagickUniqueImageColors method is:
12247%
12248%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12249%
12250%  A description of each parameter follows:
12251%
12252%    o wand: the magick wand.
12253%
12254*/
12255WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12256{
12257  Image
12258    *unique_image;
12259
12260  assert(wand != (MagickWand *) NULL);
12261  assert(wand->signature == WandSignature);
12262  if (wand->debug != MagickFalse)
12263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12264  if (wand->images == (Image *) NULL)
12265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12266  unique_image=UniqueImageColors(wand->images,wand->exception);
12267  if (unique_image == (Image *) NULL)
12268    return(MagickFalse);
12269  ReplaceImageInList(&wand->images,unique_image);
12270  return(MagickTrue);
12271}
12272
12273/*
12274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12275%                                                                             %
12276%                                                                             %
12277%                                                                             %
12278%   M a g i c k U n s h a r p M a s k I m a g e                               %
12279%                                                                             %
12280%                                                                             %
12281%                                                                             %
12282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12283%
12284%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12285%  Gaussian operator of the given radius and standard deviation (sigma).
12286%  For reasonable results, radius should be larger than sigma.  Use a radius
12287%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12288%
12289%  The format of the MagickUnsharpMaskImage method is:
12290%
12291%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12292%        const double radius,const double sigma,const double amount,
12293%        const double threshold)
12294%      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12295%        const ChannelType channel,const double radius,const double sigma,
12296%        const double amount,const double threshold)
12297%
12298%  A description of each parameter follows:
12299%
12300%    o wand: the magick wand.
12301%
12302%    o channel: the image channel(s).
12303%
12304%    o radius: the radius of the Gaussian, in pixels, not counting the center
12305%      pixel.
12306%
12307%    o sigma: the standard deviation of the Gaussian, in pixels.
12308%
12309%    o amount: the percentage of the difference between the original and the
12310%      blur image that is added back into the original.
12311%
12312%    o threshold: the threshold in pixels needed to apply the diffence amount.
12313%
12314*/
12315
12316WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12317  const double radius,const double sigma,const double amount,
12318  const double threshold)
12319{
12320  MagickBooleanType
12321    status;
12322
12323  status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12324    amount,threshold);
12325  return(status);
12326}
12327
12328WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12329  const ChannelType channel,const double radius,const double sigma,
12330  const double amount,const double threshold)
12331{
12332  Image
12333    *unsharp_image;
12334
12335  assert(wand != (MagickWand *) NULL);
12336  assert(wand->signature == WandSignature);
12337  if (wand->debug != MagickFalse)
12338    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12339  if (wand->images == (Image *) NULL)
12340    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12341  unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12342    amount,threshold,wand->exception);
12343  if (unsharp_image == (Image *) NULL)
12344    return(MagickFalse);
12345  ReplaceImageInList(&wand->images,unsharp_image);
12346  return(MagickTrue);
12347}
12348
12349/*
12350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12351%                                                                             %
12352%                                                                             %
12353%                                                                             %
12354%   M a g i c k V i g n e t t e I m a g e                                     %
12355%                                                                             %
12356%                                                                             %
12357%                                                                             %
12358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12359%
12360%  MagickVignetteImage() softens the edges of the image in vignette style.
12361%
12362%  The format of the MagickVignetteImage method is:
12363%
12364%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12365%        const double black_point,const double white_point,const ssize_t x,
12366%        const ssize_t y)
12367%
12368%  A description of each parameter follows:
12369%
12370%    o wand: the magick wand.
12371%
12372%    o black_point: the black point.
12373%
12374%    o white_point: the white point.
12375%
12376%    o x, y:  Define the x and y ellipse offset.
12377%
12378*/
12379WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12380  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12381{
12382  Image
12383    *vignette_image;
12384
12385  assert(wand != (MagickWand *) NULL);
12386  assert(wand->signature == WandSignature);
12387  if (wand->debug != MagickFalse)
12388    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12389  if (wand->images == (Image *) NULL)
12390    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12391  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12392    wand->exception);
12393  if (vignette_image == (Image *) NULL)
12394    return(MagickFalse);
12395  ReplaceImageInList(&wand->images,vignette_image);
12396  return(MagickTrue);
12397}
12398
12399/*
12400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12401%                                                                             %
12402%                                                                             %
12403%                                                                             %
12404%   M a g i c k W a v e I m a g e                                             %
12405%                                                                             %
12406%                                                                             %
12407%                                                                             %
12408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12409%
12410%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12411%  the pixels vertically along a sine wave whose amplitude and wavelength
12412%  is specified by the given parameters.
12413%
12414%  The format of the MagickWaveImage method is:
12415%
12416%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12417%        const double wave_length)
12418%
12419%  A description of each parameter follows:
12420%
12421%    o wand: the magick wand.
12422%
12423%    o amplitude, wave_length:  Define the amplitude and wave length of the
12424%      sine wave.
12425%
12426*/
12427WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12428  const double amplitude,const double wave_length)
12429{
12430  Image
12431    *wave_image;
12432
12433  assert(wand != (MagickWand *) NULL);
12434  assert(wand->signature == WandSignature);
12435  if (wand->debug != MagickFalse)
12436    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12437  if (wand->images == (Image *) NULL)
12438    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12439  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12440  if (wave_image == (Image *) NULL)
12441    return(MagickFalse);
12442  ReplaceImageInList(&wand->images,wave_image);
12443  return(MagickTrue);
12444}
12445
12446/*
12447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12448%                                                                             %
12449%                                                                             %
12450%                                                                             %
12451%   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                         %
12452%                                                                             %
12453%                                                                             %
12454%                                                                             %
12455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12456%
12457%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12458%  above the threshold into white while leaving all pixels below the threshold
12459%  unchanged.
12460%
12461%  The format of the MagickWhiteThresholdImage method is:
12462%
12463%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12464%        const PixelWand *threshold)
12465%
12466%  A description of each parameter follows:
12467%
12468%    o wand: the magick wand.
12469%
12470%    o threshold: the pixel wand.
12471%
12472*/
12473WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12474  const PixelWand *threshold)
12475{
12476  char
12477    thresholds[MaxTextExtent];
12478
12479  MagickBooleanType
12480    status;
12481
12482  assert(wand != (MagickWand *) NULL);
12483  assert(wand->signature == WandSignature);
12484  if (wand->debug != MagickFalse)
12485    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12486  if (wand->images == (Image *) NULL)
12487    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12488  (void) FormatLocaleString(thresholds,MaxTextExtent,
12489    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12490    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12491    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12492  status=WhiteThresholdImage(wand->images,thresholds);
12493  if (status == MagickFalse)
12494    InheritException(wand->exception,&wand->images->exception);
12495  return(status);
12496}
12497
12498/*
12499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12500%                                                                             %
12501%                                                                             %
12502%                                                                             %
12503%   M a g i c k W r i t e I m a g e                                           %
12504%                                                                             %
12505%                                                                             %
12506%                                                                             %
12507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12508%
12509%  MagickWriteImage() writes an image to the specified filename.  If the
12510%  filename parameter is NULL, the image is written to the filename set
12511%  by MagickReadImage() or MagickSetImageFilename().
12512%
12513%  The format of the MagickWriteImage method is:
12514%
12515%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12516%        const char *filename)
12517%
12518%  A description of each parameter follows:
12519%
12520%    o wand: the magick wand.
12521%
12522%    o filename: the image filename.
12523%
12524%
12525*/
12526WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12527  const char *filename)
12528{
12529  Image
12530    *image;
12531
12532  ImageInfo
12533    *write_info;
12534
12535  MagickBooleanType
12536    status;
12537
12538  assert(wand != (MagickWand *) NULL);
12539  assert(wand->signature == WandSignature);
12540  if (wand->debug != MagickFalse)
12541    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12542  if (wand->images == (Image *) NULL)
12543    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12544  if (filename != (const char *) NULL)
12545    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12546  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12547  if (image == (Image *) NULL)
12548    return(MagickFalse);
12549  write_info=CloneImageInfo(wand->image_info);
12550  write_info->adjoin=MagickTrue;
12551  status=WriteImage(write_info,image);
12552  if (status == MagickFalse)
12553    InheritException(wand->exception,&image->exception);
12554  image=DestroyImage(image);
12555  write_info=DestroyImageInfo(write_info);
12556  return(status);
12557}
12558
12559/*
12560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12561%                                                                             %
12562%                                                                             %
12563%                                                                             %
12564%   M a g i c k W r i t e I m a g e F i l e                                   %
12565%                                                                             %
12566%                                                                             %
12567%                                                                             %
12568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12569%
12570%  MagickWriteImageFile() writes an image to an open file descriptor.
12571%
12572%  The format of the MagickWriteImageFile method is:
12573%
12574%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12575%
12576%  A description of each parameter follows:
12577%
12578%    o wand: the magick wand.
12579%
12580%    o file: the file descriptor.
12581%
12582*/
12583WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12584{
12585  Image
12586    *image;
12587
12588  ImageInfo
12589    *write_info;
12590
12591  MagickBooleanType
12592    status;
12593
12594  assert(wand != (MagickWand *) NULL);
12595  assert(wand->signature == WandSignature);
12596  assert(file != (FILE *) NULL);
12597  if (wand->debug != MagickFalse)
12598    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12599  if (wand->images == (Image *) NULL)
12600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12601  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12602  if (image == (Image *) NULL)
12603    return(MagickFalse);
12604  write_info=CloneImageInfo(wand->image_info);
12605  SetImageInfoFile(write_info,file);
12606  write_info->adjoin=MagickTrue;
12607  status=WriteImage(write_info,image);
12608  write_info=DestroyImageInfo(write_info);
12609  if (status == MagickFalse)
12610    InheritException(wand->exception,&image->exception);
12611  image=DestroyImage(image);
12612  return(status);
12613}
12614
12615/*
12616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12617%                                                                             %
12618%                                                                             %
12619%                                                                             %
12620%   M a g i c k W r i t e I m a g e s                                         %
12621%                                                                             %
12622%                                                                             %
12623%                                                                             %
12624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12625%
12626%  MagickWriteImages() writes an image or image sequence.
12627%
12628%  The format of the MagickWriteImages method is:
12629%
12630%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12631%        const char *filename,const MagickBooleanType adjoin)
12632%
12633%  A description of each parameter follows:
12634%
12635%    o wand: the magick wand.
12636%
12637%    o filename: the image filename.
12638%
12639%    o adjoin: join images into a single multi-image file.
12640%
12641*/
12642WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12643  const char *filename,const MagickBooleanType adjoin)
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  write_info->adjoin=adjoin;
12659  status=WriteImages(write_info,wand->images,filename,wand->exception);
12660  if (status == MagickFalse)
12661    InheritException(wand->exception,&wand->images->exception);
12662  write_info=DestroyImageInfo(write_info);
12663  return(status);
12664}
12665
12666/*
12667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12668%                                                                             %
12669%                                                                             %
12670%                                                                             %
12671%   M a g i c k W r i t e I m a g e s F i l e                                 %
12672%                                                                             %
12673%                                                                             %
12674%                                                                             %
12675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12676%
12677%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12678%
12679%  The format of the MagickWriteImagesFile method is:
12680%
12681%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12682%
12683%  A description of each parameter follows:
12684%
12685%    o wand: the magick wand.
12686%
12687%    o file: the file descriptor.
12688%
12689*/
12690WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12691{
12692  ImageInfo
12693    *write_info;
12694
12695  MagickBooleanType
12696    status;
12697
12698  assert(wand != (MagickWand *) NULL);
12699  assert(wand->signature == WandSignature);
12700  if (wand->debug != MagickFalse)
12701    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12702  if (wand->images == (Image *) NULL)
12703    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12704  write_info=CloneImageInfo(wand->image_info);
12705  SetImageInfoFile(write_info,file);
12706  write_info->adjoin=MagickTrue;
12707  status=WriteImages(write_info,wand->images,(const char *) NULL,
12708    wand->exception);
12709  write_info=DestroyImageInfo(write_info);
12710  if (status == MagickFalse)
12711    InheritException(wand->exception,&wand->images->exception);
12712  return(status);
12713}
12714