magick-image.c revision fefab1b20f043d650c398fa7377274cf43d5e55d
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 i s t o r t i o n             %
4165%                                                                             %
4166%                                                                             %
4167%                                                                             %
4168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4169%
4170%  MagickGetImageChannelDistortion() compares one or more image channels of an
4171%  image to a reconstructed image and returns the specified distortion metric.
4172%
4173%  The format of the MagickGetImageChannelDistortion method is:
4174%
4175%      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4176%        const MagickWand *reference,const ChannelType channel,
4177%        const MetricType metric,double *distortion)
4178%
4179%  A description of each parameter follows:
4180%
4181%    o wand: the magick wand.
4182%
4183%    o reference: the reference wand.
4184%
4185%    o channel: the channel.
4186%
4187%    o metric: the metric.
4188%
4189%    o distortion: the computed distortion between the images.
4190%
4191*/
4192WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4193  const MagickWand *reference,const ChannelType channel,const MetricType metric,
4194  double *distortion)
4195{
4196  MagickBooleanType
4197    status;
4198
4199  assert(wand != (MagickWand *) NULL);
4200  assert(wand->signature == WandSignature);
4201  if (wand->debug != MagickFalse)
4202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4203  assert(reference != (MagickWand *) NULL);
4204  assert(reference->signature == WandSignature);
4205  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4206    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4207  status=GetImageChannelDistortion(wand->images,reference->images,channel,
4208    metric,distortion,&wand->images->exception);
4209  return(status);
4210}
4211
4212/*
4213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4214%                                                                             %
4215%                                                                             %
4216%                                                                             %
4217%   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           %
4218%                                                                             %
4219%                                                                             %
4220%                                                                             %
4221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4222%
4223%  MagickGetImageChannelDistortions() compares one or more image channels of an
4224%  image to a reconstructed image and returns the specified distortion metrics.
4225%
4226%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4227%
4228%  The format of the MagickGetImageChannelDistortion method is:
4229%
4230%      double *MagickGetImageChannelDistortion(MagickWand *wand,
4231%        const MagickWand *reference,const MetricType metric)
4232%
4233%  A description of each parameter follows:
4234%
4235%    o wand: the magick wand.
4236%
4237%    o reference: the reference wand.
4238%
4239%    o metric: the metric.
4240%
4241*/
4242WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4243  const MagickWand *reference,const MetricType metric)
4244{
4245  double
4246    *channel_distortion;
4247
4248  assert(wand != (MagickWand *) NULL);
4249  assert(wand->signature == WandSignature);
4250  if (wand->debug != MagickFalse)
4251    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4252  assert(reference != (MagickWand *) NULL);
4253  assert(reference->signature == WandSignature);
4254  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4255    {
4256      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4257        "ContainsNoImages","`%s'",wand->name);
4258      return((double *) NULL);
4259    }
4260  channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4261    metric,&wand->images->exception);
4262  return(channel_distortion);
4263}
4264
4265/*
4266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4267%                                                                             %
4268%                                                                             %
4269%                                                                             %
4270%   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                 %
4271%                                                                             %
4272%                                                                             %
4273%                                                                             %
4274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4275%
4276%  MagickGetImageChannelFeatures() returns features for each channel in the
4277%  image in each of four directions (horizontal, vertical, left and right
4278%  diagonals) for the specified distance.  The features include the angular
4279%  second moment, contrast, correlation, sum of squares: variance, inverse
4280%  difference moment, sum average, sum varience, sum entropy, entropy,
4281%  difference variance, difference entropy, information measures of
4282%  correlation 1, information measures of correlation 2, and maximum
4283%  correlation coefficient.  You can access the red channel contrast, for
4284%  example, like this:
4285%
4286%      channel_features=MagickGetImageChannelFeatures(wand,1);
4287%      contrast=channel_features[RedChannel].contrast[0];
4288%
4289%  Use MagickRelinquishMemory() to free the statistics buffer.
4290%
4291%  The format of the MagickGetImageChannelFeatures method is:
4292%
4293%      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4294%        const size_t distance)
4295%
4296%  A description of each parameter follows:
4297%
4298%    o wand: the magick wand.
4299%
4300%    o distance: the distance.
4301%
4302*/
4303WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4304  const size_t distance)
4305{
4306  assert(wand != (MagickWand *) NULL);
4307  assert(wand->signature == WandSignature);
4308  if (wand->debug != MagickFalse)
4309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4310  if (wand->images == (Image *) NULL)
4311    {
4312      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4313        "ContainsNoImages","`%s'",wand->name);
4314      return((ChannelFeatures *) NULL);
4315    }
4316  return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4317}
4318
4319/*
4320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4321%                                                                             %
4322%                                                                             %
4323%                                                                             %
4324%   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                 %
4325%                                                                             %
4326%                                                                             %
4327%                                                                             %
4328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4329%
4330%  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4331%  more image channels.
4332%
4333%  The format of the MagickGetImageChannelKurtosis method is:
4334%
4335%      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4336%        const ChannelType channel,double *kurtosis,double *skewness)
4337%
4338%  A description of each parameter follows:
4339%
4340%    o wand: the magick wand.
4341%
4342%    o channel: the image channel(s).
4343%
4344%    o kurtosis:  The kurtosis for the specified channel(s).
4345%
4346%    o skewness:  The skewness for the specified channel(s).
4347%
4348*/
4349WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4350  const ChannelType channel,double *kurtosis,double *skewness)
4351{
4352  MagickBooleanType
4353    status;
4354
4355  assert(wand != (MagickWand *) NULL);
4356  assert(wand->signature == WandSignature);
4357  if (wand->debug != MagickFalse)
4358    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4359  if (wand->images == (Image *) NULL)
4360    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4361  status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4362    wand->exception);
4363  return(status);
4364}
4365
4366/*
4367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4368%                                                                             %
4369%                                                                             %
4370%                                                                             %
4371%   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                         %
4372%                                                                             %
4373%                                                                             %
4374%                                                                             %
4375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4376%
4377%  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4378%  more image channels.
4379%
4380%  The format of the MagickGetImageChannelMean method is:
4381%
4382%      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4383%        const ChannelType channel,double *mean,double *standard_deviation)
4384%
4385%  A description of each parameter follows:
4386%
4387%    o wand: the magick wand.
4388%
4389%    o channel: the image channel(s).
4390%
4391%    o mean:  The mean pixel value for the specified channel(s).
4392%
4393%    o standard_deviation:  The standard deviation for the specified channel(s).
4394%
4395*/
4396WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4397  const ChannelType channel,double *mean,double *standard_deviation)
4398{
4399  MagickBooleanType
4400    status;
4401
4402  assert(wand != (MagickWand *) NULL);
4403  assert(wand->signature == WandSignature);
4404  if (wand->debug != MagickFalse)
4405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4406  if (wand->images == (Image *) NULL)
4407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4408  status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4409    wand->exception);
4410  return(status);
4411}
4412
4413/*
4414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4415%                                                                             %
4416%                                                                             %
4417%                                                                             %
4418%   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                       %
4419%                                                                             %
4420%                                                                             %
4421%                                                                             %
4422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4423%
4424%  MagickGetImageChannelRange() gets the range for one or more image channels.
4425%
4426%  The format of the MagickGetImageChannelRange method is:
4427%
4428%      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4429%        const ChannelType channel,double *minima,double *maxima)
4430%
4431%  A description of each parameter follows:
4432%
4433%    o wand: the magick wand.
4434%
4435%    o channel: the image channel(s).
4436%
4437%    o minima:  The minimum pixel value for the specified channel(s).
4438%
4439%    o maxima:  The maximum pixel value for the specified channel(s).
4440%
4441*/
4442WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4443  const ChannelType channel,double *minima,double *maxima)
4444{
4445  MagickBooleanType
4446    status;
4447
4448  assert(wand != (MagickWand *) NULL);
4449  assert(wand->signature == WandSignature);
4450  if (wand->debug != MagickFalse)
4451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4452  if (wand->images == (Image *) NULL)
4453    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4454  status=GetImageChannelRange(wand->images,channel,minima,maxima,
4455    wand->exception);
4456  return(status);
4457}
4458
4459/*
4460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4461%                                                                             %
4462%                                                                             %
4463%                                                                             %
4464%   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             %
4465%                                                                             %
4466%                                                                             %
4467%                                                                             %
4468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4469%
4470%  MagickGetImageChannelStatistics() returns statistics for each channel in the
4471%  image.  The statistics include the channel depth, its minima and
4472%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4473%  You can access the red channel mean, for example, like this:
4474%
4475%      channel_statistics=MagickGetImageChannelStatistics(wand);
4476%      red_mean=channel_statistics[RedChannel].mean;
4477%
4478%  Use MagickRelinquishMemory() to free the statistics buffer.
4479%
4480%  The format of the MagickGetImageChannelStatistics method is:
4481%
4482%      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4483%
4484%  A description of each parameter follows:
4485%
4486%    o wand: the magick wand.
4487%
4488*/
4489WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4490{
4491  assert(wand != (MagickWand *) NULL);
4492  assert(wand->signature == WandSignature);
4493  if (wand->debug != MagickFalse)
4494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4495  if (wand->images == (Image *) NULL)
4496    {
4497      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4498        "ContainsNoImages","`%s'",wand->name);
4499      return((ChannelStatistics *) NULL);
4500    }
4501  return(GetImageChannelStatistics(wand->images,wand->exception));
4502}
4503
4504/*
4505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4506%                                                                             %
4507%                                                                             %
4508%                                                                             %
4509%   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                     %
4510%                                                                             %
4511%                                                                             %
4512%                                                                             %
4513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4514%
4515%  MagickGetImageColormapColor() returns the color of the specified colormap
4516%  index.
4517%
4518%  The format of the MagickGetImageColormapColor method is:
4519%
4520%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4521%        const size_t index,PixelWand *color)
4522%
4523%  A description of each parameter follows:
4524%
4525%    o wand: the magick wand.
4526%
4527%    o index: the offset into the image colormap.
4528%
4529%    o color: Return the colormap color in this wand.
4530%
4531*/
4532WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4533  const size_t index,PixelWand *color)
4534{
4535  assert(wand != (MagickWand *) NULL);
4536  assert(wand->signature == WandSignature);
4537  if (wand->debug != MagickFalse)
4538    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4539  if (wand->images == (Image *) NULL)
4540    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4541  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4542      (index >= wand->images->colors))
4543    {
4544      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4545        "InvalidColormapIndex","`%s'",wand->name);
4546      return(MagickFalse);
4547    }
4548  PixelSetQuantumPacket(color,wand->images->colormap+index);
4549  return(MagickTrue);
4550}
4551
4552/*
4553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4554%                                                                             %
4555%                                                                             %
4556%                                                                             %
4557%   M a g i c k G e t I m a g e C o l o r s                                   %
4558%                                                                             %
4559%                                                                             %
4560%                                                                             %
4561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4562%
4563%  MagickGetImageColors() gets the number of unique colors in the image.
4564%
4565%  The format of the MagickGetImageColors method is:
4566%
4567%      size_t MagickGetImageColors(MagickWand *wand)
4568%
4569%  A description of each parameter follows:
4570%
4571%    o wand: the magick wand.
4572%
4573*/
4574WandExport size_t MagickGetImageColors(MagickWand *wand)
4575{
4576  assert(wand != (MagickWand *) NULL);
4577  assert(wand->signature == WandSignature);
4578  if (wand->debug != MagickFalse)
4579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4580  if (wand->images == (Image *) NULL)
4581    {
4582      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4583        "ContainsNoImages","`%s'",wand->name);
4584      return(0);
4585    }
4586  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
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 p a c e                           %
4595%                                                                             %
4596%                                                                             %
4597%                                                                             %
4598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4599%
4600%  MagickGetImageColorspace() gets the image colorspace.
4601%
4602%  The format of the MagickGetImageColorspace method is:
4603%
4604%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4605%
4606%  A description of each parameter follows:
4607%
4608%    o wand: the magick wand.
4609%
4610*/
4611WandExport ColorspaceType MagickGetImageColorspace(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(UndefinedColorspace);
4622    }
4623  return(wand->images->colorspace);
4624}
4625
4626/*
4627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4628%                                                                             %
4629%                                                                             %
4630%                                                                             %
4631%   M a g i c k G e t I m a g e C o m p o s e                                 %
4632%                                                                             %
4633%                                                                             %
4634%                                                                             %
4635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4636%
4637%  MagickGetImageCompose() returns the composite operator associated with the
4638%  image.
4639%
4640%  The format of the MagickGetImageCompose method is:
4641%
4642%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4643%
4644%  A description of each parameter follows:
4645%
4646%    o wand: the magick wand.
4647%
4648*/
4649WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4650{
4651  assert(wand != (MagickWand *) NULL);
4652  assert(wand->signature == WandSignature);
4653  if (wand->debug != MagickFalse)
4654    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4655  if (wand->images == (Image *) NULL)
4656    {
4657      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4658        "ContainsNoImages","`%s'",wand->name);
4659      return(UndefinedCompositeOp);
4660    }
4661  return(wand->images->compose);
4662}
4663
4664/*
4665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4666%                                                                             %
4667%                                                                             %
4668%                                                                             %
4669%   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                         %
4670%                                                                             %
4671%                                                                             %
4672%                                                                             %
4673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4674%
4675%  MagickGetImageCompression() gets the image compression.
4676%
4677%  The format of the MagickGetImageCompression method is:
4678%
4679%      CompressionType MagickGetImageCompression(MagickWand *wand)
4680%
4681%  A description of each parameter follows:
4682%
4683%    o wand: the magick wand.
4684%
4685*/
4686WandExport CompressionType MagickGetImageCompression(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(UndefinedCompression);
4697    }
4698  return(wand->images->compression);
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 Q u a l i t y           %
4707%                                                                             %
4708%                                                                             %
4709%                                                                             %
4710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4711%
4712%  MagickGetImageCompression() gets the image compression quality.
4713%
4714%  The format of the MagickGetImageCompression method is:
4715%
4716%      size_t MagickGetImageCompression(MagickWand *wand)
4717%
4718%  A description of each parameter follows:
4719%
4720%    o wand: the magick wand.
4721%
4722*/
4723WandExport size_t MagickGetImageCompressionQuality(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(0UL);
4734    }
4735  return(wand->images->quality);
4736}
4737
4738/*
4739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4740%                                                                             %
4741%                                                                             %
4742%                                                                             %
4743%   M a g i c k G e t I m a g e D e l a y                                     %
4744%                                                                             %
4745%                                                                             %
4746%                                                                             %
4747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4748%
4749%  MagickGetImageDelay() gets the image delay.
4750%
4751%  The format of the MagickGetImageDelay method is:
4752%
4753%      size_t MagickGetImageDelay(MagickWand *wand)
4754%
4755%  A description of each parameter follows:
4756%
4757%    o wand: the magick wand.
4758%
4759*/
4760WandExport size_t MagickGetImageDelay(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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4768  return(wand->images->delay);
4769}
4770
4771/*
4772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4773%                                                                             %
4774%                                                                             %
4775%                                                                             %
4776%   M a g i c k G e t I m a g e D e p t h                                     %
4777%                                                                             %
4778%                                                                             %
4779%                                                                             %
4780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4781%
4782%  MagickGetImageDepth() gets the image depth.
4783%
4784%  The format of the MagickGetImageDepth method is:
4785%
4786%      size_t MagickGetImageDepth(MagickWand *wand)
4787%
4788%  A description of each parameter follows:
4789%
4790%    o wand: the magick wand.
4791%
4792*/
4793WandExport size_t MagickGetImageDepth(MagickWand *wand)
4794{
4795  assert(wand != (MagickWand *) NULL);
4796  assert(wand->signature == WandSignature);
4797  if (wand->debug != MagickFalse)
4798    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4799  if (wand->images == (Image *) NULL)
4800    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4801  return(GetImageDepth(wand->images,wand->exception));
4802}
4803
4804/*
4805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4806%                                                                             %
4807%                                                                             %
4808%                                                                             %
4809%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4810%                                                                             %
4811%                                                                             %
4812%                                                                             %
4813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4814%
4815%  MagickGetImageDistortion() compares an image to a reconstructed image and
4816%  returns the specified distortion metric.
4817%
4818%  The format of the MagickGetImageDistortion method is:
4819%
4820%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4821%        const MagickWand *reference,const MetricType metric,
4822%        double *distortion)
4823%
4824%  A description of each parameter follows:
4825%
4826%    o wand: the magick wand.
4827%
4828%    o reference: the reference wand.
4829%
4830%    o metric: the metric.
4831%
4832%    o distortion: the computed distortion between the images.
4833%
4834*/
4835WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4836  const MagickWand *reference,const MetricType metric,double *distortion)
4837{
4838  MagickBooleanType
4839    status;
4840
4841
4842  assert(wand != (MagickWand *) NULL);
4843  assert(wand->signature == WandSignature);
4844  if (wand->debug != MagickFalse)
4845    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4846  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4847    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4848  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4849    &wand->images->exception);
4850  return(status);
4851}
4852
4853/*
4854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4855%                                                                             %
4856%                                                                             %
4857%                                                                             %
4858%   M a g i c k G e t I m a g e D i s p o s e                                 %
4859%                                                                             %
4860%                                                                             %
4861%                                                                             %
4862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4863%
4864%  MagickGetImageDispose() gets the image disposal method.
4865%
4866%  The format of the MagickGetImageDispose method is:
4867%
4868%      DisposeType MagickGetImageDispose(MagickWand *wand)
4869%
4870%  A description of each parameter follows:
4871%
4872%    o wand: the magick wand.
4873%
4874*/
4875WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4876{
4877  assert(wand != (MagickWand *) NULL);
4878  assert(wand->signature == WandSignature);
4879  if (wand->debug != MagickFalse)
4880    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4881  if (wand->images == (Image *) NULL)
4882    {
4883      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4884        "ContainsNoImages","`%s'",wand->name);
4885      return(UndefinedDispose);
4886    }
4887  return((DisposeType) wand->images->dispose);
4888}
4889
4890/*
4891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892%                                                                             %
4893%                                                                             %
4894%                                                                             %
4895%   M a g i c k G e t I m a g e F i l e n a m e                               %
4896%                                                                             %
4897%                                                                             %
4898%                                                                             %
4899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4900%
4901%  MagickGetImageFilename() returns the filename of a particular image in a
4902%  sequence.
4903%
4904%  The format of the MagickGetImageFilename method is:
4905%
4906%      char *MagickGetImageFilename(MagickWand *wand)
4907%
4908%  A description of each parameter follows:
4909%
4910%    o wand: the magick wand.
4911%
4912*/
4913WandExport char *MagickGetImageFilename(MagickWand *wand)
4914{
4915  assert(wand != (MagickWand *) NULL);
4916  assert(wand->signature == WandSignature);
4917  if (wand->debug != MagickFalse)
4918    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4919  if (wand->images == (Image *) NULL)
4920    {
4921      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4922        "ContainsNoImages","`%s'",wand->name);
4923      return((char *) NULL);
4924    }
4925  return(AcquireString(wand->images->filename));
4926}
4927
4928/*
4929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930%                                                                             %
4931%                                                                             %
4932%                                                                             %
4933%   M a g i c k G e t I m a g e F o r m a t                                   %
4934%                                                                             %
4935%                                                                             %
4936%                                                                             %
4937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938%
4939%  MagickGetImageFormat() returns the format of a particular image in a
4940%  sequence.
4941%
4942%  The format of the MagickGetImageFormat method is:
4943%
4944%      const char *MagickGetImageFormat(MagickWand *wand)
4945%
4946%  A description of each parameter follows:
4947%
4948%    o wand: the magick wand.
4949%
4950*/
4951WandExport char *MagickGetImageFormat(MagickWand *wand)
4952{
4953  assert(wand != (MagickWand *) NULL);
4954  assert(wand->signature == WandSignature);
4955  if (wand->debug != MagickFalse)
4956    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4957  if (wand->images == (Image *) NULL)
4958    {
4959      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4960        "ContainsNoImages","`%s'",wand->name);
4961      return((char *) NULL);
4962    }
4963  return(AcquireString(wand->images->magick));
4964}
4965
4966/*
4967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4968%                                                                             %
4969%                                                                             %
4970%                                                                             %
4971%   M a g i c k G e t I m a g e F u z z                                       %
4972%                                                                             %
4973%                                                                             %
4974%                                                                             %
4975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4976%
4977%  MagickGetImageFuzz() gets the image fuzz.
4978%
4979%  The format of the MagickGetImageFuzz method is:
4980%
4981%      double MagickGetImageFuzz(MagickWand *wand)
4982%
4983%  A description of each parameter follows:
4984%
4985%    o wand: the magick wand.
4986%
4987*/
4988WandExport double MagickGetImageFuzz(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(0.0);
4999    }
5000  return(wand->images->fuzz);
5001}
5002
5003/*
5004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005%                                                                             %
5006%                                                                             %
5007%                                                                             %
5008%   M a g i c k G e t I m a g e G a m m a                                     %
5009%                                                                             %
5010%                                                                             %
5011%                                                                             %
5012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013%
5014%  MagickGetImageGamma() gets the image gamma.
5015%
5016%  The format of the MagickGetImageGamma method is:
5017%
5018%      double MagickGetImageGamma(MagickWand *wand)
5019%
5020%  A description of each parameter follows:
5021%
5022%    o wand: the magick wand.
5023%
5024*/
5025WandExport double MagickGetImageGamma(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->gamma);
5038}
5039
5040/*
5041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5042%                                                                             %
5043%                                                                             %
5044%                                                                             %
5045%   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                 %
5046%                                                                             %
5047%                                                                             %
5048%                                                                             %
5049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5050%
5051%  MagickGetImageGravity() gets the image gravity.
5052%
5053%  The format of the MagickGetImageGravity method is:
5054%
5055%      GravityType MagickGetImageGravity(MagickWand *wand)
5056%
5057%  A description of each parameter follows:
5058%
5059%    o wand: the magick wand.
5060%
5061*/
5062WandExport GravityType MagickGetImageGravity(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(UndefinedGravity);
5073    }
5074  return(wand->images->gravity);
5075}
5076
5077/*
5078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5079%                                                                             %
5080%                                                                             %
5081%                                                                             %
5082%   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                       %
5083%                                                                             %
5084%                                                                             %
5085%                                                                             %
5086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5087%
5088%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5089%
5090%  The format of the MagickGetImageGreenPrimary method is:
5091%
5092%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5093%        double *y)
5094%
5095%  A description of each parameter follows:
5096%
5097%    o wand: the magick wand.
5098%
5099%    o x: the chromaticity green primary x-point.
5100%
5101%    o y: the chromaticity green primary y-point.
5102%
5103*/
5104WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5105  double *x,double *y)
5106{
5107  assert(wand != (MagickWand *) NULL);
5108  assert(wand->signature == WandSignature);
5109  if (wand->debug != MagickFalse)
5110    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5111  if (wand->images == (Image *) NULL)
5112    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5113  *x=wand->images->chromaticity.green_primary.x;
5114  *y=wand->images->chromaticity.green_primary.y;
5115  return(MagickTrue);
5116}
5117
5118/*
5119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5120%                                                                             %
5121%                                                                             %
5122%                                                                             %
5123%   M a g i c k G e t I m a g e H e i g h t                                   %
5124%                                                                             %
5125%                                                                             %
5126%                                                                             %
5127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5128%
5129%  MagickGetImageHeight() returns the image height.
5130%
5131%  The format of the MagickGetImageHeight method is:
5132%
5133%      size_t MagickGetImageHeight(MagickWand *wand)
5134%
5135%  A description of each parameter follows:
5136%
5137%    o wand: the magick wand.
5138%
5139*/
5140WandExport size_t MagickGetImageHeight(MagickWand *wand)
5141{
5142  assert(wand != (MagickWand *) NULL);
5143  assert(wand->signature == WandSignature);
5144  if (wand->debug != MagickFalse)
5145    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5146  if (wand->images == (Image *) NULL)
5147    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5148  return(wand->images->rows);
5149}
5150
5151/*
5152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5153%                                                                             %
5154%                                                                             %
5155%                                                                             %
5156%   M a g i c k G e t I m a g e H i s t o g r a m                             %
5157%                                                                             %
5158%                                                                             %
5159%                                                                             %
5160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5161%
5162%  MagickGetImageHistogram() returns the image histogram as an array of
5163%  PixelWand wands.
5164%
5165%  The format of the MagickGetImageHistogram method is:
5166%
5167%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5168%        size_t *number_colors)
5169%
5170%  A description of each parameter follows:
5171%
5172%    o wand: the magick wand.
5173%
5174%    o number_colors: the number of unique colors in the image and the number
5175%      of pixel wands returned.
5176%
5177*/
5178WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5179  size_t *number_colors)
5180{
5181  PixelPacket
5182    *histogram;
5183
5184  PixelWand
5185    **pixel_wands;
5186
5187  register ssize_t
5188    i;
5189
5190  assert(wand != (MagickWand *) NULL);
5191  assert(wand->signature == WandSignature);
5192  if (wand->debug != MagickFalse)
5193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5194  if (wand->images == (Image *) NULL)
5195    {
5196      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5197        "ContainsNoImages","`%s'",wand->name);
5198      return((PixelWand **) NULL);
5199    }
5200  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5201  if (histogram == (PixelPacket *) NULL)
5202    return((PixelWand **) NULL);
5203  pixel_wands=NewPixelWands(*number_colors);
5204  for (i=0; i < (ssize_t) *number_colors; i++)
5205  {
5206    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
5207    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5208  }
5209  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
5210  return(pixel_wands);
5211}
5212
5213/*
5214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5215%                                                                             %
5216%                                                                             %
5217%                                                                             %
5218%   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                 %
5219%                                                                             %
5220%                                                                             %
5221%                                                                             %
5222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5223%
5224%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5225%
5226%  The format of the MagickGetImageInterlaceScheme method is:
5227%
5228%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5229%
5230%  A description of each parameter follows:
5231%
5232%    o wand: the magick wand.
5233%
5234*/
5235WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5236{
5237  assert(wand != (MagickWand *) NULL);
5238  assert(wand->signature == WandSignature);
5239  if (wand->debug != MagickFalse)
5240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5241  if (wand->images == (Image *) NULL)
5242    {
5243      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5244        "ContainsNoImages","`%s'",wand->name);
5245      return(UndefinedInterlace);
5246    }
5247  return(wand->images->interlace);
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 p o l a t e M e t h o d             %
5256%                                                                             %
5257%                                                                             %
5258%                                                                             %
5259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5260%
5261%  MagickGetImageInterpolateMethod() returns the interpolation method for the
5262%  sepcified image.
5263%
5264%  The format of the MagickGetImageInterpolateMethod method is:
5265%
5266%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5267%
5268%  A description of each parameter follows:
5269%
5270%    o wand: the magick wand.
5271%
5272*/
5273WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5274  MagickWand *wand)
5275{
5276  assert(wand != (MagickWand *) NULL);
5277  assert(wand->signature == WandSignature);
5278  if (wand->debug != MagickFalse)
5279    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5280  if (wand->images == (Image *) NULL)
5281    {
5282      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5283        "ContainsNoImages","`%s'",wand->name);
5284      return(UndefinedInterpolatePixel);
5285    }
5286  return(wand->images->interpolate);
5287}
5288
5289/*
5290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5291%                                                                             %
5292%                                                                             %
5293%                                                                             %
5294%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5295%                                                                             %
5296%                                                                             %
5297%                                                                             %
5298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5299%
5300%  MagickGetImageIterations() gets the image iterations.
5301%
5302%  The format of the MagickGetImageIterations method is:
5303%
5304%      size_t MagickGetImageIterations(MagickWand *wand)
5305%
5306%  A description of each parameter follows:
5307%
5308%    o wand: the magick wand.
5309%
5310*/
5311WandExport size_t MagickGetImageIterations(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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5319  return(wand->images->iterations);
5320}
5321
5322/*
5323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5324%                                                                             %
5325%                                                                             %
5326%                                                                             %
5327%   M a g i c k G e t I m a g e L e n g t h                                   %
5328%                                                                             %
5329%                                                                             %
5330%                                                                             %
5331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5332%
5333%  MagickGetImageLength() returns the image length in bytes.
5334%
5335%  The format of the MagickGetImageLength method is:
5336%
5337%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5338%        MagickSizeType *length)
5339%
5340%  A description of each parameter follows:
5341%
5342%    o wand: the magick wand.
5343%
5344%    o length: the image length in bytes.
5345%
5346*/
5347WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5348  MagickSizeType *length)
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  *length=GetBlobSize(wand->images);
5357  return(MagickTrue);
5358}
5359
5360/*
5361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362%                                                                             %
5363%                                                                             %
5364%                                                                             %
5365%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5366%                                                                             %
5367%                                                                             %
5368%                                                                             %
5369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370%
5371%  MagickGetImageMatteColor() returns the image matte color.
5372%
5373%  The format of the MagickGetImageMatteColor method is:
5374%
5375%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5376%        PixelWand *matte_color)
5377%
5378%  A description of each parameter follows:
5379%
5380%    o wand: the magick wand.
5381%
5382%    o matte_color: Return the matte color.
5383%
5384*/
5385WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5386  PixelWand *matte_color)
5387{
5388  assert(wand != (MagickWand *) NULL);
5389  assert(wand->signature == WandSignature);
5390  if (wand->debug != MagickFalse)
5391    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5392  if (wand->images == (Image *) NULL)
5393    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5394  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
5395  return(MagickTrue);
5396}
5397
5398/*
5399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5400%                                                                             %
5401%                                                                             %
5402%                                                                             %
5403%   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                         %
5404%                                                                             %
5405%                                                                             %
5406%                                                                             %
5407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5408%
5409%  MagickGetImageOrientation() returns the image orientation.
5410%
5411%  The format of the MagickGetImageOrientation method is:
5412%
5413%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5414%
5415%  A description of each parameter follows:
5416%
5417%    o wand: the magick wand.
5418%
5419*/
5420WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5421{
5422  assert(wand != (MagickWand *) NULL);
5423  assert(wand->signature == WandSignature);
5424  if (wand->debug != MagickFalse)
5425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426  if (wand->images == (Image *) NULL)
5427    {
5428      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5429        "ContainsNoImages","`%s'",wand->name);
5430      return(UndefinedOrientation);
5431    }
5432  return(wand->images->orientation);
5433}
5434
5435/*
5436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437%                                                                             %
5438%                                                                             %
5439%                                                                             %
5440%   M a g i c k G e t I m a g e P a g e                                       %
5441%                                                                             %
5442%                                                                             %
5443%                                                                             %
5444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5445%
5446%  MagickGetImagePage() returns the page geometry associated with the image.
5447%
5448%  The format of the MagickGetImagePage method is:
5449%
5450%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5451%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5452%
5453%  A description of each parameter follows:
5454%
5455%    o wand: the magick wand.
5456%
5457%    o width: the page width.
5458%
5459%    o height: the page height.
5460%
5461%    o x: the page x-offset.
5462%
5463%    o y: the page y-offset.
5464%
5465*/
5466WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5467  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5468{
5469  assert(wand != (const MagickWand *) NULL);
5470  assert(wand->signature == WandSignature);
5471  if (wand->debug != MagickFalse)
5472    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5473  if (wand->images == (Image *) NULL)
5474    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5475  *width=wand->images->page.width;
5476  *height=wand->images->page.height;
5477  *x=wand->images->page.x;
5478  *y=wand->images->page.y;
5479  return(MagickTrue);
5480}
5481
5482/*
5483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5484%                                                                             %
5485%                                                                             %
5486%                                                                             %
5487%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5488%                                                                             %
5489%                                                                             %
5490%                                                                             %
5491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5492%
5493%  MagickGetImagePixelColor() returns the color of the specified pixel.
5494%
5495%  The format of the MagickGetImagePixelColor method is:
5496%
5497%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5498%        const ssize_t x,const ssize_t y,PixelWand *color)
5499%
5500%  A description of each parameter follows:
5501%
5502%    o wand: the magick wand.
5503%
5504%    o x,y: the pixel offset into the image.
5505%
5506%    o color: Return the colormap color in this wand.
5507%
5508*/
5509WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5510  const ssize_t x,const ssize_t y,PixelWand *color)
5511{
5512  register const Quantum
5513    *p;
5514
5515  CacheView
5516    *image_view;
5517
5518  assert(wand != (MagickWand *) NULL);
5519  assert(wand->signature == WandSignature);
5520  if (wand->debug != MagickFalse)
5521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5522  if (wand->images == (Image *) NULL)
5523    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5524  image_view=AcquireCacheView(wand->images);
5525  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5526  if (p == (const Quantum *) NULL)
5527    {
5528      image_view=DestroyCacheView(image_view);
5529      return(MagickFalse);
5530    }
5531  PixelSetQuantumPixel(wand->images,p,color);
5532  image_view=DestroyCacheView(image_view);
5533  return(MagickTrue);
5534}
5535
5536/*
5537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5538%                                                                             %
5539%                                                                             %
5540%                                                                             %
5541+   M a g i c k G e t I m a g e R a n g e                                     %
5542%                                                                             %
5543%                                                                             %
5544%                                                                             %
5545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5546%
5547%  MagickGetImageRange() gets the pixel range for the image.
5548%
5549%  The format of the MagickGetImageRange method is:
5550%
5551%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5552%        double *maxima)
5553%
5554%  A description of each parameter follows:
5555%
5556%    o wand: the magick wand.
5557%
5558%    o minima:  The minimum pixel value for the specified channel(s).
5559%
5560%    o maxima:  The maximum pixel value for the specified channel(s).
5561%
5562*/
5563WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5564  double *minima,double *maxima)
5565{
5566  MagickBooleanType
5567    status;
5568
5569  assert(wand != (MagickWand *) NULL);
5570  assert(wand->signature == WandSignature);
5571  if (wand->debug != MagickFalse)
5572    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5573  if (wand->images == (Image *) NULL)
5574    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5575  status=GetImageRange(wand->images,minima,maxima,wand->exception);
5576  return(status);
5577}
5578
5579/*
5580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5581%                                                                             %
5582%                                                                             %
5583%                                                                             %
5584%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5585%                                                                             %
5586%                                                                             %
5587%                                                                             %
5588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5589%
5590%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5591%
5592%  The format of the MagickGetImageRedPrimary method is:
5593%
5594%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5595%        double *y)
5596%
5597%  A description of each parameter follows:
5598%
5599%    o wand: the magick wand.
5600%
5601%    o x: the chromaticity red primary x-point.
5602%
5603%    o y: the chromaticity red primary y-point.
5604%
5605*/
5606WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5607  double *x,double *y)
5608{
5609  assert(wand != (MagickWand *) NULL);
5610  assert(wand->signature == WandSignature);
5611  if (wand->debug != MagickFalse)
5612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5613  if (wand->images == (Image *) NULL)
5614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5615  *x=wand->images->chromaticity.red_primary.x;
5616  *y=wand->images->chromaticity.red_primary.y;
5617  return(MagickTrue);
5618}
5619
5620/*
5621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5622%                                                                             %
5623%                                                                             %
5624%                                                                             %
5625%   M a g i c k G e t I m a g e R e g i o n                                   %
5626%                                                                             %
5627%                                                                             %
5628%                                                                             %
5629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5630%
5631%  MagickGetImageRegion() extracts a region of the image and returns it as a
5632%  a new wand.
5633%
5634%  The format of the MagickGetImageRegion method is:
5635%
5636%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5637%        const size_t width,const size_t height,const ssize_t x,
5638%        const ssize_t y)
5639%
5640%  A description of each parameter follows:
5641%
5642%    o wand: the magick wand.
5643%
5644%    o width: the region width.
5645%
5646%    o height: the region height.
5647%
5648%    o x: the region x offset.
5649%
5650%    o y: the region y offset.
5651%
5652*/
5653WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5654  const size_t width,const size_t height,const ssize_t x,
5655  const ssize_t y)
5656{
5657  Image
5658    *region_image;
5659
5660  RectangleInfo
5661    region;
5662
5663  assert(wand != (MagickWand *) NULL);
5664  assert(wand->signature == WandSignature);
5665  if (wand->debug != MagickFalse)
5666    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5667  if (wand->images == (Image *) NULL)
5668    return((MagickWand *) NULL);
5669  region.width=width;
5670  region.height=height;
5671  region.x=x;
5672  region.y=y;
5673  region_image=CropImage(wand->images,&region,wand->exception);
5674  if (region_image == (Image *) NULL)
5675    return((MagickWand *) NULL);
5676  return(CloneMagickWandFromImages(wand,region_image));
5677}
5678
5679/*
5680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5681%                                                                             %
5682%                                                                             %
5683%                                                                             %
5684%   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                 %
5685%                                                                             %
5686%                                                                             %
5687%                                                                             %
5688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5689%
5690%  MagickGetImageRenderingIntent() gets the image rendering intent.
5691%
5692%  The format of the MagickGetImageRenderingIntent method is:
5693%
5694%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5695%
5696%  A description of each parameter follows:
5697%
5698%    o wand: the magick wand.
5699%
5700*/
5701WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5702{
5703  assert(wand != (MagickWand *) NULL);
5704  assert(wand->signature == WandSignature);
5705  if (wand->debug != MagickFalse)
5706    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5707  if (wand->images == (Image *) NULL)
5708    {
5709      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5710        "ContainsNoImages","`%s'",wand->name);
5711      return(UndefinedIntent);
5712    }
5713  return((RenderingIntent) wand->images->rendering_intent);
5714}
5715
5716/*
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%                                                                             %
5719%                                                                             %
5720%                                                                             %
5721%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5722%                                                                             %
5723%                                                                             %
5724%                                                                             %
5725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5726%
5727%  MagickGetImageResolution() gets the image X and Y resolution.
5728%
5729%  The format of the MagickGetImageResolution method is:
5730%
5731%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5732%        double *y)
5733%
5734%  A description of each parameter follows:
5735%
5736%    o wand: the magick wand.
5737%
5738%    o x: the image x-resolution.
5739%
5740%    o y: the image y-resolution.
5741%
5742*/
5743WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5744  double *x,double *y)
5745{
5746  assert(wand != (MagickWand *) NULL);
5747  assert(wand->signature == WandSignature);
5748  if (wand->debug != MagickFalse)
5749    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5750  if (wand->images == (Image *) NULL)
5751    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5752  *x=wand->images->x_resolution;
5753  *y=wand->images->y_resolution;
5754  return(MagickTrue);
5755}
5756
5757/*
5758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5759%                                                                             %
5760%                                                                             %
5761%                                                                             %
5762%   M a g i c k G e t I m a g e S c e n e                                     %
5763%                                                                             %
5764%                                                                             %
5765%                                                                             %
5766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5767%
5768%  MagickGetImageScene() gets the image scene.
5769%
5770%  The format of the MagickGetImageScene method is:
5771%
5772%      size_t MagickGetImageScene(MagickWand *wand)
5773%
5774%  A description of each parameter follows:
5775%
5776%    o wand: the magick wand.
5777%
5778*/
5779WandExport size_t MagickGetImageScene(MagickWand *wand)
5780{
5781  assert(wand != (MagickWand *) NULL);
5782  assert(wand->signature == WandSignature);
5783  if (wand->debug != MagickFalse)
5784    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5785  if (wand->images == (Image *) NULL)
5786    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5787  return(wand->images->scene);
5788}
5789
5790/*
5791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5792%                                                                             %
5793%                                                                             %
5794%                                                                             %
5795%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5796%                                                                             %
5797%                                                                             %
5798%                                                                             %
5799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5800%
5801%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5802%  pixel stream.
5803%
5804%  The format of the MagickGetImageSignature method is:
5805%
5806%      const char MagickGetImageSignature(MagickWand *wand)
5807%
5808%  A description of each parameter follows:
5809%
5810%    o wand: the magick wand.
5811%
5812*/
5813WandExport char *MagickGetImageSignature(MagickWand *wand)
5814{
5815  const char
5816    *value;
5817
5818  MagickBooleanType
5819    status;
5820
5821  assert(wand != (MagickWand *) NULL);
5822  assert(wand->signature == WandSignature);
5823  if (wand->debug != MagickFalse)
5824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5825  if (wand->images == (Image *) NULL)
5826    {
5827      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5828        "ContainsNoImages","`%s'",wand->name);
5829      return((char *) NULL);
5830    }
5831  status=SignatureImage(wand->images);
5832  if (status == MagickFalse)
5833    InheritException(wand->exception,&wand->images->exception);
5834  value=GetImageProperty(wand->images,"signature");
5835  if (value != (const char *) NULL)
5836    return(AcquireString(value));
5837  InheritException(wand->exception,&wand->images->exception);
5838  return((char *) NULL);
5839}
5840
5841/*
5842%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5843%                                                                             %
5844%                                                                             %
5845%                                                                             %
5846%   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                   %
5847%                                                                             %
5848%                                                                             %
5849%                                                                             %
5850%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5851%
5852%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5853%
5854%  The format of the MagickGetImageTicksPerSecond method is:
5855%
5856%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5857%
5858%  A description of each parameter follows:
5859%
5860%    o wand: the magick wand.
5861%
5862*/
5863WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5864{
5865  assert(wand != (MagickWand *) NULL);
5866  assert(wand->signature == WandSignature);
5867  if (wand->debug != MagickFalse)
5868    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5869  if (wand->images == (Image *) NULL)
5870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5871  return((size_t) wand->images->ticks_per_second);
5872}
5873
5874/*
5875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5876%                                                                             %
5877%                                                                             %
5878%                                                                             %
5879%   M a g i c k G e t I m a g e T y p e                                       %
5880%                                                                             %
5881%                                                                             %
5882%                                                                             %
5883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5884%
5885%  MagickGetImageType() gets the potential image type:
5886%
5887%        Bilevel        Grayscale       GrayscaleMatte
5888%        Palette        PaletteMatte    TrueColor
5889%        TrueColorMatte ColorSeparation ColorSeparationMatte
5890%
5891%  To ensure the image type matches its potential, use MagickSetImageType():
5892%
5893%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5894%
5895%  The format of the MagickGetImageType method is:
5896%
5897%      ImageType MagickGetImageType(MagickWand *wand)
5898%
5899%  A description of each parameter follows:
5900%
5901%    o wand: the magick wand.
5902%
5903*/
5904WandExport ImageType MagickGetImageType(MagickWand *wand)
5905{
5906  assert(wand != (MagickWand *) NULL);
5907  assert(wand->signature == WandSignature);
5908  if (wand->debug != MagickFalse)
5909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5910  if (wand->images == (Image *) NULL)
5911    {
5912      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5913        "ContainsNoImages","`%s'",wand->name);
5914      return(UndefinedType);
5915    }
5916  return(GetImageType(wand->images,wand->exception));
5917}
5918
5919/*
5920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5921%                                                                             %
5922%                                                                             %
5923%                                                                             %
5924%   M a g i c k G e t I m a g e U n i t s                                     %
5925%                                                                             %
5926%                                                                             %
5927%                                                                             %
5928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5929%
5930%  MagickGetImageUnits() gets the image units of resolution.
5931%
5932%  The format of the MagickGetImageUnits method is:
5933%
5934%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5935%
5936%  A description of each parameter follows:
5937%
5938%    o wand: the magick wand.
5939%
5940*/
5941WandExport ResolutionType MagickGetImageUnits(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(UndefinedResolution);
5952    }
5953  return(wand->images->units);
5954}
5955
5956/*
5957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5958%                                                                             %
5959%                                                                             %
5960%                                                                             %
5961%   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           %
5962%                                                                             %
5963%                                                                             %
5964%                                                                             %
5965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5966%
5967%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5968%  sepcified image.
5969%
5970%  The format of the MagickGetImageVirtualPixelMethod method is:
5971%
5972%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5973%
5974%  A description of each parameter follows:
5975%
5976%    o wand: the magick wand.
5977%
5978*/
5979WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5980{
5981  assert(wand != (MagickWand *) NULL);
5982  assert(wand->signature == WandSignature);
5983  if (wand->debug != MagickFalse)
5984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5985  if (wand->images == (Image *) NULL)
5986    {
5987      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5988        "ContainsNoImages","`%s'",wand->name);
5989      return(UndefinedVirtualPixelMethod);
5990    }
5991  return(GetImageVirtualPixelMethod(wand->images));
5992}
5993
5994/*
5995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5996%                                                                             %
5997%                                                                             %
5998%                                                                             %
5999%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6000%                                                                             %
6001%                                                                             %
6002%                                                                             %
6003%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6004%
6005%  MagickGetImageWhitePoint() returns the chromaticy white point.
6006%
6007%  The format of the MagickGetImageWhitePoint method is:
6008%
6009%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6010%        double *y)
6011%
6012%  A description of each parameter follows:
6013%
6014%    o wand: the magick wand.
6015%
6016%    o x: the chromaticity white x-point.
6017%
6018%    o y: the chromaticity white y-point.
6019%
6020*/
6021WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6022  double *x,double *y)
6023{
6024  assert(wand != (MagickWand *) NULL);
6025  assert(wand->signature == WandSignature);
6026  if (wand->debug != MagickFalse)
6027    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6028  if (wand->images == (Image *) NULL)
6029    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6030  *x=wand->images->chromaticity.white_point.x;
6031  *y=wand->images->chromaticity.white_point.y;
6032  return(MagickTrue);
6033}
6034
6035/*
6036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6037%                                                                             %
6038%                                                                             %
6039%                                                                             %
6040%   M a g i c k G e t I m a g e W i d t h                                     %
6041%                                                                             %
6042%                                                                             %
6043%                                                                             %
6044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6045%
6046%  MagickGetImageWidth() returns the image width.
6047%
6048%  The format of the MagickGetImageWidth method is:
6049%
6050%      size_t MagickGetImageWidth(MagickWand *wand)
6051%
6052%  A description of each parameter follows:
6053%
6054%    o wand: the magick wand.
6055%
6056*/
6057WandExport size_t MagickGetImageWidth(MagickWand *wand)
6058{
6059  assert(wand != (MagickWand *) NULL);
6060  assert(wand->signature == WandSignature);
6061  if (wand->debug != MagickFalse)
6062    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6063  if (wand->images == (Image *) NULL)
6064    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6065  return(wand->images->columns);
6066}
6067
6068/*
6069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6070%                                                                             %
6071%                                                                             %
6072%                                                                             %
6073%   M a g i c k G e t N u m b e r I m a g e s                                 %
6074%                                                                             %
6075%                                                                             %
6076%                                                                             %
6077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6078%
6079%  MagickGetNumberImages() returns the number of images associated with a
6080%  magick wand.
6081%
6082%  The format of the MagickGetNumberImages method is:
6083%
6084%      size_t MagickGetNumberImages(MagickWand *wand)
6085%
6086%  A description of each parameter follows:
6087%
6088%    o wand: the magick wand.
6089%
6090*/
6091WandExport size_t MagickGetNumberImages(MagickWand *wand)
6092{
6093  assert(wand != (MagickWand *) NULL);
6094  assert(wand->signature == WandSignature);
6095  if (wand->debug != MagickFalse)
6096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6097  return(GetImageListLength(wand->images));
6098}
6099
6100/*
6101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6102%                                                                             %
6103%                                                                             %
6104%                                                                             %
6105%   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                 %
6106%                                                                             %
6107%                                                                             %
6108%                                                                             %
6109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6110%
6111%  MagickGetImageTotalInkDensity() gets the image total ink density.
6112%
6113%  The format of the MagickGetImageTotalInkDensity method is:
6114%
6115%      double MagickGetImageTotalInkDensity(MagickWand *wand)
6116%
6117%  A description of each parameter follows:
6118%
6119%    o wand: the magick wand.
6120%
6121*/
6122WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6123{
6124  assert(wand != (MagickWand *) NULL);
6125  assert(wand->signature == WandSignature);
6126  if (wand->debug != MagickFalse)
6127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6128  if (wand->images == (Image *) NULL)
6129    {
6130      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6131        "ContainsNoImages","`%s'",wand->name);
6132      return(0.0);
6133    }
6134  return(GetImageTotalInkDensity(wand->images));
6135}
6136
6137/*
6138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6139%                                                                             %
6140%                                                                             %
6141%                                                                             %
6142%   M a g i c k H a l d C l u t I m a g e                                     %
6143%                                                                             %
6144%                                                                             %
6145%                                                                             %
6146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6147%
6148%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6149%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6150%  dimensions.  Create it with the HALD coder.  You can apply any color
6151%  transformation to the Hald image and then use this method to apply the
6152%  transform to the image.
6153%
6154%  The format of the MagickHaldClutImage method is:
6155%
6156%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6157%        const MagickWand *hald_wand)
6158%      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6159%        const ChannelType channel,const MagickWand *hald_wand)
6160%
6161%  A description of each parameter follows:
6162%
6163%    o wand: the magick wand.
6164%
6165%    o hald_image: the hald CLUT image.
6166%
6167*/
6168
6169WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6170  const MagickWand *hald_wand)
6171{
6172  MagickBooleanType
6173    status;
6174
6175  status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6176  return(status);
6177}
6178
6179WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6180  const ChannelType channel,const MagickWand *hald_wand)
6181{
6182  MagickBooleanType
6183    status;
6184
6185  assert(wand != (MagickWand *) NULL);
6186  assert(wand->signature == WandSignature);
6187  if (wand->debug != MagickFalse)
6188    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6189  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6190    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6191  status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6192  if (status == MagickFalse)
6193    InheritException(wand->exception,&wand->images->exception);
6194  return(status);
6195}
6196
6197/*
6198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6199%                                                                             %
6200%                                                                             %
6201%                                                                             %
6202%   M a g i c k H a s N e x t I m a g e                                       %
6203%                                                                             %
6204%                                                                             %
6205%                                                                             %
6206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6207%
6208%  MagickHasNextImage() returns MagickTrue if the wand has more images when
6209%  traversing the list in the forward direction
6210%
6211%  The format of the MagickHasNextImage method is:
6212%
6213%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6214%
6215%  A description of each parameter follows:
6216%
6217%    o wand: the magick wand.
6218%
6219*/
6220WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
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)
6227    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6228  if (GetNextImageInList(wand->images) == (Image *) NULL)
6229    return(MagickFalse);
6230  return(MagickTrue);
6231}
6232
6233/*
6234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6235%                                                                             %
6236%                                                                             %
6237%                                                                             %
6238%   M a g i c k H a s P r e v i o u s I m a g e                               %
6239%                                                                             %
6240%                                                                             %
6241%                                                                             %
6242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6243%
6244%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6245%  traversing the list in the reverse direction
6246%
6247%  The format of the MagickHasPreviousImage method is:
6248%
6249%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6250%
6251%  A description of each parameter follows:
6252%
6253%    o wand: the magick wand.
6254%
6255*/
6256WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6257{
6258  assert(wand != (MagickWand *) NULL);
6259  assert(wand->signature == WandSignature);
6260  if (wand->debug != MagickFalse)
6261    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6262  if (wand->images == (Image *) NULL)
6263    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6264  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6265    return(MagickFalse);
6266  return(MagickTrue);
6267}
6268
6269/*
6270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6271%                                                                             %
6272%                                                                             %
6273%                                                                             %
6274%   M a g i c k I d e n t i f y I m a g e                                     %
6275%                                                                             %
6276%                                                                             %
6277%                                                                             %
6278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6279%
6280%  MagickIdentifyImage() identifies an image by printing its attributes to the
6281%  file.  Attributes include the image width, height, size, and others.
6282%
6283%  The format of the MagickIdentifyImage method is:
6284%
6285%      const char *MagickIdentifyImage(MagickWand *wand)
6286%
6287%  A description of each parameter follows:
6288%
6289%    o wand: the magick wand.
6290%
6291*/
6292WandExport char *MagickIdentifyImage(MagickWand *wand)
6293{
6294  char
6295    *description,
6296    filename[MaxTextExtent];
6297
6298  FILE
6299    *file;
6300
6301  int
6302    unique_file;
6303
6304  assert(wand != (MagickWand *) NULL);
6305  assert(wand->signature == WandSignature);
6306  if (wand->debug != MagickFalse)
6307    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6308  if (wand->images == (Image *) NULL)
6309    {
6310      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6311        "ContainsNoImages","`%s'",wand->name);
6312      return((char *) NULL);
6313    }
6314  description=(char *) NULL;
6315  unique_file=AcquireUniqueFileResource(filename);
6316  file=(FILE *) NULL;
6317  if (unique_file != -1)
6318    file=fdopen(unique_file,"wb");
6319  if ((unique_file == -1) || (file == (FILE *) NULL))
6320    {
6321      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6322        "UnableToCreateTemporaryFile","`%s'",wand->name);
6323      return((char *) NULL);
6324    }
6325  (void) IdentifyImage(wand->images,file,MagickTrue);
6326  (void) fclose(file);
6327  description=FileToString(filename,~0,wand->exception);
6328  (void) RelinquishUniqueFileResource(filename);
6329  return(description);
6330}
6331
6332/*
6333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6334%                                                                             %
6335%                                                                             %
6336%                                                                             %
6337%   M a g i c k I m p l o d e I m a g e                                       %
6338%                                                                             %
6339%                                                                             %
6340%                                                                             %
6341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6342%
6343%  MagickImplodeImage() creates a new image that is a copy of an existing
6344%  one with the image pixels "implode" by the specified percentage.  It
6345%  allocates the memory necessary for the new Image structure and returns a
6346%  pointer to the new image.
6347%
6348%  The format of the MagickImplodeImage method is:
6349%
6350%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6351%        const double radius)
6352%
6353%  A description of each parameter follows:
6354%
6355%    o wand: the magick wand.
6356%
6357%    o amount: Define the extent of the implosion.
6358%
6359*/
6360WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6361  const double amount)
6362{
6363  Image
6364    *implode_image;
6365
6366  assert(wand != (MagickWand *) NULL);
6367  assert(wand->signature == WandSignature);
6368  if (wand->debug != MagickFalse)
6369    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6370  if (wand->images == (Image *) NULL)
6371    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6372  implode_image=ImplodeImage(wand->images,amount,wand->exception);
6373  if (implode_image == (Image *) NULL)
6374    return(MagickFalse);
6375  ReplaceImageInList(&wand->images,implode_image);
6376  return(MagickTrue);
6377}
6378
6379/*
6380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6381%                                                                             %
6382%                                                                             %
6383%                                                                             %
6384%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6385%                                                                             %
6386%                                                                             %
6387%                                                                             %
6388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6389%
6390%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6391%  location you specify.  The method returns MagickFalse on success otherwise
6392%  MagickTrue if an error is encountered.  The pixel data can be either char,
6393%  short int, int, ssize_t, float, or double in the order specified by map.
6394%
6395%  Suppose your want to upload the first scanline of a 640x480 image from
6396%  character data in red-green-blue order:
6397%
6398%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6399%
6400%  The format of the MagickImportImagePixels method is:
6401%
6402%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6403%        const ssize_t x,const ssize_t y,const size_t columns,
6404%        const size_t rows,const char *map,const StorageType storage,
6405%        const void *pixels)
6406%
6407%  A description of each parameter follows:
6408%
6409%    o wand: the magick wand.
6410%
6411%    o x, y, columns, rows:  These values define the perimeter of a region
6412%      of pixels you want to define.
6413%
6414%    o map:  This string reflects the expected ordering of the pixel array.
6415%      It can be any combination or order of R = red, G = green, B = blue,
6416%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6417%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6418%      P = pad.
6419%
6420%    o storage: Define the data type of the pixels.  Float and double types are
6421%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6422%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6423%      or DoublePixel.
6424%
6425%    o pixels: This array of values contain the pixel components as defined by
6426%      map and type.  You must preallocate this array where the expected
6427%      length varies depending on the values of width, height, map, and type.
6428%
6429*/
6430WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6431  const ssize_t x,const ssize_t y,const size_t columns,
6432  const size_t rows,const char *map,const StorageType storage,
6433  const void *pixels)
6434{
6435  MagickBooleanType
6436    status;
6437
6438  assert(wand != (MagickWand *) NULL);
6439  assert(wand->signature == WandSignature);
6440  if (wand->debug != MagickFalse)
6441    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6442  if (wand->images == (Image *) NULL)
6443    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6444  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6445  if (status == MagickFalse)
6446    InheritException(wand->exception,&wand->images->exception);
6447  return(status);
6448}
6449
6450/*
6451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6452%                                                                             %
6453%                                                                             %
6454%                                                                             %
6455%   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       %
6456%                                                                             %
6457%                                                                             %
6458%                                                                             %
6459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6460%
6461%  MagickInverseFourierTransformImage() implements the inverse discrete
6462%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6463%  imaginary image pair.
6464%
6465%  The format of the MagickInverseFourierTransformImage method is:
6466%
6467%      MagickBooleanType MagickInverseFourierTransformImage(
6468%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6469%        const MagickBooleanType magnitude)
6470%
6471%  A description of each parameter follows:
6472%
6473%    o magnitude_wand: the magnitude or real wand.
6474%
6475%    o phase_wand: the phase or imaginary wand.
6476%
6477%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6478%      imaginary image pair.
6479%
6480*/
6481WandExport MagickBooleanType MagickInverseFourierTransformImage(
6482  MagickWand *magnitude_wand,MagickWand *phase_wand,
6483  const MagickBooleanType magnitude)
6484{
6485  Image
6486    *inverse_image;
6487
6488  MagickWand
6489    *wand;
6490
6491  assert(magnitude_wand != (MagickWand *) NULL);
6492  assert(magnitude_wand->signature == WandSignature);
6493  if (magnitude_wand->debug != MagickFalse)
6494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6495      magnitude_wand->name);
6496  wand=magnitude_wand;
6497  if (magnitude_wand->images == (Image *) NULL)
6498    ThrowWandException(WandError,"ContainsNoImages",
6499      magnitude_wand->name);
6500  assert(phase_wand != (MagickWand *) NULL);
6501  assert(phase_wand->signature == WandSignature);
6502  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6503    phase_wand->images,magnitude,wand->exception);
6504  if (inverse_image == (Image *) NULL)
6505    return(MagickFalse);
6506  ReplaceImageInList(&wand->images,inverse_image);
6507  return(MagickTrue);
6508}
6509
6510/*
6511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6512%                                                                             %
6513%                                                                             %
6514%                                                                             %
6515%   M a g i c k L a b e l I m a g e                                           %
6516%                                                                             %
6517%                                                                             %
6518%                                                                             %
6519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520%
6521%  MagickLabelImage() adds a label to your image.
6522%
6523%  The format of the MagickLabelImage method is:
6524%
6525%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6526%
6527%  A description of each parameter follows:
6528%
6529%    o wand: the magick wand.
6530%
6531%    o label: the image label.
6532%
6533*/
6534WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6535  const char *label)
6536{
6537  MagickBooleanType
6538    status;
6539
6540  assert(wand != (MagickWand *) NULL);
6541  assert(wand->signature == WandSignature);
6542  if (wand->debug != MagickFalse)
6543    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6544  if (wand->images == (Image *) NULL)
6545    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6546  status=SetImageProperty(wand->images,"label",label);
6547  if (status == MagickFalse)
6548    InheritException(wand->exception,&wand->images->exception);
6549  return(status);
6550}
6551
6552/*
6553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554%                                                                             %
6555%                                                                             %
6556%                                                                             %
6557%   M a g i c k L e v e l I m a g e                                           %
6558%                                                                             %
6559%                                                                             %
6560%                                                                             %
6561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6562%
6563%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6564%  falling between specified white and black points to the full available
6565%  quantum range. The parameters provided represent the black, mid, and white
6566%  points. The black point specifies the darkest color in the image. Colors
6567%  darker than the black point are set to zero. Mid point specifies a gamma
6568%  correction to apply to the image.  White point specifies the lightest color
6569%  in the image. Colors brighter than the white point are set to the maximum
6570%  quantum value.
6571%
6572%  The format of the MagickLevelImage method is:
6573%
6574%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6575%        const double black_point,const double gamma,const double white_point)
6576%      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6577%        const ChannelType channel,const double black_point,const double gamma,
6578%        const double white_point)
6579%
6580%  A description of each parameter follows:
6581%
6582%    o wand: the magick wand.
6583%
6584%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6585%
6586%    o black_point: the black point.
6587%
6588%    o gamma: the gamma.
6589%
6590%    o white_point: the white point.
6591%
6592*/
6593
6594WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6595  const double black_point,const double gamma,const double white_point)
6596{
6597  MagickBooleanType
6598    status;
6599
6600  status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6601    white_point);
6602  return(status);
6603}
6604
6605WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6606  const ChannelType channel,const double black_point,const double gamma,
6607  const double white_point)
6608{
6609  MagickBooleanType
6610    status;
6611
6612  assert(wand != (MagickWand *) NULL);
6613  assert(wand->signature == WandSignature);
6614  if (wand->debug != MagickFalse)
6615    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6616  if (wand->images == (Image *) NULL)
6617    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6618  status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6619  if (status == MagickFalse)
6620    InheritException(wand->exception,&wand->images->exception);
6621  return(status);
6622}
6623
6624/*
6625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6626%                                                                             %
6627%                                                                             %
6628%                                                                             %
6629%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6630%                                                                             %
6631%                                                                             %
6632%                                                                             %
6633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6634%
6635%  MagickLinearStretchImage() stretches with saturation the image intensity.
6636%
6637%  You can also reduce the influence of a particular channel with a gamma
6638%  value of 0.
6639%
6640%  The format of the MagickLinearStretchImage method is:
6641%
6642%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6643%        const double black_point,const double white_point)
6644%
6645%  A description of each parameter follows:
6646%
6647%    o wand: the magick wand.
6648%
6649%    o black_point: the black point.
6650%
6651%    o white_point: the white point.
6652%
6653*/
6654WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6655  const double black_point,const double white_point)
6656{
6657  MagickBooleanType
6658    status;
6659
6660  assert(wand != (MagickWand *) NULL);
6661  assert(wand->signature == WandSignature);
6662  if (wand->debug != MagickFalse)
6663    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6664  if (wand->images == (Image *) NULL)
6665    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6666  status=LinearStretchImage(wand->images,black_point,white_point);
6667  if (status == MagickFalse)
6668    InheritException(wand->exception,&wand->images->exception);
6669  return(status);
6670}
6671
6672/*
6673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6674%                                                                             %
6675%                                                                             %
6676%                                                                             %
6677%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6678%                                                                             %
6679%                                                                             %
6680%                                                                             %
6681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6682%
6683%  MagickLiquidRescaleImage() rescales image with seam carving.
6684%
6685%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6686%        const size_t columns,const size_t rows,
6687%        const double delta_x,const double rigidity)
6688%
6689%  A description of each parameter follows:
6690%
6691%    o wand: the magick wand.
6692%
6693%    o columns: the number of columns in the scaled image.
6694%
6695%    o rows: the number of rows in the scaled image.
6696%
6697%    o delta_x: maximum seam transversal step (0 means straight seams).
6698%
6699%    o rigidity: introduce a bias for non-straight seams (typically 0).
6700%
6701*/
6702WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6703  const size_t columns,const size_t rows,const double delta_x,
6704  const double rigidity)
6705{
6706  Image
6707    *rescale_image;
6708
6709  assert(wand != (MagickWand *) NULL);
6710  assert(wand->signature == WandSignature);
6711  if (wand->debug != MagickFalse)
6712    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6713  if (wand->images == (Image *) NULL)
6714    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6715  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6716    rigidity,wand->exception);
6717  if (rescale_image == (Image *) NULL)
6718    return(MagickFalse);
6719  ReplaceImageInList(&wand->images,rescale_image);
6720  return(MagickTrue);
6721}
6722
6723/*
6724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6725%                                                                             %
6726%                                                                             %
6727%                                                                             %
6728%   M a g i c k M a g n i f y I m a g e                                       %
6729%                                                                             %
6730%                                                                             %
6731%                                                                             %
6732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6733%
6734%  MagickMagnifyImage() is a convenience method that scales an image
6735%  proportionally to twice its original size.
6736%
6737%  The format of the MagickMagnifyImage method is:
6738%
6739%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6740%
6741%  A description of each parameter follows:
6742%
6743%    o wand: the magick wand.
6744%
6745*/
6746WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6747{
6748  Image
6749    *magnify_image;
6750
6751  assert(wand != (MagickWand *) NULL);
6752  assert(wand->signature == WandSignature);
6753  if (wand->debug != MagickFalse)
6754    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6755  if (wand->images == (Image *) NULL)
6756    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6757  magnify_image=MagnifyImage(wand->images,wand->exception);
6758  if (magnify_image == (Image *) NULL)
6759    return(MagickFalse);
6760  ReplaceImageInList(&wand->images,magnify_image);
6761  return(MagickTrue);
6762}
6763
6764/*
6765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6766%                                                                             %
6767%                                                                             %
6768%                                                                             %
6769%   M a g i c k M e r g e I m a g e L a y e r s                               %
6770%                                                                             %
6771%                                                                             %
6772%                                                                             %
6773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6774%
6775%  MagickMergeImageLayers() composes all the image layers from the current
6776%  given image onward to produce a single image of the merged layers.
6777%
6778%  The inital canvas's size depends on the given ImageLayerMethod, and is
6779%  initialized using the first images background color.  The images
6780%  are then compositied onto that image in sequence using the given
6781%  composition that has been assigned to each individual image.
6782%
6783%  The format of the MagickMergeImageLayers method is:
6784%
6785%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6786%        const ImageLayerMethod method)
6787%
6788%  A description of each parameter follows:
6789%
6790%    o wand: the magick wand.
6791%
6792%    o method: the method of selecting the size of the initial canvas.
6793%
6794%        MergeLayer: Merge all layers onto a canvas just large enough
6795%           to hold all the actual images. The virtual canvas of the
6796%           first image is preserved but otherwise ignored.
6797%
6798%        FlattenLayer: Use the virtual canvas size of first image.
6799%           Images which fall outside this canvas is clipped.
6800%           This can be used to 'fill out' a given virtual canvas.
6801%
6802%        MosaicLayer: Start with the virtual canvas of the first image,
6803%           enlarging left and right edges to contain all images.
6804%           Images with negative offsets will be clipped.
6805%
6806*/
6807WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6808  const ImageLayerMethod method)
6809{
6810  Image
6811    *mosaic_image;
6812
6813  assert(wand != (MagickWand *) NULL);
6814  assert(wand->signature == WandSignature);
6815  if (wand->debug != MagickFalse)
6816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6817  if (wand->images == (Image *) NULL)
6818    return((MagickWand *) NULL);
6819  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6820  if (mosaic_image == (Image *) NULL)
6821    return((MagickWand *) NULL);
6822  return(CloneMagickWandFromImages(wand,mosaic_image));
6823}
6824
6825/*
6826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6827%                                                                             %
6828%                                                                             %
6829%                                                                             %
6830%   M a g i c k M i n i f y I m a g e                                         %
6831%                                                                             %
6832%                                                                             %
6833%                                                                             %
6834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6835%
6836%  MagickMinifyImage() is a convenience method that scales an image
6837%  proportionally to one-half its original size
6838%
6839%  The format of the MagickMinifyImage method is:
6840%
6841%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6842%
6843%  A description of each parameter follows:
6844%
6845%    o wand: the magick wand.
6846%
6847*/
6848WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6849{
6850  Image
6851    *minify_image;
6852
6853  assert(wand != (MagickWand *) NULL);
6854  assert(wand->signature == WandSignature);
6855  if (wand->debug != MagickFalse)
6856    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6857  if (wand->images == (Image *) NULL)
6858    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6859  minify_image=MinifyImage(wand->images,wand->exception);
6860  if (minify_image == (Image *) NULL)
6861    return(MagickFalse);
6862  ReplaceImageInList(&wand->images,minify_image);
6863  return(MagickTrue);
6864}
6865
6866/*
6867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6868%                                                                             %
6869%                                                                             %
6870%                                                                             %
6871%   M a g i c k M o d u l a t e I m a g e                                     %
6872%                                                                             %
6873%                                                                             %
6874%                                                                             %
6875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6876%
6877%  MagickModulateImage() lets you control the brightness, saturation, and hue
6878%  of an image.  Hue is the percentage of absolute rotation from the current
6879%  position.  For example 50 results in a counter-clockwise rotation of 90
6880%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6881%  both resulting in a rotation of 180 degrees.
6882%
6883%  To increase the color brightness by 20% and decrease the color saturation by
6884%  10% and leave the hue unchanged, use: 120,90,100.
6885%
6886%  The format of the MagickModulateImage method is:
6887%
6888%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6889%        const double brightness,const double saturation,const double hue)
6890%
6891%  A description of each parameter follows:
6892%
6893%    o wand: the magick wand.
6894%
6895%    o brightness: the percent change in brighness.
6896%
6897%    o saturation: the percent change in saturation.
6898%
6899%    o hue: the percent change in hue.
6900%
6901*/
6902WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6903  const double brightness,const double saturation,const double hue)
6904{
6905  char
6906    modulate[MaxTextExtent];
6907
6908  MagickBooleanType
6909    status;
6910
6911  assert(wand != (MagickWand *) NULL);
6912  assert(wand->signature == WandSignature);
6913  if (wand->debug != MagickFalse)
6914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6915  if (wand->images == (Image *) NULL)
6916    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6917  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6918    brightness,saturation,hue);
6919  status=ModulateImage(wand->images,modulate);
6920  if (status == MagickFalse)
6921    InheritException(wand->exception,&wand->images->exception);
6922  return(status);
6923}
6924
6925/*
6926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6927%                                                                             %
6928%                                                                             %
6929%                                                                             %
6930%   M a g i c k M o n t a g e I m a g e                                       %
6931%                                                                             %
6932%                                                                             %
6933%                                                                             %
6934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6935%
6936%  MagickMontageImage() creates a composite image by combining several
6937%  separate images. The images are tiled on the composite image with the name
6938%  of the image optionally appearing just below the individual tile.
6939%
6940%  The format of the MagickMontageImage method is:
6941%
6942%      MagickWand *MagickMontageImage(MagickWand *wand,
6943%        const DrawingWand drawing_wand,const char *tile_geometry,
6944%        const char *thumbnail_geometry,const MontageMode mode,
6945%        const char *frame)
6946%
6947%  A description of each parameter follows:
6948%
6949%    o wand: the magick wand.
6950%
6951%    o drawing_wand: the drawing wand.  The font name, size, and color are
6952%      obtained from this wand.
6953%
6954%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6955%
6956%    o thumbnail_geometry: Preferred image size and border size of each
6957%      thumbnail (e.g. 120x120+4+3>).
6958%
6959%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6960%
6961%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6962%      The frame color is that of the thumbnail's matte color.
6963%
6964*/
6965WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6966  const DrawingWand *drawing_wand,const char *tile_geometry,
6967  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6968{
6969  char
6970    *font;
6971
6972  Image
6973    *montage_image;
6974
6975  MontageInfo
6976    *montage_info;
6977
6978  PixelWand
6979    *pixel_wand;
6980
6981  assert(wand != (MagickWand *) NULL);
6982  assert(wand->signature == WandSignature);
6983  if (wand->debug != MagickFalse)
6984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6985  if (wand->images == (Image *) NULL)
6986    return((MagickWand *) NULL);
6987  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6988  switch (mode)
6989  {
6990    case FrameMode:
6991    {
6992      (void) CloneString(&montage_info->frame,"15x15+3+3");
6993      montage_info->shadow=MagickTrue;
6994      break;
6995    }
6996    case UnframeMode:
6997    {
6998      montage_info->frame=(char *) NULL;
6999      montage_info->shadow=MagickFalse;
7000      montage_info->border_width=0;
7001      break;
7002    }
7003    case ConcatenateMode:
7004    {
7005      montage_info->frame=(char *) NULL;
7006      montage_info->shadow=MagickFalse;
7007      (void) CloneString(&montage_info->geometry,"+0+0");
7008      montage_info->border_width=0;
7009      break;
7010    }
7011    default:
7012      break;
7013  }
7014  font=DrawGetFont(drawing_wand);
7015  if (font != (char *) NULL)
7016    (void) CloneString(&montage_info->font,font);
7017  if (frame != (char *) NULL)
7018    (void) CloneString(&montage_info->frame,frame);
7019  montage_info->pointsize=DrawGetFontSize(drawing_wand);
7020  pixel_wand=NewPixelWand();
7021  DrawGetFillColor(drawing_wand,pixel_wand);
7022  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
7023  DrawGetStrokeColor(drawing_wand,pixel_wand);
7024  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
7025  pixel_wand=DestroyPixelWand(pixel_wand);
7026  if (thumbnail_geometry != (char *) NULL)
7027    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7028  if (tile_geometry != (char *) NULL)
7029    (void) CloneString(&montage_info->tile,tile_geometry);
7030  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7031    wand->exception);
7032  montage_info=DestroyMontageInfo(montage_info);
7033  if (montage_image == (Image *) NULL)
7034    return((MagickWand *) NULL);
7035  return(CloneMagickWandFromImages(wand,montage_image));
7036}
7037
7038/*
7039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7040%                                                                             %
7041%                                                                             %
7042%                                                                             %
7043%   M a g i c k M o r p h I m a g e s                                         %
7044%                                                                             %
7045%                                                                             %
7046%                                                                             %
7047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7048%
7049%  MagickMorphImages() method morphs a set of images.  Both the image pixels
7050%  and size are linearly interpolated to give the appearance of a
7051%  meta-morphosis from one image to the next.
7052%
7053%  The format of the MagickMorphImages method is:
7054%
7055%      MagickWand *MagickMorphImages(MagickWand *wand,
7056%        const size_t number_frames)
7057%
7058%  A description of each parameter follows:
7059%
7060%    o wand: the magick wand.
7061%
7062%    o number_frames: the number of in-between images to generate.
7063%
7064*/
7065WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7066  const size_t number_frames)
7067{
7068  Image
7069    *morph_image;
7070
7071  assert(wand != (MagickWand *) NULL);
7072  assert(wand->signature == WandSignature);
7073  if (wand->debug != MagickFalse)
7074    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7075  if (wand->images == (Image *) NULL)
7076    return((MagickWand *) NULL);
7077  morph_image=MorphImages(wand->images,number_frames,wand->exception);
7078  if (morph_image == (Image *) NULL)
7079    return((MagickWand *) NULL);
7080  return(CloneMagickWandFromImages(wand,morph_image));
7081}
7082
7083/*
7084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7085%                                                                             %
7086%                                                                             %
7087%                                                                             %
7088%   M a g i c k M o r p h o l o g y I m a g e                                 %
7089%                                                                             %
7090%                                                                             %
7091%                                                                             %
7092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7093%
7094%  MagickMorphologyImage() applies a user supplied kernel to the image
7095%  according to the given mophology method.
7096%
7097%  The format of the MagickMorphologyImage method is:
7098%
7099%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7100%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7101%      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7102%        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7103%        KernelInfo *kernel)
7104%
7105%  A description of each parameter follows:
7106%
7107%    o wand: the magick wand.
7108%
7109%    o channel: the image channel(s).
7110%
7111%    o method: the morphology method to be applied.
7112%
7113%    o iterations: apply the operation this many times (or no change).
7114%      A value of -1 means loop until no change found.  How this is applied
7115%      may depend on the morphology method.  Typically this is a value of 1.
7116%
7117%    o kernel: An array of doubles representing the morphology kernel.
7118%
7119*/
7120
7121WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7122  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7123{
7124  MagickBooleanType
7125    status;
7126
7127  status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7128    kernel);
7129  return(status);
7130}
7131
7132WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7133  const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7134  KernelInfo *kernel)
7135{
7136  Image
7137    *morphology_image;
7138
7139  assert(wand != (MagickWand *) NULL);
7140  assert(wand->signature == WandSignature);
7141  if (wand->debug != MagickFalse)
7142    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7143  if (kernel == (const KernelInfo *) NULL)
7144    return(MagickFalse);
7145  if (wand->images == (Image *) NULL)
7146    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7147  morphology_image=MorphologyImageChannel(wand->images,channel,method,
7148    iterations,kernel,wand->exception);
7149  if (morphology_image == (Image *) NULL)
7150    return(MagickFalse);
7151  ReplaceImageInList(&wand->images,morphology_image);
7152  return(MagickTrue);
7153}
7154
7155/*
7156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7157%                                                                             %
7158%                                                                             %
7159%                                                                             %
7160%   M a g i c k M o t i o n B l u r I m a g e                                 %
7161%                                                                             %
7162%                                                                             %
7163%                                                                             %
7164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7165%
7166%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7167%  Gaussian operator of the given radius and standard deviation (sigma).
7168%  For reasonable results, radius should be larger than sigma.  Use a
7169%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7170%  Angle gives the angle of the blurring motion.
7171%
7172%  The format of the MagickMotionBlurImage method is:
7173%
7174%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7175%        const double radius,const double sigma,const double angle)
7176%      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7177%        const ChannelType channel,const double radius,const double sigma,
7178%        const double angle)
7179%
7180%  A description of each parameter follows:
7181%
7182%    o wand: the magick wand.
7183%
7184%    o channel: the image channel(s).
7185%
7186%    o radius: the radius of the Gaussian, in pixels, not counting
7187%      the center pixel.
7188%
7189%    o sigma: the standard deviation of the Gaussian, in pixels.
7190%
7191%    o angle: Apply the effect along this angle.
7192%
7193*/
7194
7195WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7196  const double radius,const double sigma,const double angle)
7197{
7198  MagickBooleanType
7199    status;
7200
7201  status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7202  return(status);
7203}
7204
7205WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7206  const ChannelType channel,const double radius,const double sigma,
7207  const double angle)
7208{
7209  Image
7210    *blur_image;
7211
7212  assert(wand != (MagickWand *) NULL);
7213  assert(wand->signature == WandSignature);
7214  if (wand->debug != MagickFalse)
7215    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7216  if (wand->images == (Image *) NULL)
7217    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7218  blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7219    wand->exception);
7220  if (blur_image == (Image *) NULL)
7221    return(MagickFalse);
7222  ReplaceImageInList(&wand->images,blur_image);
7223  return(MagickTrue);
7224}
7225
7226/*
7227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7228%                                                                             %
7229%                                                                             %
7230%                                                                             %
7231%   M a g i c k N e g a t e I m a g e                                         %
7232%                                                                             %
7233%                                                                             %
7234%                                                                             %
7235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7236%
7237%  MagickNegateImage() negates the colors in the reference image.  The
7238%  Grayscale option means that only grayscale values within the image are
7239%  negated.
7240%
7241%  You can also reduce the influence of a particular channel with a gamma
7242%  value of 0.
7243%
7244%  The format of the MagickNegateImage method is:
7245%
7246%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7247%        const MagickBooleanType gray)
7248%      MagickBooleanType MagickNegateImage(MagickWand *wand,
7249%        const ChannelType channel,const MagickBooleanType gray)
7250%
7251%  A description of each parameter follows:
7252%
7253%    o wand: the magick wand.
7254%
7255%    o channel: the image channel(s).
7256%
7257%    o gray: If MagickTrue, only negate grayscale pixels within the image.
7258%
7259*/
7260
7261WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7262  const MagickBooleanType gray)
7263{
7264  MagickBooleanType
7265    status;
7266
7267  status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7268  return(status);
7269}
7270
7271WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7272  const ChannelType channel,const MagickBooleanType gray)
7273{
7274  MagickBooleanType
7275    status;
7276
7277  assert(wand != (MagickWand *) NULL);
7278  assert(wand->signature == WandSignature);
7279  if (wand->debug != MagickFalse)
7280    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7281  if (wand->images == (Image *) NULL)
7282    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7283  status=NegateImageChannel(wand->images,channel,gray);
7284  if (status == MagickFalse)
7285    InheritException(wand->exception,&wand->images->exception);
7286  return(status);
7287}
7288
7289/*
7290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7291%                                                                             %
7292%                                                                             %
7293%                                                                             %
7294%   M a g i c k N e w I m a g e                                               %
7295%                                                                             %
7296%                                                                             %
7297%                                                                             %
7298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7299%
7300%  MagickNewImage() adds a blank image canvas of the specified size and
7301%  background color to the wand.
7302%
7303%  The format of the MagickNewImage method is:
7304%
7305%      MagickBooleanType MagickNewImage(MagickWand *wand,
7306%        const size_t columns,const size_t rows,
7307%        const PixelWand *background)
7308%
7309%  A description of each parameter follows:
7310%
7311%    o wand: the magick wand.
7312%
7313%    o width: the image width.
7314%
7315%    o height: the image height.
7316%
7317%    o background: the image color.
7318%
7319*/
7320WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7321  const size_t width,const size_t height,
7322  const PixelWand *background)
7323{
7324  Image
7325    *images;
7326
7327  PixelInfo
7328    pixel;
7329
7330  assert(wand != (MagickWand *) NULL);
7331  assert(wand->signature == WandSignature);
7332  if (wand->debug != MagickFalse)
7333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7334  PixelGetMagickColor(background,&pixel);
7335  images=NewMagickImage(wand->image_info,width,height,&pixel);
7336  if (images == (Image *) NULL)
7337    return(MagickFalse);
7338  if (images->exception.severity != UndefinedException)
7339    InheritException(wand->exception,&images->exception);
7340  return(InsertImageInWand(wand,images));
7341}
7342
7343/*
7344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7345%                                                                             %
7346%                                                                             %
7347%                                                                             %
7348%   M a g i c k N e x t I m a g e                                             %
7349%                                                                             %
7350%                                                                             %
7351%                                                                             %
7352%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7353%
7354%  MagickNextImage() associates the next image in the image list with a magick
7355%  wand.
7356%
7357%  The format of the MagickNextImage method is:
7358%
7359%      MagickBooleanType MagickNextImage(MagickWand *wand)
7360%
7361%  A description of each parameter follows:
7362%
7363%    o wand: the magick wand.
7364%
7365*/
7366WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7367{
7368  assert(wand != (MagickWand *) NULL);
7369  assert(wand->signature == WandSignature);
7370  if (wand->debug != MagickFalse)
7371    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7372  if (wand->images == (Image *) NULL)
7373    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7374  if (wand->pend != MagickFalse)
7375    {
7376      wand->pend=MagickFalse;
7377      return(MagickTrue);
7378    }
7379  if (GetNextImageInList(wand->images) == (Image *) NULL)
7380    {
7381      wand->pend=MagickTrue;
7382      return(MagickFalse);
7383    }
7384  wand->images=GetNextImageInList(wand->images);
7385  return(MagickTrue);
7386}
7387
7388/*
7389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7390%                                                                             %
7391%                                                                             %
7392%                                                                             %
7393%   M a g i c k N o r m a l i z e I m a g e                                   %
7394%                                                                             %
7395%                                                                             %
7396%                                                                             %
7397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7398%
7399%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7400%  the pixels color to span the entire range of colors available
7401%
7402%  You can also reduce the influence of a particular channel with a gamma
7403%  value of 0.
7404%
7405%  The format of the MagickNormalizeImage method is:
7406%
7407%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7408%      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7409%        const ChannelType channel)
7410%
7411%  A description of each parameter follows:
7412%
7413%    o wand: the magick wand.
7414%
7415%    o channel: the image channel(s).
7416%
7417*/
7418
7419WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7420{
7421  MagickBooleanType
7422    status;
7423
7424  status=MagickNormalizeImageChannel(wand,DefaultChannels);
7425  return(status);
7426}
7427
7428WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7429  const ChannelType channel)
7430{
7431  MagickBooleanType
7432    status;
7433
7434  assert(wand != (MagickWand *) NULL);
7435  assert(wand->signature == WandSignature);
7436  if (wand->debug != MagickFalse)
7437    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7438  if (wand->images == (Image *) NULL)
7439    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7440  status=NormalizeImageChannel(wand->images,channel);
7441  if (status == MagickFalse)
7442    InheritException(wand->exception,&wand->images->exception);
7443  return(status);
7444}
7445
7446/*
7447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7448%                                                                             %
7449%                                                                             %
7450%                                                                             %
7451%   M a g i c k O i l P a i n t I m a g e                                     %
7452%                                                                             %
7453%                                                                             %
7454%                                                                             %
7455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7456%
7457%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7458%  painting.  Each pixel is replaced by the most frequent color occurring
7459%  in a circular region defined by radius.
7460%
7461%  The format of the MagickOilPaintImage method is:
7462%
7463%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7464%        const double radius)
7465%
7466%  A description of each parameter follows:
7467%
7468%    o wand: the magick wand.
7469%
7470%    o radius: the radius of the circular neighborhood.
7471%
7472*/
7473WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7474  const double radius)
7475{
7476  Image
7477    *paint_image;
7478
7479  assert(wand != (MagickWand *) NULL);
7480  assert(wand->signature == WandSignature);
7481  if (wand->debug != MagickFalse)
7482    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7483  if (wand->images == (Image *) NULL)
7484    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7485  paint_image=OilPaintImage(wand->images,radius,wand->exception);
7486  if (paint_image == (Image *) NULL)
7487    return(MagickFalse);
7488  ReplaceImageInList(&wand->images,paint_image);
7489  return(MagickTrue);
7490}
7491
7492/*
7493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7494%                                                                             %
7495%                                                                             %
7496%                                                                             %
7497%   M a g i c k O p a q u e P a i n t I m a g e                               %
7498%                                                                             %
7499%                                                                             %
7500%                                                                             %
7501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7502%
7503%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7504%  defined by fill.
7505%
7506%  The format of the MagickOpaquePaintImage method is:
7507%
7508%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7509%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7510%        const MagickBooleanType invert)
7511%      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7512%        const ChannelType channel,const PixelWand *target,
7513%        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7514%
7515%  A description of each parameter follows:
7516%
7517%    o wand: the magick wand.
7518%
7519%    o channel: the channel(s).
7520%
7521%    o target: Change this target color to the fill color within the image.
7522%
7523%    o fill: the fill pixel wand.
7524%
7525%    o fuzz: By default target must match a particular pixel color
7526%      exactly.  However, in many cases two colors may differ by a small amount.
7527%      The fuzz member of image defines how much tolerance is acceptable to
7528%      consider two colors as the same.  For example, set fuzz to 10 and the
7529%      color red at intensities of 100 and 102 respectively are now interpreted
7530%      as the same color for the purposes of the floodfill.
7531%
7532%    o invert: paint any pixel that does not match the target color.
7533%
7534*/
7535
7536WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7537  const PixelWand *target,const PixelWand *fill,const double fuzz,
7538  const MagickBooleanType invert)
7539{
7540  MagickBooleanType
7541    status;
7542
7543  status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7544    invert);
7545  return(status);
7546}
7547
7548WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7549  const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7550  const double fuzz,const MagickBooleanType invert)
7551{
7552  MagickBooleanType
7553    status;
7554
7555  PixelInfo
7556    fill_pixel,
7557    target_pixel;
7558
7559  assert(wand != (MagickWand *) NULL);
7560  assert(wand->signature == WandSignature);
7561  if (wand->debug != MagickFalse)
7562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7563  if (wand->images == (Image *) NULL)
7564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7565  PixelGetMagickColor(target,&target_pixel);
7566  PixelGetMagickColor(fill,&fill_pixel);
7567  wand->images->fuzz=fuzz;
7568  status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7569    &fill_pixel,invert);
7570  if (status == MagickFalse)
7571    InheritException(wand->exception,&wand->images->exception);
7572  return(status);
7573}
7574
7575/*
7576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7577%                                                                             %
7578%                                                                             %
7579%                                                                             %
7580%   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                         %
7581%                                                                             %
7582%                                                                             %
7583%                                                                             %
7584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7585%
7586%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7587%  previous image in the sequence.  From this it attempts to select the
7588%  smallest cropped image to replace each frame, while preserving the results
7589%  of the animation.
7590%
7591%  The format of the MagickOptimizeImageLayers method is:
7592%
7593%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7594%
7595%  A description of each parameter follows:
7596%
7597%    o wand: the magick wand.
7598%
7599*/
7600WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7601{
7602  Image
7603    *optimize_image;
7604
7605  assert(wand != (MagickWand *) NULL);
7606  assert(wand->signature == WandSignature);
7607  if (wand->debug != MagickFalse)
7608    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7609  if (wand->images == (Image *) NULL)
7610    return((MagickWand *) NULL);
7611  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7612  if (optimize_image == (Image *) NULL)
7613    return((MagickWand *) NULL);
7614  return(CloneMagickWandFromImages(wand,optimize_image));
7615}
7616
7617/*
7618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7619%                                                                             %
7620%                                                                             %
7621%                                                                             %
7622%     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                   %
7623%                                                                             %
7624%                                                                             %
7625%                                                                             %
7626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7627%
7628%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7629%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7630%  which can be different for different channels, according to the input
7631%  arguments.
7632%
7633%  The format of the MagickOrderedPosterizeImage method is:
7634%
7635%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7636%        const char *threshold_map)
7637%      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7638%        const ChannelType channel,const char *threshold_map)
7639%
7640%  A description of each parameter follows:
7641%
7642%    o image: the image.
7643%
7644%    o channel: the channel or channels to be thresholded.
7645%
7646%    o threshold_map: A string containing the name of the threshold dither
7647%      map to use, followed by zero or more numbers representing the number of
7648%      color levels tho dither between.
7649%
7650%      Any level number less than 2 is equivalent to 2, and means only binary
7651%      dithering will be applied to each color channel.
7652%
7653%      No numbers also means a 2 level (bitmap) dither will be applied to all
7654%      channels, while a single number is the number of levels applied to each
7655%      channel in sequence.  More numbers will be applied in turn to each of
7656%      the color channels.
7657%
7658%      For example: "o3x3,6" generates a 6 level posterization of the image
7659%      with a ordered 3x3 diffused pixel dither being applied between each
7660%      level. While checker,8,8,4 will produce a 332 colormaped image with
7661%      only a single checkerboard hash pattern (50% grey) between each color
7662%      level, to basically double the number of color levels with a bare
7663%      minimim of dithering.
7664%
7665*/
7666
7667WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7668  const char *threshold_map)
7669{
7670  MagickBooleanType
7671    status;
7672
7673  status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7674  return(status);
7675}
7676
7677WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7678  MagickWand *wand,const ChannelType channel,const char *threshold_map)
7679{
7680  MagickBooleanType
7681    status;
7682
7683  assert(wand != (MagickWand *) NULL);
7684  assert(wand->signature == WandSignature);
7685  if (wand->debug != MagickFalse)
7686    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7687  if (wand->images == (Image *) NULL)
7688    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7689  status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7690    wand->exception);
7691  return(status);
7692}
7693
7694/*
7695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7696%                                                                             %
7697%                                                                             %
7698%                                                                             %
7699%   M a g i c k P i n g I m a g e                                             %
7700%                                                                             %
7701%                                                                             %
7702%                                                                             %
7703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7704%
7705%  MagickPingImage() is like MagickReadImage() except the only valid
7706%  information returned is the image width, height, size, and format.  It
7707%  is designed to efficiently obtain this information from a file without
7708%  reading the entire image sequence into memory.
7709%
7710%  The format of the MagickPingImage method is:
7711%
7712%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7713%
7714%  A description of each parameter follows:
7715%
7716%    o wand: the magick wand.
7717%
7718%    o filename: the image filename.
7719%
7720*/
7721WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7722  const char *filename)
7723{
7724  Image
7725    *images;
7726
7727  ImageInfo
7728    *ping_info;
7729
7730  assert(wand != (MagickWand *) NULL);
7731  assert(wand->signature == WandSignature);
7732  if (wand->debug != MagickFalse)
7733    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7734  ping_info=CloneImageInfo(wand->image_info);
7735  if (filename != (const char *) NULL)
7736    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7737  images=PingImage(ping_info,wand->exception);
7738  ping_info=DestroyImageInfo(ping_info);
7739  if (images == (Image *) NULL)
7740    return(MagickFalse);
7741  return(InsertImageInWand(wand,images));
7742}
7743
7744/*
7745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7746%                                                                             %
7747%                                                                             %
7748%                                                                             %
7749%   M a g i c k P i n g I m a g e B l o b                                     %
7750%                                                                             %
7751%                                                                             %
7752%                                                                             %
7753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7754%
7755%  MagickPingImageBlob() pings an image or image sequence from a blob.
7756%
7757%  The format of the MagickPingImageBlob method is:
7758%
7759%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7760%        const void *blob,const size_t length)
7761%
7762%  A description of each parameter follows:
7763%
7764%    o wand: the magick wand.
7765%
7766%    o blob: the blob.
7767%
7768%    o length: the blob length.
7769%
7770*/
7771WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7772  const void *blob,const size_t length)
7773{
7774  Image
7775    *images;
7776
7777  ImageInfo
7778    *read_info;
7779
7780  assert(wand != (MagickWand *) NULL);
7781  assert(wand->signature == WandSignature);
7782  if (wand->debug != MagickFalse)
7783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7784  read_info=CloneImageInfo(wand->image_info);
7785  SetImageInfoBlob(read_info,blob,length);
7786  images=PingImage(read_info,wand->exception);
7787  read_info=DestroyImageInfo(read_info);
7788  if (images == (Image *) NULL)
7789    return(MagickFalse);
7790  return(InsertImageInWand(wand,images));
7791}
7792
7793/*
7794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7795%                                                                             %
7796%                                                                             %
7797%                                                                             %
7798%   M a g i c k P i n g I m a g e F i l e                                     %
7799%                                                                             %
7800%                                                                             %
7801%                                                                             %
7802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7803%
7804%  MagickPingImageFile() pings an image or image sequence from an open file
7805%  descriptor.
7806%
7807%  The format of the MagickPingImageFile method is:
7808%
7809%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7810%
7811%  A description of each parameter follows:
7812%
7813%    o wand: the magick wand.
7814%
7815%    o file: the file descriptor.
7816%
7817*/
7818WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7819{
7820  Image
7821    *images;
7822
7823  ImageInfo
7824    *read_info;
7825
7826  assert(wand != (MagickWand *) NULL);
7827  assert(wand->signature == WandSignature);
7828  assert(file != (FILE *) NULL);
7829  if (wand->debug != MagickFalse)
7830    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7831  read_info=CloneImageInfo(wand->image_info);
7832  SetImageInfoFile(read_info,file);
7833  images=PingImage(read_info,wand->exception);
7834  read_info=DestroyImageInfo(read_info);
7835  if (images == (Image *) NULL)
7836    return(MagickFalse);
7837  return(InsertImageInWand(wand,images));
7838}
7839
7840/*
7841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7842%                                                                             %
7843%                                                                             %
7844%                                                                             %
7845%   M a g i c k P o l a r o i d I m a g e                                     %
7846%                                                                             %
7847%                                                                             %
7848%                                                                             %
7849%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7850%
7851%  MagickPolaroidImage() simulates a Polaroid picture.
7852%
7853%  The format of the MagickPolaroidImage method is:
7854%
7855%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7856%        const DrawingWand *drawing_wand,const double angle)
7857%
7858%  A description of each parameter follows:
7859%
7860%    o wand: the magick wand.
7861%
7862%    o drawing_wand: the draw wand.
7863%
7864%    o angle: Apply the effect along this angle.
7865%
7866*/
7867WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7868  const DrawingWand *drawing_wand,const double angle)
7869{
7870  DrawInfo
7871    *draw_info;
7872
7873  Image
7874    *polaroid_image;
7875
7876  assert(wand != (MagickWand *) NULL);
7877  assert(wand->signature == WandSignature);
7878  if (wand->debug != MagickFalse)
7879    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7880  if (wand->images == (Image *) NULL)
7881    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7882  draw_info=PeekDrawingWand(drawing_wand);
7883  if (draw_info == (DrawInfo *) NULL)
7884    return(MagickFalse);
7885  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7886  if (polaroid_image == (Image *) NULL)
7887    return(MagickFalse);
7888  ReplaceImageInList(&wand->images,polaroid_image);
7889  return(MagickTrue);
7890}
7891
7892/*
7893%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7894%                                                                             %
7895%                                                                             %
7896%                                                                             %
7897%   M a g i c k P o s t e r i z e I m a g e                                   %
7898%                                                                             %
7899%                                                                             %
7900%                                                                             %
7901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7902%
7903%  MagickPosterizeImage() reduces the image to a limited number of color level.
7904%
7905%  The format of the MagickPosterizeImage method is:
7906%
7907%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7908%        const unsigned levels,const MagickBooleanType dither)
7909%
7910%  A description of each parameter follows:
7911%
7912%    o wand: the magick wand.
7913%
7914%    o levels: Number of color levels allowed in each channel.  Very low values
7915%      (2, 3, or 4) have the most visible effect.
7916%
7917%    o dither: Set this integer value to something other than zero to dither
7918%      the mapped image.
7919%
7920*/
7921WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7922  const size_t levels,const MagickBooleanType dither)
7923{
7924  MagickBooleanType
7925    status;
7926
7927  assert(wand != (MagickWand *) NULL);
7928  assert(wand->signature == WandSignature);
7929  if (wand->debug != MagickFalse)
7930    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7931  if (wand->images == (Image *) NULL)
7932    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7933  status=PosterizeImage(wand->images,levels,dither);
7934  if (status == MagickFalse)
7935    InheritException(wand->exception,&wand->images->exception);
7936  return(status);
7937}
7938
7939/*
7940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7941%                                                                             %
7942%                                                                             %
7943%                                                                             %
7944%   M a g i c k P r e v i e w I m a g e s                                     %
7945%                                                                             %
7946%                                                                             %
7947%                                                                             %
7948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7949%
7950%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7951%  image processing operation applied at varying strengths.  This helpful
7952%  to quickly pin-point an appropriate parameter for an image processing
7953%  operation.
7954%
7955%  The format of the MagickPreviewImages method is:
7956%
7957%      MagickWand *MagickPreviewImages(MagickWand *wand,
7958%        const PreviewType preview)
7959%
7960%  A description of each parameter follows:
7961%
7962%    o wand: the magick wand.
7963%
7964%    o preview: the preview type.
7965%
7966*/
7967WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7968  const PreviewType preview)
7969{
7970  Image
7971    *preview_image;
7972
7973  assert(wand != (MagickWand *) NULL);
7974  assert(wand->signature == WandSignature);
7975  if (wand->debug != MagickFalse)
7976    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7977  if (wand->images == (Image *) NULL)
7978    return((MagickWand *) NULL);
7979  preview_image=PreviewImage(wand->images,preview,wand->exception);
7980  if (preview_image == (Image *) NULL)
7981    return((MagickWand *) NULL);
7982  return(CloneMagickWandFromImages(wand,preview_image));
7983}
7984
7985/*
7986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7987%                                                                             %
7988%                                                                             %
7989%                                                                             %
7990%   M a g i c k P r e v i o u s I m a g e                                     %
7991%                                                                             %
7992%                                                                             %
7993%                                                                             %
7994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7995%
7996%  MagickPreviousImage() assocates the previous image in an image list with
7997%  the magick wand.
7998%
7999%  The format of the MagickPreviousImage method is:
8000%
8001%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8002%
8003%  A description of each parameter follows:
8004%
8005%    o wand: the magick wand.
8006%
8007*/
8008WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
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    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8016  if (wand->pend != MagickFalse)
8017    {
8018      wand->pend=MagickFalse;
8019      return(MagickTrue);
8020    }
8021  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8022    {
8023      wand->pend=MagickTrue;
8024      return(MagickFalse);
8025    }
8026  wand->images=GetPreviousImageInList(wand->images);
8027  return(MagickTrue);
8028}
8029
8030/*
8031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8032%                                                                             %
8033%                                                                             %
8034%                                                                             %
8035%   M a g i c k Q u a n t i z e I m a g e                                     %
8036%                                                                             %
8037%                                                                             %
8038%                                                                             %
8039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8040%
8041%  MagickQuantizeImage() analyzes the colors within a reference image and
8042%  chooses a fixed number of colors to represent the image.  The goal of the
8043%  algorithm is to minimize the color difference between the input and output
8044%  image while minimizing the processing time.
8045%
8046%  The format of the MagickQuantizeImage method is:
8047%
8048%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8049%        const size_t number_colors,const ColorspaceType colorspace,
8050%        const size_t treedepth,const MagickBooleanType dither,
8051%        const MagickBooleanType measure_error)
8052%
8053%  A description of each parameter follows:
8054%
8055%    o wand: the magick wand.
8056%
8057%    o number_colors: the number of colors.
8058%
8059%    o colorspace: Perform color reduction in this colorspace, typically
8060%      RGBColorspace.
8061%
8062%    o treedepth: Normally, this integer value is zero or one.  A zero or
8063%      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
8064%      reference image with the least amount of memory and the fastest
8065%      computational speed.  In some cases, such as an image with low color
8066%      dispersion (a few number of colors), a value other than
8067%      Log4(number_colors) is required.  To expand the color tree completely,
8068%      use a value of 8.
8069%
8070%    o dither: A value other than zero distributes the difference between an
8071%      original image and the corresponding color reduced image to
8072%      neighboring pixels along a Hilbert curve.
8073%
8074%    o measure_error: A value other than zero measures the difference between
8075%      the original and quantized images.  This difference is the total
8076%      quantization error.  The error is computed by summing over all pixels
8077%      in an image the distance squared in RGB space between each reference
8078%      pixel value and its quantized value.
8079%
8080*/
8081WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8082  const size_t number_colors,const ColorspaceType colorspace,
8083  const size_t treedepth,const MagickBooleanType dither,
8084  const MagickBooleanType measure_error)
8085{
8086  MagickBooleanType
8087    status;
8088
8089  QuantizeInfo
8090    *quantize_info;
8091
8092  assert(wand != (MagickWand *) NULL);
8093  assert(wand->signature == WandSignature);
8094  if (wand->debug != MagickFalse)
8095    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8096  if (wand->images == (Image *) NULL)
8097    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8098  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8099  quantize_info->number_colors=number_colors;
8100  quantize_info->dither=dither;
8101  quantize_info->tree_depth=treedepth;
8102  quantize_info->colorspace=colorspace;
8103  quantize_info->measure_error=measure_error;
8104  status=QuantizeImage(quantize_info,wand->images);
8105  if (status == MagickFalse)
8106    InheritException(wand->exception,&wand->images->exception);
8107  quantize_info=DestroyQuantizeInfo(quantize_info);
8108  return(status);
8109}
8110
8111/*
8112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8113%                                                                             %
8114%                                                                             %
8115%                                                                             %
8116%   M a g i c k Q u a n t i z e I m a g e s                                   %
8117%                                                                             %
8118%                                                                             %
8119%                                                                             %
8120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8121%
8122%  MagickQuantizeImages() analyzes the colors within a sequence of images and
8123%  chooses a fixed number of colors to represent the image.  The goal of the
8124%  algorithm is to minimize the color difference between the input and output
8125%  image while minimizing the processing time.
8126%
8127%  The format of the MagickQuantizeImages method is:
8128%
8129%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8130%        const size_t number_colors,const ColorspaceType colorspace,
8131%        const size_t treedepth,const MagickBooleanType dither,
8132%        const MagickBooleanType measure_error)
8133%
8134%  A description of each parameter follows:
8135%
8136%    o wand: the magick wand.
8137%
8138%    o number_colors: the number of colors.
8139%
8140%    o colorspace: Perform color reduction in this colorspace, typically
8141%      RGBColorspace.
8142%
8143%    o treedepth: Normally, this integer value is zero or one.  A zero or
8144%      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
8145%      reference image with the least amount of memory and the fastest
8146%      computational speed.  In some cases, such as an image with low color
8147%      dispersion (a few number of colors), a value other than
8148%      Log4(number_colors) is required.  To expand the color tree completely,
8149%      use a value of 8.
8150%
8151%    o dither: A value other than zero distributes the difference between an
8152%      original image and the corresponding color reduced algorithm to
8153%      neighboring pixels along a Hilbert curve.
8154%
8155%    o measure_error: A value other than zero measures the difference between
8156%      the original and quantized images.  This difference is the total
8157%      quantization error.  The error is computed by summing over all pixels
8158%      in an image the distance squared in RGB space between each reference
8159%      pixel value and its quantized value.
8160%
8161*/
8162WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8163  const size_t number_colors,const ColorspaceType colorspace,
8164  const size_t treedepth,const MagickBooleanType dither,
8165  const MagickBooleanType measure_error)
8166{
8167  MagickBooleanType
8168    status;
8169
8170  QuantizeInfo
8171    *quantize_info;
8172
8173  assert(wand != (MagickWand *) NULL);
8174  assert(wand->signature == WandSignature);
8175  if (wand->debug != MagickFalse)
8176    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8177  if (wand->images == (Image *) NULL)
8178    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8179  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8180  quantize_info->number_colors=number_colors;
8181  quantize_info->dither=dither;
8182  quantize_info->tree_depth=treedepth;
8183  quantize_info->colorspace=colorspace;
8184  quantize_info->measure_error=measure_error;
8185  status=QuantizeImages(quantize_info,wand->images);
8186  if (status == MagickFalse)
8187    InheritException(wand->exception,&wand->images->exception);
8188  quantize_info=DestroyQuantizeInfo(quantize_info);
8189  return(status);
8190}
8191
8192/*
8193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8194%                                                                             %
8195%                                                                             %
8196%                                                                             %
8197%   M a g i c k R a d i a l B l u r I m a g e                                 %
8198%                                                                             %
8199%                                                                             %
8200%                                                                             %
8201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8202%
8203%  MagickRadialBlurImage() radial blurs an image.
8204%
8205%  The format of the MagickRadialBlurImage method is:
8206%
8207%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8208%        const double angle)
8209%      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8210%        const ChannelType channel,const double angle)
8211%
8212%  A description of each parameter follows:
8213%
8214%    o wand: the magick wand.
8215%
8216%    o channel: the image channel(s).
8217%
8218%    o angle: the angle of the blur in degrees.
8219%
8220*/
8221WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8222  const double angle)
8223{
8224  MagickBooleanType
8225    status;
8226
8227  status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8228  return(status);
8229}
8230
8231WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8232  const ChannelType channel,const double angle)
8233{
8234  Image
8235    *blur_image;
8236
8237  assert(wand != (MagickWand *) NULL);
8238  assert(wand->signature == WandSignature);
8239  if (wand->debug != MagickFalse)
8240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8241  if (wand->images == (Image *) NULL)
8242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8243  blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8244    wand->exception);
8245  if (blur_image == (Image *) NULL)
8246    return(MagickFalse);
8247  ReplaceImageInList(&wand->images,blur_image);
8248  return(MagickTrue);
8249}
8250
8251/*
8252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8253%                                                                             %
8254%                                                                             %
8255%                                                                             %
8256%   M a g i c k R a i s e I m a g e                                           %
8257%                                                                             %
8258%                                                                             %
8259%                                                                             %
8260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8261%
8262%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8263%  by lightening and darkening the edges of the image.  Members width and
8264%  height of raise_info define the width of the vertical and horizontal
8265%  edge of the effect.
8266%
8267%  The format of the MagickRaiseImage method is:
8268%
8269%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8270%        const size_t width,const size_t height,const ssize_t x,
8271%        const ssize_t y,const MagickBooleanType raise)
8272%
8273%  A description of each parameter follows:
8274%
8275%    o wand: the magick wand.
8276%
8277%    o width,height,x,y:  Define the dimensions of the area to raise.
8278%
8279%    o raise: A value other than zero creates a 3-D raise effect,
8280%      otherwise it has a lowered effect.
8281%
8282*/
8283WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8284  const size_t width,const size_t height,const ssize_t x,
8285  const ssize_t y,const MagickBooleanType raise)
8286{
8287  MagickBooleanType
8288    status;
8289
8290  RectangleInfo
8291    raise_info;
8292
8293  assert(wand != (MagickWand *) NULL);
8294  assert(wand->signature == WandSignature);
8295  if (wand->debug != MagickFalse)
8296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8297  if (wand->images == (Image *) NULL)
8298    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8299  raise_info.width=width;
8300  raise_info.height=height;
8301  raise_info.x=x;
8302  raise_info.y=y;
8303  status=RaiseImage(wand->images,&raise_info,raise);
8304  if (status == MagickFalse)
8305    InheritException(wand->exception,&wand->images->exception);
8306  return(status);
8307}
8308
8309/*
8310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8311%                                                                             %
8312%                                                                             %
8313%                                                                             %
8314%   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                       %
8315%                                                                             %
8316%                                                                             %
8317%                                                                             %
8318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8319%
8320%  MagickRandomThresholdImage() changes the value of individual pixels based on
8321%  the intensity of each pixel compared to threshold.  The result is a
8322%  high-contrast, two color image.
8323%
8324%  The format of the MagickRandomThresholdImage method is:
8325%
8326%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8327%        const double low,const double high)
8328%      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8329%        const ChannelType channel,const double low,const double high)
8330%
8331%  A description of each parameter follows:
8332%
8333%    o wand: the magick wand.
8334%
8335%    o channel: the image channel(s).
8336%
8337%    o low,high: Specify the high and low thresholds.  These values range from
8338%      0 to QuantumRange.
8339%
8340*/
8341
8342WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8343  const double low,const double high)
8344{
8345  MagickBooleanType
8346    status;
8347
8348  status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8349  return(status);
8350}
8351
8352WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8353  MagickWand *wand,const ChannelType channel,const double low,
8354  const double high)
8355{
8356  char
8357    threshold[MaxTextExtent];
8358
8359  MagickBooleanType
8360    status;
8361
8362  assert(wand != (MagickWand *) NULL);
8363  assert(wand->signature == WandSignature);
8364  if (wand->debug != MagickFalse)
8365    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8366  if (wand->images == (Image *) NULL)
8367    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8368  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8369  status=RandomThresholdImageChannel(wand->images,channel,threshold,
8370    wand->exception);
8371  if (status == MagickFalse)
8372    InheritException(wand->exception,&wand->images->exception);
8373  return(status);
8374}
8375
8376/*
8377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8378%                                                                             %
8379%                                                                             %
8380%                                                                             %
8381%   M a g i c k R e a d I m a g e                                             %
8382%                                                                             %
8383%                                                                             %
8384%                                                                             %
8385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8386%
8387%  MagickReadImage() reads an image or image sequence.  The images are inserted
8388%  at the current image pointer position.   Use MagickSetFirstIterator(),
8389%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8390%  image pointer position at the beginning of the image list, the end, or
8391%  anywhere in-between respectively.
8392%
8393%  The format of the MagickReadImage method is:
8394%
8395%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8396%
8397%  A description of each parameter follows:
8398%
8399%    o wand: the magick wand.
8400%
8401%    o filename: the image filename.
8402%
8403*/
8404WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8405  const char *filename)
8406{
8407  Image
8408    *images;
8409
8410  ImageInfo
8411    *read_info;
8412
8413  assert(wand != (MagickWand *) NULL);
8414  assert(wand->signature == WandSignature);
8415  if (wand->debug != MagickFalse)
8416    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8417  read_info=CloneImageInfo(wand->image_info);
8418  if (filename != (const char *) NULL)
8419    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8420  images=ReadImage(read_info,wand->exception);
8421  read_info=DestroyImageInfo(read_info);
8422  if (images == (Image *) NULL)
8423    return(MagickFalse);
8424  return(InsertImageInWand(wand,images));
8425}
8426
8427/*
8428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8429%                                                                             %
8430%                                                                             %
8431%                                                                             %
8432%   M a g i c k R e a d I m a g e B l o b                                     %
8433%                                                                             %
8434%                                                                             %
8435%                                                                             %
8436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8437%
8438%  MagickReadImageBlob() reads an image or image sequence from a blob.
8439%
8440%  The format of the MagickReadImageBlob method is:
8441%
8442%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8443%        const void *blob,const size_t length)
8444%
8445%  A description of each parameter follows:
8446%
8447%    o wand: the magick wand.
8448%
8449%    o blob: the blob.
8450%
8451%    o length: the blob length.
8452%
8453*/
8454WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8455  const void *blob,const size_t length)
8456{
8457  Image
8458    *images;
8459
8460  assert(wand != (MagickWand *) NULL);
8461  assert(wand->signature == WandSignature);
8462  if (wand->debug != MagickFalse)
8463    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8464  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8465  if (images == (Image *) NULL)
8466    return(MagickFalse);
8467  return(InsertImageInWand(wand,images));
8468}
8469
8470/*
8471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8472%                                                                             %
8473%                                                                             %
8474%                                                                             %
8475%   M a g i c k R e a d I m a g e F i l e                                     %
8476%                                                                             %
8477%                                                                             %
8478%                                                                             %
8479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8480%
8481%  MagickReadImageFile() reads an image or image sequence from an open file
8482%  descriptor.
8483%
8484%  The format of the MagickReadImageFile method is:
8485%
8486%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8487%
8488%  A description of each parameter follows:
8489%
8490%    o wand: the magick wand.
8491%
8492%    o file: the file descriptor.
8493%
8494*/
8495WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8496{
8497  Image
8498    *images;
8499
8500  ImageInfo
8501    *read_info;
8502
8503  assert(wand != (MagickWand *) NULL);
8504  assert(wand->signature == WandSignature);
8505  assert(file != (FILE *) NULL);
8506  if (wand->debug != MagickFalse)
8507    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8508  read_info=CloneImageInfo(wand->image_info);
8509  SetImageInfoFile(read_info,file);
8510  images=ReadImage(read_info,wand->exception);
8511  read_info=DestroyImageInfo(read_info);
8512  if (images == (Image *) NULL)
8513    return(MagickFalse);
8514  return(InsertImageInWand(wand,images));
8515}
8516
8517/*
8518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8519%                                                                             %
8520%                                                                             %
8521%                                                                             %
8522%   M a g i c k R e m a p I m a g e                                           %
8523%                                                                             %
8524%                                                                             %
8525%                                                                             %
8526%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8527%
8528%  MagickRemapImage() replaces the colors of an image with the closest color
8529%  from a reference image.
8530%
8531%  The format of the MagickRemapImage method is:
8532%
8533%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8534%        const MagickWand *remap_wand,const DitherMethod method)
8535%
8536%  A description of each parameter follows:
8537%
8538%    o wand: the magick wand.
8539%
8540%    o affinity: the affinity wand.
8541%
8542%    o method: choose from these dither methods: NoDitherMethod,
8543%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8544%
8545*/
8546WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8547  const MagickWand *remap_wand,const DitherMethod method)
8548{
8549  MagickBooleanType
8550    status;
8551
8552  QuantizeInfo
8553    *quantize_info;
8554
8555  assert(wand != (MagickWand *) NULL);
8556  assert(wand->signature == WandSignature);
8557  if (wand->debug != MagickFalse)
8558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8559  if ((wand->images == (Image *) NULL) ||
8560      (remap_wand->images == (Image *) NULL))
8561    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8562  quantize_info=AcquireQuantizeInfo(wand->image_info);
8563  quantize_info->dither_method=method;
8564  if (method == NoDitherMethod)
8565    quantize_info->dither=MagickFalse;
8566  status=RemapImage(quantize_info,wand->images,remap_wand->images);
8567  quantize_info=DestroyQuantizeInfo(quantize_info);
8568  if (status == MagickFalse)
8569    InheritException(wand->exception,&wand->images->exception);
8570  return(status);
8571}
8572
8573/*
8574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8575%                                                                             %
8576%                                                                             %
8577%                                                                             %
8578%   M a g i c k R e m o v e I m a g e                                         %
8579%                                                                             %
8580%                                                                             %
8581%                                                                             %
8582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8583%
8584%  MagickRemoveImage() removes an image from the image list.
8585%
8586%  The format of the MagickRemoveImage method is:
8587%
8588%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8589%
8590%  A description of each parameter follows:
8591%
8592%    o wand: the magick wand.
8593%
8594%    o insert: the splice wand.
8595%
8596*/
8597WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8598{
8599  assert(wand != (MagickWand *) NULL);
8600  assert(wand->signature == WandSignature);
8601  if (wand->debug != MagickFalse)
8602    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8603  if (wand->images == (Image *) NULL)
8604    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8605  DeleteImageFromList(&wand->images);
8606  return(MagickTrue);
8607}
8608
8609/*
8610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611%                                                                             %
8612%                                                                             %
8613%                                                                             %
8614%   M a g i c k R e s a m p l e I m a g e                                     %
8615%                                                                             %
8616%                                                                             %
8617%                                                                             %
8618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8619%
8620%  MagickResampleImage() resample image to desired resolution.
8621%
8622%    Bessel   Blackman   Box
8623%    Catrom   Cubic      Gaussian
8624%    Hanning  Hermite    Lanczos
8625%    Mitchell Point      Quandratic
8626%    Sinc     Triangle
8627%
8628%  Most of the filters are FIR (finite impulse response), however, Bessel,
8629%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8630%  are windowed (brought down to zero) with the Blackman filter.
8631%
8632%  The format of the MagickResampleImage method is:
8633%
8634%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8635%        const double x_resolution,const double y_resolution,
8636%        const FilterTypes filter,const double blur)
8637%
8638%  A description of each parameter follows:
8639%
8640%    o wand: the magick wand.
8641%
8642%    o x_resolution: the new image x resolution.
8643%
8644%    o y_resolution: the new image y resolution.
8645%
8646%    o filter: Image filter to use.
8647%
8648%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8649%
8650*/
8651WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8652  const double x_resolution,const double y_resolution,const FilterTypes filter,
8653  const double blur)
8654{
8655  Image
8656    *resample_image;
8657
8658  assert(wand != (MagickWand *) NULL);
8659  assert(wand->signature == WandSignature);
8660  if (wand->debug != MagickFalse)
8661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8662  if (wand->images == (Image *) NULL)
8663    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8664  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8665    blur,wand->exception);
8666  if (resample_image == (Image *) NULL)
8667    return(MagickFalse);
8668  ReplaceImageInList(&wand->images,resample_image);
8669  return(MagickTrue);
8670}
8671
8672/*
8673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8674%                                                                             %
8675%                                                                             %
8676%                                                                             %
8677%   M a g i c k R e s e t I m a g e P a g e                                   %
8678%                                                                             %
8679%                                                                             %
8680%                                                                             %
8681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8682%
8683%  MagickResetImagePage() resets the Wand page canvas and position.
8684%
8685%  The format of the MagickResetImagePage method is:
8686%
8687%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8688%        const char *page)
8689%
8690%  A description of each parameter follows:
8691%
8692%    o wand: the magick wand.
8693%
8694%    o page: the relative page specification.
8695%
8696*/
8697WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8698  const char *page)
8699{
8700  assert(wand != (MagickWand *) NULL);
8701  assert(wand->signature == WandSignature);
8702  if (wand->debug != MagickFalse)
8703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8704  if (wand->images == (Image *) NULL)
8705    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8706  if ((page == (char *) NULL) || (*page == '\0'))
8707    {
8708      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8709      return(MagickTrue);
8710    }
8711  return(ResetImagePage(wand->images,page));
8712}
8713
8714/*
8715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8716%                                                                             %
8717%                                                                             %
8718%                                                                             %
8719%   M a g i c k R e s i z e I m a g e                                         %
8720%                                                                             %
8721%                                                                             %
8722%                                                                             %
8723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8724%
8725%  MagickResizeImage() scales an image to the desired dimensions with one of
8726%  these filters:
8727%
8728%    Bessel   Blackman   Box
8729%    Catrom   Cubic      Gaussian
8730%    Hanning  Hermite    Lanczos
8731%    Mitchell Point      Quandratic
8732%    Sinc     Triangle
8733%
8734%  Most of the filters are FIR (finite impulse response), however, Bessel,
8735%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8736%  are windowed (brought down to zero) with the Blackman filter.
8737%
8738%  The format of the MagickResizeImage method is:
8739%
8740%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8741%        const size_t columns,const size_t rows,
8742%        const FilterTypes filter,const double blur)
8743%
8744%  A description of each parameter follows:
8745%
8746%    o wand: the magick wand.
8747%
8748%    o columns: the number of columns in the scaled image.
8749%
8750%    o rows: the number of rows in the scaled image.
8751%
8752%    o filter: Image filter to use.
8753%
8754%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8755%
8756*/
8757WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8758  const size_t columns,const size_t rows,const FilterTypes filter,
8759  const double blur)
8760{
8761  Image
8762    *resize_image;
8763
8764  assert(wand != (MagickWand *) NULL);
8765  assert(wand->signature == WandSignature);
8766  if (wand->debug != MagickFalse)
8767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8768  if (wand->images == (Image *) NULL)
8769    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8770  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8771    wand->exception);
8772  if (resize_image == (Image *) NULL)
8773    return(MagickFalse);
8774  ReplaceImageInList(&wand->images,resize_image);
8775  return(MagickTrue);
8776}
8777
8778/*
8779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8780%                                                                             %
8781%                                                                             %
8782%                                                                             %
8783%   M a g i c k R o l l I m a g e                                             %
8784%                                                                             %
8785%                                                                             %
8786%                                                                             %
8787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8788%
8789%  MagickRollImage() offsets an image as defined by x and y.
8790%
8791%  The format of the MagickRollImage method is:
8792%
8793%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8794%        const size_t y)
8795%
8796%  A description of each parameter follows:
8797%
8798%    o wand: the magick wand.
8799%
8800%    o x: the x offset.
8801%
8802%    o y: the y offset.
8803%
8804%
8805*/
8806WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8807  const ssize_t x,const ssize_t y)
8808{
8809  Image
8810    *roll_image;
8811
8812  assert(wand != (MagickWand *) NULL);
8813  assert(wand->signature == WandSignature);
8814  if (wand->debug != MagickFalse)
8815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8816  if (wand->images == (Image *) NULL)
8817    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8818  roll_image=RollImage(wand->images,x,y,wand->exception);
8819  if (roll_image == (Image *) NULL)
8820    return(MagickFalse);
8821  ReplaceImageInList(&wand->images,roll_image);
8822  return(MagickTrue);
8823}
8824
8825/*
8826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8827%                                                                             %
8828%                                                                             %
8829%                                                                             %
8830%   M a g i c k R o t a t e I m a g e                                         %
8831%                                                                             %
8832%                                                                             %
8833%                                                                             %
8834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8835%
8836%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8837%  triangles left over from rotating the image are filled with the
8838%  background color.
8839%
8840%  The format of the MagickRotateImage method is:
8841%
8842%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8843%        const PixelWand *background,const double degrees)
8844%
8845%  A description of each parameter follows:
8846%
8847%    o wand: the magick wand.
8848%
8849%    o background: the background pixel wand.
8850%
8851%    o degrees: the number of degrees to rotate the image.
8852%
8853%
8854*/
8855WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8856  const PixelWand *background,const double degrees)
8857{
8858  Image
8859    *rotate_image;
8860
8861  assert(wand != (MagickWand *) NULL);
8862  assert(wand->signature == WandSignature);
8863  if (wand->debug != MagickFalse)
8864    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8865  if (wand->images == (Image *) NULL)
8866    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8867  PixelGetQuantumPacket(background,&wand->images->background_color);
8868  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8869  if (rotate_image == (Image *) NULL)
8870    return(MagickFalse);
8871  ReplaceImageInList(&wand->images,rotate_image);
8872  return(MagickTrue);
8873}
8874
8875/*
8876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8877%                                                                             %
8878%                                                                             %
8879%                                                                             %
8880%   M a g i c k S a m p l e I m a g e                                         %
8881%                                                                             %
8882%                                                                             %
8883%                                                                             %
8884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8885%
8886%  MagickSampleImage() scales an image to the desired dimensions with pixel
8887%  sampling.  Unlike other scaling methods, this method does not introduce
8888%  any additional color into the scaled image.
8889%
8890%  The format of the MagickSampleImage method is:
8891%
8892%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8893%        const size_t columns,const size_t rows)
8894%
8895%  A description of each parameter follows:
8896%
8897%    o wand: the magick wand.
8898%
8899%    o columns: the number of columns in the scaled image.
8900%
8901%    o rows: the number of rows in the scaled image.
8902%
8903%
8904*/
8905WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8906  const size_t columns,const size_t rows)
8907{
8908  Image
8909    *sample_image;
8910
8911  assert(wand != (MagickWand *) NULL);
8912  assert(wand->signature == WandSignature);
8913  if (wand->debug != MagickFalse)
8914    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8915  if (wand->images == (Image *) NULL)
8916    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8917  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8918  if (sample_image == (Image *) NULL)
8919    return(MagickFalse);
8920  ReplaceImageInList(&wand->images,sample_image);
8921  return(MagickTrue);
8922}
8923
8924/*
8925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8926%                                                                             %
8927%                                                                             %
8928%                                                                             %
8929%   M a g i c k S c a l e I m a g e                                           %
8930%                                                                             %
8931%                                                                             %
8932%                                                                             %
8933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8934%
8935%  MagickScaleImage() scales the size of an image to the given dimensions.
8936%
8937%  The format of the MagickScaleImage method is:
8938%
8939%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8940%        const size_t columns,const size_t rows)
8941%
8942%  A description of each parameter follows:
8943%
8944%    o wand: the magick wand.
8945%
8946%    o columns: the number of columns in the scaled image.
8947%
8948%    o rows: the number of rows in the scaled image.
8949%
8950%
8951*/
8952WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8953  const size_t columns,const size_t rows)
8954{
8955  Image
8956    *scale_image;
8957
8958  assert(wand != (MagickWand *) NULL);
8959  assert(wand->signature == WandSignature);
8960  if (wand->debug != MagickFalse)
8961    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8962  if (wand->images == (Image *) NULL)
8963    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8964  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8965  if (scale_image == (Image *) NULL)
8966    return(MagickFalse);
8967  ReplaceImageInList(&wand->images,scale_image);
8968  return(MagickTrue);
8969}
8970
8971/*
8972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8973%                                                                             %
8974%                                                                             %
8975%                                                                             %
8976%   M a g i c k S e g m e n t I m a g e                                       %
8977%                                                                             %
8978%                                                                             %
8979%                                                                             %
8980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8981%
8982%  MagickSegmentImage() segments an image by analyzing the histograms of the
8983%  color components and identifying units that are homogeneous with the fuzzy
8984%  C-means technique.
8985%
8986%  The format of the SegmentImage method is:
8987%
8988%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8989%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8990%        const double cluster_threshold,const double smooth_threshold)
8991%
8992%  A description of each parameter follows.
8993%
8994%    o wand: the wand.
8995%
8996%    o colorspace: the image colorspace.
8997%
8998%    o verbose:  Set to MagickTrue to print detailed information about the
8999%      identified classes.
9000%
9001%    o cluster_threshold:  This represents the minimum number of pixels
9002%      contained in a hexahedra before it can be considered valid (expressed as
9003%      a percentage).
9004%
9005%    o smooth_threshold: the smoothing threshold eliminates noise in the second
9006%      derivative of the histogram.  As the value is increased, you can expect a
9007%      smoother second derivative.
9008%
9009*/
9010MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9011  const ColorspaceType colorspace,const MagickBooleanType verbose,
9012  const double cluster_threshold,const double smooth_threshold)
9013{
9014  MagickBooleanType
9015    status;
9016
9017  assert(wand != (MagickWand *) NULL);
9018  assert(wand->signature == WandSignature);
9019  if (wand->debug != MagickFalse)
9020    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9021  if (wand->images == (Image *) NULL)
9022    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9023  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9024    smooth_threshold);
9025  if (status == MagickFalse)
9026    InheritException(wand->exception,&wand->images->exception);
9027  return(status);
9028}
9029
9030/*
9031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9032%                                                                             %
9033%                                                                             %
9034%                                                                             %
9035%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9036%                                                                             %
9037%                                                                             %
9038%                                                                             %
9039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9040%
9041%  MagickSelectiveBlurImage() selectively blur an image within a contrast
9042%  threshold. It is similar to the unsharpen mask that sharpens everything with
9043%  contrast above a certain threshold.
9044%
9045%  The format of the MagickSelectiveBlurImage method is:
9046%
9047%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9048%        const double radius,const double sigma,const double threshold)
9049%      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9050%        const ChannelType channel,const double radius,const double sigma,
9051%        const double threshold)
9052%
9053%  A description of each parameter follows:
9054%
9055%    o wand: the magick wand.
9056%
9057%    o channel: the image channel(s).
9058%
9059%    o radius: the radius of the gaussian, in pixels, not counting the center
9060%      pixel.
9061%
9062%    o sigma: the standard deviation of the gaussian, in pixels.
9063%
9064%    o threshold: only pixels within this contrast threshold are included
9065%      in the blur operation.
9066%
9067*/
9068
9069WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9070  const double radius,const double sigma,const double threshold)
9071{
9072  MagickBooleanType
9073    status;
9074
9075  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9076    threshold);
9077  return(status);
9078}
9079
9080WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9081  const ChannelType channel,const double radius,const double sigma,
9082  const double threshold)
9083{
9084  Image
9085    *blur_image;
9086
9087  assert(wand != (MagickWand *) NULL);
9088  assert(wand->signature == WandSignature);
9089  if (wand->debug != MagickFalse)
9090    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9091  if (wand->images == (Image *) NULL)
9092    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9093  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9094    threshold,wand->exception);
9095  if (blur_image == (Image *) NULL)
9096    return(MagickFalse);
9097  ReplaceImageInList(&wand->images,blur_image);
9098  return(MagickTrue);
9099}
9100
9101/*
9102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9103%                                                                             %
9104%                                                                             %
9105%                                                                             %
9106%   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                       %
9107%                                                                             %
9108%                                                                             %
9109%                                                                             %
9110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9111%
9112%  MagickSeparateImageChannel() separates a channel from the image and returns a
9113%  grayscale image.  A channel is a particular color component of each pixel
9114%  in the image.
9115%
9116%  The format of the MagickSeparateImageChannel method is:
9117%
9118%      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9119%        const ChannelType channel)
9120%
9121%  A description of each parameter follows:
9122%
9123%    o wand: the magick wand.
9124%
9125%    o channel: the image channel(s).
9126%
9127*/
9128WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9129  const ChannelType channel)
9130{
9131  MagickBooleanType
9132    status;
9133
9134  assert(wand != (MagickWand *) NULL);
9135  assert(wand->signature == WandSignature);
9136  if (wand->debug != MagickFalse)
9137    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9138  if (wand->images == (Image *) NULL)
9139    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9140  status=SeparateImageChannel(wand->images,channel);
9141  if (status == MagickFalse)
9142    InheritException(wand->exception,&wand->images->exception);
9143  return(status);
9144}
9145
9146/*
9147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9148%                                                                             %
9149%                                                                             %
9150%                                                                             %
9151%     M a g i c k S e p i a T o n e I m a g e                                 %
9152%                                                                             %
9153%                                                                             %
9154%                                                                             %
9155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9156%
9157%  MagickSepiaToneImage() applies a special effect to the image, similar to the
9158%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9159%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9160%  threshold of 80% is a good starting point for a reasonable tone.
9161%
9162%  The format of the MagickSepiaToneImage method is:
9163%
9164%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9165%        const double threshold)
9166%
9167%  A description of each parameter follows:
9168%
9169%    o wand: the magick wand.
9170%
9171%    o threshold:  Define the extent of the sepia toning.
9172%
9173*/
9174WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9175  const double threshold)
9176{
9177  Image
9178    *sepia_image;
9179
9180  assert(wand != (MagickWand *) NULL);
9181  assert(wand->signature == WandSignature);
9182  if (wand->debug != MagickFalse)
9183    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9184  if (wand->images == (Image *) NULL)
9185    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9186  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9187  if (sepia_image == (Image *) NULL)
9188    return(MagickFalse);
9189  ReplaceImageInList(&wand->images,sepia_image);
9190  return(MagickTrue);
9191}
9192
9193/*
9194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9195%                                                                             %
9196%                                                                             %
9197%                                                                             %
9198%   M a g i c k S e t I m a g e                                               %
9199%                                                                             %
9200%                                                                             %
9201%                                                                             %
9202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9203%
9204%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9205%  MagickNextImage(), MagickPreviousImage() with the images from the specified
9206%  wand.
9207%
9208%  The format of the MagickSetImage method is:
9209%
9210%      MagickBooleanType MagickSetImage(MagickWand *wand,
9211%        const MagickWand *set_wand)
9212%
9213%  A description of each parameter follows:
9214%
9215%    o wand: the magick wand.
9216%
9217%    o set_wand: the set_wand wand.
9218%
9219*/
9220WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9221  const MagickWand *set_wand)
9222{
9223  Image
9224    *images;
9225
9226  assert(wand != (MagickWand *) NULL);
9227  assert(wand->signature == WandSignature);
9228  if (wand->debug != MagickFalse)
9229    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9230  assert(set_wand != (MagickWand *) NULL);
9231  assert(set_wand->signature == WandSignature);
9232  if (wand->debug != MagickFalse)
9233    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9234  if (set_wand->images == (Image *) NULL)
9235    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9236  images=CloneImageList(set_wand->images,wand->exception);
9237  if (images == (Image *) NULL)
9238    return(MagickFalse);
9239  ReplaceImageInList(&wand->images,images);
9240  return(MagickTrue);
9241}
9242
9243/*
9244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9245%                                                                             %
9246%                                                                             %
9247%                                                                             %
9248%   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                       %
9249%                                                                             %
9250%                                                                             %
9251%                                                                             %
9252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9253%
9254%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9255%  alpha channel.
9256%
9257%  The format of the MagickSetImageAlphaChannel method is:
9258%
9259%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9260%        const AlphaChannelType alpha_type)
9261%
9262%  A description of each parameter follows:
9263%
9264%    o wand: the magick wand.
9265%
9266%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9267%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9268%
9269*/
9270WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9271  const AlphaChannelType alpha_type)
9272{
9273  assert(wand != (MagickWand *) NULL);
9274  assert(wand->signature == WandSignature);
9275  if (wand->debug != MagickFalse)
9276    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9277  if (wand->images == (Image *) NULL)
9278    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9279  return(SetImageAlphaChannel(wand->images,alpha_type));
9280}
9281
9282/*
9283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9284%                                                                             %
9285%                                                                             %
9286%                                                                             %
9287%   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                 %
9288%                                                                             %
9289%                                                                             %
9290%                                                                             %
9291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9292%
9293%  MagickSetImageBackgroundColor() sets the image background color.
9294%
9295%  The format of the MagickSetImageBackgroundColor method is:
9296%
9297%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9298%        const PixelWand *background)
9299%
9300%  A description of each parameter follows:
9301%
9302%    o wand: the magick wand.
9303%
9304%    o background: the background pixel wand.
9305%
9306*/
9307WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9308  const PixelWand *background)
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  PixelGetQuantumPacket(background,&wand->images->background_color);
9317  return(MagickTrue);
9318}
9319
9320/*
9321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9322%                                                                             %
9323%                                                                             %
9324%                                                                             %
9325%   M a g i c k S e t I m a g e B i a s                                       %
9326%                                                                             %
9327%                                                                             %
9328%                                                                             %
9329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9330%
9331%  MagickSetImageBias() sets the image bias for any method that convolves an
9332%  image (e.g. MagickConvolveImage()).
9333%
9334%  The format of the MagickSetImageBias method is:
9335%
9336%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9337%        const double bias)
9338%
9339%  A description of each parameter follows:
9340%
9341%    o wand: the magick wand.
9342%
9343%    o bias: the image bias.
9344%
9345*/
9346WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9347  const double bias)
9348{
9349  assert(wand != (MagickWand *) NULL);
9350  assert(wand->signature == WandSignature);
9351  if (wand->debug != MagickFalse)
9352    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9353  if (wand->images == (Image *) NULL)
9354    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9355  wand->images->bias=bias;
9356  return(MagickTrue);
9357}
9358
9359/*
9360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9361%                                                                             %
9362%                                                                             %
9363%                                                                             %
9364%   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                         %
9365%                                                                             %
9366%                                                                             %
9367%                                                                             %
9368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9369%
9370%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9371%
9372%  The format of the MagickSetImageBluePrimary method is:
9373%
9374%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9375%        const double x,const double y)
9376%
9377%  A description of each parameter follows:
9378%
9379%    o wand: the magick wand.
9380%
9381%    o x: the blue primary x-point.
9382%
9383%    o y: the blue primary y-point.
9384%
9385*/
9386WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9387  const double x,const double y)
9388{
9389  assert(wand != (MagickWand *) NULL);
9390  assert(wand->signature == WandSignature);
9391  if (wand->debug != MagickFalse)
9392    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9393  if (wand->images == (Image *) NULL)
9394    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9395  wand->images->chromaticity.blue_primary.x=x;
9396  wand->images->chromaticity.blue_primary.y=y;
9397  return(MagickTrue);
9398}
9399
9400/*
9401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9402%                                                                             %
9403%                                                                             %
9404%                                                                             %
9405%   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                         %
9406%                                                                             %
9407%                                                                             %
9408%                                                                             %
9409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9410%
9411%  MagickSetImageBorderColor() sets the image border color.
9412%
9413%  The format of the MagickSetImageBorderColor method is:
9414%
9415%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9416%        const PixelWand *border)
9417%
9418%  A description of each parameter follows:
9419%
9420%    o wand: the magick wand.
9421%
9422%    o border: the border pixel wand.
9423%
9424*/
9425WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9426  const PixelWand *border)
9427{
9428  assert(wand != (MagickWand *) NULL);
9429  assert(wand->signature == WandSignature);
9430  if (wand->debug != MagickFalse)
9431    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9432  if (wand->images == (Image *) NULL)
9433    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9434  PixelGetQuantumPacket(border,&wand->images->border_color);
9435  return(MagickTrue);
9436}
9437
9438/*
9439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9440%                                                                             %
9441%                                                                             %
9442%                                                                             %
9443%   M a g i c k S e t I m a g e C l i p M a s k                               %
9444%                                                                             %
9445%                                                                             %
9446%                                                                             %
9447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9448%
9449%  MagickSetImageClipMask() sets image clip mask.
9450%
9451%  The format of the MagickSetImageClipMask method is:
9452%
9453%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9454%        const MagickWand *clip_mask)
9455%
9456%  A description of each parameter follows:
9457%
9458%    o wand: the magick wand.
9459%
9460%    o clip_mask: the clip_mask wand.
9461%
9462*/
9463WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9464  const MagickWand *clip_mask)
9465{
9466  assert(wand != (MagickWand *) NULL);
9467  assert(wand->signature == WandSignature);
9468  if (wand->debug != MagickFalse)
9469    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9470  assert(clip_mask != (MagickWand *) NULL);
9471  assert(clip_mask->signature == WandSignature);
9472  if (wand->debug != MagickFalse)
9473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9474  if (clip_mask->images == (Image *) NULL)
9475    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9476  return(SetImageClipMask(wand->images,clip_mask->images));
9477}
9478
9479/*
9480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9481%                                                                             %
9482%                                                                             %
9483%                                                                             %
9484%   M a g i c k S e t I m a g e C o l o r                                     %
9485%                                                                             %
9486%                                                                             %
9487%                                                                             %
9488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9489%
9490%  MagickSetImageColor() set the entire wand canvas to the specified color.
9491%
9492%  The format of the MagickSetImageColor method is:
9493%
9494%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9495%        const PixelWand *color)
9496%
9497%  A description of each parameter follows:
9498%
9499%    o wand: the magick wand.
9500%
9501%    o background: the image color.
9502%
9503*/
9504WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9505  const PixelWand *color)
9506{
9507  MagickBooleanType
9508    status;
9509
9510  PixelInfo
9511    pixel;
9512
9513  assert(wand != (MagickWand *) NULL);
9514  assert(wand->signature == WandSignature);
9515  if (wand->debug != MagickFalse)
9516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9517  PixelGetMagickColor(color,&pixel);
9518  status=SetImageColor(wand->images,&pixel);
9519  if (status == MagickFalse)
9520    InheritException(wand->exception,&wand->images->exception);
9521  return(status);
9522}
9523
9524/*
9525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9526%                                                                             %
9527%                                                                             %
9528%                                                                             %
9529%   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                     %
9530%                                                                             %
9531%                                                                             %
9532%                                                                             %
9533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9534%
9535%  MagickSetImageColormapColor() sets the color of the specified colormap
9536%  index.
9537%
9538%  The format of the MagickSetImageColormapColor method is:
9539%
9540%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9541%        const size_t index,const PixelWand *color)
9542%
9543%  A description of each parameter follows:
9544%
9545%    o wand: the magick wand.
9546%
9547%    o index: the offset into the image colormap.
9548%
9549%    o color: Return the colormap color in this wand.
9550%
9551*/
9552WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9553  const size_t index,const PixelWand *color)
9554{
9555  assert(wand != (MagickWand *) NULL);
9556  assert(wand->signature == WandSignature);
9557  if (wand->debug != MagickFalse)
9558    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9559  if (wand->images == (Image *) NULL)
9560    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9561  if ((wand->images->colormap == (PixelPacket *) NULL) ||
9562      (index >= wand->images->colors))
9563    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9564  PixelGetQuantumPacket(color,wand->images->colormap+index);
9565  return(SyncImage(wand->images));
9566}
9567
9568/*
9569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9570%                                                                             %
9571%                                                                             %
9572%                                                                             %
9573%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9574%                                                                             %
9575%                                                                             %
9576%                                                                             %
9577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9578%
9579%  MagickSetImageColorspace() sets the image colorspace.
9580%
9581%  The format of the MagickSetImageColorspace method is:
9582%
9583%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9584%        const ColorspaceType colorspace)
9585%
9586%  A description of each parameter follows:
9587%
9588%    o wand: the magick wand.
9589%
9590%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9591%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9592%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9593%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9594%      HSLColorspace, or HWBColorspace.
9595%
9596*/
9597WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9598  const ColorspaceType colorspace)
9599{
9600  assert(wand != (MagickWand *) NULL);
9601  assert(wand->signature == WandSignature);
9602  if (wand->debug != MagickFalse)
9603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9604  if (wand->images == (Image *) NULL)
9605    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9606  return(SetImageColorspace(wand->images,colorspace));
9607}
9608
9609/*
9610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9611%                                                                             %
9612%                                                                             %
9613%                                                                             %
9614%   M a g i c k S e t I m a g e C o m p o s e                                 %
9615%                                                                             %
9616%                                                                             %
9617%                                                                             %
9618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9619%
9620%  MagickSetImageCompose() sets the image composite operator, useful for
9621%  specifying how to composite the image thumbnail when using the
9622%  MagickMontageImage() method.
9623%
9624%  The format of the MagickSetImageCompose method is:
9625%
9626%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9627%        const CompositeOperator compose)
9628%
9629%  A description of each parameter follows:
9630%
9631%    o wand: the magick wand.
9632%
9633%    o compose: the image composite operator.
9634%
9635*/
9636WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9637  const CompositeOperator compose)
9638{
9639  assert(wand != (MagickWand *) NULL);
9640  assert(wand->signature == WandSignature);
9641  if (wand->debug != MagickFalse)
9642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9643  if (wand->images == (Image *) NULL)
9644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9645  wand->images->compose=compose;
9646  return(MagickTrue);
9647}
9648
9649/*
9650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9651%                                                                             %
9652%                                                                             %
9653%                                                                             %
9654%   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                         %
9655%                                                                             %
9656%                                                                             %
9657%                                                                             %
9658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659%
9660%  MagickSetImageCompression() sets the image compression.
9661%
9662%  The format of the MagickSetImageCompression method is:
9663%
9664%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9665%        const CompressionType compression)
9666%
9667%  A description of each parameter follows:
9668%
9669%    o wand: the magick wand.
9670%
9671%    o compression: the image compression type.
9672%
9673*/
9674WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9675  const CompressionType compression)
9676{
9677  assert(wand != (MagickWand *) NULL);
9678  assert(wand->signature == WandSignature);
9679  if (wand->debug != MagickFalse)
9680    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9681  if (wand->images == (Image *) NULL)
9682    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9683  wand->images->compression=compression;
9684  return(MagickTrue);
9685}
9686
9687/*
9688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9689%                                                                             %
9690%                                                                             %
9691%                                                                             %
9692%   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           %
9693%                                                                             %
9694%                                                                             %
9695%                                                                             %
9696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9697%
9698%  MagickSetImageCompressionQuality() sets the image compression quality.
9699%
9700%  The format of the MagickSetImageCompressionQuality method is:
9701%
9702%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9703%        const size_t quality)
9704%
9705%  A description of each parameter follows:
9706%
9707%    o wand: the magick wand.
9708%
9709%    o quality: the image compression tlityype.
9710%
9711*/
9712WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9713  const size_t quality)
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->quality=quality;
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 D e l a y                                     %
9731%                                                                             %
9732%                                                                             %
9733%                                                                             %
9734%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9735%
9736%  MagickSetImageDelay() sets the image delay.
9737%
9738%  The format of the MagickSetImageDelay method is:
9739%
9740%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9741%        const size_t delay)
9742%
9743%  A description of each parameter follows:
9744%
9745%    o wand: the magick wand.
9746%
9747%    o delay: the image delay in ticks-per-second units.
9748%
9749*/
9750WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9751  const size_t delay)
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->delay=delay;
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 D e p t h                                     %
9769%                                                                             %
9770%                                                                             %
9771%                                                                             %
9772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9773%
9774%  MagickSetImageDepth() sets the image depth.
9775%
9776%  The format of the MagickSetImageDepth method is:
9777%
9778%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9779%        const size_t depth)
9780%
9781%  A description of each parameter follows:
9782%
9783%    o wand: the magick wand.
9784%
9785%    o depth: the image depth in bits: 8, 16, or 32.
9786%
9787*/
9788WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9789  const size_t depth)
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  return(SetImageDepth(wand->images,depth));
9798}
9799
9800/*
9801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9802%                                                                             %
9803%                                                                             %
9804%                                                                             %
9805%   M a g i c k S e t I m a g e D i s p o s e                                 %
9806%                                                                             %
9807%                                                                             %
9808%                                                                             %
9809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9810%
9811%  MagickSetImageDispose() sets the image disposal method.
9812%
9813%  The format of the MagickSetImageDispose method is:
9814%
9815%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9816%        const DisposeType dispose)
9817%
9818%  A description of each parameter follows:
9819%
9820%    o wand: the magick wand.
9821%
9822%    o dispose: the image disposeal type.
9823%
9824*/
9825WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9826  const DisposeType dispose)
9827{
9828  assert(wand != (MagickWand *) NULL);
9829  assert(wand->signature == WandSignature);
9830  if (wand->debug != MagickFalse)
9831    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9832  if (wand->images == (Image *) NULL)
9833    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9834  wand->images->dispose=dispose;
9835  return(MagickTrue);
9836}
9837
9838/*
9839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9840%                                                                             %
9841%                                                                             %
9842%                                                                             %
9843%   M a g i c k S e t I m a g e E x t e n t                                   %
9844%                                                                             %
9845%                                                                             %
9846%                                                                             %
9847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9848%
9849%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9850%
9851%  The format of the MagickSetImageExtent method is:
9852%
9853%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9854%        const size_t columns,const unsigned rows)
9855%
9856%  A description of each parameter follows:
9857%
9858%    o wand: the magick wand.
9859%
9860%    o columns:  The image width in pixels.
9861%
9862%    o rows:  The image height in pixels.
9863%
9864*/
9865WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9866  const size_t columns,const size_t rows)
9867{
9868  assert(wand != (MagickWand *) NULL);
9869  assert(wand->signature == WandSignature);
9870  if (wand->debug != MagickFalse)
9871    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9872  if (wand->images == (Image *) NULL)
9873    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9874  return(SetImageExtent(wand->images,columns,rows));
9875}
9876
9877/*
9878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9879%                                                                             %
9880%                                                                             %
9881%                                                                             %
9882%   M a g i c k S e t I m a g e F i l e n a m e                               %
9883%                                                                             %
9884%                                                                             %
9885%                                                                             %
9886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9887%
9888%  MagickSetImageFilename() sets the filename of a particular image in a
9889%  sequence.
9890%
9891%  The format of the MagickSetImageFilename method is:
9892%
9893%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9894%        const char *filename)
9895%
9896%  A description of each parameter follows:
9897%
9898%    o wand: the magick wand.
9899%
9900%    o filename: the image filename.
9901%
9902*/
9903WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9904  const char *filename)
9905{
9906  assert(wand != (MagickWand *) NULL);
9907  assert(wand->signature == WandSignature);
9908  if (wand->debug != MagickFalse)
9909    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9910  if (wand->images == (Image *) NULL)
9911    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9912  if (filename != (const char *) NULL)
9913    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9914  return(MagickTrue);
9915}
9916
9917/*
9918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9919%                                                                             %
9920%                                                                             %
9921%                                                                             %
9922%   M a g i c k S e t I m a g e F o r m a t                                   %
9923%                                                                             %
9924%                                                                             %
9925%                                                                             %
9926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9927%
9928%  MagickSetImageFormat() sets the format of a particular image in a
9929%  sequence.
9930%
9931%  The format of the MagickSetImageFormat method is:
9932%
9933%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9934%        const char *format)
9935%
9936%  A description of each parameter follows:
9937%
9938%    o wand: the magick wand.
9939%
9940%    o format: the image format.
9941%
9942*/
9943WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9944  const char *format)
9945{
9946  const MagickInfo
9947    *magick_info;
9948
9949  assert(wand != (MagickWand *) NULL);
9950  assert(wand->signature == WandSignature);
9951  if (wand->debug != MagickFalse)
9952    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9953  if (wand->images == (Image *) NULL)
9954    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9955  if ((format == (char *) NULL) || (*format == '\0'))
9956    {
9957      *wand->images->magick='\0';
9958      return(MagickTrue);
9959    }
9960  magick_info=GetMagickInfo(format,wand->exception);
9961  if (magick_info == (const MagickInfo *) NULL)
9962    return(MagickFalse);
9963  ClearMagickException(wand->exception);
9964  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9965  return(MagickTrue);
9966}
9967
9968/*
9969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9970%                                                                             %
9971%                                                                             %
9972%                                                                             %
9973%   M a g i c k S e t I m a g e F u z z                                       %
9974%                                                                             %
9975%                                                                             %
9976%                                                                             %
9977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9978%
9979%  MagickSetImageFuzz() sets the image fuzz.
9980%
9981%  The format of the MagickSetImageFuzz method is:
9982%
9983%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9984%        const double fuzz)
9985%
9986%  A description of each parameter follows:
9987%
9988%    o wand: the magick wand.
9989%
9990%    o fuzz: the image fuzz.
9991%
9992*/
9993WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9994  const double fuzz)
9995{
9996  assert(wand != (MagickWand *) NULL);
9997  assert(wand->signature == WandSignature);
9998  if (wand->debug != MagickFalse)
9999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10000  if (wand->images == (Image *) NULL)
10001    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10002  wand->images->fuzz=fuzz;
10003  return(MagickTrue);
10004}
10005
10006/*
10007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10008%                                                                             %
10009%                                                                             %
10010%                                                                             %
10011%   M a g i c k S e t I m a g e G a m m a                                     %
10012%                                                                             %
10013%                                                                             %
10014%                                                                             %
10015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10016%
10017%  MagickSetImageGamma() sets the image gamma.
10018%
10019%  The format of the MagickSetImageGamma method is:
10020%
10021%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10022%        const double gamma)
10023%
10024%  A description of each parameter follows:
10025%
10026%    o wand: the magick wand.
10027%
10028%    o gamma: the image gamma.
10029%
10030*/
10031WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10032  const double gamma)
10033{
10034  assert(wand != (MagickWand *) NULL);
10035  assert(wand->signature == WandSignature);
10036  if (wand->debug != MagickFalse)
10037    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10038  if (wand->images == (Image *) NULL)
10039    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10040  wand->images->gamma=gamma;
10041  return(MagickTrue);
10042}
10043
10044/*
10045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10046%                                                                             %
10047%                                                                             %
10048%                                                                             %
10049%   M a g i c k S e t I m a g e G r a v i t y                                 %
10050%                                                                             %
10051%                                                                             %
10052%                                                                             %
10053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10054%
10055%  MagickSetImageGravity() sets the image gravity type.
10056%
10057%  The format of the MagickSetImageGravity method is:
10058%
10059%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10060%        const GravityType gravity)
10061%
10062%  A description of each parameter follows:
10063%
10064%    o wand: the magick wand.
10065%
10066%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10067%      PlaneInterlace, PartitionInterlace.
10068%
10069*/
10070WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10071  const GravityType gravity)
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->gravity=gravity;
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 r e e n P r i m a r y                       %
10089%                                                                             %
10090%                                                                             %
10091%                                                                             %
10092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093%
10094%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10095%  point.
10096%
10097%  The format of the MagickSetImageGreenPrimary method is:
10098%
10099%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10100%        const double x,const double y)
10101%
10102%  A description of each parameter follows:
10103%
10104%    o wand: the magick wand.
10105%
10106%    o x: the green primary x-point.
10107%
10108%    o y: the green primary y-point.
10109%
10110%
10111*/
10112WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10113  const double x,const double y)
10114{
10115  assert(wand != (MagickWand *) NULL);
10116  assert(wand->signature == WandSignature);
10117  if (wand->debug != MagickFalse)
10118    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10119  if (wand->images == (Image *) NULL)
10120    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10121  wand->images->chromaticity.green_primary.x=x;
10122  wand->images->chromaticity.green_primary.y=y;
10123  return(MagickTrue);
10124}
10125
10126/*
10127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10128%                                                                             %
10129%                                                                             %
10130%                                                                             %
10131%   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                 %
10132%                                                                             %
10133%                                                                             %
10134%                                                                             %
10135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10136%
10137%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10138%
10139%  The format of the MagickSetImageInterlaceScheme method is:
10140%
10141%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10142%        const InterlaceType interlace)
10143%
10144%  A description of each parameter follows:
10145%
10146%    o wand: the magick wand.
10147%
10148%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10149%      PlaneInterlace, PartitionInterlace.
10150%
10151*/
10152WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10153  const InterlaceType interlace)
10154{
10155  assert(wand != (MagickWand *) NULL);
10156  assert(wand->signature == WandSignature);
10157  if (wand->debug != MagickFalse)
10158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10159  if (wand->images == (Image *) NULL)
10160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10161  wand->images->interlace=interlace;
10162  return(MagickTrue);
10163}
10164
10165/*
10166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10167%                                                                             %
10168%                                                                             %
10169%                                                                             %
10170%   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             %
10171%                                                                             %
10172%                                                                             %
10173%                                                                             %
10174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10175%
10176%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10177%
10178%  The format of the MagickSetImageInterpolateMethod method is:
10179%
10180%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10181%        const InterpolatePixelMethod method)
10182%
10183%  A description of each parameter follows:
10184%
10185%    o wand: the magick wand.
10186%
10187%    o method: the image interpole pixel methods: choose from Undefined,
10188%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10189%
10190*/
10191WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10192  const InterpolatePixelMethod method)
10193{
10194  assert(wand != (MagickWand *) NULL);
10195  assert(wand->signature == WandSignature);
10196  if (wand->debug != MagickFalse)
10197    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10198  if (wand->images == (Image *) NULL)
10199    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10200  wand->images->interpolate=method;
10201  return(MagickTrue);
10202}
10203
10204/*
10205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10206%                                                                             %
10207%                                                                             %
10208%                                                                             %
10209%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10210%                                                                             %
10211%                                                                             %
10212%                                                                             %
10213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10214%
10215%  MagickSetImageIterations() sets the image iterations.
10216%
10217%  The format of the MagickSetImageIterations method is:
10218%
10219%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10220%        const size_t iterations)
10221%
10222%  A description of each parameter follows:
10223%
10224%    o wand: the magick wand.
10225%
10226%    o delay: the image delay in 1/100th of a second.
10227%
10228*/
10229WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10230  const size_t iterations)
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->iterations=iterations;
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 M a t t e                                     %
10248%                                                                             %
10249%                                                                             %
10250%                                                                             %
10251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10252%
10253%  MagickSetImageMatte() sets the image matte channel.
10254%
10255%  The format of the MagickSetImageMatteColor method is:
10256%
10257%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10258%        const MagickBooleanType *matte)
10259%
10260%  A description of each parameter follows:
10261%
10262%    o wand: the magick wand.
10263%
10264%    o matte: Set to MagickTrue to enable the image matte channel otherwise
10265%      MagickFalse.
10266%
10267*/
10268WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10269  const MagickBooleanType matte)
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  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10278    (void) SetImageOpacity(wand->images,OpaqueAlpha);
10279  wand->images->matte=matte;
10280  return(MagickTrue);
10281}
10282
10283/*
10284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10285%                                                                             %
10286%                                                                             %
10287%                                                                             %
10288%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10289%                                                                             %
10290%                                                                             %
10291%                                                                             %
10292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10293%
10294%  MagickSetImageMatteColor() sets the image matte color.
10295%
10296%  The format of the MagickSetImageMatteColor method is:
10297%
10298%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10299%        const PixelWand *matte)
10300%
10301%  A description of each parameter follows:
10302%
10303%    o wand: the magick wand.
10304%
10305%    o matte: the matte pixel wand.
10306%
10307*/
10308WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10309  const PixelWand *matte)
10310{
10311  assert(wand != (MagickWand *) NULL);
10312  assert(wand->signature == WandSignature);
10313  if (wand->debug != MagickFalse)
10314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10315  if (wand->images == (Image *) NULL)
10316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10317  PixelGetQuantumPacket(matte,&wand->images->matte_color);
10318  return(MagickTrue);
10319}
10320
10321/*
10322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10323%                                                                             %
10324%                                                                             %
10325%                                                                             %
10326%   M a g i c k S e t I m a g e O p a c i t y                                 %
10327%                                                                             %
10328%                                                                             %
10329%                                                                             %
10330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10331%
10332%  MagickSetImageOpacity() sets the image to the specified opacity level.
10333%
10334%  The format of the MagickSetImageOpacity method is:
10335%
10336%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10337%        const double alpha)
10338%
10339%  A description of each parameter follows:
10340%
10341%    o wand: the magick wand.
10342%
10343%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10344%      transparent.
10345%
10346*/
10347WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10348  const double alpha)
10349{
10350  MagickBooleanType
10351    status;
10352
10353  assert(wand != (MagickWand *) NULL);
10354  assert(wand->signature == WandSignature);
10355  if (wand->debug != MagickFalse)
10356    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10357  if (wand->images == (Image *) NULL)
10358    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10359  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
10360  if (status == MagickFalse)
10361    InheritException(wand->exception,&wand->images->exception);
10362  return(status);
10363}
10364
10365/*
10366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10367%                                                                             %
10368%                                                                             %
10369%                                                                             %
10370%   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                         %
10371%                                                                             %
10372%                                                                             %
10373%                                                                             %
10374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10375%
10376%  MagickSetImageOrientation() sets the image orientation.
10377%
10378%  The format of the MagickSetImageOrientation method is:
10379%
10380%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10381%        const OrientationType orientation)
10382%
10383%  A description of each parameter follows:
10384%
10385%    o wand: the magick wand.
10386%
10387%    o orientation: the image orientation type.
10388%
10389*/
10390WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10391  const OrientationType orientation)
10392{
10393  assert(wand != (MagickWand *) NULL);
10394  assert(wand->signature == WandSignature);
10395  if (wand->debug != MagickFalse)
10396    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10397  if (wand->images == (Image *) NULL)
10398    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10399  wand->images->orientation=orientation;
10400  return(MagickTrue);
10401}
10402
10403/*
10404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10405%                                                                             %
10406%                                                                             %
10407%                                                                             %
10408%   M a g i c k S e t I m a g e P a g e                                       %
10409%                                                                             %
10410%                                                                             %
10411%                                                                             %
10412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413%
10414%  MagickSetImagePage() sets the page geometry of the image.
10415%
10416%  The format of the MagickSetImagePage method is:
10417%
10418%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10419%        const size_t width,const size_t height,const ssize_t x,
10420%        const ssize_t y)
10421%
10422%  A description of each parameter follows:
10423%
10424%    o wand: the magick wand.
10425%
10426%    o width: the page width.
10427%
10428%    o height: the page height.
10429%
10430%    o x: the page x-offset.
10431%
10432%    o y: the page y-offset.
10433%
10434*/
10435WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10436  const size_t width,const size_t height,const ssize_t x,
10437  const ssize_t y)
10438{
10439  assert(wand != (MagickWand *) NULL);
10440  assert(wand->signature == WandSignature);
10441  if (wand->debug != MagickFalse)
10442    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10443  if (wand->images == (Image *) NULL)
10444    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10445  wand->images->page.width=width;
10446  wand->images->page.height=height;
10447  wand->images->page.x=x;
10448  wand->images->page.y=y;
10449  return(MagickTrue);
10450}
10451
10452/*
10453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10454%                                                                             %
10455%                                                                             %
10456%                                                                             %
10457%   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                 %
10458%                                                                             %
10459%                                                                             %
10460%                                                                             %
10461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10462%
10463%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10464%  specified method and returns the previous progress monitor if any.  The
10465%  progress monitor method looks like this:
10466%
10467%    MagickBooleanType MagickProgressMonitor(const char *text,
10468%      const MagickOffsetType offset,const MagickSizeType span,
10469%      void *client_data)
10470%
10471%  If the progress monitor returns MagickFalse, the current operation is
10472%  interrupted.
10473%
10474%  The format of the MagickSetImageProgressMonitor method is:
10475%
10476%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10477%        const MagickProgressMonitor progress_monitor,void *client_data)
10478%
10479%  A description of each parameter follows:
10480%
10481%    o wand: the magick wand.
10482%
10483%    o progress_monitor: Specifies a pointer to a method to monitor progress
10484%      of an image operation.
10485%
10486%    o client_data: Specifies a pointer to any client data.
10487%
10488*/
10489WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10490  const MagickProgressMonitor progress_monitor,void *client_data)
10491{
10492  MagickProgressMonitor
10493    previous_monitor;
10494
10495  assert(wand != (MagickWand *) NULL);
10496  assert(wand->signature == WandSignature);
10497  if (wand->debug != MagickFalse)
10498    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10499  if (wand->images == (Image *) NULL)
10500    {
10501      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10502        "ContainsNoImages","`%s'",wand->name);
10503      return((MagickProgressMonitor) NULL);
10504    }
10505  previous_monitor=SetImageProgressMonitor(wand->images,
10506    progress_monitor,client_data);
10507  return(previous_monitor);
10508}
10509
10510/*
10511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10512%                                                                             %
10513%                                                                             %
10514%                                                                             %
10515%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10516%                                                                             %
10517%                                                                             %
10518%                                                                             %
10519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10520%
10521%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10522%
10523%  The format of the MagickSetImageRedPrimary method is:
10524%
10525%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10526%        const double x,const double y)
10527%
10528%  A description of each parameter follows:
10529%
10530%    o wand: the magick wand.
10531%
10532%    o x: the red primary x-point.
10533%
10534%    o y: the red primary y-point.
10535%
10536*/
10537WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10538  const double x,const double y)
10539{
10540  assert(wand != (MagickWand *) NULL);
10541  assert(wand->signature == WandSignature);
10542  if (wand->debug != MagickFalse)
10543    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10544  if (wand->images == (Image *) NULL)
10545    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10546  wand->images->chromaticity.red_primary.x=x;
10547  wand->images->chromaticity.red_primary.y=y;
10548  return(MagickTrue);
10549}
10550
10551/*
10552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10553%                                                                             %
10554%                                                                             %
10555%                                                                             %
10556%   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                 %
10557%                                                                             %
10558%                                                                             %
10559%                                                                             %
10560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10561%
10562%  MagickSetImageRenderingIntent() sets the image rendering intent.
10563%
10564%  The format of the MagickSetImageRenderingIntent method is:
10565%
10566%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10567%        const RenderingIntent rendering_intent)
10568%
10569%  A description of each parameter follows:
10570%
10571%    o wand: the magick wand.
10572%
10573%    o rendering_intent: the image rendering intent: UndefinedIntent,
10574%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10575%
10576*/
10577WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10578  const RenderingIntent rendering_intent)
10579{
10580  assert(wand != (MagickWand *) NULL);
10581  assert(wand->signature == WandSignature);
10582  if (wand->debug != MagickFalse)
10583    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10584  if (wand->images == (Image *) NULL)
10585    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10586  wand->images->rendering_intent=rendering_intent;
10587  return(MagickTrue);
10588}
10589
10590/*
10591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10592%                                                                             %
10593%                                                                             %
10594%                                                                             %
10595%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10596%                                                                             %
10597%                                                                             %
10598%                                                                             %
10599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10600%
10601%  MagickSetImageResolution() sets the image resolution.
10602%
10603%  The format of the MagickSetImageResolution method is:
10604%
10605%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10606%        const double x_resolution,const doubtl y_resolution)
10607%
10608%  A description of each parameter follows:
10609%
10610%    o wand: the magick wand.
10611%
10612%    o x_resolution: the image x resolution.
10613%
10614%    o y_resolution: the image y resolution.
10615%
10616*/
10617WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10618  const double x_resolution,const double y_resolution)
10619{
10620  assert(wand != (MagickWand *) NULL);
10621  assert(wand->signature == WandSignature);
10622  if (wand->debug != MagickFalse)
10623    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10624  if (wand->images == (Image *) NULL)
10625    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10626  wand->images->x_resolution=x_resolution;
10627  wand->images->y_resolution=y_resolution;
10628  return(MagickTrue);
10629}
10630
10631/*
10632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10633%                                                                             %
10634%                                                                             %
10635%                                                                             %
10636%   M a g i c k S e t I m a g e S c e n e                                     %
10637%                                                                             %
10638%                                                                             %
10639%                                                                             %
10640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10641%
10642%  MagickSetImageScene() sets the image scene.
10643%
10644%  The format of the MagickSetImageScene method is:
10645%
10646%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10647%        const size_t scene)
10648%
10649%  A description of each parameter follows:
10650%
10651%    o wand: the magick wand.
10652%
10653%    o delay: the image scene number.
10654%
10655*/
10656WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10657  const size_t scene)
10658{
10659  assert(wand != (MagickWand *) NULL);
10660  assert(wand->signature == WandSignature);
10661  if (wand->debug != MagickFalse)
10662    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10663  if (wand->images == (Image *) NULL)
10664    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10665  wand->images->scene=scene;
10666  return(MagickTrue);
10667}
10668
10669/*
10670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10671%                                                                             %
10672%                                                                             %
10673%                                                                             %
10674%   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                   %
10675%                                                                             %
10676%                                                                             %
10677%                                                                             %
10678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10679%
10680%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10681%
10682%  The format of the MagickSetImageTicksPerSecond method is:
10683%
10684%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10685%        const ssize_t ticks_per-second)
10686%
10687%  A description of each parameter follows:
10688%
10689%    o wand: the magick wand.
10690%
10691%    o ticks_per_second: the units to use for the image delay.
10692%
10693*/
10694WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10695  const ssize_t ticks_per_second)
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->ticks_per_second=ticks_per_second;
10704  return(MagickTrue);
10705}
10706
10707/*
10708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10709%                                                                             %
10710%                                                                             %
10711%                                                                             %
10712%   M a g i c k S e t I m a g e T y p e                                       %
10713%                                                                             %
10714%                                                                             %
10715%                                                                             %
10716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10717%
10718%  MagickSetImageType() sets the image type.
10719%
10720%  The format of the MagickSetImageType method is:
10721%
10722%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10723%        const ImageType image_type)
10724%
10725%  A description of each parameter follows:
10726%
10727%    o wand: the magick wand.
10728%
10729%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10730%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10731%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10732%      or OptimizeType.
10733%
10734*/
10735WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10736  const ImageType image_type)
10737{
10738  assert(wand != (MagickWand *) NULL);
10739  assert(wand->signature == WandSignature);
10740  if (wand->debug != MagickFalse)
10741    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10742  if (wand->images == (Image *) NULL)
10743    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10744  return(SetImageType(wand->images,image_type));
10745}
10746
10747/*
10748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10749%                                                                             %
10750%                                                                             %
10751%                                                                             %
10752%   M a g i c k S e t I m a g e U n i t s                                     %
10753%                                                                             %
10754%                                                                             %
10755%                                                                             %
10756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10757%
10758%  MagickSetImageUnits() sets the image units of resolution.
10759%
10760%  The format of the MagickSetImageUnits method is:
10761%
10762%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10763%        const ResolutionType units)
10764%
10765%  A description of each parameter follows:
10766%
10767%    o wand: the magick wand.
10768%
10769%    o units: the image units of resolution : UndefinedResolution,
10770%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10771%
10772*/
10773WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10774  const ResolutionType units)
10775{
10776  assert(wand != (MagickWand *) NULL);
10777  assert(wand->signature == WandSignature);
10778  if (wand->debug != MagickFalse)
10779    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10780  if (wand->images == (Image *) NULL)
10781    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10782  wand->images->units=units;
10783  return(MagickTrue);
10784}
10785
10786/*
10787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10788%                                                                             %
10789%                                                                             %
10790%                                                                             %
10791%   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           %
10792%                                                                             %
10793%                                                                             %
10794%                                                                             %
10795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10796%
10797%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10798%
10799%  The format of the MagickSetImageVirtualPixelMethod method is:
10800%
10801%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10802%        const VirtualPixelMethod method)
10803%
10804%  A description of each parameter follows:
10805%
10806%    o wand: the magick wand.
10807%
10808%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10809%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10810%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10811%
10812*/
10813WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10814  const VirtualPixelMethod method)
10815{
10816  assert(wand != (MagickWand *) NULL);
10817  assert(wand->signature == WandSignature);
10818  if (wand->debug != MagickFalse)
10819    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10820  if (wand->images == (Image *) NULL)
10821    return(UndefinedVirtualPixelMethod);
10822  return(SetImageVirtualPixelMethod(wand->images,method));
10823}
10824
10825/*
10826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10827%                                                                             %
10828%                                                                             %
10829%                                                                             %
10830%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10831%                                                                             %
10832%                                                                             %
10833%                                                                             %
10834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10835%
10836%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10837%
10838%  The format of the MagickSetImageWhitePoint method is:
10839%
10840%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10841%        const double x,const double y)
10842%
10843%  A description of each parameter follows:
10844%
10845%    o wand: the magick wand.
10846%
10847%    o x: the white x-point.
10848%
10849%    o y: the white y-point.
10850%
10851*/
10852WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10853  const double x,const double y)
10854{
10855  assert(wand != (MagickWand *) NULL);
10856  assert(wand->signature == WandSignature);
10857  if (wand->debug != MagickFalse)
10858    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10859  if (wand->images == (Image *) NULL)
10860    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10861  wand->images->chromaticity.white_point.x=x;
10862  wand->images->chromaticity.white_point.y=y;
10863  return(MagickTrue);
10864}
10865
10866/*
10867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10868%                                                                             %
10869%                                                                             %
10870%                                                                             %
10871%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10872%                                                                             %
10873%                                                                             %
10874%                                                                             %
10875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10876%
10877%  MagickShadeImage() shines a distant light on an image to create a
10878%  three-dimensional effect. You control the positioning of the light with
10879%  azimuth and elevation; azimuth is measured in degrees off the x axis
10880%  and elevation is measured in pixels above the Z axis.
10881%
10882%  The format of the MagickShadeImage method is:
10883%
10884%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10885%        const MagickBooleanType gray,const double azimuth,
10886%        const double elevation)
10887%
10888%  A description of each parameter follows:
10889%
10890%    o wand: the magick wand.
10891%
10892%    o gray: A value other than zero shades the intensity of each pixel.
10893%
10894%    o azimuth, elevation:  Define the light source direction.
10895%
10896*/
10897WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10898  const MagickBooleanType gray,const double asimuth,const double elevation)
10899{
10900  Image
10901    *shade_image;
10902
10903  assert(wand != (MagickWand *) NULL);
10904  assert(wand->signature == WandSignature);
10905  if (wand->debug != MagickFalse)
10906    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10907  if (wand->images == (Image *) NULL)
10908    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10909  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10910  if (shade_image == (Image *) NULL)
10911    return(MagickFalse);
10912  ReplaceImageInList(&wand->images,shade_image);
10913  return(MagickTrue);
10914}
10915
10916/*
10917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10918%                                                                             %
10919%                                                                             %
10920%                                                                             %
10921%   M a g i c k S h a d o w I m a g e                                         %
10922%                                                                             %
10923%                                                                             %
10924%                                                                             %
10925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10926%
10927%  MagickShadowImage() simulates an image shadow.
10928%
10929%  The format of the MagickShadowImage method is:
10930%
10931%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10932%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10933%
10934%  A description of each parameter follows:
10935%
10936%    o wand: the magick wand.
10937%
10938%    o opacity: percentage transparency.
10939%
10940%    o sigma: the standard deviation of the Gaussian, in pixels.
10941%
10942%    o x: the shadow x-offset.
10943%
10944%    o y: the shadow y-offset.
10945%
10946*/
10947WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10948  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10949{
10950  Image
10951    *shadow_image;
10952
10953  assert(wand != (MagickWand *) NULL);
10954  assert(wand->signature == WandSignature);
10955  if (wand->debug != MagickFalse)
10956    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10957  if (wand->images == (Image *) NULL)
10958    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10959  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10960  if (shadow_image == (Image *) NULL)
10961    return(MagickFalse);
10962  ReplaceImageInList(&wand->images,shadow_image);
10963  return(MagickTrue);
10964}
10965
10966/*
10967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10968%                                                                             %
10969%                                                                             %
10970%                                                                             %
10971%   M a g i c k S h a r p e n I m a g e                                       %
10972%                                                                             %
10973%                                                                             %
10974%                                                                             %
10975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10976%
10977%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10978%  Gaussian operator of the given radius and standard deviation (sigma).
10979%  For reasonable results, the radius should be larger than sigma.  Use a
10980%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10981%
10982%  The format of the MagickSharpenImage method is:
10983%
10984%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10985%        const double radius,const double sigma)
10986%      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10987%        const ChannelType channel,const double radius,const double sigma)
10988%
10989%  A description of each parameter follows:
10990%
10991%    o wand: the magick wand.
10992%
10993%    o channel: the image channel(s).
10994%
10995%    o radius: the radius of the Gaussian, in pixels, not counting the center
10996%      pixel.
10997%
10998%    o sigma: the standard deviation of the Gaussian, in pixels.
10999%
11000*/
11001
11002WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11003  const double radius,const double sigma)
11004{
11005  MagickBooleanType
11006    status;
11007
11008  status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11009  return(status);
11010}
11011
11012WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11013  const ChannelType channel,const double radius,const double sigma)
11014{
11015  Image
11016    *sharp_image;
11017
11018  assert(wand != (MagickWand *) NULL);
11019  assert(wand->signature == WandSignature);
11020  if (wand->debug != MagickFalse)
11021    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11022  if (wand->images == (Image *) NULL)
11023    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11024  sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11025    wand->exception);
11026  if (sharp_image == (Image *) NULL)
11027    return(MagickFalse);
11028  ReplaceImageInList(&wand->images,sharp_image);
11029  return(MagickTrue);
11030}
11031
11032/*
11033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11034%                                                                             %
11035%                                                                             %
11036%                                                                             %
11037%   M a g i c k S h a v e I m a g e                                           %
11038%                                                                             %
11039%                                                                             %
11040%                                                                             %
11041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11042%
11043%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11044%  memory necessary for the new Image structure and returns a pointer to the
11045%  new image.
11046%
11047%  The format of the MagickShaveImage method is:
11048%
11049%      MagickBooleanType MagickShaveImage(MagickWand *wand,
11050%        const size_t columns,const size_t rows)
11051%
11052%  A description of each parameter follows:
11053%
11054%    o wand: the magick wand.
11055%
11056%    o columns: the number of columns in the scaled image.
11057%
11058%    o rows: the number of rows in the scaled image.
11059%
11060%
11061*/
11062WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11063  const size_t columns,const size_t rows)
11064{
11065  Image
11066    *shave_image;
11067
11068  RectangleInfo
11069    shave_info;
11070
11071  assert(wand != (MagickWand *) NULL);
11072  assert(wand->signature == WandSignature);
11073  if (wand->debug != MagickFalse)
11074    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11075  if (wand->images == (Image *) NULL)
11076    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11077  shave_info.width=columns;
11078  shave_info.height=rows;
11079  shave_info.x=0;
11080  shave_info.y=0;
11081  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11082  if (shave_image == (Image *) NULL)
11083    return(MagickFalse);
11084  ReplaceImageInList(&wand->images,shave_image);
11085  return(MagickTrue);
11086}
11087
11088/*
11089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090%                                                                             %
11091%                                                                             %
11092%                                                                             %
11093%   M a g i c k S h e a r I m a g e                                           %
11094%                                                                             %
11095%                                                                             %
11096%                                                                             %
11097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098%
11099%  MagickShearImage() slides one edge of an image along the X or Y axis,
11100%  creating a parallelogram.  An X direction shear slides an edge along the X
11101%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11102%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11103%  is measured relative to the Y axis, and similarly, for Y direction shears
11104%  y_shear is measured relative to the X axis.  Empty triangles left over from
11105%  shearing the image are filled with the background color.
11106%
11107%  The format of the MagickShearImage method is:
11108%
11109%      MagickBooleanType MagickShearImage(MagickWand *wand,
11110%        const PixelWand *background,const double x_shear,onst double y_shear)
11111%
11112%  A description of each parameter follows:
11113%
11114%    o wand: the magick wand.
11115%
11116%    o background: the background pixel wand.
11117%
11118%    o x_shear: the number of degrees to shear the image.
11119%
11120%    o y_shear: the number of degrees to shear the image.
11121%
11122*/
11123WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11124  const PixelWand *background,const double x_shear,const double y_shear)
11125{
11126  Image
11127    *shear_image;
11128
11129  assert(wand != (MagickWand *) NULL);
11130  assert(wand->signature == WandSignature);
11131  if (wand->debug != MagickFalse)
11132    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11133  if (wand->images == (Image *) NULL)
11134    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11135  PixelGetQuantumPacket(background,&wand->images->background_color);
11136  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11137  if (shear_image == (Image *) NULL)
11138    return(MagickFalse);
11139  ReplaceImageInList(&wand->images,shear_image);
11140  return(MagickTrue);
11141}
11142
11143/*
11144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11145%                                                                             %
11146%                                                                             %
11147%                                                                             %
11148%   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                   %
11149%                                                                             %
11150%                                                                             %
11151%                                                                             %
11152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11153%
11154%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11155%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11156%  image using a sigmoidal transfer function without saturating highlights or
11157%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11158%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11159%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11160%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11161%  is reduced.
11162%
11163%  The format of the MagickSigmoidalContrastImage method is:
11164%
11165%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11166%        const MagickBooleanType sharpen,const double alpha,const double beta)
11167%      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11168%        const ChannelType channel,const MagickBooleanType sharpen,
11169%        const double alpha,const double beta)
11170%
11171%  A description of each parameter follows:
11172%
11173%    o wand: the magick wand.
11174%
11175%    o channel: Identify which channel to level: RedChannel, GreenChannel,
11176%
11177%    o sharpen: Increase or decrease image contrast.
11178%
11179%    o alpha: strength of the contrast, the larger the number the more
11180%      'threshold-like' it becomes.
11181%
11182%    o beta: midpoint of the function as a color value 0 to QuantumRange.
11183%
11184*/
11185
11186WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11187  const MagickBooleanType sharpen,const double alpha,const double beta)
11188{
11189  MagickBooleanType
11190    status;
11191
11192  status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11193    alpha,beta);
11194  return(status);
11195}
11196
11197WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11198  MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11199  const double alpha,const double beta)
11200{
11201  MagickBooleanType
11202    status;
11203
11204  assert(wand != (MagickWand *) NULL);
11205  assert(wand->signature == WandSignature);
11206  if (wand->debug != MagickFalse)
11207    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11208  if (wand->images == (Image *) NULL)
11209    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11210  status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11211  if (status == MagickFalse)
11212    InheritException(wand->exception,&wand->images->exception);
11213  return(status);
11214}
11215
11216/*
11217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11218%                                                                             %
11219%                                                                             %
11220%                                                                             %
11221%   M a g i c k S i m i l a r i t y I m a g e                                 %
11222%                                                                             %
11223%                                                                             %
11224%                                                                             %
11225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11226%
11227%  MagickSimilarityImage() compares the reference image of the image and
11228%  returns the best match offset.  In addition, it returns a similarity image
11229%  such that an exact match location is completely white and if none of the
11230%  pixels match, black, otherwise some gray level in-between.
11231%
11232%  The format of the MagickSimilarityImage method is:
11233%
11234%      MagickWand *MagickSimilarityImage(MagickWand *wand,
11235%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11236%
11237%  A description of each parameter follows:
11238%
11239%    o wand: the magick wand.
11240%
11241%    o reference: the reference wand.
11242%
11243%    o offset: the best match offset of the reference image within the image.
11244%
11245%    o similarity: the computed similarity between the images.
11246%
11247*/
11248WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11249  const MagickWand *reference,RectangleInfo *offset,double *similarity)
11250{
11251  Image
11252    *similarity_image;
11253
11254  assert(wand != (MagickWand *) NULL);
11255  assert(wand->signature == WandSignature);
11256  if (wand->debug != MagickFalse)
11257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11258  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11259    {
11260      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11261        "ContainsNoImages","`%s'",wand->name);
11262      return((MagickWand *) NULL);
11263    }
11264  similarity_image=SimilarityImage(wand->images,reference->images,offset,
11265    similarity,&wand->images->exception);
11266  if (similarity_image == (Image *) NULL)
11267    return((MagickWand *) NULL);
11268  return(CloneMagickWandFromImages(wand,similarity_image));
11269}
11270
11271/*
11272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11273%                                                                             %
11274%                                                                             %
11275%                                                                             %
11276%   M a g i c k S k e t c h I m a g e                                         %
11277%                                                                             %
11278%                                                                             %
11279%                                                                             %
11280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11281%
11282%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11283%  a Gaussian operator of the given radius and standard deviation (sigma).
11284%  For reasonable results, radius should be larger than sigma.  Use a
11285%  radius of 0 and SketchImage() selects a suitable radius for you.
11286%  Angle gives the angle of the blurring motion.
11287%
11288%  The format of the MagickSketchImage method is:
11289%
11290%      MagickBooleanType MagickSketchImage(MagickWand *wand,
11291%        const double radius,const double sigma,const double angle)
11292%
11293%  A description of each parameter follows:
11294%
11295%    o wand: the magick wand.
11296%
11297%    o radius: the radius of the Gaussian, in pixels, not counting
11298%      the center pixel.
11299%
11300%    o sigma: the standard deviation of the Gaussian, in pixels.
11301%
11302%    o angle: Apply the effect along this angle.
11303%
11304*/
11305WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11306  const double radius,const double sigma,const double angle)
11307{
11308  Image
11309    *sketch_image;
11310
11311  assert(wand != (MagickWand *) NULL);
11312  assert(wand->signature == WandSignature);
11313  if (wand->debug != MagickFalse)
11314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11315  if (wand->images == (Image *) NULL)
11316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11317  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11318  if (sketch_image == (Image *) NULL)
11319    return(MagickFalse);
11320  ReplaceImageInList(&wand->images,sketch_image);
11321  return(MagickTrue);
11322}
11323
11324/*
11325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11326%                                                                             %
11327%                                                                             %
11328%                                                                             %
11329%   M a g i c k S m u s h I m a g e s                                         %
11330%                                                                             %
11331%                                                                             %
11332%                                                                             %
11333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334%
11335%  MagickSmushImages() takes all images from the current image pointer to the
11336%  end of the image list and smushs them to each other top-to-bottom if the
11337%  stack parameter is true, otherwise left-to-right.
11338%
11339%  The format of the MagickSmushImages method is:
11340%
11341%      MagickWand *MagickSmushImages(MagickWand *wand,
11342%        const MagickBooleanType stack,const ssize_t offset)
11343%
11344%  A description of each parameter follows:
11345%
11346%    o wand: the magick wand.
11347%
11348%    o stack: By default, images are stacked left-to-right. Set stack to
11349%      MagickTrue to stack them top-to-bottom.
11350%
11351%    o offset: minimum distance in pixels between images.
11352%
11353*/
11354WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11355  const MagickBooleanType stack,const ssize_t offset)
11356{
11357  Image
11358    *smush_image;
11359
11360  assert(wand != (MagickWand *) NULL);
11361  assert(wand->signature == WandSignature);
11362  if (wand->debug != MagickFalse)
11363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11364  if (wand->images == (Image *) NULL)
11365    return((MagickWand *) NULL);
11366  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11367  if (smush_image == (Image *) NULL)
11368    return((MagickWand *) NULL);
11369  return(CloneMagickWandFromImages(wand,smush_image));
11370}
11371
11372/*
11373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11374%                                                                             %
11375%                                                                             %
11376%                                                                             %
11377%     M a g i c k S o l a r i z e I m a g e                                   %
11378%                                                                             %
11379%                                                                             %
11380%                                                                             %
11381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11382%
11383%  MagickSolarizeImage() applies a special effect to the image, similar to the
11384%  effect achieved in a photo darkroom by selectively exposing areas of photo
11385%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11386%  measure of the extent of the solarization.
11387%
11388%  The format of the MagickSolarizeImage method is:
11389%
11390%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11391%        const double threshold)
11392%
11393%  A description of each parameter follows:
11394%
11395%    o wand: the magick wand.
11396%
11397%    o threshold:  Define the extent of the solarization.
11398%
11399*/
11400WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11401  const double threshold)
11402{
11403  MagickBooleanType
11404    status;
11405
11406  assert(wand != (MagickWand *) NULL);
11407  assert(wand->signature == WandSignature);
11408  if (wand->debug != MagickFalse)
11409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11410  if (wand->images == (Image *) NULL)
11411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11412  status=SolarizeImage(wand->images,threshold);
11413  if (status == MagickFalse)
11414    InheritException(wand->exception,&wand->images->exception);
11415  return(status);
11416}
11417
11418/*
11419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11420%                                                                             %
11421%                                                                             %
11422%                                                                             %
11423%   M a g i c k S p a r s e C o l o r I m a g e                               %
11424%                                                                             %
11425%                                                                             %
11426%                                                                             %
11427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11428%
11429%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11430%  colors found at those coordinates, across the whole image, using various
11431%  methods.
11432%
11433%  The format of the MagickSparseColorImage method is:
11434%
11435%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11436%        const ChannelType channel,const SparseColorMethod method,
11437%        const size_t number_arguments,const double *arguments)
11438%
11439%  A description of each parameter follows:
11440%
11441%    o image: the image to be sparseed.
11442%
11443%    o method: the method of image sparseion.
11444%
11445%        ArcSparseColorion will always ignore source image offset, and always
11446%        'bestfit' the destination image with the top left corner offset
11447%        relative to the polar mapping center.
11448%
11449%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11450%        style of image sparseion.
11451%
11452%        Affine, Perspective, and Bilinear, will do least squares fitting of
11453%        the distrotion when more than the minimum number of control point
11454%        pairs are provided.
11455%
11456%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11457%        less than 4 control point pairs are provided. While Affine sparseions
11458%        will let you use any number of control point pairs, that is Zero pairs
11459%        is a No-Op (viewport only) distrotion, one pair is a translation and
11460%        two pairs of control points will do a scale-rotate-translate, without
11461%        any shearing.
11462%
11463%    o number_arguments: the number of arguments given for this sparseion
11464%      method.
11465%
11466%    o arguments: the arguments for this sparseion method.
11467%
11468*/
11469WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11470  const ChannelType channel,const SparseColorMethod method,
11471  const size_t number_arguments,const double *arguments)
11472{
11473  Image
11474    *sparse_image;
11475
11476  assert(wand != (MagickWand *) NULL);
11477  assert(wand->signature == WandSignature);
11478  if (wand->debug != MagickFalse)
11479    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11480  if (wand->images == (Image *) NULL)
11481    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11482  sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11483    arguments,wand->exception);
11484  if (sparse_image == (Image *) NULL)
11485    return(MagickFalse);
11486  ReplaceImageInList(&wand->images,sparse_image);
11487  return(MagickTrue);
11488}
11489
11490/*
11491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11492%                                                                             %
11493%                                                                             %
11494%                                                                             %
11495%   M a g i c k S p l i c e I m a g e                                         %
11496%                                                                             %
11497%                                                                             %
11498%                                                                             %
11499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11500%
11501%  MagickSpliceImage() splices a solid color into the image.
11502%
11503%  The format of the MagickSpliceImage method is:
11504%
11505%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11506%        const size_t width,const size_t height,const ssize_t x,
11507%        const ssize_t y)
11508%
11509%  A description of each parameter follows:
11510%
11511%    o wand: the magick wand.
11512%
11513%    o width: the region width.
11514%
11515%    o height: the region height.
11516%
11517%    o x: the region x offset.
11518%
11519%    o y: the region y offset.
11520%
11521*/
11522WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11523  const size_t width,const size_t height,const ssize_t x,
11524  const ssize_t y)
11525{
11526  Image
11527    *splice_image;
11528
11529  RectangleInfo
11530    splice;
11531
11532  assert(wand != (MagickWand *) NULL);
11533  assert(wand->signature == WandSignature);
11534  if (wand->debug != MagickFalse)
11535    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11536  if (wand->images == (Image *) NULL)
11537    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11538  splice.width=width;
11539  splice.height=height;
11540  splice.x=x;
11541  splice.y=y;
11542  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11543  if (splice_image == (Image *) NULL)
11544    return(MagickFalse);
11545  ReplaceImageInList(&wand->images,splice_image);
11546  return(MagickTrue);
11547}
11548
11549/*
11550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11551%                                                                             %
11552%                                                                             %
11553%                                                                             %
11554%   M a g i c k S p r e a d I m a g e                                         %
11555%                                                                             %
11556%                                                                             %
11557%                                                                             %
11558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11559%
11560%  MagickSpreadImage() is a special effects method that randomly displaces each
11561%  pixel in a block defined by the radius parameter.
11562%
11563%  The format of the MagickSpreadImage method is:
11564%
11565%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11566%
11567%  A description of each parameter follows:
11568%
11569%    o wand: the magick wand.
11570%
11571%    o radius:  Choose a random pixel in a neighborhood of this extent.
11572%
11573*/
11574WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11575  const double radius)
11576{
11577  Image
11578    *spread_image;
11579
11580  assert(wand != (MagickWand *) NULL);
11581  assert(wand->signature == WandSignature);
11582  if (wand->debug != MagickFalse)
11583    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11584  if (wand->images == (Image *) NULL)
11585    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11586  spread_image=SpreadImage(wand->images,radius,wand->exception);
11587  if (spread_image == (Image *) NULL)
11588    return(MagickFalse);
11589  ReplaceImageInList(&wand->images,spread_image);
11590  return(MagickTrue);
11591}
11592
11593/*
11594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11595%                                                                             %
11596%                                                                             %
11597%                                                                             %
11598%   M a g i c k S t a t i s t i c I m a g e                                   %
11599%                                                                             %
11600%                                                                             %
11601%                                                                             %
11602%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11603%
11604%  MagickStatisticImage() replace each pixel with corresponding statistic from
11605%  the neighborhood of the specified width and height.
11606%
11607%  The format of the MagickStatisticImage method is:
11608%
11609%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11610%        const StatisticType type,const double width,const size_t height)
11611%      MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
11612%        const ChannelType channel,const StatisticType type,const double width,
11613%        const size_t height)
11614%
11615%  A description of each parameter follows:
11616%
11617%    o wand: the magick wand.
11618%
11619%    o channel: the image channel(s).
11620%
11621%    o type: the statistic type (e.g. median, mode, etc.).
11622%
11623%    o width: the width of the pixel neighborhood.
11624%
11625%    o height: the height of the pixel neighborhood.
11626%
11627*/
11628WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11629  const ChannelType channel,const StatisticType type,const size_t width,
11630  const size_t height)
11631{
11632  Image
11633    *statistic_image;
11634
11635  assert(wand != (MagickWand *) NULL);
11636  assert(wand->signature == WandSignature);
11637  if (wand->debug != MagickFalse)
11638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11639  if (wand->images == (Image *) NULL)
11640    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11641  statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
11642    wand->exception);
11643  if (statistic_image == (Image *) NULL)
11644    return(MagickFalse);
11645  ReplaceImageInList(&wand->images,statistic_image);
11646  return(MagickTrue);
11647}
11648
11649/*
11650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11651%                                                                             %
11652%                                                                             %
11653%                                                                             %
11654%   M a g i c k S t e g a n o I m a g e                                       %
11655%                                                                             %
11656%                                                                             %
11657%                                                                             %
11658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11659%
11660%  MagickSteganoImage() hides a digital watermark within the image.
11661%  Recover the hidden watermark later to prove that the authenticity of
11662%  an image.  Offset defines the start position within the image to hide
11663%  the watermark.
11664%
11665%  The format of the MagickSteganoImage method is:
11666%
11667%      MagickWand *MagickSteganoImage(MagickWand *wand,
11668%        const MagickWand *watermark_wand,const ssize_t offset)
11669%
11670%  A description of each parameter follows:
11671%
11672%    o wand: the magick wand.
11673%
11674%    o watermark_wand: the watermark wand.
11675%
11676%    o offset: Start hiding at this offset into the image.
11677%
11678*/
11679WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11680  const MagickWand *watermark_wand,const ssize_t offset)
11681{
11682  Image
11683    *stegano_image;
11684
11685  assert(wand != (MagickWand *) NULL);
11686  assert(wand->signature == WandSignature);
11687  if (wand->debug != MagickFalse)
11688    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11689  if ((wand->images == (Image *) NULL) ||
11690      (watermark_wand->images == (Image *) NULL))
11691    {
11692      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11693        "ContainsNoImages","`%s'",wand->name);
11694      return((MagickWand *) NULL);
11695    }
11696  wand->images->offset=offset;
11697  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11698    wand->exception);
11699  if (stegano_image == (Image *) NULL)
11700    return((MagickWand *) NULL);
11701  return(CloneMagickWandFromImages(wand,stegano_image));
11702}
11703
11704/*
11705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11706%                                                                             %
11707%                                                                             %
11708%                                                                             %
11709%   M a g i c k S t e r e o I m a g e                                         %
11710%                                                                             %
11711%                                                                             %
11712%                                                                             %
11713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11714%
11715%  MagickStereoImage() composites two images and produces a single image that
11716%  is the composite of a left and right image of a stereo pair
11717%
11718%  The format of the MagickStereoImage method is:
11719%
11720%      MagickWand *MagickStereoImage(MagickWand *wand,
11721%        const MagickWand *offset_wand)
11722%
11723%  A description of each parameter follows:
11724%
11725%    o wand: the magick wand.
11726%
11727%    o offset_wand: Another image wand.
11728%
11729*/
11730WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11731  const MagickWand *offset_wand)
11732{
11733  Image
11734    *stereo_image;
11735
11736  assert(wand != (MagickWand *) NULL);
11737  assert(wand->signature == WandSignature);
11738  if (wand->debug != MagickFalse)
11739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11740  if ((wand->images == (Image *) NULL) ||
11741      (offset_wand->images == (Image *) NULL))
11742    {
11743      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11744        "ContainsNoImages","`%s'",wand->name);
11745      return((MagickWand *) NULL);
11746    }
11747  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11748  if (stereo_image == (Image *) NULL)
11749    return((MagickWand *) NULL);
11750  return(CloneMagickWandFromImages(wand,stereo_image));
11751}
11752
11753/*
11754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11755%                                                                             %
11756%                                                                             %
11757%                                                                             %
11758%   M a g i c k S t r i p I m a g e                                           %
11759%                                                                             %
11760%                                                                             %
11761%                                                                             %
11762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11763%
11764%  MagickStripImage() strips an image of all profiles and comments.
11765%
11766%  The format of the MagickStripImage method is:
11767%
11768%      MagickBooleanType MagickStripImage(MagickWand *wand)
11769%
11770%  A description of each parameter follows:
11771%
11772%    o wand: the magick wand.
11773%
11774*/
11775WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11776{
11777  MagickBooleanType
11778    status;
11779
11780  assert(wand != (MagickWand *) NULL);
11781  assert(wand->signature == WandSignature);
11782  if (wand->debug != MagickFalse)
11783    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11784  if (wand->images == (Image *) NULL)
11785    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11786  status=StripImage(wand->images);
11787  if (status == MagickFalse)
11788    InheritException(wand->exception,&wand->images->exception);
11789  return(status);
11790}
11791
11792/*
11793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11794%                                                                             %
11795%                                                                             %
11796%                                                                             %
11797%   M a g i c k S w i r l I m a g e                                           %
11798%                                                                             %
11799%                                                                             %
11800%                                                                             %
11801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11802%
11803%  MagickSwirlImage() swirls the pixels about the center of the image, where
11804%  degrees indicates the sweep of the arc through which each pixel is moved.
11805%  You get a more dramatic effect as the degrees move from 1 to 360.
11806%
11807%  The format of the MagickSwirlImage method is:
11808%
11809%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11810%
11811%  A description of each parameter follows:
11812%
11813%    o wand: the magick wand.
11814%
11815%    o degrees: Define the tightness of the swirling effect.
11816%
11817*/
11818WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11819  const double degrees)
11820{
11821  Image
11822    *swirl_image;
11823
11824  assert(wand != (MagickWand *) NULL);
11825  assert(wand->signature == WandSignature);
11826  if (wand->debug != MagickFalse)
11827    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11828  if (wand->images == (Image *) NULL)
11829    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11830  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11831  if (swirl_image == (Image *) NULL)
11832    return(MagickFalse);
11833  ReplaceImageInList(&wand->images,swirl_image);
11834  return(MagickTrue);
11835}
11836
11837/*
11838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11839%                                                                             %
11840%                                                                             %
11841%                                                                             %
11842%   M a g i c k T e x t u r e I m a g e                                       %
11843%                                                                             %
11844%                                                                             %
11845%                                                                             %
11846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11847%
11848%  MagickTextureImage() repeatedly tiles the texture image across and down the
11849%  image canvas.
11850%
11851%  The format of the MagickTextureImage method is:
11852%
11853%      MagickWand *MagickTextureImage(MagickWand *wand,
11854%        const MagickWand *texture_wand)
11855%
11856%  A description of each parameter follows:
11857%
11858%    o wand: the magick wand.
11859%
11860%    o texture_wand: the texture wand
11861%
11862*/
11863WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11864  const MagickWand *texture_wand)
11865{
11866  Image
11867    *texture_image;
11868
11869  MagickBooleanType
11870    status;
11871
11872  assert(wand != (MagickWand *) NULL);
11873  assert(wand->signature == WandSignature);
11874  if (wand->debug != MagickFalse)
11875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11876  if ((wand->images == (Image *) NULL) ||
11877      (texture_wand->images == (Image *) NULL))
11878    {
11879      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11880        "ContainsNoImages","`%s'",wand->name);
11881      return((MagickWand *) NULL);
11882    }
11883  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11884  if (texture_image == (Image *) NULL)
11885    return((MagickWand *) NULL);
11886  status=TextureImage(texture_image,texture_wand->images);
11887  if (status == MagickFalse)
11888    {
11889      InheritException(wand->exception,&texture_image->exception);
11890      texture_image=DestroyImage(texture_image);
11891      return((MagickWand *) NULL);
11892    }
11893  return(CloneMagickWandFromImages(wand,texture_image));
11894}
11895
11896/*
11897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11898%                                                                             %
11899%                                                                             %
11900%                                                                             %
11901%   M a g i c k T h r e s h o l d I m a g e                                   %
11902%                                                                             %
11903%                                                                             %
11904%                                                                             %
11905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11906%
11907%  MagickThresholdImage() changes the value of individual pixels based on
11908%  the intensity of each pixel compared to threshold.  The result is a
11909%  high-contrast, two color image.
11910%
11911%  The format of the MagickThresholdImage method is:
11912%
11913%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11914%        const double threshold)
11915%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11916%        const ChannelType channel,const double threshold)
11917%
11918%  A description of each parameter follows:
11919%
11920%    o wand: the magick wand.
11921%
11922%    o channel: the image channel(s).
11923%
11924%    o threshold: Define the threshold value.
11925%
11926*/
11927WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11928  const double threshold)
11929{
11930  MagickBooleanType
11931    status;
11932
11933  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11934  return(status);
11935}
11936
11937WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11938  const ChannelType channel,const double threshold)
11939{
11940  MagickBooleanType
11941    status;
11942
11943  assert(wand != (MagickWand *) NULL);
11944  assert(wand->signature == WandSignature);
11945  if (wand->debug != MagickFalse)
11946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11947  if (wand->images == (Image *) NULL)
11948    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11949  status=BilevelImageChannel(wand->images,channel,threshold);
11950  if (status == MagickFalse)
11951    InheritException(wand->exception,&wand->images->exception);
11952  return(status);
11953}
11954
11955/*
11956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11957%                                                                             %
11958%                                                                             %
11959%                                                                             %
11960%   M a g i c k T h u m b n a i l I m a g e                                   %
11961%                                                                             %
11962%                                                                             %
11963%                                                                             %
11964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11965%
11966%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11967%  and removes any associated profiles.  The goal is to produce small low cost
11968%  thumbnail images suited for display on the Web.
11969%
11970%  The format of the MagickThumbnailImage method is:
11971%
11972%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11973%        const size_t columns,const size_t rows)
11974%
11975%  A description of each parameter follows:
11976%
11977%    o wand: the magick wand.
11978%
11979%    o columns: the number of columns in the scaled image.
11980%
11981%    o rows: the number of rows in the scaled image.
11982%
11983*/
11984WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11985  const size_t columns,const size_t rows)
11986{
11987  Image
11988    *thumbnail_image;
11989
11990  assert(wand != (MagickWand *) NULL);
11991  assert(wand->signature == WandSignature);
11992  if (wand->debug != MagickFalse)
11993    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11994  if (wand->images == (Image *) NULL)
11995    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11996  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11997  if (thumbnail_image == (Image *) NULL)
11998    return(MagickFalse);
11999  ReplaceImageInList(&wand->images,thumbnail_image);
12000  return(MagickTrue);
12001}
12002
12003/*
12004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12005%                                                                             %
12006%                                                                             %
12007%                                                                             %
12008%   M a g i c k T i n t I m a g e                                             %
12009%                                                                             %
12010%                                                                             %
12011%                                                                             %
12012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12013%
12014%  MagickTintImage() applies a color vector to each pixel in the image.  The
12015%  length of the vector is 0 for black and white and at its maximum for the
12016%  midtones.  The vector weighting function is
12017%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12018%
12019%  The format of the MagickTintImage method is:
12020%
12021%      MagickBooleanType MagickTintImage(MagickWand *wand,
12022%        const PixelWand *tint,const PixelWand *opacity)
12023%
12024%  A description of each parameter follows:
12025%
12026%    o wand: the magick wand.
12027%
12028%    o tint: the tint pixel wand.
12029%
12030%    o opacity: the opacity pixel wand.
12031%
12032*/
12033WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12034  const PixelWand *tint,const PixelWand *opacity)
12035{
12036  char
12037    percent_opaque[MaxTextExtent];
12038
12039  Image
12040    *tint_image;
12041
12042  PixelPacket
12043    target;
12044
12045  assert(wand != (MagickWand *) NULL);
12046  assert(wand->signature == WandSignature);
12047  if (wand->debug != MagickFalse)
12048    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12049  if (wand->images == (Image *) NULL)
12050    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12051  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
12052    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12053    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12054    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12055    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12056    PixelGetOpacityQuantum(opacity)));
12057  PixelGetQuantumPacket(tint,&target);
12058  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12059  if (tint_image == (Image *) NULL)
12060    return(MagickFalse);
12061  ReplaceImageInList(&wand->images,tint_image);
12062  return(MagickTrue);
12063}
12064
12065/*
12066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12067%                                                                             %
12068%                                                                             %
12069%                                                                             %
12070%   M a g i c k T r a n s f o r m I m a g e                                   %
12071%                                                                             %
12072%                                                                             %
12073%                                                                             %
12074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12075%
12076%  MagickTransformImage() is a convenience method that behaves like
12077%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12078%  information as a region geometry specification.  If the operation fails,
12079%  a NULL image handle is returned.
12080%
12081%  The format of the MagickTransformImage method is:
12082%
12083%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12084%        const char *geometry)
12085%
12086%  A description of each parameter follows:
12087%
12088%    o wand: the magick wand.
12089%
12090%    o crop: A crop geometry string.  This geometry defines a subregion of the
12091%      image to crop.
12092%
12093%    o geometry: An image geometry string.  This geometry defines the final
12094%      size of the image.
12095%
12096*/
12097WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12098  const char *crop,const char *geometry)
12099{
12100  Image
12101    *transform_image;
12102
12103  MagickBooleanType
12104    status;
12105
12106  assert(wand != (MagickWand *) NULL);
12107  assert(wand->signature == WandSignature);
12108  if (wand->debug != MagickFalse)
12109    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12110  if (wand->images == (Image *) NULL)
12111    return((MagickWand *) NULL);
12112  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12113  if (transform_image == (Image *) NULL)
12114    return((MagickWand *) NULL);
12115  status=TransformImage(&transform_image,crop,geometry);
12116  if (status == MagickFalse)
12117    {
12118      InheritException(wand->exception,&transform_image->exception);
12119      transform_image=DestroyImage(transform_image);
12120      return((MagickWand *) NULL);
12121    }
12122  return(CloneMagickWandFromImages(wand,transform_image));
12123}
12124
12125/*
12126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12127%                                                                             %
12128%                                                                             %
12129%                                                                             %
12130%   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               %
12131%                                                                             %
12132%                                                                             %
12133%                                                                             %
12134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12135%
12136%  MagickTransformImageColorspace() transform the image colorspace.
12137%
12138%  The format of the MagickTransformImageColorspace method is:
12139%
12140%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12141%        const ColorspaceType colorspace)
12142%
12143%  A description of each parameter follows:
12144%
12145%    o wand: the magick wand.
12146%
12147%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12148%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12149%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12150%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12151%      HSLColorspace, or HWBColorspace.
12152%
12153*/
12154WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12155  const ColorspaceType colorspace)
12156{
12157  assert(wand != (MagickWand *) NULL);
12158  assert(wand->signature == WandSignature);
12159  if (wand->debug != MagickFalse)
12160    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12161  if (wand->images == (Image *) NULL)
12162    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12163  return(TransformImageColorspace(wand->images,colorspace));
12164}
12165
12166/*
12167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12168%                                                                             %
12169%                                                                             %
12170%                                                                             %
12171%   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                     %
12172%                                                                             %
12173%                                                                             %
12174%                                                                             %
12175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12176%
12177%  MagickTransparentPaintImage() changes any pixel that matches color with the
12178%  color defined by fill.
12179%
12180%  The format of the MagickTransparentPaintImage method is:
12181%
12182%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12183%        const PixelWand *target,const double alpha,const double fuzz,
12184%        const MagickBooleanType invert)
12185%
12186%  A description of each parameter follows:
12187%
12188%    o wand: the magick wand.
12189%
12190%    o target: Change this target color to specified opacity value within
12191%      the image.
12192%
12193%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12194%      transparent.
12195%
12196%    o fuzz: By default target must match a particular pixel color
12197%      exactly.  However, in many cases two colors may differ by a small amount.
12198%      The fuzz member of image defines how much tolerance is acceptable to
12199%      consider two colors as the same.  For example, set fuzz to 10 and the
12200%      color red at intensities of 100 and 102 respectively are now interpreted
12201%      as the same color for the purposes of the floodfill.
12202%
12203%    o invert: paint any pixel that does not match the target color.
12204%
12205*/
12206WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12207  const PixelWand *target,const double alpha,const double fuzz,
12208  const MagickBooleanType invert)
12209{
12210  MagickBooleanType
12211    status;
12212
12213  PixelInfo
12214    target_pixel;
12215
12216  assert(wand != (MagickWand *) NULL);
12217  assert(wand->signature == WandSignature);
12218  if (wand->debug != MagickFalse)
12219    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12220  if (wand->images == (Image *) NULL)
12221    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12222  PixelGetMagickColor(target,&target_pixel);
12223  wand->images->fuzz=fuzz;
12224  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12225    QuantumRange*alpha),invert);
12226  if (status == MagickFalse)
12227    InheritException(wand->exception,&wand->images->exception);
12228  return(status);
12229}
12230
12231/*
12232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12233%                                                                             %
12234%                                                                             %
12235%                                                                             %
12236%   M a g i c k T r a n s p o s e I m a g e                                   %
12237%                                                                             %
12238%                                                                             %
12239%                                                                             %
12240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12241%
12242%  MagickTransposeImage() creates a vertical mirror image by reflecting the
12243%  pixels around the central x-axis while rotating them 90-degrees.
12244%
12245%  The format of the MagickTransposeImage method is:
12246%
12247%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12248%
12249%  A description of each parameter follows:
12250%
12251%    o wand: the magick wand.
12252%
12253*/
12254WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12255{
12256  Image
12257    *transpose_image;
12258
12259  assert(wand != (MagickWand *) NULL);
12260  assert(wand->signature == WandSignature);
12261  if (wand->debug != MagickFalse)
12262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12263  if (wand->images == (Image *) NULL)
12264    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12265  transpose_image=TransposeImage(wand->images,wand->exception);
12266  if (transpose_image == (Image *) NULL)
12267    return(MagickFalse);
12268  ReplaceImageInList(&wand->images,transpose_image);
12269  return(MagickTrue);
12270}
12271
12272/*
12273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12274%                                                                             %
12275%                                                                             %
12276%                                                                             %
12277%   M a g i c k T r a n s v e r s e I m a g e                                 %
12278%                                                                             %
12279%                                                                             %
12280%                                                                             %
12281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12282%
12283%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12284%  pixels around the central y-axis while rotating them 270-degrees.
12285%
12286%  The format of the MagickTransverseImage method is:
12287%
12288%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12289%
12290%  A description of each parameter follows:
12291%
12292%    o wand: the magick wand.
12293%
12294*/
12295WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12296{
12297  Image
12298    *transverse_image;
12299
12300  assert(wand != (MagickWand *) NULL);
12301  assert(wand->signature == WandSignature);
12302  if (wand->debug != MagickFalse)
12303    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12304  if (wand->images == (Image *) NULL)
12305    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12306  transverse_image=TransverseImage(wand->images,wand->exception);
12307  if (transverse_image == (Image *) NULL)
12308    return(MagickFalse);
12309  ReplaceImageInList(&wand->images,transverse_image);
12310  return(MagickTrue);
12311}
12312
12313/*
12314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12315%                                                                             %
12316%                                                                             %
12317%                                                                             %
12318%   M a g i c k T r i m I m a g e                                             %
12319%                                                                             %
12320%                                                                             %
12321%                                                                             %
12322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12323%
12324%  MagickTrimImage() remove edges that are the background color from the image.
12325%
12326%  The format of the MagickTrimImage method is:
12327%
12328%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12329%
12330%  A description of each parameter follows:
12331%
12332%    o wand: the magick wand.
12333%
12334%    o fuzz: By default target must match a particular pixel color
12335%      exactly.  However, in many cases two colors may differ by a small amount.
12336%      The fuzz member of image defines how much tolerance is acceptable to
12337%      consider two colors as the same.  For example, set fuzz to 10 and the
12338%      color red at intensities of 100 and 102 respectively are now interpreted
12339%      as the same color for the purposes of the floodfill.
12340%
12341*/
12342WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12343{
12344  Image
12345    *trim_image;
12346
12347  assert(wand != (MagickWand *) NULL);
12348  assert(wand->signature == WandSignature);
12349  if (wand->debug != MagickFalse)
12350    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12351  if (wand->images == (Image *) NULL)
12352    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12353  wand->images->fuzz=fuzz;
12354  trim_image=TrimImage(wand->images,wand->exception);
12355  if (trim_image == (Image *) NULL)
12356    return(MagickFalse);
12357  ReplaceImageInList(&wand->images,trim_image);
12358  return(MagickTrue);
12359}
12360
12361/*
12362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12363%                                                                             %
12364%                                                                             %
12365%                                                                             %
12366%   M a g i c k U n i q u e I m a g e C o l o r s                             %
12367%                                                                             %
12368%                                                                             %
12369%                                                                             %
12370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12371%
12372%  MagickUniqueImageColors() discards all but one of any pixel color.
12373%
12374%  The format of the MagickUniqueImageColors method is:
12375%
12376%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12377%
12378%  A description of each parameter follows:
12379%
12380%    o wand: the magick wand.
12381%
12382*/
12383WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12384{
12385  Image
12386    *unique_image;
12387
12388  assert(wand != (MagickWand *) NULL);
12389  assert(wand->signature == WandSignature);
12390  if (wand->debug != MagickFalse)
12391    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12392  if (wand->images == (Image *) NULL)
12393    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12394  unique_image=UniqueImageColors(wand->images,wand->exception);
12395  if (unique_image == (Image *) NULL)
12396    return(MagickFalse);
12397  ReplaceImageInList(&wand->images,unique_image);
12398  return(MagickTrue);
12399}
12400
12401/*
12402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12403%                                                                             %
12404%                                                                             %
12405%                                                                             %
12406%   M a g i c k U n s h a r p M a s k I m a g e                               %
12407%                                                                             %
12408%                                                                             %
12409%                                                                             %
12410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12411%
12412%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12413%  Gaussian operator of the given radius and standard deviation (sigma).
12414%  For reasonable results, radius should be larger than sigma.  Use a radius
12415%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12416%
12417%  The format of the MagickUnsharpMaskImage method is:
12418%
12419%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12420%        const double radius,const double sigma,const double amount,
12421%        const double threshold)
12422%      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12423%        const ChannelType channel,const double radius,const double sigma,
12424%        const double amount,const double threshold)
12425%
12426%  A description of each parameter follows:
12427%
12428%    o wand: the magick wand.
12429%
12430%    o channel: the image channel(s).
12431%
12432%    o radius: the radius of the Gaussian, in pixels, not counting the center
12433%      pixel.
12434%
12435%    o sigma: the standard deviation of the Gaussian, in pixels.
12436%
12437%    o amount: the percentage of the difference between the original and the
12438%      blur image that is added back into the original.
12439%
12440%    o threshold: the threshold in pixels needed to apply the diffence amount.
12441%
12442*/
12443
12444WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12445  const double radius,const double sigma,const double amount,
12446  const double threshold)
12447{
12448  MagickBooleanType
12449    status;
12450
12451  status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12452    amount,threshold);
12453  return(status);
12454}
12455
12456WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12457  const ChannelType channel,const double radius,const double sigma,
12458  const double amount,const double threshold)
12459{
12460  Image
12461    *unsharp_image;
12462
12463  assert(wand != (MagickWand *) NULL);
12464  assert(wand->signature == WandSignature);
12465  if (wand->debug != MagickFalse)
12466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12467  if (wand->images == (Image *) NULL)
12468    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12469  unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12470    amount,threshold,wand->exception);
12471  if (unsharp_image == (Image *) NULL)
12472    return(MagickFalse);
12473  ReplaceImageInList(&wand->images,unsharp_image);
12474  return(MagickTrue);
12475}
12476
12477/*
12478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12479%                                                                             %
12480%                                                                             %
12481%                                                                             %
12482%   M a g i c k V i g n e t t e I m a g e                                     %
12483%                                                                             %
12484%                                                                             %
12485%                                                                             %
12486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12487%
12488%  MagickVignetteImage() softens the edges of the image in vignette style.
12489%
12490%  The format of the MagickVignetteImage method is:
12491%
12492%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12493%        const double black_point,const double white_point,const ssize_t x,
12494%        const ssize_t y)
12495%
12496%  A description of each parameter follows:
12497%
12498%    o wand: the magick wand.
12499%
12500%    o black_point: the black point.
12501%
12502%    o white_point: the white point.
12503%
12504%    o x, y:  Define the x and y ellipse offset.
12505%
12506*/
12507WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12508  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12509{
12510  Image
12511    *vignette_image;
12512
12513  assert(wand != (MagickWand *) NULL);
12514  assert(wand->signature == WandSignature);
12515  if (wand->debug != MagickFalse)
12516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12517  if (wand->images == (Image *) NULL)
12518    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12519  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12520    wand->exception);
12521  if (vignette_image == (Image *) NULL)
12522    return(MagickFalse);
12523  ReplaceImageInList(&wand->images,vignette_image);
12524  return(MagickTrue);
12525}
12526
12527/*
12528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12529%                                                                             %
12530%                                                                             %
12531%                                                                             %
12532%   M a g i c k W a v e I m a g e                                             %
12533%                                                                             %
12534%                                                                             %
12535%                                                                             %
12536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12537%
12538%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12539%  the pixels vertically along a sine wave whose amplitude and wavelength
12540%  is specified by the given parameters.
12541%
12542%  The format of the MagickWaveImage method is:
12543%
12544%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12545%        const double wave_length)
12546%
12547%  A description of each parameter follows:
12548%
12549%    o wand: the magick wand.
12550%
12551%    o amplitude, wave_length:  Define the amplitude and wave length of the
12552%      sine wave.
12553%
12554*/
12555WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12556  const double amplitude,const double wave_length)
12557{
12558  Image
12559    *wave_image;
12560
12561  assert(wand != (MagickWand *) NULL);
12562  assert(wand->signature == WandSignature);
12563  if (wand->debug != MagickFalse)
12564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12565  if (wand->images == (Image *) NULL)
12566    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12567  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12568  if (wave_image == (Image *) NULL)
12569    return(MagickFalse);
12570  ReplaceImageInList(&wand->images,wave_image);
12571  return(MagickTrue);
12572}
12573
12574/*
12575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12576%                                                                             %
12577%                                                                             %
12578%                                                                             %
12579%   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                         %
12580%                                                                             %
12581%                                                                             %
12582%                                                                             %
12583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12584%
12585%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12586%  above the threshold into white while leaving all pixels below the threshold
12587%  unchanged.
12588%
12589%  The format of the MagickWhiteThresholdImage method is:
12590%
12591%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12592%        const PixelWand *threshold)
12593%
12594%  A description of each parameter follows:
12595%
12596%    o wand: the magick wand.
12597%
12598%    o threshold: the pixel wand.
12599%
12600*/
12601WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12602  const PixelWand *threshold)
12603{
12604  char
12605    thresholds[MaxTextExtent];
12606
12607  MagickBooleanType
12608    status;
12609
12610  assert(wand != (MagickWand *) NULL);
12611  assert(wand->signature == WandSignature);
12612  if (wand->debug != MagickFalse)
12613    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12614  if (wand->images == (Image *) NULL)
12615    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12616  (void) FormatLocaleString(thresholds,MaxTextExtent,
12617    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12618    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12619    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12620  status=WhiteThresholdImage(wand->images,thresholds);
12621  if (status == MagickFalse)
12622    InheritException(wand->exception,&wand->images->exception);
12623  return(status);
12624}
12625
12626/*
12627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12628%                                                                             %
12629%                                                                             %
12630%                                                                             %
12631%   M a g i c k W r i t e I m a g e                                           %
12632%                                                                             %
12633%                                                                             %
12634%                                                                             %
12635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12636%
12637%  MagickWriteImage() writes an image to the specified filename.  If the
12638%  filename parameter is NULL, the image is written to the filename set
12639%  by MagickReadImage() or MagickSetImageFilename().
12640%
12641%  The format of the MagickWriteImage method is:
12642%
12643%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12644%        const char *filename)
12645%
12646%  A description of each parameter follows:
12647%
12648%    o wand: the magick wand.
12649%
12650%    o filename: the image filename.
12651%
12652%
12653*/
12654WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12655  const char *filename)
12656{
12657  Image
12658    *image;
12659
12660  ImageInfo
12661    *write_info;
12662
12663  MagickBooleanType
12664    status;
12665
12666  assert(wand != (MagickWand *) NULL);
12667  assert(wand->signature == WandSignature);
12668  if (wand->debug != MagickFalse)
12669    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12670  if (wand->images == (Image *) NULL)
12671    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12672  if (filename != (const char *) NULL)
12673    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12674  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12675  if (image == (Image *) NULL)
12676    return(MagickFalse);
12677  write_info=CloneImageInfo(wand->image_info);
12678  write_info->adjoin=MagickTrue;
12679  status=WriteImage(write_info,image);
12680  if (status == MagickFalse)
12681    InheritException(wand->exception,&image->exception);
12682  image=DestroyImage(image);
12683  write_info=DestroyImageInfo(write_info);
12684  return(status);
12685}
12686
12687/*
12688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12689%                                                                             %
12690%                                                                             %
12691%                                                                             %
12692%   M a g i c k W r i t e I m a g e F i l e                                   %
12693%                                                                             %
12694%                                                                             %
12695%                                                                             %
12696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12697%
12698%  MagickWriteImageFile() writes an image to an open file descriptor.
12699%
12700%  The format of the MagickWriteImageFile method is:
12701%
12702%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12703%
12704%  A description of each parameter follows:
12705%
12706%    o wand: the magick wand.
12707%
12708%    o file: the file descriptor.
12709%
12710*/
12711WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12712{
12713  Image
12714    *image;
12715
12716  ImageInfo
12717    *write_info;
12718
12719  MagickBooleanType
12720    status;
12721
12722  assert(wand != (MagickWand *) NULL);
12723  assert(wand->signature == WandSignature);
12724  assert(file != (FILE *) NULL);
12725  if (wand->debug != MagickFalse)
12726    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12727  if (wand->images == (Image *) NULL)
12728    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12729  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12730  if (image == (Image *) NULL)
12731    return(MagickFalse);
12732  write_info=CloneImageInfo(wand->image_info);
12733  SetImageInfoFile(write_info,file);
12734  write_info->adjoin=MagickTrue;
12735  status=WriteImage(write_info,image);
12736  write_info=DestroyImageInfo(write_info);
12737  if (status == MagickFalse)
12738    InheritException(wand->exception,&image->exception);
12739  image=DestroyImage(image);
12740  return(status);
12741}
12742
12743/*
12744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12745%                                                                             %
12746%                                                                             %
12747%                                                                             %
12748%   M a g i c k W r i t e I m a g e s                                         %
12749%                                                                             %
12750%                                                                             %
12751%                                                                             %
12752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12753%
12754%  MagickWriteImages() writes an image or image sequence.
12755%
12756%  The format of the MagickWriteImages method is:
12757%
12758%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12759%        const char *filename,const MagickBooleanType adjoin)
12760%
12761%  A description of each parameter follows:
12762%
12763%    o wand: the magick wand.
12764%
12765%    o filename: the image filename.
12766%
12767%    o adjoin: join images into a single multi-image file.
12768%
12769*/
12770WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12771  const char *filename,const MagickBooleanType adjoin)
12772{
12773  ImageInfo
12774    *write_info;
12775
12776  MagickBooleanType
12777    status;
12778
12779  assert(wand != (MagickWand *) NULL);
12780  assert(wand->signature == WandSignature);
12781  if (wand->debug != MagickFalse)
12782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12783  if (wand->images == (Image *) NULL)
12784    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12785  write_info=CloneImageInfo(wand->image_info);
12786  write_info->adjoin=adjoin;
12787  status=WriteImages(write_info,wand->images,filename,wand->exception);
12788  if (status == MagickFalse)
12789    InheritException(wand->exception,&wand->images->exception);
12790  write_info=DestroyImageInfo(write_info);
12791  return(status);
12792}
12793
12794/*
12795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12796%                                                                             %
12797%                                                                             %
12798%                                                                             %
12799%   M a g i c k W r i t e I m a g e s F i l e                                 %
12800%                                                                             %
12801%                                                                             %
12802%                                                                             %
12803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12804%
12805%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12806%
12807%  The format of the MagickWriteImagesFile method is:
12808%
12809%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12810%
12811%  A description of each parameter follows:
12812%
12813%    o wand: the magick wand.
12814%
12815%    o file: the file descriptor.
12816%
12817*/
12818WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12819{
12820  ImageInfo
12821    *write_info;
12822
12823  MagickBooleanType
12824    status;
12825
12826  assert(wand != (MagickWand *) NULL);
12827  assert(wand->signature == WandSignature);
12828  if (wand->debug != MagickFalse)
12829    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12830  if (wand->images == (Image *) NULL)
12831    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12832  write_info=CloneImageInfo(wand->image_info);
12833  SetImageInfoFile(write_info,file);
12834  write_info->adjoin=MagickTrue;
12835  status=WriteImages(write_info,wand->images,(const char *) NULL,
12836    wand->exception);
12837  write_info=DestroyImageInfo(write_info);
12838  if (status == MagickFalse)
12839    InheritException(wand->exception,&wand->images->exception);
12840  return(status);
12841}
12842