magick-image.c revision 4c08aed51c5899665ade97263692328eea4af106
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 C h a n n e l s                       %
1764%                                                                             %
1765%                                                                             %
1766%                                                                             %
1767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768%
1769%  MagickCompareImageChannels() compares one or more image channels of an image
1770%  to a reconstructed image and returns the difference image.
1771%
1772%  The format of the MagickCompareImageChannels method is:
1773%
1774%      MagickWand *MagickCompareImageChannels(MagickWand *wand,
1775%        const MagickWand *reference,const ChannelType channel,
1776%        const MetricType metric,double *distortion)
1777%
1778%  A description of each parameter follows:
1779%
1780%    o wand: the magick wand.
1781%
1782%    o reference: the reference wand.
1783%
1784%    o channel: the channel.
1785%
1786%    o metric: the metric.
1787%
1788%    o distortion: the computed distortion between the images.
1789%
1790*/
1791WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1792  const MagickWand *reference,const ChannelType channel,const MetricType metric,
1793  double *distortion)
1794{
1795  Image
1796    *compare_image;
1797
1798  assert(wand != (MagickWand *) NULL);
1799  assert(wand->signature == WandSignature);
1800  if (wand->debug != MagickFalse)
1801    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1802  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1803    {
1804      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1805        "ContainsNoImages","`%s'",wand->name);
1806      return((MagickWand *) NULL);
1807    }
1808  compare_image=CompareImageChannels(wand->images,reference->images,channel,
1809    metric,distortion,&wand->images->exception);
1810  if (compare_image == (Image *) NULL)
1811    return((MagickWand *) NULL);
1812  return(CloneMagickWandFromImages(wand,compare_image));
1813}
1814
1815/*
1816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1817%                                                                             %
1818%                                                                             %
1819%                                                                             %
1820%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1821%                                                                             %
1822%                                                                             %
1823%                                                                             %
1824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825%
1826%  MagickCompareImageLayers() compares each image with the next in a sequence
1827%  and returns the maximum bounding region of any pixel differences it
1828%  discovers.
1829%
1830%  The format of the MagickCompareImageLayers method is:
1831%
1832%      MagickWand *MagickCompareImageLayers(MagickWand *wand,
1833%        const ImageLayerMethod method)
1834%
1835%  A description of each parameter follows:
1836%
1837%    o wand: the magick wand.
1838%
1839%    o method: the compare method.
1840%
1841*/
1842WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1843  const ImageLayerMethod method)
1844{
1845  Image
1846    *layers_image;
1847
1848  assert(wand != (MagickWand *) NULL);
1849  assert(wand->signature == WandSignature);
1850  if (wand->debug != MagickFalse)
1851    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1852  if (wand->images == (Image *) NULL)
1853    return((MagickWand *) NULL);
1854  layers_image=CompareImageLayers(wand->images,method,wand->exception);
1855  if (layers_image == (Image *) NULL)
1856    return((MagickWand *) NULL);
1857  return(CloneMagickWandFromImages(wand,layers_image));
1858}
1859
1860/*
1861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1862%                                                                             %
1863%                                                                             %
1864%                                                                             %
1865%   M a g i c k C o m p a r e I m a g e s                                     %
1866%                                                                             %
1867%                                                                             %
1868%                                                                             %
1869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1870%
1871%  MagickCompareImages() compares an image to a reconstructed image and returns
1872%  the specified difference image.
1873%
1874%  The format of the MagickCompareImages method is:
1875%
1876%      MagickWand *MagickCompareImages(MagickWand *wand,
1877%        const MagickWand *reference,const MetricType metric,
1878%        double *distortion)
1879%
1880%  A description of each parameter follows:
1881%
1882%    o wand: the magick wand.
1883%
1884%    o reference: the reference wand.
1885%
1886%    o metric: the metric.
1887%
1888%    o distortion: the computed distortion between the images.
1889%
1890*/
1891WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1892  const MagickWand *reference,const MetricType metric,double *distortion)
1893{
1894  Image
1895    *compare_image;
1896
1897
1898  assert(wand != (MagickWand *) NULL);
1899  assert(wand->signature == WandSignature);
1900  if (wand->debug != MagickFalse)
1901    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1902  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1903    {
1904      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1905        "ContainsNoImages","`%s'",wand->name);
1906      return((MagickWand *) NULL);
1907    }
1908  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1909    &wand->images->exception);
1910  if (compare_image == (Image *) NULL)
1911    return((MagickWand *) NULL);
1912  return(CloneMagickWandFromImages(wand,compare_image));
1913}
1914
1915/*
1916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1917%                                                                             %
1918%                                                                             %
1919%                                                                             %
1920%   M a g i c k C o m p o s i t e I m a g e                                   %
1921%                                                                             %
1922%                                                                             %
1923%                                                                             %
1924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1925%
1926%  MagickCompositeImage() composite one image onto another at the specified
1927%  offset.
1928%
1929%  The format of the MagickCompositeImage method is:
1930%
1931%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1932%        const MagickWand *composite_wand,const CompositeOperator compose,
1933%        const ssize_t x,const ssize_t y)
1934%      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1935%        const ChannelType channel,const MagickWand *composite_wand,
1936%        const CompositeOperator compose,const ssize_t x,const ssize_t y)
1937%
1938%  A description of each parameter follows:
1939%
1940%    o wand: the magick wand.
1941%
1942%    o composite_image: the composite image.
1943%
1944%    o compose: This operator affects how the composite is applied to the
1945%      image.  The default is Over.  Choose from these operators:
1946%
1947%        OverCompositeOp       InCompositeOp         OutCompositeOp
1948%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1949%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1950%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1951%        DisplaceCompositeOp
1952%
1953%    o x: the column offset of the composited image.
1954%
1955%    o y: the row offset of the composited image.
1956%
1957*/
1958
1959WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1960  const MagickWand *composite_wand,const CompositeOperator compose,const ssize_t x,
1961  const ssize_t y)
1962{
1963  MagickBooleanType
1964    status;
1965
1966  status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1967    compose,x,y);
1968  return(status);
1969}
1970
1971WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1972  const ChannelType channel,const MagickWand *composite_wand,
1973  const CompositeOperator compose,const ssize_t x,const ssize_t y)
1974{
1975  MagickBooleanType
1976    status;
1977
1978  assert(wand != (MagickWand *) NULL);
1979  assert(wand->signature == WandSignature);
1980  if (wand->debug != MagickFalse)
1981    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1982  if ((wand->images == (Image *) NULL) ||
1983      (composite_wand->images == (Image *) NULL))
1984    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1985  status=CompositeImageChannel(wand->images,channel,compose,
1986    composite_wand->images,x,y);
1987  if (status == MagickFalse)
1988    InheritException(wand->exception,&wand->images->exception);
1989  return(status);
1990}
1991
1992/*
1993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1994%                                                                             %
1995%                                                                             %
1996%                                                                             %
1997%   M a g i c k C o n t r a s t I m a g e                                     %
1998%                                                                             %
1999%                                                                             %
2000%                                                                             %
2001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2002%
2003%  MagickContrastImage() enhances the intensity differences between the lighter
2004%  and darker elements of the image.  Set sharpen to a value other than 0 to
2005%  increase the image contrast otherwise the contrast is reduced.
2006%
2007%  The format of the MagickContrastImage method is:
2008%
2009%      MagickBooleanType MagickContrastImage(MagickWand *wand,
2010%        const MagickBooleanType sharpen)
2011%
2012%  A description of each parameter follows:
2013%
2014%    o wand: the magick wand.
2015%
2016%    o sharpen: Increase or decrease image contrast.
2017%
2018%
2019*/
2020WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2021  const MagickBooleanType sharpen)
2022{
2023  MagickBooleanType
2024    status;
2025
2026  assert(wand != (MagickWand *) NULL);
2027  assert(wand->signature == WandSignature);
2028  if (wand->debug != MagickFalse)
2029    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2030  if (wand->images == (Image *) NULL)
2031    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2032  status=ContrastImage(wand->images,sharpen);
2033  if (status == MagickFalse)
2034    InheritException(wand->exception,&wand->images->exception);
2035  return(status);
2036}
2037
2038/*
2039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040%                                                                             %
2041%                                                                             %
2042%                                                                             %
2043%   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                       %
2044%                                                                             %
2045%                                                                             %
2046%                                                                             %
2047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2048%
2049%  MagickContrastStretchImage() enhances the contrast of a color image by
2050%  adjusting the pixels color to span the entire range of colors available.
2051%  You can also reduce the influence of a particular channel with a gamma
2052%  value of 0.
2053%
2054%  The format of the MagickContrastStretchImage method is:
2055%
2056%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2057%        const double black_point,const double white_point)
2058%      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2059%        const ChannelType channel,const double black_point,
2060%        const double white_point)
2061%
2062%  A description of each parameter follows:
2063%
2064%    o wand: the magick wand.
2065%
2066%    o channel: the image channel(s).
2067%
2068%    o black_point: the black point.
2069%
2070%    o white_point: the white point.
2071%
2072*/
2073
2074WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2075  const double black_point,const double white_point)
2076{
2077  MagickBooleanType
2078    status;
2079
2080  status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2081    white_point);
2082  return(status);
2083}
2084
2085WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2086  const ChannelType channel,const double black_point,const double white_point)
2087{
2088  MagickBooleanType
2089    status;
2090
2091  assert(wand != (MagickWand *) NULL);
2092  assert(wand->signature == WandSignature);
2093  if (wand->debug != MagickFalse)
2094    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2095  if (wand->images == (Image *) NULL)
2096    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2097  status=ContrastStretchImageChannel(wand->images,channel,black_point,
2098    white_point);
2099  if (status == MagickFalse)
2100    InheritException(wand->exception,&wand->images->exception);
2101  return(status);
2102}
2103
2104/*
2105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2106%                                                                             %
2107%                                                                             %
2108%                                                                             %
2109%   M a g i c k C o n v o l v e I m a g e                                     %
2110%                                                                             %
2111%                                                                             %
2112%                                                                             %
2113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2114%
2115%  MagickConvolveImage() applies a custom convolution kernel to the image.
2116%
2117%  The format of the MagickConvolveImage method is:
2118%
2119%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2120%        const size_t order,const double *kernel)
2121%      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2122%        const ChannelType channel,const size_t order,
2123%        const double *kernel)
2124%
2125%  A description of each parameter follows:
2126%
2127%    o wand: the magick wand.
2128%
2129%    o channel: the image channel(s).
2130%
2131%    o order: the number of columns and rows in the filter kernel.
2132%
2133%    o kernel: An array of doubles representing the convolution kernel.
2134%
2135*/
2136
2137WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2138  const size_t order,const double *kernel)
2139{
2140  MagickBooleanType
2141    status;
2142
2143  status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2144  return(status);
2145}
2146
2147WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2148  const ChannelType channel,const size_t order,const double *kernel)
2149{
2150  Image
2151    *convolve_image;
2152
2153  assert(wand != (MagickWand *) NULL);
2154  assert(wand->signature == WandSignature);
2155  if (wand->debug != MagickFalse)
2156    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2157  if (kernel == (const double *) NULL)
2158    return(MagickFalse);
2159  if (wand->images == (Image *) NULL)
2160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2161  convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2162    wand->exception);
2163  if (convolve_image == (Image *) NULL)
2164    return(MagickFalse);
2165  ReplaceImageInList(&wand->images,convolve_image);
2166  return(MagickTrue);
2167}
2168
2169/*
2170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2171%                                                                             %
2172%                                                                             %
2173%                                                                             %
2174%   M a g i c k C r o p I m a g e                                             %
2175%                                                                             %
2176%                                                                             %
2177%                                                                             %
2178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2179%
2180%  MagickCropImage() extracts a region of the image.
2181%
2182%  The format of the MagickCropImage method is:
2183%
2184%      MagickBooleanType MagickCropImage(MagickWand *wand,
2185%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2186%
2187%  A description of each parameter follows:
2188%
2189%    o wand: the magick wand.
2190%
2191%    o width: the region width.
2192%
2193%    o height: the region height.
2194%
2195%    o x: the region x-offset.
2196%
2197%    o y: the region y-offset.
2198%
2199*/
2200WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2201  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2202{
2203  Image
2204    *crop_image;
2205
2206  RectangleInfo
2207    crop;
2208
2209  assert(wand != (MagickWand *) NULL);
2210  assert(wand->signature == WandSignature);
2211  if (wand->debug != MagickFalse)
2212    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2213  if (wand->images == (Image *) NULL)
2214    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2215  crop.width=width;
2216  crop.height=height;
2217  crop.x=x;
2218  crop.y=y;
2219  crop_image=CropImage(wand->images,&crop,wand->exception);
2220  if (crop_image == (Image *) NULL)
2221    return(MagickFalse);
2222  ReplaceImageInList(&wand->images,crop_image);
2223  return(MagickTrue);
2224}
2225
2226/*
2227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2228%                                                                             %
2229%                                                                             %
2230%                                                                             %
2231%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2232%                                                                             %
2233%                                                                             %
2234%                                                                             %
2235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2236%
2237%  MagickCycleColormapImage() displaces an image's colormap by a given number
2238%  of positions.  If you cycle the colormap a number of times you can produce
2239%  a psychodelic effect.
2240%
2241%  The format of the MagickCycleColormapImage method is:
2242%
2243%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2244%        const ssize_t displace)
2245%
2246%  A description of each parameter follows:
2247%
2248%    o wand: the magick wand.
2249%
2250%    o pixel_wand: the pixel wand.
2251%
2252*/
2253WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2254  const ssize_t displace)
2255{
2256  MagickBooleanType
2257    status;
2258
2259  assert(wand != (MagickWand *) NULL);
2260  assert(wand->signature == WandSignature);
2261  if (wand->debug != MagickFalse)
2262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263  if (wand->images == (Image *) NULL)
2264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2265  status=CycleColormapImage(wand->images,displace);
2266  if (status == MagickFalse)
2267    InheritException(wand->exception,&wand->images->exception);
2268  return(status);
2269}
2270
2271/*
2272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273%                                                                             %
2274%                                                                             %
2275%                                                                             %
2276%   M a g i c k C o n s t i t u t e I m a g e                                 %
2277%                                                                             %
2278%                                                                             %
2279%                                                                             %
2280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2281%
2282%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2283%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2284%  The data can be char, short int, int, float, or double.  Float and double
2285%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2286%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2287%  example, to create a 640x480 image from unsigned red-green-blue character
2288%  data, use
2289%
2290%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2291%
2292%  The format of the MagickConstituteImage method is:
2293%
2294%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2295%        const size_t columns,const size_t rows,const char *map,
2296%        const StorageType storage,void *pixels)
2297%
2298%  A description of each parameter follows:
2299%
2300%    o wand: the magick wand.
2301%
2302%    o columns: width in pixels of the image.
2303%
2304%    o rows: height in pixels of the image.
2305%
2306%    o map:  This string reflects the expected ordering of the pixel array.
2307%      It can be any combination or order of R = red, G = green, B = blue,
2308%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2309%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2310%      P = pad.
2311%
2312%    o storage: Define the data type of the pixels.  Float and double types are
2313%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2314%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2315%      LongPixel, QuantumPixel, or ShortPixel.
2316%
2317%    o pixels: This array of values contain the pixel components as defined by
2318%      map and type.  You must preallocate this array where the expected
2319%      length varies depending on the values of width, height, map, and type.
2320%
2321%
2322*/
2323WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2324  const size_t columns,const size_t rows,const char *map,
2325  const StorageType storage,const void *pixels)
2326{
2327  Image
2328    *images;
2329
2330  assert(wand != (MagickWand *) NULL);
2331  assert(wand->signature == WandSignature);
2332  if (wand->debug != MagickFalse)
2333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2334  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2335  if (images == (Image *) NULL)
2336    return(MagickFalse);
2337  return(InsertImageInWand(wand,images));
2338}
2339
2340/*
2341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2342%                                                                             %
2343%                                                                             %
2344%                                                                             %
2345%   M a g i c k D e c i p h e r I m a g e                                     %
2346%                                                                             %
2347%                                                                             %
2348%                                                                             %
2349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2350%
2351%  MagickDecipherImage() converts cipher pixels to plain pixels.
2352%
2353%  The format of the MagickDecipherImage method is:
2354%
2355%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2356%        const char *passphrase)
2357%
2358%  A description of each parameter follows:
2359%
2360%    o wand: the magick wand.
2361%
2362%    o passphrase: the passphrase.
2363%
2364*/
2365WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2366  const char *passphrase)
2367{
2368  assert(wand != (MagickWand *) NULL);
2369  assert(wand->signature == WandSignature);
2370  if (wand->debug != MagickFalse)
2371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2372  if (wand->images == (Image *) NULL)
2373    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2374  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2375}
2376
2377/*
2378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2379%                                                                             %
2380%                                                                             %
2381%                                                                             %
2382%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2383%                                                                             %
2384%                                                                             %
2385%                                                                             %
2386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2387%
2388%  MagickDeconstructImages() compares each image with the next in a sequence
2389%  and returns the maximum bounding region of any pixel differences it
2390%  discovers.
2391%
2392%  The format of the MagickDeconstructImages method is:
2393%
2394%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2395%
2396%  A description of each parameter follows:
2397%
2398%    o wand: the magick wand.
2399%
2400*/
2401WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2402{
2403  Image
2404    *deconstruct_image;
2405
2406  assert(wand != (MagickWand *) NULL);
2407  assert(wand->signature == WandSignature);
2408  if (wand->debug != MagickFalse)
2409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2410  if (wand->images == (Image *) NULL)
2411    return((MagickWand *) NULL);
2412  deconstruct_image=CompareImageLayers(wand->images,CompareAnyLayer,
2413    wand->exception);
2414  if (deconstruct_image == (Image *) NULL)
2415    return((MagickWand *) NULL);
2416  return(CloneMagickWandFromImages(wand,deconstruct_image));
2417}
2418
2419/*
2420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2421%                                                                             %
2422%                                                                             %
2423%                                                                             %
2424%     M a g i c k D e s k e w I m a g e                                       %
2425%                                                                             %
2426%                                                                             %
2427%                                                                             %
2428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2429%
2430%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2431%  occurs in scanned images because of the camera being misaligned,
2432%  imperfections in the scanning or surface, or simply because the paper was
2433%  not placed completely flat when scanned.
2434%
2435%  The format of the MagickDeskewImage method is:
2436%
2437%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2438%        const double threshold)
2439%
2440%  A description of each parameter follows:
2441%
2442%    o wand: the magick wand.
2443%
2444%    o threshold: separate background from foreground.
2445%
2446*/
2447WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2448  const double threshold)
2449{
2450  Image
2451    *sepia_image;
2452
2453  assert(wand != (MagickWand *) NULL);
2454  assert(wand->signature == WandSignature);
2455  if (wand->debug != MagickFalse)
2456    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2457  if (wand->images == (Image *) NULL)
2458    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2459  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2460  if (sepia_image == (Image *) NULL)
2461    return(MagickFalse);
2462  ReplaceImageInList(&wand->images,sepia_image);
2463  return(MagickTrue);
2464}
2465
2466/*
2467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2468%                                                                             %
2469%                                                                             %
2470%                                                                             %
2471%     M a g i c k D e s p e c k l e I m a g e                                 %
2472%                                                                             %
2473%                                                                             %
2474%                                                                             %
2475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2476%
2477%  MagickDespeckleImage() reduces the speckle noise in an image while
2478%  perserving the edges of the original image.
2479%
2480%  The format of the MagickDespeckleImage method is:
2481%
2482%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2483%
2484%  A description of each parameter follows:
2485%
2486%    o wand: the magick wand.
2487%
2488*/
2489WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2490{
2491  Image
2492    *despeckle_image;
2493
2494  assert(wand != (MagickWand *) NULL);
2495  assert(wand->signature == WandSignature);
2496  if (wand->debug != MagickFalse)
2497    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2498  if (wand->images == (Image *) NULL)
2499    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2500  despeckle_image=DespeckleImage(wand->images,wand->exception);
2501  if (despeckle_image == (Image *) NULL)
2502    return(MagickFalse);
2503  ReplaceImageInList(&wand->images,despeckle_image);
2504  return(MagickTrue);
2505}
2506
2507/*
2508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2509%                                                                             %
2510%                                                                             %
2511%                                                                             %
2512%   M a g i c k D e s t r o y I m a g e                                       %
2513%                                                                             %
2514%                                                                             %
2515%                                                                             %
2516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2517%
2518%  MagickDestroyImage() dereferences an image, deallocating memory associated
2519%  with the image if the reference count becomes zero.
2520%
2521%  The format of the MagickDestroyImage method is:
2522%
2523%      Image *MagickDestroyImage(Image *image)
2524%
2525%  A description of each parameter follows:
2526%
2527%    o image: the image.
2528%
2529*/
2530WandExport Image *MagickDestroyImage(Image *image)
2531{
2532  return(DestroyImage(image));
2533}
2534
2535/*
2536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2537%                                                                             %
2538%                                                                             %
2539%                                                                             %
2540%   M a g i c k D i s p l a y I m a g e                                       %
2541%                                                                             %
2542%                                                                             %
2543%                                                                             %
2544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2545%
2546%  MagickDisplayImage() displays an image.
2547%
2548%  The format of the MagickDisplayImage method is:
2549%
2550%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2551%        const char *server_name)
2552%
2553%  A description of each parameter follows:
2554%
2555%    o wand: the magick wand.
2556%
2557%    o server_name: the X server name.
2558%
2559*/
2560WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2561  const char *server_name)
2562{
2563  Image
2564    *image;
2565
2566  MagickBooleanType
2567    status;
2568
2569  assert(wand != (MagickWand *) NULL);
2570  assert(wand->signature == WandSignature);
2571  if (wand->debug != MagickFalse)
2572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2573  if (wand->images == (Image *) NULL)
2574    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2575  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2576  if (image == (Image *) NULL)
2577    return(MagickFalse);
2578  (void) CloneString(&wand->image_info->server_name,server_name);
2579  status=DisplayImages(wand->image_info,image);
2580  if (status == MagickFalse)
2581    InheritException(wand->exception,&image->exception);
2582  image=DestroyImage(image);
2583  return(status);
2584}
2585
2586/*
2587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2588%                                                                             %
2589%                                                                             %
2590%                                                                             %
2591%   M a g i c k D i s p l a y I m a g e s                                     %
2592%                                                                             %
2593%                                                                             %
2594%                                                                             %
2595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2596%
2597%  MagickDisplayImages() displays an image or image sequence.
2598%
2599%  The format of the MagickDisplayImages method is:
2600%
2601%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2602%        const char *server_name)
2603%
2604%  A description of each parameter follows:
2605%
2606%    o wand: the magick wand.
2607%
2608%    o server_name: the X server name.
2609%
2610*/
2611WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2612  const char *server_name)
2613{
2614  MagickBooleanType
2615    status;
2616
2617  assert(wand != (MagickWand *) NULL);
2618  assert(wand->signature == WandSignature);
2619  if (wand->debug != MagickFalse)
2620    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2621  (void) CloneString(&wand->image_info->server_name,server_name);
2622  status=DisplayImages(wand->image_info,wand->images);
2623  if (status == MagickFalse)
2624    InheritException(wand->exception,&wand->images->exception);
2625  return(status);
2626}
2627
2628/*
2629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630%                                                                             %
2631%                                                                             %
2632%                                                                             %
2633%   M a g i c k D i s t o r t I m a g e                                       %
2634%                                                                             %
2635%                                                                             %
2636%                                                                             %
2637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2638%
2639%  MagickDistortImage() distorts an image using various distortion methods, by
2640%  mapping color lookups of the source image to a new destination image
2641%  usally of the same size as the source image, unless 'bestfit' is set to
2642%  true.
2643%
2644%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2645%  adjusted to ensure the whole source 'image' will just fit within the final
2646%  destination image, which will be sized and offset accordingly.  Also in
2647%  many cases the virtual offset of the source image will be taken into
2648%  account in the mapping.
2649%
2650%  The format of the MagickDistortImage method is:
2651%
2652%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2653%        const DistortImageMethod method,const size_t number_arguments,
2654%        const double *arguments,const MagickBooleanType bestfit)
2655%
2656%  A description of each parameter follows:
2657%
2658%    o image: the image to be distorted.
2659%
2660%    o method: the method of image distortion.
2661%
2662%        ArcDistortion always ignores the source image offset, and always
2663%        'bestfit' the destination image with the top left corner offset
2664%        relative to the polar mapping center.
2665%
2666%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2667%        style of image distortion.
2668%
2669%        Affine, Perspective, and Bilinear, do least squares fitting of the
2670%        distortion when more than the minimum number of control point pairs
2671%        are provided.
2672%
2673%        Perspective, and Bilinear, falls back to a Affine distortion when less
2674%        that 4 control point pairs are provided. While Affine distortions let
2675%        you use any number of control point pairs, that is Zero pairs is a
2676%        no-Op (viewport only) distrotion, one pair is a translation and two
2677%        pairs of control points do a scale-rotate-translate, without any
2678%        shearing.
2679%
2680%    o number_arguments: the number of arguments given for this distortion
2681%      method.
2682%
2683%    o arguments: the arguments for this distortion method.
2684%
2685%    o bestfit: Attempt to resize destination to fit distorted source.
2686%
2687*/
2688WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2689  const DistortImageMethod method,const size_t number_arguments,
2690  const double *arguments,const MagickBooleanType bestfit)
2691{
2692  Image
2693    *distort_image;
2694
2695  assert(wand != (MagickWand *) NULL);
2696  assert(wand->signature == WandSignature);
2697  if (wand->debug != MagickFalse)
2698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2699  if (wand->images == (Image *) NULL)
2700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2701  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2702    bestfit,wand->exception);
2703  if (distort_image == (Image *) NULL)
2704    return(MagickFalse);
2705  ReplaceImageInList(&wand->images,distort_image);
2706  return(MagickTrue);
2707}
2708
2709/*
2710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711%                                                                             %
2712%                                                                             %
2713%                                                                             %
2714%   M a g i c k D r a w I m a g e                                             %
2715%                                                                             %
2716%                                                                             %
2717%                                                                             %
2718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2719%
2720%  MagickDrawImage() renders the drawing wand on the current image.
2721%
2722%  The format of the MagickDrawImage method is:
2723%
2724%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2725%        const DrawingWand *drawing_wand)
2726%
2727%  A description of each parameter follows:
2728%
2729%    o wand: the magick wand.
2730%
2731%    o drawing_wand: the draw wand.
2732%
2733*/
2734WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2735  const DrawingWand *drawing_wand)
2736{
2737  char
2738    *primitive;
2739
2740  DrawInfo
2741    *draw_info;
2742
2743  MagickBooleanType
2744    status;
2745
2746  assert(wand != (MagickWand *) NULL);
2747  assert(wand->signature == WandSignature);
2748  if (wand->debug != MagickFalse)
2749    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2750  if (wand->images == (Image *) NULL)
2751    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2752  draw_info=PeekDrawingWand(drawing_wand);
2753  if ((draw_info == (DrawInfo *) NULL) ||
2754      (draw_info->primitive == (char *) NULL))
2755    return(MagickFalse);
2756  primitive=AcquireString(draw_info->primitive);
2757  draw_info=DestroyDrawInfo(draw_info);
2758  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2759  draw_info->primitive=primitive;
2760  status=DrawImage(wand->images,draw_info);
2761  if (status == MagickFalse)
2762    InheritException(wand->exception,&wand->images->exception);
2763  draw_info=DestroyDrawInfo(draw_info);
2764  return(status);
2765}
2766
2767/*
2768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2769%                                                                             %
2770%                                                                             %
2771%                                                                             %
2772%   M a g i c k E d g e I m a g e                                             %
2773%                                                                             %
2774%                                                                             %
2775%                                                                             %
2776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2777%
2778%  MagickEdgeImage() enhance edges within the image with a convolution filter
2779%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2780%  radius for you.
2781%
2782%  The format of the MagickEdgeImage method is:
2783%
2784%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2785%
2786%  A description of each parameter follows:
2787%
2788%    o wand: the magick wand.
2789%
2790%    o radius: the radius of the pixel neighborhood.
2791%
2792*/
2793WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2794  const double radius)
2795{
2796  Image
2797    *edge_image;
2798
2799  assert(wand != (MagickWand *) NULL);
2800  assert(wand->signature == WandSignature);
2801  if (wand->debug != MagickFalse)
2802    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2803  if (wand->images == (Image *) NULL)
2804    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2805  edge_image=EdgeImage(wand->images,radius,wand->exception);
2806  if (edge_image == (Image *) NULL)
2807    return(MagickFalse);
2808  ReplaceImageInList(&wand->images,edge_image);
2809  return(MagickTrue);
2810}
2811
2812/*
2813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2814%                                                                             %
2815%                                                                             %
2816%                                                                             %
2817%   M a g i c k E m b o s s I m a g e                                         %
2818%                                                                             %
2819%                                                                             %
2820%                                                                             %
2821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2822%
2823%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2824%  effect.  We convolve the image with a Gaussian operator of the given radius
2825%  and standard deviation (sigma).  For reasonable results, radius should be
2826%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2827%  radius for you.
2828%
2829%  The format of the MagickEmbossImage method is:
2830%
2831%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2832%        const double sigma)
2833%
2834%  A description of each parameter follows:
2835%
2836%    o wand: the magick wand.
2837%
2838%    o radius: the radius of the Gaussian, in pixels, not counting the center
2839%      pixel.
2840%
2841%    o sigma: the standard deviation of the Gaussian, in pixels.
2842%
2843*/
2844WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2845  const double radius,const double sigma)
2846{
2847  Image
2848    *emboss_image;
2849
2850  assert(wand != (MagickWand *) NULL);
2851  assert(wand->signature == WandSignature);
2852  if (wand->debug != MagickFalse)
2853    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2854  if (wand->images == (Image *) NULL)
2855    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2856  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2857  if (emboss_image == (Image *) NULL)
2858    return(MagickFalse);
2859  ReplaceImageInList(&wand->images,emboss_image);
2860  return(MagickTrue);
2861}
2862
2863/*
2864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2865%                                                                             %
2866%                                                                             %
2867%                                                                             %
2868%   M a g i c k E n c i p h e r I m a g e                                     %
2869%                                                                             %
2870%                                                                             %
2871%                                                                             %
2872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2873%
2874%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2875%
2876%  The format of the MagickEncipherImage method is:
2877%
2878%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2879%        const char *passphrase)
2880%
2881%  A description of each parameter follows:
2882%
2883%    o wand: the magick wand.
2884%
2885%    o passphrase: the passphrase.
2886%
2887*/
2888WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2889  const char *passphrase)
2890{
2891  assert(wand != (MagickWand *) NULL);
2892  assert(wand->signature == WandSignature);
2893  if (wand->debug != MagickFalse)
2894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2895  if (wand->images == (Image *) NULL)
2896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2897  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2898}
2899
2900/*
2901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2902%                                                                             %
2903%                                                                             %
2904%                                                                             %
2905%   M a g i c k E n h a n c e I m a g e                                       %
2906%                                                                             %
2907%                                                                             %
2908%                                                                             %
2909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2910%
2911%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2912%  noisy image.
2913%
2914%  The format of the MagickEnhanceImage method is:
2915%
2916%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2917%
2918%  A description of each parameter follows:
2919%
2920%    o wand: the magick wand.
2921%
2922*/
2923WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2924{
2925  Image
2926    *enhance_image;
2927
2928  assert(wand != (MagickWand *) NULL);
2929  assert(wand->signature == WandSignature);
2930  if (wand->debug != MagickFalse)
2931    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2932  if (wand->images == (Image *) NULL)
2933    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2934  enhance_image=EnhanceImage(wand->images,wand->exception);
2935  if (enhance_image == (Image *) NULL)
2936    return(MagickFalse);
2937  ReplaceImageInList(&wand->images,enhance_image);
2938  return(MagickTrue);
2939}
2940
2941/*
2942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2943%                                                                             %
2944%                                                                             %
2945%                                                                             %
2946%   M a g i c k E q u a l i z e I m a g e                                     %
2947%                                                                             %
2948%                                                                             %
2949%                                                                             %
2950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2951%
2952%  MagickEqualizeImage() equalizes the image histogram.
2953%
2954%  The format of the MagickEqualizeImage method is:
2955%
2956%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2957%      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2958%        const ChannelType channel)
2959%
2960%  A description of each parameter follows:
2961%
2962%    o wand: the magick wand.
2963%
2964%    o channel: the image channel(s).
2965%
2966*/
2967
2968WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2969{
2970  MagickBooleanType
2971    status;
2972
2973  status=MagickEqualizeImageChannel(wand,DefaultChannels);
2974  return(status);
2975}
2976
2977WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2978  const ChannelType channel)
2979{
2980  MagickBooleanType
2981    status;
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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2989  status=EqualizeImageChannel(wand->images,channel);
2990  if (status == MagickFalse)
2991    InheritException(wand->exception,&wand->images->exception);
2992  return(status);
2993}
2994
2995/*
2996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2997%                                                                             %
2998%                                                                             %
2999%                                                                             %
3000%   M a g i c k E v a l u a t e I m a g e                                     %
3001%                                                                             %
3002%                                                                             %
3003%                                                                             %
3004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3005%
3006%  MagickEvaluateImage() applys an arithmetic, relational, or logical
3007%  expression to an image.  Use these operators to lighten or darken an image,
3008%  to increase or decrease contrast in an image, or to produce the "negative"
3009%  of an image.
3010%
3011%  The format of the MagickEvaluateImage method is:
3012%
3013%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3014%        const MagickEvaluateOperator operator,const double value)
3015%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3016%        const MagickEvaluateOperator operator)
3017%      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3018%        const ChannelType channel,const MagickEvaluateOperator op,
3019%        const double value)
3020%
3021%  A description of each parameter follows:
3022%
3023%    o wand: the magick wand.
3024%
3025%    o channel: the channel(s).
3026%
3027%    o op: A channel operator.
3028%
3029%    o value: A value value.
3030%
3031*/
3032
3033WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3034  const MagickEvaluateOperator op,const double value)
3035{
3036  MagickBooleanType
3037    status;
3038
3039  assert(wand != (MagickWand *) NULL);
3040  assert(wand->signature == WandSignature);
3041  if (wand->debug != MagickFalse)
3042    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3043  if (wand->images == (Image *) NULL)
3044    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3045  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
3046  if (status == MagickFalse)
3047    InheritException(wand->exception,&wand->images->exception);
3048  return(status);
3049}
3050
3051WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3052  const MagickEvaluateOperator op)
3053{
3054  Image
3055    *evaluate_image;
3056
3057  assert(wand != (MagickWand *) NULL);
3058  assert(wand->signature == WandSignature);
3059  if (wand->debug != MagickFalse)
3060    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3061  if (wand->images == (Image *) NULL)
3062    return((MagickWand *) NULL);
3063  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3064  if (evaluate_image == (Image *) NULL)
3065    return((MagickWand *) NULL);
3066  return(CloneMagickWandFromImages(wand,evaluate_image));
3067}
3068
3069WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3070  const ChannelType channel,const MagickEvaluateOperator op,const double value)
3071{
3072  MagickBooleanType
3073    status;
3074
3075  assert(wand != (MagickWand *) NULL);
3076  assert(wand->signature == WandSignature);
3077  if (wand->debug != MagickFalse)
3078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3079  if (wand->images == (Image *) NULL)
3080    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3081  status=EvaluateImageChannel(wand->images,channel,op,value,
3082    &wand->images->exception);
3083  return(status);
3084}
3085
3086/*
3087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3088%                                                                             %
3089%                                                                             %
3090%                                                                             %
3091%   M a g i c k E x p o r t I m a g e P i x e l s                             %
3092%                                                                             %
3093%                                                                             %
3094%                                                                             %
3095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3096%
3097%  MagickExportImagePixels() extracts pixel data from an image and returns it
3098%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3099%  an error is encountered.  The data is returned as char, short int, int,
3100%  ssize_t, float, or double in the order specified by map.
3101%
3102%  Suppose you want to extract the first scanline of a 640x480 image as
3103%  character data in red-green-blue order:
3104%
3105%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3106%
3107%  The format of the MagickExportImagePixels method is:
3108%
3109%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3110%        const ssize_t x,const ssize_t y,const size_t columns,
3111%        const size_t rows,const char *map,const StorageType storage,
3112%        void *pixels)
3113%
3114%  A description of each parameter follows:
3115%
3116%    o wand: the magick wand.
3117%
3118%    o x, y, columns, rows:  These values define the perimeter
3119%      of a region of pixels you want to extract.
3120%
3121%    o map:  This string reflects the expected ordering of the pixel array.
3122%      It can be any combination or order of R = red, G = green, B = blue,
3123%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3124%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3125%      P = pad.
3126%
3127%    o storage: Define the data type of the pixels.  Float and double types are
3128%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3129%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3130%      LongPixel, QuantumPixel, or ShortPixel.
3131%
3132%    o pixels: This array of values contain the pixel components as defined by
3133%      map and type.  You must preallocate this array where the expected
3134%      length varies depending on the values of width, height, map, and type.
3135%
3136*/
3137WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3138  const ssize_t x,const ssize_t y,const size_t columns,
3139  const size_t rows,const char *map,const StorageType storage,
3140  void *pixels)
3141{
3142  MagickBooleanType
3143    status;
3144
3145  assert(wand != (MagickWand *) NULL);
3146  assert(wand->signature == WandSignature);
3147  if (wand->debug != MagickFalse)
3148    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3149  if (wand->images == (Image *) NULL)
3150    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3151  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3152    storage,pixels,wand->exception);
3153  if (status == MagickFalse)
3154    InheritException(wand->exception,&wand->images->exception);
3155  return(status);
3156}
3157
3158/*
3159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3160%                                                                             %
3161%                                                                             %
3162%                                                                             %
3163%   M a g i c k E x t e n t I m a g e                                         %
3164%                                                                             %
3165%                                                                             %
3166%                                                                             %
3167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3168%
3169%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3170%  and wand background color.  Set the (x,y) offset of the geometry to move
3171%  the original wand relative to the extended wand.
3172%
3173%  The format of the MagickExtentImage method is:
3174%
3175%      MagickBooleanType MagickExtentImage(MagickWand *wand,
3176%        const size_t width,const size_t height,const ssize_t x,
3177%        const ssize_t y)
3178%
3179%  A description of each parameter follows:
3180%
3181%    o wand: the magick wand.
3182%
3183%    o width: the region width.
3184%
3185%    o height: the region height.
3186%
3187%    o x: the region x offset.
3188%
3189%    o y: the region y offset.
3190%
3191*/
3192WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3193  const size_t width,const size_t height,const ssize_t x,
3194  const ssize_t y)
3195{
3196  Image
3197    *extent_image;
3198
3199  RectangleInfo
3200    extent;
3201
3202  assert(wand != (MagickWand *) NULL);
3203  assert(wand->signature == WandSignature);
3204  if (wand->debug != MagickFalse)
3205    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3206  if (wand->images == (Image *) NULL)
3207    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3208  extent.width=width;
3209  extent.height=height;
3210  extent.x=x;
3211  extent.y=y;
3212  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3213  if (extent_image == (Image *) NULL)
3214    return(MagickFalse);
3215  ReplaceImageInList(&wand->images,extent_image);
3216  return(MagickTrue);
3217}
3218
3219/*
3220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3221%                                                                             %
3222%                                                                             %
3223%                                                                             %
3224%   M a g i c k F i l t e r I m a g e                                         %
3225%                                                                             %
3226%                                                                             %
3227%                                                                             %
3228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3229%
3230%  MagickFilterImage() applies a custom convolution kernel to the image.
3231%
3232%  The format of the MagickFilterImage method is:
3233%
3234%      MagickBooleanType MagickFilterImage(MagickWand *wand,
3235%        const KernelInfo *kernel)
3236%      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3237%        const ChannelType channel,const KernelInfo *kernel)
3238%
3239%  A description of each parameter follows:
3240%
3241%    o wand: the magick wand.
3242%
3243%    o channel: the image channel(s).
3244%
3245%    o kernel: An array of doubles representing the convolution kernel.
3246%
3247*/
3248
3249WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3250  const KernelInfo *kernel)
3251{
3252  MagickBooleanType
3253    status;
3254
3255  status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3256  return(status);
3257}
3258
3259WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3260  const ChannelType channel,const KernelInfo *kernel)
3261{
3262  Image
3263    *filter_image;
3264
3265  assert(wand != (MagickWand *) NULL);
3266  assert(wand->signature == WandSignature);
3267  if (wand->debug != MagickFalse)
3268    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3269  if (kernel == (const KernelInfo *) NULL)
3270    return(MagickFalse);
3271  if (wand->images == (Image *) NULL)
3272    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3273  filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3274  if (filter_image == (Image *) NULL)
3275    return(MagickFalse);
3276  ReplaceImageInList(&wand->images,filter_image);
3277  return(MagickTrue);
3278}
3279
3280/*
3281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282%                                                                             %
3283%                                                                             %
3284%                                                                             %
3285%   M a g i c k F l i p I m a g e                                             %
3286%                                                                             %
3287%                                                                             %
3288%                                                                             %
3289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3290%
3291%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3292%  around the central x-axis.
3293%
3294%  The format of the MagickFlipImage method is:
3295%
3296%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3297%
3298%  A description of each parameter follows:
3299%
3300%    o wand: the magick wand.
3301%
3302*/
3303WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3304{
3305  Image
3306    *flip_image;
3307
3308  assert(wand != (MagickWand *) NULL);
3309  assert(wand->signature == WandSignature);
3310  if (wand->debug != MagickFalse)
3311    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3312  if (wand->images == (Image *) NULL)
3313    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3314  flip_image=FlipImage(wand->images,wand->exception);
3315  if (flip_image == (Image *) NULL)
3316    return(MagickFalse);
3317  ReplaceImageInList(&wand->images,flip_image);
3318  return(MagickTrue);
3319}
3320
3321/*
3322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323%                                                                             %
3324%                                                                             %
3325%                                                                             %
3326%   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                         %
3327%                                                                             %
3328%                                                                             %
3329%                                                                             %
3330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3331%
3332%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3333%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3334%  specified, the color value is changed for any neighbor pixel that does not
3335%  match the bordercolor member of image.
3336%
3337%  The format of the MagickFloodfillPaintImage method is:
3338%
3339%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3340%        const ChannelType channel,const PixelWand *fill,const double fuzz,
3341%        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3342%        const MagickBooleanType invert)
3343%
3344%  A description of each parameter follows:
3345%
3346%    o wand: the magick wand.
3347%
3348%    o channel: the channel(s).
3349%
3350%    o fill: the floodfill color pixel wand.
3351%
3352%    o fuzz: By default target must match a particular pixel color
3353%      exactly.  However, in many cases two colors may differ by a small amount.
3354%      The fuzz member of image defines how much tolerance is acceptable to
3355%      consider two colors as the same.  For example, set fuzz to 10 and the
3356%      color red at intensities of 100 and 102 respectively are now interpreted
3357%      as the same color for the purposes of the floodfill.
3358%
3359%    o bordercolor: the border color pixel wand.
3360%
3361%    o x,y: the starting location of the operation.
3362%
3363%    o invert: paint any pixel that does not match the target color.
3364%
3365*/
3366WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3367  const ChannelType channel,const PixelWand *fill,const double fuzz,
3368  const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3369  const MagickBooleanType invert)
3370{
3371  DrawInfo
3372    *draw_info;
3373
3374  MagickBooleanType
3375    status;
3376
3377  PixelInfo
3378    target;
3379
3380  assert(wand != (MagickWand *) NULL);
3381  assert(wand->signature == WandSignature);
3382  if (wand->debug != MagickFalse)
3383    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3384  if (wand->images == (Image *) NULL)
3385    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3386  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3387  PixelGetQuantumPacket(fill,&draw_info->fill);
3388  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3389    y % wand->images->rows,&target,wand->exception);
3390  if (bordercolor != (PixelWand *) NULL)
3391    PixelGetMagickColor(bordercolor,&target);
3392  wand->images->fuzz=fuzz;
3393  status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3394    invert);
3395  if (status == MagickFalse)
3396    InheritException(wand->exception,&wand->images->exception);
3397  draw_info=DestroyDrawInfo(draw_info);
3398  return(status);
3399}
3400
3401/*
3402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3403%                                                                             %
3404%                                                                             %
3405%                                                                             %
3406%   M a g i c k F l o p I m a g e                                             %
3407%                                                                             %
3408%                                                                             %
3409%                                                                             %
3410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3411%
3412%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3413%  around the central y-axis.
3414%
3415%  The format of the MagickFlopImage method is:
3416%
3417%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3418%
3419%  A description of each parameter follows:
3420%
3421%    o wand: the magick wand.
3422%
3423*/
3424WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3425{
3426  Image
3427    *flop_image;
3428
3429  assert(wand != (MagickWand *) NULL);
3430  assert(wand->signature == WandSignature);
3431  if (wand->debug != MagickFalse)
3432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3433  if (wand->images == (Image *) NULL)
3434    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3435  flop_image=FlopImage(wand->images,wand->exception);
3436  if (flop_image == (Image *) NULL)
3437    return(MagickFalse);
3438  ReplaceImageInList(&wand->images,flop_image);
3439  return(MagickTrue);
3440}
3441
3442/*
3443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3444%                                                                             %
3445%                                                                             %
3446%                                                                             %
3447%   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                     %
3448%                                                                             %
3449%                                                                             %
3450%                                                                             %
3451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452%
3453%  MagickForwardFourierTransformImage() implements the discrete Fourier
3454%  transform (DFT) of the image either as a magnitude / phase or real /
3455%  imaginary image pair.
3456%
3457%  The format of the MagickForwardFourierTransformImage method is:
3458%
3459%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3460%        const MagickBooleanType magnitude)
3461%
3462%  A description of each parameter follows:
3463%
3464%    o wand: the magick wand.
3465%
3466%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3467%      imaginary image pair.
3468%
3469*/
3470WandExport MagickBooleanType MagickForwardFourierTransformImage(
3471  MagickWand *wand,const MagickBooleanType magnitude)
3472{
3473  Image
3474    *forward_image;
3475
3476  assert(wand != (MagickWand *) NULL);
3477  assert(wand->signature == WandSignature);
3478  if (wand->debug != MagickFalse)
3479    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3480  if (wand->images == (Image *) NULL)
3481    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3482  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3483    wand->exception);
3484  if (forward_image == (Image *) NULL)
3485    return(MagickFalse);
3486  ReplaceImageInList(&wand->images,forward_image);
3487  return(MagickTrue);
3488}
3489
3490/*
3491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3492%                                                                             %
3493%                                                                             %
3494%                                                                             %
3495%   M a g i c k F r a m e I m a g e                                           %
3496%                                                                             %
3497%                                                                             %
3498%                                                                             %
3499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3500%
3501%  MagickFrameImage() adds a simulated three-dimensional border around the
3502%  image.  The width and height specify the border width of the vertical and
3503%  horizontal sides of the frame.  The inner and outer bevels indicate the
3504%  width of the inner and outer shadows of the frame.
3505%
3506%  The format of the MagickFrameImage method is:
3507%
3508%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3509%        const PixelWand *matte_color,const size_t width,
3510%        const size_t height,const ssize_t inner_bevel,
3511%        const ssize_t outer_bevel)
3512%
3513%  A description of each parameter follows:
3514%
3515%    o wand: the magick wand.
3516%
3517%    o matte_color: the frame color pixel wand.
3518%
3519%    o width: the border width.
3520%
3521%    o height: the border height.
3522%
3523%    o inner_bevel: the inner bevel width.
3524%
3525%    o outer_bevel: the outer bevel width.
3526%
3527*/
3528WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3529  const PixelWand *matte_color,const size_t width,
3530  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3531{
3532  Image
3533    *frame_image;
3534
3535  FrameInfo
3536    frame_info;
3537
3538  assert(wand != (MagickWand *) NULL);
3539  assert(wand->signature == WandSignature);
3540  if (wand->debug != MagickFalse)
3541    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3542  if (wand->images == (Image *) NULL)
3543    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3544  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3545  frame_info.width=wand->images->columns+2*width;
3546  frame_info.height=wand->images->rows+2*height;
3547  frame_info.x=(ssize_t) width;
3548  frame_info.y=(ssize_t) height;
3549  frame_info.inner_bevel=inner_bevel;
3550  frame_info.outer_bevel=outer_bevel;
3551  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3552  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3553  if (frame_image == (Image *) NULL)
3554    return(MagickFalse);
3555  ReplaceImageInList(&wand->images,frame_image);
3556  return(MagickTrue);
3557}
3558
3559/*
3560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3561%                                                                             %
3562%                                                                             %
3563%                                                                             %
3564%   M a g i c k F u n c t i o n I m a g e                                     %
3565%                                                                             %
3566%                                                                             %
3567%                                                                             %
3568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3569%
3570%  MagickFunctionImage() applys an arithmetic, relational, or logical
3571%  expression to an image.  Use these operators to lighten or darken an image,
3572%  to increase or decrease contrast in an image, or to produce the "negative"
3573%  of an image.
3574%
3575%  The format of the MagickFunctionImage method is:
3576%
3577%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3578%        const MagickFunction function,const size_t number_arguments,
3579%        const double *arguments)
3580%      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3581%        const ChannelType channel,const MagickFunction function,
3582%        const size_t number_arguments,const double *arguments)
3583%
3584%  A description of each parameter follows:
3585%
3586%    o wand: the magick wand.
3587%
3588%    o channel: the channel(s).
3589%
3590%    o function: the image function.
3591%
3592%    o number_arguments: the number of function arguments.
3593%
3594%    o arguments: the function arguments.
3595%
3596*/
3597
3598WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3599  const MagickFunction function,const size_t number_arguments,
3600  const double *arguments)
3601{
3602  MagickBooleanType
3603    status;
3604
3605  assert(wand != (MagickWand *) NULL);
3606  assert(wand->signature == WandSignature);
3607  if (wand->debug != MagickFalse)
3608    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3609  if (wand->images == (Image *) NULL)
3610    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3611  status=FunctionImage(wand->images,function,number_arguments,arguments,
3612    &wand->images->exception);
3613  if (status == MagickFalse)
3614    InheritException(wand->exception,&wand->images->exception);
3615  return(status);
3616}
3617
3618WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3619  const ChannelType channel,const MagickFunction function,
3620  const size_t number_arguments,const double *arguments)
3621{
3622  MagickBooleanType
3623    status;
3624
3625  assert(wand != (MagickWand *) NULL);
3626  assert(wand->signature == WandSignature);
3627  if (wand->debug != MagickFalse)
3628    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3629  if (wand->images == (Image *) NULL)
3630    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3631  status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3632    arguments,&wand->images->exception);
3633  return(status);
3634}
3635
3636/*
3637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3638%                                                                             %
3639%                                                                             %
3640%                                                                             %
3641%   M a g i c k F x I m a g e                                                 %
3642%                                                                             %
3643%                                                                             %
3644%                                                                             %
3645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3646%
3647%  MagickFxImage() evaluate expression for each pixel in the image.
3648%
3649%  The format of the MagickFxImage method is:
3650%
3651%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3652%      MagickWand *MagickFxImageChannel(MagickWand *wand,
3653%        const ChannelType channel,const char *expression)
3654%
3655%  A description of each parameter follows:
3656%
3657%    o wand: the magick wand.
3658%
3659%    o channel: the image channel(s).
3660%
3661%    o expression: the expression.
3662%
3663*/
3664
3665WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3666{
3667  MagickWand
3668    *fx_wand;
3669
3670  fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3671  return(fx_wand);
3672}
3673
3674WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3675  const ChannelType channel,const char *expression)
3676{
3677  Image
3678    *fx_image;
3679
3680  assert(wand != (MagickWand *) NULL);
3681  assert(wand->signature == WandSignature);
3682  if (wand->debug != MagickFalse)
3683    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3684  if (wand->images == (Image *) NULL)
3685    return((MagickWand *) NULL);
3686  fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3687  if (fx_image == (Image *) NULL)
3688    return((MagickWand *) NULL);
3689  return(CloneMagickWandFromImages(wand,fx_image));
3690}
3691
3692/*
3693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3694%                                                                             %
3695%                                                                             %
3696%                                                                             %
3697%   M a g i c k G a m m a I m a g e                                           %
3698%                                                                             %
3699%                                                                             %
3700%                                                                             %
3701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3702%
3703%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3704%  different devices will have perceptual differences in the way the image's
3705%  intensities are represented on the screen.  Specify individual gamma levels
3706%  for the red, green, and blue channels, or adjust all three with the gamma
3707%  parameter.  Values typically range from 0.8 to 2.3.
3708%
3709%  You can also reduce the influence of a particular channel with a gamma
3710%  value of 0.
3711%
3712%  The format of the MagickGammaImage method is:
3713%
3714%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3715%      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3716%        const ChannelType channel,const double gamma)
3717%
3718%  A description of each parameter follows:
3719%
3720%    o wand: the magick wand.
3721%
3722%    o channel: the channel.
3723%
3724%    o level: Define the level of gamma correction.
3725%
3726*/
3727
3728WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3729  const double gamma)
3730{
3731  MagickBooleanType
3732    status;
3733
3734  status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3735  return(status);
3736}
3737
3738WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3739  const ChannelType channel,const double gamma)
3740{
3741  MagickBooleanType
3742    status;
3743
3744  assert(wand != (MagickWand *) NULL);
3745  assert(wand->signature == WandSignature);
3746  if (wand->debug != MagickFalse)
3747    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3748  if (wand->images == (Image *) NULL)
3749    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3750  status=GammaImageChannel(wand->images,channel,gamma);
3751  if (status == MagickFalse)
3752    InheritException(wand->exception,&wand->images->exception);
3753  return(status);
3754}
3755
3756/*
3757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3758%                                                                             %
3759%                                                                             %
3760%                                                                             %
3761%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3762%                                                                             %
3763%                                                                             %
3764%                                                                             %
3765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3766%
3767%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3768%  Gaussian operator of the given radius and standard deviation (sigma).
3769%  For reasonable results, the radius should be larger than sigma.  Use a
3770%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3771%
3772%  The format of the MagickGaussianBlurImage method is:
3773%
3774%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3775%        const double radius,const double sigma)
3776%      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3777%        const ChannelType channel,const double radius,const double sigma)
3778%
3779%  A description of each parameter follows:
3780%
3781%    o wand: the magick wand.
3782%
3783%    o channel: the image channel(s).
3784%
3785%    o radius: the radius of the Gaussian, in pixels, not counting the center
3786%      pixel.
3787%
3788%    o sigma: the standard deviation of the Gaussian, in pixels.
3789%
3790*/
3791
3792WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3793  const double radius,const double sigma)
3794{
3795  MagickBooleanType
3796    status;
3797
3798  status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3799  return(status);
3800}
3801
3802WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3803  const ChannelType channel,const double radius,const double sigma)
3804{
3805  Image
3806    *blur_image;
3807
3808  assert(wand != (MagickWand *) NULL);
3809  assert(wand->signature == WandSignature);
3810  if (wand->debug != MagickFalse)
3811    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3812  if (wand->images == (Image *) NULL)
3813    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3814  blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3815    wand->exception);
3816  if (blur_image == (Image *) NULL)
3817    return(MagickFalse);
3818  ReplaceImageInList(&wand->images,blur_image);
3819  return(MagickTrue);
3820}
3821
3822/*
3823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3824%                                                                             %
3825%                                                                             %
3826%                                                                             %
3827%   M a g i c k G e t I m a g e                                               %
3828%                                                                             %
3829%                                                                             %
3830%                                                                             %
3831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3832%
3833%  MagickGetImage() gets the image at the current image index.
3834%
3835%  The format of the MagickGetImage method is:
3836%
3837%      MagickWand *MagickGetImage(MagickWand *wand)
3838%
3839%  A description of each parameter follows:
3840%
3841%    o wand: the magick wand.
3842%
3843*/
3844WandExport MagickWand *MagickGetImage(MagickWand *wand)
3845{
3846  Image
3847    *image;
3848
3849  assert(wand != (MagickWand *) NULL);
3850  assert(wand->signature == WandSignature);
3851  if (wand->debug != MagickFalse)
3852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3853  if (wand->images == (Image *) NULL)
3854    {
3855      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3856        "ContainsNoImages","`%s'",wand->name);
3857      return((MagickWand *) NULL);
3858    }
3859  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3860  if (image == (Image *) NULL)
3861    return((MagickWand *) NULL);
3862  return(CloneMagickWandFromImages(wand,image));
3863}
3864
3865/*
3866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3867%                                                                             %
3868%                                                                             %
3869%                                                                             %
3870%   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                       %
3871%                                                                             %
3872%                                                                             %
3873%                                                                             %
3874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3875%
3876%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3877%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3878%  than CMYKA.
3879%
3880%  The format of the MagickGetImageAlphaChannel method is:
3881%
3882%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3883%
3884%  A description of each parameter follows:
3885%
3886%    o wand: the magick wand.
3887%
3888*/
3889WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3890{
3891  assert(wand != (MagickWand *) NULL);
3892  assert(wand->signature == WandSignature);
3893  if (wand->debug != MagickFalse)
3894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3895  if (wand->images == (Image *) NULL)
3896    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3897  return(GetImageAlphaChannel(wand->images));
3898}
3899
3900/*
3901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3902%                                                                             %
3903%                                                                             %
3904%                                                                             %
3905%   M a g i c k G e t I m a g e C l i p M a s k                               %
3906%                                                                             %
3907%                                                                             %
3908%                                                                             %
3909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3910%
3911%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3912%
3913%  The format of the MagickGetImageClipMask method is:
3914%
3915%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3916%
3917%  A description of each parameter follows:
3918%
3919%    o wand: the magick wand.
3920%
3921*/
3922WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3923{
3924  Image
3925    *image;
3926
3927  assert(wand != (MagickWand *) NULL);
3928  assert(wand->signature == WandSignature);
3929  if (wand->debug != MagickFalse)
3930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3931  if (wand->images == (Image *) NULL)
3932    {
3933      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3934        "ContainsNoImages","`%s'",wand->name);
3935      return((MagickWand *) NULL);
3936    }
3937  image=GetImageClipMask(wand->images,wand->exception);
3938  if (image == (Image *) NULL)
3939    return((MagickWand *) NULL);
3940  return(CloneMagickWandFromImages(wand,image));
3941}
3942
3943/*
3944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3945%                                                                             %
3946%                                                                             %
3947%                                                                             %
3948%   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                 %
3949%                                                                             %
3950%                                                                             %
3951%                                                                             %
3952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3953%
3954%  MagickGetImageBackgroundColor() returns the image background color.
3955%
3956%  The format of the MagickGetImageBackgroundColor method is:
3957%
3958%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3959%        PixelWand *background_color)
3960%
3961%  A description of each parameter follows:
3962%
3963%    o wand: the magick wand.
3964%
3965%    o background_color: Return the background color.
3966%
3967*/
3968WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3969  PixelWand *background_color)
3970{
3971  assert(wand != (MagickWand *) NULL);
3972  assert(wand->signature == WandSignature);
3973  if (wand->debug != MagickFalse)
3974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3975  if (wand->images == (Image *) NULL)
3976    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3977  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3978  return(MagickTrue);
3979}
3980
3981/*
3982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3983%                                                                             %
3984%                                                                             %
3985%                                                                             %
3986%   M a g i c k G e t I m a g e B l o b                                       %
3987%                                                                             %
3988%                                                                             %
3989%                                                                             %
3990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3991%
3992%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3993%  the image as a blob (a formatted "file" in memory) and its length, starting
3994%  from the current position in the image sequence.  Use MagickSetImageFormat()
3995%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3996%
3997%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3998%  the image sequence.
3999%
4000%  Use MagickRelinquishMemory() to free the blob when you are done with it.
4001%
4002%  The format of the MagickGetImageBlob method is:
4003%
4004%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4005%
4006%  A description of each parameter follows:
4007%
4008%    o wand: the magick wand.
4009%
4010%    o length: the length of the blob.
4011%
4012*/
4013WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4014{
4015  assert(wand != (MagickWand *) NULL);
4016  assert(wand->signature == WandSignature);
4017  if (wand->debug != MagickFalse)
4018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4019  if (wand->images == (Image *) NULL)
4020    {
4021      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4022        "ContainsNoImages","`%s'",wand->name);
4023      return((unsigned char *) NULL);
4024    }
4025  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4026}
4027
4028/*
4029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4030%                                                                             %
4031%                                                                             %
4032%                                                                             %
4033%   M a g i c k G e t I m a g e s B l o b                                     %
4034%                                                                             %
4035%                                                                             %
4036%                                                                             %
4037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4038%
4039%  MagickGetImageBlob() implements direct to memory image formats.  It
4040%  returns the image sequence as a blob and its length.  The format of the image
4041%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4042%  return a different image format, use MagickSetImageFormat().
4043%
4044%  Note, some image formats do not permit multiple images to the same image
4045%  stream (e.g. JPEG).  in this instance, just the first image of the
4046%  sequence is returned as a blob.
4047%
4048%  The format of the MagickGetImagesBlob method is:
4049%
4050%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4051%
4052%  A description of each parameter follows:
4053%
4054%    o wand: the magick wand.
4055%
4056%    o length: the length of the blob.
4057%
4058*/
4059WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4060{
4061  unsigned char
4062    *blob;
4063
4064  assert(wand != (MagickWand *) NULL);
4065  assert(wand->signature == WandSignature);
4066  if (wand->debug != MagickFalse)
4067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4068  if (wand->images == (Image *) NULL)
4069    {
4070      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4071        "ContainsNoImages","`%s'",wand->name);
4072      return((unsigned char *) NULL);
4073    }
4074  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4075    wand->exception);
4076  return(blob);
4077}
4078
4079/*
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%                                                                             %
4082%                                                                             %
4083%                                                                             %
4084%   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                         %
4085%                                                                             %
4086%                                                                             %
4087%                                                                             %
4088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4089%
4090%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4091%  image.
4092%
4093%  The format of the MagickGetImageBluePrimary method is:
4094%
4095%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4096%        double *y)
4097%
4098%  A description of each parameter follows:
4099%
4100%    o wand: the magick wand.
4101%
4102%    o x: the chromaticity blue primary x-point.
4103%
4104%    o y: the chromaticity blue primary y-point.
4105%
4106*/
4107WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4108  double *x,double *y)
4109{
4110  assert(wand != (MagickWand *) NULL);
4111  assert(wand->signature == WandSignature);
4112  if (wand->debug != MagickFalse)
4113    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4114  if (wand->images == (Image *) NULL)
4115    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4116  *x=wand->images->chromaticity.blue_primary.x;
4117  *y=wand->images->chromaticity.blue_primary.y;
4118  return(MagickTrue);
4119}
4120
4121/*
4122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4123%                                                                             %
4124%                                                                             %
4125%                                                                             %
4126%   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                         %
4127%                                                                             %
4128%                                                                             %
4129%                                                                             %
4130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4131%
4132%  MagickGetImageBorderColor() returns the image border color.
4133%
4134%  The format of the MagickGetImageBorderColor method is:
4135%
4136%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4137%        PixelWand *border_color)
4138%
4139%  A description of each parameter follows:
4140%
4141%    o wand: the magick wand.
4142%
4143%    o border_color: Return the border color.
4144%
4145*/
4146WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4147  PixelWand *border_color)
4148{
4149  assert(wand != (MagickWand *) NULL);
4150  assert(wand->signature == WandSignature);
4151  if (wand->debug != MagickFalse)
4152    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4153  if (wand->images == (Image *) NULL)
4154    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4155  PixelSetQuantumPacket(border_color,&wand->images->border_color);
4156  return(MagickTrue);
4157}
4158
4159/*
4160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4161%                                                                             %
4162%                                                                             %
4163%                                                                             %
4164%   M a g i c k G e t I m a g e C h a n n e l D e p t h                       %
4165%                                                                             %
4166%                                                                             %
4167%                                                                             %
4168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4169%
4170%  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4171%
4172%  The format of the MagickGetImageChannelDepth method is:
4173%
4174%      size_t MagickGetImageChannelDepth(MagickWand *wand,
4175%        const ChannelType channel)
4176%
4177%  A description of each parameter follows:
4178%
4179%    o wand: the magick wand.
4180%
4181%    o channel: the image channel(s).
4182%
4183*/
4184WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
4185  const ChannelType channel)
4186{
4187  assert(wand != (MagickWand *) NULL);
4188  assert(wand->signature == WandSignature);
4189  if (wand->debug != MagickFalse)
4190    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4191  if (wand->images == (Image *) NULL)
4192    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4193  return(GetImageChannelDepth(wand->images,channel,wand->exception));
4194}
4195
4196/*
4197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4198%                                                                             %
4199%                                                                             %
4200%                                                                             %
4201%   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n             %
4202%                                                                             %
4203%                                                                             %
4204%                                                                             %
4205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4206%
4207%  MagickGetImageChannelDistortion() compares one or more image channels of an
4208%  image to a reconstructed image and returns the specified distortion metric.
4209%
4210%  The format of the MagickGetImageChannelDistortion method is:
4211%
4212%      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4213%        const MagickWand *reference,const ChannelType channel,
4214%        const MetricType metric,double *distortion)
4215%
4216%  A description of each parameter follows:
4217%
4218%    o wand: the magick wand.
4219%
4220%    o reference: the reference wand.
4221%
4222%    o channel: the channel.
4223%
4224%    o metric: the metric.
4225%
4226%    o distortion: the computed distortion between the images.
4227%
4228*/
4229WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4230  const MagickWand *reference,const ChannelType channel,const MetricType metric,
4231  double *distortion)
4232{
4233  MagickBooleanType
4234    status;
4235
4236  assert(wand != (MagickWand *) NULL);
4237  assert(wand->signature == WandSignature);
4238  if (wand->debug != MagickFalse)
4239    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4240  assert(reference != (MagickWand *) NULL);
4241  assert(reference->signature == WandSignature);
4242  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4243    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4244  status=GetImageChannelDistortion(wand->images,reference->images,channel,
4245    metric,distortion,&wand->images->exception);
4246  return(status);
4247}
4248
4249/*
4250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4251%                                                                             %
4252%                                                                             %
4253%                                                                             %
4254%   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s           %
4255%                                                                             %
4256%                                                                             %
4257%                                                                             %
4258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259%
4260%  MagickGetImageChannelDistortions() compares one or more image channels of an
4261%  image to a reconstructed image and returns the specified distortion metrics.
4262%
4263%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4264%
4265%  The format of the MagickGetImageChannelDistortion method is:
4266%
4267%      double *MagickGetImageChannelDistortion(MagickWand *wand,
4268%        const MagickWand *reference,const MetricType metric)
4269%
4270%  A description of each parameter follows:
4271%
4272%    o wand: the magick wand.
4273%
4274%    o reference: the reference wand.
4275%
4276%    o metric: the metric.
4277%
4278*/
4279WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4280  const MagickWand *reference,const MetricType metric)
4281{
4282  double
4283    *channel_distortion;
4284
4285  assert(wand != (MagickWand *) NULL);
4286  assert(wand->signature == WandSignature);
4287  if (wand->debug != MagickFalse)
4288    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4289  assert(reference != (MagickWand *) NULL);
4290  assert(reference->signature == WandSignature);
4291  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4292    {
4293      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4294        "ContainsNoImages","`%s'",wand->name);
4295      return((double *) NULL);
4296    }
4297  channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4298    metric,&wand->images->exception);
4299  return(channel_distortion);
4300}
4301
4302/*
4303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304%                                                                             %
4305%                                                                             %
4306%                                                                             %
4307%   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                 %
4308%                                                                             %
4309%                                                                             %
4310%                                                                             %
4311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4312%
4313%  MagickGetImageChannelFeatures() returns features for each channel in the
4314%  image in each of four directions (horizontal, vertical, left and right
4315%  diagonals) for the specified distance.  The features include the angular
4316%  second moment, contrast, correlation, sum of squares: variance, inverse
4317%  difference moment, sum average, sum varience, sum entropy, entropy,
4318%  difference variance, difference entropy, information measures of
4319%  correlation 1, information measures of correlation 2, and maximum
4320%  correlation coefficient.  You can access the red channel contrast, for
4321%  example, like this:
4322%
4323%      channel_features=MagickGetImageChannelFeatures(wand,1);
4324%      contrast=channel_features[RedChannel].contrast[0];
4325%
4326%  Use MagickRelinquishMemory() to free the statistics buffer.
4327%
4328%  The format of the MagickGetImageChannelFeatures method is:
4329%
4330%      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4331%        const size_t distance)
4332%
4333%  A description of each parameter follows:
4334%
4335%    o wand: the magick wand.
4336%
4337%    o distance: the distance.
4338%
4339*/
4340WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4341  const size_t distance)
4342{
4343  assert(wand != (MagickWand *) NULL);
4344  assert(wand->signature == WandSignature);
4345  if (wand->debug != MagickFalse)
4346    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4347  if (wand->images == (Image *) NULL)
4348    {
4349      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4350        "ContainsNoImages","`%s'",wand->name);
4351      return((ChannelFeatures *) NULL);
4352    }
4353  return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4354}
4355
4356/*
4357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4358%                                                                             %
4359%                                                                             %
4360%                                                                             %
4361%   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                 %
4362%                                                                             %
4363%                                                                             %
4364%                                                                             %
4365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4366%
4367%  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4368%  more image channels.
4369%
4370%  The format of the MagickGetImageChannelKurtosis method is:
4371%
4372%      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4373%        const ChannelType channel,double *kurtosis,double *skewness)
4374%
4375%  A description of each parameter follows:
4376%
4377%    o wand: the magick wand.
4378%
4379%    o channel: the image channel(s).
4380%
4381%    o kurtosis:  The kurtosis for the specified channel(s).
4382%
4383%    o skewness:  The skewness for the specified channel(s).
4384%
4385*/
4386WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4387  const ChannelType channel,double *kurtosis,double *skewness)
4388{
4389  MagickBooleanType
4390    status;
4391
4392  assert(wand != (MagickWand *) NULL);
4393  assert(wand->signature == WandSignature);
4394  if (wand->debug != MagickFalse)
4395    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4396  if (wand->images == (Image *) NULL)
4397    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4398  status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4399    wand->exception);
4400  return(status);
4401}
4402
4403/*
4404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4405%                                                                             %
4406%                                                                             %
4407%                                                                             %
4408%   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                         %
4409%                                                                             %
4410%                                                                             %
4411%                                                                             %
4412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4413%
4414%  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4415%  more image channels.
4416%
4417%  The format of the MagickGetImageChannelMean method is:
4418%
4419%      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4420%        const ChannelType channel,double *mean,double *standard_deviation)
4421%
4422%  A description of each parameter follows:
4423%
4424%    o wand: the magick wand.
4425%
4426%    o channel: the image channel(s).
4427%
4428%    o mean:  The mean pixel value for the specified channel(s).
4429%
4430%    o standard_deviation:  The standard deviation for the specified channel(s).
4431%
4432*/
4433WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4434  const ChannelType channel,double *mean,double *standard_deviation)
4435{
4436  MagickBooleanType
4437    status;
4438
4439  assert(wand != (MagickWand *) NULL);
4440  assert(wand->signature == WandSignature);
4441  if (wand->debug != MagickFalse)
4442    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4443  if (wand->images == (Image *) NULL)
4444    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4445  status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4446    wand->exception);
4447  return(status);
4448}
4449
4450/*
4451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4452%                                                                             %
4453%                                                                             %
4454%                                                                             %
4455%   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                       %
4456%                                                                             %
4457%                                                                             %
4458%                                                                             %
4459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4460%
4461%  MagickGetImageChannelRange() gets the range for one or more image channels.
4462%
4463%  The format of the MagickGetImageChannelRange method is:
4464%
4465%      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4466%        const ChannelType channel,double *minima,double *maxima)
4467%
4468%  A description of each parameter follows:
4469%
4470%    o wand: the magick wand.
4471%
4472%    o channel: the image channel(s).
4473%
4474%    o minima:  The minimum pixel value for the specified channel(s).
4475%
4476%    o maxima:  The maximum pixel value for the specified channel(s).
4477%
4478*/
4479WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4480  const ChannelType channel,double *minima,double *maxima)
4481{
4482  MagickBooleanType
4483    status;
4484
4485  assert(wand != (MagickWand *) NULL);
4486  assert(wand->signature == WandSignature);
4487  if (wand->debug != MagickFalse)
4488    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4489  if (wand->images == (Image *) NULL)
4490    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4491  status=GetImageChannelRange(wand->images,channel,minima,maxima,
4492    wand->exception);
4493  return(status);
4494}
4495
4496/*
4497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4498%                                                                             %
4499%                                                                             %
4500%                                                                             %
4501%   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             %
4502%                                                                             %
4503%                                                                             %
4504%                                                                             %
4505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4506%
4507%  MagickGetImageChannelStatistics() returns statistics for each channel in the
4508%  image.  The statistics include the channel depth, its minima and
4509%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4510%  You can access the red channel mean, for example, like this:
4511%
4512%      channel_statistics=MagickGetImageChannelStatistics(wand);
4513%      red_mean=channel_statistics[RedChannel].mean;
4514%
4515%  Use MagickRelinquishMemory() to free the statistics buffer.
4516%
4517%  The format of the MagickGetImageChannelStatistics method is:
4518%
4519%      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4520%
4521%  A description of each parameter follows:
4522%
4523%    o wand: the magick wand.
4524%
4525*/
4526WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4527{
4528  assert(wand != (MagickWand *) NULL);
4529  assert(wand->signature == WandSignature);
4530  if (wand->debug != MagickFalse)
4531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4532  if (wand->images == (Image *) NULL)
4533    {
4534      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4535        "ContainsNoImages","`%s'",wand->name);
4536      return((ChannelStatistics *) NULL);
4537    }
4538  return(GetImageChannelStatistics(wand->images,wand->exception));
4539}
4540
4541/*
4542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4543%                                                                             %
4544%                                                                             %
4545%                                                                             %
4546%   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                     %
4547%                                                                             %
4548%                                                                             %
4549%                                                                             %
4550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4551%
4552%  MagickGetImageColormapColor() returns the color of the specified colormap
4553%  index.
4554%
4555%  The format of the MagickGetImageColormapColor method is:
4556%
4557%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4558%        const size_t index,PixelWand *color)
4559%
4560%  A description of each parameter follows:
4561%
4562%    o wand: the magick wand.
4563%
4564%    o index: the offset into the image colormap.
4565%
4566%    o color: Return the colormap color in this wand.
4567%
4568*/
4569WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4570  const size_t index,PixelWand *color)
4571{
4572  assert(wand != (MagickWand *) NULL);
4573  assert(wand->signature == WandSignature);
4574  if (wand->debug != MagickFalse)
4575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4576  if (wand->images == (Image *) NULL)
4577    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4578  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4579      (index >= wand->images->colors))
4580    {
4581      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4582        "InvalidColormapIndex","`%s'",wand->name);
4583      return(MagickFalse);
4584    }
4585  PixelSetQuantumPacket(color,wand->images->colormap+index);
4586  return(MagickTrue);
4587}
4588
4589/*
4590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4591%                                                                             %
4592%                                                                             %
4593%                                                                             %
4594%   M a g i c k G e t I m a g e C o l o r s                                   %
4595%                                                                             %
4596%                                                                             %
4597%                                                                             %
4598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4599%
4600%  MagickGetImageColors() gets the number of unique colors in the image.
4601%
4602%  The format of the MagickGetImageColors method is:
4603%
4604%      size_t MagickGetImageColors(MagickWand *wand)
4605%
4606%  A description of each parameter follows:
4607%
4608%    o wand: the magick wand.
4609%
4610*/
4611WandExport size_t MagickGetImageColors(MagickWand *wand)
4612{
4613  assert(wand != (MagickWand *) NULL);
4614  assert(wand->signature == WandSignature);
4615  if (wand->debug != MagickFalse)
4616    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4617  if (wand->images == (Image *) NULL)
4618    {
4619      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4620        "ContainsNoImages","`%s'",wand->name);
4621      return(0);
4622    }
4623  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4624}
4625
4626/*
4627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4628%                                                                             %
4629%                                                                             %
4630%                                                                             %
4631%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4632%                                                                             %
4633%                                                                             %
4634%                                                                             %
4635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4636%
4637%  MagickGetImageColorspace() gets the image colorspace.
4638%
4639%  The format of the MagickGetImageColorspace method is:
4640%
4641%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4642%
4643%  A description of each parameter follows:
4644%
4645%    o wand: the magick wand.
4646%
4647*/
4648WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4649{
4650  assert(wand != (MagickWand *) NULL);
4651  assert(wand->signature == WandSignature);
4652  if (wand->debug != MagickFalse)
4653    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4654  if (wand->images == (Image *) NULL)
4655    {
4656      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4657        "ContainsNoImages","`%s'",wand->name);
4658      return(UndefinedColorspace);
4659    }
4660  return(wand->images->colorspace);
4661}
4662
4663/*
4664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4665%                                                                             %
4666%                                                                             %
4667%                                                                             %
4668%   M a g i c k G e t I m a g e C o m p o s e                                 %
4669%                                                                             %
4670%                                                                             %
4671%                                                                             %
4672%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4673%
4674%  MagickGetImageCompose() returns the composite operator associated with the
4675%  image.
4676%
4677%  The format of the MagickGetImageCompose method is:
4678%
4679%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4680%
4681%  A description of each parameter follows:
4682%
4683%    o wand: the magick wand.
4684%
4685*/
4686WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4687{
4688  assert(wand != (MagickWand *) NULL);
4689  assert(wand->signature == WandSignature);
4690  if (wand->debug != MagickFalse)
4691    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4692  if (wand->images == (Image *) NULL)
4693    {
4694      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4695        "ContainsNoImages","`%s'",wand->name);
4696      return(UndefinedCompositeOp);
4697    }
4698  return(wand->images->compose);
4699}
4700
4701/*
4702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4703%                                                                             %
4704%                                                                             %
4705%                                                                             %
4706%   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                         %
4707%                                                                             %
4708%                                                                             %
4709%                                                                             %
4710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4711%
4712%  MagickGetImageCompression() gets the image compression.
4713%
4714%  The format of the MagickGetImageCompression method is:
4715%
4716%      CompressionType MagickGetImageCompression(MagickWand *wand)
4717%
4718%  A description of each parameter follows:
4719%
4720%    o wand: the magick wand.
4721%
4722*/
4723WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4724{
4725  assert(wand != (MagickWand *) NULL);
4726  assert(wand->signature == WandSignature);
4727  if (wand->debug != MagickFalse)
4728    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4729  if (wand->images == (Image *) NULL)
4730    {
4731      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4732        "ContainsNoImages","`%s'",wand->name);
4733      return(UndefinedCompression);
4734    }
4735  return(wand->images->compression);
4736}
4737
4738/*
4739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4740%                                                                             %
4741%                                                                             %
4742%                                                                             %
4743%   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           %
4744%                                                                             %
4745%                                                                             %
4746%                                                                             %
4747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4748%
4749%  MagickGetImageCompression() gets the image compression quality.
4750%
4751%  The format of the MagickGetImageCompression method is:
4752%
4753%      size_t MagickGetImageCompression(MagickWand *wand)
4754%
4755%  A description of each parameter follows:
4756%
4757%    o wand: the magick wand.
4758%
4759*/
4760WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4761{
4762  assert(wand != (MagickWand *) NULL);
4763  assert(wand->signature == WandSignature);
4764  if (wand->debug != MagickFalse)
4765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4766  if (wand->images == (Image *) NULL)
4767    {
4768      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4769        "ContainsNoImages","`%s'",wand->name);
4770      return(0UL);
4771    }
4772  return(wand->images->quality);
4773}
4774
4775/*
4776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4777%                                                                             %
4778%                                                                             %
4779%                                                                             %
4780%   M a g i c k G e t I m a g e D e l a y                                     %
4781%                                                                             %
4782%                                                                             %
4783%                                                                             %
4784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4785%
4786%  MagickGetImageDelay() gets the image delay.
4787%
4788%  The format of the MagickGetImageDelay method is:
4789%
4790%      size_t MagickGetImageDelay(MagickWand *wand)
4791%
4792%  A description of each parameter follows:
4793%
4794%    o wand: the magick wand.
4795%
4796*/
4797WandExport size_t MagickGetImageDelay(MagickWand *wand)
4798{
4799  assert(wand != (MagickWand *) NULL);
4800  assert(wand->signature == WandSignature);
4801  if (wand->debug != MagickFalse)
4802    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4803  if (wand->images == (Image *) NULL)
4804    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4805  return(wand->images->delay);
4806}
4807
4808/*
4809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4810%                                                                             %
4811%                                                                             %
4812%                                                                             %
4813%   M a g i c k G e t I m a g e D e p t h                                     %
4814%                                                                             %
4815%                                                                             %
4816%                                                                             %
4817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4818%
4819%  MagickGetImageDepth() gets the image depth.
4820%
4821%  The format of the MagickGetImageDepth method is:
4822%
4823%      size_t MagickGetImageDepth(MagickWand *wand)
4824%
4825%  A description of each parameter follows:
4826%
4827%    o wand: the magick wand.
4828%
4829*/
4830WandExport size_t MagickGetImageDepth(MagickWand *wand)
4831{
4832  assert(wand != (MagickWand *) NULL);
4833  assert(wand->signature == WandSignature);
4834  if (wand->debug != MagickFalse)
4835    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4836  if (wand->images == (Image *) NULL)
4837    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4838  return(wand->images->depth);
4839}
4840
4841/*
4842%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4843%                                                                             %
4844%                                                                             %
4845%                                                                             %
4846%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4847%                                                                             %
4848%                                                                             %
4849%                                                                             %
4850%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4851%
4852%  MagickGetImageDistortion() compares an image to a reconstructed image and
4853%  returns the specified distortion metric.
4854%
4855%  The format of the MagickGetImageDistortion method is:
4856%
4857%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4858%        const MagickWand *reference,const MetricType metric,
4859%        double *distortion)
4860%
4861%  A description of each parameter follows:
4862%
4863%    o wand: the magick wand.
4864%
4865%    o reference: the reference wand.
4866%
4867%    o metric: the metric.
4868%
4869%    o distortion: the computed distortion between the images.
4870%
4871*/
4872WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4873  const MagickWand *reference,const MetricType metric,double *distortion)
4874{
4875  MagickBooleanType
4876    status;
4877
4878
4879  assert(wand != (MagickWand *) NULL);
4880  assert(wand->signature == WandSignature);
4881  if (wand->debug != MagickFalse)
4882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4883  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4884    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4885  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4886    &wand->images->exception);
4887  return(status);
4888}
4889
4890/*
4891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892%                                                                             %
4893%                                                                             %
4894%                                                                             %
4895%   M a g i c k G e t I m a g e D i s p o s e                                 %
4896%                                                                             %
4897%                                                                             %
4898%                                                                             %
4899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4900%
4901%  MagickGetImageDispose() gets the image disposal method.
4902%
4903%  The format of the MagickGetImageDispose method is:
4904%
4905%      DisposeType MagickGetImageDispose(MagickWand *wand)
4906%
4907%  A description of each parameter follows:
4908%
4909%    o wand: the magick wand.
4910%
4911*/
4912WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4913{
4914  assert(wand != (MagickWand *) NULL);
4915  assert(wand->signature == WandSignature);
4916  if (wand->debug != MagickFalse)
4917    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4918  if (wand->images == (Image *) NULL)
4919    {
4920      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4921        "ContainsNoImages","`%s'",wand->name);
4922      return(UndefinedDispose);
4923    }
4924  return((DisposeType) wand->images->dispose);
4925}
4926
4927/*
4928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4929%                                                                             %
4930%                                                                             %
4931%                                                                             %
4932%   M a g i c k G e t I m a g e F i l e n a m e                               %
4933%                                                                             %
4934%                                                                             %
4935%                                                                             %
4936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4937%
4938%  MagickGetImageFilename() returns the filename of a particular image in a
4939%  sequence.
4940%
4941%  The format of the MagickGetImageFilename method is:
4942%
4943%      char *MagickGetImageFilename(MagickWand *wand)
4944%
4945%  A description of each parameter follows:
4946%
4947%    o wand: the magick wand.
4948%
4949*/
4950WandExport char *MagickGetImageFilename(MagickWand *wand)
4951{
4952  assert(wand != (MagickWand *) NULL);
4953  assert(wand->signature == WandSignature);
4954  if (wand->debug != MagickFalse)
4955    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4956  if (wand->images == (Image *) NULL)
4957    {
4958      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4959        "ContainsNoImages","`%s'",wand->name);
4960      return((char *) NULL);
4961    }
4962  return(AcquireString(wand->images->filename));
4963}
4964
4965/*
4966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967%                                                                             %
4968%                                                                             %
4969%                                                                             %
4970%   M a g i c k G e t I m a g e F o r m a t                                   %
4971%                                                                             %
4972%                                                                             %
4973%                                                                             %
4974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975%
4976%  MagickGetImageFormat() returns the format of a particular image in a
4977%  sequence.
4978%
4979%  The format of the MagickGetImageFormat method is:
4980%
4981%      const char *MagickGetImageFormat(MagickWand *wand)
4982%
4983%  A description of each parameter follows:
4984%
4985%    o wand: the magick wand.
4986%
4987*/
4988WandExport char *MagickGetImageFormat(MagickWand *wand)
4989{
4990  assert(wand != (MagickWand *) NULL);
4991  assert(wand->signature == WandSignature);
4992  if (wand->debug != MagickFalse)
4993    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4994  if (wand->images == (Image *) NULL)
4995    {
4996      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4997        "ContainsNoImages","`%s'",wand->name);
4998      return((char *) NULL);
4999    }
5000  return(AcquireString(wand->images->magick));
5001}
5002
5003/*
5004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005%                                                                             %
5006%                                                                             %
5007%                                                                             %
5008%   M a g i c k G e t I m a g e F u z z                                       %
5009%                                                                             %
5010%                                                                             %
5011%                                                                             %
5012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013%
5014%  MagickGetImageFuzz() gets the image fuzz.
5015%
5016%  The format of the MagickGetImageFuzz method is:
5017%
5018%      double MagickGetImageFuzz(MagickWand *wand)
5019%
5020%  A description of each parameter follows:
5021%
5022%    o wand: the magick wand.
5023%
5024*/
5025WandExport double MagickGetImageFuzz(MagickWand *wand)
5026{
5027  assert(wand != (MagickWand *) NULL);
5028  assert(wand->signature == WandSignature);
5029  if (wand->debug != MagickFalse)
5030    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5031  if (wand->images == (Image *) NULL)
5032    {
5033      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5034        "ContainsNoImages","`%s'",wand->name);
5035      return(0.0);
5036    }
5037  return(wand->images->fuzz);
5038}
5039
5040/*
5041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5042%                                                                             %
5043%                                                                             %
5044%                                                                             %
5045%   M a g i c k G e t I m a g e G a m m a                                     %
5046%                                                                             %
5047%                                                                             %
5048%                                                                             %
5049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5050%
5051%  MagickGetImageGamma() gets the image gamma.
5052%
5053%  The format of the MagickGetImageGamma method is:
5054%
5055%      double MagickGetImageGamma(MagickWand *wand)
5056%
5057%  A description of each parameter follows:
5058%
5059%    o wand: the magick wand.
5060%
5061*/
5062WandExport double MagickGetImageGamma(MagickWand *wand)
5063{
5064  assert(wand != (MagickWand *) NULL);
5065  assert(wand->signature == WandSignature);
5066  if (wand->debug != MagickFalse)
5067    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5068  if (wand->images == (Image *) NULL)
5069    {
5070      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5071        "ContainsNoImages","`%s'",wand->name);
5072      return(0.0);
5073    }
5074  return(wand->images->gamma);
5075}
5076
5077/*
5078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5079%                                                                             %
5080%                                                                             %
5081%                                                                             %
5082%   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                 %
5083%                                                                             %
5084%                                                                             %
5085%                                                                             %
5086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5087%
5088%  MagickGetImageGravity() gets the image gravity.
5089%
5090%  The format of the MagickGetImageGravity method is:
5091%
5092%      GravityType MagickGetImageGravity(MagickWand *wand)
5093%
5094%  A description of each parameter follows:
5095%
5096%    o wand: the magick wand.
5097%
5098*/
5099WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5100{
5101  assert(wand != (MagickWand *) NULL);
5102  assert(wand->signature == WandSignature);
5103  if (wand->debug != MagickFalse)
5104    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5105  if (wand->images == (Image *) NULL)
5106    {
5107      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5108        "ContainsNoImages","`%s'",wand->name);
5109      return(UndefinedGravity);
5110    }
5111  return(wand->images->gravity);
5112}
5113
5114/*
5115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5116%                                                                             %
5117%                                                                             %
5118%                                                                             %
5119%   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                       %
5120%                                                                             %
5121%                                                                             %
5122%                                                                             %
5123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5124%
5125%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5126%
5127%  The format of the MagickGetImageGreenPrimary method is:
5128%
5129%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5130%        double *y)
5131%
5132%  A description of each parameter follows:
5133%
5134%    o wand: the magick wand.
5135%
5136%    o x: the chromaticity green primary x-point.
5137%
5138%    o y: the chromaticity green primary y-point.
5139%
5140*/
5141WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5142  double *x,double *y)
5143{
5144  assert(wand != (MagickWand *) NULL);
5145  assert(wand->signature == WandSignature);
5146  if (wand->debug != MagickFalse)
5147    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5148  if (wand->images == (Image *) NULL)
5149    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5150  *x=wand->images->chromaticity.green_primary.x;
5151  *y=wand->images->chromaticity.green_primary.y;
5152  return(MagickTrue);
5153}
5154
5155/*
5156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5157%                                                                             %
5158%                                                                             %
5159%                                                                             %
5160%   M a g i c k G e t I m a g e H e i g h t                                   %
5161%                                                                             %
5162%                                                                             %
5163%                                                                             %
5164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5165%
5166%  MagickGetImageHeight() returns the image height.
5167%
5168%  The format of the MagickGetImageHeight method is:
5169%
5170%      size_t MagickGetImageHeight(MagickWand *wand)
5171%
5172%  A description of each parameter follows:
5173%
5174%    o wand: the magick wand.
5175%
5176*/
5177WandExport size_t MagickGetImageHeight(MagickWand *wand)
5178{
5179  assert(wand != (MagickWand *) NULL);
5180  assert(wand->signature == WandSignature);
5181  if (wand->debug != MagickFalse)
5182    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5183  if (wand->images == (Image *) NULL)
5184    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5185  return(wand->images->rows);
5186}
5187
5188/*
5189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5190%                                                                             %
5191%                                                                             %
5192%                                                                             %
5193%   M a g i c k G e t I m a g e H i s t o g r a m                             %
5194%                                                                             %
5195%                                                                             %
5196%                                                                             %
5197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5198%
5199%  MagickGetImageHistogram() returns the image histogram as an array of
5200%  PixelWand wands.
5201%
5202%  The format of the MagickGetImageHistogram method is:
5203%
5204%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5205%        size_t *number_colors)
5206%
5207%  A description of each parameter follows:
5208%
5209%    o wand: the magick wand.
5210%
5211%    o number_colors: the number of unique colors in the image and the number
5212%      of pixel wands returned.
5213%
5214*/
5215WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5216  size_t *number_colors)
5217{
5218  PixelPacket
5219    *histogram;
5220
5221  PixelWand
5222    **pixel_wands;
5223
5224  register ssize_t
5225    i;
5226
5227  assert(wand != (MagickWand *) NULL);
5228  assert(wand->signature == WandSignature);
5229  if (wand->debug != MagickFalse)
5230    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5231  if (wand->images == (Image *) NULL)
5232    {
5233      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5234        "ContainsNoImages","`%s'",wand->name);
5235      return((PixelWand **) NULL);
5236    }
5237  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5238  if (histogram == (PixelPacket *) NULL)
5239    return((PixelWand **) NULL);
5240  pixel_wands=NewPixelWands(*number_colors);
5241  for (i=0; i < (ssize_t) *number_colors; i++)
5242  {
5243    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
5244    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5245  }
5246  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
5247  return(pixel_wands);
5248}
5249
5250/*
5251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5252%                                                                             %
5253%                                                                             %
5254%                                                                             %
5255%   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                 %
5256%                                                                             %
5257%                                                                             %
5258%                                                                             %
5259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5260%
5261%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5262%
5263%  The format of the MagickGetImageInterlaceScheme method is:
5264%
5265%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5266%
5267%  A description of each parameter follows:
5268%
5269%    o wand: the magick wand.
5270%
5271*/
5272WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5273{
5274  assert(wand != (MagickWand *) NULL);
5275  assert(wand->signature == WandSignature);
5276  if (wand->debug != MagickFalse)
5277    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5278  if (wand->images == (Image *) NULL)
5279    {
5280      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5281        "ContainsNoImages","`%s'",wand->name);
5282      return(UndefinedInterlace);
5283    }
5284  return(wand->images->interlace);
5285}
5286
5287/*
5288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5289%                                                                             %
5290%                                                                             %
5291%                                                                             %
5292%   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             %
5293%                                                                             %
5294%                                                                             %
5295%                                                                             %
5296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5297%
5298%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5299%  sepcified image.
5300%
5301%  The format of the MagickGetImageInterpolateMethod method is:
5302%
5303%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5304%
5305%  A description of each parameter follows:
5306%
5307%    o wand: the magick wand.
5308%
5309*/
5310WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5311  MagickWand *wand)
5312{
5313  assert(wand != (MagickWand *) NULL);
5314  assert(wand->signature == WandSignature);
5315  if (wand->debug != MagickFalse)
5316    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5317  if (wand->images == (Image *) NULL)
5318    {
5319      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5320        "ContainsNoImages","`%s'",wand->name);
5321      return(UndefinedInterpolatePixel);
5322    }
5323  return(wand->images->interpolate);
5324}
5325
5326/*
5327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5328%                                                                             %
5329%                                                                             %
5330%                                                                             %
5331%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5332%                                                                             %
5333%                                                                             %
5334%                                                                             %
5335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5336%
5337%  MagickGetImageIterations() gets the image iterations.
5338%
5339%  The format of the MagickGetImageIterations method is:
5340%
5341%      size_t MagickGetImageIterations(MagickWand *wand)
5342%
5343%  A description of each parameter follows:
5344%
5345%    o wand: the magick wand.
5346%
5347*/
5348WandExport size_t MagickGetImageIterations(MagickWand *wand)
5349{
5350  assert(wand != (MagickWand *) NULL);
5351  assert(wand->signature == WandSignature);
5352  if (wand->debug != MagickFalse)
5353    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5354  if (wand->images == (Image *) NULL)
5355    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5356  return(wand->images->iterations);
5357}
5358
5359/*
5360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361%                                                                             %
5362%                                                                             %
5363%                                                                             %
5364%   M a g i c k G e t I m a g e L e n g t h                                   %
5365%                                                                             %
5366%                                                                             %
5367%                                                                             %
5368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5369%
5370%  MagickGetImageLength() returns the image length in bytes.
5371%
5372%  The format of the MagickGetImageLength method is:
5373%
5374%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5375%        MagickSizeType *length)
5376%
5377%  A description of each parameter follows:
5378%
5379%    o wand: the magick wand.
5380%
5381%    o length: the image length in bytes.
5382%
5383*/
5384WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5385  MagickSizeType *length)
5386{
5387  assert(wand != (MagickWand *) NULL);
5388  assert(wand->signature == WandSignature);
5389  if (wand->debug != MagickFalse)
5390    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5391  if (wand->images == (Image *) NULL)
5392    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5393  *length=GetBlobSize(wand->images);
5394  return(MagickTrue);
5395}
5396
5397/*
5398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399%                                                                             %
5400%                                                                             %
5401%                                                                             %
5402%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5403%                                                                             %
5404%                                                                             %
5405%                                                                             %
5406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407%
5408%  MagickGetImageMatteColor() returns the image matte color.
5409%
5410%  The format of the MagickGetImageMatteColor method is:
5411%
5412%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5413%        PixelWand *matte_color)
5414%
5415%  A description of each parameter follows:
5416%
5417%    o wand: the magick wand.
5418%
5419%    o matte_color: Return the matte color.
5420%
5421*/
5422WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5423  PixelWand *matte_color)
5424{
5425  assert(wand != (MagickWand *) NULL);
5426  assert(wand->signature == WandSignature);
5427  if (wand->debug != MagickFalse)
5428    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5429  if (wand->images == (Image *) NULL)
5430    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5431  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
5432  return(MagickTrue);
5433}
5434
5435/*
5436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437%                                                                             %
5438%                                                                             %
5439%                                                                             %
5440%   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                         %
5441%                                                                             %
5442%                                                                             %
5443%                                                                             %
5444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5445%
5446%  MagickGetImageOrientation() returns the image orientation.
5447%
5448%  The format of the MagickGetImageOrientation method is:
5449%
5450%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5451%
5452%  A description of each parameter follows:
5453%
5454%    o wand: the magick wand.
5455%
5456*/
5457WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5458{
5459  assert(wand != (MagickWand *) NULL);
5460  assert(wand->signature == WandSignature);
5461  if (wand->debug != MagickFalse)
5462    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5463  if (wand->images == (Image *) NULL)
5464    {
5465      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5466        "ContainsNoImages","`%s'",wand->name);
5467      return(UndefinedOrientation);
5468    }
5469  return(wand->images->orientation);
5470}
5471
5472/*
5473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5474%                                                                             %
5475%                                                                             %
5476%                                                                             %
5477%   M a g i c k G e t I m a g e P a g e                                       %
5478%                                                                             %
5479%                                                                             %
5480%                                                                             %
5481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482%
5483%  MagickGetImagePage() returns the page geometry associated with the image.
5484%
5485%  The format of the MagickGetImagePage method is:
5486%
5487%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5488%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5489%
5490%  A description of each parameter follows:
5491%
5492%    o wand: the magick wand.
5493%
5494%    o width: the page width.
5495%
5496%    o height: the page height.
5497%
5498%    o x: the page x-offset.
5499%
5500%    o y: the page y-offset.
5501%
5502*/
5503WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5504  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5505{
5506  assert(wand != (const MagickWand *) NULL);
5507  assert(wand->signature == WandSignature);
5508  if (wand->debug != MagickFalse)
5509    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5510  if (wand->images == (Image *) NULL)
5511    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5512  *width=wand->images->page.width;
5513  *height=wand->images->page.height;
5514  *x=wand->images->page.x;
5515  *y=wand->images->page.y;
5516  return(MagickTrue);
5517}
5518
5519/*
5520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521%                                                                             %
5522%                                                                             %
5523%                                                                             %
5524%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5525%                                                                             %
5526%                                                                             %
5527%                                                                             %
5528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5529%
5530%  MagickGetImagePixelColor() returns the color of the specified pixel.
5531%
5532%  The format of the MagickGetImagePixelColor method is:
5533%
5534%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5535%        const ssize_t x,const ssize_t y,PixelWand *color)
5536%
5537%  A description of each parameter follows:
5538%
5539%    o wand: the magick wand.
5540%
5541%    o x,y: the pixel offset into the image.
5542%
5543%    o color: Return the colormap color in this wand.
5544%
5545*/
5546WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5547  const ssize_t x,const ssize_t y,PixelWand *color)
5548{
5549  register const Quantum
5550    *p;
5551
5552  CacheView
5553    *image_view;
5554
5555  assert(wand != (MagickWand *) NULL);
5556  assert(wand->signature == WandSignature);
5557  if (wand->debug != MagickFalse)
5558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5559  if (wand->images == (Image *) NULL)
5560    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5561  image_view=AcquireCacheView(wand->images);
5562  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5563  if (p == (const Quantum *) NULL)
5564    {
5565      image_view=DestroyCacheView(image_view);
5566      return(MagickFalse);
5567    }
5568  PixelSetQuantumPixel(wand->images,p,color);
5569  image_view=DestroyCacheView(image_view);
5570  return(MagickTrue);
5571}
5572
5573/*
5574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5575%                                                                             %
5576%                                                                             %
5577%                                                                             %
5578+   M a g i c k G e t I m a g e R a n g e                                     %
5579%                                                                             %
5580%                                                                             %
5581%                                                                             %
5582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5583%
5584%  MagickGetImageRange() gets the pixel range for the image.
5585%
5586%  The format of the MagickGetImageRange method is:
5587%
5588%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5589%        double *maxima)
5590%
5591%  A description of each parameter follows:
5592%
5593%    o wand: the magick wand.
5594%
5595%    o minima:  The minimum pixel value for the specified channel(s).
5596%
5597%    o maxima:  The maximum pixel value for the specified channel(s).
5598%
5599*/
5600WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5601  double *minima,double *maxima)
5602{
5603  MagickBooleanType
5604    status;
5605
5606  assert(wand != (MagickWand *) NULL);
5607  assert(wand->signature == WandSignature);
5608  if (wand->debug != MagickFalse)
5609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5610  if (wand->images == (Image *) NULL)
5611    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5612  status=GetImageRange(wand->images,minima,maxima,wand->exception);
5613  return(status);
5614}
5615
5616/*
5617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5618%                                                                             %
5619%                                                                             %
5620%                                                                             %
5621%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5622%                                                                             %
5623%                                                                             %
5624%                                                                             %
5625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626%
5627%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5628%
5629%  The format of the MagickGetImageRedPrimary method is:
5630%
5631%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5632%        double *y)
5633%
5634%  A description of each parameter follows:
5635%
5636%    o wand: the magick wand.
5637%
5638%    o x: the chromaticity red primary x-point.
5639%
5640%    o y: the chromaticity red primary y-point.
5641%
5642*/
5643WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5644  double *x,double *y)
5645{
5646  assert(wand != (MagickWand *) NULL);
5647  assert(wand->signature == WandSignature);
5648  if (wand->debug != MagickFalse)
5649    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5650  if (wand->images == (Image *) NULL)
5651    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5652  *x=wand->images->chromaticity.red_primary.x;
5653  *y=wand->images->chromaticity.red_primary.y;
5654  return(MagickTrue);
5655}
5656
5657/*
5658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5659%                                                                             %
5660%                                                                             %
5661%                                                                             %
5662%   M a g i c k G e t I m a g e R e g i o n                                   %
5663%                                                                             %
5664%                                                                             %
5665%                                                                             %
5666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5667%
5668%  MagickGetImageRegion() extracts a region of the image and returns it as a
5669%  a new wand.
5670%
5671%  The format of the MagickGetImageRegion method is:
5672%
5673%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5674%        const size_t width,const size_t height,const ssize_t x,
5675%        const ssize_t y)
5676%
5677%  A description of each parameter follows:
5678%
5679%    o wand: the magick wand.
5680%
5681%    o width: the region width.
5682%
5683%    o height: the region height.
5684%
5685%    o x: the region x offset.
5686%
5687%    o y: the region y offset.
5688%
5689*/
5690WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5691  const size_t width,const size_t height,const ssize_t x,
5692  const ssize_t y)
5693{
5694  Image
5695    *region_image;
5696
5697  RectangleInfo
5698    region;
5699
5700  assert(wand != (MagickWand *) NULL);
5701  assert(wand->signature == WandSignature);
5702  if (wand->debug != MagickFalse)
5703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5704  if (wand->images == (Image *) NULL)
5705    return((MagickWand *) NULL);
5706  region.width=width;
5707  region.height=height;
5708  region.x=x;
5709  region.y=y;
5710  region_image=CropImage(wand->images,&region,wand->exception);
5711  if (region_image == (Image *) NULL)
5712    return((MagickWand *) NULL);
5713  return(CloneMagickWandFromImages(wand,region_image));
5714}
5715
5716/*
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%                                                                             %
5719%                                                                             %
5720%                                                                             %
5721%   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                 %
5722%                                                                             %
5723%                                                                             %
5724%                                                                             %
5725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5726%
5727%  MagickGetImageRenderingIntent() gets the image rendering intent.
5728%
5729%  The format of the MagickGetImageRenderingIntent method is:
5730%
5731%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5732%
5733%  A description of each parameter follows:
5734%
5735%    o wand: the magick wand.
5736%
5737*/
5738WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5739{
5740  assert(wand != (MagickWand *) NULL);
5741  assert(wand->signature == WandSignature);
5742  if (wand->debug != MagickFalse)
5743    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5744  if (wand->images == (Image *) NULL)
5745    {
5746      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5747        "ContainsNoImages","`%s'",wand->name);
5748      return(UndefinedIntent);
5749    }
5750  return((RenderingIntent) wand->images->rendering_intent);
5751}
5752
5753/*
5754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5755%                                                                             %
5756%                                                                             %
5757%                                                                             %
5758%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5759%                                                                             %
5760%                                                                             %
5761%                                                                             %
5762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5763%
5764%  MagickGetImageResolution() gets the image X and Y resolution.
5765%
5766%  The format of the MagickGetImageResolution method is:
5767%
5768%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5769%        double *y)
5770%
5771%  A description of each parameter follows:
5772%
5773%    o wand: the magick wand.
5774%
5775%    o x: the image x-resolution.
5776%
5777%    o y: the image y-resolution.
5778%
5779*/
5780WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5781  double *x,double *y)
5782{
5783  assert(wand != (MagickWand *) NULL);
5784  assert(wand->signature == WandSignature);
5785  if (wand->debug != MagickFalse)
5786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5787  if (wand->images == (Image *) NULL)
5788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5789  *x=wand->images->x_resolution;
5790  *y=wand->images->y_resolution;
5791  return(MagickTrue);
5792}
5793
5794/*
5795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5796%                                                                             %
5797%                                                                             %
5798%                                                                             %
5799%   M a g i c k G e t I m a g e S c e n e                                     %
5800%                                                                             %
5801%                                                                             %
5802%                                                                             %
5803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5804%
5805%  MagickGetImageScene() gets the image scene.
5806%
5807%  The format of the MagickGetImageScene method is:
5808%
5809%      size_t MagickGetImageScene(MagickWand *wand)
5810%
5811%  A description of each parameter follows:
5812%
5813%    o wand: the magick wand.
5814%
5815*/
5816WandExport size_t MagickGetImageScene(MagickWand *wand)
5817{
5818  assert(wand != (MagickWand *) NULL);
5819  assert(wand->signature == WandSignature);
5820  if (wand->debug != MagickFalse)
5821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5822  if (wand->images == (Image *) NULL)
5823    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5824  return(wand->images->scene);
5825}
5826
5827/*
5828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5829%                                                                             %
5830%                                                                             %
5831%                                                                             %
5832%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5833%                                                                             %
5834%                                                                             %
5835%                                                                             %
5836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5837%
5838%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5839%  pixel stream.
5840%
5841%  The format of the MagickGetImageSignature method is:
5842%
5843%      const char MagickGetImageSignature(MagickWand *wand)
5844%
5845%  A description of each parameter follows:
5846%
5847%    o wand: the magick wand.
5848%
5849*/
5850WandExport char *MagickGetImageSignature(MagickWand *wand)
5851{
5852  const char
5853    *value;
5854
5855  MagickBooleanType
5856    status;
5857
5858  assert(wand != (MagickWand *) NULL);
5859  assert(wand->signature == WandSignature);
5860  if (wand->debug != MagickFalse)
5861    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5862  if (wand->images == (Image *) NULL)
5863    {
5864      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5865        "ContainsNoImages","`%s'",wand->name);
5866      return((char *) NULL);
5867    }
5868  status=SignatureImage(wand->images);
5869  if (status == MagickFalse)
5870    InheritException(wand->exception,&wand->images->exception);
5871  value=GetImageProperty(wand->images,"signature");
5872  if (value != (const char *) NULL)
5873    return(AcquireString(value));
5874  InheritException(wand->exception,&wand->images->exception);
5875  return((char *) NULL);
5876}
5877
5878/*
5879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5880%                                                                             %
5881%                                                                             %
5882%                                                                             %
5883%   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                   %
5884%                                                                             %
5885%                                                                             %
5886%                                                                             %
5887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5888%
5889%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5890%
5891%  The format of the MagickGetImageTicksPerSecond method is:
5892%
5893%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5894%
5895%  A description of each parameter follows:
5896%
5897%    o wand: the magick wand.
5898%
5899*/
5900WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5901{
5902  assert(wand != (MagickWand *) NULL);
5903  assert(wand->signature == WandSignature);
5904  if (wand->debug != MagickFalse)
5905    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5906  if (wand->images == (Image *) NULL)
5907    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5908  return((size_t) wand->images->ticks_per_second);
5909}
5910
5911/*
5912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5913%                                                                             %
5914%                                                                             %
5915%                                                                             %
5916%   M a g i c k G e t I m a g e T y p e                                       %
5917%                                                                             %
5918%                                                                             %
5919%                                                                             %
5920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5921%
5922%  MagickGetImageType() gets the potential image type:
5923%
5924%        Bilevel        Grayscale       GrayscaleMatte
5925%        Palette        PaletteMatte    TrueColor
5926%        TrueColorMatte ColorSeparation ColorSeparationMatte
5927%
5928%  To ensure the image type matches its potential, use MagickSetImageType():
5929%
5930%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5931%
5932%  The format of the MagickGetImageType method is:
5933%
5934%      ImageType MagickGetImageType(MagickWand *wand)
5935%
5936%  A description of each parameter follows:
5937%
5938%    o wand: the magick wand.
5939%
5940*/
5941WandExport ImageType MagickGetImageType(MagickWand *wand)
5942{
5943  assert(wand != (MagickWand *) NULL);
5944  assert(wand->signature == WandSignature);
5945  if (wand->debug != MagickFalse)
5946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5947  if (wand->images == (Image *) NULL)
5948    {
5949      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5950        "ContainsNoImages","`%s'",wand->name);
5951      return(UndefinedType);
5952    }
5953  return(GetImageType(wand->images,wand->exception));
5954}
5955
5956/*
5957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5958%                                                                             %
5959%                                                                             %
5960%                                                                             %
5961%   M a g i c k G e t I m a g e U n i t s                                     %
5962%                                                                             %
5963%                                                                             %
5964%                                                                             %
5965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5966%
5967%  MagickGetImageUnits() gets the image units of resolution.
5968%
5969%  The format of the MagickGetImageUnits method is:
5970%
5971%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5972%
5973%  A description of each parameter follows:
5974%
5975%    o wand: the magick wand.
5976%
5977*/
5978WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5979{
5980  assert(wand != (MagickWand *) NULL);
5981  assert(wand->signature == WandSignature);
5982  if (wand->debug != MagickFalse)
5983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5984  if (wand->images == (Image *) NULL)
5985    {
5986      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5987        "ContainsNoImages","`%s'",wand->name);
5988      return(UndefinedResolution);
5989    }
5990  return(wand->images->units);
5991}
5992
5993/*
5994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5995%                                                                             %
5996%                                                                             %
5997%                                                                             %
5998%   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           %
5999%                                                                             %
6000%                                                                             %
6001%                                                                             %
6002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6003%
6004%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6005%  sepcified image.
6006%
6007%  The format of the MagickGetImageVirtualPixelMethod method is:
6008%
6009%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6010%
6011%  A description of each parameter follows:
6012%
6013%    o wand: the magick wand.
6014%
6015*/
6016WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6017{
6018  assert(wand != (MagickWand *) NULL);
6019  assert(wand->signature == WandSignature);
6020  if (wand->debug != MagickFalse)
6021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6022  if (wand->images == (Image *) NULL)
6023    {
6024      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6025        "ContainsNoImages","`%s'",wand->name);
6026      return(UndefinedVirtualPixelMethod);
6027    }
6028  return(GetImageVirtualPixelMethod(wand->images));
6029}
6030
6031/*
6032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6033%                                                                             %
6034%                                                                             %
6035%                                                                             %
6036%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6037%                                                                             %
6038%                                                                             %
6039%                                                                             %
6040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6041%
6042%  MagickGetImageWhitePoint() returns the chromaticy white point.
6043%
6044%  The format of the MagickGetImageWhitePoint method is:
6045%
6046%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6047%        double *y)
6048%
6049%  A description of each parameter follows:
6050%
6051%    o wand: the magick wand.
6052%
6053%    o x: the chromaticity white x-point.
6054%
6055%    o y: the chromaticity white y-point.
6056%
6057*/
6058WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6059  double *x,double *y)
6060{
6061  assert(wand != (MagickWand *) NULL);
6062  assert(wand->signature == WandSignature);
6063  if (wand->debug != MagickFalse)
6064    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6065  if (wand->images == (Image *) NULL)
6066    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6067  *x=wand->images->chromaticity.white_point.x;
6068  *y=wand->images->chromaticity.white_point.y;
6069  return(MagickTrue);
6070}
6071
6072/*
6073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6074%                                                                             %
6075%                                                                             %
6076%                                                                             %
6077%   M a g i c k G e t I m a g e W i d t h                                     %
6078%                                                                             %
6079%                                                                             %
6080%                                                                             %
6081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6082%
6083%  MagickGetImageWidth() returns the image width.
6084%
6085%  The format of the MagickGetImageWidth method is:
6086%
6087%      size_t MagickGetImageWidth(MagickWand *wand)
6088%
6089%  A description of each parameter follows:
6090%
6091%    o wand: the magick wand.
6092%
6093*/
6094WandExport size_t MagickGetImageWidth(MagickWand *wand)
6095{
6096  assert(wand != (MagickWand *) NULL);
6097  assert(wand->signature == WandSignature);
6098  if (wand->debug != MagickFalse)
6099    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6100  if (wand->images == (Image *) NULL)
6101    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6102  return(wand->images->columns);
6103}
6104
6105/*
6106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6107%                                                                             %
6108%                                                                             %
6109%                                                                             %
6110%   M a g i c k G e t N u m b e r I m a g e s                                 %
6111%                                                                             %
6112%                                                                             %
6113%                                                                             %
6114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115%
6116%  MagickGetNumberImages() returns the number of images associated with a
6117%  magick wand.
6118%
6119%  The format of the MagickGetNumberImages method is:
6120%
6121%      size_t MagickGetNumberImages(MagickWand *wand)
6122%
6123%  A description of each parameter follows:
6124%
6125%    o wand: the magick wand.
6126%
6127*/
6128WandExport size_t MagickGetNumberImages(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  return(GetImageListLength(wand->images));
6135}
6136
6137/*
6138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6139%                                                                             %
6140%                                                                             %
6141%                                                                             %
6142%   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                 %
6143%                                                                             %
6144%                                                                             %
6145%                                                                             %
6146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6147%
6148%  MagickGetImageTotalInkDensity() gets the image total ink density.
6149%
6150%  The format of the MagickGetImageTotalInkDensity method is:
6151%
6152%      double MagickGetImageTotalInkDensity(MagickWand *wand)
6153%
6154%  A description of each parameter follows:
6155%
6156%    o wand: the magick wand.
6157%
6158*/
6159WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6160{
6161  assert(wand != (MagickWand *) NULL);
6162  assert(wand->signature == WandSignature);
6163  if (wand->debug != MagickFalse)
6164    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6165  if (wand->images == (Image *) NULL)
6166    {
6167      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6168        "ContainsNoImages","`%s'",wand->name);
6169      return(0.0);
6170    }
6171  return(GetImageTotalInkDensity(wand->images));
6172}
6173
6174/*
6175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6176%                                                                             %
6177%                                                                             %
6178%                                                                             %
6179%   M a g i c k H a l d C l u t I m a g e                                     %
6180%                                                                             %
6181%                                                                             %
6182%                                                                             %
6183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6184%
6185%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6186%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6187%  dimensions.  Create it with the HALD coder.  You can apply any color
6188%  transformation to the Hald image and then use this method to apply the
6189%  transform to the image.
6190%
6191%  The format of the MagickHaldClutImage method is:
6192%
6193%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6194%        const MagickWand *hald_wand)
6195%      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6196%        const ChannelType channel,const MagickWand *hald_wand)
6197%
6198%  A description of each parameter follows:
6199%
6200%    o wand: the magick wand.
6201%
6202%    o hald_image: the hald CLUT image.
6203%
6204*/
6205
6206WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6207  const MagickWand *hald_wand)
6208{
6209  MagickBooleanType
6210    status;
6211
6212  status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6213  return(status);
6214}
6215
6216WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6217  const ChannelType channel,const MagickWand *hald_wand)
6218{
6219  MagickBooleanType
6220    status;
6221
6222  assert(wand != (MagickWand *) NULL);
6223  assert(wand->signature == WandSignature);
6224  if (wand->debug != MagickFalse)
6225    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6226  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6227    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6228  status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6229  if (status == MagickFalse)
6230    InheritException(wand->exception,&wand->images->exception);
6231  return(status);
6232}
6233
6234/*
6235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6236%                                                                             %
6237%                                                                             %
6238%                                                                             %
6239%   M a g i c k H a s N e x t I m a g e                                       %
6240%                                                                             %
6241%                                                                             %
6242%                                                                             %
6243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6244%
6245%  MagickHasNextImage() returns MagickTrue if the wand has more images when
6246%  traversing the list in the forward direction
6247%
6248%  The format of the MagickHasNextImage method is:
6249%
6250%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6251%
6252%  A description of each parameter follows:
6253%
6254%    o wand: the magick wand.
6255%
6256*/
6257WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6258{
6259  assert(wand != (MagickWand *) NULL);
6260  assert(wand->signature == WandSignature);
6261  if (wand->debug != MagickFalse)
6262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6263  if (wand->images == (Image *) NULL)
6264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6265  if (GetNextImageInList(wand->images) == (Image *) NULL)
6266    return(MagickFalse);
6267  return(MagickTrue);
6268}
6269
6270/*
6271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6272%                                                                             %
6273%                                                                             %
6274%                                                                             %
6275%   M a g i c k H a s P r e v i o u s I m a g e                               %
6276%                                                                             %
6277%                                                                             %
6278%                                                                             %
6279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6280%
6281%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6282%  traversing the list in the reverse direction
6283%
6284%  The format of the MagickHasPreviousImage method is:
6285%
6286%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6287%
6288%  A description of each parameter follows:
6289%
6290%    o wand: the magick wand.
6291%
6292*/
6293WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6294{
6295  assert(wand != (MagickWand *) NULL);
6296  assert(wand->signature == WandSignature);
6297  if (wand->debug != MagickFalse)
6298    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6299  if (wand->images == (Image *) NULL)
6300    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6301  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6302    return(MagickFalse);
6303  return(MagickTrue);
6304}
6305
6306/*
6307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6308%                                                                             %
6309%                                                                             %
6310%                                                                             %
6311%   M a g i c k I d e n t i f y I m a g e                                     %
6312%                                                                             %
6313%                                                                             %
6314%                                                                             %
6315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6316%
6317%  MagickIdentifyImage() identifies an image by printing its attributes to the
6318%  file.  Attributes include the image width, height, size, and others.
6319%
6320%  The format of the MagickIdentifyImage method is:
6321%
6322%      const char *MagickIdentifyImage(MagickWand *wand)
6323%
6324%  A description of each parameter follows:
6325%
6326%    o wand: the magick wand.
6327%
6328*/
6329WandExport char *MagickIdentifyImage(MagickWand *wand)
6330{
6331  char
6332    *description,
6333    filename[MaxTextExtent];
6334
6335  FILE
6336    *file;
6337
6338  int
6339    unique_file;
6340
6341  assert(wand != (MagickWand *) NULL);
6342  assert(wand->signature == WandSignature);
6343  if (wand->debug != MagickFalse)
6344    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6345  if (wand->images == (Image *) NULL)
6346    {
6347      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6348        "ContainsNoImages","`%s'",wand->name);
6349      return((char *) NULL);
6350    }
6351  description=(char *) NULL;
6352  unique_file=AcquireUniqueFileResource(filename);
6353  file=(FILE *) NULL;
6354  if (unique_file != -1)
6355    file=fdopen(unique_file,"wb");
6356  if ((unique_file == -1) || (file == (FILE *) NULL))
6357    {
6358      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6359        "UnableToCreateTemporaryFile","`%s'",wand->name);
6360      return((char *) NULL);
6361    }
6362  (void) IdentifyImage(wand->images,file,MagickTrue);
6363  (void) fclose(file);
6364  description=FileToString(filename,~0,wand->exception);
6365  (void) RelinquishUniqueFileResource(filename);
6366  return(description);
6367}
6368
6369/*
6370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6371%                                                                             %
6372%                                                                             %
6373%                                                                             %
6374%   M a g i c k I m p l o d e I m a g e                                       %
6375%                                                                             %
6376%                                                                             %
6377%                                                                             %
6378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6379%
6380%  MagickImplodeImage() creates a new image that is a copy of an existing
6381%  one with the image pixels "implode" by the specified percentage.  It
6382%  allocates the memory necessary for the new Image structure and returns a
6383%  pointer to the new image.
6384%
6385%  The format of the MagickImplodeImage method is:
6386%
6387%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6388%        const double radius)
6389%
6390%  A description of each parameter follows:
6391%
6392%    o wand: the magick wand.
6393%
6394%    o amount: Define the extent of the implosion.
6395%
6396*/
6397WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6398  const double amount)
6399{
6400  Image
6401    *implode_image;
6402
6403  assert(wand != (MagickWand *) NULL);
6404  assert(wand->signature == WandSignature);
6405  if (wand->debug != MagickFalse)
6406    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6407  if (wand->images == (Image *) NULL)
6408    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6409  implode_image=ImplodeImage(wand->images,amount,wand->exception);
6410  if (implode_image == (Image *) NULL)
6411    return(MagickFalse);
6412  ReplaceImageInList(&wand->images,implode_image);
6413  return(MagickTrue);
6414}
6415
6416/*
6417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418%                                                                             %
6419%                                                                             %
6420%                                                                             %
6421%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6422%                                                                             %
6423%                                                                             %
6424%                                                                             %
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%
6427%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6428%  location you specify.  The method returns MagickFalse on success otherwise
6429%  MagickTrue if an error is encountered.  The pixel data can be either char,
6430%  short int, int, ssize_t, float, or double in the order specified by map.
6431%
6432%  Suppose your want to upload the first scanline of a 640x480 image from
6433%  character data in red-green-blue order:
6434%
6435%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6436%
6437%  The format of the MagickImportImagePixels method is:
6438%
6439%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6440%        const ssize_t x,const ssize_t y,const size_t columns,
6441%        const size_t rows,const char *map,const StorageType storage,
6442%        const void *pixels)
6443%
6444%  A description of each parameter follows:
6445%
6446%    o wand: the magick wand.
6447%
6448%    o x, y, columns, rows:  These values define the perimeter of a region
6449%      of pixels you want to define.
6450%
6451%    o map:  This string reflects the expected ordering of the pixel array.
6452%      It can be any combination or order of R = red, G = green, B = blue,
6453%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6454%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6455%      P = pad.
6456%
6457%    o storage: Define the data type of the pixels.  Float and double types are
6458%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6459%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6460%      or DoublePixel.
6461%
6462%    o pixels: This array of values contain the pixel components as defined by
6463%      map and type.  You must preallocate this array where the expected
6464%      length varies depending on the values of width, height, map, and type.
6465%
6466*/
6467WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6468  const ssize_t x,const ssize_t y,const size_t columns,
6469  const size_t rows,const char *map,const StorageType storage,
6470  const void *pixels)
6471{
6472  MagickBooleanType
6473    status;
6474
6475  assert(wand != (MagickWand *) NULL);
6476  assert(wand->signature == WandSignature);
6477  if (wand->debug != MagickFalse)
6478    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6479  if (wand->images == (Image *) NULL)
6480    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6481  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6482  if (status == MagickFalse)
6483    InheritException(wand->exception,&wand->images->exception);
6484  return(status);
6485}
6486
6487/*
6488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6489%                                                                             %
6490%                                                                             %
6491%                                                                             %
6492%   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       %
6493%                                                                             %
6494%                                                                             %
6495%                                                                             %
6496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6497%
6498%  MagickInverseFourierTransformImage() implements the inverse discrete
6499%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6500%  imaginary image pair.
6501%
6502%  The format of the MagickInverseFourierTransformImage method is:
6503%
6504%      MagickBooleanType MagickInverseFourierTransformImage(
6505%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6506%        const MagickBooleanType magnitude)
6507%
6508%  A description of each parameter follows:
6509%
6510%    o magnitude_wand: the magnitude or real wand.
6511%
6512%    o phase_wand: the phase or imaginary wand.
6513%
6514%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6515%      imaginary image pair.
6516%
6517*/
6518WandExport MagickBooleanType MagickInverseFourierTransformImage(
6519  MagickWand *magnitude_wand,MagickWand *phase_wand,
6520  const MagickBooleanType magnitude)
6521{
6522  Image
6523    *inverse_image;
6524
6525  MagickWand
6526    *wand;
6527
6528  assert(magnitude_wand != (MagickWand *) NULL);
6529  assert(magnitude_wand->signature == WandSignature);
6530  if (magnitude_wand->debug != MagickFalse)
6531    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6532      magnitude_wand->name);
6533  wand=magnitude_wand;
6534  if (magnitude_wand->images == (Image *) NULL)
6535    ThrowWandException(WandError,"ContainsNoImages",
6536      magnitude_wand->name);
6537  assert(phase_wand != (MagickWand *) NULL);
6538  assert(phase_wand->signature == WandSignature);
6539  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6540    phase_wand->images,magnitude,wand->exception);
6541  if (inverse_image == (Image *) NULL)
6542    return(MagickFalse);
6543  ReplaceImageInList(&wand->images,inverse_image);
6544  return(MagickTrue);
6545}
6546
6547/*
6548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6549%                                                                             %
6550%                                                                             %
6551%                                                                             %
6552%   M a g i c k L a b e l I m a g e                                           %
6553%                                                                             %
6554%                                                                             %
6555%                                                                             %
6556%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6557%
6558%  MagickLabelImage() adds a label to your image.
6559%
6560%  The format of the MagickLabelImage method is:
6561%
6562%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6563%
6564%  A description of each parameter follows:
6565%
6566%    o wand: the magick wand.
6567%
6568%    o label: the image label.
6569%
6570*/
6571WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6572  const char *label)
6573{
6574  MagickBooleanType
6575    status;
6576
6577  assert(wand != (MagickWand *) NULL);
6578  assert(wand->signature == WandSignature);
6579  if (wand->debug != MagickFalse)
6580    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6581  if (wand->images == (Image *) NULL)
6582    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6583  status=SetImageProperty(wand->images,"label",label);
6584  if (status == MagickFalse)
6585    InheritException(wand->exception,&wand->images->exception);
6586  return(status);
6587}
6588
6589/*
6590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591%                                                                             %
6592%                                                                             %
6593%                                                                             %
6594%   M a g i c k L e v e l I m a g e                                           %
6595%                                                                             %
6596%                                                                             %
6597%                                                                             %
6598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6599%
6600%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6601%  falling between specified white and black points to the full available
6602%  quantum range. The parameters provided represent the black, mid, and white
6603%  points. The black point specifies the darkest color in the image. Colors
6604%  darker than the black point are set to zero. Mid point specifies a gamma
6605%  correction to apply to the image.  White point specifies the lightest color
6606%  in the image. Colors brighter than the white point are set to the maximum
6607%  quantum value.
6608%
6609%  The format of the MagickLevelImage method is:
6610%
6611%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6612%        const double black_point,const double gamma,const double white_point)
6613%      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6614%        const ChannelType channel,const double black_point,const double gamma,
6615%        const double white_point)
6616%
6617%  A description of each parameter follows:
6618%
6619%    o wand: the magick wand.
6620%
6621%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6622%
6623%    o black_point: the black point.
6624%
6625%    o gamma: the gamma.
6626%
6627%    o white_point: the white point.
6628%
6629*/
6630
6631WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6632  const double black_point,const double gamma,const double white_point)
6633{
6634  MagickBooleanType
6635    status;
6636
6637  status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6638    white_point);
6639  return(status);
6640}
6641
6642WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6643  const ChannelType channel,const double black_point,const double gamma,
6644  const double white_point)
6645{
6646  MagickBooleanType
6647    status;
6648
6649  assert(wand != (MagickWand *) NULL);
6650  assert(wand->signature == WandSignature);
6651  if (wand->debug != MagickFalse)
6652    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6653  if (wand->images == (Image *) NULL)
6654    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6655  status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6656  if (status == MagickFalse)
6657    InheritException(wand->exception,&wand->images->exception);
6658  return(status);
6659}
6660
6661/*
6662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6663%                                                                             %
6664%                                                                             %
6665%                                                                             %
6666%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6667%                                                                             %
6668%                                                                             %
6669%                                                                             %
6670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6671%
6672%  MagickLinearStretchImage() stretches with saturation the image intensity.
6673%
6674%  You can also reduce the influence of a particular channel with a gamma
6675%  value of 0.
6676%
6677%  The format of the MagickLinearStretchImage method is:
6678%
6679%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6680%        const double black_point,const double white_point)
6681%
6682%  A description of each parameter follows:
6683%
6684%    o wand: the magick wand.
6685%
6686%    o black_point: the black point.
6687%
6688%    o white_point: the white point.
6689%
6690*/
6691WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6692  const double black_point,const double white_point)
6693{
6694  MagickBooleanType
6695    status;
6696
6697  assert(wand != (MagickWand *) NULL);
6698  assert(wand->signature == WandSignature);
6699  if (wand->debug != MagickFalse)
6700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6701  if (wand->images == (Image *) NULL)
6702    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6703  status=LinearStretchImage(wand->images,black_point,white_point);
6704  if (status == MagickFalse)
6705    InheritException(wand->exception,&wand->images->exception);
6706  return(status);
6707}
6708
6709/*
6710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6711%                                                                             %
6712%                                                                             %
6713%                                                                             %
6714%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6715%                                                                             %
6716%                                                                             %
6717%                                                                             %
6718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6719%
6720%  MagickLiquidRescaleImage() rescales image with seam carving.
6721%
6722%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6723%        const size_t columns,const size_t rows,
6724%        const double delta_x,const double rigidity)
6725%
6726%  A description of each parameter follows:
6727%
6728%    o wand: the magick wand.
6729%
6730%    o columns: the number of columns in the scaled image.
6731%
6732%    o rows: the number of rows in the scaled image.
6733%
6734%    o delta_x: maximum seam transversal step (0 means straight seams).
6735%
6736%    o rigidity: introduce a bias for non-straight seams (typically 0).
6737%
6738*/
6739WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6740  const size_t columns,const size_t rows,const double delta_x,
6741  const double rigidity)
6742{
6743  Image
6744    *rescale_image;
6745
6746  assert(wand != (MagickWand *) NULL);
6747  assert(wand->signature == WandSignature);
6748  if (wand->debug != MagickFalse)
6749    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6750  if (wand->images == (Image *) NULL)
6751    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6752  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6753    rigidity,wand->exception);
6754  if (rescale_image == (Image *) NULL)
6755    return(MagickFalse);
6756  ReplaceImageInList(&wand->images,rescale_image);
6757  return(MagickTrue);
6758}
6759
6760/*
6761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6762%                                                                             %
6763%                                                                             %
6764%                                                                             %
6765%   M a g i c k M a g n i f y I m a g e                                       %
6766%                                                                             %
6767%                                                                             %
6768%                                                                             %
6769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6770%
6771%  MagickMagnifyImage() is a convenience method that scales an image
6772%  proportionally to twice its original size.
6773%
6774%  The format of the MagickMagnifyImage method is:
6775%
6776%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6777%
6778%  A description of each parameter follows:
6779%
6780%    o wand: the magick wand.
6781%
6782*/
6783WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6784{
6785  Image
6786    *magnify_image;
6787
6788  assert(wand != (MagickWand *) NULL);
6789  assert(wand->signature == WandSignature);
6790  if (wand->debug != MagickFalse)
6791    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6792  if (wand->images == (Image *) NULL)
6793    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6794  magnify_image=MagnifyImage(wand->images,wand->exception);
6795  if (magnify_image == (Image *) NULL)
6796    return(MagickFalse);
6797  ReplaceImageInList(&wand->images,magnify_image);
6798  return(MagickTrue);
6799}
6800
6801/*
6802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6803%                                                                             %
6804%                                                                             %
6805%                                                                             %
6806%   M a g i c k M e r g e I m a g e L a y e r s                               %
6807%                                                                             %
6808%                                                                             %
6809%                                                                             %
6810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6811%
6812%  MagickMergeImageLayers() composes all the image layers from the current
6813%  given image onward to produce a single image of the merged layers.
6814%
6815%  The inital canvas's size depends on the given ImageLayerMethod, and is
6816%  initialized using the first images background color.  The images
6817%  are then compositied onto that image in sequence using the given
6818%  composition that has been assigned to each individual image.
6819%
6820%  The format of the MagickMergeImageLayers method is:
6821%
6822%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6823%        const ImageLayerMethod method)
6824%
6825%  A description of each parameter follows:
6826%
6827%    o wand: the magick wand.
6828%
6829%    o method: the method of selecting the size of the initial canvas.
6830%
6831%        MergeLayer: Merge all layers onto a canvas just large enough
6832%           to hold all the actual images. The virtual canvas of the
6833%           first image is preserved but otherwise ignored.
6834%
6835%        FlattenLayer: Use the virtual canvas size of first image.
6836%           Images which fall outside this canvas is clipped.
6837%           This can be used to 'fill out' a given virtual canvas.
6838%
6839%        MosaicLayer: Start with the virtual canvas of the first image,
6840%           enlarging left and right edges to contain all images.
6841%           Images with negative offsets will be clipped.
6842%
6843*/
6844WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6845  const ImageLayerMethod method)
6846{
6847  Image
6848    *mosaic_image;
6849
6850  assert(wand != (MagickWand *) NULL);
6851  assert(wand->signature == WandSignature);
6852  if (wand->debug != MagickFalse)
6853    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6854  if (wand->images == (Image *) NULL)
6855    return((MagickWand *) NULL);
6856  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6857  if (mosaic_image == (Image *) NULL)
6858    return((MagickWand *) NULL);
6859  return(CloneMagickWandFromImages(wand,mosaic_image));
6860}
6861
6862/*
6863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6864%                                                                             %
6865%                                                                             %
6866%                                                                             %
6867%   M a g i c k M i n i f y I m a g e                                         %
6868%                                                                             %
6869%                                                                             %
6870%                                                                             %
6871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6872%
6873%  MagickMinifyImage() is a convenience method that scales an image
6874%  proportionally to one-half its original size
6875%
6876%  The format of the MagickMinifyImage method is:
6877%
6878%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6879%
6880%  A description of each parameter follows:
6881%
6882%    o wand: the magick wand.
6883%
6884*/
6885WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6886{
6887  Image
6888    *minify_image;
6889
6890  assert(wand != (MagickWand *) NULL);
6891  assert(wand->signature == WandSignature);
6892  if (wand->debug != MagickFalse)
6893    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6894  if (wand->images == (Image *) NULL)
6895    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6896  minify_image=MinifyImage(wand->images,wand->exception);
6897  if (minify_image == (Image *) NULL)
6898    return(MagickFalse);
6899  ReplaceImageInList(&wand->images,minify_image);
6900  return(MagickTrue);
6901}
6902
6903/*
6904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6905%                                                                             %
6906%                                                                             %
6907%                                                                             %
6908%   M a g i c k M o d u l a t e I m a g e                                     %
6909%                                                                             %
6910%                                                                             %
6911%                                                                             %
6912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6913%
6914%  MagickModulateImage() lets you control the brightness, saturation, and hue
6915%  of an image.  Hue is the percentage of absolute rotation from the current
6916%  position.  For example 50 results in a counter-clockwise rotation of 90
6917%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6918%  both resulting in a rotation of 180 degrees.
6919%
6920%  To increase the color brightness by 20% and decrease the color saturation by
6921%  10% and leave the hue unchanged, use: 120,90,100.
6922%
6923%  The format of the MagickModulateImage method is:
6924%
6925%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6926%        const double brightness,const double saturation,const double hue)
6927%
6928%  A description of each parameter follows:
6929%
6930%    o wand: the magick wand.
6931%
6932%    o brightness: the percent change in brighness.
6933%
6934%    o saturation: the percent change in saturation.
6935%
6936%    o hue: the percent change in hue.
6937%
6938*/
6939WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6940  const double brightness,const double saturation,const double hue)
6941{
6942  char
6943    modulate[MaxTextExtent];
6944
6945  MagickBooleanType
6946    status;
6947
6948  assert(wand != (MagickWand *) NULL);
6949  assert(wand->signature == WandSignature);
6950  if (wand->debug != MagickFalse)
6951    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6952  if (wand->images == (Image *) NULL)
6953    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6954  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6955    brightness,saturation,hue);
6956  status=ModulateImage(wand->images,modulate);
6957  if (status == MagickFalse)
6958    InheritException(wand->exception,&wand->images->exception);
6959  return(status);
6960}
6961
6962/*
6963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6964%                                                                             %
6965%                                                                             %
6966%                                                                             %
6967%   M a g i c k M o n t a g e I m a g e                                       %
6968%                                                                             %
6969%                                                                             %
6970%                                                                             %
6971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6972%
6973%  MagickMontageImage() creates a composite image by combining several
6974%  separate images. The images are tiled on the composite image with the name
6975%  of the image optionally appearing just below the individual tile.
6976%
6977%  The format of the MagickMontageImage method is:
6978%
6979%      MagickWand *MagickMontageImage(MagickWand *wand,
6980%        const DrawingWand drawing_wand,const char *tile_geometry,
6981%        const char *thumbnail_geometry,const MontageMode mode,
6982%        const char *frame)
6983%
6984%  A description of each parameter follows:
6985%
6986%    o wand: the magick wand.
6987%
6988%    o drawing_wand: the drawing wand.  The font name, size, and color are
6989%      obtained from this wand.
6990%
6991%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6992%
6993%    o thumbnail_geometry: Preferred image size and border size of each
6994%      thumbnail (e.g. 120x120+4+3>).
6995%
6996%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6997%
6998%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6999%      The frame color is that of the thumbnail's matte color.
7000%
7001*/
7002WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7003  const DrawingWand *drawing_wand,const char *tile_geometry,
7004  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7005{
7006  char
7007    *font;
7008
7009  Image
7010    *montage_image;
7011
7012  MontageInfo
7013    *montage_info;
7014
7015  PixelWand
7016    *pixel_wand;
7017
7018  assert(wand != (MagickWand *) NULL);
7019  assert(wand->signature == WandSignature);
7020  if (wand->debug != MagickFalse)
7021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7022  if (wand->images == (Image *) NULL)
7023    return((MagickWand *) NULL);
7024  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7025  switch (mode)
7026  {
7027    case FrameMode:
7028    {
7029      (void) CloneString(&montage_info->frame,"15x15+3+3");
7030      montage_info->shadow=MagickTrue;
7031      break;
7032    }
7033    case UnframeMode:
7034    {
7035      montage_info->frame=(char *) NULL;
7036      montage_info->shadow=MagickFalse;
7037      montage_info->border_width=0;
7038      break;
7039    }
7040    case ConcatenateMode:
7041    {
7042      montage_info->frame=(char *) NULL;
7043      montage_info->shadow=MagickFalse;
7044      (void) CloneString(&montage_info->geometry,"+0+0");
7045      montage_info->border_width=0;
7046      break;
7047    }
7048    default:
7049      break;
7050  }
7051  font=DrawGetFont(drawing_wand);
7052  if (font != (char *) NULL)
7053    (void) CloneString(&montage_info->font,font);
7054  if (frame != (char *) NULL)
7055    (void) CloneString(&montage_info->frame,frame);
7056  montage_info->pointsize=DrawGetFontSize(drawing_wand);
7057  pixel_wand=NewPixelWand();
7058  DrawGetFillColor(drawing_wand,pixel_wand);
7059  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
7060  DrawGetStrokeColor(drawing_wand,pixel_wand);
7061  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
7062  pixel_wand=DestroyPixelWand(pixel_wand);
7063  if (thumbnail_geometry != (char *) NULL)
7064    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7065  if (tile_geometry != (char *) NULL)
7066    (void) CloneString(&montage_info->tile,tile_geometry);
7067  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7068    wand->exception);
7069  montage_info=DestroyMontageInfo(montage_info);
7070  if (montage_image == (Image *) NULL)
7071    return((MagickWand *) NULL);
7072  return(CloneMagickWandFromImages(wand,montage_image));
7073}
7074
7075/*
7076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7077%                                                                             %
7078%                                                                             %
7079%                                                                             %
7080%   M a g i c k M o r p h I m a g e s                                         %
7081%                                                                             %
7082%                                                                             %
7083%                                                                             %
7084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7085%
7086%  MagickMorphImages() method morphs a set of images.  Both the image pixels
7087%  and size are linearly interpolated to give the appearance of a
7088%  meta-morphosis from one image to the next.
7089%
7090%  The format of the MagickMorphImages method is:
7091%
7092%      MagickWand *MagickMorphImages(MagickWand *wand,
7093%        const size_t number_frames)
7094%
7095%  A description of each parameter follows:
7096%
7097%    o wand: the magick wand.
7098%
7099%    o number_frames: the number of in-between images to generate.
7100%
7101*/
7102WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7103  const size_t number_frames)
7104{
7105  Image
7106    *morph_image;
7107
7108  assert(wand != (MagickWand *) NULL);
7109  assert(wand->signature == WandSignature);
7110  if (wand->debug != MagickFalse)
7111    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7112  if (wand->images == (Image *) NULL)
7113    return((MagickWand *) NULL);
7114  morph_image=MorphImages(wand->images,number_frames,wand->exception);
7115  if (morph_image == (Image *) NULL)
7116    return((MagickWand *) NULL);
7117  return(CloneMagickWandFromImages(wand,morph_image));
7118}
7119
7120/*
7121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7122%                                                                             %
7123%                                                                             %
7124%                                                                             %
7125%   M a g i c k M o r p h o l o g y I m a g e                                 %
7126%                                                                             %
7127%                                                                             %
7128%                                                                             %
7129%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7130%
7131%  MagickMorphologyImage() applies a user supplied kernel to the image
7132%  according to the given mophology method.
7133%
7134%  The format of the MagickMorphologyImage method is:
7135%
7136%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7137%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7138%      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7139%        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7140%        KernelInfo *kernel)
7141%
7142%  A description of each parameter follows:
7143%
7144%    o wand: the magick wand.
7145%
7146%    o channel: the image channel(s).
7147%
7148%    o method: the morphology method to be applied.
7149%
7150%    o iterations: apply the operation this many times (or no change).
7151%      A value of -1 means loop until no change found.  How this is applied
7152%      may depend on the morphology method.  Typically this is a value of 1.
7153%
7154%    o kernel: An array of doubles representing the morphology kernel.
7155%
7156*/
7157
7158WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7159  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7160{
7161  MagickBooleanType
7162    status;
7163
7164  status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7165    kernel);
7166  return(status);
7167}
7168
7169WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7170  const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7171  KernelInfo *kernel)
7172{
7173  Image
7174    *morphology_image;
7175
7176  assert(wand != (MagickWand *) NULL);
7177  assert(wand->signature == WandSignature);
7178  if (wand->debug != MagickFalse)
7179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7180  if (kernel == (const KernelInfo *) NULL)
7181    return(MagickFalse);
7182  if (wand->images == (Image *) NULL)
7183    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7184  morphology_image=MorphologyImageChannel(wand->images,channel,method,
7185    iterations,kernel,wand->exception);
7186  if (morphology_image == (Image *) NULL)
7187    return(MagickFalse);
7188  ReplaceImageInList(&wand->images,morphology_image);
7189  return(MagickTrue);
7190}
7191
7192/*
7193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7194%                                                                             %
7195%                                                                             %
7196%                                                                             %
7197%   M a g i c k M o t i o n B l u r I m a g e                                 %
7198%                                                                             %
7199%                                                                             %
7200%                                                                             %
7201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7202%
7203%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7204%  Gaussian operator of the given radius and standard deviation (sigma).
7205%  For reasonable results, radius should be larger than sigma.  Use a
7206%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7207%  Angle gives the angle of the blurring motion.
7208%
7209%  The format of the MagickMotionBlurImage method is:
7210%
7211%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7212%        const double radius,const double sigma,const double angle)
7213%      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7214%        const ChannelType channel,const double radius,const double sigma,
7215%        const double angle)
7216%
7217%  A description of each parameter follows:
7218%
7219%    o wand: the magick wand.
7220%
7221%    o channel: the image channel(s).
7222%
7223%    o radius: the radius of the Gaussian, in pixels, not counting
7224%      the center pixel.
7225%
7226%    o sigma: the standard deviation of the Gaussian, in pixels.
7227%
7228%    o angle: Apply the effect along this angle.
7229%
7230*/
7231
7232WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7233  const double radius,const double sigma,const double angle)
7234{
7235  MagickBooleanType
7236    status;
7237
7238  status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7239  return(status);
7240}
7241
7242WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7243  const ChannelType channel,const double radius,const double sigma,
7244  const double angle)
7245{
7246  Image
7247    *blur_image;
7248
7249  assert(wand != (MagickWand *) NULL);
7250  assert(wand->signature == WandSignature);
7251  if (wand->debug != MagickFalse)
7252    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7253  if (wand->images == (Image *) NULL)
7254    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7255  blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7256    wand->exception);
7257  if (blur_image == (Image *) NULL)
7258    return(MagickFalse);
7259  ReplaceImageInList(&wand->images,blur_image);
7260  return(MagickTrue);
7261}
7262
7263/*
7264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7265%                                                                             %
7266%                                                                             %
7267%                                                                             %
7268%   M a g i c k N e g a t e I m a g e                                         %
7269%                                                                             %
7270%                                                                             %
7271%                                                                             %
7272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7273%
7274%  MagickNegateImage() negates the colors in the reference image.  The
7275%  Grayscale option means that only grayscale values within the image are
7276%  negated.
7277%
7278%  You can also reduce the influence of a particular channel with a gamma
7279%  value of 0.
7280%
7281%  The format of the MagickNegateImage method is:
7282%
7283%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7284%        const MagickBooleanType gray)
7285%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7286%        const ChannelType channel,const MagickBooleanType gray)
7287%
7288%  A description of each parameter follows:
7289%
7290%    o wand: the magick wand.
7291%
7292%    o channel: the image channel(s).
7293%
7294%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7295%
7296*/
7297
7298WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7299  const MagickBooleanType gray)
7300{
7301  MagickBooleanType
7302    status;
7303
7304  status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7305  return(status);
7306}
7307
7308WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7309  const ChannelType channel,const MagickBooleanType gray)
7310{
7311  MagickBooleanType
7312    status;
7313
7314  assert(wand != (MagickWand *) NULL);
7315  assert(wand->signature == WandSignature);
7316  if (wand->debug != MagickFalse)
7317    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7318  if (wand->images == (Image *) NULL)
7319    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7320  status=NegateImageChannel(wand->images,channel,gray);
7321  if (status == MagickFalse)
7322    InheritException(wand->exception,&wand->images->exception);
7323  return(status);
7324}
7325
7326/*
7327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7328%                                                                             %
7329%                                                                             %
7330%                                                                             %
7331%   M a g i c k N e w I m a g e                                               %
7332%                                                                             %
7333%                                                                             %
7334%                                                                             %
7335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7336%
7337%  MagickNewImage() adds a blank image canvas of the specified size and
7338%  background color to the wand.
7339%
7340%  The format of the MagickNewImage method is:
7341%
7342%      MagickBooleanType MagickNewImage(MagickWand *wand,
7343%        const size_t columns,const size_t rows,
7344%        const PixelWand *background)
7345%
7346%  A description of each parameter follows:
7347%
7348%    o wand: the magick wand.
7349%
7350%    o width: the image width.
7351%
7352%    o height: the image height.
7353%
7354%    o background: the image color.
7355%
7356*/
7357WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7358  const size_t width,const size_t height,
7359  const PixelWand *background)
7360{
7361  Image
7362    *images;
7363
7364  PixelInfo
7365    pixel;
7366
7367  assert(wand != (MagickWand *) NULL);
7368  assert(wand->signature == WandSignature);
7369  if (wand->debug != MagickFalse)
7370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7371  PixelGetMagickColor(background,&pixel);
7372  images=NewMagickImage(wand->image_info,width,height,&pixel);
7373  if (images == (Image *) NULL)
7374    return(MagickFalse);
7375  if (images->exception.severity != UndefinedException)
7376    InheritException(wand->exception,&images->exception);
7377  return(InsertImageInWand(wand,images));
7378}
7379
7380/*
7381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7382%                                                                             %
7383%                                                                             %
7384%                                                                             %
7385%   M a g i c k N e x t I m a g e                                             %
7386%                                                                             %
7387%                                                                             %
7388%                                                                             %
7389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7390%
7391%  MagickNextImage() associates the next image in the image list with a magick
7392%  wand.
7393%
7394%  The format of the MagickNextImage method is:
7395%
7396%      MagickBooleanType MagickNextImage(MagickWand *wand)
7397%
7398%  A description of each parameter follows:
7399%
7400%    o wand: the magick wand.
7401%
7402*/
7403WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7404{
7405  assert(wand != (MagickWand *) NULL);
7406  assert(wand->signature == WandSignature);
7407  if (wand->debug != MagickFalse)
7408    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7409  if (wand->images == (Image *) NULL)
7410    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7411  if (wand->pend != MagickFalse)
7412    {
7413      wand->pend=MagickFalse;
7414      return(MagickTrue);
7415    }
7416  if (GetNextImageInList(wand->images) == (Image *) NULL)
7417    {
7418      wand->pend=MagickTrue;
7419      return(MagickFalse);
7420    }
7421  wand->images=GetNextImageInList(wand->images);
7422  return(MagickTrue);
7423}
7424
7425/*
7426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7427%                                                                             %
7428%                                                                             %
7429%                                                                             %
7430%   M a g i c k N o r m a l i z e I m a g e                                   %
7431%                                                                             %
7432%                                                                             %
7433%                                                                             %
7434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7435%
7436%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7437%  the pixels color to span the entire range of colors available
7438%
7439%  You can also reduce the influence of a particular channel with a gamma
7440%  value of 0.
7441%
7442%  The format of the MagickNormalizeImage method is:
7443%
7444%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7445%      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7446%        const ChannelType channel)
7447%
7448%  A description of each parameter follows:
7449%
7450%    o wand: the magick wand.
7451%
7452%    o channel: the image channel(s).
7453%
7454*/
7455
7456WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7457{
7458  MagickBooleanType
7459    status;
7460
7461  status=MagickNormalizeImageChannel(wand,DefaultChannels);
7462  return(status);
7463}
7464
7465WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7466  const ChannelType channel)
7467{
7468  MagickBooleanType
7469    status;
7470
7471  assert(wand != (MagickWand *) NULL);
7472  assert(wand->signature == WandSignature);
7473  if (wand->debug != MagickFalse)
7474    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7475  if (wand->images == (Image *) NULL)
7476    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7477  status=NormalizeImageChannel(wand->images,channel);
7478  if (status == MagickFalse)
7479    InheritException(wand->exception,&wand->images->exception);
7480  return(status);
7481}
7482
7483/*
7484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7485%                                                                             %
7486%                                                                             %
7487%                                                                             %
7488%   M a g i c k O i l P a i n t I m a g e                                     %
7489%                                                                             %
7490%                                                                             %
7491%                                                                             %
7492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7493%
7494%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7495%  painting.  Each pixel is replaced by the most frequent color occurring
7496%  in a circular region defined by radius.
7497%
7498%  The format of the MagickOilPaintImage method is:
7499%
7500%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7501%        const double radius)
7502%
7503%  A description of each parameter follows:
7504%
7505%    o wand: the magick wand.
7506%
7507%    o radius: the radius of the circular neighborhood.
7508%
7509*/
7510WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7511  const double radius)
7512{
7513  Image
7514    *paint_image;
7515
7516  assert(wand != (MagickWand *) NULL);
7517  assert(wand->signature == WandSignature);
7518  if (wand->debug != MagickFalse)
7519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7520  if (wand->images == (Image *) NULL)
7521    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7522  paint_image=OilPaintImage(wand->images,radius,wand->exception);
7523  if (paint_image == (Image *) NULL)
7524    return(MagickFalse);
7525  ReplaceImageInList(&wand->images,paint_image);
7526  return(MagickTrue);
7527}
7528
7529/*
7530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7531%                                                                             %
7532%                                                                             %
7533%                                                                             %
7534%   M a g i c k O p a q u e P a i n t I m a g e                               %
7535%                                                                             %
7536%                                                                             %
7537%                                                                             %
7538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7539%
7540%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7541%  defined by fill.
7542%
7543%  The format of the MagickOpaquePaintImage method is:
7544%
7545%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7546%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7547%        const MagickBooleanType invert)
7548%      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7549%        const ChannelType channel,const PixelWand *target,
7550%        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7551%
7552%  A description of each parameter follows:
7553%
7554%    o wand: the magick wand.
7555%
7556%    o channel: the channel(s).
7557%
7558%    o target: Change this target color to the fill color within the image.
7559%
7560%    o fill: the fill pixel wand.
7561%
7562%    o fuzz: By default target must match a particular pixel color
7563%      exactly.  However, in many cases two colors may differ by a small amount.
7564%      The fuzz member of image defines how much tolerance is acceptable to
7565%      consider two colors as the same.  For example, set fuzz to 10 and the
7566%      color red at intensities of 100 and 102 respectively are now interpreted
7567%      as the same color for the purposes of the floodfill.
7568%
7569%    o invert: paint any pixel that does not match the target color.
7570%
7571*/
7572
7573WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7574  const PixelWand *target,const PixelWand *fill,const double fuzz,
7575  const MagickBooleanType invert)
7576{
7577  MagickBooleanType
7578    status;
7579
7580  status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7581    invert);
7582  return(status);
7583}
7584
7585WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7586  const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7587  const double fuzz,const MagickBooleanType invert)
7588{
7589  MagickBooleanType
7590    status;
7591
7592  PixelInfo
7593    fill_pixel,
7594    target_pixel;
7595
7596  assert(wand != (MagickWand *) NULL);
7597  assert(wand->signature == WandSignature);
7598  if (wand->debug != MagickFalse)
7599    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7600  if (wand->images == (Image *) NULL)
7601    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7602  PixelGetMagickColor(target,&target_pixel);
7603  PixelGetMagickColor(fill,&fill_pixel);
7604  wand->images->fuzz=fuzz;
7605  status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7606    &fill_pixel,invert);
7607  if (status == MagickFalse)
7608    InheritException(wand->exception,&wand->images->exception);
7609  return(status);
7610}
7611
7612/*
7613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7614%                                                                             %
7615%                                                                             %
7616%                                                                             %
7617%   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                         %
7618%                                                                             %
7619%                                                                             %
7620%                                                                             %
7621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7622%
7623%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7624%  previous image in the sequence.  From this it attempts to select the
7625%  smallest cropped image to replace each frame, while preserving the results
7626%  of the animation.
7627%
7628%  The format of the MagickOptimizeImageLayers method is:
7629%
7630%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7631%
7632%  A description of each parameter follows:
7633%
7634%    o wand: the magick wand.
7635%
7636*/
7637WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7638{
7639  Image
7640    *optimize_image;
7641
7642  assert(wand != (MagickWand *) NULL);
7643  assert(wand->signature == WandSignature);
7644  if (wand->debug != MagickFalse)
7645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7646  if (wand->images == (Image *) NULL)
7647    return((MagickWand *) NULL);
7648  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7649  if (optimize_image == (Image *) NULL)
7650    return((MagickWand *) NULL);
7651  return(CloneMagickWandFromImages(wand,optimize_image));
7652}
7653
7654/*
7655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7656%                                                                             %
7657%                                                                             %
7658%                                                                             %
7659%     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                   %
7660%                                                                             %
7661%                                                                             %
7662%                                                                             %
7663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7664%
7665%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7666%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7667%  which can be different for different channels, according to the input
7668%  arguments.
7669%
7670%  The format of the MagickOrderedPosterizeImage method is:
7671%
7672%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7673%        const char *threshold_map)
7674%      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7675%        const ChannelType channel,const char *threshold_map)
7676%
7677%  A description of each parameter follows:
7678%
7679%    o image: the image.
7680%
7681%    o channel: the channel or channels to be thresholded.
7682%
7683%    o threshold_map: A string containing the name of the threshold dither
7684%      map to use, followed by zero or more numbers representing the number of
7685%      color levels tho dither between.
7686%
7687%      Any level number less than 2 is equivalent to 2, and means only binary
7688%      dithering will be applied to each color channel.
7689%
7690%      No numbers also means a 2 level (bitmap) dither will be applied to all
7691%      channels, while a single number is the number of levels applied to each
7692%      channel in sequence.  More numbers will be applied in turn to each of
7693%      the color channels.
7694%
7695%      For example: "o3x3,6" generates a 6 level posterization of the image
7696%      with a ordered 3x3 diffused pixel dither being applied between each
7697%      level. While checker,8,8,4 will produce a 332 colormaped image with
7698%      only a single checkerboard hash pattern (50% grey) between each color
7699%      level, to basically double the number of color levels with a bare
7700%      minimim of dithering.
7701%
7702*/
7703
7704WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7705  const char *threshold_map)
7706{
7707  MagickBooleanType
7708    status;
7709
7710  status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7711  return(status);
7712}
7713
7714WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7715  MagickWand *wand,const ChannelType channel,const char *threshold_map)
7716{
7717  MagickBooleanType
7718    status;
7719
7720  assert(wand != (MagickWand *) NULL);
7721  assert(wand->signature == WandSignature);
7722  if (wand->debug != MagickFalse)
7723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7724  if (wand->images == (Image *) NULL)
7725    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7726  status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7727    wand->exception);
7728  return(status);
7729}
7730
7731/*
7732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7733%                                                                             %
7734%                                                                             %
7735%                                                                             %
7736%   M a g i c k P i n g I m a g e                                             %
7737%                                                                             %
7738%                                                                             %
7739%                                                                             %
7740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7741%
7742%  MagickPingImage() is like MagickReadImage() except the only valid
7743%  information returned is the image width, height, size, and format.  It
7744%  is designed to efficiently obtain this information from a file without
7745%  reading the entire image sequence into memory.
7746%
7747%  The format of the MagickPingImage method is:
7748%
7749%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7750%
7751%  A description of each parameter follows:
7752%
7753%    o wand: the magick wand.
7754%
7755%    o filename: the image filename.
7756%
7757*/
7758WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7759  const char *filename)
7760{
7761  Image
7762    *images;
7763
7764  ImageInfo
7765    *ping_info;
7766
7767  assert(wand != (MagickWand *) NULL);
7768  assert(wand->signature == WandSignature);
7769  if (wand->debug != MagickFalse)
7770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7771  ping_info=CloneImageInfo(wand->image_info);
7772  if (filename != (const char *) NULL)
7773    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7774  images=PingImage(ping_info,wand->exception);
7775  ping_info=DestroyImageInfo(ping_info);
7776  if (images == (Image *) NULL)
7777    return(MagickFalse);
7778  return(InsertImageInWand(wand,images));
7779}
7780
7781/*
7782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7783%                                                                             %
7784%                                                                             %
7785%                                                                             %
7786%   M a g i c k P i n g I m a g e B l o b                                     %
7787%                                                                             %
7788%                                                                             %
7789%                                                                             %
7790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7791%
7792%  MagickPingImageBlob() pings an image or image sequence from a blob.
7793%
7794%  The format of the MagickPingImageBlob method is:
7795%
7796%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7797%        const void *blob,const size_t length)
7798%
7799%  A description of each parameter follows:
7800%
7801%    o wand: the magick wand.
7802%
7803%    o blob: the blob.
7804%
7805%    o length: the blob length.
7806%
7807*/
7808WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7809  const void *blob,const size_t length)
7810{
7811  Image
7812    *images;
7813
7814  ImageInfo
7815    *read_info;
7816
7817  assert(wand != (MagickWand *) NULL);
7818  assert(wand->signature == WandSignature);
7819  if (wand->debug != MagickFalse)
7820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7821  read_info=CloneImageInfo(wand->image_info);
7822  SetImageInfoBlob(read_info,blob,length);
7823  images=PingImage(read_info,wand->exception);
7824  read_info=DestroyImageInfo(read_info);
7825  if (images == (Image *) NULL)
7826    return(MagickFalse);
7827  return(InsertImageInWand(wand,images));
7828}
7829
7830/*
7831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7832%                                                                             %
7833%                                                                             %
7834%                                                                             %
7835%   M a g i c k P i n g I m a g e F i l e                                     %
7836%                                                                             %
7837%                                                                             %
7838%                                                                             %
7839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7840%
7841%  MagickPingImageFile() pings an image or image sequence from an open file
7842%  descriptor.
7843%
7844%  The format of the MagickPingImageFile method is:
7845%
7846%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7847%
7848%  A description of each parameter follows:
7849%
7850%    o wand: the magick wand.
7851%
7852%    o file: the file descriptor.
7853%
7854*/
7855WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7856{
7857  Image
7858    *images;
7859
7860  ImageInfo
7861    *read_info;
7862
7863  assert(wand != (MagickWand *) NULL);
7864  assert(wand->signature == WandSignature);
7865  assert(file != (FILE *) NULL);
7866  if (wand->debug != MagickFalse)
7867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868  read_info=CloneImageInfo(wand->image_info);
7869  SetImageInfoFile(read_info,file);
7870  images=PingImage(read_info,wand->exception);
7871  read_info=DestroyImageInfo(read_info);
7872  if (images == (Image *) NULL)
7873    return(MagickFalse);
7874  return(InsertImageInWand(wand,images));
7875}
7876
7877/*
7878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7879%                                                                             %
7880%                                                                             %
7881%                                                                             %
7882%   M a g i c k P o l a r o i d I m a g e                                     %
7883%                                                                             %
7884%                                                                             %
7885%                                                                             %
7886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7887%
7888%  MagickPolaroidImage() simulates a Polaroid picture.
7889%
7890%  The format of the MagickPolaroidImage method is:
7891%
7892%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7893%        const DrawingWand *drawing_wand,const double angle)
7894%
7895%  A description of each parameter follows:
7896%
7897%    o wand: the magick wand.
7898%
7899%    o drawing_wand: the draw wand.
7900%
7901%    o angle: Apply the effect along this angle.
7902%
7903*/
7904WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7905  const DrawingWand *drawing_wand,const double angle)
7906{
7907  DrawInfo
7908    *draw_info;
7909
7910  Image
7911    *polaroid_image;
7912
7913  assert(wand != (MagickWand *) NULL);
7914  assert(wand->signature == WandSignature);
7915  if (wand->debug != MagickFalse)
7916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7917  if (wand->images == (Image *) NULL)
7918    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7919  draw_info=PeekDrawingWand(drawing_wand);
7920  if (draw_info == (DrawInfo *) NULL)
7921    return(MagickFalse);
7922  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7923  if (polaroid_image == (Image *) NULL)
7924    return(MagickFalse);
7925  ReplaceImageInList(&wand->images,polaroid_image);
7926  return(MagickTrue);
7927}
7928
7929/*
7930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7931%                                                                             %
7932%                                                                             %
7933%                                                                             %
7934%   M a g i c k P o s t e r i z e I m a g e                                   %
7935%                                                                             %
7936%                                                                             %
7937%                                                                             %
7938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7939%
7940%  MagickPosterizeImage() reduces the image to a limited number of color level.
7941%
7942%  The format of the MagickPosterizeImage method is:
7943%
7944%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7945%        const unsigned levels,const MagickBooleanType dither)
7946%
7947%  A description of each parameter follows:
7948%
7949%    o wand: the magick wand.
7950%
7951%    o levels: Number of color levels allowed in each channel.  Very low values
7952%      (2, 3, or 4) have the most visible effect.
7953%
7954%    o dither: Set this integer value to something other than zero to dither
7955%      the mapped image.
7956%
7957*/
7958WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7959  const size_t levels,const MagickBooleanType dither)
7960{
7961  MagickBooleanType
7962    status;
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  status=PosterizeImage(wand->images,levels,dither);
7971  if (status == MagickFalse)
7972    InheritException(wand->exception,&wand->images->exception);
7973  return(status);
7974}
7975
7976/*
7977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7978%                                                                             %
7979%                                                                             %
7980%                                                                             %
7981%   M a g i c k P r e v i e w I m a g e s                                     %
7982%                                                                             %
7983%                                                                             %
7984%                                                                             %
7985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7986%
7987%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7988%  image processing operation applied at varying strengths.  This helpful
7989%  to quickly pin-point an appropriate parameter for an image processing
7990%  operation.
7991%
7992%  The format of the MagickPreviewImages method is:
7993%
7994%      MagickWand *MagickPreviewImages(MagickWand *wand,
7995%        const PreviewType preview)
7996%
7997%  A description of each parameter follows:
7998%
7999%    o wand: the magick wand.
8000%
8001%    o preview: the preview type.
8002%
8003*/
8004WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8005  const PreviewType preview)
8006{
8007  Image
8008    *preview_image;
8009
8010  assert(wand != (MagickWand *) NULL);
8011  assert(wand->signature == WandSignature);
8012  if (wand->debug != MagickFalse)
8013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8014  if (wand->images == (Image *) NULL)
8015    return((MagickWand *) NULL);
8016  preview_image=PreviewImage(wand->images,preview,wand->exception);
8017  if (preview_image == (Image *) NULL)
8018    return((MagickWand *) NULL);
8019  return(CloneMagickWandFromImages(wand,preview_image));
8020}
8021
8022/*
8023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8024%                                                                             %
8025%                                                                             %
8026%                                                                             %
8027%   M a g i c k P r e v i o u s I m a g e                                     %
8028%                                                                             %
8029%                                                                             %
8030%                                                                             %
8031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8032%
8033%  MagickPreviousImage() assocates the previous image in an image list with
8034%  the magick wand.
8035%
8036%  The format of the MagickPreviousImage method is:
8037%
8038%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8039%
8040%  A description of each parameter follows:
8041%
8042%    o wand: the magick wand.
8043%
8044*/
8045WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8046{
8047  assert(wand != (MagickWand *) NULL);
8048  assert(wand->signature == WandSignature);
8049  if (wand->debug != MagickFalse)
8050    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8051  if (wand->images == (Image *) NULL)
8052    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8053  if (wand->pend != MagickFalse)
8054    {
8055      wand->pend=MagickFalse;
8056      return(MagickTrue);
8057    }
8058  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8059    {
8060      wand->pend=MagickTrue;
8061      return(MagickFalse);
8062    }
8063  wand->images=GetPreviousImageInList(wand->images);
8064  return(MagickTrue);
8065}
8066
8067/*
8068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8069%                                                                             %
8070%                                                                             %
8071%                                                                             %
8072%   M a g i c k Q u a n t i z e I m a g e                                     %
8073%                                                                             %
8074%                                                                             %
8075%                                                                             %
8076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8077%
8078%  MagickQuantizeImage() analyzes the colors within a reference image and
8079%  chooses a fixed number of colors to represent the image.  The goal of the
8080%  algorithm is to minimize the color difference between the input and output
8081%  image while minimizing the processing time.
8082%
8083%  The format of the MagickQuantizeImage method is:
8084%
8085%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8086%        const size_t number_colors,const ColorspaceType colorspace,
8087%        const size_t treedepth,const MagickBooleanType dither,
8088%        const MagickBooleanType measure_error)
8089%
8090%  A description of each parameter follows:
8091%
8092%    o wand: the magick wand.
8093%
8094%    o number_colors: the number of colors.
8095%
8096%    o colorspace: Perform color reduction in this colorspace, typically
8097%      RGBColorspace.
8098%
8099%    o treedepth: Normally, this integer value is zero or one.  A zero or
8100%      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
8101%      reference image with the least amount of memory and the fastest
8102%      computational speed.  In some cases, such as an image with low color
8103%      dispersion (a few number of colors), a value other than
8104%      Log4(number_colors) is required.  To expand the color tree completely,
8105%      use a value of 8.
8106%
8107%    o dither: A value other than zero distributes the difference between an
8108%      original image and the corresponding color reduced image to
8109%      neighboring pixels along a Hilbert curve.
8110%
8111%    o measure_error: A value other than zero measures the difference between
8112%      the original and quantized images.  This difference is the total
8113%      quantization error.  The error is computed by summing over all pixels
8114%      in an image the distance squared in RGB space between each reference
8115%      pixel value and its quantized value.
8116%
8117*/
8118WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8119  const size_t number_colors,const ColorspaceType colorspace,
8120  const size_t treedepth,const MagickBooleanType dither,
8121  const MagickBooleanType measure_error)
8122{
8123  MagickBooleanType
8124    status;
8125
8126  QuantizeInfo
8127    *quantize_info;
8128
8129  assert(wand != (MagickWand *) NULL);
8130  assert(wand->signature == WandSignature);
8131  if (wand->debug != MagickFalse)
8132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8133  if (wand->images == (Image *) NULL)
8134    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8135  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8136  quantize_info->number_colors=number_colors;
8137  quantize_info->dither=dither;
8138  quantize_info->tree_depth=treedepth;
8139  quantize_info->colorspace=colorspace;
8140  quantize_info->measure_error=measure_error;
8141  status=QuantizeImage(quantize_info,wand->images);
8142  if (status == MagickFalse)
8143    InheritException(wand->exception,&wand->images->exception);
8144  quantize_info=DestroyQuantizeInfo(quantize_info);
8145  return(status);
8146}
8147
8148/*
8149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8150%                                                                             %
8151%                                                                             %
8152%                                                                             %
8153%   M a g i c k Q u a n t i z e I m a g e s                                   %
8154%                                                                             %
8155%                                                                             %
8156%                                                                             %
8157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8158%
8159%  MagickQuantizeImages() analyzes the colors within a sequence of images and
8160%  chooses a fixed number of colors to represent the image.  The goal of the
8161%  algorithm is to minimize the color difference between the input and output
8162%  image while minimizing the processing time.
8163%
8164%  The format of the MagickQuantizeImages method is:
8165%
8166%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8167%        const size_t number_colors,const ColorspaceType colorspace,
8168%        const size_t treedepth,const MagickBooleanType dither,
8169%        const MagickBooleanType measure_error)
8170%
8171%  A description of each parameter follows:
8172%
8173%    o wand: the magick wand.
8174%
8175%    o number_colors: the number of colors.
8176%
8177%    o colorspace: Perform color reduction in this colorspace, typically
8178%      RGBColorspace.
8179%
8180%    o treedepth: Normally, this integer value is zero or one.  A zero or
8181%      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
8182%      reference image with the least amount of memory and the fastest
8183%      computational speed.  In some cases, such as an image with low color
8184%      dispersion (a few number of colors), a value other than
8185%      Log4(number_colors) is required.  To expand the color tree completely,
8186%      use a value of 8.
8187%
8188%    o dither: A value other than zero distributes the difference between an
8189%      original image and the corresponding color reduced algorithm to
8190%      neighboring pixels along a Hilbert curve.
8191%
8192%    o measure_error: A value other than zero measures the difference between
8193%      the original and quantized images.  This difference is the total
8194%      quantization error.  The error is computed by summing over all pixels
8195%      in an image the distance squared in RGB space between each reference
8196%      pixel value and its quantized value.
8197%
8198*/
8199WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8200  const size_t number_colors,const ColorspaceType colorspace,
8201  const size_t treedepth,const MagickBooleanType dither,
8202  const MagickBooleanType measure_error)
8203{
8204  MagickBooleanType
8205    status;
8206
8207  QuantizeInfo
8208    *quantize_info;
8209
8210  assert(wand != (MagickWand *) NULL);
8211  assert(wand->signature == WandSignature);
8212  if (wand->debug != MagickFalse)
8213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8214  if (wand->images == (Image *) NULL)
8215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8216  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8217  quantize_info->number_colors=number_colors;
8218  quantize_info->dither=dither;
8219  quantize_info->tree_depth=treedepth;
8220  quantize_info->colorspace=colorspace;
8221  quantize_info->measure_error=measure_error;
8222  status=QuantizeImages(quantize_info,wand->images);
8223  if (status == MagickFalse)
8224    InheritException(wand->exception,&wand->images->exception);
8225  quantize_info=DestroyQuantizeInfo(quantize_info);
8226  return(status);
8227}
8228
8229/*
8230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8231%                                                                             %
8232%                                                                             %
8233%                                                                             %
8234%   M a g i c k R a d i a l B l u r I m a g e                                 %
8235%                                                                             %
8236%                                                                             %
8237%                                                                             %
8238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8239%
8240%  MagickRadialBlurImage() radial blurs an image.
8241%
8242%  The format of the MagickRadialBlurImage method is:
8243%
8244%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8245%        const double angle)
8246%      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8247%        const ChannelType channel,const double angle)
8248%
8249%  A description of each parameter follows:
8250%
8251%    o wand: the magick wand.
8252%
8253%    o channel: the image channel(s).
8254%
8255%    o angle: the angle of the blur in degrees.
8256%
8257*/
8258WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8259  const double angle)
8260{
8261  MagickBooleanType
8262    status;
8263
8264  status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8265  return(status);
8266}
8267
8268WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8269  const ChannelType channel,const double angle)
8270{
8271  Image
8272    *blur_image;
8273
8274  assert(wand != (MagickWand *) NULL);
8275  assert(wand->signature == WandSignature);
8276  if (wand->debug != MagickFalse)
8277    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8278  if (wand->images == (Image *) NULL)
8279    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8280  blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8281    wand->exception);
8282  if (blur_image == (Image *) NULL)
8283    return(MagickFalse);
8284  ReplaceImageInList(&wand->images,blur_image);
8285  return(MagickTrue);
8286}
8287
8288/*
8289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8290%                                                                             %
8291%                                                                             %
8292%                                                                             %
8293%   M a g i c k R a i s e I m a g e                                           %
8294%                                                                             %
8295%                                                                             %
8296%                                                                             %
8297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8298%
8299%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8300%  by lightening and darkening the edges of the image.  Members width and
8301%  height of raise_info define the width of the vertical and horizontal
8302%  edge of the effect.
8303%
8304%  The format of the MagickRaiseImage method is:
8305%
8306%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8307%        const size_t width,const size_t height,const ssize_t x,
8308%        const ssize_t y,const MagickBooleanType raise)
8309%
8310%  A description of each parameter follows:
8311%
8312%    o wand: the magick wand.
8313%
8314%    o width,height,x,y:  Define the dimensions of the area to raise.
8315%
8316%    o raise: A value other than zero creates a 3-D raise effect,
8317%      otherwise it has a lowered effect.
8318%
8319*/
8320WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8321  const size_t width,const size_t height,const ssize_t x,
8322  const ssize_t y,const MagickBooleanType raise)
8323{
8324  MagickBooleanType
8325    status;
8326
8327  RectangleInfo
8328    raise_info;
8329
8330  assert(wand != (MagickWand *) NULL);
8331  assert(wand->signature == WandSignature);
8332  if (wand->debug != MagickFalse)
8333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8334  if (wand->images == (Image *) NULL)
8335    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8336  raise_info.width=width;
8337  raise_info.height=height;
8338  raise_info.x=x;
8339  raise_info.y=y;
8340  status=RaiseImage(wand->images,&raise_info,raise);
8341  if (status == MagickFalse)
8342    InheritException(wand->exception,&wand->images->exception);
8343  return(status);
8344}
8345
8346/*
8347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8348%                                                                             %
8349%                                                                             %
8350%                                                                             %
8351%   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                       %
8352%                                                                             %
8353%                                                                             %
8354%                                                                             %
8355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8356%
8357%  MagickRandomThresholdImage() changes the value of individual pixels based on
8358%  the intensity of each pixel compared to threshold.  The result is a
8359%  high-contrast, two color image.
8360%
8361%  The format of the MagickRandomThresholdImage method is:
8362%
8363%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8364%        const double low,const double high)
8365%      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8366%        const ChannelType channel,const double low,const double high)
8367%
8368%  A description of each parameter follows:
8369%
8370%    o wand: the magick wand.
8371%
8372%    o channel: the image channel(s).
8373%
8374%    o low,high: Specify the high and low thresholds.  These values range from
8375%      0 to QuantumRange.
8376%
8377*/
8378
8379WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8380  const double low,const double high)
8381{
8382  MagickBooleanType
8383    status;
8384
8385  status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8386  return(status);
8387}
8388
8389WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8390  MagickWand *wand,const ChannelType channel,const double low,
8391  const double high)
8392{
8393  char
8394    threshold[MaxTextExtent];
8395
8396  MagickBooleanType
8397    status;
8398
8399  assert(wand != (MagickWand *) NULL);
8400  assert(wand->signature == WandSignature);
8401  if (wand->debug != MagickFalse)
8402    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8403  if (wand->images == (Image *) NULL)
8404    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8405  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8406  status=RandomThresholdImageChannel(wand->images,channel,threshold,
8407    wand->exception);
8408  if (status == MagickFalse)
8409    InheritException(wand->exception,&wand->images->exception);
8410  return(status);
8411}
8412
8413/*
8414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8415%                                                                             %
8416%                                                                             %
8417%                                                                             %
8418%   M a g i c k R e a d I m a g e                                             %
8419%                                                                             %
8420%                                                                             %
8421%                                                                             %
8422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8423%
8424%  MagickReadImage() reads an image or image sequence.  The images are inserted
8425%  at the current image pointer position.   Use MagickSetFirstIterator(),
8426%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8427%  image pointer position at the beginning of the image list, the end, or
8428%  anywhere in-between respectively.
8429%
8430%  The format of the MagickReadImage method is:
8431%
8432%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8433%
8434%  A description of each parameter follows:
8435%
8436%    o wand: the magick wand.
8437%
8438%    o filename: the image filename.
8439%
8440*/
8441WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8442  const char *filename)
8443{
8444  Image
8445    *images;
8446
8447  ImageInfo
8448    *read_info;
8449
8450  assert(wand != (MagickWand *) NULL);
8451  assert(wand->signature == WandSignature);
8452  if (wand->debug != MagickFalse)
8453    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8454  read_info=CloneImageInfo(wand->image_info);
8455  if (filename != (const char *) NULL)
8456    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8457  images=ReadImage(read_info,wand->exception);
8458  read_info=DestroyImageInfo(read_info);
8459  if (images == (Image *) NULL)
8460    return(MagickFalse);
8461  return(InsertImageInWand(wand,images));
8462}
8463
8464/*
8465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8466%                                                                             %
8467%                                                                             %
8468%                                                                             %
8469%   M a g i c k R e a d I m a g e B l o b                                     %
8470%                                                                             %
8471%                                                                             %
8472%                                                                             %
8473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8474%
8475%  MagickReadImageBlob() reads an image or image sequence from a blob.
8476%
8477%  The format of the MagickReadImageBlob method is:
8478%
8479%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8480%        const void *blob,const size_t length)
8481%
8482%  A description of each parameter follows:
8483%
8484%    o wand: the magick wand.
8485%
8486%    o blob: the blob.
8487%
8488%    o length: the blob length.
8489%
8490*/
8491WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8492  const void *blob,const size_t length)
8493{
8494  Image
8495    *images;
8496
8497  assert(wand != (MagickWand *) NULL);
8498  assert(wand->signature == WandSignature);
8499  if (wand->debug != MagickFalse)
8500    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8501  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8502  if (images == (Image *) NULL)
8503    return(MagickFalse);
8504  return(InsertImageInWand(wand,images));
8505}
8506
8507/*
8508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8509%                                                                             %
8510%                                                                             %
8511%                                                                             %
8512%   M a g i c k R e a d I m a g e F i l e                                     %
8513%                                                                             %
8514%                                                                             %
8515%                                                                             %
8516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8517%
8518%  MagickReadImageFile() reads an image or image sequence from an open file
8519%  descriptor.
8520%
8521%  The format of the MagickReadImageFile method is:
8522%
8523%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8524%
8525%  A description of each parameter follows:
8526%
8527%    o wand: the magick wand.
8528%
8529%    o file: the file descriptor.
8530%
8531*/
8532WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8533{
8534  Image
8535    *images;
8536
8537  ImageInfo
8538    *read_info;
8539
8540  assert(wand != (MagickWand *) NULL);
8541  assert(wand->signature == WandSignature);
8542  assert(file != (FILE *) NULL);
8543  if (wand->debug != MagickFalse)
8544    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8545  read_info=CloneImageInfo(wand->image_info);
8546  SetImageInfoFile(read_info,file);
8547  images=ReadImage(read_info,wand->exception);
8548  read_info=DestroyImageInfo(read_info);
8549  if (images == (Image *) NULL)
8550    return(MagickFalse);
8551  return(InsertImageInWand(wand,images));
8552}
8553
8554/*
8555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8556%                                                                             %
8557%                                                                             %
8558%                                                                             %
8559%   M a g i c k R e m a p I m a g e                                           %
8560%                                                                             %
8561%                                                                             %
8562%                                                                             %
8563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8564%
8565%  MagickRemapImage() replaces the colors of an image with the closest color
8566%  from a reference image.
8567%
8568%  The format of the MagickRemapImage method is:
8569%
8570%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8571%        const MagickWand *remap_wand,const DitherMethod method)
8572%
8573%  A description of each parameter follows:
8574%
8575%    o wand: the magick wand.
8576%
8577%    o affinity: the affinity wand.
8578%
8579%    o method: choose from these dither methods: NoDitherMethod,
8580%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8581%
8582*/
8583WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8584  const MagickWand *remap_wand,const DitherMethod method)
8585{
8586  MagickBooleanType
8587    status;
8588
8589  QuantizeInfo
8590    *quantize_info;
8591
8592  assert(wand != (MagickWand *) NULL);
8593  assert(wand->signature == WandSignature);
8594  if (wand->debug != MagickFalse)
8595    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8596  if ((wand->images == (Image *) NULL) ||
8597      (remap_wand->images == (Image *) NULL))
8598    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8599  quantize_info=AcquireQuantizeInfo(wand->image_info);
8600  quantize_info->dither_method=method;
8601  if (method == NoDitherMethod)
8602    quantize_info->dither=MagickFalse;
8603  status=RemapImage(quantize_info,wand->images,remap_wand->images);
8604  quantize_info=DestroyQuantizeInfo(quantize_info);
8605  if (status == MagickFalse)
8606    InheritException(wand->exception,&wand->images->exception);
8607  return(status);
8608}
8609
8610/*
8611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8612%                                                                             %
8613%                                                                             %
8614%                                                                             %
8615%   M a g i c k R e m o v e I m a g e                                         %
8616%                                                                             %
8617%                                                                             %
8618%                                                                             %
8619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8620%
8621%  MagickRemoveImage() removes an image from the image list.
8622%
8623%  The format of the MagickRemoveImage method is:
8624%
8625%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8626%
8627%  A description of each parameter follows:
8628%
8629%    o wand: the magick wand.
8630%
8631%    o insert: the splice wand.
8632%
8633*/
8634WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
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  DeleteImageFromList(&wand->images);
8643  return(MagickTrue);
8644}
8645
8646/*
8647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8648%                                                                             %
8649%                                                                             %
8650%                                                                             %
8651%   M a g i c k R e s a m p l e I m a g e                                     %
8652%                                                                             %
8653%                                                                             %
8654%                                                                             %
8655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8656%
8657%  MagickResampleImage() resample image to desired resolution.
8658%
8659%    Bessel   Blackman   Box
8660%    Catrom   Cubic      Gaussian
8661%    Hanning  Hermite    Lanczos
8662%    Mitchell Point      Quandratic
8663%    Sinc     Triangle
8664%
8665%  Most of the filters are FIR (finite impulse response), however, Bessel,
8666%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8667%  are windowed (brought down to zero) with the Blackman filter.
8668%
8669%  The format of the MagickResampleImage method is:
8670%
8671%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8672%        const double x_resolution,const double y_resolution,
8673%        const FilterTypes filter,const double blur)
8674%
8675%  A description of each parameter follows:
8676%
8677%    o wand: the magick wand.
8678%
8679%    o x_resolution: the new image x resolution.
8680%
8681%    o y_resolution: the new image y resolution.
8682%
8683%    o filter: Image filter to use.
8684%
8685%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8686%
8687*/
8688WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8689  const double x_resolution,const double y_resolution,const FilterTypes filter,
8690  const double blur)
8691{
8692  Image
8693    *resample_image;
8694
8695  assert(wand != (MagickWand *) NULL);
8696  assert(wand->signature == WandSignature);
8697  if (wand->debug != MagickFalse)
8698    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8699  if (wand->images == (Image *) NULL)
8700    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8701  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8702    blur,wand->exception);
8703  if (resample_image == (Image *) NULL)
8704    return(MagickFalse);
8705  ReplaceImageInList(&wand->images,resample_image);
8706  return(MagickTrue);
8707}
8708
8709/*
8710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8711%                                                                             %
8712%                                                                             %
8713%                                                                             %
8714%   M a g i c k R e s e t I m a g e P a g e                                   %
8715%                                                                             %
8716%                                                                             %
8717%                                                                             %
8718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8719%
8720%  MagickResetImagePage() resets the Wand page canvas and position.
8721%
8722%  The format of the MagickResetImagePage method is:
8723%
8724%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8725%        const char *page)
8726%
8727%  A description of each parameter follows:
8728%
8729%    o wand: the magick wand.
8730%
8731%    o page: the relative page specification.
8732%
8733*/
8734WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8735  const char *page)
8736{
8737  assert(wand != (MagickWand *) NULL);
8738  assert(wand->signature == WandSignature);
8739  if (wand->debug != MagickFalse)
8740    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8741  if (wand->images == (Image *) NULL)
8742    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8743  if ((page == (char *) NULL) || (*page == '\0'))
8744    {
8745      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8746      return(MagickTrue);
8747    }
8748  return(ResetImagePage(wand->images,page));
8749}
8750
8751/*
8752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8753%                                                                             %
8754%                                                                             %
8755%                                                                             %
8756%   M a g i c k R e s i z e I m a g e                                         %
8757%                                                                             %
8758%                                                                             %
8759%                                                                             %
8760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8761%
8762%  MagickResizeImage() scales an image to the desired dimensions with one of
8763%  these filters:
8764%
8765%    Bessel   Blackman   Box
8766%    Catrom   Cubic      Gaussian
8767%    Hanning  Hermite    Lanczos
8768%    Mitchell Point      Quandratic
8769%    Sinc     Triangle
8770%
8771%  Most of the filters are FIR (finite impulse response), however, Bessel,
8772%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8773%  are windowed (brought down to zero) with the Blackman filter.
8774%
8775%  The format of the MagickResizeImage method is:
8776%
8777%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8778%        const size_t columns,const size_t rows,
8779%        const FilterTypes filter,const double blur)
8780%
8781%  A description of each parameter follows:
8782%
8783%    o wand: the magick wand.
8784%
8785%    o columns: the number of columns in the scaled image.
8786%
8787%    o rows: the number of rows in the scaled image.
8788%
8789%    o filter: Image filter to use.
8790%
8791%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8792%
8793*/
8794WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8795  const size_t columns,const size_t rows,const FilterTypes filter,
8796  const double blur)
8797{
8798  Image
8799    *resize_image;
8800
8801  assert(wand != (MagickWand *) NULL);
8802  assert(wand->signature == WandSignature);
8803  if (wand->debug != MagickFalse)
8804    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8805  if (wand->images == (Image *) NULL)
8806    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8807  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8808    wand->exception);
8809  if (resize_image == (Image *) NULL)
8810    return(MagickFalse);
8811  ReplaceImageInList(&wand->images,resize_image);
8812  return(MagickTrue);
8813}
8814
8815/*
8816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8817%                                                                             %
8818%                                                                             %
8819%                                                                             %
8820%   M a g i c k R o l l I m a g e                                             %
8821%                                                                             %
8822%                                                                             %
8823%                                                                             %
8824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8825%
8826%  MagickRollImage() offsets an image as defined by x and y.
8827%
8828%  The format of the MagickRollImage method is:
8829%
8830%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8831%        const size_t y)
8832%
8833%  A description of each parameter follows:
8834%
8835%    o wand: the magick wand.
8836%
8837%    o x: the x offset.
8838%
8839%    o y: the y offset.
8840%
8841%
8842*/
8843WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8844  const ssize_t x,const ssize_t y)
8845{
8846  Image
8847    *roll_image;
8848
8849  assert(wand != (MagickWand *) NULL);
8850  assert(wand->signature == WandSignature);
8851  if (wand->debug != MagickFalse)
8852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8853  if (wand->images == (Image *) NULL)
8854    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8855  roll_image=RollImage(wand->images,x,y,wand->exception);
8856  if (roll_image == (Image *) NULL)
8857    return(MagickFalse);
8858  ReplaceImageInList(&wand->images,roll_image);
8859  return(MagickTrue);
8860}
8861
8862/*
8863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8864%                                                                             %
8865%                                                                             %
8866%                                                                             %
8867%   M a g i c k R o t a t e I m a g e                                         %
8868%                                                                             %
8869%                                                                             %
8870%                                                                             %
8871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8872%
8873%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8874%  triangles left over from rotating the image are filled with the
8875%  background color.
8876%
8877%  The format of the MagickRotateImage method is:
8878%
8879%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8880%        const PixelWand *background,const double degrees)
8881%
8882%  A description of each parameter follows:
8883%
8884%    o wand: the magick wand.
8885%
8886%    o background: the background pixel wand.
8887%
8888%    o degrees: the number of degrees to rotate the image.
8889%
8890%
8891*/
8892WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8893  const PixelWand *background,const double degrees)
8894{
8895  Image
8896    *rotate_image;
8897
8898  assert(wand != (MagickWand *) NULL);
8899  assert(wand->signature == WandSignature);
8900  if (wand->debug != MagickFalse)
8901    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8902  if (wand->images == (Image *) NULL)
8903    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8904  PixelGetQuantumPacket(background,&wand->images->background_color);
8905  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8906  if (rotate_image == (Image *) NULL)
8907    return(MagickFalse);
8908  ReplaceImageInList(&wand->images,rotate_image);
8909  return(MagickTrue);
8910}
8911
8912/*
8913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8914%                                                                             %
8915%                                                                             %
8916%                                                                             %
8917%   M a g i c k S a m p l e I m a g e                                         %
8918%                                                                             %
8919%                                                                             %
8920%                                                                             %
8921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8922%
8923%  MagickSampleImage() scales an image to the desired dimensions with pixel
8924%  sampling.  Unlike other scaling methods, this method does not introduce
8925%  any additional color into the scaled image.
8926%
8927%  The format of the MagickSampleImage method is:
8928%
8929%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8930%        const size_t columns,const size_t rows)
8931%
8932%  A description of each parameter follows:
8933%
8934%    o wand: the magick wand.
8935%
8936%    o columns: the number of columns in the scaled image.
8937%
8938%    o rows: the number of rows in the scaled image.
8939%
8940%
8941*/
8942WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8943  const size_t columns,const size_t rows)
8944{
8945  Image
8946    *sample_image;
8947
8948  assert(wand != (MagickWand *) NULL);
8949  assert(wand->signature == WandSignature);
8950  if (wand->debug != MagickFalse)
8951    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8952  if (wand->images == (Image *) NULL)
8953    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8954  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8955  if (sample_image == (Image *) NULL)
8956    return(MagickFalse);
8957  ReplaceImageInList(&wand->images,sample_image);
8958  return(MagickTrue);
8959}
8960
8961/*
8962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8963%                                                                             %
8964%                                                                             %
8965%                                                                             %
8966%   M a g i c k S c a l e I m a g e                                           %
8967%                                                                             %
8968%                                                                             %
8969%                                                                             %
8970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8971%
8972%  MagickScaleImage() scales the size of an image to the given dimensions.
8973%
8974%  The format of the MagickScaleImage method is:
8975%
8976%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8977%        const size_t columns,const size_t rows)
8978%
8979%  A description of each parameter follows:
8980%
8981%    o wand: the magick wand.
8982%
8983%    o columns: the number of columns in the scaled image.
8984%
8985%    o rows: the number of rows in the scaled image.
8986%
8987%
8988*/
8989WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8990  const size_t columns,const size_t rows)
8991{
8992  Image
8993    *scale_image;
8994
8995  assert(wand != (MagickWand *) NULL);
8996  assert(wand->signature == WandSignature);
8997  if (wand->debug != MagickFalse)
8998    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8999  if (wand->images == (Image *) NULL)
9000    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9001  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9002  if (scale_image == (Image *) NULL)
9003    return(MagickFalse);
9004  ReplaceImageInList(&wand->images,scale_image);
9005  return(MagickTrue);
9006}
9007
9008/*
9009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9010%                                                                             %
9011%                                                                             %
9012%                                                                             %
9013%   M a g i c k S e g m e n t I m a g e                                       %
9014%                                                                             %
9015%                                                                             %
9016%                                                                             %
9017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9018%
9019%  MagickSegmentImage() segments an image by analyzing the histograms of the
9020%  color components and identifying units that are homogeneous with the fuzzy
9021%  C-means technique.
9022%
9023%  The format of the SegmentImage method is:
9024%
9025%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9026%        const ColorspaceType colorspace,const MagickBooleanType verbose,
9027%        const double cluster_threshold,const double smooth_threshold)
9028%
9029%  A description of each parameter follows.
9030%
9031%    o wand: the wand.
9032%
9033%    o colorspace: the image colorspace.
9034%
9035%    o verbose:  Set to MagickTrue to print detailed information about the
9036%      identified classes.
9037%
9038%    o cluster_threshold:  This represents the minimum number of pixels
9039%      contained in a hexahedra before it can be considered valid (expressed as
9040%      a percentage).
9041%
9042%    o smooth_threshold: the smoothing threshold eliminates noise in the second
9043%      derivative of the histogram.  As the value is increased, you can expect a
9044%      smoother second derivative.
9045%
9046*/
9047MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9048  const ColorspaceType colorspace,const MagickBooleanType verbose,
9049  const double cluster_threshold,const double smooth_threshold)
9050{
9051  MagickBooleanType
9052    status;
9053
9054  assert(wand != (MagickWand *) NULL);
9055  assert(wand->signature == WandSignature);
9056  if (wand->debug != MagickFalse)
9057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9058  if (wand->images == (Image *) NULL)
9059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9060  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9061    smooth_threshold);
9062  if (status == MagickFalse)
9063    InheritException(wand->exception,&wand->images->exception);
9064  return(status);
9065}
9066
9067/*
9068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9069%                                                                             %
9070%                                                                             %
9071%                                                                             %
9072%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9073%                                                                             %
9074%                                                                             %
9075%                                                                             %
9076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9077%
9078%  MagickSelectiveBlurImage() selectively blur an image within a contrast
9079%  threshold. It is similar to the unsharpen mask that sharpens everything with
9080%  contrast above a certain threshold.
9081%
9082%  The format of the MagickSelectiveBlurImage method is:
9083%
9084%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9085%        const double radius,const double sigma,const double threshold)
9086%      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9087%        const ChannelType channel,const double radius,const double sigma,
9088%        const double threshold)
9089%
9090%  A description of each parameter follows:
9091%
9092%    o wand: the magick wand.
9093%
9094%    o channel: the image channel(s).
9095%
9096%    o radius: the radius of the gaussian, in pixels, not counting the center
9097%      pixel.
9098%
9099%    o sigma: the standard deviation of the gaussian, in pixels.
9100%
9101%    o threshold: only pixels within this contrast threshold are included
9102%      in the blur operation.
9103%
9104*/
9105
9106WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9107  const double radius,const double sigma,const double threshold)
9108{
9109  MagickBooleanType
9110    status;
9111
9112  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9113    threshold);
9114  return(status);
9115}
9116
9117WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9118  const ChannelType channel,const double radius,const double sigma,
9119  const double threshold)
9120{
9121  Image
9122    *blur_image;
9123
9124  assert(wand != (MagickWand *) NULL);
9125  assert(wand->signature == WandSignature);
9126  if (wand->debug != MagickFalse)
9127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9128  if (wand->images == (Image *) NULL)
9129    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9130  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9131    threshold,wand->exception);
9132  if (blur_image == (Image *) NULL)
9133    return(MagickFalse);
9134  ReplaceImageInList(&wand->images,blur_image);
9135  return(MagickTrue);
9136}
9137
9138/*
9139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9140%                                                                             %
9141%                                                                             %
9142%                                                                             %
9143%   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                       %
9144%                                                                             %
9145%                                                                             %
9146%                                                                             %
9147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9148%
9149%  MagickSeparateImageChannel() separates a channel from the image and returns a
9150%  grayscale image.  A channel is a particular color component of each pixel
9151%  in the image.
9152%
9153%  The format of the MagickSeparateImageChannel method is:
9154%
9155%      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9156%        const ChannelType channel)
9157%
9158%  A description of each parameter follows:
9159%
9160%    o wand: the magick wand.
9161%
9162%    o channel: the image channel(s).
9163%
9164*/
9165WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9166  const ChannelType channel)
9167{
9168  MagickBooleanType
9169    status;
9170
9171  assert(wand != (MagickWand *) NULL);
9172  assert(wand->signature == WandSignature);
9173  if (wand->debug != MagickFalse)
9174    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9175  if (wand->images == (Image *) NULL)
9176    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9177  status=SeparateImageChannel(wand->images,channel);
9178  if (status == MagickFalse)
9179    InheritException(wand->exception,&wand->images->exception);
9180  return(status);
9181}
9182
9183/*
9184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9185%                                                                             %
9186%                                                                             %
9187%                                                                             %
9188%     M a g i c k S e p i a T o n e I m a g e                                 %
9189%                                                                             %
9190%                                                                             %
9191%                                                                             %
9192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9193%
9194%  MagickSepiaToneImage() applies a special effect to the image, similar to the
9195%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9196%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9197%  threshold of 80% is a good starting point for a reasonable tone.
9198%
9199%  The format of the MagickSepiaToneImage method is:
9200%
9201%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9202%        const double threshold)
9203%
9204%  A description of each parameter follows:
9205%
9206%    o wand: the magick wand.
9207%
9208%    o threshold:  Define the extent of the sepia toning.
9209%
9210*/
9211WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9212  const double threshold)
9213{
9214  Image
9215    *sepia_image;
9216
9217  assert(wand != (MagickWand *) NULL);
9218  assert(wand->signature == WandSignature);
9219  if (wand->debug != MagickFalse)
9220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9221  if (wand->images == (Image *) NULL)
9222    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9223  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9224  if (sepia_image == (Image *) NULL)
9225    return(MagickFalse);
9226  ReplaceImageInList(&wand->images,sepia_image);
9227  return(MagickTrue);
9228}
9229
9230/*
9231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9232%                                                                             %
9233%                                                                             %
9234%                                                                             %
9235%   M a g i c k S e t I m a g e                                               %
9236%                                                                             %
9237%                                                                             %
9238%                                                                             %
9239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9240%
9241%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9242%  MagickNextImage(), MagickPreviousImage() with the images from the specified
9243%  wand.
9244%
9245%  The format of the MagickSetImage method is:
9246%
9247%      MagickBooleanType MagickSetImage(MagickWand *wand,
9248%        const MagickWand *set_wand)
9249%
9250%  A description of each parameter follows:
9251%
9252%    o wand: the magick wand.
9253%
9254%    o set_wand: the set_wand wand.
9255%
9256*/
9257WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9258  const MagickWand *set_wand)
9259{
9260  Image
9261    *images;
9262
9263  assert(wand != (MagickWand *) NULL);
9264  assert(wand->signature == WandSignature);
9265  if (wand->debug != MagickFalse)
9266    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9267  assert(set_wand != (MagickWand *) NULL);
9268  assert(set_wand->signature == WandSignature);
9269  if (wand->debug != MagickFalse)
9270    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9271  if (set_wand->images == (Image *) NULL)
9272    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9273  images=CloneImageList(set_wand->images,wand->exception);
9274  if (images == (Image *) NULL)
9275    return(MagickFalse);
9276  ReplaceImageInList(&wand->images,images);
9277  return(MagickTrue);
9278}
9279
9280/*
9281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282%                                                                             %
9283%                                                                             %
9284%                                                                             %
9285%   M a g i c k S e t I m a g e A l p h a C h a n n e l                       %
9286%                                                                             %
9287%                                                                             %
9288%                                                                             %
9289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9290%
9291%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9292%  alpha channel.
9293%
9294%  The format of the MagickSetImageAlphaChannel method is:
9295%
9296%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9297%        const AlphaChannelType alpha_type)
9298%
9299%  A description of each parameter follows:
9300%
9301%    o wand: the magick wand.
9302%
9303%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9304%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9305%
9306*/
9307WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9308  const AlphaChannelType alpha_type)
9309{
9310  assert(wand != (MagickWand *) NULL);
9311  assert(wand->signature == WandSignature);
9312  if (wand->debug != MagickFalse)
9313    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9314  if (wand->images == (Image *) NULL)
9315    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9316  return(SetImageAlphaChannel(wand->images,alpha_type));
9317}
9318
9319/*
9320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9321%                                                                             %
9322%                                                                             %
9323%                                                                             %
9324%   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                 %
9325%                                                                             %
9326%                                                                             %
9327%                                                                             %
9328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9329%
9330%  MagickSetImageBackgroundColor() sets the image background color.
9331%
9332%  The format of the MagickSetImageBackgroundColor method is:
9333%
9334%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9335%        const PixelWand *background)
9336%
9337%  A description of each parameter follows:
9338%
9339%    o wand: the magick wand.
9340%
9341%    o background: the background pixel wand.
9342%
9343*/
9344WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9345  const PixelWand *background)
9346{
9347  assert(wand != (MagickWand *) NULL);
9348  assert(wand->signature == WandSignature);
9349  if (wand->debug != MagickFalse)
9350    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9351  if (wand->images == (Image *) NULL)
9352    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9353  PixelGetQuantumPacket(background,&wand->images->background_color);
9354  return(MagickTrue);
9355}
9356
9357/*
9358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9359%                                                                             %
9360%                                                                             %
9361%                                                                             %
9362%   M a g i c k S e t I m a g e B i a s                                       %
9363%                                                                             %
9364%                                                                             %
9365%                                                                             %
9366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9367%
9368%  MagickSetImageBias() sets the image bias for any method that convolves an
9369%  image (e.g. MagickConvolveImage()).
9370%
9371%  The format of the MagickSetImageBias method is:
9372%
9373%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9374%        const double bias)
9375%
9376%  A description of each parameter follows:
9377%
9378%    o wand: the magick wand.
9379%
9380%    o bias: the image bias.
9381%
9382*/
9383WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9384  const double bias)
9385{
9386  assert(wand != (MagickWand *) NULL);
9387  assert(wand->signature == WandSignature);
9388  if (wand->debug != MagickFalse)
9389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9390  if (wand->images == (Image *) NULL)
9391    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9392  wand->images->bias=bias;
9393  return(MagickTrue);
9394}
9395
9396/*
9397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9398%                                                                             %
9399%                                                                             %
9400%                                                                             %
9401%   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                         %
9402%                                                                             %
9403%                                                                             %
9404%                                                                             %
9405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9406%
9407%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9408%
9409%  The format of the MagickSetImageBluePrimary method is:
9410%
9411%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9412%        const double x,const double y)
9413%
9414%  A description of each parameter follows:
9415%
9416%    o wand: the magick wand.
9417%
9418%    o x: the blue primary x-point.
9419%
9420%    o y: the blue primary y-point.
9421%
9422*/
9423WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9424  const double x,const double y)
9425{
9426  assert(wand != (MagickWand *) NULL);
9427  assert(wand->signature == WandSignature);
9428  if (wand->debug != MagickFalse)
9429    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9430  if (wand->images == (Image *) NULL)
9431    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9432  wand->images->chromaticity.blue_primary.x=x;
9433  wand->images->chromaticity.blue_primary.y=y;
9434  return(MagickTrue);
9435}
9436
9437/*
9438%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9439%                                                                             %
9440%                                                                             %
9441%                                                                             %
9442%   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                         %
9443%                                                                             %
9444%                                                                             %
9445%                                                                             %
9446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9447%
9448%  MagickSetImageBorderColor() sets the image border color.
9449%
9450%  The format of the MagickSetImageBorderColor method is:
9451%
9452%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9453%        const PixelWand *border)
9454%
9455%  A description of each parameter follows:
9456%
9457%    o wand: the magick wand.
9458%
9459%    o border: the border pixel wand.
9460%
9461*/
9462WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9463  const PixelWand *border)
9464{
9465  assert(wand != (MagickWand *) NULL);
9466  assert(wand->signature == WandSignature);
9467  if (wand->debug != MagickFalse)
9468    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9469  if (wand->images == (Image *) NULL)
9470    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9471  PixelGetQuantumPacket(border,&wand->images->border_color);
9472  return(MagickTrue);
9473}
9474
9475/*
9476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9477%                                                                             %
9478%                                                                             %
9479%                                                                             %
9480%   M a g i c k S e t I m a g e C h a n n e l D e p t h                       %
9481%                                                                             %
9482%                                                                             %
9483%                                                                             %
9484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9485%
9486%  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9487%
9488%  The format of the MagickSetImageChannelDepth method is:
9489%
9490%      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9491%        const ChannelType channel,const size_t depth)
9492%
9493%  A description of each parameter follows:
9494%
9495%    o wand: the magick wand.
9496%
9497%    o channel: the image channel(s).
9498%
9499%    o depth: the image depth in bits.
9500%
9501*/
9502WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9503  const ChannelType channel,const size_t depth)
9504{
9505  assert(wand != (MagickWand *) NULL);
9506  assert(wand->signature == WandSignature);
9507  if (wand->debug != MagickFalse)
9508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9509  if (wand->images == (Image *) NULL)
9510    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9511  return(SetImageChannelDepth(wand->images,channel,depth));
9512}
9513
9514/*
9515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9516%                                                                             %
9517%                                                                             %
9518%                                                                             %
9519%   M a g i c k S e t I m a g e C l i p M a s k                               %
9520%                                                                             %
9521%                                                                             %
9522%                                                                             %
9523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9524%
9525%  MagickSetImageClipMask() sets image clip mask.
9526%
9527%  The format of the MagickSetImageClipMask method is:
9528%
9529%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9530%        const MagickWand *clip_mask)
9531%
9532%  A description of each parameter follows:
9533%
9534%    o wand: the magick wand.
9535%
9536%    o clip_mask: the clip_mask wand.
9537%
9538*/
9539WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9540  const MagickWand *clip_mask)
9541{
9542  assert(wand != (MagickWand *) NULL);
9543  assert(wand->signature == WandSignature);
9544  if (wand->debug != MagickFalse)
9545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9546  assert(clip_mask != (MagickWand *) NULL);
9547  assert(clip_mask->signature == WandSignature);
9548  if (wand->debug != MagickFalse)
9549    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9550  if (clip_mask->images == (Image *) NULL)
9551    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9552  return(SetImageClipMask(wand->images,clip_mask->images));
9553}
9554
9555/*
9556%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9557%                                                                             %
9558%                                                                             %
9559%                                                                             %
9560%   M a g i c k S e t I m a g e C o l o r                                     %
9561%                                                                             %
9562%                                                                             %
9563%                                                                             %
9564%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9565%
9566%  MagickSetImageColor() set the entire wand canvas to the specified color.
9567%
9568%  The format of the MagickSetImageColor method is:
9569%
9570%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9571%        const PixelWand *color)
9572%
9573%  A description of each parameter follows:
9574%
9575%    o wand: the magick wand.
9576%
9577%    o background: the image color.
9578%
9579*/
9580WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9581  const PixelWand *color)
9582{
9583  MagickBooleanType
9584    status;
9585
9586  PixelInfo
9587    pixel;
9588
9589  assert(wand != (MagickWand *) NULL);
9590  assert(wand->signature == WandSignature);
9591  if (wand->debug != MagickFalse)
9592    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9593  PixelGetMagickColor(color,&pixel);
9594  status=SetImageColor(wand->images,&pixel);
9595  if (status == MagickFalse)
9596    InheritException(wand->exception,&wand->images->exception);
9597  return(status);
9598}
9599
9600/*
9601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9602%                                                                             %
9603%                                                                             %
9604%                                                                             %
9605%   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                     %
9606%                                                                             %
9607%                                                                             %
9608%                                                                             %
9609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9610%
9611%  MagickSetImageColormapColor() sets the color of the specified colormap
9612%  index.
9613%
9614%  The format of the MagickSetImageColormapColor method is:
9615%
9616%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9617%        const size_t index,const PixelWand *color)
9618%
9619%  A description of each parameter follows:
9620%
9621%    o wand: the magick wand.
9622%
9623%    o index: the offset into the image colormap.
9624%
9625%    o color: Return the colormap color in this wand.
9626%
9627*/
9628WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9629  const size_t index,const PixelWand *color)
9630{
9631  assert(wand != (MagickWand *) NULL);
9632  assert(wand->signature == WandSignature);
9633  if (wand->debug != MagickFalse)
9634    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9635  if (wand->images == (Image *) NULL)
9636    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9637  if ((wand->images->colormap == (PixelPacket *) NULL) ||
9638      (index >= wand->images->colors))
9639    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9640  PixelGetQuantumPacket(color,wand->images->colormap+index);
9641  return(SyncImage(wand->images));
9642}
9643
9644/*
9645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9646%                                                                             %
9647%                                                                             %
9648%                                                                             %
9649%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9650%                                                                             %
9651%                                                                             %
9652%                                                                             %
9653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9654%
9655%  MagickSetImageColorspace() sets the image colorspace.
9656%
9657%  The format of the MagickSetImageColorspace method is:
9658%
9659%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9660%        const ColorspaceType colorspace)
9661%
9662%  A description of each parameter follows:
9663%
9664%    o wand: the magick wand.
9665%
9666%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9667%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9668%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9669%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9670%      HSLColorspace, or HWBColorspace.
9671%
9672*/
9673WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9674  const ColorspaceType colorspace)
9675{
9676  assert(wand != (MagickWand *) NULL);
9677  assert(wand->signature == WandSignature);
9678  if (wand->debug != MagickFalse)
9679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9680  if (wand->images == (Image *) NULL)
9681    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9682  return(SetImageColorspace(wand->images,colorspace));
9683}
9684
9685/*
9686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9687%                                                                             %
9688%                                                                             %
9689%                                                                             %
9690%   M a g i c k S e t I m a g e C o m p o s e                                 %
9691%                                                                             %
9692%                                                                             %
9693%                                                                             %
9694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9695%
9696%  MagickSetImageCompose() sets the image composite operator, useful for
9697%  specifying how to composite the image thumbnail when using the
9698%  MagickMontageImage() method.
9699%
9700%  The format of the MagickSetImageCompose method is:
9701%
9702%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9703%        const CompositeOperator compose)
9704%
9705%  A description of each parameter follows:
9706%
9707%    o wand: the magick wand.
9708%
9709%    o compose: the image composite operator.
9710%
9711*/
9712WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9713  const CompositeOperator compose)
9714{
9715  assert(wand != (MagickWand *) NULL);
9716  assert(wand->signature == WandSignature);
9717  if (wand->debug != MagickFalse)
9718    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9719  if (wand->images == (Image *) NULL)
9720    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9721  wand->images->compose=compose;
9722  return(MagickTrue);
9723}
9724
9725/*
9726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9727%                                                                             %
9728%                                                                             %
9729%                                                                             %
9730%   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                         %
9731%                                                                             %
9732%                                                                             %
9733%                                                                             %
9734%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9735%
9736%  MagickSetImageCompression() sets the image compression.
9737%
9738%  The format of the MagickSetImageCompression method is:
9739%
9740%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9741%        const CompressionType compression)
9742%
9743%  A description of each parameter follows:
9744%
9745%    o wand: the magick wand.
9746%
9747%    o compression: the image compression type.
9748%
9749*/
9750WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9751  const CompressionType compression)
9752{
9753  assert(wand != (MagickWand *) NULL);
9754  assert(wand->signature == WandSignature);
9755  if (wand->debug != MagickFalse)
9756    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9757  if (wand->images == (Image *) NULL)
9758    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9759  wand->images->compression=compression;
9760  return(MagickTrue);
9761}
9762
9763/*
9764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9765%                                                                             %
9766%                                                                             %
9767%                                                                             %
9768%   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           %
9769%                                                                             %
9770%                                                                             %
9771%                                                                             %
9772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9773%
9774%  MagickSetImageCompressionQuality() sets the image compression quality.
9775%
9776%  The format of the MagickSetImageCompressionQuality method is:
9777%
9778%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9779%        const size_t quality)
9780%
9781%  A description of each parameter follows:
9782%
9783%    o wand: the magick wand.
9784%
9785%    o quality: the image compression tlityype.
9786%
9787*/
9788WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9789  const size_t quality)
9790{
9791  assert(wand != (MagickWand *) NULL);
9792  assert(wand->signature == WandSignature);
9793  if (wand->debug != MagickFalse)
9794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9795  if (wand->images == (Image *) NULL)
9796    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9797  wand->images->quality=quality;
9798  return(MagickTrue);
9799}
9800
9801/*
9802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9803%                                                                             %
9804%                                                                             %
9805%                                                                             %
9806%   M a g i c k S e t I m a g e D e l a y                                     %
9807%                                                                             %
9808%                                                                             %
9809%                                                                             %
9810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9811%
9812%  MagickSetImageDelay() sets the image delay.
9813%
9814%  The format of the MagickSetImageDelay method is:
9815%
9816%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9817%        const size_t delay)
9818%
9819%  A description of each parameter follows:
9820%
9821%    o wand: the magick wand.
9822%
9823%    o delay: the image delay in ticks-per-second units.
9824%
9825*/
9826WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9827  const size_t delay)
9828{
9829  assert(wand != (MagickWand *) NULL);
9830  assert(wand->signature == WandSignature);
9831  if (wand->debug != MagickFalse)
9832    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9833  if (wand->images == (Image *) NULL)
9834    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9835  wand->images->delay=delay;
9836  return(MagickTrue);
9837}
9838
9839/*
9840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9841%                                                                             %
9842%                                                                             %
9843%                                                                             %
9844%   M a g i c k S e t I m a g e D e p t h                                     %
9845%                                                                             %
9846%                                                                             %
9847%                                                                             %
9848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9849%
9850%  MagickSetImageDepth() sets the image depth.
9851%
9852%  The format of the MagickSetImageDepth method is:
9853%
9854%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9855%        const size_t depth)
9856%
9857%  A description of each parameter follows:
9858%
9859%    o wand: the magick wand.
9860%
9861%    o depth: the image depth in bits: 8, 16, or 32.
9862%
9863*/
9864WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9865  const size_t depth)
9866{
9867  assert(wand != (MagickWand *) NULL);
9868  assert(wand->signature == WandSignature);
9869  if (wand->debug != MagickFalse)
9870    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9871  if (wand->images == (Image *) NULL)
9872    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9873  wand->images->depth=depth;
9874  return(MagickTrue);
9875}
9876
9877/*
9878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9879%                                                                             %
9880%                                                                             %
9881%                                                                             %
9882%   M a g i c k S e t I m a g e D i s p o s e                                 %
9883%                                                                             %
9884%                                                                             %
9885%                                                                             %
9886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9887%
9888%  MagickSetImageDispose() sets the image disposal method.
9889%
9890%  The format of the MagickSetImageDispose method is:
9891%
9892%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9893%        const DisposeType dispose)
9894%
9895%  A description of each parameter follows:
9896%
9897%    o wand: the magick wand.
9898%
9899%    o dispose: the image disposeal type.
9900%
9901*/
9902WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9903  const DisposeType dispose)
9904{
9905  assert(wand != (MagickWand *) NULL);
9906  assert(wand->signature == WandSignature);
9907  if (wand->debug != MagickFalse)
9908    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9909  if (wand->images == (Image *) NULL)
9910    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9911  wand->images->dispose=dispose;
9912  return(MagickTrue);
9913}
9914
9915/*
9916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9917%                                                                             %
9918%                                                                             %
9919%                                                                             %
9920%   M a g i c k S e t I m a g e E x t e n t                                   %
9921%                                                                             %
9922%                                                                             %
9923%                                                                             %
9924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9925%
9926%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9927%
9928%  The format of the MagickSetImageExtent method is:
9929%
9930%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9931%        const size_t columns,const unsigned rows)
9932%
9933%  A description of each parameter follows:
9934%
9935%    o wand: the magick wand.
9936%
9937%    o columns:  The image width in pixels.
9938%
9939%    o rows:  The image height in pixels.
9940%
9941*/
9942WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9943  const size_t columns,const size_t rows)
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  return(SetImageExtent(wand->images,columns,rows));
9952}
9953
9954/*
9955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9956%                                                                             %
9957%                                                                             %
9958%                                                                             %
9959%   M a g i c k S e t I m a g e F i l e n a m e                               %
9960%                                                                             %
9961%                                                                             %
9962%                                                                             %
9963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9964%
9965%  MagickSetImageFilename() sets the filename of a particular image in a
9966%  sequence.
9967%
9968%  The format of the MagickSetImageFilename method is:
9969%
9970%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9971%        const char *filename)
9972%
9973%  A description of each parameter follows:
9974%
9975%    o wand: the magick wand.
9976%
9977%    o filename: the image filename.
9978%
9979*/
9980WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9981  const char *filename)
9982{
9983  assert(wand != (MagickWand *) NULL);
9984  assert(wand->signature == WandSignature);
9985  if (wand->debug != MagickFalse)
9986    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9987  if (wand->images == (Image *) NULL)
9988    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9989  if (filename != (const char *) NULL)
9990    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9991  return(MagickTrue);
9992}
9993
9994/*
9995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9996%                                                                             %
9997%                                                                             %
9998%                                                                             %
9999%   M a g i c k S e t I m a g e F o r m a t                                   %
10000%                                                                             %
10001%                                                                             %
10002%                                                                             %
10003%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10004%
10005%  MagickSetImageFormat() sets the format of a particular image in a
10006%  sequence.
10007%
10008%  The format of the MagickSetImageFormat method is:
10009%
10010%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10011%        const char *format)
10012%
10013%  A description of each parameter follows:
10014%
10015%    o wand: the magick wand.
10016%
10017%    o format: the image format.
10018%
10019*/
10020WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10021  const char *format)
10022{
10023  const MagickInfo
10024    *magick_info;
10025
10026  assert(wand != (MagickWand *) NULL);
10027  assert(wand->signature == WandSignature);
10028  if (wand->debug != MagickFalse)
10029    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10030  if (wand->images == (Image *) NULL)
10031    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10032  if ((format == (char *) NULL) || (*format == '\0'))
10033    {
10034      *wand->images->magick='\0';
10035      return(MagickTrue);
10036    }
10037  magick_info=GetMagickInfo(format,wand->exception);
10038  if (magick_info == (const MagickInfo *) NULL)
10039    return(MagickFalse);
10040  ClearMagickException(wand->exception);
10041  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10042  return(MagickTrue);
10043}
10044
10045/*
10046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10047%                                                                             %
10048%                                                                             %
10049%                                                                             %
10050%   M a g i c k S e t I m a g e F u z z                                       %
10051%                                                                             %
10052%                                                                             %
10053%                                                                             %
10054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10055%
10056%  MagickSetImageFuzz() sets the image fuzz.
10057%
10058%  The format of the MagickSetImageFuzz method is:
10059%
10060%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10061%        const double fuzz)
10062%
10063%  A description of each parameter follows:
10064%
10065%    o wand: the magick wand.
10066%
10067%    o fuzz: the image fuzz.
10068%
10069*/
10070WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10071  const double fuzz)
10072{
10073  assert(wand != (MagickWand *) NULL);
10074  assert(wand->signature == WandSignature);
10075  if (wand->debug != MagickFalse)
10076    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10077  if (wand->images == (Image *) NULL)
10078    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10079  wand->images->fuzz=fuzz;
10080  return(MagickTrue);
10081}
10082
10083/*
10084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10085%                                                                             %
10086%                                                                             %
10087%                                                                             %
10088%   M a g i c k S e t I m a g e G a m m a                                     %
10089%                                                                             %
10090%                                                                             %
10091%                                                                             %
10092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093%
10094%  MagickSetImageGamma() sets the image gamma.
10095%
10096%  The format of the MagickSetImageGamma method is:
10097%
10098%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10099%        const double gamma)
10100%
10101%  A description of each parameter follows:
10102%
10103%    o wand: the magick wand.
10104%
10105%    o gamma: the image gamma.
10106%
10107*/
10108WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10109  const double gamma)
10110{
10111  assert(wand != (MagickWand *) NULL);
10112  assert(wand->signature == WandSignature);
10113  if (wand->debug != MagickFalse)
10114    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10115  if (wand->images == (Image *) NULL)
10116    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10117  wand->images->gamma=gamma;
10118  return(MagickTrue);
10119}
10120
10121/*
10122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10123%                                                                             %
10124%                                                                             %
10125%                                                                             %
10126%   M a g i c k S e t I m a g e G r a v i t y                                 %
10127%                                                                             %
10128%                                                                             %
10129%                                                                             %
10130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10131%
10132%  MagickSetImageGravity() sets the image gravity type.
10133%
10134%  The format of the MagickSetImageGravity method is:
10135%
10136%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10137%        const GravityType gravity)
10138%
10139%  A description of each parameter follows:
10140%
10141%    o wand: the magick wand.
10142%
10143%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10144%      PlaneInterlace, PartitionInterlace.
10145%
10146*/
10147WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10148  const GravityType gravity)
10149{
10150  assert(wand != (MagickWand *) NULL);
10151  assert(wand->signature == WandSignature);
10152  if (wand->debug != MagickFalse)
10153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10154  if (wand->images == (Image *) NULL)
10155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10156  wand->images->gravity=gravity;
10157  return(MagickTrue);
10158}
10159
10160/*
10161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10162%                                                                             %
10163%                                                                             %
10164%                                                                             %
10165%   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                       %
10166%                                                                             %
10167%                                                                             %
10168%                                                                             %
10169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10170%
10171%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10172%  point.
10173%
10174%  The format of the MagickSetImageGreenPrimary method is:
10175%
10176%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10177%        const double x,const double y)
10178%
10179%  A description of each parameter follows:
10180%
10181%    o wand: the magick wand.
10182%
10183%    o x: the green primary x-point.
10184%
10185%    o y: the green primary y-point.
10186%
10187%
10188*/
10189WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10190  const double x,const double y)
10191{
10192  assert(wand != (MagickWand *) NULL);
10193  assert(wand->signature == WandSignature);
10194  if (wand->debug != MagickFalse)
10195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10196  if (wand->images == (Image *) NULL)
10197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10198  wand->images->chromaticity.green_primary.x=x;
10199  wand->images->chromaticity.green_primary.y=y;
10200  return(MagickTrue);
10201}
10202
10203/*
10204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10205%                                                                             %
10206%                                                                             %
10207%                                                                             %
10208%   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                 %
10209%                                                                             %
10210%                                                                             %
10211%                                                                             %
10212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10213%
10214%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10215%
10216%  The format of the MagickSetImageInterlaceScheme method is:
10217%
10218%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10219%        const InterlaceType interlace)
10220%
10221%  A description of each parameter follows:
10222%
10223%    o wand: the magick wand.
10224%
10225%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10226%      PlaneInterlace, PartitionInterlace.
10227%
10228*/
10229WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10230  const InterlaceType interlace)
10231{
10232  assert(wand != (MagickWand *) NULL);
10233  assert(wand->signature == WandSignature);
10234  if (wand->debug != MagickFalse)
10235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10236  if (wand->images == (Image *) NULL)
10237    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10238  wand->images->interlace=interlace;
10239  return(MagickTrue);
10240}
10241
10242/*
10243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10244%                                                                             %
10245%                                                                             %
10246%                                                                             %
10247%   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             %
10248%                                                                             %
10249%                                                                             %
10250%                                                                             %
10251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10252%
10253%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10254%
10255%  The format of the MagickSetImageInterpolateMethod method is:
10256%
10257%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10258%        const InterpolatePixelMethod method)
10259%
10260%  A description of each parameter follows:
10261%
10262%    o wand: the magick wand.
10263%
10264%    o method: the image interpole pixel methods: choose from Undefined,
10265%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10266%
10267*/
10268WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10269  const InterpolatePixelMethod method)
10270{
10271  assert(wand != (MagickWand *) NULL);
10272  assert(wand->signature == WandSignature);
10273  if (wand->debug != MagickFalse)
10274    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10275  if (wand->images == (Image *) NULL)
10276    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10277  wand->images->interpolate=method;
10278  return(MagickTrue);
10279}
10280
10281/*
10282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10283%                                                                             %
10284%                                                                             %
10285%                                                                             %
10286%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10287%                                                                             %
10288%                                                                             %
10289%                                                                             %
10290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10291%
10292%  MagickSetImageIterations() sets the image iterations.
10293%
10294%  The format of the MagickSetImageIterations method is:
10295%
10296%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10297%        const size_t iterations)
10298%
10299%  A description of each parameter follows:
10300%
10301%    o wand: the magick wand.
10302%
10303%    o delay: the image delay in 1/100th of a second.
10304%
10305*/
10306WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10307  const size_t iterations)
10308{
10309  assert(wand != (MagickWand *) NULL);
10310  assert(wand->signature == WandSignature);
10311  if (wand->debug != MagickFalse)
10312    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10313  if (wand->images == (Image *) NULL)
10314    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10315  wand->images->iterations=iterations;
10316  return(MagickTrue);
10317}
10318
10319/*
10320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10321%                                                                             %
10322%                                                                             %
10323%                                                                             %
10324%   M a g i c k S e t I m a g e M a t t e                                     %
10325%                                                                             %
10326%                                                                             %
10327%                                                                             %
10328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10329%
10330%  MagickSetImageMatte() sets the image matte channel.
10331%
10332%  The format of the MagickSetImageMatteColor method is:
10333%
10334%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10335%        const MagickBooleanType *matte)
10336%
10337%  A description of each parameter follows:
10338%
10339%    o wand: the magick wand.
10340%
10341%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10342%      MagickFalse.
10343%
10344*/
10345WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10346  const MagickBooleanType matte)
10347{
10348  assert(wand != (MagickWand *) NULL);
10349  assert(wand->signature == WandSignature);
10350  if (wand->debug != MagickFalse)
10351    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10352  if (wand->images == (Image *) NULL)
10353    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10354  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10355    (void) SetImageOpacity(wand->images,OpaqueAlpha);
10356  wand->images->matte=matte;
10357  return(MagickTrue);
10358}
10359
10360/*
10361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10362%                                                                             %
10363%                                                                             %
10364%                                                                             %
10365%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10366%                                                                             %
10367%                                                                             %
10368%                                                                             %
10369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10370%
10371%  MagickSetImageMatteColor() sets the image matte color.
10372%
10373%  The format of the MagickSetImageMatteColor method is:
10374%
10375%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10376%        const PixelWand *matte)
10377%
10378%  A description of each parameter follows:
10379%
10380%    o wand: the magick wand.
10381%
10382%    o matte: the matte pixel wand.
10383%
10384*/
10385WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10386  const PixelWand *matte)
10387{
10388  assert(wand != (MagickWand *) NULL);
10389  assert(wand->signature == WandSignature);
10390  if (wand->debug != MagickFalse)
10391    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10392  if (wand->images == (Image *) NULL)
10393    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10394  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10395  return(MagickTrue);
10396}
10397
10398/*
10399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10400%                                                                             %
10401%                                                                             %
10402%                                                                             %
10403%   M a g i c k S e t I m a g e O p a c i t y                                 %
10404%                                                                             %
10405%                                                                             %
10406%                                                                             %
10407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10408%
10409%  MagickSetImageOpacity() sets the image to the specified opacity level.
10410%
10411%  The format of the MagickSetImageOpacity method is:
10412%
10413%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10414%        const double alpha)
10415%
10416%  A description of each parameter follows:
10417%
10418%    o wand: the magick wand.
10419%
10420%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10421%      transparent.
10422%
10423*/
10424WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10425  const double alpha)
10426{
10427  MagickBooleanType
10428    status;
10429
10430  assert(wand != (MagickWand *) NULL);
10431  assert(wand->signature == WandSignature);
10432  if (wand->debug != MagickFalse)
10433    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10434  if (wand->images == (Image *) NULL)
10435    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10436  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
10437  if (status == MagickFalse)
10438    InheritException(wand->exception,&wand->images->exception);
10439  return(status);
10440}
10441
10442/*
10443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10444%                                                                             %
10445%                                                                             %
10446%                                                                             %
10447%   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                         %
10448%                                                                             %
10449%                                                                             %
10450%                                                                             %
10451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10452%
10453%  MagickSetImageOrientation() sets the image orientation.
10454%
10455%  The format of the MagickSetImageOrientation method is:
10456%
10457%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10458%        const OrientationType orientation)
10459%
10460%  A description of each parameter follows:
10461%
10462%    o wand: the magick wand.
10463%
10464%    o orientation: the image orientation type.
10465%
10466*/
10467WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10468  const OrientationType orientation)
10469{
10470  assert(wand != (MagickWand *) NULL);
10471  assert(wand->signature == WandSignature);
10472  if (wand->debug != MagickFalse)
10473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10474  if (wand->images == (Image *) NULL)
10475    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10476  wand->images->orientation=orientation;
10477  return(MagickTrue);
10478}
10479
10480/*
10481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10482%                                                                             %
10483%                                                                             %
10484%                                                                             %
10485%   M a g i c k S e t I m a g e P a g e                                       %
10486%                                                                             %
10487%                                                                             %
10488%                                                                             %
10489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10490%
10491%  MagickSetImagePage() sets the page geometry of the image.
10492%
10493%  The format of the MagickSetImagePage method is:
10494%
10495%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10496%        const size_t width,const size_t height,const ssize_t x,
10497%        const ssize_t y)
10498%
10499%  A description of each parameter follows:
10500%
10501%    o wand: the magick wand.
10502%
10503%    o width: the page width.
10504%
10505%    o height: the page height.
10506%
10507%    o x: the page x-offset.
10508%
10509%    o y: the page y-offset.
10510%
10511*/
10512WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10513  const size_t width,const size_t height,const ssize_t x,
10514  const ssize_t y)
10515{
10516  assert(wand != (MagickWand *) NULL);
10517  assert(wand->signature == WandSignature);
10518  if (wand->debug != MagickFalse)
10519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10520  if (wand->images == (Image *) NULL)
10521    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10522  wand->images->page.width=width;
10523  wand->images->page.height=height;
10524  wand->images->page.x=x;
10525  wand->images->page.y=y;
10526  return(MagickTrue);
10527}
10528
10529/*
10530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10531%                                                                             %
10532%                                                                             %
10533%                                                                             %
10534%   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                 %
10535%                                                                             %
10536%                                                                             %
10537%                                                                             %
10538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10539%
10540%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10541%  specified method and returns the previous progress monitor if any.  The
10542%  progress monitor method looks like this:
10543%
10544%    MagickBooleanType MagickProgressMonitor(const char *text,
10545%      const MagickOffsetType offset,const MagickSizeType span,
10546%      void *client_data)
10547%
10548%  If the progress monitor returns MagickFalse, the current operation is
10549%  interrupted.
10550%
10551%  The format of the MagickSetImageProgressMonitor method is:
10552%
10553%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10554%        const MagickProgressMonitor progress_monitor,void *client_data)
10555%
10556%  A description of each parameter follows:
10557%
10558%    o wand: the magick wand.
10559%
10560%    o progress_monitor: Specifies a pointer to a method to monitor progress
10561%      of an image operation.
10562%
10563%    o client_data: Specifies a pointer to any client data.
10564%
10565*/
10566WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10567  const MagickProgressMonitor progress_monitor,void *client_data)
10568{
10569  MagickProgressMonitor
10570    previous_monitor;
10571
10572  assert(wand != (MagickWand *) NULL);
10573  assert(wand->signature == WandSignature);
10574  if (wand->debug != MagickFalse)
10575    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10576  if (wand->images == (Image *) NULL)
10577    {
10578      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10579        "ContainsNoImages","`%s'",wand->name);
10580      return((MagickProgressMonitor) NULL);
10581    }
10582  previous_monitor=SetImageProgressMonitor(wand->images,
10583    progress_monitor,client_data);
10584  return(previous_monitor);
10585}
10586
10587/*
10588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10589%                                                                             %
10590%                                                                             %
10591%                                                                             %
10592%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10593%                                                                             %
10594%                                                                             %
10595%                                                                             %
10596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10597%
10598%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10599%
10600%  The format of the MagickSetImageRedPrimary method is:
10601%
10602%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10603%        const double x,const double y)
10604%
10605%  A description of each parameter follows:
10606%
10607%    o wand: the magick wand.
10608%
10609%    o x: the red primary x-point.
10610%
10611%    o y: the red primary y-point.
10612%
10613*/
10614WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10615  const double x,const double y)
10616{
10617  assert(wand != (MagickWand *) NULL);
10618  assert(wand->signature == WandSignature);
10619  if (wand->debug != MagickFalse)
10620    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10621  if (wand->images == (Image *) NULL)
10622    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10623  wand->images->chromaticity.red_primary.x=x;
10624  wand->images->chromaticity.red_primary.y=y;
10625  return(MagickTrue);
10626}
10627
10628/*
10629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10630%                                                                             %
10631%                                                                             %
10632%                                                                             %
10633%   M a g i c k S e t I m a g e R e n d e r i n g I n t e n t                 %
10634%                                                                             %
10635%                                                                             %
10636%                                                                             %
10637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10638%
10639%  MagickSetImageRenderingIntent() sets the image rendering intent.
10640%
10641%  The format of the MagickSetImageRenderingIntent method is:
10642%
10643%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10644%        const RenderingIntent rendering_intent)
10645%
10646%  A description of each parameter follows:
10647%
10648%    o wand: the magick wand.
10649%
10650%    o rendering_intent: the image rendering intent: UndefinedIntent,
10651%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10652%
10653*/
10654WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10655  const RenderingIntent rendering_intent)
10656{
10657  assert(wand != (MagickWand *) NULL);
10658  assert(wand->signature == WandSignature);
10659  if (wand->debug != MagickFalse)
10660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10661  if (wand->images == (Image *) NULL)
10662    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10663  wand->images->rendering_intent=rendering_intent;
10664  return(MagickTrue);
10665}
10666
10667/*
10668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10669%                                                                             %
10670%                                                                             %
10671%                                                                             %
10672%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10673%                                                                             %
10674%                                                                             %
10675%                                                                             %
10676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10677%
10678%  MagickSetImageResolution() sets the image resolution.
10679%
10680%  The format of the MagickSetImageResolution method is:
10681%
10682%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10683%        const double x_resolution,const doubtl y_resolution)
10684%
10685%  A description of each parameter follows:
10686%
10687%    o wand: the magick wand.
10688%
10689%    o x_resolution: the image x resolution.
10690%
10691%    o y_resolution: the image y resolution.
10692%
10693*/
10694WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10695  const double x_resolution,const double y_resolution)
10696{
10697  assert(wand != (MagickWand *) NULL);
10698  assert(wand->signature == WandSignature);
10699  if (wand->debug != MagickFalse)
10700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10701  if (wand->images == (Image *) NULL)
10702    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10703  wand->images->x_resolution=x_resolution;
10704  wand->images->y_resolution=y_resolution;
10705  return(MagickTrue);
10706}
10707
10708/*
10709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10710%                                                                             %
10711%                                                                             %
10712%                                                                             %
10713%   M a g i c k S e t I m a g e S c e n e                                     %
10714%                                                                             %
10715%                                                                             %
10716%                                                                             %
10717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10718%
10719%  MagickSetImageScene() sets the image scene.
10720%
10721%  The format of the MagickSetImageScene method is:
10722%
10723%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10724%        const size_t scene)
10725%
10726%  A description of each parameter follows:
10727%
10728%    o wand: the magick wand.
10729%
10730%    o delay: the image scene number.
10731%
10732*/
10733WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10734  const size_t scene)
10735{
10736  assert(wand != (MagickWand *) NULL);
10737  assert(wand->signature == WandSignature);
10738  if (wand->debug != MagickFalse)
10739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10740  if (wand->images == (Image *) NULL)
10741    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10742  wand->images->scene=scene;
10743  return(MagickTrue);
10744}
10745
10746/*
10747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10748%                                                                             %
10749%                                                                             %
10750%                                                                             %
10751%   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                   %
10752%                                                                             %
10753%                                                                             %
10754%                                                                             %
10755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10756%
10757%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10758%
10759%  The format of the MagickSetImageTicksPerSecond method is:
10760%
10761%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10762%        const ssize_t ticks_per-second)
10763%
10764%  A description of each parameter follows:
10765%
10766%    o wand: the magick wand.
10767%
10768%    o ticks_per_second: the units to use for the image delay.
10769%
10770*/
10771WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10772  const ssize_t ticks_per_second)
10773{
10774  assert(wand != (MagickWand *) NULL);
10775  assert(wand->signature == WandSignature);
10776  if (wand->debug != MagickFalse)
10777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10778  if (wand->images == (Image *) NULL)
10779    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10780  wand->images->ticks_per_second=ticks_per_second;
10781  return(MagickTrue);
10782}
10783
10784/*
10785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10786%                                                                             %
10787%                                                                             %
10788%                                                                             %
10789%   M a g i c k S e t I m a g e T y p e                                       %
10790%                                                                             %
10791%                                                                             %
10792%                                                                             %
10793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10794%
10795%  MagickSetImageType() sets the image type.
10796%
10797%  The format of the MagickSetImageType method is:
10798%
10799%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10800%        const ImageType image_type)
10801%
10802%  A description of each parameter follows:
10803%
10804%    o wand: the magick wand.
10805%
10806%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10807%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10808%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10809%      or OptimizeType.
10810%
10811*/
10812WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10813  const ImageType image_type)
10814{
10815  assert(wand != (MagickWand *) NULL);
10816  assert(wand->signature == WandSignature);
10817  if (wand->debug != MagickFalse)
10818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10819  if (wand->images == (Image *) NULL)
10820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10821  return(SetImageType(wand->images,image_type));
10822}
10823
10824/*
10825%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10826%                                                                             %
10827%                                                                             %
10828%                                                                             %
10829%   M a g i c k S e t I m a g e U n i t s                                     %
10830%                                                                             %
10831%                                                                             %
10832%                                                                             %
10833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10834%
10835%  MagickSetImageUnits() sets the image units of resolution.
10836%
10837%  The format of the MagickSetImageUnits method is:
10838%
10839%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10840%        const ResolutionType units)
10841%
10842%  A description of each parameter follows:
10843%
10844%    o wand: the magick wand.
10845%
10846%    o units: the image units of resolution : UndefinedResolution,
10847%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10848%
10849*/
10850WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10851  const ResolutionType units)
10852{
10853  assert(wand != (MagickWand *) NULL);
10854  assert(wand->signature == WandSignature);
10855  if (wand->debug != MagickFalse)
10856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10857  if (wand->images == (Image *) NULL)
10858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10859  wand->images->units=units;
10860  return(MagickTrue);
10861}
10862
10863/*
10864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10865%                                                                             %
10866%                                                                             %
10867%                                                                             %
10868%   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           %
10869%                                                                             %
10870%                                                                             %
10871%                                                                             %
10872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10873%
10874%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10875%
10876%  The format of the MagickSetImageVirtualPixelMethod method is:
10877%
10878%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10879%        const VirtualPixelMethod method)
10880%
10881%  A description of each parameter follows:
10882%
10883%    o wand: the magick wand.
10884%
10885%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10886%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10887%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10888%
10889*/
10890WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10891  const VirtualPixelMethod method)
10892{
10893  assert(wand != (MagickWand *) NULL);
10894  assert(wand->signature == WandSignature);
10895  if (wand->debug != MagickFalse)
10896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10897  if (wand->images == (Image *) NULL)
10898    return(UndefinedVirtualPixelMethod);
10899  return(SetImageVirtualPixelMethod(wand->images,method));
10900}
10901
10902/*
10903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10904%                                                                             %
10905%                                                                             %
10906%                                                                             %
10907%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10908%                                                                             %
10909%                                                                             %
10910%                                                                             %
10911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10912%
10913%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10914%
10915%  The format of the MagickSetImageWhitePoint method is:
10916%
10917%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10918%        const double x,const double y)
10919%
10920%  A description of each parameter follows:
10921%
10922%    o wand: the magick wand.
10923%
10924%    o x: the white x-point.
10925%
10926%    o y: the white y-point.
10927%
10928*/
10929WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10930  const double x,const double y)
10931{
10932  assert(wand != (MagickWand *) NULL);
10933  assert(wand->signature == WandSignature);
10934  if (wand->debug != MagickFalse)
10935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10936  if (wand->images == (Image *) NULL)
10937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10938  wand->images->chromaticity.white_point.x=x;
10939  wand->images->chromaticity.white_point.y=y;
10940  return(MagickTrue);
10941}
10942
10943/*
10944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10945%                                                                             %
10946%                                                                             %
10947%                                                                             %
10948%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10949%                                                                             %
10950%                                                                             %
10951%                                                                             %
10952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10953%
10954%  MagickShadeImage() shines a distant light on an image to create a
10955%  three-dimensional effect. You control the positioning of the light with
10956%  azimuth and elevation; azimuth is measured in degrees off the x axis
10957%  and elevation is measured in pixels above the Z axis.
10958%
10959%  The format of the MagickShadeImage method is:
10960%
10961%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10962%        const MagickBooleanType gray,const double azimuth,
10963%        const double elevation)
10964%
10965%  A description of each parameter follows:
10966%
10967%    o wand: the magick wand.
10968%
10969%    o gray: A value other than zero shades the intensity of each pixel.
10970%
10971%    o azimuth, elevation:  Define the light source direction.
10972%
10973*/
10974WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10975  const MagickBooleanType gray,const double asimuth,const double elevation)
10976{
10977  Image
10978    *shade_image;
10979
10980  assert(wand != (MagickWand *) NULL);
10981  assert(wand->signature == WandSignature);
10982  if (wand->debug != MagickFalse)
10983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10984  if (wand->images == (Image *) NULL)
10985    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10986  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10987  if (shade_image == (Image *) NULL)
10988    return(MagickFalse);
10989  ReplaceImageInList(&wand->images,shade_image);
10990  return(MagickTrue);
10991}
10992
10993/*
10994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10995%                                                                             %
10996%                                                                             %
10997%                                                                             %
10998%   M a g i c k S h a d o w I m a g e                                         %
10999%                                                                             %
11000%                                                                             %
11001%                                                                             %
11002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11003%
11004%  MagickShadowImage() simulates an image shadow.
11005%
11006%  The format of the MagickShadowImage method is:
11007%
11008%      MagickBooleanType MagickShadowImage(MagickWand *wand,
11009%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11010%
11011%  A description of each parameter follows:
11012%
11013%    o wand: the magick wand.
11014%
11015%    o opacity: percentage transparency.
11016%
11017%    o sigma: the standard deviation of the Gaussian, in pixels.
11018%
11019%    o x: the shadow x-offset.
11020%
11021%    o y: the shadow y-offset.
11022%
11023*/
11024WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11025  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11026{
11027  Image
11028    *shadow_image;
11029
11030  assert(wand != (MagickWand *) NULL);
11031  assert(wand->signature == WandSignature);
11032  if (wand->debug != MagickFalse)
11033    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11034  if (wand->images == (Image *) NULL)
11035    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11036  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11037  if (shadow_image == (Image *) NULL)
11038    return(MagickFalse);
11039  ReplaceImageInList(&wand->images,shadow_image);
11040  return(MagickTrue);
11041}
11042
11043/*
11044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11045%                                                                             %
11046%                                                                             %
11047%                                                                             %
11048%   M a g i c k S h a r p e n I m a g e                                       %
11049%                                                                             %
11050%                                                                             %
11051%                                                                             %
11052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11053%
11054%  MagickSharpenImage() sharpens an image.  We convolve the image with a
11055%  Gaussian operator of the given radius and standard deviation (sigma).
11056%  For reasonable results, the radius should be larger than sigma.  Use a
11057%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11058%
11059%  The format of the MagickSharpenImage method is:
11060%
11061%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11062%        const double radius,const double sigma)
11063%      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11064%        const ChannelType channel,const double radius,const double sigma)
11065%
11066%  A description of each parameter follows:
11067%
11068%    o wand: the magick wand.
11069%
11070%    o channel: the image channel(s).
11071%
11072%    o radius: the radius of the Gaussian, in pixels, not counting the center
11073%      pixel.
11074%
11075%    o sigma: the standard deviation of the Gaussian, in pixels.
11076%
11077*/
11078
11079WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11080  const double radius,const double sigma)
11081{
11082  MagickBooleanType
11083    status;
11084
11085  status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11086  return(status);
11087}
11088
11089WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11090  const ChannelType channel,const double radius,const double sigma)
11091{
11092  Image
11093    *sharp_image;
11094
11095  assert(wand != (MagickWand *) NULL);
11096  assert(wand->signature == WandSignature);
11097  if (wand->debug != MagickFalse)
11098    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11099  if (wand->images == (Image *) NULL)
11100    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11101  sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11102    wand->exception);
11103  if (sharp_image == (Image *) NULL)
11104    return(MagickFalse);
11105  ReplaceImageInList(&wand->images,sharp_image);
11106  return(MagickTrue);
11107}
11108
11109/*
11110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11111%                                                                             %
11112%                                                                             %
11113%                                                                             %
11114%   M a g i c k S h a v e I m a g e                                           %
11115%                                                                             %
11116%                                                                             %
11117%                                                                             %
11118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11119%
11120%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11121%  memory necessary for the new Image structure and returns a pointer to the
11122%  new image.
11123%
11124%  The format of the MagickShaveImage method is:
11125%
11126%      MagickBooleanType MagickShaveImage(MagickWand *wand,
11127%        const size_t columns,const size_t rows)
11128%
11129%  A description of each parameter follows:
11130%
11131%    o wand: the magick wand.
11132%
11133%    o columns: the number of columns in the scaled image.
11134%
11135%    o rows: the number of rows in the scaled image.
11136%
11137%
11138*/
11139WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11140  const size_t columns,const size_t rows)
11141{
11142  Image
11143    *shave_image;
11144
11145  RectangleInfo
11146    shave_info;
11147
11148  assert(wand != (MagickWand *) NULL);
11149  assert(wand->signature == WandSignature);
11150  if (wand->debug != MagickFalse)
11151    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11152  if (wand->images == (Image *) NULL)
11153    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11154  shave_info.width=columns;
11155  shave_info.height=rows;
11156  shave_info.x=0;
11157  shave_info.y=0;
11158  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11159  if (shave_image == (Image *) NULL)
11160    return(MagickFalse);
11161  ReplaceImageInList(&wand->images,shave_image);
11162  return(MagickTrue);
11163}
11164
11165/*
11166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11167%                                                                             %
11168%                                                                             %
11169%                                                                             %
11170%   M a g i c k S h e a r I m a g e                                           %
11171%                                                                             %
11172%                                                                             %
11173%                                                                             %
11174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11175%
11176%  MagickShearImage() slides one edge of an image along the X or Y axis,
11177%  creating a parallelogram.  An X direction shear slides an edge along the X
11178%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11179%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11180%  is measured relative to the Y axis, and similarly, for Y direction shears
11181%  y_shear is measured relative to the X axis.  Empty triangles left over from
11182%  shearing the image are filled with the background color.
11183%
11184%  The format of the MagickShearImage method is:
11185%
11186%      MagickBooleanType MagickShearImage(MagickWand *wand,
11187%        const PixelWand *background,const double x_shear,onst double y_shear)
11188%
11189%  A description of each parameter follows:
11190%
11191%    o wand: the magick wand.
11192%
11193%    o background: the background pixel wand.
11194%
11195%    o x_shear: the number of degrees to shear the image.
11196%
11197%    o y_shear: the number of degrees to shear the image.
11198%
11199*/
11200WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11201  const PixelWand *background,const double x_shear,const double y_shear)
11202{
11203  Image
11204    *shear_image;
11205
11206  assert(wand != (MagickWand *) NULL);
11207  assert(wand->signature == WandSignature);
11208  if (wand->debug != MagickFalse)
11209    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11210  if (wand->images == (Image *) NULL)
11211    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11212  PixelGetQuantumPacket(background,&wand->images->background_color);
11213  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11214  if (shear_image == (Image *) NULL)
11215    return(MagickFalse);
11216  ReplaceImageInList(&wand->images,shear_image);
11217  return(MagickTrue);
11218}
11219
11220/*
11221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11222%                                                                             %
11223%                                                                             %
11224%                                                                             %
11225%   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                   %
11226%                                                                             %
11227%                                                                             %
11228%                                                                             %
11229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11230%
11231%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11232%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11233%  image using a sigmoidal transfer function without saturating highlights or
11234%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11235%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11236%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11237%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11238%  is reduced.
11239%
11240%  The format of the MagickSigmoidalContrastImage method is:
11241%
11242%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11243%        const MagickBooleanType sharpen,const double alpha,const double beta)
11244%      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11245%        const ChannelType channel,const MagickBooleanType sharpen,
11246%        const double alpha,const double beta)
11247%
11248%  A description of each parameter follows:
11249%
11250%    o wand: the magick wand.
11251%
11252%    o channel: Identify which channel to level: RedChannel, GreenChannel,
11253%
11254%    o sharpen: Increase or decrease image contrast.
11255%
11256%    o alpha: strength of the contrast, the larger the number the more
11257%      'threshold-like' it becomes.
11258%
11259%    o beta: midpoint of the function as a color value 0 to QuantumRange.
11260%
11261*/
11262
11263WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11264  const MagickBooleanType sharpen,const double alpha,const double beta)
11265{
11266  MagickBooleanType
11267    status;
11268
11269  status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11270    alpha,beta);
11271  return(status);
11272}
11273
11274WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11275  MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11276  const double alpha,const double beta)
11277{
11278  MagickBooleanType
11279    status;
11280
11281  assert(wand != (MagickWand *) NULL);
11282  assert(wand->signature == WandSignature);
11283  if (wand->debug != MagickFalse)
11284    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11285  if (wand->images == (Image *) NULL)
11286    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11287  status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11288  if (status == MagickFalse)
11289    InheritException(wand->exception,&wand->images->exception);
11290  return(status);
11291}
11292
11293/*
11294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11295%                                                                             %
11296%                                                                             %
11297%                                                                             %
11298%   M a g i c k S i m i l a r i t y I m a g e                                 %
11299%                                                                             %
11300%                                                                             %
11301%                                                                             %
11302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11303%
11304%  MagickSimilarityImage() compares the reference image of the image and
11305%  returns the best match offset.  In addition, it returns a similarity image
11306%  such that an exact match location is completely white and if none of the
11307%  pixels match, black, otherwise some gray level in-between.
11308%
11309%  The format of the MagickSimilarityImage method is:
11310%
11311%      MagickWand *MagickSimilarityImage(MagickWand *wand,
11312%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11313%
11314%  A description of each parameter follows:
11315%
11316%    o wand: the magick wand.
11317%
11318%    o reference: the reference wand.
11319%
11320%    o offset: the best match offset of the reference image within the image.
11321%
11322%    o similarity: the computed similarity between the images.
11323%
11324*/
11325WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11326  const MagickWand *reference,RectangleInfo *offset,double *similarity)
11327{
11328  Image
11329    *similarity_image;
11330
11331  assert(wand != (MagickWand *) NULL);
11332  assert(wand->signature == WandSignature);
11333  if (wand->debug != MagickFalse)
11334    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11335  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11336    {
11337      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11338        "ContainsNoImages","`%s'",wand->name);
11339      return((MagickWand *) NULL);
11340    }
11341  similarity_image=SimilarityImage(wand->images,reference->images,offset,
11342    similarity,&wand->images->exception);
11343  if (similarity_image == (Image *) NULL)
11344    return((MagickWand *) NULL);
11345  return(CloneMagickWandFromImages(wand,similarity_image));
11346}
11347
11348/*
11349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11350%                                                                             %
11351%                                                                             %
11352%                                                                             %
11353%   M a g i c k S k e t c h I m a g e                                         %
11354%                                                                             %
11355%                                                                             %
11356%                                                                             %
11357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11358%
11359%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11360%  a Gaussian operator of the given radius and standard deviation (sigma).
11361%  For reasonable results, radius should be larger than sigma.  Use a
11362%  radius of 0 and SketchImage() selects a suitable radius for you.
11363%  Angle gives the angle of the blurring motion.
11364%
11365%  The format of the MagickSketchImage method is:
11366%
11367%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11368%        const double radius,const double sigma,const double angle)
11369%
11370%  A description of each parameter follows:
11371%
11372%    o wand: the magick wand.
11373%
11374%    o radius: the radius of the Gaussian, in pixels, not counting
11375%      the center pixel.
11376%
11377%    o sigma: the standard deviation of the Gaussian, in pixels.
11378%
11379%    o angle: Apply the effect along this angle.
11380%
11381*/
11382WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11383  const double radius,const double sigma,const double angle)
11384{
11385  Image
11386    *sketch_image;
11387
11388  assert(wand != (MagickWand *) NULL);
11389  assert(wand->signature == WandSignature);
11390  if (wand->debug != MagickFalse)
11391    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11392  if (wand->images == (Image *) NULL)
11393    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11394  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11395  if (sketch_image == (Image *) NULL)
11396    return(MagickFalse);
11397  ReplaceImageInList(&wand->images,sketch_image);
11398  return(MagickTrue);
11399}
11400
11401/*
11402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11403%                                                                             %
11404%                                                                             %
11405%                                                                             %
11406%   M a g i c k S m u s h I m a g e s                                         %
11407%                                                                             %
11408%                                                                             %
11409%                                                                             %
11410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11411%
11412%  MagickSmushImages() takes all images from the current image pointer to the
11413%  end of the image list and smushs them to each other top-to-bottom if the
11414%  stack parameter is true, otherwise left-to-right.
11415%
11416%  The format of the MagickSmushImages method is:
11417%
11418%      MagickWand *MagickSmushImages(MagickWand *wand,
11419%        const MagickBooleanType stack,const ssize_t offset)
11420%
11421%  A description of each parameter follows:
11422%
11423%    o wand: the magick wand.
11424%
11425%    o stack: By default, images are stacked left-to-right. Set stack to
11426%      MagickTrue to stack them top-to-bottom.
11427%
11428%    o offset: minimum distance in pixels between images.
11429%
11430*/
11431WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11432  const MagickBooleanType stack,const ssize_t offset)
11433{
11434  Image
11435    *smush_image;
11436
11437  assert(wand != (MagickWand *) NULL);
11438  assert(wand->signature == WandSignature);
11439  if (wand->debug != MagickFalse)
11440    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11441  if (wand->images == (Image *) NULL)
11442    return((MagickWand *) NULL);
11443  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11444  if (smush_image == (Image *) NULL)
11445    return((MagickWand *) NULL);
11446  return(CloneMagickWandFromImages(wand,smush_image));
11447}
11448
11449/*
11450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11451%                                                                             %
11452%                                                                             %
11453%                                                                             %
11454%     M a g i c k S o l a r i z e I m a g e                                   %
11455%                                                                             %
11456%                                                                             %
11457%                                                                             %
11458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11459%
11460%  MagickSolarizeImage() applies a special effect to the image, similar to the
11461%  effect achieved in a photo darkroom by selectively exposing areas of photo
11462%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11463%  measure of the extent of the solarization.
11464%
11465%  The format of the MagickSolarizeImage method is:
11466%
11467%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11468%        const double threshold)
11469%
11470%  A description of each parameter follows:
11471%
11472%    o wand: the magick wand.
11473%
11474%    o threshold:  Define the extent of the solarization.
11475%
11476*/
11477WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11478  const double threshold)
11479{
11480  MagickBooleanType
11481    status;
11482
11483  assert(wand != (MagickWand *) NULL);
11484  assert(wand->signature == WandSignature);
11485  if (wand->debug != MagickFalse)
11486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11487  if (wand->images == (Image *) NULL)
11488    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11489  status=SolarizeImage(wand->images,threshold);
11490  if (status == MagickFalse)
11491    InheritException(wand->exception,&wand->images->exception);
11492  return(status);
11493}
11494
11495/*
11496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11497%                                                                             %
11498%                                                                             %
11499%                                                                             %
11500%   M a g i c k S p a r s e C o l o r I m a g e                               %
11501%                                                                             %
11502%                                                                             %
11503%                                                                             %
11504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11505%
11506%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11507%  colors found at those coordinates, across the whole image, using various
11508%  methods.
11509%
11510%  The format of the MagickSparseColorImage method is:
11511%
11512%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11513%        const ChannelType channel,const SparseColorMethod method,
11514%        const size_t number_arguments,const double *arguments)
11515%
11516%  A description of each parameter follows:
11517%
11518%    o image: the image to be sparseed.
11519%
11520%    o method: the method of image sparseion.
11521%
11522%        ArcSparseColorion will always ignore source image offset, and always
11523%        'bestfit' the destination image with the top left corner offset
11524%        relative to the polar mapping center.
11525%
11526%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11527%        style of image sparseion.
11528%
11529%        Affine, Perspective, and Bilinear, will do least squares fitting of
11530%        the distrotion when more than the minimum number of control point
11531%        pairs are provided.
11532%
11533%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11534%        less than 4 control point pairs are provided. While Affine sparseions
11535%        will let you use any number of control point pairs, that is Zero pairs
11536%        is a No-Op (viewport only) distrotion, one pair is a translation and
11537%        two pairs of control points will do a scale-rotate-translate, without
11538%        any shearing.
11539%
11540%    o number_arguments: the number of arguments given for this sparseion
11541%      method.
11542%
11543%    o arguments: the arguments for this sparseion method.
11544%
11545*/
11546WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11547  const ChannelType channel,const SparseColorMethod method,
11548  const size_t number_arguments,const double *arguments)
11549{
11550  Image
11551    *sparse_image;
11552
11553  assert(wand != (MagickWand *) NULL);
11554  assert(wand->signature == WandSignature);
11555  if (wand->debug != MagickFalse)
11556    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11557  if (wand->images == (Image *) NULL)
11558    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11559  sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11560    arguments,wand->exception);
11561  if (sparse_image == (Image *) NULL)
11562    return(MagickFalse);
11563  ReplaceImageInList(&wand->images,sparse_image);
11564  return(MagickTrue);
11565}
11566
11567/*
11568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11569%                                                                             %
11570%                                                                             %
11571%                                                                             %
11572%   M a g i c k S p l i c e I m a g e                                         %
11573%                                                                             %
11574%                                                                             %
11575%                                                                             %
11576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11577%
11578%  MagickSpliceImage() splices a solid color into the image.
11579%
11580%  The format of the MagickSpliceImage method is:
11581%
11582%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11583%        const size_t width,const size_t height,const ssize_t x,
11584%        const ssize_t y)
11585%
11586%  A description of each parameter follows:
11587%
11588%    o wand: the magick wand.
11589%
11590%    o width: the region width.
11591%
11592%    o height: the region height.
11593%
11594%    o x: the region x offset.
11595%
11596%    o y: the region y offset.
11597%
11598*/
11599WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11600  const size_t width,const size_t height,const ssize_t x,
11601  const ssize_t y)
11602{
11603  Image
11604    *splice_image;
11605
11606  RectangleInfo
11607    splice;
11608
11609  assert(wand != (MagickWand *) NULL);
11610  assert(wand->signature == WandSignature);
11611  if (wand->debug != MagickFalse)
11612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11613  if (wand->images == (Image *) NULL)
11614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11615  splice.width=width;
11616  splice.height=height;
11617  splice.x=x;
11618  splice.y=y;
11619  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11620  if (splice_image == (Image *) NULL)
11621    return(MagickFalse);
11622  ReplaceImageInList(&wand->images,splice_image);
11623  return(MagickTrue);
11624}
11625
11626/*
11627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11628%                                                                             %
11629%                                                                             %
11630%                                                                             %
11631%   M a g i c k S p r e a d I m a g e                                         %
11632%                                                                             %
11633%                                                                             %
11634%                                                                             %
11635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11636%
11637%  MagickSpreadImage() is a special effects method that randomly displaces each
11638%  pixel in a block defined by the radius parameter.
11639%
11640%  The format of the MagickSpreadImage method is:
11641%
11642%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11643%
11644%  A description of each parameter follows:
11645%
11646%    o wand: the magick wand.
11647%
11648%    o radius:  Choose a random pixel in a neighborhood of this extent.
11649%
11650*/
11651WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11652  const double radius)
11653{
11654  Image
11655    *spread_image;
11656
11657  assert(wand != (MagickWand *) NULL);
11658  assert(wand->signature == WandSignature);
11659  if (wand->debug != MagickFalse)
11660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11661  if (wand->images == (Image *) NULL)
11662    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11663  spread_image=SpreadImage(wand->images,radius,wand->exception);
11664  if (spread_image == (Image *) NULL)
11665    return(MagickFalse);
11666  ReplaceImageInList(&wand->images,spread_image);
11667  return(MagickTrue);
11668}
11669
11670/*
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672%                                                                             %
11673%                                                                             %
11674%                                                                             %
11675%   M a g i c k S t a t i s t i c I m a g e                                   %
11676%                                                                             %
11677%                                                                             %
11678%                                                                             %
11679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680%
11681%  MagickStatisticImage() replace each pixel with corresponding statistic from
11682%  the neighborhood of the specified width and height.
11683%
11684%  The format of the MagickStatisticImage method is:
11685%
11686%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11687%        const StatisticType type,const double width,const size_t height)
11688%      MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
11689%        const ChannelType channel,const StatisticType type,const double width,
11690%        const size_t height)
11691%
11692%  A description of each parameter follows:
11693%
11694%    o wand: the magick wand.
11695%
11696%    o channel: the image channel(s).
11697%
11698%    o type: the statistic type (e.g. median, mode, etc.).
11699%
11700%    o width: the width of the pixel neighborhood.
11701%
11702%    o height: the height of the pixel neighborhood.
11703%
11704*/
11705WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11706  const ChannelType channel,const StatisticType type,const size_t width,
11707  const size_t height)
11708{
11709  Image
11710    *statistic_image;
11711
11712  assert(wand != (MagickWand *) NULL);
11713  assert(wand->signature == WandSignature);
11714  if (wand->debug != MagickFalse)
11715    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11716  if (wand->images == (Image *) NULL)
11717    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11718  statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
11719    wand->exception);
11720  if (statistic_image == (Image *) NULL)
11721    return(MagickFalse);
11722  ReplaceImageInList(&wand->images,statistic_image);
11723  return(MagickTrue);
11724}
11725
11726/*
11727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11728%                                                                             %
11729%                                                                             %
11730%                                                                             %
11731%   M a g i c k S t e g a n o I m a g e                                       %
11732%                                                                             %
11733%                                                                             %
11734%                                                                             %
11735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11736%
11737%  MagickSteganoImage() hides a digital watermark within the image.
11738%  Recover the hidden watermark later to prove that the authenticity of
11739%  an image.  Offset defines the start position within the image to hide
11740%  the watermark.
11741%
11742%  The format of the MagickSteganoImage method is:
11743%
11744%      MagickWand *MagickSteganoImage(MagickWand *wand,
11745%        const MagickWand *watermark_wand,const ssize_t offset)
11746%
11747%  A description of each parameter follows:
11748%
11749%    o wand: the magick wand.
11750%
11751%    o watermark_wand: the watermark wand.
11752%
11753%    o offset: Start hiding at this offset into the image.
11754%
11755*/
11756WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11757  const MagickWand *watermark_wand,const ssize_t offset)
11758{
11759  Image
11760    *stegano_image;
11761
11762  assert(wand != (MagickWand *) NULL);
11763  assert(wand->signature == WandSignature);
11764  if (wand->debug != MagickFalse)
11765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11766  if ((wand->images == (Image *) NULL) ||
11767      (watermark_wand->images == (Image *) NULL))
11768    {
11769      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11770        "ContainsNoImages","`%s'",wand->name);
11771      return((MagickWand *) NULL);
11772    }
11773  wand->images->offset=offset;
11774  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11775    wand->exception);
11776  if (stegano_image == (Image *) NULL)
11777    return((MagickWand *) NULL);
11778  return(CloneMagickWandFromImages(wand,stegano_image));
11779}
11780
11781/*
11782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11783%                                                                             %
11784%                                                                             %
11785%                                                                             %
11786%   M a g i c k S t e r e o I m a g e                                         %
11787%                                                                             %
11788%                                                                             %
11789%                                                                             %
11790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11791%
11792%  MagickStereoImage() composites two images and produces a single image that
11793%  is the composite of a left and right image of a stereo pair
11794%
11795%  The format of the MagickStereoImage method is:
11796%
11797%      MagickWand *MagickStereoImage(MagickWand *wand,
11798%        const MagickWand *offset_wand)
11799%
11800%  A description of each parameter follows:
11801%
11802%    o wand: the magick wand.
11803%
11804%    o offset_wand: Another image wand.
11805%
11806*/
11807WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11808  const MagickWand *offset_wand)
11809{
11810  Image
11811    *stereo_image;
11812
11813  assert(wand != (MagickWand *) NULL);
11814  assert(wand->signature == WandSignature);
11815  if (wand->debug != MagickFalse)
11816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11817  if ((wand->images == (Image *) NULL) ||
11818      (offset_wand->images == (Image *) NULL))
11819    {
11820      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11821        "ContainsNoImages","`%s'",wand->name);
11822      return((MagickWand *) NULL);
11823    }
11824  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11825  if (stereo_image == (Image *) NULL)
11826    return((MagickWand *) NULL);
11827  return(CloneMagickWandFromImages(wand,stereo_image));
11828}
11829
11830/*
11831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11832%                                                                             %
11833%                                                                             %
11834%                                                                             %
11835%   M a g i c k S t r i p I m a g e                                           %
11836%                                                                             %
11837%                                                                             %
11838%                                                                             %
11839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11840%
11841%  MagickStripImage() strips an image of all profiles and comments.
11842%
11843%  The format of the MagickStripImage method is:
11844%
11845%      MagickBooleanType MagickStripImage(MagickWand *wand)
11846%
11847%  A description of each parameter follows:
11848%
11849%    o wand: the magick wand.
11850%
11851*/
11852WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11853{
11854  MagickBooleanType
11855    status;
11856
11857  assert(wand != (MagickWand *) NULL);
11858  assert(wand->signature == WandSignature);
11859  if (wand->debug != MagickFalse)
11860    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11861  if (wand->images == (Image *) NULL)
11862    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11863  status=StripImage(wand->images);
11864  if (status == MagickFalse)
11865    InheritException(wand->exception,&wand->images->exception);
11866  return(status);
11867}
11868
11869/*
11870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11871%                                                                             %
11872%                                                                             %
11873%                                                                             %
11874%   M a g i c k S w i r l I m a g e                                           %
11875%                                                                             %
11876%                                                                             %
11877%                                                                             %
11878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11879%
11880%  MagickSwirlImage() swirls the pixels about the center of the image, where
11881%  degrees indicates the sweep of the arc through which each pixel is moved.
11882%  You get a more dramatic effect as the degrees move from 1 to 360.
11883%
11884%  The format of the MagickSwirlImage method is:
11885%
11886%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11887%
11888%  A description of each parameter follows:
11889%
11890%    o wand: the magick wand.
11891%
11892%    o degrees: Define the tightness of the swirling effect.
11893%
11894*/
11895WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11896  const double degrees)
11897{
11898  Image
11899    *swirl_image;
11900
11901  assert(wand != (MagickWand *) NULL);
11902  assert(wand->signature == WandSignature);
11903  if (wand->debug != MagickFalse)
11904    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11905  if (wand->images == (Image *) NULL)
11906    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11907  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11908  if (swirl_image == (Image *) NULL)
11909    return(MagickFalse);
11910  ReplaceImageInList(&wand->images,swirl_image);
11911  return(MagickTrue);
11912}
11913
11914/*
11915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11916%                                                                             %
11917%                                                                             %
11918%                                                                             %
11919%   M a g i c k T e x t u r e I m a g e                                       %
11920%                                                                             %
11921%                                                                             %
11922%                                                                             %
11923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11924%
11925%  MagickTextureImage() repeatedly tiles the texture image across and down the
11926%  image canvas.
11927%
11928%  The format of the MagickTextureImage method is:
11929%
11930%      MagickWand *MagickTextureImage(MagickWand *wand,
11931%        const MagickWand *texture_wand)
11932%
11933%  A description of each parameter follows:
11934%
11935%    o wand: the magick wand.
11936%
11937%    o texture_wand: the texture wand
11938%
11939*/
11940WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11941  const MagickWand *texture_wand)
11942{
11943  Image
11944    *texture_image;
11945
11946  MagickBooleanType
11947    status;
11948
11949  assert(wand != (MagickWand *) NULL);
11950  assert(wand->signature == WandSignature);
11951  if (wand->debug != MagickFalse)
11952    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11953  if ((wand->images == (Image *) NULL) ||
11954      (texture_wand->images == (Image *) NULL))
11955    {
11956      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11957        "ContainsNoImages","`%s'",wand->name);
11958      return((MagickWand *) NULL);
11959    }
11960  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11961  if (texture_image == (Image *) NULL)
11962    return((MagickWand *) NULL);
11963  status=TextureImage(texture_image,texture_wand->images);
11964  if (status == MagickFalse)
11965    {
11966      InheritException(wand->exception,&texture_image->exception);
11967      texture_image=DestroyImage(texture_image);
11968      return((MagickWand *) NULL);
11969    }
11970  return(CloneMagickWandFromImages(wand,texture_image));
11971}
11972
11973/*
11974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11975%                                                                             %
11976%                                                                             %
11977%                                                                             %
11978%   M a g i c k T h r e s h o l d I m a g e                                   %
11979%                                                                             %
11980%                                                                             %
11981%                                                                             %
11982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11983%
11984%  MagickThresholdImage() changes the value of individual pixels based on
11985%  the intensity of each pixel compared to threshold.  The result is a
11986%  high-contrast, two color image.
11987%
11988%  The format of the MagickThresholdImage method is:
11989%
11990%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11991%        const double threshold)
11992%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11993%        const ChannelType channel,const double threshold)
11994%
11995%  A description of each parameter follows:
11996%
11997%    o wand: the magick wand.
11998%
11999%    o channel: the image channel(s).
12000%
12001%    o threshold: Define the threshold value.
12002%
12003*/
12004WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12005  const double threshold)
12006{
12007  MagickBooleanType
12008    status;
12009
12010  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12011  return(status);
12012}
12013
12014WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12015  const ChannelType channel,const double threshold)
12016{
12017  MagickBooleanType
12018    status;
12019
12020  assert(wand != (MagickWand *) NULL);
12021  assert(wand->signature == WandSignature);
12022  if (wand->debug != MagickFalse)
12023    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12024  if (wand->images == (Image *) NULL)
12025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12026  status=BilevelImageChannel(wand->images,channel,threshold);
12027  if (status == MagickFalse)
12028    InheritException(wand->exception,&wand->images->exception);
12029  return(status);
12030}
12031
12032/*
12033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12034%                                                                             %
12035%                                                                             %
12036%                                                                             %
12037%   M a g i c k T h u m b n a i l I m a g e                                   %
12038%                                                                             %
12039%                                                                             %
12040%                                                                             %
12041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12042%
12043%  MagickThumbnailImage()  changes the size of an image to the given dimensions
12044%  and removes any associated profiles.  The goal is to produce small low cost
12045%  thumbnail images suited for display on the Web.
12046%
12047%  The format of the MagickThumbnailImage method is:
12048%
12049%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12050%        const size_t columns,const size_t rows)
12051%
12052%  A description of each parameter follows:
12053%
12054%    o wand: the magick wand.
12055%
12056%    o columns: the number of columns in the scaled image.
12057%
12058%    o rows: the number of rows in the scaled image.
12059%
12060*/
12061WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12062  const size_t columns,const size_t rows)
12063{
12064  Image
12065    *thumbnail_image;
12066
12067  assert(wand != (MagickWand *) NULL);
12068  assert(wand->signature == WandSignature);
12069  if (wand->debug != MagickFalse)
12070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12071  if (wand->images == (Image *) NULL)
12072    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12073  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12074  if (thumbnail_image == (Image *) NULL)
12075    return(MagickFalse);
12076  ReplaceImageInList(&wand->images,thumbnail_image);
12077  return(MagickTrue);
12078}
12079
12080/*
12081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12082%                                                                             %
12083%                                                                             %
12084%                                                                             %
12085%   M a g i c k T i n t I m a g e                                             %
12086%                                                                             %
12087%                                                                             %
12088%                                                                             %
12089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12090%
12091%  MagickTintImage() applies a color vector to each pixel in the image.  The
12092%  length of the vector is 0 for black and white and at its maximum for the
12093%  midtones.  The vector weighting function is
12094%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12095%
12096%  The format of the MagickTintImage method is:
12097%
12098%      MagickBooleanType MagickTintImage(MagickWand *wand,
12099%        const PixelWand *tint,const PixelWand *opacity)
12100%
12101%  A description of each parameter follows:
12102%
12103%    o wand: the magick wand.
12104%
12105%    o tint: the tint pixel wand.
12106%
12107%    o opacity: the opacity pixel wand.
12108%
12109*/
12110WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12111  const PixelWand *tint,const PixelWand *opacity)
12112{
12113  char
12114    percent_opaque[MaxTextExtent];
12115
12116  Image
12117    *tint_image;
12118
12119  PixelPacket
12120    target;
12121
12122  assert(wand != (MagickWand *) NULL);
12123  assert(wand->signature == WandSignature);
12124  if (wand->debug != MagickFalse)
12125    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12126  if (wand->images == (Image *) NULL)
12127    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12128  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
12129    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12130    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12131    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12132    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12133    PixelGetOpacityQuantum(opacity)));
12134  PixelGetQuantumPacket(tint,&target);
12135  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12136  if (tint_image == (Image *) NULL)
12137    return(MagickFalse);
12138  ReplaceImageInList(&wand->images,tint_image);
12139  return(MagickTrue);
12140}
12141
12142/*
12143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12144%                                                                             %
12145%                                                                             %
12146%                                                                             %
12147%   M a g i c k T r a n s f o r m I m a g e                                   %
12148%                                                                             %
12149%                                                                             %
12150%                                                                             %
12151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12152%
12153%  MagickTransformImage() is a convenience method that behaves like
12154%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12155%  information as a region geometry specification.  If the operation fails,
12156%  a NULL image handle is returned.
12157%
12158%  The format of the MagickTransformImage method is:
12159%
12160%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12161%        const char *geometry)
12162%
12163%  A description of each parameter follows:
12164%
12165%    o wand: the magick wand.
12166%
12167%    o crop: A crop geometry string.  This geometry defines a subregion of the
12168%      image to crop.
12169%
12170%    o geometry: An image geometry string.  This geometry defines the final
12171%      size of the image.
12172%
12173*/
12174WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12175  const char *crop,const char *geometry)
12176{
12177  Image
12178    *transform_image;
12179
12180  MagickBooleanType
12181    status;
12182
12183  assert(wand != (MagickWand *) NULL);
12184  assert(wand->signature == WandSignature);
12185  if (wand->debug != MagickFalse)
12186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12187  if (wand->images == (Image *) NULL)
12188    return((MagickWand *) NULL);
12189  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12190  if (transform_image == (Image *) NULL)
12191    return((MagickWand *) NULL);
12192  status=TransformImage(&transform_image,crop,geometry);
12193  if (status == MagickFalse)
12194    {
12195      InheritException(wand->exception,&transform_image->exception);
12196      transform_image=DestroyImage(transform_image);
12197      return((MagickWand *) NULL);
12198    }
12199  return(CloneMagickWandFromImages(wand,transform_image));
12200}
12201
12202/*
12203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12204%                                                                             %
12205%                                                                             %
12206%                                                                             %
12207%   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               %
12208%                                                                             %
12209%                                                                             %
12210%                                                                             %
12211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12212%
12213%  MagickTransformImageColorspace() transform the image colorspace.
12214%
12215%  The format of the MagickTransformImageColorspace method is:
12216%
12217%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12218%        const ColorspaceType colorspace)
12219%
12220%  A description of each parameter follows:
12221%
12222%    o wand: the magick wand.
12223%
12224%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12225%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12226%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12227%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12228%      HSLColorspace, or HWBColorspace.
12229%
12230*/
12231WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12232  const ColorspaceType colorspace)
12233{
12234  assert(wand != (MagickWand *) NULL);
12235  assert(wand->signature == WandSignature);
12236  if (wand->debug != MagickFalse)
12237    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12238  if (wand->images == (Image *) NULL)
12239    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12240  return(TransformImageColorspace(wand->images,colorspace));
12241}
12242
12243/*
12244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12245%                                                                             %
12246%                                                                             %
12247%                                                                             %
12248%   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                     %
12249%                                                                             %
12250%                                                                             %
12251%                                                                             %
12252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12253%
12254%  MagickTransparentPaintImage() changes any pixel that matches color with the
12255%  color defined by fill.
12256%
12257%  The format of the MagickTransparentPaintImage method is:
12258%
12259%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12260%        const PixelWand *target,const double alpha,const double fuzz,
12261%        const MagickBooleanType invert)
12262%
12263%  A description of each parameter follows:
12264%
12265%    o wand: the magick wand.
12266%
12267%    o target: Change this target color to specified opacity value within
12268%      the image.
12269%
12270%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12271%      transparent.
12272%
12273%    o fuzz: By default target must match a particular pixel color
12274%      exactly.  However, in many cases two colors may differ by a small amount.
12275%      The fuzz member of image defines how much tolerance is acceptable to
12276%      consider two colors as the same.  For example, set fuzz to 10 and the
12277%      color red at intensities of 100 and 102 respectively are now interpreted
12278%      as the same color for the purposes of the floodfill.
12279%
12280%    o invert: paint any pixel that does not match the target color.
12281%
12282*/
12283WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12284  const PixelWand *target,const double alpha,const double fuzz,
12285  const MagickBooleanType invert)
12286{
12287  MagickBooleanType
12288    status;
12289
12290  PixelInfo
12291    target_pixel;
12292
12293  assert(wand != (MagickWand *) NULL);
12294  assert(wand->signature == WandSignature);
12295  if (wand->debug != MagickFalse)
12296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12297  if (wand->images == (Image *) NULL)
12298    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12299  PixelGetMagickColor(target,&target_pixel);
12300  wand->images->fuzz=fuzz;
12301  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12302    QuantumRange*alpha),invert);
12303  if (status == MagickFalse)
12304    InheritException(wand->exception,&wand->images->exception);
12305  return(status);
12306}
12307
12308/*
12309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12310%                                                                             %
12311%                                                                             %
12312%                                                                             %
12313%   M a g i c k T r a n s p o s e I m a g e                                   %
12314%                                                                             %
12315%                                                                             %
12316%                                                                             %
12317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12318%
12319%  MagickTransposeImage() creates a vertical mirror image by reflecting the
12320%  pixels around the central x-axis while rotating them 90-degrees.
12321%
12322%  The format of the MagickTransposeImage method is:
12323%
12324%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12325%
12326%  A description of each parameter follows:
12327%
12328%    o wand: the magick wand.
12329%
12330*/
12331WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12332{
12333  Image
12334    *transpose_image;
12335
12336  assert(wand != (MagickWand *) NULL);
12337  assert(wand->signature == WandSignature);
12338  if (wand->debug != MagickFalse)
12339    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12340  if (wand->images == (Image *) NULL)
12341    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12342  transpose_image=TransposeImage(wand->images,wand->exception);
12343  if (transpose_image == (Image *) NULL)
12344    return(MagickFalse);
12345  ReplaceImageInList(&wand->images,transpose_image);
12346  return(MagickTrue);
12347}
12348
12349/*
12350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12351%                                                                             %
12352%                                                                             %
12353%                                                                             %
12354%   M a g i c k T r a n s v e r s e I m a g e                                 %
12355%                                                                             %
12356%                                                                             %
12357%                                                                             %
12358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12359%
12360%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12361%  pixels around the central y-axis while rotating them 270-degrees.
12362%
12363%  The format of the MagickTransverseImage method is:
12364%
12365%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12366%
12367%  A description of each parameter follows:
12368%
12369%    o wand: the magick wand.
12370%
12371*/
12372WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12373{
12374  Image
12375    *transverse_image;
12376
12377  assert(wand != (MagickWand *) NULL);
12378  assert(wand->signature == WandSignature);
12379  if (wand->debug != MagickFalse)
12380    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12381  if (wand->images == (Image *) NULL)
12382    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12383  transverse_image=TransverseImage(wand->images,wand->exception);
12384  if (transverse_image == (Image *) NULL)
12385    return(MagickFalse);
12386  ReplaceImageInList(&wand->images,transverse_image);
12387  return(MagickTrue);
12388}
12389
12390/*
12391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12392%                                                                             %
12393%                                                                             %
12394%                                                                             %
12395%   M a g i c k T r i m I m a g e                                             %
12396%                                                                             %
12397%                                                                             %
12398%                                                                             %
12399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12400%
12401%  MagickTrimImage() remove edges that are the background color from the image.
12402%
12403%  The format of the MagickTrimImage method is:
12404%
12405%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12406%
12407%  A description of each parameter follows:
12408%
12409%    o wand: the magick wand.
12410%
12411%    o fuzz: By default target must match a particular pixel color
12412%      exactly.  However, in many cases two colors may differ by a small amount.
12413%      The fuzz member of image defines how much tolerance is acceptable to
12414%      consider two colors as the same.  For example, set fuzz to 10 and the
12415%      color red at intensities of 100 and 102 respectively are now interpreted
12416%      as the same color for the purposes of the floodfill.
12417%
12418*/
12419WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12420{
12421  Image
12422    *trim_image;
12423
12424  assert(wand != (MagickWand *) NULL);
12425  assert(wand->signature == WandSignature);
12426  if (wand->debug != MagickFalse)
12427    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12428  if (wand->images == (Image *) NULL)
12429    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12430  wand->images->fuzz=fuzz;
12431  trim_image=TrimImage(wand->images,wand->exception);
12432  if (trim_image == (Image *) NULL)
12433    return(MagickFalse);
12434  ReplaceImageInList(&wand->images,trim_image);
12435  return(MagickTrue);
12436}
12437
12438/*
12439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12440%                                                                             %
12441%                                                                             %
12442%                                                                             %
12443%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12444%                                                                             %
12445%                                                                             %
12446%                                                                             %
12447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12448%
12449%  MagickUniqueImageColors() discards all but one of any pixel color.
12450%
12451%  The format of the MagickUniqueImageColors method is:
12452%
12453%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12454%
12455%  A description of each parameter follows:
12456%
12457%    o wand: the magick wand.
12458%
12459*/
12460WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12461{
12462  Image
12463    *unique_image;
12464
12465  assert(wand != (MagickWand *) NULL);
12466  assert(wand->signature == WandSignature);
12467  if (wand->debug != MagickFalse)
12468    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12469  if (wand->images == (Image *) NULL)
12470    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12471  unique_image=UniqueImageColors(wand->images,wand->exception);
12472  if (unique_image == (Image *) NULL)
12473    return(MagickFalse);
12474  ReplaceImageInList(&wand->images,unique_image);
12475  return(MagickTrue);
12476}
12477
12478/*
12479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12480%                                                                             %
12481%                                                                             %
12482%                                                                             %
12483%   M a g i c k U n s h a r p M a s k I m a g e                               %
12484%                                                                             %
12485%                                                                             %
12486%                                                                             %
12487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12488%
12489%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12490%  Gaussian operator of the given radius and standard deviation (sigma).
12491%  For reasonable results, radius should be larger than sigma.  Use a radius
12492%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12493%
12494%  The format of the MagickUnsharpMaskImage method is:
12495%
12496%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12497%        const double radius,const double sigma,const double amount,
12498%        const double threshold)
12499%      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12500%        const ChannelType channel,const double radius,const double sigma,
12501%        const double amount,const double threshold)
12502%
12503%  A description of each parameter follows:
12504%
12505%    o wand: the magick wand.
12506%
12507%    o channel: the image channel(s).
12508%
12509%    o radius: the radius of the Gaussian, in pixels, not counting the center
12510%      pixel.
12511%
12512%    o sigma: the standard deviation of the Gaussian, in pixels.
12513%
12514%    o amount: the percentage of the difference between the original and the
12515%      blur image that is added back into the original.
12516%
12517%    o threshold: the threshold in pixels needed to apply the diffence amount.
12518%
12519*/
12520
12521WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12522  const double radius,const double sigma,const double amount,
12523  const double threshold)
12524{
12525  MagickBooleanType
12526    status;
12527
12528  status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12529    amount,threshold);
12530  return(status);
12531}
12532
12533WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12534  const ChannelType channel,const double radius,const double sigma,
12535  const double amount,const double threshold)
12536{
12537  Image
12538    *unsharp_image;
12539
12540  assert(wand != (MagickWand *) NULL);
12541  assert(wand->signature == WandSignature);
12542  if (wand->debug != MagickFalse)
12543    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12544  if (wand->images == (Image *) NULL)
12545    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12546  unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12547    amount,threshold,wand->exception);
12548  if (unsharp_image == (Image *) NULL)
12549    return(MagickFalse);
12550  ReplaceImageInList(&wand->images,unsharp_image);
12551  return(MagickTrue);
12552}
12553
12554/*
12555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12556%                                                                             %
12557%                                                                             %
12558%                                                                             %
12559%   M a g i c k V i g n e t t e I m a g e                                     %
12560%                                                                             %
12561%                                                                             %
12562%                                                                             %
12563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12564%
12565%  MagickVignetteImage() softens the edges of the image in vignette style.
12566%
12567%  The format of the MagickVignetteImage method is:
12568%
12569%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12570%        const double black_point,const double white_point,const ssize_t x,
12571%        const ssize_t y)
12572%
12573%  A description of each parameter follows:
12574%
12575%    o wand: the magick wand.
12576%
12577%    o black_point: the black point.
12578%
12579%    o white_point: the white point.
12580%
12581%    o x, y:  Define the x and y ellipse offset.
12582%
12583*/
12584WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12585  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12586{
12587  Image
12588    *vignette_image;
12589
12590  assert(wand != (MagickWand *) NULL);
12591  assert(wand->signature == WandSignature);
12592  if (wand->debug != MagickFalse)
12593    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12594  if (wand->images == (Image *) NULL)
12595    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12596  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12597    wand->exception);
12598  if (vignette_image == (Image *) NULL)
12599    return(MagickFalse);
12600  ReplaceImageInList(&wand->images,vignette_image);
12601  return(MagickTrue);
12602}
12603
12604/*
12605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12606%                                                                             %
12607%                                                                             %
12608%                                                                             %
12609%   M a g i c k W a v e I m a g e                                             %
12610%                                                                             %
12611%                                                                             %
12612%                                                                             %
12613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12614%
12615%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12616%  the pixels vertically along a sine wave whose amplitude and wavelength
12617%  is specified by the given parameters.
12618%
12619%  The format of the MagickWaveImage method is:
12620%
12621%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12622%        const double wave_length)
12623%
12624%  A description of each parameter follows:
12625%
12626%    o wand: the magick wand.
12627%
12628%    o amplitude, wave_length:  Define the amplitude and wave length of the
12629%      sine wave.
12630%
12631*/
12632WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12633  const double amplitude,const double wave_length)
12634{
12635  Image
12636    *wave_image;
12637
12638  assert(wand != (MagickWand *) NULL);
12639  assert(wand->signature == WandSignature);
12640  if (wand->debug != MagickFalse)
12641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12642  if (wand->images == (Image *) NULL)
12643    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12644  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12645  if (wave_image == (Image *) NULL)
12646    return(MagickFalse);
12647  ReplaceImageInList(&wand->images,wave_image);
12648  return(MagickTrue);
12649}
12650
12651/*
12652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12653%                                                                             %
12654%                                                                             %
12655%                                                                             %
12656%   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                         %
12657%                                                                             %
12658%                                                                             %
12659%                                                                             %
12660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12661%
12662%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12663%  above the threshold into white while leaving all pixels below the threshold
12664%  unchanged.
12665%
12666%  The format of the MagickWhiteThresholdImage method is:
12667%
12668%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12669%        const PixelWand *threshold)
12670%
12671%  A description of each parameter follows:
12672%
12673%    o wand: the magick wand.
12674%
12675%    o threshold: the pixel wand.
12676%
12677*/
12678WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12679  const PixelWand *threshold)
12680{
12681  char
12682    thresholds[MaxTextExtent];
12683
12684  MagickBooleanType
12685    status;
12686
12687  assert(wand != (MagickWand *) NULL);
12688  assert(wand->signature == WandSignature);
12689  if (wand->debug != MagickFalse)
12690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12691  if (wand->images == (Image *) NULL)
12692    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12693  (void) FormatLocaleString(thresholds,MaxTextExtent,
12694    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12695    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12696    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12697  status=WhiteThresholdImage(wand->images,thresholds);
12698  if (status == MagickFalse)
12699    InheritException(wand->exception,&wand->images->exception);
12700  return(status);
12701}
12702
12703/*
12704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12705%                                                                             %
12706%                                                                             %
12707%                                                                             %
12708%   M a g i c k W r i t e I m a g e                                           %
12709%                                                                             %
12710%                                                                             %
12711%                                                                             %
12712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12713%
12714%  MagickWriteImage() writes an image to the specified filename.  If the
12715%  filename parameter is NULL, the image is written to the filename set
12716%  by MagickReadImage() or MagickSetImageFilename().
12717%
12718%  The format of the MagickWriteImage method is:
12719%
12720%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12721%        const char *filename)
12722%
12723%  A description of each parameter follows:
12724%
12725%    o wand: the magick wand.
12726%
12727%    o filename: the image filename.
12728%
12729%
12730*/
12731WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12732  const char *filename)
12733{
12734  Image
12735    *image;
12736
12737  ImageInfo
12738    *write_info;
12739
12740  MagickBooleanType
12741    status;
12742
12743  assert(wand != (MagickWand *) NULL);
12744  assert(wand->signature == WandSignature);
12745  if (wand->debug != MagickFalse)
12746    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12747  if (wand->images == (Image *) NULL)
12748    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12749  if (filename != (const char *) NULL)
12750    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12751  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12752  if (image == (Image *) NULL)
12753    return(MagickFalse);
12754  write_info=CloneImageInfo(wand->image_info);
12755  write_info->adjoin=MagickTrue;
12756  status=WriteImage(write_info,image);
12757  if (status == MagickFalse)
12758    InheritException(wand->exception,&image->exception);
12759  image=DestroyImage(image);
12760  write_info=DestroyImageInfo(write_info);
12761  return(status);
12762}
12763
12764/*
12765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12766%                                                                             %
12767%                                                                             %
12768%                                                                             %
12769%   M a g i c k W r i t e I m a g e F i l e                                   %
12770%                                                                             %
12771%                                                                             %
12772%                                                                             %
12773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12774%
12775%  MagickWriteImageFile() writes an image to an open file descriptor.
12776%
12777%  The format of the MagickWriteImageFile method is:
12778%
12779%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12780%
12781%  A description of each parameter follows:
12782%
12783%    o wand: the magick wand.
12784%
12785%    o file: the file descriptor.
12786%
12787*/
12788WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12789{
12790  Image
12791    *image;
12792
12793  ImageInfo
12794    *write_info;
12795
12796  MagickBooleanType
12797    status;
12798
12799  assert(wand != (MagickWand *) NULL);
12800  assert(wand->signature == WandSignature);
12801  assert(file != (FILE *) NULL);
12802  if (wand->debug != MagickFalse)
12803    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12804  if (wand->images == (Image *) NULL)
12805    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12806  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12807  if (image == (Image *) NULL)
12808    return(MagickFalse);
12809  write_info=CloneImageInfo(wand->image_info);
12810  SetImageInfoFile(write_info,file);
12811  write_info->adjoin=MagickTrue;
12812  status=WriteImage(write_info,image);
12813  write_info=DestroyImageInfo(write_info);
12814  if (status == MagickFalse)
12815    InheritException(wand->exception,&image->exception);
12816  image=DestroyImage(image);
12817  return(status);
12818}
12819
12820/*
12821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12822%                                                                             %
12823%                                                                             %
12824%                                                                             %
12825%   M a g i c k W r i t e I m a g e s                                         %
12826%                                                                             %
12827%                                                                             %
12828%                                                                             %
12829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12830%
12831%  MagickWriteImages() writes an image or image sequence.
12832%
12833%  The format of the MagickWriteImages method is:
12834%
12835%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12836%        const char *filename,const MagickBooleanType adjoin)
12837%
12838%  A description of each parameter follows:
12839%
12840%    o wand: the magick wand.
12841%
12842%    o filename: the image filename.
12843%
12844%    o adjoin: join images into a single multi-image file.
12845%
12846*/
12847WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12848  const char *filename,const MagickBooleanType adjoin)
12849{
12850  ImageInfo
12851    *write_info;
12852
12853  MagickBooleanType
12854    status;
12855
12856  assert(wand != (MagickWand *) NULL);
12857  assert(wand->signature == WandSignature);
12858  if (wand->debug != MagickFalse)
12859    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12860  if (wand->images == (Image *) NULL)
12861    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12862  write_info=CloneImageInfo(wand->image_info);
12863  write_info->adjoin=adjoin;
12864  status=WriteImages(write_info,wand->images,filename,wand->exception);
12865  if (status == MagickFalse)
12866    InheritException(wand->exception,&wand->images->exception);
12867  write_info=DestroyImageInfo(write_info);
12868  return(status);
12869}
12870
12871/*
12872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12873%                                                                             %
12874%                                                                             %
12875%                                                                             %
12876%   M a g i c k W r i t e I m a g e s F i l e                                 %
12877%                                                                             %
12878%                                                                             %
12879%                                                                             %
12880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12881%
12882%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12883%
12884%  The format of the MagickWriteImagesFile method is:
12885%
12886%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12887%
12888%  A description of each parameter follows:
12889%
12890%    o wand: the magick wand.
12891%
12892%    o file: the file descriptor.
12893%
12894*/
12895WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12896{
12897  ImageInfo
12898    *write_info;
12899
12900  MagickBooleanType
12901    status;
12902
12903  assert(wand != (MagickWand *) NULL);
12904  assert(wand->signature == WandSignature);
12905  if (wand->debug != MagickFalse)
12906    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12907  if (wand->images == (Image *) NULL)
12908    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12909  write_info=CloneImageInfo(wand->image_info);
12910  SetImageInfoFile(write_info,file);
12911  write_info->adjoin=MagickTrue;
12912  status=WriteImages(write_info,wand->images,(const char *) NULL,
12913    wand->exception);
12914  write_info=DestroyImageInfo(write_info);
12915  if (status == MagickFalse)
12916    InheritException(wand->exception,&wand->images->exception);
12917  return(status);
12918}
12919