magick-image.c revision b3e7c6c7000b5f854198b77a2491be3717b88e07
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%
182%  A description of each parameter follows:
183%
184%    o wand: the magick wand.
185%
186%    o radius: the radius of the Gaussian, in pixels, not counting the center
187%      pixel.
188%
189%    o sigma: the standard deviation of the Gaussian, in pixels.
190%
191*/
192WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
193  const double radius,const double sigma)
194{
195  Image
196    *sharp_image;
197
198  assert(wand != (MagickWand *) NULL);
199  assert(wand->signature == WandSignature);
200  if (wand->debug != MagickFalse)
201    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
202  if (wand->images == (Image *) NULL)
203    ThrowWandException(WandError,"ContainsNoImages",wand->name);
204  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
205  if (sharp_image == (Image *) NULL)
206    return(MagickFalse);
207  ReplaceImageInList(&wand->images,sharp_image);
208  return(MagickTrue);
209}
210
211/*
212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213%                                                                             %
214%                                                                             %
215%                                                                             %
216%   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                         %
217%                                                                             %
218%                                                                             %
219%                                                                             %
220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221%
222%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
223%  triangulation.
224%
225%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
226%        const size_t columns,const size_t rows)
227%
228%  A description of each parameter follows:
229%
230%    o wand: the magick wand.
231%
232%    o columns: the number of columns in the scaled image.
233%
234%    o rows: the number of rows in the scaled image.
235%
236*/
237WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
238  const size_t columns,const size_t rows)
239{
240  Image
241    *resize_image;
242
243  assert(wand != (MagickWand *) NULL);
244  assert(wand->signature == WandSignature);
245  if (wand->debug != MagickFalse)
246    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
247  if (wand->images == (Image *) NULL)
248    ThrowWandException(WandError,"ContainsNoImages",wand->name);
249  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
250  if (resize_image == (Image *) NULL)
251    return(MagickFalse);
252  ReplaceImageInList(&wand->images,resize_image);
253  return(MagickTrue);
254}
255
256/*
257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258%                                                                             %
259%                                                                             %
260%                                                                             %
261%   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                       %
262%                                                                             %
263%                                                                             %
264%                                                                             %
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266%
267%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
268%  more intensely near image edges and less intensely far from edges. We
269%  sharpen the image with a Gaussian operator of the given radius and standard
270%  deviation (sigma).  For reasonable results, radius should be larger than
271%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
272%  suitable radius for you.
273%
274%  The format of the MagickAdaptiveSharpenImage method is:
275%
276%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
277%        const double radius,const double sigma)
278%
279%  A description of each parameter follows:
280%
281%    o wand: the magick wand.
282%
283%    o radius: the radius of the Gaussian, in pixels, not counting the center
284%      pixel.
285%
286%    o sigma: the standard deviation of the Gaussian, in pixels.
287%
288*/
289WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
290  const double radius,const double sigma)
291{
292  Image
293    *sharp_image;
294
295  assert(wand != (MagickWand *) NULL);
296  assert(wand->signature == WandSignature);
297  if (wand->debug != MagickFalse)
298    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
299  if (wand->images == (Image *) NULL)
300    ThrowWandException(WandError,"ContainsNoImages",wand->name);
301  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
302  if (sharp_image == (Image *) NULL)
303    return(MagickFalse);
304  ReplaceImageInList(&wand->images,sharp_image);
305  return(MagickTrue);
306}
307
308/*
309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310%                                                                             %
311%                                                                             %
312%                                                                             %
313%   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                   %
314%                                                                             %
315%                                                                             %
316%                                                                             %
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318%
319%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
320%  based on the range of intensity values in its local neighborhood.  This
321%  allows for thresholding of an image whose global intensity histogram
322%  doesn't contain distinctive peaks.
323%
324%  The format of the AdaptiveThresholdImage method is:
325%
326%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
327%        const size_t width,const size_t height,const ssize_t offset)
328%
329%  A description of each parameter follows:
330%
331%    o wand: the magick wand.
332%
333%    o width: the width of the local neighborhood.
334%
335%    o height: the height of the local neighborhood.
336%
337%    o offset: the mean offset.
338%
339*/
340WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
341  const size_t width,const size_t height,const ssize_t offset)
342{
343  Image
344    *threshold_image;
345
346  assert(wand != (MagickWand *) NULL);
347  assert(wand->signature == WandSignature);
348  if (wand->debug != MagickFalse)
349    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
350  if (wand->images == (Image *) NULL)
351    ThrowWandException(WandError,"ContainsNoImages",wand->name);
352  threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
353    wand->exception);
354  if (threshold_image == (Image *) NULL)
355    return(MagickFalse);
356  ReplaceImageInList(&wand->images,threshold_image);
357  return(MagickTrue);
358}
359
360/*
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%                                                                             %
363%                                                                             %
364%                                                                             %
365%   M a g i c k A d d I m a g e                                               %
366%                                                                             %
367%                                                                             %
368%                                                                             %
369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370%
371%  MagickAddImage() adds the specified images at the current image location.
372%
373%  The format of the MagickAddImage method is:
374%
375%      MagickBooleanType MagickAddImage(MagickWand *wand,
376%        const MagickWand *add_wand)
377%
378%  A description of each parameter follows:
379%
380%    o wand: the magick wand.
381%
382%    o add_wand: A wand that contains images to add at the current image
383%      location.
384%
385*/
386
387static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
388  Image *images)
389{
390  Image
391    *sentinel;
392
393  sentinel=wand->images;
394  if (sentinel == (Image *) NULL)
395    {
396      wand->images=GetFirstImageInList(images);
397      return(MagickTrue);
398    }
399  if (wand->active == MagickFalse)
400    {
401      if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
402        {
403          AppendImageToList(&sentinel,images);
404          wand->images=GetLastImageInList(images);
405          return(MagickTrue);
406        }
407      if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
408        {
409          PrependImageToList(&sentinel,images);
410          wand->images=GetFirstImageInList(images);
411          return(MagickTrue);
412        }
413    }
414  if (sentinel->next == (Image *) NULL)
415    {
416      InsertImageInList(&sentinel,images);
417      wand->images=GetLastImageInList(images);
418      return(MagickTrue);
419    }
420  InsertImageInList(&sentinel,images);
421  wand->images=GetFirstImageInList(images);
422  return(MagickTrue);
423}
424
425WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
426  const MagickWand *add_wand)
427{
428  Image
429    *images;
430
431  assert(wand != (MagickWand *) NULL);
432  assert(wand->signature == WandSignature);
433  if (wand->debug != MagickFalse)
434    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
435  assert(add_wand != (MagickWand *) NULL);
436  assert(add_wand->signature == WandSignature);
437  if (add_wand->images == (Image *) NULL)
438    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
439  images=CloneImageList(add_wand->images,wand->exception);
440  if (images == (Image *) NULL)
441    return(MagickFalse);
442  return(InsertImageInWand(wand,images));
443}
444
445/*
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447%                                                                             %
448%                                                                             %
449%                                                                             %
450%     M a g i c k A d d N o i s e I m a g e                                   %
451%                                                                             %
452%                                                                             %
453%                                                                             %
454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455%
456%  MagickAddNoiseImage() adds random noise to the image.
457%
458%  The format of the MagickAddNoiseImage method is:
459%
460%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
461%        const NoiseType noise_type)
462%
463%  A description of each parameter follows:
464%
465%    o wand: the magick wand.
466%
467%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
468%      Impulse, Laplacian, or Poisson.
469%
470*/
471WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
472  const NoiseType noise_type)
473{
474  Image
475    *noise_image;
476
477  assert(wand != (MagickWand *) NULL);
478  assert(wand->signature == WandSignature);
479  if (wand->debug != MagickFalse)
480    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
481  if (wand->images == (Image *) NULL)
482    ThrowWandException(WandError,"ContainsNoImages",wand->name);
483  noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
484  if (noise_image == (Image *) NULL)
485    return(MagickFalse);
486  ReplaceImageInList(&wand->images,noise_image);
487  return(MagickTrue);
488}
489
490/*
491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492%                                                                             %
493%                                                                             %
494%                                                                             %
495%   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                       %
496%                                                                             %
497%                                                                             %
498%                                                                             %
499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500%
501%  MagickAffineTransformImage() transforms an image as dictated by the affine
502%  matrix of the drawing wand.
503%
504%  The format of the MagickAffineTransformImage method is:
505%
506%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
507%        const DrawingWand *drawing_wand)
508%
509%  A description of each parameter follows:
510%
511%    o wand: the magick wand.
512%
513%    o drawing_wand: the draw wand.
514%
515*/
516WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
517  const DrawingWand *drawing_wand)
518{
519  DrawInfo
520    *draw_info;
521
522  Image
523    *affine_image;
524
525  assert(wand != (MagickWand *) NULL);
526  assert(wand->signature == WandSignature);
527  if (wand->debug != MagickFalse)
528    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
529  if (wand->images == (Image *) NULL)
530    ThrowWandException(WandError,"ContainsNoImages",wand->name);
531  draw_info=PeekDrawingWand(drawing_wand);
532  if (draw_info == (DrawInfo *) NULL)
533    return(MagickFalse);
534  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
535    wand->exception);
536  draw_info=DestroyDrawInfo(draw_info);
537  if (affine_image == (Image *) NULL)
538    return(MagickFalse);
539  ReplaceImageInList(&wand->images,affine_image);
540  return(MagickTrue);
541}
542
543/*
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545%                                                                             %
546%                                                                             %
547%                                                                             %
548%   M a g i c k A n n o t a t e I m a g e                                     %
549%                                                                             %
550%                                                                             %
551%                                                                             %
552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553%
554%  MagickAnnotateImage() annotates an image with text.
555%
556%  The format of the MagickAnnotateImage method is:
557%
558%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
559%        const DrawingWand *drawing_wand,const double x,const double y,
560%        const double angle,const char *text)
561%
562%  A description of each parameter follows:
563%
564%    o wand: the magick wand.
565%
566%    o drawing_wand: the draw wand.
567%
568%    o x: x ordinate to left of text
569%
570%    o y: y ordinate to text baseline
571%
572%    o angle: rotate text relative to this angle.
573%
574%    o text: text to draw
575%
576*/
577WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
578  const DrawingWand *drawing_wand,const double x,const double y,
579  const double angle,const char *text)
580{
581  char
582    geometry[MaxTextExtent];
583
584  DrawInfo
585    *draw_info;
586
587  MagickBooleanType
588    status;
589
590  assert(wand != (MagickWand *) NULL);
591  assert(wand->signature == WandSignature);
592  if (wand->debug != MagickFalse)
593    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
594  if (wand->images == (Image *) NULL)
595    ThrowWandException(WandError,"ContainsNoImages",wand->name);
596  draw_info=PeekDrawingWand(drawing_wand);
597  if (draw_info == (DrawInfo *) NULL)
598    return(MagickFalse);
599  (void) CloneString(&draw_info->text,text);
600  (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
601  draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
602  draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
603  draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
604  draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
605  (void) CloneString(&draw_info->geometry,geometry);
606  status=AnnotateImage(wand->images,draw_info);
607  draw_info=DestroyDrawInfo(draw_info);
608  if (status == MagickFalse)
609    InheritException(wand->exception,&wand->images->exception);
610  return(status);
611}
612
613/*
614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615%                                                                             %
616%                                                                             %
617%                                                                             %
618%   M a g i c k A n i m a t e I m a g e s                                     %
619%                                                                             %
620%                                                                             %
621%                                                                             %
622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623%
624%  MagickAnimateImages() animates an image or image sequence.
625%
626%  The format of the MagickAnimateImages method is:
627%
628%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
629%        const char *server_name)
630%
631%  A description of each parameter follows:
632%
633%    o wand: the magick wand.
634%
635%    o server_name: the X server name.
636%
637*/
638WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
639  const char *server_name)
640{
641  MagickBooleanType
642    status;
643
644  assert(wand != (MagickWand *) NULL);
645  assert(wand->signature == WandSignature);
646  if (wand->debug != MagickFalse)
647    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
648  (void) CloneString(&wand->image_info->server_name,server_name);
649  status=AnimateImages(wand->image_info,wand->images);
650  if (status == MagickFalse)
651    InheritException(wand->exception,&wand->images->exception);
652  return(status);
653}
654
655/*
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657%                                                                             %
658%                                                                             %
659%                                                                             %
660%   M a g i c k A p p e n d I m a g e s                                       %
661%                                                                             %
662%                                                                             %
663%                                                                             %
664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665%
666%  MagickAppendImages() append a set of images.
667%
668%  The format of the MagickAppendImages method is:
669%
670%      MagickWand *MagickAppendImages(MagickWand *wand,
671%        const MagickBooleanType stack)
672%
673%  A description of each parameter follows:
674%
675%    o wand: the magick wand.
676%
677%    o stack: By default, images are stacked left-to-right. Set stack to
678%      MagickTrue to stack them top-to-bottom.
679%
680*/
681WandExport MagickWand *MagickAppendImages(MagickWand *wand,
682  const MagickBooleanType stack)
683{
684  Image
685    *append_image;
686
687  assert(wand != (MagickWand *) NULL);
688  assert(wand->signature == WandSignature);
689  if (wand->debug != MagickFalse)
690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
691  if (wand->images == (Image *) NULL)
692    return((MagickWand *) NULL);
693  append_image=AppendImages(wand->images,stack,wand->exception);
694  if (append_image == (Image *) NULL)
695    return((MagickWand *) NULL);
696  return(CloneMagickWandFromImages(wand,append_image));
697}
698
699/*
700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701%                                                                             %
702%                                                                             %
703%                                                                             %
704%   M a g i c k A u t o G a m m a I m a g e                                   %
705%                                                                             %
706%                                                                             %
707%                                                                             %
708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709%
710%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
711%  image to try make set its gamma appropriatally.
712%
713%  The format of the MagickAutoGammaImage method is:
714%
715%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
716%
717%  A description of each parameter follows:
718%
719%    o wand: the magick wand.
720%
721*/
722WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
723{
724  MagickBooleanType
725    status;
726
727  assert(wand != (MagickWand *) NULL);
728  assert(wand->signature == WandSignature);
729  if (wand->debug != MagickFalse)
730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
731  if (wand->images == (Image *) NULL)
732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
733  status=AutoGammaImage(wand->images);
734  if (status == MagickFalse)
735    InheritException(wand->exception,&wand->images->exception);
736  return(status);
737}
738
739/*
740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741%                                                                             %
742%                                                                             %
743%                                                                             %
744%   M a g i c k A u t o L e v e l I m a g e                                   %
745%                                                                             %
746%                                                                             %
747%                                                                             %
748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749%
750%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
751%  scaling the minimum and maximum values to the full quantum range.
752%
753%  The format of the MagickAutoLevelImage method is:
754%
755%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
756%
757%  A description of each parameter follows:
758%
759%    o wand: the magick wand.
760%
761*/
762WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
763{
764  MagickBooleanType
765    status;
766
767  assert(wand != (MagickWand *) NULL);
768  assert(wand->signature == WandSignature);
769  if (wand->debug != MagickFalse)
770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
771  if (wand->images == (Image *) NULL)
772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
773  status=AutoLevelImage(wand->images);
774  if (status == MagickFalse)
775    InheritException(wand->exception,&wand->images->exception);
776  return(status);
777}
778
779/*
780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
781%                                                                             %
782%                                                                             %
783%                                                                             %
784%   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                         %
785%                                                                             %
786%                                                                             %
787%                                                                             %
788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
789%
790%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
791%  pixels below the threshold into black while leaving all pixels above the
792%  threshold unchanged.
793%
794%  The format of the MagickBlackThresholdImage method is:
795%
796%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
797%        const PixelWand *threshold)
798%
799%  A description of each parameter follows:
800%
801%    o wand: the magick wand.
802%
803%    o threshold: the pixel wand.
804%
805*/
806WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
807  const PixelWand *threshold)
808{
809  char
810    thresholds[MaxTextExtent];
811
812  MagickBooleanType
813    status;
814
815  assert(wand != (MagickWand *) NULL);
816  assert(wand->signature == WandSignature);
817  if (wand->debug != MagickFalse)
818    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
819  if (wand->images == (Image *) NULL)
820    ThrowWandException(WandError,"ContainsNoImages",wand->name);
821  (void) FormatLocaleString(thresholds,MaxTextExtent,
822    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
823    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
824    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
825  status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
826  if (status == MagickFalse)
827    InheritException(wand->exception,&wand->images->exception);
828  return(status);
829}
830
831/*
832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833%                                                                             %
834%                                                                             %
835%                                                                             %
836%   M a g i c k B l u e S h i f t I m a g e                                   %
837%                                                                             %
838%                                                                             %
839%                                                                             %
840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
841%
842%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
843%  nighttime in the moonlight.
844%
845%  The format of the MagickBlueShiftImage method is:
846%
847%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
848%        const double factor)
849%
850%  A description of each parameter follows:
851%
852%    o wand: the magick wand.
853%
854%    o factor: the blue shift factor (default 1.5)
855%
856*/
857WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
858  const double factor)
859{
860  Image
861    *shift_image;
862
863  assert(wand != (MagickWand *) NULL);
864  assert(wand->signature == WandSignature);
865  if (wand->debug != MagickFalse)
866    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
867  if (wand->images == (Image *) NULL)
868    ThrowWandException(WandError,"ContainsNoImages",wand->name);
869  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
870  if (shift_image == (Image *) NULL)
871    return(MagickFalse);
872  ReplaceImageInList(&wand->images,shift_image);
873  return(MagickTrue);
874}
875
876/*
877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
878%                                                                             %
879%                                                                             %
880%                                                                             %
881%   M a g i c k B l u r I m a g e                                             %
882%                                                                             %
883%                                                                             %
884%                                                                             %
885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
886%
887%  MagickBlurImage() blurs an image.  We convolve the image with a
888%  gaussian operator of the given radius and standard deviation (sigma).
889%  For reasonable results, the radius should be larger than sigma.  Use a
890%  radius of 0 and BlurImage() selects a suitable radius for you.
891%
892%  The format of the MagickBlurImage method is:
893%
894%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
895%        const double sigma)
896%
897%  A description of each parameter follows:
898%
899%    o wand: the magick wand.
900%
901%    o radius: the radius of the , in pixels, not counting the center
902%      pixel.
903%
904%    o sigma: the standard deviation of the , in pixels.
905%
906*/
907WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
908  const double radius,const double sigma)
909{
910  Image
911    *blur_image;
912
913  assert(wand != (MagickWand *) NULL);
914  assert(wand->signature == WandSignature);
915  if (wand->debug != MagickFalse)
916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
917  if (wand->images == (Image *) NULL)
918    ThrowWandException(WandError,"ContainsNoImages",wand->name);
919  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
920  if (blur_image == (Image *) NULL)
921    return(MagickFalse);
922  ReplaceImageInList(&wand->images,blur_image);
923  return(MagickTrue);
924}
925
926/*
927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928%                                                                             %
929%                                                                             %
930%                                                                             %
931%   M a g i c k B o r d e r I m a g e                                         %
932%                                                                             %
933%                                                                             %
934%                                                                             %
935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
936%
937%  MagickBorderImage() surrounds the image with a border of the color defined
938%  by the bordercolor pixel wand.
939%
940%  The format of the MagickBorderImage method is:
941%
942%      MagickBooleanType MagickBorderImage(MagickWand *wand,
943%        const PixelWand *bordercolor,const size_t width,
944%        const size_t height)
945%
946%  A description of each parameter follows:
947%
948%    o wand: the magick wand.
949%
950%    o bordercolor: the border color pixel wand.
951%
952%    o width: the border width.
953%
954%    o height: the border height.
955%
956*/
957WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
958  const PixelWand *bordercolor,const size_t width,
959  const size_t height)
960{
961  Image
962    *border_image;
963
964  RectangleInfo
965    border_info;
966
967  assert(wand != (MagickWand *) NULL);
968  assert(wand->signature == WandSignature);
969  if (wand->debug != MagickFalse)
970    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
971  if (wand->images == (Image *) NULL)
972    ThrowWandException(WandError,"ContainsNoImages",wand->name);
973  border_info.width=width;
974  border_info.height=height;
975  border_info.x=0;
976  border_info.y=0;
977  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
978  border_image=BorderImage(wand->images,&border_info,wand->exception);
979  if (border_image == (Image *) NULL)
980    return(MagickFalse);
981  ReplaceImageInList(&wand->images,border_image);
982  return(MagickTrue);
983}
984
985/*
986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987%                                                                             %
988%                                                                             %
989%                                                                             %
990%   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   %
991%                                                                             %
992%                                                                             %
993%                                                                             %
994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995%
996%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
997%  of an image.  It converts the brightness and contrast parameters into slope
998%  and intercept and calls a polynomical function to apply to the image.
999
1000%
1001%  The format of the MagickBrightnessContrastImage method is:
1002%
1003%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1004%        const double brightness,const double contrast)
1005%
1006%  A description of each parameter follows:
1007%
1008%    o wand: the magick wand.
1009%
1010%    o brightness: the brightness percent (-100 .. 100).
1011%
1012%    o contrast: the contrast percent (-100 .. 100).
1013%
1014*/
1015WandExport MagickBooleanType MagickBrightnessContrastImage(
1016  MagickWand *wand,const double brightness,const double contrast)
1017{
1018  MagickBooleanType
1019    status;
1020
1021  assert(wand != (MagickWand *) NULL);
1022  assert(wand->signature == WandSignature);
1023  if (wand->debug != MagickFalse)
1024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1025  if (wand->images == (Image *) NULL)
1026    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1027  status=BrightnessContrastImage(wand->images,brightness,contrast);
1028  if (status == MagickFalse)
1029    InheritException(wand->exception,&wand->images->exception);
1030  return(status);
1031}
1032
1033/*
1034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1035%                                                                             %
1036%                                                                             %
1037%                                                                             %
1038%   M a g i c k C h a r c o a l I m a g e                                     %
1039%                                                                             %
1040%                                                                             %
1041%                                                                             %
1042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1043%
1044%  MagickCharcoalImage() simulates a charcoal drawing.
1045%
1046%  The format of the MagickCharcoalImage method is:
1047%
1048%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1049%        const double radius,const double sigma)
1050%
1051%  A description of each parameter follows:
1052%
1053%    o wand: the magick wand.
1054%
1055%    o radius: the radius of the Gaussian, in pixels, not counting the center
1056%      pixel.
1057%
1058%    o sigma: the standard deviation of the Gaussian, in pixels.
1059%
1060*/
1061WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1062  const double radius,const double sigma)
1063{
1064  Image
1065    *charcoal_image;
1066
1067  assert(wand != (MagickWand *) NULL);
1068  assert(wand->signature == WandSignature);
1069  if (wand->debug != MagickFalse)
1070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1071  if (wand->images == (Image *) NULL)
1072    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1073  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1074  if (charcoal_image == (Image *) NULL)
1075    return(MagickFalse);
1076  ReplaceImageInList(&wand->images,charcoal_image);
1077  return(MagickTrue);
1078}
1079
1080/*
1081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082%                                                                             %
1083%                                                                             %
1084%                                                                             %
1085%   M a g i c k C h o p I m a g e                                             %
1086%                                                                             %
1087%                                                                             %
1088%                                                                             %
1089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090%
1091%  MagickChopImage() removes a region of an image and collapses the image to
1092%  occupy the removed portion
1093%
1094%  The format of the MagickChopImage method is:
1095%
1096%      MagickBooleanType MagickChopImage(MagickWand *wand,
1097%        const size_t width,const size_t height,const ssize_t x,
1098%        const ssize_t y)
1099%
1100%  A description of each parameter follows:
1101%
1102%    o wand: the magick wand.
1103%
1104%    o width: the region width.
1105%
1106%    o height: the region height.
1107%
1108%    o x: the region x offset.
1109%
1110%    o y: the region y offset.
1111%
1112%
1113*/
1114WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1115  const size_t width,const size_t height,const ssize_t x,
1116  const ssize_t y)
1117{
1118  Image
1119    *chop_image;
1120
1121  RectangleInfo
1122    chop;
1123
1124  assert(wand != (MagickWand *) NULL);
1125  assert(wand->signature == WandSignature);
1126  if (wand->debug != MagickFalse)
1127    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1128  if (wand->images == (Image *) NULL)
1129    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1130  chop.width=width;
1131  chop.height=height;
1132  chop.x=x;
1133  chop.y=y;
1134  chop_image=ChopImage(wand->images,&chop,wand->exception);
1135  if (chop_image == (Image *) NULL)
1136    return(MagickFalse);
1137  ReplaceImageInList(&wand->images,chop_image);
1138  return(MagickTrue);
1139}
1140
1141/*
1142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143%                                                                             %
1144%                                                                             %
1145%                                                                             %
1146%   M a g i c k C l a m p I m a g e                                           %
1147%                                                                             %
1148%                                                                             %
1149%                                                                             %
1150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1151%
1152%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1153%
1154%  The format of the MagickClampImage method is:
1155%
1156%      MagickBooleanType MagickClampImage(MagickWand *wand)
1157%
1158%  A description of each parameter follows:
1159%
1160%    o wand: the magick wand.
1161%
1162%    o channel: the channel.
1163%
1164*/
1165WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1166{
1167  MagickBooleanType
1168    status;
1169
1170  assert(wand != (MagickWand *) NULL);
1171  assert(wand->signature == WandSignature);
1172  if (wand->debug != MagickFalse)
1173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1174  if (wand->images == (Image *) NULL)
1175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1176  status=ClampImage(wand->images);
1177  if (status == MagickFalse)
1178    InheritException(wand->exception,&wand->images->exception);
1179  return(status);
1180}
1181
1182/*
1183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184%                                                                             %
1185%                                                                             %
1186%                                                                             %
1187%   M a g i c k C l i p I m a g e                                             %
1188%                                                                             %
1189%                                                                             %
1190%                                                                             %
1191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1192%
1193%  MagickClipImage() clips along the first path from the 8BIM profile, if
1194%  present.
1195%
1196%  The format of the MagickClipImage method is:
1197%
1198%      MagickBooleanType MagickClipImage(MagickWand *wand)
1199%
1200%  A description of each parameter follows:
1201%
1202%    o wand: the magick wand.
1203%
1204*/
1205WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1206{
1207  MagickBooleanType
1208    status;
1209
1210  assert(wand != (MagickWand *) NULL);
1211  assert(wand->signature == WandSignature);
1212  if (wand->debug != MagickFalse)
1213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1214  if (wand->images == (Image *) NULL)
1215    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1216  status=ClipImage(wand->images);
1217  if (status == MagickFalse)
1218    InheritException(wand->exception,&wand->images->exception);
1219  return(status);
1220}
1221
1222/*
1223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1224%                                                                             %
1225%                                                                             %
1226%                                                                             %
1227%   M a g i c k C l i p I m a g e P a t h                                     %
1228%                                                                             %
1229%                                                                             %
1230%                                                                             %
1231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232%
1233%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1234%  present. Later operations take effect inside the path.  Id may be a number
1235%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1236%  path.
1237%
1238%  The format of the MagickClipImagePath method is:
1239%
1240%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1241%        const char *pathname,const MagickBooleanType inside)
1242%
1243%  A description of each parameter follows:
1244%
1245%    o wand: the magick wand.
1246%
1247%    o pathname: name of clipping path resource. If name is preceded by #, use
1248%      clipping path numbered by name.
1249%
1250%    o inside: if non-zero, later operations take effect inside clipping path.
1251%      Otherwise later operations take effect outside clipping path.
1252%
1253*/
1254WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1255  const char *pathname,const MagickBooleanType inside)
1256{
1257  MagickBooleanType
1258    status;
1259
1260  assert(wand != (MagickWand *) NULL);
1261  assert(wand->signature == WandSignature);
1262  if (wand->debug != MagickFalse)
1263    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1264  if (wand->images == (Image *) NULL)
1265    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1266  status=ClipImagePath(wand->images,pathname,inside);
1267  if (status == MagickFalse)
1268    InheritException(wand->exception,&wand->images->exception);
1269  return(status);
1270}
1271
1272/*
1273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1274%                                                                             %
1275%                                                                             %
1276%                                                                             %
1277%   M a g i c k C l u t I m a g e                                             %
1278%                                                                             %
1279%                                                                             %
1280%                                                                             %
1281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1282%
1283%  MagickClutImage() replaces colors in the image from a color lookup table.
1284%
1285%  The format of the MagickClutImage method is:
1286%
1287%      MagickBooleanType MagickClutImage(MagickWand *wand,
1288%        const MagickWand *clut_wand)
1289%
1290%  A description of each parameter follows:
1291%
1292%    o wand: the magick wand.
1293%
1294%    o clut_image: the clut image.
1295%
1296*/
1297WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1298  const MagickWand *clut_wand)
1299{
1300  MagickBooleanType
1301    status;
1302
1303  assert(wand != (MagickWand *) NULL);
1304  assert(wand->signature == WandSignature);
1305  if (wand->debug != MagickFalse)
1306    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1307  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1308    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1309  status=ClutImage(wand->images,clut_wand->images);
1310  if (status == MagickFalse)
1311    InheritException(wand->exception,&wand->images->exception);
1312  return(status);
1313}
1314
1315/*
1316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1317%                                                                             %
1318%                                                                             %
1319%                                                                             %
1320%   M a g i c k C o a l e s c e I m a g e s                                   %
1321%                                                                             %
1322%                                                                             %
1323%                                                                             %
1324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1325%
1326%  MagickCoalesceImages() composites a set of images while respecting any page
1327%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1328%  typically start with an image background and each subsequent image
1329%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1330%  where each image in the sequence is the same size as the first and
1331%  composited with the next image in the sequence.
1332%
1333%  The format of the MagickCoalesceImages method is:
1334%
1335%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1336%
1337%  A description of each parameter follows:
1338%
1339%    o wand: the magick wand.
1340%
1341*/
1342WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1343{
1344  Image
1345    *coalesce_image;
1346
1347  assert(wand != (MagickWand *) NULL);
1348  assert(wand->signature == WandSignature);
1349  if (wand->debug != MagickFalse)
1350    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1351  if (wand->images == (Image *) NULL)
1352    return((MagickWand *) NULL);
1353  coalesce_image=CoalesceImages(wand->images,wand->exception);
1354  if (coalesce_image == (Image *) NULL)
1355    return((MagickWand *) NULL);
1356  return(CloneMagickWandFromImages(wand,coalesce_image));
1357}
1358
1359/*
1360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1361%                                                                             %
1362%                                                                             %
1363%                                                                             %
1364%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1365%                                                                             %
1366%                                                                             %
1367%                                                                             %
1368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369%
1370%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1371%  Collection (CCC) file which solely contains one or more color corrections
1372%  and applies the color correction to the image.  Here is a sample CCC file:
1373%
1374%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1375%          <ColorCorrection id="cc03345">
1376%                <SOPNode>
1377%                     <Slope> 0.9 1.2 0.5 </Slope>
1378%                     <Offset> 0.4 -0.5 0.6 </Offset>
1379%                     <Power> 1.0 0.8 1.5 </Power>
1380%                </SOPNode>
1381%                <SATNode>
1382%                     <Saturation> 0.85 </Saturation>
1383%                </SATNode>
1384%          </ColorCorrection>
1385%    </ColorCorrectionCollection>
1386%
1387%  which includes the offset, slope, and power for each of the RGB channels
1388%  as well as the saturation.
1389%
1390%  The format of the MagickColorDecisionListImage method is:
1391%
1392%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1393%        const double gamma)
1394%
1395%  A description of each parameter follows:
1396%
1397%    o wand: the magick wand.
1398%
1399%    o color_correction_collection: the color correction collection in XML.
1400%
1401*/
1402WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1403  const char *color_correction_collection)
1404{
1405  MagickBooleanType
1406    status;
1407
1408  assert(wand != (MagickWand *) NULL);
1409  assert(wand->signature == WandSignature);
1410  if (wand->debug != MagickFalse)
1411    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1412  if (wand->images == (Image *) NULL)
1413    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1414  status=ColorDecisionListImage(wand->images,color_correction_collection);
1415  if (status == MagickFalse)
1416    InheritException(wand->exception,&wand->images->exception);
1417  return(status);
1418}
1419
1420/*
1421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422%                                                                             %
1423%                                                                             %
1424%                                                                             %
1425%   M a g i c k C o l o r i z e I m a g e                                     %
1426%                                                                             %
1427%                                                                             %
1428%                                                                             %
1429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1430%
1431%  MagickColorizeImage() blends the fill color with each pixel in the image.
1432%
1433%  The format of the MagickColorizeImage method is:
1434%
1435%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1436%        const PixelWand *colorize,const PixelWand *opacity)
1437%
1438%  A description of each parameter follows:
1439%
1440%    o wand: the magick wand.
1441%
1442%    o colorize: the colorize pixel wand.
1443%
1444%    o opacity: the opacity pixel wand.
1445%
1446*/
1447WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1448  const PixelWand *colorize,const PixelWand *opacity)
1449{
1450  char
1451    percent_opaque[MaxTextExtent];
1452
1453  Image
1454    *colorize_image;
1455
1456  PixelPacket
1457    target;
1458
1459  assert(wand != (MagickWand *) NULL);
1460  assert(wand->signature == WandSignature);
1461  if (wand->debug != MagickFalse)
1462    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1463  if (wand->images == (Image *) NULL)
1464    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1465  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1466    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1467    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1468    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1469    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1470    PixelGetOpacityQuantum(opacity)));
1471  PixelGetQuantumPacket(colorize,&target);
1472  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1473    wand->exception);
1474  if (colorize_image == (Image *) NULL)
1475    return(MagickFalse);
1476  ReplaceImageInList(&wand->images,colorize_image);
1477  return(MagickTrue);
1478}
1479
1480/*
1481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1482%                                                                             %
1483%                                                                             %
1484%                                                                             %
1485%   M a g i c k C o l o r M a t r i x I m a g e                               %
1486%                                                                             %
1487%                                                                             %
1488%                                                                             %
1489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1490%
1491%  MagickColorMatrixImage() apply color transformation to an image. The method
1492%  permits saturation changes, hue rotation, luminance to alpha, and various
1493%  other effects.  Although variable-sized transformation matrices can be used,
1494%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1495%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1496%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1497%  and offsets are normalized (divide Flash offset by 255).
1498%
1499%  The format of the MagickColorMatrixImage method is:
1500%
1501%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1502%        const KernelInfo *color_matrix)
1503%
1504%  A description of each parameter follows:
1505%
1506%    o wand: the magick wand.
1507%
1508%    o color_matrix:  the color matrix.
1509%
1510*/
1511WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1512  const KernelInfo *color_matrix)
1513{
1514  Image
1515    *color_image;
1516
1517  assert(wand != (MagickWand *) NULL);
1518  assert(wand->signature == WandSignature);
1519  if (wand->debug != MagickFalse)
1520    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1521  if (color_matrix == (const KernelInfo *) NULL)
1522    return(MagickFalse);
1523  if (wand->images == (Image *) NULL)
1524    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1525  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1526  if (color_image == (Image *) NULL)
1527    return(MagickFalse);
1528  ReplaceImageInList(&wand->images,color_image);
1529  return(MagickTrue);
1530}
1531
1532/*
1533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1534%                                                                             %
1535%                                                                             %
1536%                                                                             %
1537%   M a g i c k C o m b i n e I m a g e s                                     %
1538%                                                                             %
1539%                                                                             %
1540%                                                                             %
1541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1542%
1543%  MagickCombineImages() combines one or more images into a single image.  The
1544%  grayscale value of the pixels of each image in the sequence is assigned in
1545%  order to the specified  hannels of the combined image.   The typical
1546%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1547%
1548%  The format of the MagickCombineImages method is:
1549%
1550%      MagickWand *MagickCombineImages(MagickWand *wand)
1551%
1552%  A description of each parameter follows:
1553%
1554%    o wand: the magick wand.
1555%
1556*/
1557WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1558{
1559  Image
1560    *combine_image;
1561
1562  assert(wand != (MagickWand *) NULL);
1563  assert(wand->signature == WandSignature);
1564  if (wand->debug != MagickFalse)
1565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1566  if (wand->images == (Image *) NULL)
1567    return((MagickWand *) NULL);
1568  combine_image=CombineImages(wand->images,wand->exception);
1569  if (combine_image == (Image *) NULL)
1570    return((MagickWand *) NULL);
1571  return(CloneMagickWandFromImages(wand,combine_image));
1572}
1573
1574/*
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%                                                                             %
1577%                                                                             %
1578%                                                                             %
1579%   M a g i c k C o m m e n t I m a g e                                       %
1580%                                                                             %
1581%                                                                             %
1582%                                                                             %
1583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1584%
1585%  MagickCommentImage() adds a comment to your image.
1586%
1587%  The format of the MagickCommentImage method is:
1588%
1589%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1590%        const char *comment)
1591%
1592%  A description of each parameter follows:
1593%
1594%    o wand: the magick wand.
1595%
1596%    o comment: the image comment.
1597%
1598*/
1599WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1600  const char *comment)
1601{
1602  MagickBooleanType
1603    status;
1604
1605  assert(wand != (MagickWand *) NULL);
1606  assert(wand->signature == WandSignature);
1607  if (wand->debug != MagickFalse)
1608    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1609  if (wand->images == (Image *) NULL)
1610    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1611  status=SetImageProperty(wand->images,"comment",comment);
1612  if (status == MagickFalse)
1613    InheritException(wand->exception,&wand->images->exception);
1614  return(status);
1615}
1616
1617/*
1618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619%                                                                             %
1620%                                                                             %
1621%                                                                             %
1622%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1623%                                                                             %
1624%                                                                             %
1625%                                                                             %
1626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1627%
1628%  MagickCompareImagesLayers() compares each image with the next in a sequence
1629%  and returns the maximum bounding region of any pixel differences it
1630%  discovers.
1631%
1632%  The format of the MagickCompareImagesLayers method is:
1633%
1634%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1635%        const ImageLayerMethod method)
1636%
1637%  A description of each parameter follows:
1638%
1639%    o wand: the magick wand.
1640%
1641%    o method: the compare method.
1642%
1643*/
1644WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1645  const ImageLayerMethod method)
1646{
1647  Image
1648    *layers_image;
1649
1650  assert(wand != (MagickWand *) NULL);
1651  assert(wand->signature == WandSignature);
1652  if (wand->debug != MagickFalse)
1653    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1654  if (wand->images == (Image *) NULL)
1655    return((MagickWand *) NULL);
1656  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1657  if (layers_image == (Image *) NULL)
1658    return((MagickWand *) NULL);
1659  return(CloneMagickWandFromImages(wand,layers_image));
1660}
1661
1662/*
1663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664%                                                                             %
1665%                                                                             %
1666%                                                                             %
1667%   M a g i c k C o m p a r e I m a g e s                                     %
1668%                                                                             %
1669%                                                                             %
1670%                                                                             %
1671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1672%
1673%  MagickCompareImages() compares an image to a reconstructed image and returns
1674%  the specified difference image.
1675%
1676%  The format of the MagickCompareImages method is:
1677%
1678%      MagickWand *MagickCompareImages(MagickWand *wand,
1679%        const MagickWand *reference,const MetricType metric,
1680%        double *distortion)
1681%
1682%  A description of each parameter follows:
1683%
1684%    o wand: the magick wand.
1685%
1686%    o reference: the reference wand.
1687%
1688%    o metric: the metric.
1689%
1690%    o distortion: the computed distortion between the images.
1691%
1692*/
1693WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1694  const MagickWand *reference,const MetricType metric,double *distortion)
1695{
1696  Image
1697    *compare_image;
1698
1699
1700  assert(wand != (MagickWand *) NULL);
1701  assert(wand->signature == WandSignature);
1702  if (wand->debug != MagickFalse)
1703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1704  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1705    {
1706      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1707        "ContainsNoImages","`%s'",wand->name);
1708      return((MagickWand *) NULL);
1709    }
1710  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1711    &wand->images->exception);
1712  if (compare_image == (Image *) NULL)
1713    return((MagickWand *) NULL);
1714  return(CloneMagickWandFromImages(wand,compare_image));
1715}
1716
1717/*
1718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719%                                                                             %
1720%                                                                             %
1721%                                                                             %
1722%   M a g i c k C o m p o s i t e I m a g e                                   %
1723%                                                                             %
1724%                                                                             %
1725%                                                                             %
1726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1727%
1728%  MagickCompositeImage() composite one image onto another at the specified
1729%  offset.
1730%
1731%  The format of the MagickCompositeImage method is:
1732%
1733%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1734%        const MagickWand *composite_wand,const CompositeOperator compose,
1735%        const ssize_t x,const ssize_t y)
1736%
1737%  A description of each parameter follows:
1738%
1739%    o wand: the magick wand.
1740%
1741%    o composite_image: the composite image.
1742%
1743%    o compose: This operator affects how the composite is applied to the
1744%      image.  The default is Over.  Choose from these operators:
1745%
1746%        OverCompositeOp       InCompositeOp         OutCompositeOp
1747%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1748%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1749%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1750%        DisplaceCompositeOp
1751%
1752%    o x: the column offset of the composited image.
1753%
1754%    o y: the row offset of the composited image.
1755%
1756*/
1757WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1758  const MagickWand *composite_wand,const CompositeOperator compose,
1759  const ssize_t x,const ssize_t y)
1760{
1761  MagickBooleanType
1762    status;
1763
1764  assert(wand != (MagickWand *) NULL);
1765  assert(wand->signature == WandSignature);
1766  if (wand->debug != MagickFalse)
1767    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1768  if ((wand->images == (Image *) NULL) ||
1769      (composite_wand->images == (Image *) NULL))
1770    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1771  status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1772  if (status == MagickFalse)
1773    InheritException(wand->exception,&wand->images->exception);
1774  return(status);
1775}
1776
1777/*
1778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1779%                                                                             %
1780%                                                                             %
1781%                                                                             %
1782%   M a g i c k C o n t r a s t I m a g e                                     %
1783%                                                                             %
1784%                                                                             %
1785%                                                                             %
1786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1787%
1788%  MagickContrastImage() enhances the intensity differences between the lighter
1789%  and darker elements of the image.  Set sharpen to a value other than 0 to
1790%  increase the image contrast otherwise the contrast is reduced.
1791%
1792%  The format of the MagickContrastImage method is:
1793%
1794%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1795%        const MagickBooleanType sharpen)
1796%
1797%  A description of each parameter follows:
1798%
1799%    o wand: the magick wand.
1800%
1801%    o sharpen: Increase or decrease image contrast.
1802%
1803%
1804*/
1805WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1806  const MagickBooleanType sharpen)
1807{
1808  MagickBooleanType
1809    status;
1810
1811  assert(wand != (MagickWand *) NULL);
1812  assert(wand->signature == WandSignature);
1813  if (wand->debug != MagickFalse)
1814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1815  if (wand->images == (Image *) NULL)
1816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1817  status=ContrastImage(wand->images,sharpen);
1818  if (status == MagickFalse)
1819    InheritException(wand->exception,&wand->images->exception);
1820  return(status);
1821}
1822
1823/*
1824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825%                                                                             %
1826%                                                                             %
1827%                                                                             %
1828%   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                       %
1829%                                                                             %
1830%                                                                             %
1831%                                                                             %
1832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1833%
1834%  MagickContrastStretchImage() enhances the contrast of a color image by
1835%  adjusting the pixels color to span the entire range of colors available.
1836%  You can also reduce the influence of a particular channel with a gamma
1837%  value of 0.
1838%
1839%  The format of the MagickContrastStretchImage method is:
1840%
1841%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1842%        const double black_point,const double white_point)
1843%
1844%  A description of each parameter follows:
1845%
1846%    o wand: the magick wand.
1847%
1848%    o black_point: the black point.
1849%
1850%    o white_point: the white point.
1851%
1852*/
1853WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1854  const double black_point,const double white_point)
1855{
1856  MagickBooleanType
1857    status;
1858
1859  assert(wand != (MagickWand *) NULL);
1860  assert(wand->signature == WandSignature);
1861  if (wand->debug != MagickFalse)
1862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1863  if (wand->images == (Image *) NULL)
1864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1865  status=ContrastStretchImage(wand->images,black_point,white_point);
1866  if (status == MagickFalse)
1867    InheritException(wand->exception,&wand->images->exception);
1868  return(status);
1869}
1870
1871/*
1872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1873%                                                                             %
1874%                                                                             %
1875%                                                                             %
1876%   M a g i c k C o n v o l v e I m a g e                                     %
1877%                                                                             %
1878%                                                                             %
1879%                                                                             %
1880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1881%
1882%  MagickConvolveImage() applies a custom convolution kernel to the image.
1883%
1884%  The format of the MagickConvolveImage method is:
1885%
1886%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1887%        const KernelInfo *kernel)
1888%
1889%  A description of each parameter follows:
1890%
1891%    o wand: the magick wand.
1892%
1893%    o kernel: An array of doubles representing the convolution kernel.
1894%
1895*/
1896WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1897  const KernelInfo *kernel)
1898{
1899  Image
1900    *filter_image;
1901
1902  assert(wand != (MagickWand *) NULL);
1903  assert(wand->signature == WandSignature);
1904  if (wand->debug != MagickFalse)
1905    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1906  if (kernel == (const KernelInfo *) NULL)
1907    return(MagickFalse);
1908  if (wand->images == (Image *) NULL)
1909    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1910  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1911  if (filter_image == (Image *) NULL)
1912    return(MagickFalse);
1913  ReplaceImageInList(&wand->images,filter_image);
1914  return(MagickTrue);
1915}
1916
1917/*
1918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1919%                                                                             %
1920%                                                                             %
1921%                                                                             %
1922%   M a g i c k C r o p I m a g e                                             %
1923%                                                                             %
1924%                                                                             %
1925%                                                                             %
1926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1927%
1928%  MagickCropImage() extracts a region of the image.
1929%
1930%  The format of the MagickCropImage method is:
1931%
1932%      MagickBooleanType MagickCropImage(MagickWand *wand,
1933%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1934%
1935%  A description of each parameter follows:
1936%
1937%    o wand: the magick wand.
1938%
1939%    o width: the region width.
1940%
1941%    o height: the region height.
1942%
1943%    o x: the region x-offset.
1944%
1945%    o y: the region y-offset.
1946%
1947*/
1948WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1949  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1950{
1951  Image
1952    *crop_image;
1953
1954  RectangleInfo
1955    crop;
1956
1957  assert(wand != (MagickWand *) NULL);
1958  assert(wand->signature == WandSignature);
1959  if (wand->debug != MagickFalse)
1960    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1961  if (wand->images == (Image *) NULL)
1962    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1963  crop.width=width;
1964  crop.height=height;
1965  crop.x=x;
1966  crop.y=y;
1967  crop_image=CropImage(wand->images,&crop,wand->exception);
1968  if (crop_image == (Image *) NULL)
1969    return(MagickFalse);
1970  ReplaceImageInList(&wand->images,crop_image);
1971  return(MagickTrue);
1972}
1973
1974/*
1975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1976%                                                                             %
1977%                                                                             %
1978%                                                                             %
1979%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1980%                                                                             %
1981%                                                                             %
1982%                                                                             %
1983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1984%
1985%  MagickCycleColormapImage() displaces an image's colormap by a given number
1986%  of positions.  If you cycle the colormap a number of times you can produce
1987%  a psychodelic effect.
1988%
1989%  The format of the MagickCycleColormapImage method is:
1990%
1991%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1992%        const ssize_t displace)
1993%
1994%  A description of each parameter follows:
1995%
1996%    o wand: the magick wand.
1997%
1998%    o pixel_wand: the pixel wand.
1999%
2000*/
2001WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2002  const ssize_t displace)
2003{
2004  MagickBooleanType
2005    status;
2006
2007  assert(wand != (MagickWand *) NULL);
2008  assert(wand->signature == WandSignature);
2009  if (wand->debug != MagickFalse)
2010    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2011  if (wand->images == (Image *) NULL)
2012    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2013  status=CycleColormapImage(wand->images,displace);
2014  if (status == MagickFalse)
2015    InheritException(wand->exception,&wand->images->exception);
2016  return(status);
2017}
2018
2019/*
2020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2021%                                                                             %
2022%                                                                             %
2023%                                                                             %
2024%   M a g i c k C o n s t i t u t e I m a g e                                 %
2025%                                                                             %
2026%                                                                             %
2027%                                                                             %
2028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2029%
2030%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2031%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2032%  The data can be char, short int, int, float, or double.  Float and double
2033%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2034%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2035%  example, to create a 640x480 image from unsigned red-green-blue character
2036%  data, use
2037%
2038%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2039%
2040%  The format of the MagickConstituteImage method is:
2041%
2042%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2043%        const size_t columns,const size_t rows,const char *map,
2044%        const StorageType storage,void *pixels)
2045%
2046%  A description of each parameter follows:
2047%
2048%    o wand: the magick wand.
2049%
2050%    o columns: width in pixels of the image.
2051%
2052%    o rows: height in pixels of the image.
2053%
2054%    o map:  This string reflects the expected ordering of the pixel array.
2055%      It can be any combination or order of R = red, G = green, B = blue,
2056%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2057%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2058%      P = pad.
2059%
2060%    o storage: Define the data type of the pixels.  Float and double types are
2061%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2062%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2063%      LongPixel, QuantumPixel, or ShortPixel.
2064%
2065%    o pixels: This array of values contain the pixel components as defined by
2066%      map and type.  You must preallocate this array where the expected
2067%      length varies depending on the values of width, height, map, and type.
2068%
2069%
2070*/
2071WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2072  const size_t columns,const size_t rows,const char *map,
2073  const StorageType storage,const void *pixels)
2074{
2075  Image
2076    *images;
2077
2078  assert(wand != (MagickWand *) NULL);
2079  assert(wand->signature == WandSignature);
2080  if (wand->debug != MagickFalse)
2081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2082  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2083  if (images == (Image *) NULL)
2084    return(MagickFalse);
2085  return(InsertImageInWand(wand,images));
2086}
2087
2088/*
2089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2090%                                                                             %
2091%                                                                             %
2092%                                                                             %
2093%   M a g i c k D e c i p h e r I m a g e                                     %
2094%                                                                             %
2095%                                                                             %
2096%                                                                             %
2097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2098%
2099%  MagickDecipherImage() converts cipher pixels to plain pixels.
2100%
2101%  The format of the MagickDecipherImage method is:
2102%
2103%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2104%        const char *passphrase)
2105%
2106%  A description of each parameter follows:
2107%
2108%    o wand: the magick wand.
2109%
2110%    o passphrase: the passphrase.
2111%
2112*/
2113WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2114  const char *passphrase)
2115{
2116  assert(wand != (MagickWand *) NULL);
2117  assert(wand->signature == WandSignature);
2118  if (wand->debug != MagickFalse)
2119    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2120  if (wand->images == (Image *) NULL)
2121    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2122  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2123}
2124
2125/*
2126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2127%                                                                             %
2128%                                                                             %
2129%                                                                             %
2130%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2131%                                                                             %
2132%                                                                             %
2133%                                                                             %
2134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2135%
2136%  MagickDeconstructImages() compares each image with the next in a sequence
2137%  and returns the maximum bounding region of any pixel differences it
2138%  discovers.
2139%
2140%  The format of the MagickDeconstructImages method is:
2141%
2142%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2143%
2144%  A description of each parameter follows:
2145%
2146%    o wand: the magick wand.
2147%
2148*/
2149WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2150{
2151  Image
2152    *deconstruct_image;
2153
2154  assert(wand != (MagickWand *) NULL);
2155  assert(wand->signature == WandSignature);
2156  if (wand->debug != MagickFalse)
2157    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2158  if (wand->images == (Image *) NULL)
2159    return((MagickWand *) NULL);
2160  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2161    wand->exception);
2162  if (deconstruct_image == (Image *) NULL)
2163    return((MagickWand *) NULL);
2164  return(CloneMagickWandFromImages(wand,deconstruct_image));
2165}
2166
2167/*
2168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169%                                                                             %
2170%                                                                             %
2171%                                                                             %
2172%     M a g i c k D e s k e w I m a g e                                       %
2173%                                                                             %
2174%                                                                             %
2175%                                                                             %
2176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177%
2178%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2179%  occurs in scanned images because of the camera being misaligned,
2180%  imperfections in the scanning or surface, or simply because the paper was
2181%  not placed completely flat when scanned.
2182%
2183%  The format of the MagickDeskewImage method is:
2184%
2185%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2186%        const double threshold)
2187%
2188%  A description of each parameter follows:
2189%
2190%    o wand: the magick wand.
2191%
2192%    o threshold: separate background from foreground.
2193%
2194*/
2195WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2196  const double threshold)
2197{
2198  Image
2199    *sepia_image;
2200
2201  assert(wand != (MagickWand *) NULL);
2202  assert(wand->signature == WandSignature);
2203  if (wand->debug != MagickFalse)
2204    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2205  if (wand->images == (Image *) NULL)
2206    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2207  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2208  if (sepia_image == (Image *) NULL)
2209    return(MagickFalse);
2210  ReplaceImageInList(&wand->images,sepia_image);
2211  return(MagickTrue);
2212}
2213
2214/*
2215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2216%                                                                             %
2217%                                                                             %
2218%                                                                             %
2219%     M a g i c k D e s p e c k l e I m a g e                                 %
2220%                                                                             %
2221%                                                                             %
2222%                                                                             %
2223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2224%
2225%  MagickDespeckleImage() reduces the speckle noise in an image while
2226%  perserving the edges of the original image.
2227%
2228%  The format of the MagickDespeckleImage method is:
2229%
2230%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2231%
2232%  A description of each parameter follows:
2233%
2234%    o wand: the magick wand.
2235%
2236*/
2237WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2238{
2239  Image
2240    *despeckle_image;
2241
2242  assert(wand != (MagickWand *) NULL);
2243  assert(wand->signature == WandSignature);
2244  if (wand->debug != MagickFalse)
2245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2246  if (wand->images == (Image *) NULL)
2247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2248  despeckle_image=DespeckleImage(wand->images,wand->exception);
2249  if (despeckle_image == (Image *) NULL)
2250    return(MagickFalse);
2251  ReplaceImageInList(&wand->images,despeckle_image);
2252  return(MagickTrue);
2253}
2254
2255/*
2256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2257%                                                                             %
2258%                                                                             %
2259%                                                                             %
2260%   M a g i c k D e s t r o y I m a g e                                       %
2261%                                                                             %
2262%                                                                             %
2263%                                                                             %
2264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265%
2266%  MagickDestroyImage() dereferences an image, deallocating memory associated
2267%  with the image if the reference count becomes zero.
2268%
2269%  The format of the MagickDestroyImage method is:
2270%
2271%      Image *MagickDestroyImage(Image *image)
2272%
2273%  A description of each parameter follows:
2274%
2275%    o image: the image.
2276%
2277*/
2278WandExport Image *MagickDestroyImage(Image *image)
2279{
2280  return(DestroyImage(image));
2281}
2282
2283/*
2284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2285%                                                                             %
2286%                                                                             %
2287%                                                                             %
2288%   M a g i c k D i s p l a y I m a g e                                       %
2289%                                                                             %
2290%                                                                             %
2291%                                                                             %
2292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2293%
2294%  MagickDisplayImage() displays an image.
2295%
2296%  The format of the MagickDisplayImage method is:
2297%
2298%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2299%        const char *server_name)
2300%
2301%  A description of each parameter follows:
2302%
2303%    o wand: the magick wand.
2304%
2305%    o server_name: the X server name.
2306%
2307*/
2308WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2309  const char *server_name)
2310{
2311  Image
2312    *image;
2313
2314  MagickBooleanType
2315    status;
2316
2317  assert(wand != (MagickWand *) NULL);
2318  assert(wand->signature == WandSignature);
2319  if (wand->debug != MagickFalse)
2320    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2321  if (wand->images == (Image *) NULL)
2322    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2323  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2324  if (image == (Image *) NULL)
2325    return(MagickFalse);
2326  (void) CloneString(&wand->image_info->server_name,server_name);
2327  status=DisplayImages(wand->image_info,image);
2328  if (status == MagickFalse)
2329    InheritException(wand->exception,&image->exception);
2330  image=DestroyImage(image);
2331  return(status);
2332}
2333
2334/*
2335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2336%                                                                             %
2337%                                                                             %
2338%                                                                             %
2339%   M a g i c k D i s p l a y I m a g e s                                     %
2340%                                                                             %
2341%                                                                             %
2342%                                                                             %
2343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2344%
2345%  MagickDisplayImages() displays an image or image sequence.
2346%
2347%  The format of the MagickDisplayImages method is:
2348%
2349%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2350%        const char *server_name)
2351%
2352%  A description of each parameter follows:
2353%
2354%    o wand: the magick wand.
2355%
2356%    o server_name: the X server name.
2357%
2358*/
2359WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2360  const char *server_name)
2361{
2362  MagickBooleanType
2363    status;
2364
2365  assert(wand != (MagickWand *) NULL);
2366  assert(wand->signature == WandSignature);
2367  if (wand->debug != MagickFalse)
2368    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2369  (void) CloneString(&wand->image_info->server_name,server_name);
2370  status=DisplayImages(wand->image_info,wand->images);
2371  if (status == MagickFalse)
2372    InheritException(wand->exception,&wand->images->exception);
2373  return(status);
2374}
2375
2376/*
2377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2378%                                                                             %
2379%                                                                             %
2380%                                                                             %
2381%   M a g i c k D i s t o r t I m a g e                                       %
2382%                                                                             %
2383%                                                                             %
2384%                                                                             %
2385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2386%
2387%  MagickDistortImage() distorts an image using various distortion methods, by
2388%  mapping color lookups of the source image to a new destination image
2389%  usally of the same size as the source image, unless 'bestfit' is set to
2390%  true.
2391%
2392%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2393%  adjusted to ensure the whole source 'image' will just fit within the final
2394%  destination image, which will be sized and offset accordingly.  Also in
2395%  many cases the virtual offset of the source image will be taken into
2396%  account in the mapping.
2397%
2398%  The format of the MagickDistortImage method is:
2399%
2400%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2401%        const DistortImageMethod method,const size_t number_arguments,
2402%        const double *arguments,const MagickBooleanType bestfit)
2403%
2404%  A description of each parameter follows:
2405%
2406%    o image: the image to be distorted.
2407%
2408%    o method: the method of image distortion.
2409%
2410%        ArcDistortion always ignores the source image offset, and always
2411%        'bestfit' the destination image with the top left corner offset
2412%        relative to the polar mapping center.
2413%
2414%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2415%        style of image distortion.
2416%
2417%        Affine, Perspective, and Bilinear, do least squares fitting of the
2418%        distortion when more than the minimum number of control point pairs
2419%        are provided.
2420%
2421%        Perspective, and Bilinear, falls back to a Affine distortion when less
2422%        that 4 control point pairs are provided. While Affine distortions let
2423%        you use any number of control point pairs, that is Zero pairs is a
2424%        no-Op (viewport only) distrotion, one pair is a translation and two
2425%        pairs of control points do a scale-rotate-translate, without any
2426%        shearing.
2427%
2428%    o number_arguments: the number of arguments given for this distortion
2429%      method.
2430%
2431%    o arguments: the arguments for this distortion method.
2432%
2433%    o bestfit: Attempt to resize destination to fit distorted source.
2434%
2435*/
2436WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2437  const DistortImageMethod method,const size_t number_arguments,
2438  const double *arguments,const MagickBooleanType bestfit)
2439{
2440  Image
2441    *distort_image;
2442
2443  assert(wand != (MagickWand *) NULL);
2444  assert(wand->signature == WandSignature);
2445  if (wand->debug != MagickFalse)
2446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2447  if (wand->images == (Image *) NULL)
2448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2449  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2450    bestfit,wand->exception);
2451  if (distort_image == (Image *) NULL)
2452    return(MagickFalse);
2453  ReplaceImageInList(&wand->images,distort_image);
2454  return(MagickTrue);
2455}
2456
2457/*
2458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2459%                                                                             %
2460%                                                                             %
2461%                                                                             %
2462%   M a g i c k D r a w I m a g e                                             %
2463%                                                                             %
2464%                                                                             %
2465%                                                                             %
2466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2467%
2468%  MagickDrawImage() renders the drawing wand on the current image.
2469%
2470%  The format of the MagickDrawImage method is:
2471%
2472%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2473%        const DrawingWand *drawing_wand)
2474%
2475%  A description of each parameter follows:
2476%
2477%    o wand: the magick wand.
2478%
2479%    o drawing_wand: the draw wand.
2480%
2481*/
2482WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2483  const DrawingWand *drawing_wand)
2484{
2485  char
2486    *primitive;
2487
2488  DrawInfo
2489    *draw_info;
2490
2491  MagickBooleanType
2492    status;
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  draw_info=PeekDrawingWand(drawing_wand);
2501  if ((draw_info == (DrawInfo *) NULL) ||
2502      (draw_info->primitive == (char *) NULL))
2503    return(MagickFalse);
2504  primitive=AcquireString(draw_info->primitive);
2505  draw_info=DestroyDrawInfo(draw_info);
2506  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2507  draw_info->primitive=primitive;
2508  status=DrawImage(wand->images,draw_info);
2509  if (status == MagickFalse)
2510    InheritException(wand->exception,&wand->images->exception);
2511  draw_info=DestroyDrawInfo(draw_info);
2512  return(status);
2513}
2514
2515/*
2516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2517%                                                                             %
2518%                                                                             %
2519%                                                                             %
2520%   M a g i c k E d g e I m a g e                                             %
2521%                                                                             %
2522%                                                                             %
2523%                                                                             %
2524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2525%
2526%  MagickEdgeImage() enhance edges within the image with a convolution filter
2527%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2528%  radius for you.
2529%
2530%  The format of the MagickEdgeImage method is:
2531%
2532%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2533%
2534%  A description of each parameter follows:
2535%
2536%    o wand: the magick wand.
2537%
2538%    o radius: the radius of the pixel neighborhood.
2539%
2540*/
2541WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2542  const double radius)
2543{
2544  Image
2545    *edge_image;
2546
2547  assert(wand != (MagickWand *) NULL);
2548  assert(wand->signature == WandSignature);
2549  if (wand->debug != MagickFalse)
2550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2551  if (wand->images == (Image *) NULL)
2552    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2553  edge_image=EdgeImage(wand->images,radius,wand->exception);
2554  if (edge_image == (Image *) NULL)
2555    return(MagickFalse);
2556  ReplaceImageInList(&wand->images,edge_image);
2557  return(MagickTrue);
2558}
2559
2560/*
2561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2562%                                                                             %
2563%                                                                             %
2564%                                                                             %
2565%   M a g i c k E m b o s s I m a g e                                         %
2566%                                                                             %
2567%                                                                             %
2568%                                                                             %
2569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2570%
2571%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2572%  effect.  We convolve the image with a Gaussian operator of the given radius
2573%  and standard deviation (sigma).  For reasonable results, radius should be
2574%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2575%  radius for you.
2576%
2577%  The format of the MagickEmbossImage method is:
2578%
2579%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2580%        const double sigma)
2581%
2582%  A description of each parameter follows:
2583%
2584%    o wand: the magick wand.
2585%
2586%    o radius: the radius of the Gaussian, in pixels, not counting the center
2587%      pixel.
2588%
2589%    o sigma: the standard deviation of the Gaussian, in pixels.
2590%
2591*/
2592WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2593  const double radius,const double sigma)
2594{
2595  Image
2596    *emboss_image;
2597
2598  assert(wand != (MagickWand *) NULL);
2599  assert(wand->signature == WandSignature);
2600  if (wand->debug != MagickFalse)
2601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2602  if (wand->images == (Image *) NULL)
2603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2604  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2605  if (emboss_image == (Image *) NULL)
2606    return(MagickFalse);
2607  ReplaceImageInList(&wand->images,emboss_image);
2608  return(MagickTrue);
2609}
2610
2611/*
2612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2613%                                                                             %
2614%                                                                             %
2615%                                                                             %
2616%   M a g i c k E n c i p h e r I m a g e                                     %
2617%                                                                             %
2618%                                                                             %
2619%                                                                             %
2620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2621%
2622%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2623%
2624%  The format of the MagickEncipherImage method is:
2625%
2626%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2627%        const char *passphrase)
2628%
2629%  A description of each parameter follows:
2630%
2631%    o wand: the magick wand.
2632%
2633%    o passphrase: the passphrase.
2634%
2635*/
2636WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2637  const char *passphrase)
2638{
2639  assert(wand != (MagickWand *) NULL);
2640  assert(wand->signature == WandSignature);
2641  if (wand->debug != MagickFalse)
2642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2643  if (wand->images == (Image *) NULL)
2644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2645  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2646}
2647
2648/*
2649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2650%                                                                             %
2651%                                                                             %
2652%                                                                             %
2653%   M a g i c k E n h a n c e I m a g e                                       %
2654%                                                                             %
2655%                                                                             %
2656%                                                                             %
2657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2658%
2659%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2660%  noisy image.
2661%
2662%  The format of the MagickEnhanceImage method is:
2663%
2664%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2665%
2666%  A description of each parameter follows:
2667%
2668%    o wand: the magick wand.
2669%
2670*/
2671WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2672{
2673  Image
2674    *enhance_image;
2675
2676  assert(wand != (MagickWand *) NULL);
2677  assert(wand->signature == WandSignature);
2678  if (wand->debug != MagickFalse)
2679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2680  if (wand->images == (Image *) NULL)
2681    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2682  enhance_image=EnhanceImage(wand->images,wand->exception);
2683  if (enhance_image == (Image *) NULL)
2684    return(MagickFalse);
2685  ReplaceImageInList(&wand->images,enhance_image);
2686  return(MagickTrue);
2687}
2688
2689/*
2690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2691%                                                                             %
2692%                                                                             %
2693%                                                                             %
2694%   M a g i c k E q u a l i z e I m a g e                                     %
2695%                                                                             %
2696%                                                                             %
2697%                                                                             %
2698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2699%
2700%  MagickEqualizeImage() equalizes the image histogram.
2701%
2702%  The format of the MagickEqualizeImage method is:
2703%
2704%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2705%
2706%  A description of each parameter follows:
2707%
2708%    o wand: the magick wand.
2709%
2710%    o channel: the image channel(s).
2711%
2712*/
2713WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2714{
2715  MagickBooleanType
2716    status;
2717
2718  assert(wand != (MagickWand *) NULL);
2719  assert(wand->signature == WandSignature);
2720  if (wand->debug != MagickFalse)
2721    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2722  if (wand->images == (Image *) NULL)
2723    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2724  status=EqualizeImage(wand->images);
2725  if (status == MagickFalse)
2726    InheritException(wand->exception,&wand->images->exception);
2727  return(status);
2728}
2729
2730/*
2731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2732%                                                                             %
2733%                                                                             %
2734%                                                                             %
2735%   M a g i c k E v a l u a t e I m a g e                                     %
2736%                                                                             %
2737%                                                                             %
2738%                                                                             %
2739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2740%
2741%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2742%  expression to an image.  Use these operators to lighten or darken an image,
2743%  to increase or decrease contrast in an image, or to produce the "negative"
2744%  of an image.
2745%
2746%  The format of the MagickEvaluateImage method is:
2747%
2748%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2749%        const MagickEvaluateOperator operator,const double value)
2750%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2751%        const MagickEvaluateOperator operator)
2752%
2753%  A description of each parameter follows:
2754%
2755%    o wand: the magick wand.
2756%
2757%    o op: A channel operator.
2758%
2759%    o value: A value value.
2760%
2761*/
2762
2763WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2764  const MagickEvaluateOperator op)
2765{
2766  Image
2767    *evaluate_image;
2768
2769  assert(wand != (MagickWand *) NULL);
2770  assert(wand->signature == WandSignature);
2771  if (wand->debug != MagickFalse)
2772    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2773  if (wand->images == (Image *) NULL)
2774    return((MagickWand *) NULL);
2775  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2776  if (evaluate_image == (Image *) NULL)
2777    return((MagickWand *) NULL);
2778  return(CloneMagickWandFromImages(wand,evaluate_image));
2779}
2780
2781WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2782  const MagickEvaluateOperator op,const double value)
2783{
2784  MagickBooleanType
2785    status;
2786
2787  assert(wand != (MagickWand *) NULL);
2788  assert(wand->signature == WandSignature);
2789  if (wand->debug != MagickFalse)
2790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2791  if (wand->images == (Image *) NULL)
2792    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2793  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2794  return(status);
2795}
2796
2797/*
2798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2799%                                                                             %
2800%                                                                             %
2801%                                                                             %
2802%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2803%                                                                             %
2804%                                                                             %
2805%                                                                             %
2806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2807%
2808%  MagickExportImagePixels() extracts pixel data from an image and returns it
2809%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2810%  an error is encountered.  The data is returned as char, short int, int,
2811%  ssize_t, float, or double in the order specified by map.
2812%
2813%  Suppose you want to extract the first scanline of a 640x480 image as
2814%  character data in red-green-blue order:
2815%
2816%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2817%
2818%  The format of the MagickExportImagePixels method is:
2819%
2820%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2821%        const ssize_t x,const ssize_t y,const size_t columns,
2822%        const size_t rows,const char *map,const StorageType storage,
2823%        void *pixels)
2824%
2825%  A description of each parameter follows:
2826%
2827%    o wand: the magick wand.
2828%
2829%    o x, y, columns, rows:  These values define the perimeter
2830%      of a region of pixels you want to extract.
2831%
2832%    o map:  This string reflects the expected ordering of the pixel array.
2833%      It can be any combination or order of R = red, G = green, B = blue,
2834%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2835%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2836%      P = pad.
2837%
2838%    o storage: Define the data type of the pixels.  Float and double types are
2839%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2840%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2841%      LongPixel, QuantumPixel, or ShortPixel.
2842%
2843%    o pixels: This array of values contain the pixel components as defined by
2844%      map and type.  You must preallocate this array where the expected
2845%      length varies depending on the values of width, height, map, and type.
2846%
2847*/
2848WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2849  const ssize_t x,const ssize_t y,const size_t columns,
2850  const size_t rows,const char *map,const StorageType storage,
2851  void *pixels)
2852{
2853  MagickBooleanType
2854    status;
2855
2856  assert(wand != (MagickWand *) NULL);
2857  assert(wand->signature == WandSignature);
2858  if (wand->debug != MagickFalse)
2859    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2860  if (wand->images == (Image *) NULL)
2861    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2862  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2863    storage,pixels,wand->exception);
2864  if (status == MagickFalse)
2865    InheritException(wand->exception,&wand->images->exception);
2866  return(status);
2867}
2868
2869/*
2870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2871%                                                                             %
2872%                                                                             %
2873%                                                                             %
2874%   M a g i c k E x t e n t I m a g e                                         %
2875%                                                                             %
2876%                                                                             %
2877%                                                                             %
2878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2879%
2880%  MagickExtentImage() extends the image as defined by the geometry, gravity,
2881%  and wand background color.  Set the (x,y) offset of the geometry to move
2882%  the original wand relative to the extended wand.
2883%
2884%  The format of the MagickExtentImage method is:
2885%
2886%      MagickBooleanType MagickExtentImage(MagickWand *wand,
2887%        const size_t width,const size_t height,const ssize_t x,
2888%        const ssize_t y)
2889%
2890%  A description of each parameter follows:
2891%
2892%    o wand: the magick wand.
2893%
2894%    o width: the region width.
2895%
2896%    o height: the region height.
2897%
2898%    o x: the region x offset.
2899%
2900%    o y: the region y offset.
2901%
2902*/
2903WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2904  const size_t width,const size_t height,const ssize_t x,
2905  const ssize_t y)
2906{
2907  Image
2908    *extent_image;
2909
2910  RectangleInfo
2911    extent;
2912
2913  assert(wand != (MagickWand *) NULL);
2914  assert(wand->signature == WandSignature);
2915  if (wand->debug != MagickFalse)
2916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2917  if (wand->images == (Image *) NULL)
2918    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2919  extent.width=width;
2920  extent.height=height;
2921  extent.x=x;
2922  extent.y=y;
2923  extent_image=ExtentImage(wand->images,&extent,wand->exception);
2924  if (extent_image == (Image *) NULL)
2925    return(MagickFalse);
2926  ReplaceImageInList(&wand->images,extent_image);
2927  return(MagickTrue);
2928}
2929
2930/*
2931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2932%                                                                             %
2933%                                                                             %
2934%                                                                             %
2935%   M a g i c k F l i p I m a g e                                             %
2936%                                                                             %
2937%                                                                             %
2938%                                                                             %
2939%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2940%
2941%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2942%  around the central x-axis.
2943%
2944%  The format of the MagickFlipImage method is:
2945%
2946%      MagickBooleanType MagickFlipImage(MagickWand *wand)
2947%
2948%  A description of each parameter follows:
2949%
2950%    o wand: the magick wand.
2951%
2952*/
2953WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2954{
2955  Image
2956    *flip_image;
2957
2958  assert(wand != (MagickWand *) NULL);
2959  assert(wand->signature == WandSignature);
2960  if (wand->debug != MagickFalse)
2961    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2962  if (wand->images == (Image *) NULL)
2963    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2964  flip_image=FlipImage(wand->images,wand->exception);
2965  if (flip_image == (Image *) NULL)
2966    return(MagickFalse);
2967  ReplaceImageInList(&wand->images,flip_image);
2968  return(MagickTrue);
2969}
2970
2971/*
2972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2973%                                                                             %
2974%                                                                             %
2975%                                                                             %
2976%   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                         %
2977%                                                                             %
2978%                                                                             %
2979%                                                                             %
2980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2981%
2982%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2983%  target and is an immediate neighbor.  If the method FillToBorderMethod is
2984%  specified, the color value is changed for any neighbor pixel that does not
2985%  match the bordercolor member of image.
2986%
2987%  The format of the MagickFloodfillPaintImage method is:
2988%
2989%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2990%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2991%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2992%
2993%  A description of each parameter follows:
2994%
2995%    o wand: the magick wand.
2996%
2997%    o fill: the floodfill color pixel wand.
2998%
2999%    o fuzz: By default target must match a particular pixel color
3000%      exactly.  However, in many cases two colors may differ by a small amount.
3001%      The fuzz member of image defines how much tolerance is acceptable to
3002%      consider two colors as the same.  For example, set fuzz to 10 and the
3003%      color red at intensities of 100 and 102 respectively are now interpreted
3004%      as the same color for the purposes of the floodfill.
3005%
3006%    o bordercolor: the border color pixel wand.
3007%
3008%    o x,y: the starting location of the operation.
3009%
3010%    o invert: paint any pixel that does not match the target color.
3011%
3012*/
3013WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3014  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3015  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3016{
3017  DrawInfo
3018    *draw_info;
3019
3020  MagickBooleanType
3021    status;
3022
3023  PixelInfo
3024    target;
3025
3026  assert(wand != (MagickWand *) NULL);
3027  assert(wand->signature == WandSignature);
3028  if (wand->debug != MagickFalse)
3029    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3030  if (wand->images == (Image *) NULL)
3031    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3032  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3033  PixelGetQuantumPacket(fill,&draw_info->fill);
3034  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3035    y % wand->images->rows,&target,wand->exception);
3036  if (bordercolor != (PixelWand *) NULL)
3037    PixelGetMagickColor(bordercolor,&target);
3038  wand->images->fuzz=fuzz;
3039  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert);
3040  if (status == MagickFalse)
3041    InheritException(wand->exception,&wand->images->exception);
3042  draw_info=DestroyDrawInfo(draw_info);
3043  return(status);
3044}
3045
3046/*
3047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3048%                                                                             %
3049%                                                                             %
3050%                                                                             %
3051%   M a g i c k F l o p I m a g e                                             %
3052%                                                                             %
3053%                                                                             %
3054%                                                                             %
3055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3056%
3057%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3058%  around the central y-axis.
3059%
3060%  The format of the MagickFlopImage method is:
3061%
3062%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3063%
3064%  A description of each parameter follows:
3065%
3066%    o wand: the magick wand.
3067%
3068*/
3069WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3070{
3071  Image
3072    *flop_image;
3073
3074  assert(wand != (MagickWand *) NULL);
3075  assert(wand->signature == WandSignature);
3076  if (wand->debug != MagickFalse)
3077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3078  if (wand->images == (Image *) NULL)
3079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3080  flop_image=FlopImage(wand->images,wand->exception);
3081  if (flop_image == (Image *) NULL)
3082    return(MagickFalse);
3083  ReplaceImageInList(&wand->images,flop_image);
3084  return(MagickTrue);
3085}
3086
3087/*
3088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3089%                                                                             %
3090%                                                                             %
3091%                                                                             %
3092%   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                     %
3093%                                                                             %
3094%                                                                             %
3095%                                                                             %
3096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3097%
3098%  MagickForwardFourierTransformImage() implements the discrete Fourier
3099%  transform (DFT) of the image either as a magnitude / phase or real /
3100%  imaginary image pair.
3101%
3102%  The format of the MagickForwardFourierTransformImage method is:
3103%
3104%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3105%        const MagickBooleanType magnitude)
3106%
3107%  A description of each parameter follows:
3108%
3109%    o wand: the magick wand.
3110%
3111%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3112%      imaginary image pair.
3113%
3114*/
3115WandExport MagickBooleanType MagickForwardFourierTransformImage(
3116  MagickWand *wand,const MagickBooleanType magnitude)
3117{
3118  Image
3119    *forward_image;
3120
3121  assert(wand != (MagickWand *) NULL);
3122  assert(wand->signature == WandSignature);
3123  if (wand->debug != MagickFalse)
3124    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3125  if (wand->images == (Image *) NULL)
3126    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3127  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3128    wand->exception);
3129  if (forward_image == (Image *) NULL)
3130    return(MagickFalse);
3131  ReplaceImageInList(&wand->images,forward_image);
3132  return(MagickTrue);
3133}
3134
3135/*
3136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3137%                                                                             %
3138%                                                                             %
3139%                                                                             %
3140%   M a g i c k F r a m e I m a g e                                           %
3141%                                                                             %
3142%                                                                             %
3143%                                                                             %
3144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3145%
3146%  MagickFrameImage() adds a simulated three-dimensional border around the
3147%  image.  The width and height specify the border width of the vertical and
3148%  horizontal sides of the frame.  The inner and outer bevels indicate the
3149%  width of the inner and outer shadows of the frame.
3150%
3151%  The format of the MagickFrameImage method is:
3152%
3153%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3154%        const PixelWand *matte_color,const size_t width,
3155%        const size_t height,const ssize_t inner_bevel,
3156%        const ssize_t outer_bevel)
3157%
3158%  A description of each parameter follows:
3159%
3160%    o wand: the magick wand.
3161%
3162%    o matte_color: the frame color pixel wand.
3163%
3164%    o width: the border width.
3165%
3166%    o height: the border height.
3167%
3168%    o inner_bevel: the inner bevel width.
3169%
3170%    o outer_bevel: the outer bevel width.
3171%
3172*/
3173WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3174  const PixelWand *matte_color,const size_t width,
3175  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3176{
3177  Image
3178    *frame_image;
3179
3180  FrameInfo
3181    frame_info;
3182
3183  assert(wand != (MagickWand *) NULL);
3184  assert(wand->signature == WandSignature);
3185  if (wand->debug != MagickFalse)
3186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3187  if (wand->images == (Image *) NULL)
3188    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3189  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3190  frame_info.width=wand->images->columns+2*width;
3191  frame_info.height=wand->images->rows+2*height;
3192  frame_info.x=(ssize_t) width;
3193  frame_info.y=(ssize_t) height;
3194  frame_info.inner_bevel=inner_bevel;
3195  frame_info.outer_bevel=outer_bevel;
3196  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3197  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3198  if (frame_image == (Image *) NULL)
3199    return(MagickFalse);
3200  ReplaceImageInList(&wand->images,frame_image);
3201  return(MagickTrue);
3202}
3203
3204/*
3205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3206%                                                                             %
3207%                                                                             %
3208%                                                                             %
3209%   M a g i c k F u n c t i o n I m a g e                                     %
3210%                                                                             %
3211%                                                                             %
3212%                                                                             %
3213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3214%
3215%  MagickFunctionImage() applys an arithmetic, relational, or logical
3216%  expression to an image.  Use these operators to lighten or darken an image,
3217%  to increase or decrease contrast in an image, or to produce the "negative"
3218%  of an image.
3219%
3220%  The format of the MagickFunctionImage method is:
3221%
3222%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3223%        const MagickFunction function,const size_t number_arguments,
3224%        const double *arguments)
3225%
3226%  A description of each parameter follows:
3227%
3228%    o wand: the magick wand.
3229%
3230%    o function: the image function.
3231%
3232%    o number_arguments: the number of function arguments.
3233%
3234%    o arguments: the function arguments.
3235%
3236*/
3237WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3238  const MagickFunction function,const size_t number_arguments,
3239  const double *arguments)
3240{
3241  MagickBooleanType
3242    status;
3243
3244  assert(wand != (MagickWand *) NULL);
3245  assert(wand->signature == WandSignature);
3246  if (wand->debug != MagickFalse)
3247    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3248  if (wand->images == (Image *) NULL)
3249    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3250  status=FunctionImage(wand->images,function,number_arguments,arguments,
3251    &wand->images->exception);
3252  return(status);
3253}
3254
3255/*
3256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3257%                                                                             %
3258%                                                                             %
3259%                                                                             %
3260%   M a g i c k F x I m a g e                                                 %
3261%                                                                             %
3262%                                                                             %
3263%                                                                             %
3264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3265%
3266%  MagickFxImage() evaluate expression for each pixel in the image.
3267%
3268%  The format of the MagickFxImage method is:
3269%
3270%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3271%
3272%  A description of each parameter follows:
3273%
3274%    o wand: the magick wand.
3275%
3276%    o expression: the expression.
3277%
3278*/
3279WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3280{
3281  Image
3282    *fx_image;
3283
3284  assert(wand != (MagickWand *) NULL);
3285  assert(wand->signature == WandSignature);
3286  if (wand->debug != MagickFalse)
3287    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3288  if (wand->images == (Image *) NULL)
3289    return((MagickWand *) NULL);
3290  fx_image=FxImage(wand->images,expression,wand->exception);
3291  if (fx_image == (Image *) NULL)
3292    return((MagickWand *) NULL);
3293  return(CloneMagickWandFromImages(wand,fx_image));
3294}
3295
3296/*
3297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3298%                                                                             %
3299%                                                                             %
3300%                                                                             %
3301%   M a g i c k G a m m a I m a g e                                           %
3302%                                                                             %
3303%                                                                             %
3304%                                                                             %
3305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3306%
3307%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3308%  different devices will have perceptual differences in the way the image's
3309%  intensities are represented on the screen.  Specify individual gamma levels
3310%  for the red, green, and blue channels, or adjust all three with the gamma
3311%  parameter.  Values typically range from 0.8 to 2.3.
3312%
3313%  You can also reduce the influence of a particular channel with a gamma
3314%  value of 0.
3315%
3316%  The format of the MagickGammaImage method is:
3317%
3318%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3319%
3320%  A description of each parameter follows:
3321%
3322%    o wand: the magick wand.
3323%
3324%    o level: Define the level of gamma correction.
3325%
3326*/
3327WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3328  const double gamma)
3329{
3330  MagickBooleanType
3331    status;
3332
3333  assert(wand != (MagickWand *) NULL);
3334  assert(wand->signature == WandSignature);
3335  if (wand->debug != MagickFalse)
3336    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3337  if (wand->images == (Image *) NULL)
3338    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3339  status=GammaImage(wand->images,gamma,wand->exception);
3340  return(status);
3341}
3342
3343/*
3344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3345%                                                                             %
3346%                                                                             %
3347%                                                                             %
3348%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3349%                                                                             %
3350%                                                                             %
3351%                                                                             %
3352%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3353%
3354%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3355%  Gaussian operator of the given radius and standard deviation (sigma).
3356%  For reasonable results, the radius should be larger than sigma.  Use a
3357%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3358%
3359%  The format of the MagickGaussianBlurImage method is:
3360%
3361%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3362%        const double radius,const double sigma)
3363%
3364%  A description of each parameter follows:
3365%
3366%    o wand: the magick wand.
3367%
3368%    o radius: the radius of the Gaussian, in pixels, not counting the center
3369%      pixel.
3370%
3371%    o sigma: the standard deviation of the Gaussian, in pixels.
3372%
3373*/
3374WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3375  const double radius,const double sigma)
3376{
3377  Image
3378    *blur_image;
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  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3387  if (blur_image == (Image *) NULL)
3388    return(MagickFalse);
3389  ReplaceImageInList(&wand->images,blur_image);
3390  return(MagickTrue);
3391}
3392
3393/*
3394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3395%                                                                             %
3396%                                                                             %
3397%                                                                             %
3398%   M a g i c k G e t I m a g e                                               %
3399%                                                                             %
3400%                                                                             %
3401%                                                                             %
3402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3403%
3404%  MagickGetImage() gets the image at the current image index.
3405%
3406%  The format of the MagickGetImage method is:
3407%
3408%      MagickWand *MagickGetImage(MagickWand *wand)
3409%
3410%  A description of each parameter follows:
3411%
3412%    o wand: the magick wand.
3413%
3414*/
3415WandExport MagickWand *MagickGetImage(MagickWand *wand)
3416{
3417  Image
3418    *image;
3419
3420  assert(wand != (MagickWand *) NULL);
3421  assert(wand->signature == WandSignature);
3422  if (wand->debug != MagickFalse)
3423    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3424  if (wand->images == (Image *) NULL)
3425    {
3426      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3427        "ContainsNoImages","`%s'",wand->name);
3428      return((MagickWand *) NULL);
3429    }
3430  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3431  if (image == (Image *) NULL)
3432    return((MagickWand *) NULL);
3433  return(CloneMagickWandFromImages(wand,image));
3434}
3435
3436/*
3437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3438%                                                                             %
3439%                                                                             %
3440%                                                                             %
3441%   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                       %
3442%                                                                             %
3443%                                                                             %
3444%                                                                             %
3445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3446%
3447%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3448%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3449%  than CMYKA.
3450%
3451%  The format of the MagickGetImageAlphaChannel method is:
3452%
3453%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3454%
3455%  A description of each parameter follows:
3456%
3457%    o wand: the magick wand.
3458%
3459*/
3460WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3461{
3462  assert(wand != (MagickWand *) NULL);
3463  assert(wand->signature == WandSignature);
3464  if (wand->debug != MagickFalse)
3465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3466  if (wand->images == (Image *) NULL)
3467    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3468  return(GetImageAlphaChannel(wand->images));
3469}
3470
3471/*
3472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3473%                                                                             %
3474%                                                                             %
3475%                                                                             %
3476%   M a g i c k G e t I m a g e C l i p M a s k                               %
3477%                                                                             %
3478%                                                                             %
3479%                                                                             %
3480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3481%
3482%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3483%
3484%  The format of the MagickGetImageClipMask method is:
3485%
3486%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3487%
3488%  A description of each parameter follows:
3489%
3490%    o wand: the magick wand.
3491%
3492*/
3493WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3494{
3495  Image
3496    *image;
3497
3498  assert(wand != (MagickWand *) NULL);
3499  assert(wand->signature == WandSignature);
3500  if (wand->debug != MagickFalse)
3501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3502  if (wand->images == (Image *) NULL)
3503    {
3504      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3505        "ContainsNoImages","`%s'",wand->name);
3506      return((MagickWand *) NULL);
3507    }
3508  image=GetImageClipMask(wand->images,wand->exception);
3509  if (image == (Image *) NULL)
3510    return((MagickWand *) NULL);
3511  return(CloneMagickWandFromImages(wand,image));
3512}
3513
3514/*
3515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3516%                                                                             %
3517%                                                                             %
3518%                                                                             %
3519%   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                 %
3520%                                                                             %
3521%                                                                             %
3522%                                                                             %
3523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3524%
3525%  MagickGetImageBackgroundColor() returns the image background color.
3526%
3527%  The format of the MagickGetImageBackgroundColor method is:
3528%
3529%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3530%        PixelWand *background_color)
3531%
3532%  A description of each parameter follows:
3533%
3534%    o wand: the magick wand.
3535%
3536%    o background_color: Return the background color.
3537%
3538*/
3539WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3540  PixelWand *background_color)
3541{
3542  assert(wand != (MagickWand *) NULL);
3543  assert(wand->signature == WandSignature);
3544  if (wand->debug != MagickFalse)
3545    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3546  if (wand->images == (Image *) NULL)
3547    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3548  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3549  return(MagickTrue);
3550}
3551
3552/*
3553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3554%                                                                             %
3555%                                                                             %
3556%                                                                             %
3557%   M a g i c k G e t I m a g e B l o b                                       %
3558%                                                                             %
3559%                                                                             %
3560%                                                                             %
3561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3562%
3563%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3564%  the image as a blob (a formatted "file" in memory) and its length, starting
3565%  from the current position in the image sequence.  Use MagickSetImageFormat()
3566%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3567%
3568%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3569%  the image sequence.
3570%
3571%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3572%
3573%  The format of the MagickGetImageBlob method is:
3574%
3575%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3576%
3577%  A description of each parameter follows:
3578%
3579%    o wand: the magick wand.
3580%
3581%    o length: the length of the blob.
3582%
3583*/
3584WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3585{
3586  assert(wand != (MagickWand *) NULL);
3587  assert(wand->signature == WandSignature);
3588  if (wand->debug != MagickFalse)
3589    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3590  if (wand->images == (Image *) NULL)
3591    {
3592      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3593        "ContainsNoImages","`%s'",wand->name);
3594      return((unsigned char *) NULL);
3595    }
3596  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3597}
3598
3599/*
3600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3601%                                                                             %
3602%                                                                             %
3603%                                                                             %
3604%   M a g i c k G e t I m a g e s B l o b                                     %
3605%                                                                             %
3606%                                                                             %
3607%                                                                             %
3608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3609%
3610%  MagickGetImageBlob() implements direct to memory image formats.  It
3611%  returns the image sequence as a blob and its length.  The format of the image
3612%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3613%  return a different image format, use MagickSetImageFormat().
3614%
3615%  Note, some image formats do not permit multiple images to the same image
3616%  stream (e.g. JPEG).  in this instance, just the first image of the
3617%  sequence is returned as a blob.
3618%
3619%  The format of the MagickGetImagesBlob method is:
3620%
3621%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3622%
3623%  A description of each parameter follows:
3624%
3625%    o wand: the magick wand.
3626%
3627%    o length: the length of the blob.
3628%
3629*/
3630WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3631{
3632  unsigned char
3633    *blob;
3634
3635  assert(wand != (MagickWand *) NULL);
3636  assert(wand->signature == WandSignature);
3637  if (wand->debug != MagickFalse)
3638    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3639  if (wand->images == (Image *) NULL)
3640    {
3641      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3642        "ContainsNoImages","`%s'",wand->name);
3643      return((unsigned char *) NULL);
3644    }
3645  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3646    wand->exception);
3647  return(blob);
3648}
3649
3650/*
3651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3652%                                                                             %
3653%                                                                             %
3654%                                                                             %
3655%   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                         %
3656%                                                                             %
3657%                                                                             %
3658%                                                                             %
3659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3660%
3661%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3662%  image.
3663%
3664%  The format of the MagickGetImageBluePrimary method is:
3665%
3666%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3667%        double *y)
3668%
3669%  A description of each parameter follows:
3670%
3671%    o wand: the magick wand.
3672%
3673%    o x: the chromaticity blue primary x-point.
3674%
3675%    o y: the chromaticity blue primary y-point.
3676%
3677*/
3678WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3679  double *x,double *y)
3680{
3681  assert(wand != (MagickWand *) NULL);
3682  assert(wand->signature == WandSignature);
3683  if (wand->debug != MagickFalse)
3684    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3685  if (wand->images == (Image *) NULL)
3686    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3687  *x=wand->images->chromaticity.blue_primary.x;
3688  *y=wand->images->chromaticity.blue_primary.y;
3689  return(MagickTrue);
3690}
3691
3692/*
3693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3694%                                                                             %
3695%                                                                             %
3696%                                                                             %
3697%   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                         %
3698%                                                                             %
3699%                                                                             %
3700%                                                                             %
3701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3702%
3703%  MagickGetImageBorderColor() returns the image border color.
3704%
3705%  The format of the MagickGetImageBorderColor method is:
3706%
3707%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3708%        PixelWand *border_color)
3709%
3710%  A description of each parameter follows:
3711%
3712%    o wand: the magick wand.
3713%
3714%    o border_color: Return the border color.
3715%
3716*/
3717WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3718  PixelWand *border_color)
3719{
3720  assert(wand != (MagickWand *) NULL);
3721  assert(wand->signature == WandSignature);
3722  if (wand->debug != MagickFalse)
3723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3724  if (wand->images == (Image *) NULL)
3725    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3726  PixelSetQuantumPacket(border_color,&wand->images->border_color);
3727  return(MagickTrue);
3728}
3729
3730/*
3731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3732%                                                                             %
3733%                                                                             %
3734%                                                                             %
3735%   M a g i c k G e t I m a g e F e a t u r e s                               %
3736%                                                                             %
3737%                                                                             %
3738%                                                                             %
3739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3740%
3741%  MagickGetImageFeatures() returns features for each channel in the
3742%  image in each of four directions (horizontal, vertical, left and right
3743%  diagonals) for the specified distance.  The features include the angular
3744%  second moment, contrast, correlation, sum of squares: variance, inverse
3745%  difference moment, sum average, sum varience, sum entropy, entropy,
3746%  difference variance, difference entropy, information measures of
3747%  correlation 1, information measures of correlation 2, and maximum
3748%  correlation coefficient.  You can access the red channel contrast, for
3749%  example, like this:
3750%
3751%      channel_features=MagickGetImageFeatures(wand,1);
3752%      contrast=channel_features[RedChannel].contrast[0];
3753%
3754%  Use MagickRelinquishMemory() to free the statistics buffer.
3755%
3756%  The format of the MagickGetImageFeatures method is:
3757%
3758%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3759%        const size_t distance)
3760%
3761%  A description of each parameter follows:
3762%
3763%    o wand: the magick wand.
3764%
3765%    o distance: the distance.
3766%
3767*/
3768WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3769  const size_t distance)
3770{
3771  assert(wand != (MagickWand *) NULL);
3772  assert(wand->signature == WandSignature);
3773  if (wand->debug != MagickFalse)
3774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3775  if (wand->images == (Image *) NULL)
3776    {
3777      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3778        "ContainsNoImages","`%s'",wand->name);
3779      return((ChannelFeatures *) NULL);
3780    }
3781  return(GetImageFeatures(wand->images,distance,wand->exception));
3782}
3783
3784/*
3785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3786%                                                                             %
3787%                                                                             %
3788%                                                                             %
3789%   M a g i c k G e t I m a g e K u r t o s i s                               %
3790%                                                                             %
3791%                                                                             %
3792%                                                                             %
3793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3794%
3795%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3796%  more image channels.
3797%
3798%  The format of the MagickGetImageKurtosis method is:
3799%
3800%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3801%        double *kurtosis,double *skewness)
3802%
3803%  A description of each parameter follows:
3804%
3805%    o wand: the magick wand.
3806%
3807%    o kurtosis:  The kurtosis for the specified channel(s).
3808%
3809%    o skewness:  The skewness for the specified channel(s).
3810%
3811*/
3812WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3813  double *kurtosis,double *skewness)
3814{
3815  MagickBooleanType
3816    status;
3817
3818  assert(wand != (MagickWand *) NULL);
3819  assert(wand->signature == WandSignature);
3820  if (wand->debug != MagickFalse)
3821    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3822  if (wand->images == (Image *) NULL)
3823    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3824  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3825  return(status);
3826}
3827
3828/*
3829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3830%                                                                             %
3831%                                                                             %
3832%                                                                             %
3833%   M a g i c k G e t I m a g e M e a n                                       %
3834%                                                                             %
3835%                                                                             %
3836%                                                                             %
3837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3838%
3839%  MagickGetImageMean() gets the mean and standard deviation of one or more
3840%  image channels.
3841%
3842%  The format of the MagickGetImageMean method is:
3843%
3844%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3845%        double *standard_deviation)
3846%
3847%  A description of each parameter follows:
3848%
3849%    o wand: the magick wand.
3850%
3851%    o channel: the image channel(s).
3852%
3853%    o mean:  The mean pixel value for the specified channel(s).
3854%
3855%    o standard_deviation:  The standard deviation for the specified channel(s).
3856%
3857*/
3858WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3859  double *standard_deviation)
3860{
3861  MagickBooleanType
3862    status;
3863
3864  assert(wand != (MagickWand *) NULL);
3865  assert(wand->signature == WandSignature);
3866  if (wand->debug != MagickFalse)
3867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3868  if (wand->images == (Image *) NULL)
3869    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3870  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3871  return(status);
3872}
3873
3874/*
3875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3876%                                                                             %
3877%                                                                             %
3878%                                                                             %
3879%   M a g i c k G e t I m a g e R a n g e                                     %
3880%                                                                             %
3881%                                                                             %
3882%                                                                             %
3883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3884%
3885%  MagickGetImageRange() gets the range for one or more image channels.
3886%
3887%  The format of the MagickGetImageRange method is:
3888%
3889%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3890%        double *maxima)
3891%
3892%  A description of each parameter follows:
3893%
3894%    o wand: the magick wand.
3895%
3896%    o minima:  The minimum pixel value for the specified channel(s).
3897%
3898%    o maxima:  The maximum pixel value for the specified channel(s).
3899%
3900*/
3901WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3902  double *minima,double *maxima)
3903{
3904  MagickBooleanType
3905    status;
3906
3907  assert(wand != (MagickWand *) NULL);
3908  assert(wand->signature == WandSignature);
3909  if (wand->debug != MagickFalse)
3910    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3911  if (wand->images == (Image *) NULL)
3912    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3913  status=GetImageRange(wand->images,minima,maxima,wand->exception);
3914  return(status);
3915}
3916
3917/*
3918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3919%                                                                             %
3920%                                                                             %
3921%                                                                             %
3922%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3923%                                                                             %
3924%                                                                             %
3925%                                                                             %
3926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3927%
3928%  MagickGetImageStatistics() returns statistics for each channel in the
3929%  image.  The statistics include the channel depth, its minima and
3930%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3931%  You can access the red channel mean, for example, like this:
3932%
3933%      channel_statistics=MagickGetImageStatistics(wand);
3934%      red_mean=channel_statistics[RedChannel].mean;
3935%
3936%  Use MagickRelinquishMemory() to free the statistics buffer.
3937%
3938%  The format of the MagickGetImageStatistics method is:
3939%
3940%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3941%
3942%  A description of each parameter follows:
3943%
3944%    o wand: the magick wand.
3945%
3946*/
3947WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3948{
3949  assert(wand != (MagickWand *) NULL);
3950  assert(wand->signature == WandSignature);
3951  if (wand->debug != MagickFalse)
3952    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3953  if (wand->images == (Image *) NULL)
3954    {
3955      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3956        "ContainsNoImages","`%s'",wand->name);
3957      return((ChannelStatistics *) NULL);
3958    }
3959  return(GetImageStatistics(wand->images,wand->exception));
3960}
3961
3962/*
3963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3964%                                                                             %
3965%                                                                             %
3966%                                                                             %
3967%   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                     %
3968%                                                                             %
3969%                                                                             %
3970%                                                                             %
3971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3972%
3973%  MagickGetImageColormapColor() returns the color of the specified colormap
3974%  index.
3975%
3976%  The format of the MagickGetImageColormapColor method is:
3977%
3978%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3979%        const size_t index,PixelWand *color)
3980%
3981%  A description of each parameter follows:
3982%
3983%    o wand: the magick wand.
3984%
3985%    o index: the offset into the image colormap.
3986%
3987%    o color: Return the colormap color in this wand.
3988%
3989*/
3990WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3991  const size_t index,PixelWand *color)
3992{
3993  assert(wand != (MagickWand *) NULL);
3994  assert(wand->signature == WandSignature);
3995  if (wand->debug != MagickFalse)
3996    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3997  if (wand->images == (Image *) NULL)
3998    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3999  if ((wand->images->colormap == (PixelPacket *) NULL) ||
4000      (index >= wand->images->colors))
4001    {
4002      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4003        "InvalidColormapIndex","`%s'",wand->name);
4004      return(MagickFalse);
4005    }
4006  PixelSetQuantumPacket(color,wand->images->colormap+index);
4007  return(MagickTrue);
4008}
4009
4010/*
4011%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4012%                                                                             %
4013%                                                                             %
4014%                                                                             %
4015%   M a g i c k G e t I m a g e C o l o r s                                   %
4016%                                                                             %
4017%                                                                             %
4018%                                                                             %
4019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4020%
4021%  MagickGetImageColors() gets the number of unique colors in the image.
4022%
4023%  The format of the MagickGetImageColors method is:
4024%
4025%      size_t MagickGetImageColors(MagickWand *wand)
4026%
4027%  A description of each parameter follows:
4028%
4029%    o wand: the magick wand.
4030%
4031*/
4032WandExport size_t MagickGetImageColors(MagickWand *wand)
4033{
4034  assert(wand != (MagickWand *) NULL);
4035  assert(wand->signature == WandSignature);
4036  if (wand->debug != MagickFalse)
4037    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4038  if (wand->images == (Image *) NULL)
4039    {
4040      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4041        "ContainsNoImages","`%s'",wand->name);
4042      return(0);
4043    }
4044  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4045}
4046
4047/*
4048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4049%                                                                             %
4050%                                                                             %
4051%                                                                             %
4052%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4053%                                                                             %
4054%                                                                             %
4055%                                                                             %
4056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4057%
4058%  MagickGetImageColorspace() gets the image colorspace.
4059%
4060%  The format of the MagickGetImageColorspace method is:
4061%
4062%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4063%
4064%  A description of each parameter follows:
4065%
4066%    o wand: the magick wand.
4067%
4068*/
4069WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4070{
4071  assert(wand != (MagickWand *) NULL);
4072  assert(wand->signature == WandSignature);
4073  if (wand->debug != MagickFalse)
4074    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4075  if (wand->images == (Image *) NULL)
4076    {
4077      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4078        "ContainsNoImages","`%s'",wand->name);
4079      return(UndefinedColorspace);
4080    }
4081  return(wand->images->colorspace);
4082}
4083
4084/*
4085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4086%                                                                             %
4087%                                                                             %
4088%                                                                             %
4089%   M a g i c k G e t I m a g e C o m p o s e                                 %
4090%                                                                             %
4091%                                                                             %
4092%                                                                             %
4093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4094%
4095%  MagickGetImageCompose() returns the composite operator associated with the
4096%  image.
4097%
4098%  The format of the MagickGetImageCompose method is:
4099%
4100%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4101%
4102%  A description of each parameter follows:
4103%
4104%    o wand: the magick wand.
4105%
4106*/
4107WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4108{
4109  assert(wand != (MagickWand *) NULL);
4110  assert(wand->signature == WandSignature);
4111  if (wand->debug != MagickFalse)
4112    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4113  if (wand->images == (Image *) NULL)
4114    {
4115      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4116        "ContainsNoImages","`%s'",wand->name);
4117      return(UndefinedCompositeOp);
4118    }
4119  return(wand->images->compose);
4120}
4121
4122/*
4123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4124%                                                                             %
4125%                                                                             %
4126%                                                                             %
4127%   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                         %
4128%                                                                             %
4129%                                                                             %
4130%                                                                             %
4131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4132%
4133%  MagickGetImageCompression() gets the image compression.
4134%
4135%  The format of the MagickGetImageCompression method is:
4136%
4137%      CompressionType MagickGetImageCompression(MagickWand *wand)
4138%
4139%  A description of each parameter follows:
4140%
4141%    o wand: the magick wand.
4142%
4143*/
4144WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4145{
4146  assert(wand != (MagickWand *) NULL);
4147  assert(wand->signature == WandSignature);
4148  if (wand->debug != MagickFalse)
4149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4150  if (wand->images == (Image *) NULL)
4151    {
4152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4153        "ContainsNoImages","`%s'",wand->name);
4154      return(UndefinedCompression);
4155    }
4156  return(wand->images->compression);
4157}
4158
4159/*
4160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4161%                                                                             %
4162%                                                                             %
4163%                                                                             %
4164%   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           %
4165%                                                                             %
4166%                                                                             %
4167%                                                                             %
4168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4169%
4170%  MagickGetImageCompression() gets the image compression quality.
4171%
4172%  The format of the MagickGetImageCompression method is:
4173%
4174%      size_t MagickGetImageCompression(MagickWand *wand)
4175%
4176%  A description of each parameter follows:
4177%
4178%    o wand: the magick wand.
4179%
4180*/
4181WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4182{
4183  assert(wand != (MagickWand *) NULL);
4184  assert(wand->signature == WandSignature);
4185  if (wand->debug != MagickFalse)
4186    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4187  if (wand->images == (Image *) NULL)
4188    {
4189      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4190        "ContainsNoImages","`%s'",wand->name);
4191      return(0UL);
4192    }
4193  return(wand->images->quality);
4194}
4195
4196/*
4197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4198%                                                                             %
4199%                                                                             %
4200%                                                                             %
4201%   M a g i c k G e t I m a g e D e l a y                                     %
4202%                                                                             %
4203%                                                                             %
4204%                                                                             %
4205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4206%
4207%  MagickGetImageDelay() gets the image delay.
4208%
4209%  The format of the MagickGetImageDelay method is:
4210%
4211%      size_t MagickGetImageDelay(MagickWand *wand)
4212%
4213%  A description of each parameter follows:
4214%
4215%    o wand: the magick wand.
4216%
4217*/
4218WandExport size_t MagickGetImageDelay(MagickWand *wand)
4219{
4220  assert(wand != (MagickWand *) NULL);
4221  assert(wand->signature == WandSignature);
4222  if (wand->debug != MagickFalse)
4223    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4224  if (wand->images == (Image *) NULL)
4225    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4226  return(wand->images->delay);
4227}
4228
4229/*
4230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4231%                                                                             %
4232%                                                                             %
4233%                                                                             %
4234%   M a g i c k G e t I m a g e D e p t h                                     %
4235%                                                                             %
4236%                                                                             %
4237%                                                                             %
4238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4239%
4240%  MagickGetImageDepth() gets the image depth.
4241%
4242%  The format of the MagickGetImageDepth method is:
4243%
4244%      size_t MagickGetImageDepth(MagickWand *wand)
4245%
4246%  A description of each parameter follows:
4247%
4248%    o wand: the magick wand.
4249%
4250*/
4251WandExport size_t MagickGetImageDepth(MagickWand *wand)
4252{
4253  assert(wand != (MagickWand *) NULL);
4254  assert(wand->signature == WandSignature);
4255  if (wand->debug != MagickFalse)
4256    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4257  if (wand->images == (Image *) NULL)
4258    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4259  return(GetImageDepth(wand->images,wand->exception));
4260}
4261
4262/*
4263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4264%                                                                             %
4265%                                                                             %
4266%                                                                             %
4267%   M a g i c k G e t I m a g e D i s p o s e                                 %
4268%                                                                             %
4269%                                                                             %
4270%                                                                             %
4271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4272%
4273%  MagickGetImageDispose() gets the image disposal method.
4274%
4275%  The format of the MagickGetImageDispose method is:
4276%
4277%      DisposeType MagickGetImageDispose(MagickWand *wand)
4278%
4279%  A description of each parameter follows:
4280%
4281%    o wand: the magick wand.
4282%
4283*/
4284WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4285{
4286  assert(wand != (MagickWand *) NULL);
4287  assert(wand->signature == WandSignature);
4288  if (wand->debug != MagickFalse)
4289    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4290  if (wand->images == (Image *) NULL)
4291    {
4292      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4293        "ContainsNoImages","`%s'",wand->name);
4294      return(UndefinedDispose);
4295    }
4296  return((DisposeType) wand->images->dispose);
4297}
4298
4299/*
4300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4301%                                                                             %
4302%                                                                             %
4303%                                                                             %
4304%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4305%                                                                             %
4306%                                                                             %
4307%                                                                             %
4308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4309%
4310%  MagickGetImageDistortion() compares an image to a reconstructed image and
4311%  returns the specified distortion metric.
4312%
4313%  The format of the MagickGetImageDistortion method is:
4314%
4315%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4316%        const MagickWand *reference,const MetricType metric,
4317%        double *distortion)
4318%
4319%  A description of each parameter follows:
4320%
4321%    o wand: the magick wand.
4322%
4323%    o reference: the reference wand.
4324%
4325%    o metric: the metric.
4326%
4327%    o distortion: the computed distortion between the images.
4328%
4329*/
4330WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4331  const MagickWand *reference,const MetricType metric,double *distortion)
4332{
4333  MagickBooleanType
4334    status;
4335
4336  assert(wand != (MagickWand *) NULL);
4337  assert(wand->signature == WandSignature);
4338  if (wand->debug != MagickFalse)
4339    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4340  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4341    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4342  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4343    &wand->images->exception);
4344  return(status);
4345}
4346
4347/*
4348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4349%                                                                             %
4350%                                                                             %
4351%                                                                             %
4352%   M a g i c k G e t I m a g e D i s t o r t i o n s                         %
4353%                                                                             %
4354%                                                                             %
4355%                                                                             %
4356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4357%
4358%  MagickGetImageDistortions() compares one or more pixel channels of an
4359%  image to a reconstructed image and returns the specified distortion metrics.
4360%
4361%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4362%
4363%  The format of the MagickGetImageDistortion method is:
4364%
4365%      double *MagickGetImageDistortion(MagickWand *wand,
4366%        const MagickWand *reference,const MetricType metric)
4367%
4368%  A description of each parameter follows:
4369%
4370%    o wand: the magick wand.
4371%
4372%    o reference: the reference wand.
4373%
4374%    o metric: the metric.
4375%
4376*/
4377WandExport double *MagickGetImageDistortions(MagickWand *wand,
4378  const MagickWand *reference,const MetricType metric)
4379{
4380  double
4381    *channel_distortion;
4382
4383  assert(wand != (MagickWand *) NULL);
4384  assert(wand->signature == WandSignature);
4385  if (wand->debug != MagickFalse)
4386    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4387  assert(reference != (MagickWand *) NULL);
4388  assert(reference->signature == WandSignature);
4389  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4390    {
4391      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4392        "ContainsNoImages","`%s'",wand->name);
4393      return((double *) NULL);
4394    }
4395  channel_distortion=GetImageDistortions(wand->images,reference->images,
4396    metric,&wand->images->exception);
4397  return(channel_distortion);
4398}
4399
4400/*
4401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4402%                                                                             %
4403%                                                                             %
4404%                                                                             %
4405%   M a g i c k G e t I m a g e F i l e n a m e                               %
4406%                                                                             %
4407%                                                                             %
4408%                                                                             %
4409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4410%
4411%  MagickGetImageFilename() returns the filename of a particular image in a
4412%  sequence.
4413%
4414%  The format of the MagickGetImageFilename method is:
4415%
4416%      char *MagickGetImageFilename(MagickWand *wand)
4417%
4418%  A description of each parameter follows:
4419%
4420%    o wand: the magick wand.
4421%
4422*/
4423WandExport char *MagickGetImageFilename(MagickWand *wand)
4424{
4425  assert(wand != (MagickWand *) NULL);
4426  assert(wand->signature == WandSignature);
4427  if (wand->debug != MagickFalse)
4428    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4429  if (wand->images == (Image *) NULL)
4430    {
4431      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4432        "ContainsNoImages","`%s'",wand->name);
4433      return((char *) NULL);
4434    }
4435  return(AcquireString(wand->images->filename));
4436}
4437
4438/*
4439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4440%                                                                             %
4441%                                                                             %
4442%                                                                             %
4443%   M a g i c k G e t I m a g e F o r m a t                                   %
4444%                                                                             %
4445%                                                                             %
4446%                                                                             %
4447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4448%
4449%  MagickGetImageFormat() returns the format of a particular image in a
4450%  sequence.
4451%
4452%  The format of the MagickGetImageFormat method is:
4453%
4454%      const char *MagickGetImageFormat(MagickWand *wand)
4455%
4456%  A description of each parameter follows:
4457%
4458%    o wand: the magick wand.
4459%
4460*/
4461WandExport char *MagickGetImageFormat(MagickWand *wand)
4462{
4463  assert(wand != (MagickWand *) NULL);
4464  assert(wand->signature == WandSignature);
4465  if (wand->debug != MagickFalse)
4466    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4467  if (wand->images == (Image *) NULL)
4468    {
4469      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4470        "ContainsNoImages","`%s'",wand->name);
4471      return((char *) NULL);
4472    }
4473  return(AcquireString(wand->images->magick));
4474}
4475
4476/*
4477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4478%                                                                             %
4479%                                                                             %
4480%                                                                             %
4481%   M a g i c k G e t I m a g e F u z z                                       %
4482%                                                                             %
4483%                                                                             %
4484%                                                                             %
4485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4486%
4487%  MagickGetImageFuzz() gets the image fuzz.
4488%
4489%  The format of the MagickGetImageFuzz method is:
4490%
4491%      double MagickGetImageFuzz(MagickWand *wand)
4492%
4493%  A description of each parameter follows:
4494%
4495%    o wand: the magick wand.
4496%
4497*/
4498WandExport double MagickGetImageFuzz(MagickWand *wand)
4499{
4500  assert(wand != (MagickWand *) NULL);
4501  assert(wand->signature == WandSignature);
4502  if (wand->debug != MagickFalse)
4503    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4504  if (wand->images == (Image *) NULL)
4505    {
4506      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4507        "ContainsNoImages","`%s'",wand->name);
4508      return(0.0);
4509    }
4510  return(wand->images->fuzz);
4511}
4512
4513/*
4514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4515%                                                                             %
4516%                                                                             %
4517%                                                                             %
4518%   M a g i c k G e t I m a g e G a m m a                                     %
4519%                                                                             %
4520%                                                                             %
4521%                                                                             %
4522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4523%
4524%  MagickGetImageGamma() gets the image gamma.
4525%
4526%  The format of the MagickGetImageGamma method is:
4527%
4528%      double MagickGetImageGamma(MagickWand *wand)
4529%
4530%  A description of each parameter follows:
4531%
4532%    o wand: the magick wand.
4533%
4534*/
4535WandExport double MagickGetImageGamma(MagickWand *wand)
4536{
4537  assert(wand != (MagickWand *) NULL);
4538  assert(wand->signature == WandSignature);
4539  if (wand->debug != MagickFalse)
4540    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4541  if (wand->images == (Image *) NULL)
4542    {
4543      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4544        "ContainsNoImages","`%s'",wand->name);
4545      return(0.0);
4546    }
4547  return(wand->images->gamma);
4548}
4549
4550/*
4551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4552%                                                                             %
4553%                                                                             %
4554%                                                                             %
4555%   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                 %
4556%                                                                             %
4557%                                                                             %
4558%                                                                             %
4559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4560%
4561%  MagickGetImageGravity() gets the image gravity.
4562%
4563%  The format of the MagickGetImageGravity method is:
4564%
4565%      GravityType MagickGetImageGravity(MagickWand *wand)
4566%
4567%  A description of each parameter follows:
4568%
4569%    o wand: the magick wand.
4570%
4571*/
4572WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4573{
4574  assert(wand != (MagickWand *) NULL);
4575  assert(wand->signature == WandSignature);
4576  if (wand->debug != MagickFalse)
4577    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4578  if (wand->images == (Image *) NULL)
4579    {
4580      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4581        "ContainsNoImages","`%s'",wand->name);
4582      return(UndefinedGravity);
4583    }
4584  return(wand->images->gravity);
4585}
4586
4587/*
4588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4589%                                                                             %
4590%                                                                             %
4591%                                                                             %
4592%   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                       %
4593%                                                                             %
4594%                                                                             %
4595%                                                                             %
4596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4597%
4598%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4599%
4600%  The format of the MagickGetImageGreenPrimary method is:
4601%
4602%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4603%        double *y)
4604%
4605%  A description of each parameter follows:
4606%
4607%    o wand: the magick wand.
4608%
4609%    o x: the chromaticity green primary x-point.
4610%
4611%    o y: the chromaticity green primary y-point.
4612%
4613*/
4614WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4615  double *x,double *y)
4616{
4617  assert(wand != (MagickWand *) NULL);
4618  assert(wand->signature == WandSignature);
4619  if (wand->debug != MagickFalse)
4620    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4621  if (wand->images == (Image *) NULL)
4622    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4623  *x=wand->images->chromaticity.green_primary.x;
4624  *y=wand->images->chromaticity.green_primary.y;
4625  return(MagickTrue);
4626}
4627
4628/*
4629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4630%                                                                             %
4631%                                                                             %
4632%                                                                             %
4633%   M a g i c k G e t I m a g e H e i g h t                                   %
4634%                                                                             %
4635%                                                                             %
4636%                                                                             %
4637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4638%
4639%  MagickGetImageHeight() returns the image height.
4640%
4641%  The format of the MagickGetImageHeight method is:
4642%
4643%      size_t MagickGetImageHeight(MagickWand *wand)
4644%
4645%  A description of each parameter follows:
4646%
4647%    o wand: the magick wand.
4648%
4649*/
4650WandExport size_t MagickGetImageHeight(MagickWand *wand)
4651{
4652  assert(wand != (MagickWand *) NULL);
4653  assert(wand->signature == WandSignature);
4654  if (wand->debug != MagickFalse)
4655    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4656  if (wand->images == (Image *) NULL)
4657    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4658  return(wand->images->rows);
4659}
4660
4661/*
4662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4663%                                                                             %
4664%                                                                             %
4665%                                                                             %
4666%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4667%                                                                             %
4668%                                                                             %
4669%                                                                             %
4670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4671%
4672%  MagickGetImageHistogram() returns the image histogram as an array of
4673%  PixelWand wands.
4674%
4675%  The format of the MagickGetImageHistogram method is:
4676%
4677%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4678%        size_t *number_colors)
4679%
4680%  A description of each parameter follows:
4681%
4682%    o wand: the magick wand.
4683%
4684%    o number_colors: the number of unique colors in the image and the number
4685%      of pixel wands returned.
4686%
4687*/
4688WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4689  size_t *number_colors)
4690{
4691  PixelPacket
4692    *histogram;
4693
4694  PixelWand
4695    **pixel_wands;
4696
4697  register ssize_t
4698    i;
4699
4700  assert(wand != (MagickWand *) NULL);
4701  assert(wand->signature == WandSignature);
4702  if (wand->debug != MagickFalse)
4703    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4704  if (wand->images == (Image *) NULL)
4705    {
4706      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4707        "ContainsNoImages","`%s'",wand->name);
4708      return((PixelWand **) NULL);
4709    }
4710  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4711  if (histogram == (PixelPacket *) NULL)
4712    return((PixelWand **) NULL);
4713  pixel_wands=NewPixelWands(*number_colors);
4714  for (i=0; i < (ssize_t) *number_colors; i++)
4715  {
4716    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4717    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4718  }
4719  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4720  return(pixel_wands);
4721}
4722
4723/*
4724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4725%                                                                             %
4726%                                                                             %
4727%                                                                             %
4728%   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                 %
4729%                                                                             %
4730%                                                                             %
4731%                                                                             %
4732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4733%
4734%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4735%
4736%  The format of the MagickGetImageInterlaceScheme method is:
4737%
4738%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4739%
4740%  A description of each parameter follows:
4741%
4742%    o wand: the magick wand.
4743%
4744*/
4745WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4746{
4747  assert(wand != (MagickWand *) NULL);
4748  assert(wand->signature == WandSignature);
4749  if (wand->debug != MagickFalse)
4750    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4751  if (wand->images == (Image *) NULL)
4752    {
4753      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4754        "ContainsNoImages","`%s'",wand->name);
4755      return(UndefinedInterlace);
4756    }
4757  return(wand->images->interlace);
4758}
4759
4760/*
4761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4762%                                                                             %
4763%                                                                             %
4764%                                                                             %
4765%   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             %
4766%                                                                             %
4767%                                                                             %
4768%                                                                             %
4769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4770%
4771%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4772%  sepcified image.
4773%
4774%  The format of the MagickGetImageInterpolateMethod method is:
4775%
4776%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4777%
4778%  A description of each parameter follows:
4779%
4780%    o wand: the magick wand.
4781%
4782*/
4783WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4784  MagickWand *wand)
4785{
4786  assert(wand != (MagickWand *) NULL);
4787  assert(wand->signature == WandSignature);
4788  if (wand->debug != MagickFalse)
4789    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4790  if (wand->images == (Image *) NULL)
4791    {
4792      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4793        "ContainsNoImages","`%s'",wand->name);
4794      return(UndefinedInterpolatePixel);
4795    }
4796  return(wand->images->interpolate);
4797}
4798
4799/*
4800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4801%                                                                             %
4802%                                                                             %
4803%                                                                             %
4804%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4805%                                                                             %
4806%                                                                             %
4807%                                                                             %
4808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4809%
4810%  MagickGetImageIterations() gets the image iterations.
4811%
4812%  The format of the MagickGetImageIterations method is:
4813%
4814%      size_t MagickGetImageIterations(MagickWand *wand)
4815%
4816%  A description of each parameter follows:
4817%
4818%    o wand: the magick wand.
4819%
4820*/
4821WandExport size_t MagickGetImageIterations(MagickWand *wand)
4822{
4823  assert(wand != (MagickWand *) NULL);
4824  assert(wand->signature == WandSignature);
4825  if (wand->debug != MagickFalse)
4826    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4827  if (wand->images == (Image *) NULL)
4828    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4829  return(wand->images->iterations);
4830}
4831
4832/*
4833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4834%                                                                             %
4835%                                                                             %
4836%                                                                             %
4837%   M a g i c k G e t I m a g e L e n g t h                                   %
4838%                                                                             %
4839%                                                                             %
4840%                                                                             %
4841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4842%
4843%  MagickGetImageLength() returns the image length in bytes.
4844%
4845%  The format of the MagickGetImageLength method is:
4846%
4847%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4848%        MagickSizeType *length)
4849%
4850%  A description of each parameter follows:
4851%
4852%    o wand: the magick wand.
4853%
4854%    o length: the image length in bytes.
4855%
4856*/
4857WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4858  MagickSizeType *length)
4859{
4860  assert(wand != (MagickWand *) NULL);
4861  assert(wand->signature == WandSignature);
4862  if (wand->debug != MagickFalse)
4863    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4864  if (wand->images == (Image *) NULL)
4865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4866  *length=GetBlobSize(wand->images);
4867  return(MagickTrue);
4868}
4869
4870/*
4871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4872%                                                                             %
4873%                                                                             %
4874%                                                                             %
4875%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4876%                                                                             %
4877%                                                                             %
4878%                                                                             %
4879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4880%
4881%  MagickGetImageMatteColor() returns the image matte color.
4882%
4883%  The format of the MagickGetImageMatteColor method is:
4884%
4885%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4886%        PixelWand *matte_color)
4887%
4888%  A description of each parameter follows:
4889%
4890%    o wand: the magick wand.
4891%
4892%    o matte_color: Return the matte color.
4893%
4894*/
4895WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4896  PixelWand *matte_color)
4897{
4898  assert(wand != (MagickWand *) NULL);
4899  assert(wand->signature == WandSignature);
4900  if (wand->debug != MagickFalse)
4901    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4902  if (wand->images == (Image *) NULL)
4903    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4904  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4905  return(MagickTrue);
4906}
4907
4908/*
4909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4910%                                                                             %
4911%                                                                             %
4912%                                                                             %
4913%   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                         %
4914%                                                                             %
4915%                                                                             %
4916%                                                                             %
4917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4918%
4919%  MagickGetImageOrientation() returns the image orientation.
4920%
4921%  The format of the MagickGetImageOrientation method is:
4922%
4923%      OrientationType MagickGetImageOrientation(MagickWand *wand)
4924%
4925%  A description of each parameter follows:
4926%
4927%    o wand: the magick wand.
4928%
4929*/
4930WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4931{
4932  assert(wand != (MagickWand *) NULL);
4933  assert(wand->signature == WandSignature);
4934  if (wand->debug != MagickFalse)
4935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4936  if (wand->images == (Image *) NULL)
4937    {
4938      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4939        "ContainsNoImages","`%s'",wand->name);
4940      return(UndefinedOrientation);
4941    }
4942  return(wand->images->orientation);
4943}
4944
4945/*
4946%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4947%                                                                             %
4948%                                                                             %
4949%                                                                             %
4950%   M a g i c k G e t I m a g e P a g e                                       %
4951%                                                                             %
4952%                                                                             %
4953%                                                                             %
4954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4955%
4956%  MagickGetImagePage() returns the page geometry associated with the image.
4957%
4958%  The format of the MagickGetImagePage method is:
4959%
4960%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4961%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4962%
4963%  A description of each parameter follows:
4964%
4965%    o wand: the magick wand.
4966%
4967%    o width: the page width.
4968%
4969%    o height: the page height.
4970%
4971%    o x: the page x-offset.
4972%
4973%    o y: the page y-offset.
4974%
4975*/
4976WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4977  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4978{
4979  assert(wand != (const MagickWand *) NULL);
4980  assert(wand->signature == WandSignature);
4981  if (wand->debug != MagickFalse)
4982    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4983  if (wand->images == (Image *) NULL)
4984    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4985  *width=wand->images->page.width;
4986  *height=wand->images->page.height;
4987  *x=wand->images->page.x;
4988  *y=wand->images->page.y;
4989  return(MagickTrue);
4990}
4991
4992/*
4993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4994%                                                                             %
4995%                                                                             %
4996%                                                                             %
4997%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4998%                                                                             %
4999%                                                                             %
5000%                                                                             %
5001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5002%
5003%  MagickGetImagePixelColor() returns the color of the specified pixel.
5004%
5005%  The format of the MagickGetImagePixelColor method is:
5006%
5007%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5008%        const ssize_t x,const ssize_t y,PixelWand *color)
5009%
5010%  A description of each parameter follows:
5011%
5012%    o wand: the magick wand.
5013%
5014%    o x,y: the pixel offset into the image.
5015%
5016%    o color: Return the colormap color in this wand.
5017%
5018*/
5019WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5020  const ssize_t x,const ssize_t y,PixelWand *color)
5021{
5022  register const Quantum
5023    *p;
5024
5025  CacheView
5026    *image_view;
5027
5028  assert(wand != (MagickWand *) NULL);
5029  assert(wand->signature == WandSignature);
5030  if (wand->debug != MagickFalse)
5031    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5032  if (wand->images == (Image *) NULL)
5033    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5034  image_view=AcquireCacheView(wand->images);
5035  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5036  if (p == (const Quantum *) NULL)
5037    {
5038      image_view=DestroyCacheView(image_view);
5039      return(MagickFalse);
5040    }
5041  PixelSetQuantumPixel(wand->images,p,color);
5042  image_view=DestroyCacheView(image_view);
5043  return(MagickTrue);
5044}
5045
5046/*
5047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5048%                                                                             %
5049%                                                                             %
5050%                                                                             %
5051%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5052%                                                                             %
5053%                                                                             %
5054%                                                                             %
5055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5056%
5057%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5058%
5059%  The format of the MagickGetImageRedPrimary method is:
5060%
5061%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5062%        double *y)
5063%
5064%  A description of each parameter follows:
5065%
5066%    o wand: the magick wand.
5067%
5068%    o x: the chromaticity red primary x-point.
5069%
5070%    o y: the chromaticity red primary y-point.
5071%
5072*/
5073WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5074  double *x,double *y)
5075{
5076  assert(wand != (MagickWand *) NULL);
5077  assert(wand->signature == WandSignature);
5078  if (wand->debug != MagickFalse)
5079    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5080  if (wand->images == (Image *) NULL)
5081    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5082  *x=wand->images->chromaticity.red_primary.x;
5083  *y=wand->images->chromaticity.red_primary.y;
5084  return(MagickTrue);
5085}
5086
5087/*
5088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089%                                                                             %
5090%                                                                             %
5091%                                                                             %
5092%   M a g i c k G e t I m a g e R e g i o n                                   %
5093%                                                                             %
5094%                                                                             %
5095%                                                                             %
5096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5097%
5098%  MagickGetImageRegion() extracts a region of the image and returns it as a
5099%  a new wand.
5100%
5101%  The format of the MagickGetImageRegion method is:
5102%
5103%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5104%        const size_t width,const size_t height,const ssize_t x,
5105%        const ssize_t y)
5106%
5107%  A description of each parameter follows:
5108%
5109%    o wand: the magick wand.
5110%
5111%    o width: the region width.
5112%
5113%    o height: the region height.
5114%
5115%    o x: the region x offset.
5116%
5117%    o y: the region y offset.
5118%
5119*/
5120WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5121  const size_t width,const size_t height,const ssize_t x,
5122  const ssize_t y)
5123{
5124  Image
5125    *region_image;
5126
5127  RectangleInfo
5128    region;
5129
5130  assert(wand != (MagickWand *) NULL);
5131  assert(wand->signature == WandSignature);
5132  if (wand->debug != MagickFalse)
5133    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5134  if (wand->images == (Image *) NULL)
5135    return((MagickWand *) NULL);
5136  region.width=width;
5137  region.height=height;
5138  region.x=x;
5139  region.y=y;
5140  region_image=CropImage(wand->images,&region,wand->exception);
5141  if (region_image == (Image *) NULL)
5142    return((MagickWand *) NULL);
5143  return(CloneMagickWandFromImages(wand,region_image));
5144}
5145
5146/*
5147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5148%                                                                             %
5149%                                                                             %
5150%                                                                             %
5151%   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                 %
5152%                                                                             %
5153%                                                                             %
5154%                                                                             %
5155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156%
5157%  MagickGetImageRenderingIntent() gets the image rendering intent.
5158%
5159%  The format of the MagickGetImageRenderingIntent method is:
5160%
5161%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5162%
5163%  A description of each parameter follows:
5164%
5165%    o wand: the magick wand.
5166%
5167*/
5168WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5169{
5170  assert(wand != (MagickWand *) NULL);
5171  assert(wand->signature == WandSignature);
5172  if (wand->debug != MagickFalse)
5173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5174  if (wand->images == (Image *) NULL)
5175    {
5176      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5177        "ContainsNoImages","`%s'",wand->name);
5178      return(UndefinedIntent);
5179    }
5180  return((RenderingIntent) wand->images->rendering_intent);
5181}
5182
5183/*
5184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5185%                                                                             %
5186%                                                                             %
5187%                                                                             %
5188%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5189%                                                                             %
5190%                                                                             %
5191%                                                                             %
5192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5193%
5194%  MagickGetImageResolution() gets the image X and Y resolution.
5195%
5196%  The format of the MagickGetImageResolution method is:
5197%
5198%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5199%        double *y)
5200%
5201%  A description of each parameter follows:
5202%
5203%    o wand: the magick wand.
5204%
5205%    o x: the image x-resolution.
5206%
5207%    o y: the image y-resolution.
5208%
5209*/
5210WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5211  double *x,double *y)
5212{
5213  assert(wand != (MagickWand *) NULL);
5214  assert(wand->signature == WandSignature);
5215  if (wand->debug != MagickFalse)
5216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5217  if (wand->images == (Image *) NULL)
5218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5219  *x=wand->images->x_resolution;
5220  *y=wand->images->y_resolution;
5221  return(MagickTrue);
5222}
5223
5224/*
5225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5226%                                                                             %
5227%                                                                             %
5228%                                                                             %
5229%   M a g i c k G e t I m a g e S c e n e                                     %
5230%                                                                             %
5231%                                                                             %
5232%                                                                             %
5233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5234%
5235%  MagickGetImageScene() gets the image scene.
5236%
5237%  The format of the MagickGetImageScene method is:
5238%
5239%      size_t MagickGetImageScene(MagickWand *wand)
5240%
5241%  A description of each parameter follows:
5242%
5243%    o wand: the magick wand.
5244%
5245*/
5246WandExport size_t MagickGetImageScene(MagickWand *wand)
5247{
5248  assert(wand != (MagickWand *) NULL);
5249  assert(wand->signature == WandSignature);
5250  if (wand->debug != MagickFalse)
5251    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5252  if (wand->images == (Image *) NULL)
5253    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5254  return(wand->images->scene);
5255}
5256
5257/*
5258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5259%                                                                             %
5260%                                                                             %
5261%                                                                             %
5262%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5263%                                                                             %
5264%                                                                             %
5265%                                                                             %
5266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5267%
5268%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5269%  pixel stream.
5270%
5271%  The format of the MagickGetImageSignature method is:
5272%
5273%      const char MagickGetImageSignature(MagickWand *wand)
5274%
5275%  A description of each parameter follows:
5276%
5277%    o wand: the magick wand.
5278%
5279*/
5280WandExport char *MagickGetImageSignature(MagickWand *wand)
5281{
5282  const char
5283    *value;
5284
5285  MagickBooleanType
5286    status;
5287
5288  assert(wand != (MagickWand *) NULL);
5289  assert(wand->signature == WandSignature);
5290  if (wand->debug != MagickFalse)
5291    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5292  if (wand->images == (Image *) NULL)
5293    {
5294      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5295        "ContainsNoImages","`%s'",wand->name);
5296      return((char *) NULL);
5297    }
5298  status=SignatureImage(wand->images);
5299  if (status == MagickFalse)
5300    InheritException(wand->exception,&wand->images->exception);
5301  value=GetImageProperty(wand->images,"signature");
5302  if (value != (const char *) NULL)
5303    return(AcquireString(value));
5304  InheritException(wand->exception,&wand->images->exception);
5305  return((char *) NULL);
5306}
5307
5308/*
5309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5310%                                                                             %
5311%                                                                             %
5312%                                                                             %
5313%   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                   %
5314%                                                                             %
5315%                                                                             %
5316%                                                                             %
5317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5318%
5319%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5320%
5321%  The format of the MagickGetImageTicksPerSecond method is:
5322%
5323%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5324%
5325%  A description of each parameter follows:
5326%
5327%    o wand: the magick wand.
5328%
5329*/
5330WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5331{
5332  assert(wand != (MagickWand *) NULL);
5333  assert(wand->signature == WandSignature);
5334  if (wand->debug != MagickFalse)
5335    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5336  if (wand->images == (Image *) NULL)
5337    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5338  return((size_t) wand->images->ticks_per_second);
5339}
5340
5341/*
5342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5343%                                                                             %
5344%                                                                             %
5345%                                                                             %
5346%   M a g i c k G e t I m a g e T y p e                                       %
5347%                                                                             %
5348%                                                                             %
5349%                                                                             %
5350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5351%
5352%  MagickGetImageType() gets the potential image type:
5353%
5354%        Bilevel        Grayscale       GrayscaleMatte
5355%        Palette        PaletteMatte    TrueColor
5356%        TrueColorMatte ColorSeparation ColorSeparationMatte
5357%
5358%  To ensure the image type matches its potential, use MagickSetImageType():
5359%
5360%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5361%
5362%  The format of the MagickGetImageType method is:
5363%
5364%      ImageType MagickGetImageType(MagickWand *wand)
5365%
5366%  A description of each parameter follows:
5367%
5368%    o wand: the magick wand.
5369%
5370*/
5371WandExport ImageType MagickGetImageType(MagickWand *wand)
5372{
5373  assert(wand != (MagickWand *) NULL);
5374  assert(wand->signature == WandSignature);
5375  if (wand->debug != MagickFalse)
5376    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5377  if (wand->images == (Image *) NULL)
5378    {
5379      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5380        "ContainsNoImages","`%s'",wand->name);
5381      return(UndefinedType);
5382    }
5383  return(GetImageType(wand->images,wand->exception));
5384}
5385
5386/*
5387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5388%                                                                             %
5389%                                                                             %
5390%                                                                             %
5391%   M a g i c k G e t I m a g e U n i t s                                     %
5392%                                                                             %
5393%                                                                             %
5394%                                                                             %
5395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5396%
5397%  MagickGetImageUnits() gets the image units of resolution.
5398%
5399%  The format of the MagickGetImageUnits method is:
5400%
5401%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5402%
5403%  A description of each parameter follows:
5404%
5405%    o wand: the magick wand.
5406%
5407*/
5408WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5409{
5410  assert(wand != (MagickWand *) NULL);
5411  assert(wand->signature == WandSignature);
5412  if (wand->debug != MagickFalse)
5413    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5414  if (wand->images == (Image *) NULL)
5415    {
5416      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5417        "ContainsNoImages","`%s'",wand->name);
5418      return(UndefinedResolution);
5419    }
5420  return(wand->images->units);
5421}
5422
5423/*
5424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5425%                                                                             %
5426%                                                                             %
5427%                                                                             %
5428%   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           %
5429%                                                                             %
5430%                                                                             %
5431%                                                                             %
5432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5433%
5434%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5435%  sepcified image.
5436%
5437%  The format of the MagickGetImageVirtualPixelMethod method is:
5438%
5439%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5440%
5441%  A description of each parameter follows:
5442%
5443%    o wand: the magick wand.
5444%
5445*/
5446WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5447{
5448  assert(wand != (MagickWand *) NULL);
5449  assert(wand->signature == WandSignature);
5450  if (wand->debug != MagickFalse)
5451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5452  if (wand->images == (Image *) NULL)
5453    {
5454      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5455        "ContainsNoImages","`%s'",wand->name);
5456      return(UndefinedVirtualPixelMethod);
5457    }
5458  return(GetImageVirtualPixelMethod(wand->images));
5459}
5460
5461/*
5462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5463%                                                                             %
5464%                                                                             %
5465%                                                                             %
5466%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5467%                                                                             %
5468%                                                                             %
5469%                                                                             %
5470%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5471%
5472%  MagickGetImageWhitePoint() returns the chromaticy white point.
5473%
5474%  The format of the MagickGetImageWhitePoint method is:
5475%
5476%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5477%        double *y)
5478%
5479%  A description of each parameter follows:
5480%
5481%    o wand: the magick wand.
5482%
5483%    o x: the chromaticity white x-point.
5484%
5485%    o y: the chromaticity white y-point.
5486%
5487*/
5488WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5489  double *x,double *y)
5490{
5491  assert(wand != (MagickWand *) NULL);
5492  assert(wand->signature == WandSignature);
5493  if (wand->debug != MagickFalse)
5494    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5495  if (wand->images == (Image *) NULL)
5496    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5497  *x=wand->images->chromaticity.white_point.x;
5498  *y=wand->images->chromaticity.white_point.y;
5499  return(MagickTrue);
5500}
5501
5502/*
5503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5504%                                                                             %
5505%                                                                             %
5506%                                                                             %
5507%   M a g i c k G e t I m a g e W i d t h                                     %
5508%                                                                             %
5509%                                                                             %
5510%                                                                             %
5511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5512%
5513%  MagickGetImageWidth() returns the image width.
5514%
5515%  The format of the MagickGetImageWidth method is:
5516%
5517%      size_t MagickGetImageWidth(MagickWand *wand)
5518%
5519%  A description of each parameter follows:
5520%
5521%    o wand: the magick wand.
5522%
5523*/
5524WandExport size_t MagickGetImageWidth(MagickWand *wand)
5525{
5526  assert(wand != (MagickWand *) NULL);
5527  assert(wand->signature == WandSignature);
5528  if (wand->debug != MagickFalse)
5529    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5530  if (wand->images == (Image *) NULL)
5531    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5532  return(wand->images->columns);
5533}
5534
5535/*
5536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5537%                                                                             %
5538%                                                                             %
5539%                                                                             %
5540%   M a g i c k G e t N u m b e r I m a g e s                                 %
5541%                                                                             %
5542%                                                                             %
5543%                                                                             %
5544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5545%
5546%  MagickGetNumberImages() returns the number of images associated with a
5547%  magick wand.
5548%
5549%  The format of the MagickGetNumberImages method is:
5550%
5551%      size_t MagickGetNumberImages(MagickWand *wand)
5552%
5553%  A description of each parameter follows:
5554%
5555%    o wand: the magick wand.
5556%
5557*/
5558WandExport size_t MagickGetNumberImages(MagickWand *wand)
5559{
5560  assert(wand != (MagickWand *) NULL);
5561  assert(wand->signature == WandSignature);
5562  if (wand->debug != MagickFalse)
5563    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5564  return(GetImageListLength(wand->images));
5565}
5566
5567/*
5568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5569%                                                                             %
5570%                                                                             %
5571%                                                                             %
5572%   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                 %
5573%                                                                             %
5574%                                                                             %
5575%                                                                             %
5576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5577%
5578%  MagickGetImageTotalInkDensity() gets the image total ink density.
5579%
5580%  The format of the MagickGetImageTotalInkDensity method is:
5581%
5582%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5583%
5584%  A description of each parameter follows:
5585%
5586%    o wand: the magick wand.
5587%
5588*/
5589WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5590{
5591  assert(wand != (MagickWand *) NULL);
5592  assert(wand->signature == WandSignature);
5593  if (wand->debug != MagickFalse)
5594    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5595  if (wand->images == (Image *) NULL)
5596    {
5597      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5598        "ContainsNoImages","`%s'",wand->name);
5599      return(0.0);
5600    }
5601  return(GetImageTotalInkDensity(wand->images));
5602}
5603
5604/*
5605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5606%                                                                             %
5607%                                                                             %
5608%                                                                             %
5609%   M a g i c k H a l d C l u t I m a g e                                     %
5610%                                                                             %
5611%                                                                             %
5612%                                                                             %
5613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5614%
5615%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5616%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5617%  dimensions.  Create it with the HALD coder.  You can apply any color
5618%  transformation to the Hald image and then use this method to apply the
5619%  transform to the image.
5620%
5621%  The format of the MagickHaldClutImage method is:
5622%
5623%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5624%        const MagickWand *hald_wand)
5625%
5626%  A description of each parameter follows:
5627%
5628%    o wand: the magick wand.
5629%
5630%    o hald_image: the hald CLUT image.
5631%
5632*/
5633WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5634  const MagickWand *hald_wand)
5635{
5636  MagickBooleanType
5637    status;
5638
5639  assert(wand != (MagickWand *) NULL);
5640  assert(wand->signature == WandSignature);
5641  if (wand->debug != MagickFalse)
5642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5643  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5645  status=HaldClutImage(wand->images,hald_wand->images);
5646  if (status == MagickFalse)
5647    InheritException(wand->exception,&wand->images->exception);
5648  return(status);
5649}
5650
5651/*
5652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5653%                                                                             %
5654%                                                                             %
5655%                                                                             %
5656%   M a g i c k H a s N e x t I m a g e                                       %
5657%                                                                             %
5658%                                                                             %
5659%                                                                             %
5660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5661%
5662%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5663%  traversing the list in the forward direction
5664%
5665%  The format of the MagickHasNextImage method is:
5666%
5667%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5668%
5669%  A description of each parameter follows:
5670%
5671%    o wand: the magick wand.
5672%
5673*/
5674WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5675{
5676  assert(wand != (MagickWand *) NULL);
5677  assert(wand->signature == WandSignature);
5678  if (wand->debug != MagickFalse)
5679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5680  if (wand->images == (Image *) NULL)
5681    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5682  if (GetNextImageInList(wand->images) == (Image *) NULL)
5683    return(MagickFalse);
5684  return(MagickTrue);
5685}
5686
5687/*
5688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5689%                                                                             %
5690%                                                                             %
5691%                                                                             %
5692%   M a g i c k H a s P r e v i o u s I m a g e                               %
5693%                                                                             %
5694%                                                                             %
5695%                                                                             %
5696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5697%
5698%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5699%  traversing the list in the reverse direction
5700%
5701%  The format of the MagickHasPreviousImage method is:
5702%
5703%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5704%
5705%  A description of each parameter follows:
5706%
5707%    o wand: the magick wand.
5708%
5709*/
5710WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5711{
5712  assert(wand != (MagickWand *) NULL);
5713  assert(wand->signature == WandSignature);
5714  if (wand->debug != MagickFalse)
5715    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5716  if (wand->images == (Image *) NULL)
5717    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5718  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5719    return(MagickFalse);
5720  return(MagickTrue);
5721}
5722
5723/*
5724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5725%                                                                             %
5726%                                                                             %
5727%                                                                             %
5728%   M a g i c k I d e n t i f y I m a g e                                     %
5729%                                                                             %
5730%                                                                             %
5731%                                                                             %
5732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5733%
5734%  MagickIdentifyImage() identifies an image by printing its attributes to the
5735%  file.  Attributes include the image width, height, size, and others.
5736%
5737%  The format of the MagickIdentifyImage method is:
5738%
5739%      const char *MagickIdentifyImage(MagickWand *wand)
5740%
5741%  A description of each parameter follows:
5742%
5743%    o wand: the magick wand.
5744%
5745*/
5746WandExport char *MagickIdentifyImage(MagickWand *wand)
5747{
5748  char
5749    *description,
5750    filename[MaxTextExtent];
5751
5752  FILE
5753    *file;
5754
5755  int
5756    unique_file;
5757
5758  assert(wand != (MagickWand *) NULL);
5759  assert(wand->signature == WandSignature);
5760  if (wand->debug != MagickFalse)
5761    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5762  if (wand->images == (Image *) NULL)
5763    {
5764      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5765        "ContainsNoImages","`%s'",wand->name);
5766      return((char *) NULL);
5767    }
5768  description=(char *) NULL;
5769  unique_file=AcquireUniqueFileResource(filename);
5770  file=(FILE *) NULL;
5771  if (unique_file != -1)
5772    file=fdopen(unique_file,"wb");
5773  if ((unique_file == -1) || (file == (FILE *) NULL))
5774    {
5775      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5776        "UnableToCreateTemporaryFile","`%s'",wand->name);
5777      return((char *) NULL);
5778    }
5779  (void) IdentifyImage(wand->images,file,MagickTrue);
5780  (void) fclose(file);
5781  description=FileToString(filename,~0,wand->exception);
5782  (void) RelinquishUniqueFileResource(filename);
5783  return(description);
5784}
5785
5786/*
5787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5788%                                                                             %
5789%                                                                             %
5790%                                                                             %
5791%   M a g i c k I m p l o d e I m a g e                                       %
5792%                                                                             %
5793%                                                                             %
5794%                                                                             %
5795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5796%
5797%  MagickImplodeImage() creates a new image that is a copy of an existing
5798%  one with the image pixels "implode" by the specified percentage.  It
5799%  allocates the memory necessary for the new Image structure and returns a
5800%  pointer to the new image.
5801%
5802%  The format of the MagickImplodeImage method is:
5803%
5804%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5805%        const double radius)
5806%
5807%  A description of each parameter follows:
5808%
5809%    o wand: the magick wand.
5810%
5811%    o amount: Define the extent of the implosion.
5812%
5813*/
5814WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5815  const double amount)
5816{
5817  Image
5818    *implode_image;
5819
5820  assert(wand != (MagickWand *) NULL);
5821  assert(wand->signature == WandSignature);
5822  if (wand->debug != MagickFalse)
5823    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5824  if (wand->images == (Image *) NULL)
5825    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5826  implode_image=ImplodeImage(wand->images,amount,wand->exception);
5827  if (implode_image == (Image *) NULL)
5828    return(MagickFalse);
5829  ReplaceImageInList(&wand->images,implode_image);
5830  return(MagickTrue);
5831}
5832
5833/*
5834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5835%                                                                             %
5836%                                                                             %
5837%                                                                             %
5838%   M a g i c k I m p o r t I m a g e P i x e l s                             %
5839%                                                                             %
5840%                                                                             %
5841%                                                                             %
5842%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5843%
5844%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5845%  location you specify.  The method returns MagickFalse on success otherwise
5846%  MagickTrue if an error is encountered.  The pixel data can be either char,
5847%  short int, int, ssize_t, float, or double in the order specified by map.
5848%
5849%  Suppose your want to upload the first scanline of a 640x480 image from
5850%  character data in red-green-blue order:
5851%
5852%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5853%
5854%  The format of the MagickImportImagePixels method is:
5855%
5856%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5857%        const ssize_t x,const ssize_t y,const size_t columns,
5858%        const size_t rows,const char *map,const StorageType storage,
5859%        const void *pixels)
5860%
5861%  A description of each parameter follows:
5862%
5863%    o wand: the magick wand.
5864%
5865%    o x, y, columns, rows:  These values define the perimeter of a region
5866%      of pixels you want to define.
5867%
5868%    o map:  This string reflects the expected ordering of the pixel array.
5869%      It can be any combination or order of R = red, G = green, B = blue,
5870%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5871%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5872%      P = pad.
5873%
5874%    o storage: Define the data type of the pixels.  Float and double types are
5875%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5876%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5877%      or DoublePixel.
5878%
5879%    o pixels: This array of values contain the pixel components as defined by
5880%      map and type.  You must preallocate this array where the expected
5881%      length varies depending on the values of width, height, map, and type.
5882%
5883*/
5884WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5885  const ssize_t x,const ssize_t y,const size_t columns,
5886  const size_t rows,const char *map,const StorageType storage,
5887  const void *pixels)
5888{
5889  MagickBooleanType
5890    status;
5891
5892  assert(wand != (MagickWand *) NULL);
5893  assert(wand->signature == WandSignature);
5894  if (wand->debug != MagickFalse)
5895    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5896  if (wand->images == (Image *) NULL)
5897    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5898  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5899  if (status == MagickFalse)
5900    InheritException(wand->exception,&wand->images->exception);
5901  return(status);
5902}
5903
5904/*
5905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5906%                                                                             %
5907%                                                                             %
5908%                                                                             %
5909%   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       %
5910%                                                                             %
5911%                                                                             %
5912%                                                                             %
5913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5914%
5915%  MagickInverseFourierTransformImage() implements the inverse discrete
5916%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5917%  imaginary image pair.
5918%
5919%  The format of the MagickInverseFourierTransformImage method is:
5920%
5921%      MagickBooleanType MagickInverseFourierTransformImage(
5922%        MagickWand *magnitude_wand,MagickWand *phase_wand,
5923%        const MagickBooleanType magnitude)
5924%
5925%  A description of each parameter follows:
5926%
5927%    o magnitude_wand: the magnitude or real wand.
5928%
5929%    o phase_wand: the phase or imaginary wand.
5930%
5931%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5932%      imaginary image pair.
5933%
5934*/
5935WandExport MagickBooleanType MagickInverseFourierTransformImage(
5936  MagickWand *magnitude_wand,MagickWand *phase_wand,
5937  const MagickBooleanType magnitude)
5938{
5939  Image
5940    *inverse_image;
5941
5942  MagickWand
5943    *wand;
5944
5945  assert(magnitude_wand != (MagickWand *) NULL);
5946  assert(magnitude_wand->signature == WandSignature);
5947  if (magnitude_wand->debug != MagickFalse)
5948    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5949      magnitude_wand->name);
5950  wand=magnitude_wand;
5951  if (magnitude_wand->images == (Image *) NULL)
5952    ThrowWandException(WandError,"ContainsNoImages",
5953      magnitude_wand->name);
5954  assert(phase_wand != (MagickWand *) NULL);
5955  assert(phase_wand->signature == WandSignature);
5956  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5957    phase_wand->images,magnitude,wand->exception);
5958  if (inverse_image == (Image *) NULL)
5959    return(MagickFalse);
5960  ReplaceImageInList(&wand->images,inverse_image);
5961  return(MagickTrue);
5962}
5963
5964/*
5965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5966%                                                                             %
5967%                                                                             %
5968%                                                                             %
5969%   M a g i c k L a b e l I m a g e                                           %
5970%                                                                             %
5971%                                                                             %
5972%                                                                             %
5973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5974%
5975%  MagickLabelImage() adds a label to your image.
5976%
5977%  The format of the MagickLabelImage method is:
5978%
5979%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5980%
5981%  A description of each parameter follows:
5982%
5983%    o wand: the magick wand.
5984%
5985%    o label: the image label.
5986%
5987*/
5988WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5989  const char *label)
5990{
5991  MagickBooleanType
5992    status;
5993
5994  assert(wand != (MagickWand *) NULL);
5995  assert(wand->signature == WandSignature);
5996  if (wand->debug != MagickFalse)
5997    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5998  if (wand->images == (Image *) NULL)
5999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6000  status=SetImageProperty(wand->images,"label",label);
6001  if (status == MagickFalse)
6002    InheritException(wand->exception,&wand->images->exception);
6003  return(status);
6004}
6005
6006/*
6007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6008%                                                                             %
6009%                                                                             %
6010%                                                                             %
6011%   M a g i c k L e v e l I m a g e                                           %
6012%                                                                             %
6013%                                                                             %
6014%                                                                             %
6015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6016%
6017%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6018%  falling between specified white and black points to the full available
6019%  quantum range. The parameters provided represent the black, mid, and white
6020%  points. The black point specifies the darkest color in the image. Colors
6021%  darker than the black point are set to zero. Mid point specifies a gamma
6022%  correction to apply to the image.  White point specifies the lightest color
6023%  in the image. Colors brighter than the white point are set to the maximum
6024%  quantum value.
6025%
6026%  The format of the MagickLevelImage method is:
6027%
6028%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6029%        const double black_point,const double gamma,const double white_point)
6030%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6031%        const ChannelType channel,const double black_point,const double gamma,
6032%        const double white_point)
6033%
6034%  A description of each parameter follows:
6035%
6036%    o wand: the magick wand.
6037%
6038%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6039%
6040%    o black_point: the black point.
6041%
6042%    o gamma: the gamma.
6043%
6044%    o white_point: the white point.
6045%
6046*/
6047WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6048  const double black_point,const double gamma,const double white_point)
6049{
6050  MagickBooleanType
6051    status;
6052
6053  assert(wand != (MagickWand *) NULL);
6054  assert(wand->signature == WandSignature);
6055  if (wand->debug != MagickFalse)
6056    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6057  if (wand->images == (Image *) NULL)
6058    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6059  status=LevelImage(wand->images,black_point,white_point,gamma);
6060  if (status == MagickFalse)
6061    InheritException(wand->exception,&wand->images->exception);
6062  return(status);
6063}
6064
6065/*
6066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6067%                                                                             %
6068%                                                                             %
6069%                                                                             %
6070%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6071%                                                                             %
6072%                                                                             %
6073%                                                                             %
6074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6075%
6076%  MagickLinearStretchImage() stretches with saturation the image intensity.
6077%
6078%  You can also reduce the influence of a particular channel with a gamma
6079%  value of 0.
6080%
6081%  The format of the MagickLinearStretchImage method is:
6082%
6083%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6084%        const double black_point,const double white_point)
6085%
6086%  A description of each parameter follows:
6087%
6088%    o wand: the magick wand.
6089%
6090%    o black_point: the black point.
6091%
6092%    o white_point: the white point.
6093%
6094*/
6095WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6096  const double black_point,const double white_point)
6097{
6098  MagickBooleanType
6099    status;
6100
6101  assert(wand != (MagickWand *) NULL);
6102  assert(wand->signature == WandSignature);
6103  if (wand->debug != MagickFalse)
6104    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6105  if (wand->images == (Image *) NULL)
6106    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6107  status=LinearStretchImage(wand->images,black_point,white_point);
6108  if (status == MagickFalse)
6109    InheritException(wand->exception,&wand->images->exception);
6110  return(status);
6111}
6112
6113/*
6114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115%                                                                             %
6116%                                                                             %
6117%                                                                             %
6118%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6119%                                                                             %
6120%                                                                             %
6121%                                                                             %
6122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6123%
6124%  MagickLiquidRescaleImage() rescales image with seam carving.
6125%
6126%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6127%        const size_t columns,const size_t rows,
6128%        const double delta_x,const double rigidity)
6129%
6130%  A description of each parameter follows:
6131%
6132%    o wand: the magick wand.
6133%
6134%    o columns: the number of columns in the scaled image.
6135%
6136%    o rows: the number of rows in the scaled image.
6137%
6138%    o delta_x: maximum seam transversal step (0 means straight seams).
6139%
6140%    o rigidity: introduce a bias for non-straight seams (typically 0).
6141%
6142*/
6143WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6144  const size_t columns,const size_t rows,const double delta_x,
6145  const double rigidity)
6146{
6147  Image
6148    *rescale_image;
6149
6150  assert(wand != (MagickWand *) NULL);
6151  assert(wand->signature == WandSignature);
6152  if (wand->debug != MagickFalse)
6153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6154  if (wand->images == (Image *) NULL)
6155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6156  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6157    rigidity,wand->exception);
6158  if (rescale_image == (Image *) NULL)
6159    return(MagickFalse);
6160  ReplaceImageInList(&wand->images,rescale_image);
6161  return(MagickTrue);
6162}
6163
6164/*
6165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6166%                                                                             %
6167%                                                                             %
6168%                                                                             %
6169%   M a g i c k M a g n i f y I m a g e                                       %
6170%                                                                             %
6171%                                                                             %
6172%                                                                             %
6173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6174%
6175%  MagickMagnifyImage() is a convenience method that scales an image
6176%  proportionally to twice its original size.
6177%
6178%  The format of the MagickMagnifyImage method is:
6179%
6180%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6181%
6182%  A description of each parameter follows:
6183%
6184%    o wand: the magick wand.
6185%
6186*/
6187WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6188{
6189  Image
6190    *magnify_image;
6191
6192  assert(wand != (MagickWand *) NULL);
6193  assert(wand->signature == WandSignature);
6194  if (wand->debug != MagickFalse)
6195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6196  if (wand->images == (Image *) NULL)
6197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6198  magnify_image=MagnifyImage(wand->images,wand->exception);
6199  if (magnify_image == (Image *) NULL)
6200    return(MagickFalse);
6201  ReplaceImageInList(&wand->images,magnify_image);
6202  return(MagickTrue);
6203}
6204
6205/*
6206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6207%                                                                             %
6208%                                                                             %
6209%                                                                             %
6210%   M a g i c k M e r g e I m a g e L a y e r s                               %
6211%                                                                             %
6212%                                                                             %
6213%                                                                             %
6214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6215%
6216%  MagickMergeImageLayers() composes all the image layers from the current
6217%  given image onward to produce a single image of the merged layers.
6218%
6219%  The inital canvas's size depends on the given ImageLayerMethod, and is
6220%  initialized using the first images background color.  The images
6221%  are then compositied onto that image in sequence using the given
6222%  composition that has been assigned to each individual image.
6223%
6224%  The format of the MagickMergeImageLayers method is:
6225%
6226%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6227%        const ImageLayerMethod method)
6228%
6229%  A description of each parameter follows:
6230%
6231%    o wand: the magick wand.
6232%
6233%    o method: the method of selecting the size of the initial canvas.
6234%
6235%        MergeLayer: Merge all layers onto a canvas just large enough
6236%           to hold all the actual images. The virtual canvas of the
6237%           first image is preserved but otherwise ignored.
6238%
6239%        FlattenLayer: Use the virtual canvas size of first image.
6240%           Images which fall outside this canvas is clipped.
6241%           This can be used to 'fill out' a given virtual canvas.
6242%
6243%        MosaicLayer: Start with the virtual canvas of the first image,
6244%           enlarging left and right edges to contain all images.
6245%           Images with negative offsets will be clipped.
6246%
6247*/
6248WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6249  const ImageLayerMethod method)
6250{
6251  Image
6252    *mosaic_image;
6253
6254  assert(wand != (MagickWand *) NULL);
6255  assert(wand->signature == WandSignature);
6256  if (wand->debug != MagickFalse)
6257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6258  if (wand->images == (Image *) NULL)
6259    return((MagickWand *) NULL);
6260  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6261  if (mosaic_image == (Image *) NULL)
6262    return((MagickWand *) NULL);
6263  return(CloneMagickWandFromImages(wand,mosaic_image));
6264}
6265
6266/*
6267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6268%                                                                             %
6269%                                                                             %
6270%                                                                             %
6271%   M a g i c k M i n i f y I m a g e                                         %
6272%                                                                             %
6273%                                                                             %
6274%                                                                             %
6275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6276%
6277%  MagickMinifyImage() is a convenience method that scales an image
6278%  proportionally to one-half its original size
6279%
6280%  The format of the MagickMinifyImage method is:
6281%
6282%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6283%
6284%  A description of each parameter follows:
6285%
6286%    o wand: the magick wand.
6287%
6288*/
6289WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6290{
6291  Image
6292    *minify_image;
6293
6294  assert(wand != (MagickWand *) NULL);
6295  assert(wand->signature == WandSignature);
6296  if (wand->debug != MagickFalse)
6297    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6298  if (wand->images == (Image *) NULL)
6299    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6300  minify_image=MinifyImage(wand->images,wand->exception);
6301  if (minify_image == (Image *) NULL)
6302    return(MagickFalse);
6303  ReplaceImageInList(&wand->images,minify_image);
6304  return(MagickTrue);
6305}
6306
6307/*
6308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6309%                                                                             %
6310%                                                                             %
6311%                                                                             %
6312%   M a g i c k M o d u l a t e I m a g e                                     %
6313%                                                                             %
6314%                                                                             %
6315%                                                                             %
6316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6317%
6318%  MagickModulateImage() lets you control the brightness, saturation, and hue
6319%  of an image.  Hue is the percentage of absolute rotation from the current
6320%  position.  For example 50 results in a counter-clockwise rotation of 90
6321%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6322%  both resulting in a rotation of 180 degrees.
6323%
6324%  To increase the color brightness by 20% and decrease the color saturation by
6325%  10% and leave the hue unchanged, use: 120,90,100.
6326%
6327%  The format of the MagickModulateImage method is:
6328%
6329%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6330%        const double brightness,const double saturation,const double hue)
6331%
6332%  A description of each parameter follows:
6333%
6334%    o wand: the magick wand.
6335%
6336%    o brightness: the percent change in brighness.
6337%
6338%    o saturation: the percent change in saturation.
6339%
6340%    o hue: the percent change in hue.
6341%
6342*/
6343WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6344  const double brightness,const double saturation,const double hue)
6345{
6346  char
6347    modulate[MaxTextExtent];
6348
6349  MagickBooleanType
6350    status;
6351
6352  assert(wand != (MagickWand *) NULL);
6353  assert(wand->signature == WandSignature);
6354  if (wand->debug != MagickFalse)
6355    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6356  if (wand->images == (Image *) NULL)
6357    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6358  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6359    brightness,saturation,hue);
6360  status=ModulateImage(wand->images,modulate);
6361  if (status == MagickFalse)
6362    InheritException(wand->exception,&wand->images->exception);
6363  return(status);
6364}
6365
6366/*
6367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6368%                                                                             %
6369%                                                                             %
6370%                                                                             %
6371%   M a g i c k M o n t a g e I m a g e                                       %
6372%                                                                             %
6373%                                                                             %
6374%                                                                             %
6375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6376%
6377%  MagickMontageImage() creates a composite image by combining several
6378%  separate images. The images are tiled on the composite image with the name
6379%  of the image optionally appearing just below the individual tile.
6380%
6381%  The format of the MagickMontageImage method is:
6382%
6383%      MagickWand *MagickMontageImage(MagickWand *wand,
6384%        const DrawingWand drawing_wand,const char *tile_geometry,
6385%        const char *thumbnail_geometry,const MontageMode mode,
6386%        const char *frame)
6387%
6388%  A description of each parameter follows:
6389%
6390%    o wand: the magick wand.
6391%
6392%    o drawing_wand: the drawing wand.  The font name, size, and color are
6393%      obtained from this wand.
6394%
6395%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6396%
6397%    o thumbnail_geometry: Preferred image size and border size of each
6398%      thumbnail (e.g. 120x120+4+3>).
6399%
6400%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6401%
6402%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6403%      The frame color is that of the thumbnail's matte color.
6404%
6405*/
6406WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6407  const DrawingWand *drawing_wand,const char *tile_geometry,
6408  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6409{
6410  char
6411    *font;
6412
6413  Image
6414    *montage_image;
6415
6416  MontageInfo
6417    *montage_info;
6418
6419  PixelWand
6420    *pixel_wand;
6421
6422  assert(wand != (MagickWand *) NULL);
6423  assert(wand->signature == WandSignature);
6424  if (wand->debug != MagickFalse)
6425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6426  if (wand->images == (Image *) NULL)
6427    return((MagickWand *) NULL);
6428  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6429  switch (mode)
6430  {
6431    case FrameMode:
6432    {
6433      (void) CloneString(&montage_info->frame,"15x15+3+3");
6434      montage_info->shadow=MagickTrue;
6435      break;
6436    }
6437    case UnframeMode:
6438    {
6439      montage_info->frame=(char *) NULL;
6440      montage_info->shadow=MagickFalse;
6441      montage_info->border_width=0;
6442      break;
6443    }
6444    case ConcatenateMode:
6445    {
6446      montage_info->frame=(char *) NULL;
6447      montage_info->shadow=MagickFalse;
6448      (void) CloneString(&montage_info->geometry,"+0+0");
6449      montage_info->border_width=0;
6450      break;
6451    }
6452    default:
6453      break;
6454  }
6455  font=DrawGetFont(drawing_wand);
6456  if (font != (char *) NULL)
6457    (void) CloneString(&montage_info->font,font);
6458  if (frame != (char *) NULL)
6459    (void) CloneString(&montage_info->frame,frame);
6460  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6461  pixel_wand=NewPixelWand();
6462  DrawGetFillColor(drawing_wand,pixel_wand);
6463  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6464  DrawGetStrokeColor(drawing_wand,pixel_wand);
6465  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6466  pixel_wand=DestroyPixelWand(pixel_wand);
6467  if (thumbnail_geometry != (char *) NULL)
6468    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6469  if (tile_geometry != (char *) NULL)
6470    (void) CloneString(&montage_info->tile,tile_geometry);
6471  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6472    wand->exception);
6473  montage_info=DestroyMontageInfo(montage_info);
6474  if (montage_image == (Image *) NULL)
6475    return((MagickWand *) NULL);
6476  return(CloneMagickWandFromImages(wand,montage_image));
6477}
6478
6479/*
6480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6481%                                                                             %
6482%                                                                             %
6483%                                                                             %
6484%   M a g i c k M o r p h I m a g e s                                         %
6485%                                                                             %
6486%                                                                             %
6487%                                                                             %
6488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6489%
6490%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6491%  and size are linearly interpolated to give the appearance of a
6492%  meta-morphosis from one image to the next.
6493%
6494%  The format of the MagickMorphImages method is:
6495%
6496%      MagickWand *MagickMorphImages(MagickWand *wand,
6497%        const size_t number_frames)
6498%
6499%  A description of each parameter follows:
6500%
6501%    o wand: the magick wand.
6502%
6503%    o number_frames: the number of in-between images to generate.
6504%
6505*/
6506WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6507  const size_t number_frames)
6508{
6509  Image
6510    *morph_image;
6511
6512  assert(wand != (MagickWand *) NULL);
6513  assert(wand->signature == WandSignature);
6514  if (wand->debug != MagickFalse)
6515    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6516  if (wand->images == (Image *) NULL)
6517    return((MagickWand *) NULL);
6518  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6519  if (morph_image == (Image *) NULL)
6520    return((MagickWand *) NULL);
6521  return(CloneMagickWandFromImages(wand,morph_image));
6522}
6523
6524/*
6525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6526%                                                                             %
6527%                                                                             %
6528%                                                                             %
6529%   M a g i c k M o r p h o l o g y I m a g e                                 %
6530%                                                                             %
6531%                                                                             %
6532%                                                                             %
6533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6534%
6535%  MagickMorphologyImage() applies a user supplied kernel to the image
6536%  according to the given mophology method.
6537%
6538%  The format of the MagickMorphologyImage method is:
6539%
6540%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6541%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6542%
6543%  A description of each parameter follows:
6544%
6545%    o wand: the magick wand.
6546%
6547%    o method: the morphology method to be applied.
6548%
6549%    o iterations: apply the operation this many times (or no change).
6550%      A value of -1 means loop until no change found.  How this is applied
6551%      may depend on the morphology method.  Typically this is a value of 1.
6552%
6553%    o kernel: An array of doubles representing the morphology kernel.
6554%
6555*/
6556WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6557  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6558{
6559  Image
6560    *morphology_image;
6561
6562  assert(wand != (MagickWand *) NULL);
6563  assert(wand->signature == WandSignature);
6564  if (wand->debug != MagickFalse)
6565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6566  if (kernel == (const KernelInfo *) NULL)
6567    return(MagickFalse);
6568  if (wand->images == (Image *) NULL)
6569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6570  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6571    wand->exception);
6572  if (morphology_image == (Image *) NULL)
6573    return(MagickFalse);
6574  ReplaceImageInList(&wand->images,morphology_image);
6575  return(MagickTrue);
6576}
6577
6578/*
6579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6580%                                                                             %
6581%                                                                             %
6582%                                                                             %
6583%   M a g i c k M o t i o n B l u r I m a g e                                 %
6584%                                                                             %
6585%                                                                             %
6586%                                                                             %
6587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6588%
6589%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6590%  Gaussian operator of the given radius and standard deviation (sigma).
6591%  For reasonable results, radius should be larger than sigma.  Use a
6592%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6593%  Angle gives the angle of the blurring motion.
6594%
6595%  The format of the MagickMotionBlurImage method is:
6596%
6597%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6598%        const double radius,const double sigma,const double angle)
6599%
6600%  A description of each parameter follows:
6601%
6602%    o wand: the magick wand.
6603%
6604%    o radius: the radius of the Gaussian, in pixels, not counting
6605%      the center pixel.
6606%
6607%    o sigma: the standard deviation of the Gaussian, in pixels.
6608%
6609%    o angle: Apply the effect along this angle.
6610%
6611*/
6612WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6613  const double radius,const double sigma,const double angle)
6614{
6615  Image
6616    *blur_image;
6617
6618  assert(wand != (MagickWand *) NULL);
6619  assert(wand->signature == WandSignature);
6620  if (wand->debug != MagickFalse)
6621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6622  if (wand->images == (Image *) NULL)
6623    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6624  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6625  if (blur_image == (Image *) NULL)
6626    return(MagickFalse);
6627  ReplaceImageInList(&wand->images,blur_image);
6628  return(MagickTrue);
6629}
6630
6631/*
6632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6633%                                                                             %
6634%                                                                             %
6635%                                                                             %
6636%   M a g i c k N e g a t e I m a g e                                         %
6637%                                                                             %
6638%                                                                             %
6639%                                                                             %
6640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6641%
6642%  MagickNegateImage() negates the colors in the reference image.  The
6643%  Grayscale option means that only grayscale values within the image are
6644%  negated.
6645%
6646%  You can also reduce the influence of a particular channel with a gamma
6647%  value of 0.
6648%
6649%  The format of the MagickNegateImage method is:
6650%
6651%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6652%        const MagickBooleanType gray)
6653%
6654%  A description of each parameter follows:
6655%
6656%    o wand: the magick wand.
6657%
6658%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6659%
6660*/
6661WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6662  const MagickBooleanType gray)
6663{
6664  MagickBooleanType
6665    status;
6666
6667  assert(wand != (MagickWand *) NULL);
6668  assert(wand->signature == WandSignature);
6669  if (wand->debug != MagickFalse)
6670    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6671  if (wand->images == (Image *) NULL)
6672    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6673  status=NegateImage(wand->images,gray,wand->exception);
6674  return(status);
6675}
6676
6677/*
6678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6679%                                                                             %
6680%                                                                             %
6681%                                                                             %
6682%   M a g i c k N e w I m a g e                                               %
6683%                                                                             %
6684%                                                                             %
6685%                                                                             %
6686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6687%
6688%  MagickNewImage() adds a blank image canvas of the specified size and
6689%  background color to the wand.
6690%
6691%  The format of the MagickNewImage method is:
6692%
6693%      MagickBooleanType MagickNewImage(MagickWand *wand,
6694%        const size_t columns,const size_t rows,
6695%        const PixelWand *background)
6696%
6697%  A description of each parameter follows:
6698%
6699%    o wand: the magick wand.
6700%
6701%    o width: the image width.
6702%
6703%    o height: the image height.
6704%
6705%    o background: the image color.
6706%
6707*/
6708WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6709  const size_t width,const size_t height,
6710  const PixelWand *background)
6711{
6712  Image
6713    *images;
6714
6715  PixelInfo
6716    pixel;
6717
6718  assert(wand != (MagickWand *) NULL);
6719  assert(wand->signature == WandSignature);
6720  if (wand->debug != MagickFalse)
6721    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6722  PixelGetMagickColor(background,&pixel);
6723  images=NewMagickImage(wand->image_info,width,height,&pixel);
6724  if (images == (Image *) NULL)
6725    return(MagickFalse);
6726  if (images->exception.severity != UndefinedException)
6727    InheritException(wand->exception,&images->exception);
6728  return(InsertImageInWand(wand,images));
6729}
6730
6731/*
6732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6733%                                                                             %
6734%                                                                             %
6735%                                                                             %
6736%   M a g i c k N e x t I m a g e                                             %
6737%                                                                             %
6738%                                                                             %
6739%                                                                             %
6740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6741%
6742%  MagickNextImage() associates the next image in the image list with a magick
6743%  wand.
6744%
6745%  The format of the MagickNextImage method is:
6746%
6747%      MagickBooleanType MagickNextImage(MagickWand *wand)
6748%
6749%  A description of each parameter follows:
6750%
6751%    o wand: the magick wand.
6752%
6753*/
6754WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6755{
6756  assert(wand != (MagickWand *) NULL);
6757  assert(wand->signature == WandSignature);
6758  if (wand->debug != MagickFalse)
6759    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6760  if (wand->images == (Image *) NULL)
6761    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6762  if (wand->pend != MagickFalse)
6763    {
6764      wand->pend=MagickFalse;
6765      return(MagickTrue);
6766    }
6767  if (GetNextImageInList(wand->images) == (Image *) NULL)
6768    {
6769      wand->pend=MagickTrue;
6770      return(MagickFalse);
6771    }
6772  wand->images=GetNextImageInList(wand->images);
6773  return(MagickTrue);
6774}
6775
6776/*
6777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6778%                                                                             %
6779%                                                                             %
6780%                                                                             %
6781%   M a g i c k N o r m a l i z e I m a g e                                   %
6782%                                                                             %
6783%                                                                             %
6784%                                                                             %
6785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6786%
6787%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6788%  the pixels color to span the entire range of colors available
6789%
6790%  You can also reduce the influence of a particular channel with a gamma
6791%  value of 0.
6792%
6793%  The format of the MagickNormalizeImage method is:
6794%
6795%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6796%
6797%  A description of each parameter follows:
6798%
6799%    o wand: the magick wand.
6800%
6801*/
6802WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6803{
6804  MagickBooleanType
6805    status;
6806
6807  assert(wand != (MagickWand *) NULL);
6808  assert(wand->signature == WandSignature);
6809  if (wand->debug != MagickFalse)
6810    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6811  if (wand->images == (Image *) NULL)
6812    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6813  status=NormalizeImage(wand->images);
6814  if (status == MagickFalse)
6815    InheritException(wand->exception,&wand->images->exception);
6816  return(status);
6817}
6818
6819/*
6820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6821%                                                                             %
6822%                                                                             %
6823%                                                                             %
6824%   M a g i c k O i l P a i n t I m a g e                                     %
6825%                                                                             %
6826%                                                                             %
6827%                                                                             %
6828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6829%
6830%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6831%  painting.  Each pixel is replaced by the most frequent color occurring
6832%  in a circular region defined by radius.
6833%
6834%  The format of the MagickOilPaintImage method is:
6835%
6836%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6837%        const double radius)
6838%
6839%  A description of each parameter follows:
6840%
6841%    o wand: the magick wand.
6842%
6843%    o radius: the radius of the circular neighborhood.
6844%
6845*/
6846WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6847  const double radius)
6848{
6849  Image
6850    *paint_image;
6851
6852  assert(wand != (MagickWand *) NULL);
6853  assert(wand->signature == WandSignature);
6854  if (wand->debug != MagickFalse)
6855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6856  if (wand->images == (Image *) NULL)
6857    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6858  paint_image=OilPaintImage(wand->images,radius,wand->exception);
6859  if (paint_image == (Image *) NULL)
6860    return(MagickFalse);
6861  ReplaceImageInList(&wand->images,paint_image);
6862  return(MagickTrue);
6863}
6864
6865/*
6866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6867%                                                                             %
6868%                                                                             %
6869%                                                                             %
6870%   M a g i c k O p a q u e P a i n t I m a g e                               %
6871%                                                                             %
6872%                                                                             %
6873%                                                                             %
6874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6875%
6876%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6877%  defined by fill.
6878%
6879%  The format of the MagickOpaquePaintImage method is:
6880%
6881%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6882%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6883%        const MagickBooleanType invert)
6884%
6885%  A description of each parameter follows:
6886%
6887%    o wand: the magick wand.
6888%
6889%    o target: Change this target color to the fill color within the image.
6890%
6891%    o fill: the fill pixel wand.
6892%
6893%    o fuzz: By default target must match a particular pixel color
6894%      exactly.  However, in many cases two colors may differ by a small amount.
6895%      The fuzz member of image defines how much tolerance is acceptable to
6896%      consider two colors as the same.  For example, set fuzz to 10 and the
6897%      color red at intensities of 100 and 102 respectively are now interpreted
6898%      as the same color for the purposes of the floodfill.
6899%
6900%    o invert: paint any pixel that does not match the target color.
6901%
6902*/
6903WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6904  const PixelWand *target,const PixelWand *fill,const double fuzz,
6905  const MagickBooleanType invert)
6906{
6907  MagickBooleanType
6908    status;
6909
6910  PixelInfo
6911    fill_pixel,
6912    target_pixel;
6913
6914  assert(wand != (MagickWand *) NULL);
6915  assert(wand->signature == WandSignature);
6916  if (wand->debug != MagickFalse)
6917    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6918  if (wand->images == (Image *) NULL)
6919    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6920  PixelGetMagickColor(target,&target_pixel);
6921  PixelGetMagickColor(fill,&fill_pixel);
6922  wand->images->fuzz=fuzz;
6923  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert);
6924  if (status == MagickFalse)
6925    InheritException(wand->exception,&wand->images->exception);
6926  return(status);
6927}
6928
6929/*
6930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6931%                                                                             %
6932%                                                                             %
6933%                                                                             %
6934%   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                         %
6935%                                                                             %
6936%                                                                             %
6937%                                                                             %
6938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6939%
6940%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6941%  previous image in the sequence.  From this it attempts to select the
6942%  smallest cropped image to replace each frame, while preserving the results
6943%  of the animation.
6944%
6945%  The format of the MagickOptimizeImageLayers method is:
6946%
6947%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6948%
6949%  A description of each parameter follows:
6950%
6951%    o wand: the magick wand.
6952%
6953*/
6954WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6955{
6956  Image
6957    *optimize_image;
6958
6959  assert(wand != (MagickWand *) NULL);
6960  assert(wand->signature == WandSignature);
6961  if (wand->debug != MagickFalse)
6962    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6963  if (wand->images == (Image *) NULL)
6964    return((MagickWand *) NULL);
6965  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6966  if (optimize_image == (Image *) NULL)
6967    return((MagickWand *) NULL);
6968  return(CloneMagickWandFromImages(wand,optimize_image));
6969}
6970
6971/*
6972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6973%                                                                             %
6974%                                                                             %
6975%                                                                             %
6976%     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                   %
6977%                                                                             %
6978%                                                                             %
6979%                                                                             %
6980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6981%
6982%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6983%  of pre-defined dithering threshold maps, but over multiple intensity levels,
6984%  which can be different for different channels, according to the input
6985%  arguments.
6986%
6987%  The format of the MagickOrderedPosterizeImage method is:
6988%
6989%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6990%        const char *threshold_map)
6991%
6992%  A description of each parameter follows:
6993%
6994%    o image: the image.
6995%
6996%    o threshold_map: A string containing the name of the threshold dither
6997%      map to use, followed by zero or more numbers representing the number of
6998%      color levels tho dither between.
6999%
7000%      Any level number less than 2 is equivalent to 2, and means only binary
7001%      dithering will be applied to each color channel.
7002%
7003%      No numbers also means a 2 level (bitmap) dither will be applied to all
7004%      channels, while a single number is the number of levels applied to each
7005%      channel in sequence.  More numbers will be applied in turn to each of
7006%      the color channels.
7007%
7008%      For example: "o3x3,6" generates a 6 level posterization of the image
7009%      with a ordered 3x3 diffused pixel dither being applied between each
7010%      level. While checker,8,8,4 will produce a 332 colormaped image with
7011%      only a single checkerboard hash pattern (50% grey) between each color
7012%      level, to basically double the number of color levels with a bare
7013%      minimim of dithering.
7014%
7015*/
7016WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7017  const char *threshold_map)
7018{
7019  MagickBooleanType
7020    status;
7021
7022  assert(wand != (MagickWand *) NULL);
7023  assert(wand->signature == WandSignature);
7024  if (wand->debug != MagickFalse)
7025    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7026  if (wand->images == (Image *) NULL)
7027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7028  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7029  return(status);
7030}
7031
7032/*
7033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7034%                                                                             %
7035%                                                                             %
7036%                                                                             %
7037%   M a g i c k P i n g I m a g e                                             %
7038%                                                                             %
7039%                                                                             %
7040%                                                                             %
7041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7042%
7043%  MagickPingImage() is like MagickReadImage() except the only valid
7044%  information returned is the image width, height, size, and format.  It
7045%  is designed to efficiently obtain this information from a file without
7046%  reading the entire image sequence into memory.
7047%
7048%  The format of the MagickPingImage method is:
7049%
7050%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7051%
7052%  A description of each parameter follows:
7053%
7054%    o wand: the magick wand.
7055%
7056%    o filename: the image filename.
7057%
7058*/
7059WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7060  const char *filename)
7061{
7062  Image
7063    *images;
7064
7065  ImageInfo
7066    *ping_info;
7067
7068  assert(wand != (MagickWand *) NULL);
7069  assert(wand->signature == WandSignature);
7070  if (wand->debug != MagickFalse)
7071    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7072  ping_info=CloneImageInfo(wand->image_info);
7073  if (filename != (const char *) NULL)
7074    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7075  images=PingImage(ping_info,wand->exception);
7076  ping_info=DestroyImageInfo(ping_info);
7077  if (images == (Image *) NULL)
7078    return(MagickFalse);
7079  return(InsertImageInWand(wand,images));
7080}
7081
7082/*
7083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7084%                                                                             %
7085%                                                                             %
7086%                                                                             %
7087%   M a g i c k P i n g I m a g e B l o b                                     %
7088%                                                                             %
7089%                                                                             %
7090%                                                                             %
7091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092%
7093%  MagickPingImageBlob() pings an image or image sequence from a blob.
7094%
7095%  The format of the MagickPingImageBlob method is:
7096%
7097%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7098%        const void *blob,const size_t length)
7099%
7100%  A description of each parameter follows:
7101%
7102%    o wand: the magick wand.
7103%
7104%    o blob: the blob.
7105%
7106%    o length: the blob length.
7107%
7108*/
7109WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7110  const void *blob,const size_t length)
7111{
7112  Image
7113    *images;
7114
7115  ImageInfo
7116    *read_info;
7117
7118  assert(wand != (MagickWand *) NULL);
7119  assert(wand->signature == WandSignature);
7120  if (wand->debug != MagickFalse)
7121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7122  read_info=CloneImageInfo(wand->image_info);
7123  SetImageInfoBlob(read_info,blob,length);
7124  images=PingImage(read_info,wand->exception);
7125  read_info=DestroyImageInfo(read_info);
7126  if (images == (Image *) NULL)
7127    return(MagickFalse);
7128  return(InsertImageInWand(wand,images));
7129}
7130
7131/*
7132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7133%                                                                             %
7134%                                                                             %
7135%                                                                             %
7136%   M a g i c k P i n g I m a g e F i l e                                     %
7137%                                                                             %
7138%                                                                             %
7139%                                                                             %
7140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7141%
7142%  MagickPingImageFile() pings an image or image sequence from an open file
7143%  descriptor.
7144%
7145%  The format of the MagickPingImageFile method is:
7146%
7147%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7148%
7149%  A description of each parameter follows:
7150%
7151%    o wand: the magick wand.
7152%
7153%    o file: the file descriptor.
7154%
7155*/
7156WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7157{
7158  Image
7159    *images;
7160
7161  ImageInfo
7162    *read_info;
7163
7164  assert(wand != (MagickWand *) NULL);
7165  assert(wand->signature == WandSignature);
7166  assert(file != (FILE *) NULL);
7167  if (wand->debug != MagickFalse)
7168    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7169  read_info=CloneImageInfo(wand->image_info);
7170  SetImageInfoFile(read_info,file);
7171  images=PingImage(read_info,wand->exception);
7172  read_info=DestroyImageInfo(read_info);
7173  if (images == (Image *) NULL)
7174    return(MagickFalse);
7175  return(InsertImageInWand(wand,images));
7176}
7177
7178/*
7179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7180%                                                                             %
7181%                                                                             %
7182%                                                                             %
7183%   M a g i c k P o l a r o i d I m a g e                                     %
7184%                                                                             %
7185%                                                                             %
7186%                                                                             %
7187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7188%
7189%  MagickPolaroidImage() simulates a Polaroid picture.
7190%
7191%  The format of the MagickPolaroidImage method is:
7192%
7193%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7194%        const DrawingWand *drawing_wand,const double angle)
7195%
7196%  A description of each parameter follows:
7197%
7198%    o wand: the magick wand.
7199%
7200%    o drawing_wand: the draw wand.
7201%
7202%    o angle: Apply the effect along this angle.
7203%
7204*/
7205WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7206  const DrawingWand *drawing_wand,const double angle)
7207{
7208  DrawInfo
7209    *draw_info;
7210
7211  Image
7212    *polaroid_image;
7213
7214  assert(wand != (MagickWand *) NULL);
7215  assert(wand->signature == WandSignature);
7216  if (wand->debug != MagickFalse)
7217    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7218  if (wand->images == (Image *) NULL)
7219    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7220  draw_info=PeekDrawingWand(drawing_wand);
7221  if (draw_info == (DrawInfo *) NULL)
7222    return(MagickFalse);
7223  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7224  if (polaroid_image == (Image *) NULL)
7225    return(MagickFalse);
7226  ReplaceImageInList(&wand->images,polaroid_image);
7227  return(MagickTrue);
7228}
7229
7230/*
7231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232%                                                                             %
7233%                                                                             %
7234%                                                                             %
7235%   M a g i c k P o s t e r i z e I m a g e                                   %
7236%                                                                             %
7237%                                                                             %
7238%                                                                             %
7239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240%
7241%  MagickPosterizeImage() reduces the image to a limited number of color level.
7242%
7243%  The format of the MagickPosterizeImage method is:
7244%
7245%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7246%        const unsigned levels,const MagickBooleanType dither)
7247%
7248%  A description of each parameter follows:
7249%
7250%    o wand: the magick wand.
7251%
7252%    o levels: Number of color levels allowed in each channel.  Very low values
7253%      (2, 3, or 4) have the most visible effect.
7254%
7255%    o dither: Set this integer value to something other than zero to dither
7256%      the mapped image.
7257%
7258*/
7259WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7260  const size_t levels,const MagickBooleanType dither)
7261{
7262  MagickBooleanType
7263    status;
7264
7265  assert(wand != (MagickWand *) NULL);
7266  assert(wand->signature == WandSignature);
7267  if (wand->debug != MagickFalse)
7268    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7269  if (wand->images == (Image *) NULL)
7270    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7271  status=PosterizeImage(wand->images,levels,dither);
7272  if (status == MagickFalse)
7273    InheritException(wand->exception,&wand->images->exception);
7274  return(status);
7275}
7276
7277/*
7278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7279%                                                                             %
7280%                                                                             %
7281%                                                                             %
7282%   M a g i c k P r e v i e w I m a g e s                                     %
7283%                                                                             %
7284%                                                                             %
7285%                                                                             %
7286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7287%
7288%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7289%  image processing operation applied at varying strengths.  This helpful
7290%  to quickly pin-point an appropriate parameter for an image processing
7291%  operation.
7292%
7293%  The format of the MagickPreviewImages method is:
7294%
7295%      MagickWand *MagickPreviewImages(MagickWand *wand,
7296%        const PreviewType preview)
7297%
7298%  A description of each parameter follows:
7299%
7300%    o wand: the magick wand.
7301%
7302%    o preview: the preview type.
7303%
7304*/
7305WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7306  const PreviewType preview)
7307{
7308  Image
7309    *preview_image;
7310
7311  assert(wand != (MagickWand *) NULL);
7312  assert(wand->signature == WandSignature);
7313  if (wand->debug != MagickFalse)
7314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7315  if (wand->images == (Image *) NULL)
7316    return((MagickWand *) NULL);
7317  preview_image=PreviewImage(wand->images,preview,wand->exception);
7318  if (preview_image == (Image *) NULL)
7319    return((MagickWand *) NULL);
7320  return(CloneMagickWandFromImages(wand,preview_image));
7321}
7322
7323/*
7324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7325%                                                                             %
7326%                                                                             %
7327%                                                                             %
7328%   M a g i c k P r e v i o u s I m a g e                                     %
7329%                                                                             %
7330%                                                                             %
7331%                                                                             %
7332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7333%
7334%  MagickPreviousImage() assocates the previous image in an image list with
7335%  the magick wand.
7336%
7337%  The format of the MagickPreviousImage method is:
7338%
7339%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7340%
7341%  A description of each parameter follows:
7342%
7343%    o wand: the magick wand.
7344%
7345*/
7346WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7347{
7348  assert(wand != (MagickWand *) NULL);
7349  assert(wand->signature == WandSignature);
7350  if (wand->debug != MagickFalse)
7351    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7352  if (wand->images == (Image *) NULL)
7353    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7354  if (wand->pend != MagickFalse)
7355    {
7356      wand->pend=MagickFalse;
7357      return(MagickTrue);
7358    }
7359  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7360    {
7361      wand->pend=MagickTrue;
7362      return(MagickFalse);
7363    }
7364  wand->images=GetPreviousImageInList(wand->images);
7365  return(MagickTrue);
7366}
7367
7368/*
7369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7370%                                                                             %
7371%                                                                             %
7372%                                                                             %
7373%   M a g i c k Q u a n t i z e I m a g e                                     %
7374%                                                                             %
7375%                                                                             %
7376%                                                                             %
7377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7378%
7379%  MagickQuantizeImage() analyzes the colors within a reference image and
7380%  chooses a fixed number of colors to represent the image.  The goal of the
7381%  algorithm is to minimize the color difference between the input and output
7382%  image while minimizing the processing time.
7383%
7384%  The format of the MagickQuantizeImage method is:
7385%
7386%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7387%        const size_t number_colors,const ColorspaceType colorspace,
7388%        const size_t treedepth,const MagickBooleanType dither,
7389%        const MagickBooleanType measure_error)
7390%
7391%  A description of each parameter follows:
7392%
7393%    o wand: the magick wand.
7394%
7395%    o number_colors: the number of colors.
7396%
7397%    o colorspace: Perform color reduction in this colorspace, typically
7398%      RGBColorspace.
7399%
7400%    o treedepth: Normally, this integer value is zero or one.  A zero or
7401%      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
7402%      reference image with the least amount of memory and the fastest
7403%      computational speed.  In some cases, such as an image with low color
7404%      dispersion (a few number of colors), a value other than
7405%      Log4(number_colors) is required.  To expand the color tree completely,
7406%      use a value of 8.
7407%
7408%    o dither: A value other than zero distributes the difference between an
7409%      original image and the corresponding color reduced image to
7410%      neighboring pixels along a Hilbert curve.
7411%
7412%    o measure_error: A value other than zero measures the difference between
7413%      the original and quantized images.  This difference is the total
7414%      quantization error.  The error is computed by summing over all pixels
7415%      in an image the distance squared in RGB space between each reference
7416%      pixel value and its quantized value.
7417%
7418*/
7419WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7420  const size_t number_colors,const ColorspaceType colorspace,
7421  const size_t treedepth,const MagickBooleanType dither,
7422  const MagickBooleanType measure_error)
7423{
7424  MagickBooleanType
7425    status;
7426
7427  QuantizeInfo
7428    *quantize_info;
7429
7430  assert(wand != (MagickWand *) NULL);
7431  assert(wand->signature == WandSignature);
7432  if (wand->debug != MagickFalse)
7433    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7434  if (wand->images == (Image *) NULL)
7435    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7436  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7437  quantize_info->number_colors=number_colors;
7438  quantize_info->dither=dither;
7439  quantize_info->tree_depth=treedepth;
7440  quantize_info->colorspace=colorspace;
7441  quantize_info->measure_error=measure_error;
7442  status=QuantizeImage(quantize_info,wand->images);
7443  if (status == MagickFalse)
7444    InheritException(wand->exception,&wand->images->exception);
7445  quantize_info=DestroyQuantizeInfo(quantize_info);
7446  return(status);
7447}
7448
7449/*
7450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7451%                                                                             %
7452%                                                                             %
7453%                                                                             %
7454%   M a g i c k Q u a n t i z e I m a g e s                                   %
7455%                                                                             %
7456%                                                                             %
7457%                                                                             %
7458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7459%
7460%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7461%  chooses a fixed number of colors to represent the image.  The goal of the
7462%  algorithm is to minimize the color difference between the input and output
7463%  image while minimizing the processing time.
7464%
7465%  The format of the MagickQuantizeImages method is:
7466%
7467%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7468%        const size_t number_colors,const ColorspaceType colorspace,
7469%        const size_t treedepth,const MagickBooleanType dither,
7470%        const MagickBooleanType measure_error)
7471%
7472%  A description of each parameter follows:
7473%
7474%    o wand: the magick wand.
7475%
7476%    o number_colors: the number of colors.
7477%
7478%    o colorspace: Perform color reduction in this colorspace, typically
7479%      RGBColorspace.
7480%
7481%    o treedepth: Normally, this integer value is zero or one.  A zero or
7482%      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
7483%      reference image with the least amount of memory and the fastest
7484%      computational speed.  In some cases, such as an image with low color
7485%      dispersion (a few number of colors), a value other than
7486%      Log4(number_colors) is required.  To expand the color tree completely,
7487%      use a value of 8.
7488%
7489%    o dither: A value other than zero distributes the difference between an
7490%      original image and the corresponding color reduced algorithm to
7491%      neighboring pixels along a Hilbert curve.
7492%
7493%    o measure_error: A value other than zero measures the difference between
7494%      the original and quantized images.  This difference is the total
7495%      quantization error.  The error is computed by summing over all pixels
7496%      in an image the distance squared in RGB space between each reference
7497%      pixel value and its quantized value.
7498%
7499*/
7500WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7501  const size_t number_colors,const ColorspaceType colorspace,
7502  const size_t treedepth,const MagickBooleanType dither,
7503  const MagickBooleanType measure_error)
7504{
7505  MagickBooleanType
7506    status;
7507
7508  QuantizeInfo
7509    *quantize_info;
7510
7511  assert(wand != (MagickWand *) NULL);
7512  assert(wand->signature == WandSignature);
7513  if (wand->debug != MagickFalse)
7514    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7515  if (wand->images == (Image *) NULL)
7516    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7517  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7518  quantize_info->number_colors=number_colors;
7519  quantize_info->dither=dither;
7520  quantize_info->tree_depth=treedepth;
7521  quantize_info->colorspace=colorspace;
7522  quantize_info->measure_error=measure_error;
7523  status=QuantizeImages(quantize_info,wand->images);
7524  if (status == MagickFalse)
7525    InheritException(wand->exception,&wand->images->exception);
7526  quantize_info=DestroyQuantizeInfo(quantize_info);
7527  return(status);
7528}
7529
7530/*
7531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7532%                                                                             %
7533%                                                                             %
7534%                                                                             %
7535%   M a g i c k R a d i a l B l u r I m a g e                                 %
7536%                                                                             %
7537%                                                                             %
7538%                                                                             %
7539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7540%
7541%  MagickRadialBlurImage() radial blurs an image.
7542%
7543%  The format of the MagickRadialBlurImage method is:
7544%
7545%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7546%        const double angle)
7547%
7548%  A description of each parameter follows:
7549%
7550%    o wand: the magick wand.
7551%
7552%    o angle: the angle of the blur in degrees.
7553%
7554*/
7555WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7556  const double angle)
7557{
7558  Image
7559    *blur_image;
7560
7561  assert(wand != (MagickWand *) NULL);
7562  assert(wand->signature == WandSignature);
7563  if (wand->debug != MagickFalse)
7564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7565  if (wand->images == (Image *) NULL)
7566    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7567  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7568  if (blur_image == (Image *) NULL)
7569    return(MagickFalse);
7570  ReplaceImageInList(&wand->images,blur_image);
7571  return(MagickTrue);
7572}
7573
7574/*
7575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7576%                                                                             %
7577%                                                                             %
7578%                                                                             %
7579%   M a g i c k R a i s e I m a g e                                           %
7580%                                                                             %
7581%                                                                             %
7582%                                                                             %
7583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7584%
7585%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7586%  by lightening and darkening the edges of the image.  Members width and
7587%  height of raise_info define the width of the vertical and horizontal
7588%  edge of the effect.
7589%
7590%  The format of the MagickRaiseImage method is:
7591%
7592%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7593%        const size_t width,const size_t height,const ssize_t x,
7594%        const ssize_t y,const MagickBooleanType raise)
7595%
7596%  A description of each parameter follows:
7597%
7598%    o wand: the magick wand.
7599%
7600%    o width,height,x,y:  Define the dimensions of the area to raise.
7601%
7602%    o raise: A value other than zero creates a 3-D raise effect,
7603%      otherwise it has a lowered effect.
7604%
7605*/
7606WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7607  const size_t width,const size_t height,const ssize_t x,
7608  const ssize_t y,const MagickBooleanType raise)
7609{
7610  MagickBooleanType
7611    status;
7612
7613  RectangleInfo
7614    raise_info;
7615
7616  assert(wand != (MagickWand *) NULL);
7617  assert(wand->signature == WandSignature);
7618  if (wand->debug != MagickFalse)
7619    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7620  if (wand->images == (Image *) NULL)
7621    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7622  raise_info.width=width;
7623  raise_info.height=height;
7624  raise_info.x=x;
7625  raise_info.y=y;
7626  status=RaiseImage(wand->images,&raise_info,raise);
7627  if (status == MagickFalse)
7628    InheritException(wand->exception,&wand->images->exception);
7629  return(status);
7630}
7631
7632/*
7633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7634%                                                                             %
7635%                                                                             %
7636%                                                                             %
7637%   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                       %
7638%                                                                             %
7639%                                                                             %
7640%                                                                             %
7641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7642%
7643%  MagickRandomThresholdImage() changes the value of individual pixels based on
7644%  the intensity of each pixel compared to threshold.  The result is a
7645%  high-contrast, two color image.
7646%
7647%  The format of the MagickRandomThresholdImage method is:
7648%
7649%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7650%        const double low,const double high)
7651%
7652%  A description of each parameter follows:
7653%
7654%    o wand: the magick wand.
7655%
7656%    o low,high: Specify the high and low thresholds.  These values range from
7657%      0 to QuantumRange.
7658%
7659*/
7660WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7661  const double low,const double high)
7662{
7663  char
7664    threshold[MaxTextExtent];
7665
7666  MagickBooleanType
7667    status;
7668
7669  assert(wand != (MagickWand *) NULL);
7670  assert(wand->signature == WandSignature);
7671  if (wand->debug != MagickFalse)
7672    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7673  if (wand->images == (Image *) NULL)
7674    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7675  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7676  status=RandomThresholdImage(wand->images,threshold,wand->exception);
7677  if (status == MagickFalse)
7678    InheritException(wand->exception,&wand->images->exception);
7679  return(status);
7680}
7681
7682/*
7683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7684%                                                                             %
7685%                                                                             %
7686%                                                                             %
7687%   M a g i c k R e a d I m a g e                                             %
7688%                                                                             %
7689%                                                                             %
7690%                                                                             %
7691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7692%
7693%  MagickReadImage() reads an image or image sequence.  The images are inserted
7694%  at the current image pointer position.   Use MagickSetFirstIterator(),
7695%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7696%  image pointer position at the beginning of the image list, the end, or
7697%  anywhere in-between respectively.
7698%
7699%  The format of the MagickReadImage method is:
7700%
7701%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7702%
7703%  A description of each parameter follows:
7704%
7705%    o wand: the magick wand.
7706%
7707%    o filename: the image filename.
7708%
7709*/
7710WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7711  const char *filename)
7712{
7713  Image
7714    *images;
7715
7716  ImageInfo
7717    *read_info;
7718
7719  assert(wand != (MagickWand *) NULL);
7720  assert(wand->signature == WandSignature);
7721  if (wand->debug != MagickFalse)
7722    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7723  read_info=CloneImageInfo(wand->image_info);
7724  if (filename != (const char *) NULL)
7725    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7726  images=ReadImage(read_info,wand->exception);
7727  read_info=DestroyImageInfo(read_info);
7728  if (images == (Image *) NULL)
7729    return(MagickFalse);
7730  return(InsertImageInWand(wand,images));
7731}
7732
7733/*
7734%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7735%                                                                             %
7736%                                                                             %
7737%                                                                             %
7738%   M a g i c k R e a d I m a g e B l o b                                     %
7739%                                                                             %
7740%                                                                             %
7741%                                                                             %
7742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7743%
7744%  MagickReadImageBlob() reads an image or image sequence from a blob.
7745%
7746%  The format of the MagickReadImageBlob method is:
7747%
7748%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7749%        const void *blob,const size_t length)
7750%
7751%  A description of each parameter follows:
7752%
7753%    o wand: the magick wand.
7754%
7755%    o blob: the blob.
7756%
7757%    o length: the blob length.
7758%
7759*/
7760WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7761  const void *blob,const size_t length)
7762{
7763  Image
7764    *images;
7765
7766  assert(wand != (MagickWand *) NULL);
7767  assert(wand->signature == WandSignature);
7768  if (wand->debug != MagickFalse)
7769    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7770  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7771  if (images == (Image *) NULL)
7772    return(MagickFalse);
7773  return(InsertImageInWand(wand,images));
7774}
7775
7776/*
7777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7778%                                                                             %
7779%                                                                             %
7780%                                                                             %
7781%   M a g i c k R e a d I m a g e F i l e                                     %
7782%                                                                             %
7783%                                                                             %
7784%                                                                             %
7785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7786%
7787%  MagickReadImageFile() reads an image or image sequence from an open file
7788%  descriptor.
7789%
7790%  The format of the MagickReadImageFile method is:
7791%
7792%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7793%
7794%  A description of each parameter follows:
7795%
7796%    o wand: the magick wand.
7797%
7798%    o file: the file descriptor.
7799%
7800*/
7801WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7802{
7803  Image
7804    *images;
7805
7806  ImageInfo
7807    *read_info;
7808
7809  assert(wand != (MagickWand *) NULL);
7810  assert(wand->signature == WandSignature);
7811  assert(file != (FILE *) NULL);
7812  if (wand->debug != MagickFalse)
7813    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7814  read_info=CloneImageInfo(wand->image_info);
7815  SetImageInfoFile(read_info,file);
7816  images=ReadImage(read_info,wand->exception);
7817  read_info=DestroyImageInfo(read_info);
7818  if (images == (Image *) NULL)
7819    return(MagickFalse);
7820  return(InsertImageInWand(wand,images));
7821}
7822
7823/*
7824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7825%                                                                             %
7826%                                                                             %
7827%                                                                             %
7828%   M a g i c k R e m a p I m a g e                                           %
7829%                                                                             %
7830%                                                                             %
7831%                                                                             %
7832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7833%
7834%  MagickRemapImage() replaces the colors of an image with the closest color
7835%  from a reference image.
7836%
7837%  The format of the MagickRemapImage method is:
7838%
7839%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7840%        const MagickWand *remap_wand,const DitherMethod method)
7841%
7842%  A description of each parameter follows:
7843%
7844%    o wand: the magick wand.
7845%
7846%    o affinity: the affinity wand.
7847%
7848%    o method: choose from these dither methods: NoDitherMethod,
7849%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7850%
7851*/
7852WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7853  const MagickWand *remap_wand,const DitherMethod method)
7854{
7855  MagickBooleanType
7856    status;
7857
7858  QuantizeInfo
7859    *quantize_info;
7860
7861  assert(wand != (MagickWand *) NULL);
7862  assert(wand->signature == WandSignature);
7863  if (wand->debug != MagickFalse)
7864    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7865  if ((wand->images == (Image *) NULL) ||
7866      (remap_wand->images == (Image *) NULL))
7867    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7868  quantize_info=AcquireQuantizeInfo(wand->image_info);
7869  quantize_info->dither_method=method;
7870  if (method == NoDitherMethod)
7871    quantize_info->dither=MagickFalse;
7872  status=RemapImage(quantize_info,wand->images,remap_wand->images);
7873  quantize_info=DestroyQuantizeInfo(quantize_info);
7874  if (status == MagickFalse)
7875    InheritException(wand->exception,&wand->images->exception);
7876  return(status);
7877}
7878
7879/*
7880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7881%                                                                             %
7882%                                                                             %
7883%                                                                             %
7884%   M a g i c k R e m o v e I m a g e                                         %
7885%                                                                             %
7886%                                                                             %
7887%                                                                             %
7888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7889%
7890%  MagickRemoveImage() removes an image from the image list.
7891%
7892%  The format of the MagickRemoveImage method is:
7893%
7894%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7895%
7896%  A description of each parameter follows:
7897%
7898%    o wand: the magick wand.
7899%
7900%    o insert: the splice wand.
7901%
7902*/
7903WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7904{
7905  assert(wand != (MagickWand *) NULL);
7906  assert(wand->signature == WandSignature);
7907  if (wand->debug != MagickFalse)
7908    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7909  if (wand->images == (Image *) NULL)
7910    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7911  DeleteImageFromList(&wand->images);
7912  return(MagickTrue);
7913}
7914
7915/*
7916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7917%                                                                             %
7918%                                                                             %
7919%                                                                             %
7920%   M a g i c k R e s a m p l e I m a g e                                     %
7921%                                                                             %
7922%                                                                             %
7923%                                                                             %
7924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7925%
7926%  MagickResampleImage() resample image to desired resolution.
7927%
7928%    Bessel   Blackman   Box
7929%    Catrom   Cubic      Gaussian
7930%    Hanning  Hermite    Lanczos
7931%    Mitchell Point      Quandratic
7932%    Sinc     Triangle
7933%
7934%  Most of the filters are FIR (finite impulse response), however, Bessel,
7935%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7936%  are windowed (brought down to zero) with the Blackman filter.
7937%
7938%  The format of the MagickResampleImage method is:
7939%
7940%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7941%        const double x_resolution,const double y_resolution,
7942%        const FilterTypes filter,const double blur)
7943%
7944%  A description of each parameter follows:
7945%
7946%    o wand: the magick wand.
7947%
7948%    o x_resolution: the new image x resolution.
7949%
7950%    o y_resolution: the new image y resolution.
7951%
7952%    o filter: Image filter to use.
7953%
7954%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7955%
7956*/
7957WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7958  const double x_resolution,const double y_resolution,const FilterTypes filter,
7959  const double blur)
7960{
7961  Image
7962    *resample_image;
7963
7964  assert(wand != (MagickWand *) NULL);
7965  assert(wand->signature == WandSignature);
7966  if (wand->debug != MagickFalse)
7967    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7968  if (wand->images == (Image *) NULL)
7969    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7970  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7971    blur,wand->exception);
7972  if (resample_image == (Image *) NULL)
7973    return(MagickFalse);
7974  ReplaceImageInList(&wand->images,resample_image);
7975  return(MagickTrue);
7976}
7977
7978/*
7979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7980%                                                                             %
7981%                                                                             %
7982%                                                                             %
7983%   M a g i c k R e s e t I m a g e P a g e                                   %
7984%                                                                             %
7985%                                                                             %
7986%                                                                             %
7987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7988%
7989%  MagickResetImagePage() resets the Wand page canvas and position.
7990%
7991%  The format of the MagickResetImagePage method is:
7992%
7993%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7994%        const char *page)
7995%
7996%  A description of each parameter follows:
7997%
7998%    o wand: the magick wand.
7999%
8000%    o page: the relative page specification.
8001%
8002*/
8003WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8004  const char *page)
8005{
8006  assert(wand != (MagickWand *) NULL);
8007  assert(wand->signature == WandSignature);
8008  if (wand->debug != MagickFalse)
8009    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8010  if (wand->images == (Image *) NULL)
8011    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8012  if ((page == (char *) NULL) || (*page == '\0'))
8013    {
8014      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8015      return(MagickTrue);
8016    }
8017  return(ResetImagePage(wand->images,page));
8018}
8019
8020/*
8021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8022%                                                                             %
8023%                                                                             %
8024%                                                                             %
8025%   M a g i c k R e s i z e I m a g e                                         %
8026%                                                                             %
8027%                                                                             %
8028%                                                                             %
8029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8030%
8031%  MagickResizeImage() scales an image to the desired dimensions with one of
8032%  these filters:
8033%
8034%    Bessel   Blackman   Box
8035%    Catrom   Cubic      Gaussian
8036%    Hanning  Hermite    Lanczos
8037%    Mitchell Point      Quandratic
8038%    Sinc     Triangle
8039%
8040%  Most of the filters are FIR (finite impulse response), however, Bessel,
8041%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8042%  are windowed (brought down to zero) with the Blackman filter.
8043%
8044%  The format of the MagickResizeImage method is:
8045%
8046%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8047%        const size_t columns,const size_t rows,
8048%        const FilterTypes filter,const double blur)
8049%
8050%  A description of each parameter follows:
8051%
8052%    o wand: the magick wand.
8053%
8054%    o columns: the number of columns in the scaled image.
8055%
8056%    o rows: the number of rows in the scaled image.
8057%
8058%    o filter: Image filter to use.
8059%
8060%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8061%
8062*/
8063WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8064  const size_t columns,const size_t rows,const FilterTypes filter,
8065  const double blur)
8066{
8067  Image
8068    *resize_image;
8069
8070  assert(wand != (MagickWand *) NULL);
8071  assert(wand->signature == WandSignature);
8072  if (wand->debug != MagickFalse)
8073    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8074  if (wand->images == (Image *) NULL)
8075    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8076  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8077    wand->exception);
8078  if (resize_image == (Image *) NULL)
8079    return(MagickFalse);
8080  ReplaceImageInList(&wand->images,resize_image);
8081  return(MagickTrue);
8082}
8083
8084/*
8085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8086%                                                                             %
8087%                                                                             %
8088%                                                                             %
8089%   M a g i c k R o l l I m a g e                                             %
8090%                                                                             %
8091%                                                                             %
8092%                                                                             %
8093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8094%
8095%  MagickRollImage() offsets an image as defined by x and y.
8096%
8097%  The format of the MagickRollImage method is:
8098%
8099%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8100%        const size_t y)
8101%
8102%  A description of each parameter follows:
8103%
8104%    o wand: the magick wand.
8105%
8106%    o x: the x offset.
8107%
8108%    o y: the y offset.
8109%
8110%
8111*/
8112WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8113  const ssize_t x,const ssize_t y)
8114{
8115  Image
8116    *roll_image;
8117
8118  assert(wand != (MagickWand *) NULL);
8119  assert(wand->signature == WandSignature);
8120  if (wand->debug != MagickFalse)
8121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8122  if (wand->images == (Image *) NULL)
8123    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8124  roll_image=RollImage(wand->images,x,y,wand->exception);
8125  if (roll_image == (Image *) NULL)
8126    return(MagickFalse);
8127  ReplaceImageInList(&wand->images,roll_image);
8128  return(MagickTrue);
8129}
8130
8131/*
8132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8133%                                                                             %
8134%                                                                             %
8135%                                                                             %
8136%   M a g i c k R o t a t e I m a g e                                         %
8137%                                                                             %
8138%                                                                             %
8139%                                                                             %
8140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8141%
8142%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8143%  triangles left over from rotating the image are filled with the
8144%  background color.
8145%
8146%  The format of the MagickRotateImage method is:
8147%
8148%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8149%        const PixelWand *background,const double degrees)
8150%
8151%  A description of each parameter follows:
8152%
8153%    o wand: the magick wand.
8154%
8155%    o background: the background pixel wand.
8156%
8157%    o degrees: the number of degrees to rotate the image.
8158%
8159%
8160*/
8161WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8162  const PixelWand *background,const double degrees)
8163{
8164  Image
8165    *rotate_image;
8166
8167  assert(wand != (MagickWand *) NULL);
8168  assert(wand->signature == WandSignature);
8169  if (wand->debug != MagickFalse)
8170    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8171  if (wand->images == (Image *) NULL)
8172    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8173  PixelGetQuantumPacket(background,&wand->images->background_color);
8174  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8175  if (rotate_image == (Image *) NULL)
8176    return(MagickFalse);
8177  ReplaceImageInList(&wand->images,rotate_image);
8178  return(MagickTrue);
8179}
8180
8181/*
8182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8183%                                                                             %
8184%                                                                             %
8185%                                                                             %
8186%   M a g i c k S a m p l e I m a g e                                         %
8187%                                                                             %
8188%                                                                             %
8189%                                                                             %
8190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8191%
8192%  MagickSampleImage() scales an image to the desired dimensions with pixel
8193%  sampling.  Unlike other scaling methods, this method does not introduce
8194%  any additional color into the scaled image.
8195%
8196%  The format of the MagickSampleImage method is:
8197%
8198%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8199%        const size_t columns,const size_t rows)
8200%
8201%  A description of each parameter follows:
8202%
8203%    o wand: the magick wand.
8204%
8205%    o columns: the number of columns in the scaled image.
8206%
8207%    o rows: the number of rows in the scaled image.
8208%
8209%
8210*/
8211WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8212  const size_t columns,const size_t rows)
8213{
8214  Image
8215    *sample_image;
8216
8217  assert(wand != (MagickWand *) NULL);
8218  assert(wand->signature == WandSignature);
8219  if (wand->debug != MagickFalse)
8220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8221  if (wand->images == (Image *) NULL)
8222    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8223  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8224  if (sample_image == (Image *) NULL)
8225    return(MagickFalse);
8226  ReplaceImageInList(&wand->images,sample_image);
8227  return(MagickTrue);
8228}
8229
8230/*
8231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8232%                                                                             %
8233%                                                                             %
8234%                                                                             %
8235%   M a g i c k S c a l e I m a g e                                           %
8236%                                                                             %
8237%                                                                             %
8238%                                                                             %
8239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8240%
8241%  MagickScaleImage() scales the size of an image to the given dimensions.
8242%
8243%  The format of the MagickScaleImage method is:
8244%
8245%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8246%        const size_t columns,const size_t rows)
8247%
8248%  A description of each parameter follows:
8249%
8250%    o wand: the magick wand.
8251%
8252%    o columns: the number of columns in the scaled image.
8253%
8254%    o rows: the number of rows in the scaled image.
8255%
8256%
8257*/
8258WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8259  const size_t columns,const size_t rows)
8260{
8261  Image
8262    *scale_image;
8263
8264  assert(wand != (MagickWand *) NULL);
8265  assert(wand->signature == WandSignature);
8266  if (wand->debug != MagickFalse)
8267    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8268  if (wand->images == (Image *) NULL)
8269    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8270  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8271  if (scale_image == (Image *) NULL)
8272    return(MagickFalse);
8273  ReplaceImageInList(&wand->images,scale_image);
8274  return(MagickTrue);
8275}
8276
8277/*
8278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8279%                                                                             %
8280%                                                                             %
8281%                                                                             %
8282%   M a g i c k S e g m e n t I m a g e                                       %
8283%                                                                             %
8284%                                                                             %
8285%                                                                             %
8286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8287%
8288%  MagickSegmentImage() segments an image by analyzing the histograms of the
8289%  color components and identifying units that are homogeneous with the fuzzy
8290%  C-means technique.
8291%
8292%  The format of the SegmentImage method is:
8293%
8294%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8295%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8296%        const double cluster_threshold,const double smooth_threshold)
8297%
8298%  A description of each parameter follows.
8299%
8300%    o wand: the wand.
8301%
8302%    o colorspace: the image colorspace.
8303%
8304%    o verbose:  Set to MagickTrue to print detailed information about the
8305%      identified classes.
8306%
8307%    o cluster_threshold:  This represents the minimum number of pixels
8308%      contained in a hexahedra before it can be considered valid (expressed as
8309%      a percentage).
8310%
8311%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8312%      derivative of the histogram.  As the value is increased, you can expect a
8313%      smoother second derivative.
8314%
8315*/
8316MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8317  const ColorspaceType colorspace,const MagickBooleanType verbose,
8318  const double cluster_threshold,const double smooth_threshold)
8319{
8320  MagickBooleanType
8321    status;
8322
8323  assert(wand != (MagickWand *) NULL);
8324  assert(wand->signature == WandSignature);
8325  if (wand->debug != MagickFalse)
8326    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8327  if (wand->images == (Image *) NULL)
8328    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8329  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8330    smooth_threshold);
8331  if (status == MagickFalse)
8332    InheritException(wand->exception,&wand->images->exception);
8333  return(status);
8334}
8335
8336/*
8337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8338%                                                                             %
8339%                                                                             %
8340%                                                                             %
8341%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8342%                                                                             %
8343%                                                                             %
8344%                                                                             %
8345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8346%
8347%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8348%  threshold. It is similar to the unsharpen mask that sharpens everything with
8349%  contrast above a certain threshold.
8350%
8351%  The format of the MagickSelectiveBlurImage method is:
8352%
8353%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8354%        const double radius,const double sigma,const double threshold)
8355%
8356%  A description of each parameter follows:
8357%
8358%    o wand: the magick wand.
8359%
8360%    o radius: the radius of the gaussian, in pixels, not counting the center
8361%      pixel.
8362%
8363%    o sigma: the standard deviation of the gaussian, in pixels.
8364%
8365%    o threshold: only pixels within this contrast threshold are included
8366%      in the blur operation.
8367%
8368*/
8369WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8370  const double radius,const double sigma,const double threshold)
8371{
8372  Image
8373    *blur_image;
8374
8375  assert(wand != (MagickWand *) NULL);
8376  assert(wand->signature == WandSignature);
8377  if (wand->debug != MagickFalse)
8378    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8379  if (wand->images == (Image *) NULL)
8380    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8381  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8382    wand->exception);
8383  if (blur_image == (Image *) NULL)
8384    return(MagickFalse);
8385  ReplaceImageInList(&wand->images,blur_image);
8386  return(MagickTrue);
8387}
8388
8389/*
8390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8391%                                                                             %
8392%                                                                             %
8393%                                                                             %
8394%   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                       %
8395%                                                                             %
8396%                                                                             %
8397%                                                                             %
8398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8399%
8400%  MagickSeparateImage() separates a channel from the image and returns a
8401%  grayscale image.  A channel is a particular color component of each pixel
8402%  in the image.
8403%
8404%  The format of the MagickSeparateImage method is:
8405%
8406%      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8407%
8408%  A description of each parameter follows:
8409%
8410%    o wand: the magick wand.
8411%
8412*/
8413WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8414{
8415  MagickBooleanType
8416    status;
8417
8418  assert(wand != (MagickWand *) NULL);
8419  assert(wand->signature == WandSignature);
8420  if (wand->debug != MagickFalse)
8421    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8422  if (wand->images == (Image *) NULL)
8423    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8424  status=SeparateImage(wand->images);
8425  if (status == MagickFalse)
8426    InheritException(wand->exception,&wand->images->exception);
8427  return(status);
8428}
8429
8430/*
8431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8432%                                                                             %
8433%                                                                             %
8434%                                                                             %
8435%     M a g i c k S e p i a T o n e I m a g e                                 %
8436%                                                                             %
8437%                                                                             %
8438%                                                                             %
8439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8440%
8441%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8442%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8443%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8444%  threshold of 80% is a good starting point for a reasonable tone.
8445%
8446%  The format of the MagickSepiaToneImage method is:
8447%
8448%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8449%        const double threshold)
8450%
8451%  A description of each parameter follows:
8452%
8453%    o wand: the magick wand.
8454%
8455%    o threshold:  Define the extent of the sepia toning.
8456%
8457*/
8458WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8459  const double threshold)
8460{
8461  Image
8462    *sepia_image;
8463
8464  assert(wand != (MagickWand *) NULL);
8465  assert(wand->signature == WandSignature);
8466  if (wand->debug != MagickFalse)
8467    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8468  if (wand->images == (Image *) NULL)
8469    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8470  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8471  if (sepia_image == (Image *) NULL)
8472    return(MagickFalse);
8473  ReplaceImageInList(&wand->images,sepia_image);
8474  return(MagickTrue);
8475}
8476
8477/*
8478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8479%                                                                             %
8480%                                                                             %
8481%                                                                             %
8482%   M a g i c k S e t I m a g e                                               %
8483%                                                                             %
8484%                                                                             %
8485%                                                                             %
8486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8487%
8488%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8489%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8490%  wand.
8491%
8492%  The format of the MagickSetImage method is:
8493%
8494%      MagickBooleanType MagickSetImage(MagickWand *wand,
8495%        const MagickWand *set_wand)
8496%
8497%  A description of each parameter follows:
8498%
8499%    o wand: the magick wand.
8500%
8501%    o set_wand: the set_wand wand.
8502%
8503*/
8504WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8505  const MagickWand *set_wand)
8506{
8507  Image
8508    *images;
8509
8510  assert(wand != (MagickWand *) NULL);
8511  assert(wand->signature == WandSignature);
8512  if (wand->debug != MagickFalse)
8513    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8514  assert(set_wand != (MagickWand *) NULL);
8515  assert(set_wand->signature == WandSignature);
8516  if (wand->debug != MagickFalse)
8517    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8518  if (set_wand->images == (Image *) NULL)
8519    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8520  images=CloneImageList(set_wand->images,wand->exception);
8521  if (images == (Image *) NULL)
8522    return(MagickFalse);
8523  ReplaceImageInList(&wand->images,images);
8524  return(MagickTrue);
8525}
8526
8527/*
8528%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8529%                                                                             %
8530%                                                                             %
8531%                                                                             %
8532%   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                       %
8533%                                                                             %
8534%                                                                             %
8535%                                                                             %
8536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8537%
8538%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8539%  alpha channel.
8540%
8541%  The format of the MagickSetImageAlphaChannel method is:
8542%
8543%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8544%        const AlphaChannelType alpha_type)
8545%
8546%  A description of each parameter follows:
8547%
8548%    o wand: the magick wand.
8549%
8550%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8551%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8552%
8553*/
8554WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8555  const AlphaChannelType alpha_type)
8556{
8557  assert(wand != (MagickWand *) NULL);
8558  assert(wand->signature == WandSignature);
8559  if (wand->debug != MagickFalse)
8560    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8561  if (wand->images == (Image *) NULL)
8562    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8563  return(SetImageAlphaChannel(wand->images,alpha_type));
8564}
8565
8566/*
8567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568%                                                                             %
8569%                                                                             %
8570%                                                                             %
8571%   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                 %
8572%                                                                             %
8573%                                                                             %
8574%                                                                             %
8575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8576%
8577%  MagickSetImageBackgroundColor() sets the image background color.
8578%
8579%  The format of the MagickSetImageBackgroundColor method is:
8580%
8581%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8582%        const PixelWand *background)
8583%
8584%  A description of each parameter follows:
8585%
8586%    o wand: the magick wand.
8587%
8588%    o background: the background pixel wand.
8589%
8590*/
8591WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8592  const PixelWand *background)
8593{
8594  assert(wand != (MagickWand *) NULL);
8595  assert(wand->signature == WandSignature);
8596  if (wand->debug != MagickFalse)
8597    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8598  if (wand->images == (Image *) NULL)
8599    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8600  PixelGetQuantumPacket(background,&wand->images->background_color);
8601  return(MagickTrue);
8602}
8603
8604/*
8605%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8606%                                                                             %
8607%                                                                             %
8608%                                                                             %
8609%   M a g i c k S e t I m a g e B i a s                                       %
8610%                                                                             %
8611%                                                                             %
8612%                                                                             %
8613%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8614%
8615%  MagickSetImageBias() sets the image bias for any method that convolves an
8616%  image (e.g. MagickConvolveImage()).
8617%
8618%  The format of the MagickSetImageBias method is:
8619%
8620%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8621%        const double bias)
8622%
8623%  A description of each parameter follows:
8624%
8625%    o wand: the magick wand.
8626%
8627%    o bias: the image bias.
8628%
8629*/
8630WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8631  const double bias)
8632{
8633  assert(wand != (MagickWand *) NULL);
8634  assert(wand->signature == WandSignature);
8635  if (wand->debug != MagickFalse)
8636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8637  if (wand->images == (Image *) NULL)
8638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8639  wand->images->bias=bias;
8640  return(MagickTrue);
8641}
8642
8643/*
8644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8645%                                                                             %
8646%                                                                             %
8647%                                                                             %
8648%   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                         %
8649%                                                                             %
8650%                                                                             %
8651%                                                                             %
8652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8653%
8654%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8655%
8656%  The format of the MagickSetImageBluePrimary method is:
8657%
8658%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8659%        const double x,const double y)
8660%
8661%  A description of each parameter follows:
8662%
8663%    o wand: the magick wand.
8664%
8665%    o x: the blue primary x-point.
8666%
8667%    o y: the blue primary y-point.
8668%
8669*/
8670WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8671  const double x,const double y)
8672{
8673  assert(wand != (MagickWand *) NULL);
8674  assert(wand->signature == WandSignature);
8675  if (wand->debug != MagickFalse)
8676    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8677  if (wand->images == (Image *) NULL)
8678    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8679  wand->images->chromaticity.blue_primary.x=x;
8680  wand->images->chromaticity.blue_primary.y=y;
8681  return(MagickTrue);
8682}
8683
8684/*
8685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8686%                                                                             %
8687%                                                                             %
8688%                                                                             %
8689%   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                         %
8690%                                                                             %
8691%                                                                             %
8692%                                                                             %
8693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8694%
8695%  MagickSetImageBorderColor() sets the image border color.
8696%
8697%  The format of the MagickSetImageBorderColor method is:
8698%
8699%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8700%        const PixelWand *border)
8701%
8702%  A description of each parameter follows:
8703%
8704%    o wand: the magick wand.
8705%
8706%    o border: the border pixel wand.
8707%
8708*/
8709WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8710  const PixelWand *border)
8711{
8712  assert(wand != (MagickWand *) NULL);
8713  assert(wand->signature == WandSignature);
8714  if (wand->debug != MagickFalse)
8715    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8716  if (wand->images == (Image *) NULL)
8717    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8718  PixelGetQuantumPacket(border,&wand->images->border_color);
8719  return(MagickTrue);
8720}
8721
8722/*
8723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8724%                                                                             %
8725%                                                                             %
8726%                                                                             %
8727%   M a g i c k S e t I m a g e C l i p M a s k                               %
8728%                                                                             %
8729%                                                                             %
8730%                                                                             %
8731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8732%
8733%  MagickSetImageClipMask() sets image clip mask.
8734%
8735%  The format of the MagickSetImageClipMask method is:
8736%
8737%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8738%        const MagickWand *clip_mask)
8739%
8740%  A description of each parameter follows:
8741%
8742%    o wand: the magick wand.
8743%
8744%    o clip_mask: the clip_mask wand.
8745%
8746*/
8747WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8748  const MagickWand *clip_mask)
8749{
8750  assert(wand != (MagickWand *) NULL);
8751  assert(wand->signature == WandSignature);
8752  if (wand->debug != MagickFalse)
8753    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8754  assert(clip_mask != (MagickWand *) NULL);
8755  assert(clip_mask->signature == WandSignature);
8756  if (wand->debug != MagickFalse)
8757    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8758  if (clip_mask->images == (Image *) NULL)
8759    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8760  return(SetImageClipMask(wand->images,clip_mask->images));
8761}
8762
8763/*
8764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8765%                                                                             %
8766%                                                                             %
8767%                                                                             %
8768%   M a g i c k S e t I m a g e C o l o r                                     %
8769%                                                                             %
8770%                                                                             %
8771%                                                                             %
8772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8773%
8774%  MagickSetImageColor() set the entire wand canvas to the specified color.
8775%
8776%  The format of the MagickSetImageColor method is:
8777%
8778%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8779%        const PixelWand *color)
8780%
8781%  A description of each parameter follows:
8782%
8783%    o wand: the magick wand.
8784%
8785%    o background: the image color.
8786%
8787*/
8788WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8789  const PixelWand *color)
8790{
8791  MagickBooleanType
8792    status;
8793
8794  PixelInfo
8795    pixel;
8796
8797  assert(wand != (MagickWand *) NULL);
8798  assert(wand->signature == WandSignature);
8799  if (wand->debug != MagickFalse)
8800    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8801  PixelGetMagickColor(color,&pixel);
8802  status=SetImageColor(wand->images,&pixel);
8803  if (status == MagickFalse)
8804    InheritException(wand->exception,&wand->images->exception);
8805  return(status);
8806}
8807
8808/*
8809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8810%                                                                             %
8811%                                                                             %
8812%                                                                             %
8813%   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                     %
8814%                                                                             %
8815%                                                                             %
8816%                                                                             %
8817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8818%
8819%  MagickSetImageColormapColor() sets the color of the specified colormap
8820%  index.
8821%
8822%  The format of the MagickSetImageColormapColor method is:
8823%
8824%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8825%        const size_t index,const PixelWand *color)
8826%
8827%  A description of each parameter follows:
8828%
8829%    o wand: the magick wand.
8830%
8831%    o index: the offset into the image colormap.
8832%
8833%    o color: Return the colormap color in this wand.
8834%
8835*/
8836WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8837  const size_t index,const PixelWand *color)
8838{
8839  assert(wand != (MagickWand *) NULL);
8840  assert(wand->signature == WandSignature);
8841  if (wand->debug != MagickFalse)
8842    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8843  if (wand->images == (Image *) NULL)
8844    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8845  if ((wand->images->colormap == (PixelPacket *) NULL) ||
8846      (index >= wand->images->colors))
8847    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8848  PixelGetQuantumPacket(color,wand->images->colormap+index);
8849  return(SyncImage(wand->images));
8850}
8851
8852/*
8853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8854%                                                                             %
8855%                                                                             %
8856%                                                                             %
8857%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8858%                                                                             %
8859%                                                                             %
8860%                                                                             %
8861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8862%
8863%  MagickSetImageColorspace() sets the image colorspace.
8864%
8865%  The format of the MagickSetImageColorspace method is:
8866%
8867%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8868%        const ColorspaceType colorspace)
8869%
8870%  A description of each parameter follows:
8871%
8872%    o wand: the magick wand.
8873%
8874%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8875%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8876%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8877%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8878%      HSLColorspace, or HWBColorspace.
8879%
8880*/
8881WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8882  const ColorspaceType colorspace)
8883{
8884  assert(wand != (MagickWand *) NULL);
8885  assert(wand->signature == WandSignature);
8886  if (wand->debug != MagickFalse)
8887    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8888  if (wand->images == (Image *) NULL)
8889    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8890  return(SetImageColorspace(wand->images,colorspace));
8891}
8892
8893/*
8894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8895%                                                                             %
8896%                                                                             %
8897%                                                                             %
8898%   M a g i c k S e t I m a g e C o m p o s e                                 %
8899%                                                                             %
8900%                                                                             %
8901%                                                                             %
8902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8903%
8904%  MagickSetImageCompose() sets the image composite operator, useful for
8905%  specifying how to composite the image thumbnail when using the
8906%  MagickMontageImage() method.
8907%
8908%  The format of the MagickSetImageCompose method is:
8909%
8910%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8911%        const CompositeOperator compose)
8912%
8913%  A description of each parameter follows:
8914%
8915%    o wand: the magick wand.
8916%
8917%    o compose: the image composite operator.
8918%
8919*/
8920WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8921  const CompositeOperator compose)
8922{
8923  assert(wand != (MagickWand *) NULL);
8924  assert(wand->signature == WandSignature);
8925  if (wand->debug != MagickFalse)
8926    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8927  if (wand->images == (Image *) NULL)
8928    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8929  wand->images->compose=compose;
8930  return(MagickTrue);
8931}
8932
8933/*
8934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8935%                                                                             %
8936%                                                                             %
8937%                                                                             %
8938%   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                         %
8939%                                                                             %
8940%                                                                             %
8941%                                                                             %
8942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8943%
8944%  MagickSetImageCompression() sets the image compression.
8945%
8946%  The format of the MagickSetImageCompression method is:
8947%
8948%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8949%        const CompressionType compression)
8950%
8951%  A description of each parameter follows:
8952%
8953%    o wand: the magick wand.
8954%
8955%    o compression: the image compression type.
8956%
8957*/
8958WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8959  const CompressionType compression)
8960{
8961  assert(wand != (MagickWand *) NULL);
8962  assert(wand->signature == WandSignature);
8963  if (wand->debug != MagickFalse)
8964    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8965  if (wand->images == (Image *) NULL)
8966    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8967  wand->images->compression=compression;
8968  return(MagickTrue);
8969}
8970
8971/*
8972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8973%                                                                             %
8974%                                                                             %
8975%                                                                             %
8976%   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           %
8977%                                                                             %
8978%                                                                             %
8979%                                                                             %
8980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8981%
8982%  MagickSetImageCompressionQuality() sets the image compression quality.
8983%
8984%  The format of the MagickSetImageCompressionQuality method is:
8985%
8986%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8987%        const size_t quality)
8988%
8989%  A description of each parameter follows:
8990%
8991%    o wand: the magick wand.
8992%
8993%    o quality: the image compression tlityype.
8994%
8995*/
8996WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8997  const size_t quality)
8998{
8999  assert(wand != (MagickWand *) NULL);
9000  assert(wand->signature == WandSignature);
9001  if (wand->debug != MagickFalse)
9002    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9003  if (wand->images == (Image *) NULL)
9004    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9005  wand->images->quality=quality;
9006  return(MagickTrue);
9007}
9008
9009/*
9010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9011%                                                                             %
9012%                                                                             %
9013%                                                                             %
9014%   M a g i c k S e t I m a g e D e l a y                                     %
9015%                                                                             %
9016%                                                                             %
9017%                                                                             %
9018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9019%
9020%  MagickSetImageDelay() sets the image delay.
9021%
9022%  The format of the MagickSetImageDelay method is:
9023%
9024%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9025%        const size_t delay)
9026%
9027%  A description of each parameter follows:
9028%
9029%    o wand: the magick wand.
9030%
9031%    o delay: the image delay in ticks-per-second units.
9032%
9033*/
9034WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9035  const size_t delay)
9036{
9037  assert(wand != (MagickWand *) NULL);
9038  assert(wand->signature == WandSignature);
9039  if (wand->debug != MagickFalse)
9040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9041  if (wand->images == (Image *) NULL)
9042    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9043  wand->images->delay=delay;
9044  return(MagickTrue);
9045}
9046
9047/*
9048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9049%                                                                             %
9050%                                                                             %
9051%                                                                             %
9052%   M a g i c k S e t I m a g e D e p t h                                     %
9053%                                                                             %
9054%                                                                             %
9055%                                                                             %
9056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9057%
9058%  MagickSetImageDepth() sets the image depth.
9059%
9060%  The format of the MagickSetImageDepth method is:
9061%
9062%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9063%        const size_t depth)
9064%
9065%  A description of each parameter follows:
9066%
9067%    o wand: the magick wand.
9068%
9069%    o depth: the image depth in bits: 8, 16, or 32.
9070%
9071*/
9072WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9073  const size_t depth)
9074{
9075  assert(wand != (MagickWand *) NULL);
9076  assert(wand->signature == WandSignature);
9077  if (wand->debug != MagickFalse)
9078    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9079  if (wand->images == (Image *) NULL)
9080    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9081  return(SetImageDepth(wand->images,depth));
9082}
9083
9084/*
9085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9086%                                                                             %
9087%                                                                             %
9088%                                                                             %
9089%   M a g i c k S e t I m a g e D i s p o s e                                 %
9090%                                                                             %
9091%                                                                             %
9092%                                                                             %
9093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9094%
9095%  MagickSetImageDispose() sets the image disposal method.
9096%
9097%  The format of the MagickSetImageDispose method is:
9098%
9099%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9100%        const DisposeType dispose)
9101%
9102%  A description of each parameter follows:
9103%
9104%    o wand: the magick wand.
9105%
9106%    o dispose: the image disposeal type.
9107%
9108*/
9109WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9110  const DisposeType dispose)
9111{
9112  assert(wand != (MagickWand *) NULL);
9113  assert(wand->signature == WandSignature);
9114  if (wand->debug != MagickFalse)
9115    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9116  if (wand->images == (Image *) NULL)
9117    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9118  wand->images->dispose=dispose;
9119  return(MagickTrue);
9120}
9121
9122/*
9123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9124%                                                                             %
9125%                                                                             %
9126%                                                                             %
9127%   M a g i c k S e t I m a g e E x t e n t                                   %
9128%                                                                             %
9129%                                                                             %
9130%                                                                             %
9131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9132%
9133%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9134%
9135%  The format of the MagickSetImageExtent method is:
9136%
9137%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9138%        const size_t columns,const unsigned rows)
9139%
9140%  A description of each parameter follows:
9141%
9142%    o wand: the magick wand.
9143%
9144%    o columns:  The image width in pixels.
9145%
9146%    o rows:  The image height in pixels.
9147%
9148*/
9149WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9150  const size_t columns,const size_t rows)
9151{
9152  assert(wand != (MagickWand *) NULL);
9153  assert(wand->signature == WandSignature);
9154  if (wand->debug != MagickFalse)
9155    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9156  if (wand->images == (Image *) NULL)
9157    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9158  return(SetImageExtent(wand->images,columns,rows));
9159}
9160
9161/*
9162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9163%                                                                             %
9164%                                                                             %
9165%                                                                             %
9166%   M a g i c k S e t I m a g e F i l e n a m e                               %
9167%                                                                             %
9168%                                                                             %
9169%                                                                             %
9170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9171%
9172%  MagickSetImageFilename() sets the filename of a particular image in a
9173%  sequence.
9174%
9175%  The format of the MagickSetImageFilename method is:
9176%
9177%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9178%        const char *filename)
9179%
9180%  A description of each parameter follows:
9181%
9182%    o wand: the magick wand.
9183%
9184%    o filename: the image filename.
9185%
9186*/
9187WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9188  const char *filename)
9189{
9190  assert(wand != (MagickWand *) NULL);
9191  assert(wand->signature == WandSignature);
9192  if (wand->debug != MagickFalse)
9193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9194  if (wand->images == (Image *) NULL)
9195    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9196  if (filename != (const char *) NULL)
9197    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9198  return(MagickTrue);
9199}
9200
9201/*
9202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9203%                                                                             %
9204%                                                                             %
9205%                                                                             %
9206%   M a g i c k S e t I m a g e F o r m a t                                   %
9207%                                                                             %
9208%                                                                             %
9209%                                                                             %
9210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9211%
9212%  MagickSetImageFormat() sets the format of a particular image in a
9213%  sequence.
9214%
9215%  The format of the MagickSetImageFormat method is:
9216%
9217%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9218%        const char *format)
9219%
9220%  A description of each parameter follows:
9221%
9222%    o wand: the magick wand.
9223%
9224%    o format: the image format.
9225%
9226*/
9227WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9228  const char *format)
9229{
9230  const MagickInfo
9231    *magick_info;
9232
9233  assert(wand != (MagickWand *) NULL);
9234  assert(wand->signature == WandSignature);
9235  if (wand->debug != MagickFalse)
9236    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9237  if (wand->images == (Image *) NULL)
9238    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9239  if ((format == (char *) NULL) || (*format == '\0'))
9240    {
9241      *wand->images->magick='\0';
9242      return(MagickTrue);
9243    }
9244  magick_info=GetMagickInfo(format,wand->exception);
9245  if (magick_info == (const MagickInfo *) NULL)
9246    return(MagickFalse);
9247  ClearMagickException(wand->exception);
9248  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9249  return(MagickTrue);
9250}
9251
9252/*
9253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9254%                                                                             %
9255%                                                                             %
9256%                                                                             %
9257%   M a g i c k S e t I m a g e F u z z                                       %
9258%                                                                             %
9259%                                                                             %
9260%                                                                             %
9261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9262%
9263%  MagickSetImageFuzz() sets the image fuzz.
9264%
9265%  The format of the MagickSetImageFuzz method is:
9266%
9267%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9268%        const double fuzz)
9269%
9270%  A description of each parameter follows:
9271%
9272%    o wand: the magick wand.
9273%
9274%    o fuzz: the image fuzz.
9275%
9276*/
9277WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9278  const double fuzz)
9279{
9280  assert(wand != (MagickWand *) NULL);
9281  assert(wand->signature == WandSignature);
9282  if (wand->debug != MagickFalse)
9283    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9284  if (wand->images == (Image *) NULL)
9285    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9286  wand->images->fuzz=fuzz;
9287  return(MagickTrue);
9288}
9289
9290/*
9291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9292%                                                                             %
9293%                                                                             %
9294%                                                                             %
9295%   M a g i c k S e t I m a g e G a m m a                                     %
9296%                                                                             %
9297%                                                                             %
9298%                                                                             %
9299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9300%
9301%  MagickSetImageGamma() sets the image gamma.
9302%
9303%  The format of the MagickSetImageGamma method is:
9304%
9305%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9306%        const double gamma)
9307%
9308%  A description of each parameter follows:
9309%
9310%    o wand: the magick wand.
9311%
9312%    o gamma: the image gamma.
9313%
9314*/
9315WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9316  const double gamma)
9317{
9318  assert(wand != (MagickWand *) NULL);
9319  assert(wand->signature == WandSignature);
9320  if (wand->debug != MagickFalse)
9321    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9322  if (wand->images == (Image *) NULL)
9323    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9324  wand->images->gamma=gamma;
9325  return(MagickTrue);
9326}
9327
9328/*
9329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9330%                                                                             %
9331%                                                                             %
9332%                                                                             %
9333%   M a g i c k S e t I m a g e G r a v i t y                                 %
9334%                                                                             %
9335%                                                                             %
9336%                                                                             %
9337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9338%
9339%  MagickSetImageGravity() sets the image gravity type.
9340%
9341%  The format of the MagickSetImageGravity method is:
9342%
9343%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9344%        const GravityType gravity)
9345%
9346%  A description of each parameter follows:
9347%
9348%    o wand: the magick wand.
9349%
9350%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9351%      PlaneInterlace, PartitionInterlace.
9352%
9353*/
9354WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9355  const GravityType gravity)
9356{
9357  assert(wand != (MagickWand *) NULL);
9358  assert(wand->signature == WandSignature);
9359  if (wand->debug != MagickFalse)
9360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9361  if (wand->images == (Image *) NULL)
9362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9363  wand->images->gravity=gravity;
9364  return(MagickTrue);
9365}
9366
9367/*
9368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9369%                                                                             %
9370%                                                                             %
9371%                                                                             %
9372%   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                       %
9373%                                                                             %
9374%                                                                             %
9375%                                                                             %
9376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9377%
9378%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9379%  point.
9380%
9381%  The format of the MagickSetImageGreenPrimary method is:
9382%
9383%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9384%        const double x,const double y)
9385%
9386%  A description of each parameter follows:
9387%
9388%    o wand: the magick wand.
9389%
9390%    o x: the green primary x-point.
9391%
9392%    o y: the green primary y-point.
9393%
9394%
9395*/
9396WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9397  const double x,const double y)
9398{
9399  assert(wand != (MagickWand *) NULL);
9400  assert(wand->signature == WandSignature);
9401  if (wand->debug != MagickFalse)
9402    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9403  if (wand->images == (Image *) NULL)
9404    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9405  wand->images->chromaticity.green_primary.x=x;
9406  wand->images->chromaticity.green_primary.y=y;
9407  return(MagickTrue);
9408}
9409
9410/*
9411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9412%                                                                             %
9413%                                                                             %
9414%                                                                             %
9415%   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                 %
9416%                                                                             %
9417%                                                                             %
9418%                                                                             %
9419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420%
9421%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9422%
9423%  The format of the MagickSetImageInterlaceScheme method is:
9424%
9425%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9426%        const InterlaceType interlace)
9427%
9428%  A description of each parameter follows:
9429%
9430%    o wand: the magick wand.
9431%
9432%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9433%      PlaneInterlace, PartitionInterlace.
9434%
9435*/
9436WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9437  const InterlaceType interlace)
9438{
9439  assert(wand != (MagickWand *) NULL);
9440  assert(wand->signature == WandSignature);
9441  if (wand->debug != MagickFalse)
9442    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9443  if (wand->images == (Image *) NULL)
9444    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9445  wand->images->interlace=interlace;
9446  return(MagickTrue);
9447}
9448
9449/*
9450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9451%                                                                             %
9452%                                                                             %
9453%                                                                             %
9454%   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             %
9455%                                                                             %
9456%                                                                             %
9457%                                                                             %
9458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459%
9460%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9461%
9462%  The format of the MagickSetImageInterpolateMethod method is:
9463%
9464%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9465%        const InterpolatePixelMethod method)
9466%
9467%  A description of each parameter follows:
9468%
9469%    o wand: the magick wand.
9470%
9471%    o method: the image interpole pixel methods: choose from Undefined,
9472%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9473%
9474*/
9475WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9476  const InterpolatePixelMethod method)
9477{
9478  assert(wand != (MagickWand *) NULL);
9479  assert(wand->signature == WandSignature);
9480  if (wand->debug != MagickFalse)
9481    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9482  if (wand->images == (Image *) NULL)
9483    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9484  wand->images->interpolate=method;
9485  return(MagickTrue);
9486}
9487
9488/*
9489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9490%                                                                             %
9491%                                                                             %
9492%                                                                             %
9493%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9494%                                                                             %
9495%                                                                             %
9496%                                                                             %
9497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9498%
9499%  MagickSetImageIterations() sets the image iterations.
9500%
9501%  The format of the MagickSetImageIterations method is:
9502%
9503%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9504%        const size_t iterations)
9505%
9506%  A description of each parameter follows:
9507%
9508%    o wand: the magick wand.
9509%
9510%    o delay: the image delay in 1/100th of a second.
9511%
9512*/
9513WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9514  const size_t iterations)
9515{
9516  assert(wand != (MagickWand *) NULL);
9517  assert(wand->signature == WandSignature);
9518  if (wand->debug != MagickFalse)
9519    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9520  if (wand->images == (Image *) NULL)
9521    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9522  wand->images->iterations=iterations;
9523  return(MagickTrue);
9524}
9525
9526/*
9527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9528%                                                                             %
9529%                                                                             %
9530%                                                                             %
9531%   M a g i c k S e t I m a g e M a t t e                                     %
9532%                                                                             %
9533%                                                                             %
9534%                                                                             %
9535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9536%
9537%  MagickSetImageMatte() sets the image matte channel.
9538%
9539%  The format of the MagickSetImageMatteColor method is:
9540%
9541%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9542%        const MagickBooleanType *matte)
9543%
9544%  A description of each parameter follows:
9545%
9546%    o wand: the magick wand.
9547%
9548%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9549%      MagickFalse.
9550%
9551*/
9552WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9553  const MagickBooleanType matte)
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->matte == MagickFalse) && (matte != MagickFalse))
9562    (void) SetImageOpacity(wand->images,OpaqueAlpha);
9563  wand->images->matte=matte;
9564  return(MagickTrue);
9565}
9566
9567/*
9568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9569%                                                                             %
9570%                                                                             %
9571%                                                                             %
9572%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9573%                                                                             %
9574%                                                                             %
9575%                                                                             %
9576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9577%
9578%  MagickSetImageMatteColor() sets the image matte color.
9579%
9580%  The format of the MagickSetImageMatteColor method is:
9581%
9582%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9583%        const PixelWand *matte)
9584%
9585%  A description of each parameter follows:
9586%
9587%    o wand: the magick wand.
9588%
9589%    o matte: the matte pixel wand.
9590%
9591*/
9592WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9593  const PixelWand *matte)
9594{
9595  assert(wand != (MagickWand *) NULL);
9596  assert(wand->signature == WandSignature);
9597  if (wand->debug != MagickFalse)
9598    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9599  if (wand->images == (Image *) NULL)
9600    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9601  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9602  return(MagickTrue);
9603}
9604
9605/*
9606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9607%                                                                             %
9608%                                                                             %
9609%                                                                             %
9610%   M a g i c k S e t I m a g e O p a c i t y                                 %
9611%                                                                             %
9612%                                                                             %
9613%                                                                             %
9614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9615%
9616%  MagickSetImageOpacity() sets the image to the specified opacity level.
9617%
9618%  The format of the MagickSetImageOpacity method is:
9619%
9620%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9621%        const double alpha)
9622%
9623%  A description of each parameter follows:
9624%
9625%    o wand: the magick wand.
9626%
9627%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9628%      transparent.
9629%
9630*/
9631WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9632  const double alpha)
9633{
9634  MagickBooleanType
9635    status;
9636
9637  assert(wand != (MagickWand *) NULL);
9638  assert(wand->signature == WandSignature);
9639  if (wand->debug != MagickFalse)
9640    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9641  if (wand->images == (Image *) NULL)
9642    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9643  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9644  if (status == MagickFalse)
9645    InheritException(wand->exception,&wand->images->exception);
9646  return(status);
9647}
9648
9649/*
9650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9651%                                                                             %
9652%                                                                             %
9653%                                                                             %
9654%   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                         %
9655%                                                                             %
9656%                                                                             %
9657%                                                                             %
9658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659%
9660%  MagickSetImageOrientation() sets the image orientation.
9661%
9662%  The format of the MagickSetImageOrientation method is:
9663%
9664%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9665%        const OrientationType orientation)
9666%
9667%  A description of each parameter follows:
9668%
9669%    o wand: the magick wand.
9670%
9671%    o orientation: the image orientation type.
9672%
9673*/
9674WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9675  const OrientationType orientation)
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->orientation=orientation;
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 P a g e                                       %
9693%                                                                             %
9694%                                                                             %
9695%                                                                             %
9696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9697%
9698%  MagickSetImagePage() sets the page geometry of the image.
9699%
9700%  The format of the MagickSetImagePage method is:
9701%
9702%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9703%        const size_t width,const size_t height,const ssize_t x,
9704%        const ssize_t y)
9705%
9706%  A description of each parameter follows:
9707%
9708%    o wand: the magick wand.
9709%
9710%    o width: the page width.
9711%
9712%    o height: the page height.
9713%
9714%    o x: the page x-offset.
9715%
9716%    o y: the page y-offset.
9717%
9718*/
9719WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9720  const size_t width,const size_t height,const ssize_t x,
9721  const ssize_t y)
9722{
9723  assert(wand != (MagickWand *) NULL);
9724  assert(wand->signature == WandSignature);
9725  if (wand->debug != MagickFalse)
9726    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9727  if (wand->images == (Image *) NULL)
9728    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9729  wand->images->page.width=width;
9730  wand->images->page.height=height;
9731  wand->images->page.x=x;
9732  wand->images->page.y=y;
9733  return(MagickTrue);
9734}
9735
9736/*
9737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9738%                                                                             %
9739%                                                                             %
9740%                                                                             %
9741%   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                 %
9742%                                                                             %
9743%                                                                             %
9744%                                                                             %
9745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9746%
9747%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9748%  specified method and returns the previous progress monitor if any.  The
9749%  progress monitor method looks like this:
9750%
9751%    MagickBooleanType MagickProgressMonitor(const char *text,
9752%      const MagickOffsetType offset,const MagickSizeType span,
9753%      void *client_data)
9754%
9755%  If the progress monitor returns MagickFalse, the current operation is
9756%  interrupted.
9757%
9758%  The format of the MagickSetImageProgressMonitor method is:
9759%
9760%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9761%        const MagickProgressMonitor progress_monitor,void *client_data)
9762%
9763%  A description of each parameter follows:
9764%
9765%    o wand: the magick wand.
9766%
9767%    o progress_monitor: Specifies a pointer to a method to monitor progress
9768%      of an image operation.
9769%
9770%    o client_data: Specifies a pointer to any client data.
9771%
9772*/
9773WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9774  const MagickProgressMonitor progress_monitor,void *client_data)
9775{
9776  MagickProgressMonitor
9777    previous_monitor;
9778
9779  assert(wand != (MagickWand *) NULL);
9780  assert(wand->signature == WandSignature);
9781  if (wand->debug != MagickFalse)
9782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9783  if (wand->images == (Image *) NULL)
9784    {
9785      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9786        "ContainsNoImages","`%s'",wand->name);
9787      return((MagickProgressMonitor) NULL);
9788    }
9789  previous_monitor=SetImageProgressMonitor(wand->images,
9790    progress_monitor,client_data);
9791  return(previous_monitor);
9792}
9793
9794/*
9795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9796%                                                                             %
9797%                                                                             %
9798%                                                                             %
9799%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9800%                                                                             %
9801%                                                                             %
9802%                                                                             %
9803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9804%
9805%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9806%
9807%  The format of the MagickSetImageRedPrimary method is:
9808%
9809%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9810%        const double x,const double y)
9811%
9812%  A description of each parameter follows:
9813%
9814%    o wand: the magick wand.
9815%
9816%    o x: the red primary x-point.
9817%
9818%    o y: the red primary y-point.
9819%
9820*/
9821WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9822  const double x,const double y)
9823{
9824  assert(wand != (MagickWand *) NULL);
9825  assert(wand->signature == WandSignature);
9826  if (wand->debug != MagickFalse)
9827    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9828  if (wand->images == (Image *) NULL)
9829    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9830  wand->images->chromaticity.red_primary.x=x;
9831  wand->images->chromaticity.red_primary.y=y;
9832  return(MagickTrue);
9833}
9834
9835/*
9836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9837%                                                                             %
9838%                                                                             %
9839%                                                                             %
9840%   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                 %
9841%                                                                             %
9842%                                                                             %
9843%                                                                             %
9844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9845%
9846%  MagickSetImageRenderingIntent() sets the image rendering intent.
9847%
9848%  The format of the MagickSetImageRenderingIntent method is:
9849%
9850%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9851%        const RenderingIntent rendering_intent)
9852%
9853%  A description of each parameter follows:
9854%
9855%    o wand: the magick wand.
9856%
9857%    o rendering_intent: the image rendering intent: UndefinedIntent,
9858%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9859%
9860*/
9861WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9862  const RenderingIntent rendering_intent)
9863{
9864  assert(wand != (MagickWand *) NULL);
9865  assert(wand->signature == WandSignature);
9866  if (wand->debug != MagickFalse)
9867    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9868  if (wand->images == (Image *) NULL)
9869    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9870  wand->images->rendering_intent=rendering_intent;
9871  return(MagickTrue);
9872}
9873
9874/*
9875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9876%                                                                             %
9877%                                                                             %
9878%                                                                             %
9879%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9880%                                                                             %
9881%                                                                             %
9882%                                                                             %
9883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9884%
9885%  MagickSetImageResolution() sets the image resolution.
9886%
9887%  The format of the MagickSetImageResolution method is:
9888%
9889%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9890%        const double x_resolution,const doubtl y_resolution)
9891%
9892%  A description of each parameter follows:
9893%
9894%    o wand: the magick wand.
9895%
9896%    o x_resolution: the image x resolution.
9897%
9898%    o y_resolution: the image y resolution.
9899%
9900*/
9901WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9902  const double x_resolution,const double y_resolution)
9903{
9904  assert(wand != (MagickWand *) NULL);
9905  assert(wand->signature == WandSignature);
9906  if (wand->debug != MagickFalse)
9907    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9908  if (wand->images == (Image *) NULL)
9909    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9910  wand->images->x_resolution=x_resolution;
9911  wand->images->y_resolution=y_resolution;
9912  return(MagickTrue);
9913}
9914
9915/*
9916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9917%                                                                             %
9918%                                                                             %
9919%                                                                             %
9920%   M a g i c k S e t I m a g e S c e n e                                     %
9921%                                                                             %
9922%                                                                             %
9923%                                                                             %
9924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9925%
9926%  MagickSetImageScene() sets the image scene.
9927%
9928%  The format of the MagickSetImageScene method is:
9929%
9930%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9931%        const size_t scene)
9932%
9933%  A description of each parameter follows:
9934%
9935%    o wand: the magick wand.
9936%
9937%    o delay: the image scene number.
9938%
9939*/
9940WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9941  const size_t scene)
9942{
9943  assert(wand != (MagickWand *) NULL);
9944  assert(wand->signature == WandSignature);
9945  if (wand->debug != MagickFalse)
9946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9947  if (wand->images == (Image *) NULL)
9948    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9949  wand->images->scene=scene;
9950  return(MagickTrue);
9951}
9952
9953/*
9954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955%                                                                             %
9956%                                                                             %
9957%                                                                             %
9958%   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                   %
9959%                                                                             %
9960%                                                                             %
9961%                                                                             %
9962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9963%
9964%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9965%
9966%  The format of the MagickSetImageTicksPerSecond method is:
9967%
9968%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9969%        const ssize_t ticks_per-second)
9970%
9971%  A description of each parameter follows:
9972%
9973%    o wand: the magick wand.
9974%
9975%    o ticks_per_second: the units to use for the image delay.
9976%
9977*/
9978WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9979  const ssize_t ticks_per_second)
9980{
9981  assert(wand != (MagickWand *) NULL);
9982  assert(wand->signature == WandSignature);
9983  if (wand->debug != MagickFalse)
9984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9985  if (wand->images == (Image *) NULL)
9986    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9987  wand->images->ticks_per_second=ticks_per_second;
9988  return(MagickTrue);
9989}
9990
9991/*
9992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9993%                                                                             %
9994%                                                                             %
9995%                                                                             %
9996%   M a g i c k S e t I m a g e T y p e                                       %
9997%                                                                             %
9998%                                                                             %
9999%                                                                             %
10000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10001%
10002%  MagickSetImageType() sets the image type.
10003%
10004%  The format of the MagickSetImageType method is:
10005%
10006%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10007%        const ImageType image_type)
10008%
10009%  A description of each parameter follows:
10010%
10011%    o wand: the magick wand.
10012%
10013%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10014%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10015%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10016%      or OptimizeType.
10017%
10018*/
10019WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10020  const ImageType image_type)
10021{
10022  assert(wand != (MagickWand *) NULL);
10023  assert(wand->signature == WandSignature);
10024  if (wand->debug != MagickFalse)
10025    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10026  if (wand->images == (Image *) NULL)
10027    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10028  return(SetImageType(wand->images,image_type));
10029}
10030
10031/*
10032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10033%                                                                             %
10034%                                                                             %
10035%                                                                             %
10036%   M a g i c k S e t I m a g e U n i t s                                     %
10037%                                                                             %
10038%                                                                             %
10039%                                                                             %
10040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10041%
10042%  MagickSetImageUnits() sets the image units of resolution.
10043%
10044%  The format of the MagickSetImageUnits method is:
10045%
10046%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10047%        const ResolutionType units)
10048%
10049%  A description of each parameter follows:
10050%
10051%    o wand: the magick wand.
10052%
10053%    o units: the image units of resolution : UndefinedResolution,
10054%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10055%
10056*/
10057WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10058  const ResolutionType units)
10059{
10060  assert(wand != (MagickWand *) NULL);
10061  assert(wand->signature == WandSignature);
10062  if (wand->debug != MagickFalse)
10063    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10064  if (wand->images == (Image *) NULL)
10065    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10066  wand->images->units=units;
10067  return(MagickTrue);
10068}
10069
10070/*
10071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10072%                                                                             %
10073%                                                                             %
10074%                                                                             %
10075%   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           %
10076%                                                                             %
10077%                                                                             %
10078%                                                                             %
10079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10080%
10081%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10082%
10083%  The format of the MagickSetImageVirtualPixelMethod method is:
10084%
10085%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10086%        const VirtualPixelMethod method)
10087%
10088%  A description of each parameter follows:
10089%
10090%    o wand: the magick wand.
10091%
10092%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10093%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10094%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10095%
10096*/
10097WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10098  const VirtualPixelMethod method)
10099{
10100  assert(wand != (MagickWand *) NULL);
10101  assert(wand->signature == WandSignature);
10102  if (wand->debug != MagickFalse)
10103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10104  if (wand->images == (Image *) NULL)
10105    return(UndefinedVirtualPixelMethod);
10106  return(SetImageVirtualPixelMethod(wand->images,method));
10107}
10108
10109/*
10110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10111%                                                                             %
10112%                                                                             %
10113%                                                                             %
10114%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10115%                                                                             %
10116%                                                                             %
10117%                                                                             %
10118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10119%
10120%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10121%
10122%  The format of the MagickSetImageWhitePoint method is:
10123%
10124%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10125%        const double x,const double y)
10126%
10127%  A description of each parameter follows:
10128%
10129%    o wand: the magick wand.
10130%
10131%    o x: the white x-point.
10132%
10133%    o y: the white y-point.
10134%
10135*/
10136WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10137  const double x,const double y)
10138{
10139  assert(wand != (MagickWand *) NULL);
10140  assert(wand->signature == WandSignature);
10141  if (wand->debug != MagickFalse)
10142    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10143  if (wand->images == (Image *) NULL)
10144    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10145  wand->images->chromaticity.white_point.x=x;
10146  wand->images->chromaticity.white_point.y=y;
10147  return(MagickTrue);
10148}
10149
10150/*
10151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10152%                                                                             %
10153%                                                                             %
10154%                                                                             %
10155%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10156%                                                                             %
10157%                                                                             %
10158%                                                                             %
10159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10160%
10161%  MagickShadeImage() shines a distant light on an image to create a
10162%  three-dimensional effect. You control the positioning of the light with
10163%  azimuth and elevation; azimuth is measured in degrees off the x axis
10164%  and elevation is measured in pixels above the Z axis.
10165%
10166%  The format of the MagickShadeImage method is:
10167%
10168%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10169%        const MagickBooleanType gray,const double azimuth,
10170%        const double elevation)
10171%
10172%  A description of each parameter follows:
10173%
10174%    o wand: the magick wand.
10175%
10176%    o gray: A value other than zero shades the intensity of each pixel.
10177%
10178%    o azimuth, elevation:  Define the light source direction.
10179%
10180*/
10181WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10182  const MagickBooleanType gray,const double asimuth,const double elevation)
10183{
10184  Image
10185    *shade_image;
10186
10187  assert(wand != (MagickWand *) NULL);
10188  assert(wand->signature == WandSignature);
10189  if (wand->debug != MagickFalse)
10190    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10191  if (wand->images == (Image *) NULL)
10192    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10193  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10194  if (shade_image == (Image *) NULL)
10195    return(MagickFalse);
10196  ReplaceImageInList(&wand->images,shade_image);
10197  return(MagickTrue);
10198}
10199
10200/*
10201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10202%                                                                             %
10203%                                                                             %
10204%                                                                             %
10205%   M a g i c k S h a d o w I m a g e                                         %
10206%                                                                             %
10207%                                                                             %
10208%                                                                             %
10209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10210%
10211%  MagickShadowImage() simulates an image shadow.
10212%
10213%  The format of the MagickShadowImage method is:
10214%
10215%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10216%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10217%
10218%  A description of each parameter follows:
10219%
10220%    o wand: the magick wand.
10221%
10222%    o opacity: percentage transparency.
10223%
10224%    o sigma: the standard deviation of the Gaussian, in pixels.
10225%
10226%    o x: the shadow x-offset.
10227%
10228%    o y: the shadow y-offset.
10229%
10230*/
10231WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10232  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10233{
10234  Image
10235    *shadow_image;
10236
10237  assert(wand != (MagickWand *) NULL);
10238  assert(wand->signature == WandSignature);
10239  if (wand->debug != MagickFalse)
10240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10241  if (wand->images == (Image *) NULL)
10242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10243  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10244  if (shadow_image == (Image *) NULL)
10245    return(MagickFalse);
10246  ReplaceImageInList(&wand->images,shadow_image);
10247  return(MagickTrue);
10248}
10249
10250/*
10251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10252%                                                                             %
10253%                                                                             %
10254%                                                                             %
10255%   M a g i c k S h a r p e n I m a g e                                       %
10256%                                                                             %
10257%                                                                             %
10258%                                                                             %
10259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10260%
10261%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10262%  Gaussian operator of the given radius and standard deviation (sigma).
10263%  For reasonable results, the radius should be larger than sigma.  Use a
10264%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10265%
10266%  The format of the MagickSharpenImage method is:
10267%
10268%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10269%        const double radius,const double sigma)
10270%
10271%  A description of each parameter follows:
10272%
10273%    o wand: the magick wand.
10274%
10275%    o radius: the radius of the Gaussian, in pixels, not counting the center
10276%      pixel.
10277%
10278%    o sigma: the standard deviation of the Gaussian, in pixels.
10279%
10280*/
10281WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10282  const double radius,const double sigma)
10283{
10284  Image
10285    *sharp_image;
10286
10287  assert(wand != (MagickWand *) NULL);
10288  assert(wand->signature == WandSignature);
10289  if (wand->debug != MagickFalse)
10290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10291  if (wand->images == (Image *) NULL)
10292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10293  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10294  if (sharp_image == (Image *) NULL)
10295    return(MagickFalse);
10296  ReplaceImageInList(&wand->images,sharp_image);
10297  return(MagickTrue);
10298}
10299
10300/*
10301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10302%                                                                             %
10303%                                                                             %
10304%                                                                             %
10305%   M a g i c k S h a v e I m a g e                                           %
10306%                                                                             %
10307%                                                                             %
10308%                                                                             %
10309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10310%
10311%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10312%  memory necessary for the new Image structure and returns a pointer to the
10313%  new image.
10314%
10315%  The format of the MagickShaveImage method is:
10316%
10317%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10318%        const size_t columns,const size_t rows)
10319%
10320%  A description of each parameter follows:
10321%
10322%    o wand: the magick wand.
10323%
10324%    o columns: the number of columns in the scaled image.
10325%
10326%    o rows: the number of rows in the scaled image.
10327%
10328%
10329*/
10330WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10331  const size_t columns,const size_t rows)
10332{
10333  Image
10334    *shave_image;
10335
10336  RectangleInfo
10337    shave_info;
10338
10339  assert(wand != (MagickWand *) NULL);
10340  assert(wand->signature == WandSignature);
10341  if (wand->debug != MagickFalse)
10342    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10343  if (wand->images == (Image *) NULL)
10344    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10345  shave_info.width=columns;
10346  shave_info.height=rows;
10347  shave_info.x=0;
10348  shave_info.y=0;
10349  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10350  if (shave_image == (Image *) NULL)
10351    return(MagickFalse);
10352  ReplaceImageInList(&wand->images,shave_image);
10353  return(MagickTrue);
10354}
10355
10356/*
10357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10358%                                                                             %
10359%                                                                             %
10360%                                                                             %
10361%   M a g i c k S h e a r I m a g e                                           %
10362%                                                                             %
10363%                                                                             %
10364%                                                                             %
10365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10366%
10367%  MagickShearImage() slides one edge of an image along the X or Y axis,
10368%  creating a parallelogram.  An X direction shear slides an edge along the X
10369%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10370%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10371%  is measured relative to the Y axis, and similarly, for Y direction shears
10372%  y_shear is measured relative to the X axis.  Empty triangles left over from
10373%  shearing the image are filled with the background color.
10374%
10375%  The format of the MagickShearImage method is:
10376%
10377%      MagickBooleanType MagickShearImage(MagickWand *wand,
10378%        const PixelWand *background,const double x_shear,onst double y_shear)
10379%
10380%  A description of each parameter follows:
10381%
10382%    o wand: the magick wand.
10383%
10384%    o background: the background pixel wand.
10385%
10386%    o x_shear: the number of degrees to shear the image.
10387%
10388%    o y_shear: the number of degrees to shear the image.
10389%
10390*/
10391WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10392  const PixelWand *background,const double x_shear,const double y_shear)
10393{
10394  Image
10395    *shear_image;
10396
10397  assert(wand != (MagickWand *) NULL);
10398  assert(wand->signature == WandSignature);
10399  if (wand->debug != MagickFalse)
10400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10401  if (wand->images == (Image *) NULL)
10402    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10403  PixelGetQuantumPacket(background,&wand->images->background_color);
10404  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10405  if (shear_image == (Image *) NULL)
10406    return(MagickFalse);
10407  ReplaceImageInList(&wand->images,shear_image);
10408  return(MagickTrue);
10409}
10410
10411/*
10412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413%                                                                             %
10414%                                                                             %
10415%                                                                             %
10416%   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                   %
10417%                                                                             %
10418%                                                                             %
10419%                                                                             %
10420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10421%
10422%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10423%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10424%  image using a sigmoidal transfer function without saturating highlights or
10425%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10426%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10427%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10428%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10429%  is reduced.
10430%
10431%  The format of the MagickSigmoidalContrastImage method is:
10432%
10433%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10434%        const MagickBooleanType sharpen,const double alpha,const double beta)
10435%
10436%  A description of each parameter follows:
10437%
10438%    o wand: the magick wand.
10439%
10440%    o sharpen: Increase or decrease image contrast.
10441%
10442%    o alpha: strength of the contrast, the larger the number the more
10443%      'threshold-like' it becomes.
10444%
10445%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10446%
10447*/
10448WandExport MagickBooleanType MagickSigmoidalContrastImage(
10449  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10450  const double beta)
10451{
10452  MagickBooleanType
10453    status;
10454
10455  assert(wand != (MagickWand *) NULL);
10456  assert(wand->signature == WandSignature);
10457  if (wand->debug != MagickFalse)
10458    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10459  if (wand->images == (Image *) NULL)
10460    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10461  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
10462  if (status == MagickFalse)
10463    InheritException(wand->exception,&wand->images->exception);
10464  return(status);
10465}
10466
10467/*
10468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10469%                                                                             %
10470%                                                                             %
10471%                                                                             %
10472%   M a g i c k S i m i l a r i t y I m a g e                                 %
10473%                                                                             %
10474%                                                                             %
10475%                                                                             %
10476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10477%
10478%  MagickSimilarityImage() compares the reference image of the image and
10479%  returns the best match offset.  In addition, it returns a similarity image
10480%  such that an exact match location is completely white and if none of the
10481%  pixels match, black, otherwise some gray level in-between.
10482%
10483%  The format of the MagickSimilarityImage method is:
10484%
10485%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10486%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10487%
10488%  A description of each parameter follows:
10489%
10490%    o wand: the magick wand.
10491%
10492%    o reference: the reference wand.
10493%
10494%    o offset: the best match offset of the reference image within the image.
10495%
10496%    o similarity: the computed similarity between the images.
10497%
10498*/
10499WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10500  const MagickWand *reference,RectangleInfo *offset,double *similarity)
10501{
10502  Image
10503    *similarity_image;
10504
10505  assert(wand != (MagickWand *) NULL);
10506  assert(wand->signature == WandSignature);
10507  if (wand->debug != MagickFalse)
10508    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10509  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10510    {
10511      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10512        "ContainsNoImages","`%s'",wand->name);
10513      return((MagickWand *) NULL);
10514    }
10515  similarity_image=SimilarityImage(wand->images,reference->images,offset,
10516    similarity,&wand->images->exception);
10517  if (similarity_image == (Image *) NULL)
10518    return((MagickWand *) NULL);
10519  return(CloneMagickWandFromImages(wand,similarity_image));
10520}
10521
10522/*
10523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10524%                                                                             %
10525%                                                                             %
10526%                                                                             %
10527%   M a g i c k S k e t c h I m a g e                                         %
10528%                                                                             %
10529%                                                                             %
10530%                                                                             %
10531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10532%
10533%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10534%  a Gaussian operator of the given radius and standard deviation (sigma).
10535%  For reasonable results, radius should be larger than sigma.  Use a
10536%  radius of 0 and SketchImage() selects a suitable radius for you.
10537%  Angle gives the angle of the blurring motion.
10538%
10539%  The format of the MagickSketchImage method is:
10540%
10541%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10542%        const double radius,const double sigma,const double angle)
10543%
10544%  A description of each parameter follows:
10545%
10546%    o wand: the magick wand.
10547%
10548%    o radius: the radius of the Gaussian, in pixels, not counting
10549%      the center pixel.
10550%
10551%    o sigma: the standard deviation of the Gaussian, in pixels.
10552%
10553%    o angle: Apply the effect along this angle.
10554%
10555*/
10556WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10557  const double radius,const double sigma,const double angle)
10558{
10559  Image
10560    *sketch_image;
10561
10562  assert(wand != (MagickWand *) NULL);
10563  assert(wand->signature == WandSignature);
10564  if (wand->debug != MagickFalse)
10565    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10566  if (wand->images == (Image *) NULL)
10567    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10568  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10569  if (sketch_image == (Image *) NULL)
10570    return(MagickFalse);
10571  ReplaceImageInList(&wand->images,sketch_image);
10572  return(MagickTrue);
10573}
10574
10575/*
10576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10577%                                                                             %
10578%                                                                             %
10579%                                                                             %
10580%   M a g i c k S m u s h I m a g e s                                         %
10581%                                                                             %
10582%                                                                             %
10583%                                                                             %
10584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10585%
10586%  MagickSmushImages() takes all images from the current image pointer to the
10587%  end of the image list and smushs them to each other top-to-bottom if the
10588%  stack parameter is true, otherwise left-to-right.
10589%
10590%  The format of the MagickSmushImages method is:
10591%
10592%      MagickWand *MagickSmushImages(MagickWand *wand,
10593%        const MagickBooleanType stack,const ssize_t offset)
10594%
10595%  A description of each parameter follows:
10596%
10597%    o wand: the magick wand.
10598%
10599%    o stack: By default, images are stacked left-to-right. Set stack to
10600%      MagickTrue to stack them top-to-bottom.
10601%
10602%    o offset: minimum distance in pixels between images.
10603%
10604*/
10605WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10606  const MagickBooleanType stack,const ssize_t offset)
10607{
10608  Image
10609    *smush_image;
10610
10611  assert(wand != (MagickWand *) NULL);
10612  assert(wand->signature == WandSignature);
10613  if (wand->debug != MagickFalse)
10614    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10615  if (wand->images == (Image *) NULL)
10616    return((MagickWand *) NULL);
10617  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10618  if (smush_image == (Image *) NULL)
10619    return((MagickWand *) NULL);
10620  return(CloneMagickWandFromImages(wand,smush_image));
10621}
10622
10623/*
10624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10625%                                                                             %
10626%                                                                             %
10627%                                                                             %
10628%     M a g i c k S o l a r i z e I m a g e                                   %
10629%                                                                             %
10630%                                                                             %
10631%                                                                             %
10632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10633%
10634%  MagickSolarizeImage() applies a special effect to the image, similar to the
10635%  effect achieved in a photo darkroom by selectively exposing areas of photo
10636%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10637%  measure of the extent of the solarization.
10638%
10639%  The format of the MagickSolarizeImage method is:
10640%
10641%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10642%        const double threshold)
10643%
10644%  A description of each parameter follows:
10645%
10646%    o wand: the magick wand.
10647%
10648%    o threshold:  Define the extent of the solarization.
10649%
10650*/
10651WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10652  const double threshold)
10653{
10654  MagickBooleanType
10655    status;
10656
10657  assert(wand != (MagickWand *) NULL);
10658  assert(wand->signature == WandSignature);
10659  if (wand->debug != MagickFalse)
10660    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10661  if (wand->images == (Image *) NULL)
10662    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10663  status=SolarizeImage(wand->images,threshold);
10664  if (status == MagickFalse)
10665    InheritException(wand->exception,&wand->images->exception);
10666  return(status);
10667}
10668
10669/*
10670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10671%                                                                             %
10672%                                                                             %
10673%                                                                             %
10674%   M a g i c k S p a r s e C o l o r I m a g e                               %
10675%                                                                             %
10676%                                                                             %
10677%                                                                             %
10678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10679%
10680%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10681%  colors found at those coordinates, across the whole image, using various
10682%  methods.
10683%
10684%  The format of the MagickSparseColorImage method is:
10685%
10686%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10687%        const SparseColorMethod method,const size_t number_arguments,
10688%        const double *arguments)
10689%
10690%  A description of each parameter follows:
10691%
10692%    o image: the image to be sparseed.
10693%
10694%    o method: the method of image sparseion.
10695%
10696%        ArcSparseColorion will always ignore source image offset, and always
10697%        'bestfit' the destination image with the top left corner offset
10698%        relative to the polar mapping center.
10699%
10700%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10701%        style of image sparseion.
10702%
10703%        Affine, Perspective, and Bilinear, will do least squares fitting of
10704%        the distrotion when more than the minimum number of control point
10705%        pairs are provided.
10706%
10707%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10708%        less than 4 control point pairs are provided. While Affine sparseions
10709%        will let you use any number of control point pairs, that is Zero pairs
10710%        is a No-Op (viewport only) distrotion, one pair is a translation and
10711%        two pairs of control points will do a scale-rotate-translate, without
10712%        any shearing.
10713%
10714%    o number_arguments: the number of arguments given for this sparseion
10715%      method.
10716%
10717%    o arguments: the arguments for this sparseion method.
10718%
10719*/
10720WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10721  const SparseColorMethod method,const size_t number_arguments,
10722  const double *arguments)
10723{
10724  Image
10725    *sparse_image;
10726
10727  assert(wand != (MagickWand *) NULL);
10728  assert(wand->signature == WandSignature);
10729  if (wand->debug != MagickFalse)
10730    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10731  if (wand->images == (Image *) NULL)
10732    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10733  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10734    wand->exception);
10735  if (sparse_image == (Image *) NULL)
10736    return(MagickFalse);
10737  ReplaceImageInList(&wand->images,sparse_image);
10738  return(MagickTrue);
10739}
10740
10741/*
10742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10743%                                                                             %
10744%                                                                             %
10745%                                                                             %
10746%   M a g i c k S p l i c e I m a g e                                         %
10747%                                                                             %
10748%                                                                             %
10749%                                                                             %
10750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10751%
10752%  MagickSpliceImage() splices a solid color into the image.
10753%
10754%  The format of the MagickSpliceImage method is:
10755%
10756%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10757%        const size_t width,const size_t height,const ssize_t x,
10758%        const ssize_t y)
10759%
10760%  A description of each parameter follows:
10761%
10762%    o wand: the magick wand.
10763%
10764%    o width: the region width.
10765%
10766%    o height: the region height.
10767%
10768%    o x: the region x offset.
10769%
10770%    o y: the region y offset.
10771%
10772*/
10773WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10774  const size_t width,const size_t height,const ssize_t x,
10775  const ssize_t y)
10776{
10777  Image
10778    *splice_image;
10779
10780  RectangleInfo
10781    splice;
10782
10783  assert(wand != (MagickWand *) NULL);
10784  assert(wand->signature == WandSignature);
10785  if (wand->debug != MagickFalse)
10786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10787  if (wand->images == (Image *) NULL)
10788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10789  splice.width=width;
10790  splice.height=height;
10791  splice.x=x;
10792  splice.y=y;
10793  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10794  if (splice_image == (Image *) NULL)
10795    return(MagickFalse);
10796  ReplaceImageInList(&wand->images,splice_image);
10797  return(MagickTrue);
10798}
10799
10800/*
10801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10802%                                                                             %
10803%                                                                             %
10804%                                                                             %
10805%   M a g i c k S p r e a d I m a g e                                         %
10806%                                                                             %
10807%                                                                             %
10808%                                                                             %
10809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10810%
10811%  MagickSpreadImage() is a special effects method that randomly displaces each
10812%  pixel in a block defined by the radius parameter.
10813%
10814%  The format of the MagickSpreadImage method is:
10815%
10816%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10817%
10818%  A description of each parameter follows:
10819%
10820%    o wand: the magick wand.
10821%
10822%    o radius:  Choose a random pixel in a neighborhood of this extent.
10823%
10824*/
10825WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10826  const double radius)
10827{
10828  Image
10829    *spread_image;
10830
10831  assert(wand != (MagickWand *) NULL);
10832  assert(wand->signature == WandSignature);
10833  if (wand->debug != MagickFalse)
10834    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10835  if (wand->images == (Image *) NULL)
10836    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10837  spread_image=SpreadImage(wand->images,radius,wand->exception);
10838  if (spread_image == (Image *) NULL)
10839    return(MagickFalse);
10840  ReplaceImageInList(&wand->images,spread_image);
10841  return(MagickTrue);
10842}
10843
10844/*
10845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10846%                                                                             %
10847%                                                                             %
10848%                                                                             %
10849%   M a g i c k S t a t i s t i c I m a g e                                   %
10850%                                                                             %
10851%                                                                             %
10852%                                                                             %
10853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10854%
10855%  MagickStatisticImage() replace each pixel with corresponding statistic from
10856%  the neighborhood of the specified width and height.
10857%
10858%  The format of the MagickStatisticImage method is:
10859%
10860%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10861%        const StatisticType type,const double width,const size_t height)
10862%
10863%  A description of each parameter follows:
10864%
10865%    o wand: the magick wand.
10866%
10867%    o type: the statistic type (e.g. median, mode, etc.).
10868%
10869%    o width: the width of the pixel neighborhood.
10870%
10871%    o height: the height of the pixel neighborhood.
10872%
10873*/
10874WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10875  const StatisticType type,const size_t width,const size_t height)
10876{
10877  Image
10878    *statistic_image;
10879
10880  assert(wand != (MagickWand *) NULL);
10881  assert(wand->signature == WandSignature);
10882  if (wand->debug != MagickFalse)
10883    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10884  if (wand->images == (Image *) NULL)
10885    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10886  statistic_image=StatisticImage(wand->images,type,width,height,
10887    wand->exception);
10888  if (statistic_image == (Image *) NULL)
10889    return(MagickFalse);
10890  ReplaceImageInList(&wand->images,statistic_image);
10891  return(MagickTrue);
10892}
10893
10894/*
10895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10896%                                                                             %
10897%                                                                             %
10898%                                                                             %
10899%   M a g i c k S t e g a n o I m a g e                                       %
10900%                                                                             %
10901%                                                                             %
10902%                                                                             %
10903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10904%
10905%  MagickSteganoImage() hides a digital watermark within the image.
10906%  Recover the hidden watermark later to prove that the authenticity of
10907%  an image.  Offset defines the start position within the image to hide
10908%  the watermark.
10909%
10910%  The format of the MagickSteganoImage method is:
10911%
10912%      MagickWand *MagickSteganoImage(MagickWand *wand,
10913%        const MagickWand *watermark_wand,const ssize_t offset)
10914%
10915%  A description of each parameter follows:
10916%
10917%    o wand: the magick wand.
10918%
10919%    o watermark_wand: the watermark wand.
10920%
10921%    o offset: Start hiding at this offset into the image.
10922%
10923*/
10924WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10925  const MagickWand *watermark_wand,const ssize_t offset)
10926{
10927  Image
10928    *stegano_image;
10929
10930  assert(wand != (MagickWand *) NULL);
10931  assert(wand->signature == WandSignature);
10932  if (wand->debug != MagickFalse)
10933    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10934  if ((wand->images == (Image *) NULL) ||
10935      (watermark_wand->images == (Image *) NULL))
10936    {
10937      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10938        "ContainsNoImages","`%s'",wand->name);
10939      return((MagickWand *) NULL);
10940    }
10941  wand->images->offset=offset;
10942  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10943    wand->exception);
10944  if (stegano_image == (Image *) NULL)
10945    return((MagickWand *) NULL);
10946  return(CloneMagickWandFromImages(wand,stegano_image));
10947}
10948
10949/*
10950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10951%                                                                             %
10952%                                                                             %
10953%                                                                             %
10954%   M a g i c k S t e r e o I m a g e                                         %
10955%                                                                             %
10956%                                                                             %
10957%                                                                             %
10958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10959%
10960%  MagickStereoImage() composites two images and produces a single image that
10961%  is the composite of a left and right image of a stereo pair
10962%
10963%  The format of the MagickStereoImage method is:
10964%
10965%      MagickWand *MagickStereoImage(MagickWand *wand,
10966%        const MagickWand *offset_wand)
10967%
10968%  A description of each parameter follows:
10969%
10970%    o wand: the magick wand.
10971%
10972%    o offset_wand: Another image wand.
10973%
10974*/
10975WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10976  const MagickWand *offset_wand)
10977{
10978  Image
10979    *stereo_image;
10980
10981  assert(wand != (MagickWand *) NULL);
10982  assert(wand->signature == WandSignature);
10983  if (wand->debug != MagickFalse)
10984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10985  if ((wand->images == (Image *) NULL) ||
10986      (offset_wand->images == (Image *) NULL))
10987    {
10988      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10989        "ContainsNoImages","`%s'",wand->name);
10990      return((MagickWand *) NULL);
10991    }
10992  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10993  if (stereo_image == (Image *) NULL)
10994    return((MagickWand *) NULL);
10995  return(CloneMagickWandFromImages(wand,stereo_image));
10996}
10997
10998/*
10999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11000%                                                                             %
11001%                                                                             %
11002%                                                                             %
11003%   M a g i c k S t r i p I m a g e                                           %
11004%                                                                             %
11005%                                                                             %
11006%                                                                             %
11007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11008%
11009%  MagickStripImage() strips an image of all profiles and comments.
11010%
11011%  The format of the MagickStripImage method is:
11012%
11013%      MagickBooleanType MagickStripImage(MagickWand *wand)
11014%
11015%  A description of each parameter follows:
11016%
11017%    o wand: the magick wand.
11018%
11019*/
11020WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11021{
11022  MagickBooleanType
11023    status;
11024
11025  assert(wand != (MagickWand *) NULL);
11026  assert(wand->signature == WandSignature);
11027  if (wand->debug != MagickFalse)
11028    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11029  if (wand->images == (Image *) NULL)
11030    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11031  status=StripImage(wand->images);
11032  if (status == MagickFalse)
11033    InheritException(wand->exception,&wand->images->exception);
11034  return(status);
11035}
11036
11037/*
11038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11039%                                                                             %
11040%                                                                             %
11041%                                                                             %
11042%   M a g i c k S w i r l I m a g e                                           %
11043%                                                                             %
11044%                                                                             %
11045%                                                                             %
11046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11047%
11048%  MagickSwirlImage() swirls the pixels about the center of the image, where
11049%  degrees indicates the sweep of the arc through which each pixel is moved.
11050%  You get a more dramatic effect as the degrees move from 1 to 360.
11051%
11052%  The format of the MagickSwirlImage method is:
11053%
11054%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11055%
11056%  A description of each parameter follows:
11057%
11058%    o wand: the magick wand.
11059%
11060%    o degrees: Define the tightness of the swirling effect.
11061%
11062*/
11063WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11064  const double degrees)
11065{
11066  Image
11067    *swirl_image;
11068
11069  assert(wand != (MagickWand *) NULL);
11070  assert(wand->signature == WandSignature);
11071  if (wand->debug != MagickFalse)
11072    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11073  if (wand->images == (Image *) NULL)
11074    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11075  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11076  if (swirl_image == (Image *) NULL)
11077    return(MagickFalse);
11078  ReplaceImageInList(&wand->images,swirl_image);
11079  return(MagickTrue);
11080}
11081
11082/*
11083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11084%                                                                             %
11085%                                                                             %
11086%                                                                             %
11087%   M a g i c k T e x t u r e I m a g e                                       %
11088%                                                                             %
11089%                                                                             %
11090%                                                                             %
11091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11092%
11093%  MagickTextureImage() repeatedly tiles the texture image across and down the
11094%  image canvas.
11095%
11096%  The format of the MagickTextureImage method is:
11097%
11098%      MagickWand *MagickTextureImage(MagickWand *wand,
11099%        const MagickWand *texture_wand)
11100%
11101%  A description of each parameter follows:
11102%
11103%    o wand: the magick wand.
11104%
11105%    o texture_wand: the texture wand
11106%
11107*/
11108WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11109  const MagickWand *texture_wand)
11110{
11111  Image
11112    *texture_image;
11113
11114  MagickBooleanType
11115    status;
11116
11117  assert(wand != (MagickWand *) NULL);
11118  assert(wand->signature == WandSignature);
11119  if (wand->debug != MagickFalse)
11120    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11121  if ((wand->images == (Image *) NULL) ||
11122      (texture_wand->images == (Image *) NULL))
11123    {
11124      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11125        "ContainsNoImages","`%s'",wand->name);
11126      return((MagickWand *) NULL);
11127    }
11128  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11129  if (texture_image == (Image *) NULL)
11130    return((MagickWand *) NULL);
11131  status=TextureImage(texture_image,texture_wand->images);
11132  if (status == MagickFalse)
11133    {
11134      InheritException(wand->exception,&texture_image->exception);
11135      texture_image=DestroyImage(texture_image);
11136      return((MagickWand *) NULL);
11137    }
11138  return(CloneMagickWandFromImages(wand,texture_image));
11139}
11140
11141/*
11142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11143%                                                                             %
11144%                                                                             %
11145%                                                                             %
11146%   M a g i c k T h r e s h o l d I m a g e                                   %
11147%                                                                             %
11148%                                                                             %
11149%                                                                             %
11150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11151%
11152%  MagickThresholdImage() changes the value of individual pixels based on
11153%  the intensity of each pixel compared to threshold.  The result is a
11154%  high-contrast, two color image.
11155%
11156%  The format of the MagickThresholdImage method is:
11157%
11158%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11159%        const double threshold)
11160%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11161%        const ChannelType channel,const double threshold)
11162%
11163%  A description of each parameter follows:
11164%
11165%    o wand: the magick wand.
11166%
11167%    o channel: the image channel(s).
11168%
11169%    o threshold: Define the threshold value.
11170%
11171*/
11172WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11173  const double threshold)
11174{
11175  MagickBooleanType
11176    status;
11177
11178  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11179  return(status);
11180}
11181
11182WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11183  const ChannelType channel,const double threshold)
11184{
11185  MagickBooleanType
11186    status;
11187
11188  assert(wand != (MagickWand *) NULL);
11189  assert(wand->signature == WandSignature);
11190  if (wand->debug != MagickFalse)
11191    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11192  if (wand->images == (Image *) NULL)
11193    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11194  status=BilevelImage(wand->images,threshold);
11195  if (status == MagickFalse)
11196    InheritException(wand->exception,&wand->images->exception);
11197  return(status);
11198}
11199
11200/*
11201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11202%                                                                             %
11203%                                                                             %
11204%                                                                             %
11205%   M a g i c k T h u m b n a i l I m a g e                                   %
11206%                                                                             %
11207%                                                                             %
11208%                                                                             %
11209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11210%
11211%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11212%  and removes any associated profiles.  The goal is to produce small low cost
11213%  thumbnail images suited for display on the Web.
11214%
11215%  The format of the MagickThumbnailImage method is:
11216%
11217%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11218%        const size_t columns,const size_t rows)
11219%
11220%  A description of each parameter follows:
11221%
11222%    o wand: the magick wand.
11223%
11224%    o columns: the number of columns in the scaled image.
11225%
11226%    o rows: the number of rows in the scaled image.
11227%
11228*/
11229WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11230  const size_t columns,const size_t rows)
11231{
11232  Image
11233    *thumbnail_image;
11234
11235  assert(wand != (MagickWand *) NULL);
11236  assert(wand->signature == WandSignature);
11237  if (wand->debug != MagickFalse)
11238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11239  if (wand->images == (Image *) NULL)
11240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11241  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11242  if (thumbnail_image == (Image *) NULL)
11243    return(MagickFalse);
11244  ReplaceImageInList(&wand->images,thumbnail_image);
11245  return(MagickTrue);
11246}
11247
11248/*
11249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11250%                                                                             %
11251%                                                                             %
11252%                                                                             %
11253%   M a g i c k T i n t I m a g e                                             %
11254%                                                                             %
11255%                                                                             %
11256%                                                                             %
11257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11258%
11259%  MagickTintImage() applies a color vector to each pixel in the image.  The
11260%  length of the vector is 0 for black and white and at its maximum for the
11261%  midtones.  The vector weighting function is
11262%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11263%
11264%  The format of the MagickTintImage method is:
11265%
11266%      MagickBooleanType MagickTintImage(MagickWand *wand,
11267%        const PixelWand *tint,const PixelWand *opacity)
11268%
11269%  A description of each parameter follows:
11270%
11271%    o wand: the magick wand.
11272%
11273%    o tint: the tint pixel wand.
11274%
11275%    o opacity: the opacity pixel wand.
11276%
11277*/
11278WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11279  const PixelWand *tint,const PixelWand *opacity)
11280{
11281  char
11282    percent_opaque[MaxTextExtent];
11283
11284  Image
11285    *tint_image;
11286
11287  PixelPacket
11288    target;
11289
11290  assert(wand != (MagickWand *) NULL);
11291  assert(wand->signature == WandSignature);
11292  if (wand->debug != MagickFalse)
11293    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11294  if (wand->images == (Image *) NULL)
11295    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11296  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11297    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11298    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11299    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11300    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11301    PixelGetOpacityQuantum(opacity)));
11302  PixelGetQuantumPacket(tint,&target);
11303  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11304  if (tint_image == (Image *) NULL)
11305    return(MagickFalse);
11306  ReplaceImageInList(&wand->images,tint_image);
11307  return(MagickTrue);
11308}
11309
11310/*
11311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11312%                                                                             %
11313%                                                                             %
11314%                                                                             %
11315%   M a g i c k T r a n s f o r m I m a g e                                   %
11316%                                                                             %
11317%                                                                             %
11318%                                                                             %
11319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11320%
11321%  MagickTransformImage() is a convenience method that behaves like
11322%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11323%  information as a region geometry specification.  If the operation fails,
11324%  a NULL image handle is returned.
11325%
11326%  The format of the MagickTransformImage method is:
11327%
11328%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11329%        const char *geometry)
11330%
11331%  A description of each parameter follows:
11332%
11333%    o wand: the magick wand.
11334%
11335%    o crop: A crop geometry string.  This geometry defines a subregion of the
11336%      image to crop.
11337%
11338%    o geometry: An image geometry string.  This geometry defines the final
11339%      size of the image.
11340%
11341*/
11342WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11343  const char *crop,const char *geometry)
11344{
11345  Image
11346    *transform_image;
11347
11348  MagickBooleanType
11349    status;
11350
11351  assert(wand != (MagickWand *) NULL);
11352  assert(wand->signature == WandSignature);
11353  if (wand->debug != MagickFalse)
11354    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11355  if (wand->images == (Image *) NULL)
11356    return((MagickWand *) NULL);
11357  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11358  if (transform_image == (Image *) NULL)
11359    return((MagickWand *) NULL);
11360  status=TransformImage(&transform_image,crop,geometry);
11361  if (status == MagickFalse)
11362    {
11363      InheritException(wand->exception,&transform_image->exception);
11364      transform_image=DestroyImage(transform_image);
11365      return((MagickWand *) NULL);
11366    }
11367  return(CloneMagickWandFromImages(wand,transform_image));
11368}
11369
11370/*
11371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372%                                                                             %
11373%                                                                             %
11374%                                                                             %
11375%   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               %
11376%                                                                             %
11377%                                                                             %
11378%                                                                             %
11379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11380%
11381%  MagickTransformImageColorspace() transform the image colorspace.
11382%
11383%  The format of the MagickTransformImageColorspace method is:
11384%
11385%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11386%        const ColorspaceType colorspace)
11387%
11388%  A description of each parameter follows:
11389%
11390%    o wand: the magick wand.
11391%
11392%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11393%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11394%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11395%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11396%      HSLColorspace, or HWBColorspace.
11397%
11398*/
11399WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11400  const ColorspaceType colorspace)
11401{
11402  assert(wand != (MagickWand *) NULL);
11403  assert(wand->signature == WandSignature);
11404  if (wand->debug != MagickFalse)
11405    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11406  if (wand->images == (Image *) NULL)
11407    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11408  return(TransformImageColorspace(wand->images,colorspace));
11409}
11410
11411/*
11412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11413%                                                                             %
11414%                                                                             %
11415%                                                                             %
11416%   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                     %
11417%                                                                             %
11418%                                                                             %
11419%                                                                             %
11420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11421%
11422%  MagickTransparentPaintImage() changes any pixel that matches color with the
11423%  color defined by fill.
11424%
11425%  The format of the MagickTransparentPaintImage method is:
11426%
11427%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11428%        const PixelWand *target,const double alpha,const double fuzz,
11429%        const MagickBooleanType invert)
11430%
11431%  A description of each parameter follows:
11432%
11433%    o wand: the magick wand.
11434%
11435%    o target: Change this target color to specified opacity value within
11436%      the image.
11437%
11438%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11439%      transparent.
11440%
11441%    o fuzz: By default target must match a particular pixel color
11442%      exactly.  However, in many cases two colors may differ by a small amount.
11443%      The fuzz member of image defines how much tolerance is acceptable to
11444%      consider two colors as the same.  For example, set fuzz to 10 and the
11445%      color red at intensities of 100 and 102 respectively are now interpreted
11446%      as the same color for the purposes of the floodfill.
11447%
11448%    o invert: paint any pixel that does not match the target color.
11449%
11450*/
11451WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11452  const PixelWand *target,const double alpha,const double fuzz,
11453  const MagickBooleanType invert)
11454{
11455  MagickBooleanType
11456    status;
11457
11458  PixelInfo
11459    target_pixel;
11460
11461  assert(wand != (MagickWand *) NULL);
11462  assert(wand->signature == WandSignature);
11463  if (wand->debug != MagickFalse)
11464    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11465  if (wand->images == (Image *) NULL)
11466    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11467  PixelGetMagickColor(target,&target_pixel);
11468  wand->images->fuzz=fuzz;
11469  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11470    QuantumRange*alpha),invert);
11471  if (status == MagickFalse)
11472    InheritException(wand->exception,&wand->images->exception);
11473  return(status);
11474}
11475
11476/*
11477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11478%                                                                             %
11479%                                                                             %
11480%                                                                             %
11481%   M a g i c k T r a n s p o s e I m a g e                                   %
11482%                                                                             %
11483%                                                                             %
11484%                                                                             %
11485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11486%
11487%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11488%  pixels around the central x-axis while rotating them 90-degrees.
11489%
11490%  The format of the MagickTransposeImage method is:
11491%
11492%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11493%
11494%  A description of each parameter follows:
11495%
11496%    o wand: the magick wand.
11497%
11498*/
11499WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11500{
11501  Image
11502    *transpose_image;
11503
11504  assert(wand != (MagickWand *) NULL);
11505  assert(wand->signature == WandSignature);
11506  if (wand->debug != MagickFalse)
11507    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11508  if (wand->images == (Image *) NULL)
11509    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11510  transpose_image=TransposeImage(wand->images,wand->exception);
11511  if (transpose_image == (Image *) NULL)
11512    return(MagickFalse);
11513  ReplaceImageInList(&wand->images,transpose_image);
11514  return(MagickTrue);
11515}
11516
11517/*
11518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11519%                                                                             %
11520%                                                                             %
11521%                                                                             %
11522%   M a g i c k T r a n s v e r s e I m a g e                                 %
11523%                                                                             %
11524%                                                                             %
11525%                                                                             %
11526%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11527%
11528%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11529%  pixels around the central y-axis while rotating them 270-degrees.
11530%
11531%  The format of the MagickTransverseImage method is:
11532%
11533%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11534%
11535%  A description of each parameter follows:
11536%
11537%    o wand: the magick wand.
11538%
11539*/
11540WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11541{
11542  Image
11543    *transverse_image;
11544
11545  assert(wand != (MagickWand *) NULL);
11546  assert(wand->signature == WandSignature);
11547  if (wand->debug != MagickFalse)
11548    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11549  if (wand->images == (Image *) NULL)
11550    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11551  transverse_image=TransverseImage(wand->images,wand->exception);
11552  if (transverse_image == (Image *) NULL)
11553    return(MagickFalse);
11554  ReplaceImageInList(&wand->images,transverse_image);
11555  return(MagickTrue);
11556}
11557
11558/*
11559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11560%                                                                             %
11561%                                                                             %
11562%                                                                             %
11563%   M a g i c k T r i m I m a g e                                             %
11564%                                                                             %
11565%                                                                             %
11566%                                                                             %
11567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11568%
11569%  MagickTrimImage() remove edges that are the background color from the image.
11570%
11571%  The format of the MagickTrimImage method is:
11572%
11573%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11574%
11575%  A description of each parameter follows:
11576%
11577%    o wand: the magick wand.
11578%
11579%    o fuzz: By default target must match a particular pixel color
11580%      exactly.  However, in many cases two colors may differ by a small amount.
11581%      The fuzz member of image defines how much tolerance is acceptable to
11582%      consider two colors as the same.  For example, set fuzz to 10 and the
11583%      color red at intensities of 100 and 102 respectively are now interpreted
11584%      as the same color for the purposes of the floodfill.
11585%
11586*/
11587WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11588{
11589  Image
11590    *trim_image;
11591
11592  assert(wand != (MagickWand *) NULL);
11593  assert(wand->signature == WandSignature);
11594  if (wand->debug != MagickFalse)
11595    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11596  if (wand->images == (Image *) NULL)
11597    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11598  wand->images->fuzz=fuzz;
11599  trim_image=TrimImage(wand->images,wand->exception);
11600  if (trim_image == (Image *) NULL)
11601    return(MagickFalse);
11602  ReplaceImageInList(&wand->images,trim_image);
11603  return(MagickTrue);
11604}
11605
11606/*
11607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11608%                                                                             %
11609%                                                                             %
11610%                                                                             %
11611%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11612%                                                                             %
11613%                                                                             %
11614%                                                                             %
11615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11616%
11617%  MagickUniqueImageColors() discards all but one of any pixel color.
11618%
11619%  The format of the MagickUniqueImageColors method is:
11620%
11621%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11622%
11623%  A description of each parameter follows:
11624%
11625%    o wand: the magick wand.
11626%
11627*/
11628WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11629{
11630  Image
11631    *unique_image;
11632
11633  assert(wand != (MagickWand *) NULL);
11634  assert(wand->signature == WandSignature);
11635  if (wand->debug != MagickFalse)
11636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11637  if (wand->images == (Image *) NULL)
11638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11639  unique_image=UniqueImageColors(wand->images,wand->exception);
11640  if (unique_image == (Image *) NULL)
11641    return(MagickFalse);
11642  ReplaceImageInList(&wand->images,unique_image);
11643  return(MagickTrue);
11644}
11645
11646/*
11647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11648%                                                                             %
11649%                                                                             %
11650%                                                                             %
11651%   M a g i c k U n s h a r p M a s k I m a g e                               %
11652%                                                                             %
11653%                                                                             %
11654%                                                                             %
11655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11656%
11657%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11658%  Gaussian operator of the given radius and standard deviation (sigma).
11659%  For reasonable results, radius should be larger than sigma.  Use a radius
11660%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11661%
11662%  The format of the MagickUnsharpMaskImage method is:
11663%
11664%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11665%        const double radius,const double sigma,const double amount,
11666%        const double threshold)
11667%
11668%  A description of each parameter follows:
11669%
11670%    o wand: the magick wand.
11671%
11672%    o radius: the radius of the Gaussian, in pixels, not counting the center
11673%      pixel.
11674%
11675%    o sigma: the standard deviation of the Gaussian, in pixels.
11676%
11677%    o amount: the percentage of the difference between the original and the
11678%      blur image that is added back into the original.
11679%
11680%    o threshold: the threshold in pixels needed to apply the diffence amount.
11681%
11682*/
11683WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11684  const double radius,const double sigma,const double amount,
11685  const double threshold)
11686{
11687  Image
11688    *unsharp_image;
11689
11690  assert(wand != (MagickWand *) NULL);
11691  assert(wand->signature == WandSignature);
11692  if (wand->debug != MagickFalse)
11693    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11694  if (wand->images == (Image *) NULL)
11695    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11696  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11697    wand->exception);
11698  if (unsharp_image == (Image *) NULL)
11699    return(MagickFalse);
11700  ReplaceImageInList(&wand->images,unsharp_image);
11701  return(MagickTrue);
11702}
11703
11704/*
11705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11706%                                                                             %
11707%                                                                             %
11708%                                                                             %
11709%   M a g i c k V i g n e t t e I m a g e                                     %
11710%                                                                             %
11711%                                                                             %
11712%                                                                             %
11713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11714%
11715%  MagickVignetteImage() softens the edges of the image in vignette style.
11716%
11717%  The format of the MagickVignetteImage method is:
11718%
11719%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11720%        const double black_point,const double white_point,const ssize_t x,
11721%        const ssize_t y)
11722%
11723%  A description of each parameter follows:
11724%
11725%    o wand: the magick wand.
11726%
11727%    o black_point: the black point.
11728%
11729%    o white_point: the white point.
11730%
11731%    o x, y:  Define the x and y ellipse offset.
11732%
11733*/
11734WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11735  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11736{
11737  Image
11738    *vignette_image;
11739
11740  assert(wand != (MagickWand *) NULL);
11741  assert(wand->signature == WandSignature);
11742  if (wand->debug != MagickFalse)
11743    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11744  if (wand->images == (Image *) NULL)
11745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11746  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11747    wand->exception);
11748  if (vignette_image == (Image *) NULL)
11749    return(MagickFalse);
11750  ReplaceImageInList(&wand->images,vignette_image);
11751  return(MagickTrue);
11752}
11753
11754/*
11755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11756%                                                                             %
11757%                                                                             %
11758%                                                                             %
11759%   M a g i c k W a v e I m a g e                                             %
11760%                                                                             %
11761%                                                                             %
11762%                                                                             %
11763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11764%
11765%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11766%  the pixels vertically along a sine wave whose amplitude and wavelength
11767%  is specified by the given parameters.
11768%
11769%  The format of the MagickWaveImage method is:
11770%
11771%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11772%        const double wave_length)
11773%
11774%  A description of each parameter follows:
11775%
11776%    o wand: the magick wand.
11777%
11778%    o amplitude, wave_length:  Define the amplitude and wave length of the
11779%      sine wave.
11780%
11781*/
11782WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11783  const double amplitude,const double wave_length)
11784{
11785  Image
11786    *wave_image;
11787
11788  assert(wand != (MagickWand *) NULL);
11789  assert(wand->signature == WandSignature);
11790  if (wand->debug != MagickFalse)
11791    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11792  if (wand->images == (Image *) NULL)
11793    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11794  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11795  if (wave_image == (Image *) NULL)
11796    return(MagickFalse);
11797  ReplaceImageInList(&wand->images,wave_image);
11798  return(MagickTrue);
11799}
11800
11801/*
11802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11803%                                                                             %
11804%                                                                             %
11805%                                                                             %
11806%   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                         %
11807%                                                                             %
11808%                                                                             %
11809%                                                                             %
11810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11811%
11812%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11813%  above the threshold into white while leaving all pixels below the threshold
11814%  unchanged.
11815%
11816%  The format of the MagickWhiteThresholdImage method is:
11817%
11818%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11819%        const PixelWand *threshold)
11820%
11821%  A description of each parameter follows:
11822%
11823%    o wand: the magick wand.
11824%
11825%    o threshold: the pixel wand.
11826%
11827*/
11828WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11829  const PixelWand *threshold)
11830{
11831  char
11832    thresholds[MaxTextExtent];
11833
11834  MagickBooleanType
11835    status;
11836
11837  assert(wand != (MagickWand *) NULL);
11838  assert(wand->signature == WandSignature);
11839  if (wand->debug != MagickFalse)
11840    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11841  if (wand->images == (Image *) NULL)
11842    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11843  (void) FormatLocaleString(thresholds,MaxTextExtent,
11844    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11845    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11846    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11847  status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11848  if (status == MagickFalse)
11849    InheritException(wand->exception,&wand->images->exception);
11850  return(status);
11851}
11852
11853/*
11854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11855%                                                                             %
11856%                                                                             %
11857%                                                                             %
11858%   M a g i c k W r i t e I m a g e                                           %
11859%                                                                             %
11860%                                                                             %
11861%                                                                             %
11862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11863%
11864%  MagickWriteImage() writes an image to the specified filename.  If the
11865%  filename parameter is NULL, the image is written to the filename set
11866%  by MagickReadImage() or MagickSetImageFilename().
11867%
11868%  The format of the MagickWriteImage method is:
11869%
11870%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11871%        const char *filename)
11872%
11873%  A description of each parameter follows:
11874%
11875%    o wand: the magick wand.
11876%
11877%    o filename: the image filename.
11878%
11879%
11880*/
11881WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11882  const char *filename)
11883{
11884  Image
11885    *image;
11886
11887  ImageInfo
11888    *write_info;
11889
11890  MagickBooleanType
11891    status;
11892
11893  assert(wand != (MagickWand *) NULL);
11894  assert(wand->signature == WandSignature);
11895  if (wand->debug != MagickFalse)
11896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11897  if (wand->images == (Image *) NULL)
11898    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11899  if (filename != (const char *) NULL)
11900    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11901  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11902  if (image == (Image *) NULL)
11903    return(MagickFalse);
11904  write_info=CloneImageInfo(wand->image_info);
11905  write_info->adjoin=MagickTrue;
11906  status=WriteImage(write_info,image);
11907  if (status == MagickFalse)
11908    InheritException(wand->exception,&image->exception);
11909  image=DestroyImage(image);
11910  write_info=DestroyImageInfo(write_info);
11911  return(status);
11912}
11913
11914/*
11915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11916%                                                                             %
11917%                                                                             %
11918%                                                                             %
11919%   M a g i c k W r i t e I m a g e F i l e                                   %
11920%                                                                             %
11921%                                                                             %
11922%                                                                             %
11923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11924%
11925%  MagickWriteImageFile() writes an image to an open file descriptor.
11926%
11927%  The format of the MagickWriteImageFile method is:
11928%
11929%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11930%
11931%  A description of each parameter follows:
11932%
11933%    o wand: the magick wand.
11934%
11935%    o file: the file descriptor.
11936%
11937*/
11938WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11939{
11940  Image
11941    *image;
11942
11943  ImageInfo
11944    *write_info;
11945
11946  MagickBooleanType
11947    status;
11948
11949  assert(wand != (MagickWand *) NULL);
11950  assert(wand->signature == WandSignature);
11951  assert(file != (FILE *) NULL);
11952  if (wand->debug != MagickFalse)
11953    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11954  if (wand->images == (Image *) NULL)
11955    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11956  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11957  if (image == (Image *) NULL)
11958    return(MagickFalse);
11959  write_info=CloneImageInfo(wand->image_info);
11960  SetImageInfoFile(write_info,file);
11961  write_info->adjoin=MagickTrue;
11962  status=WriteImage(write_info,image);
11963  write_info=DestroyImageInfo(write_info);
11964  if (status == MagickFalse)
11965    InheritException(wand->exception,&image->exception);
11966  image=DestroyImage(image);
11967  return(status);
11968}
11969
11970/*
11971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11972%                                                                             %
11973%                                                                             %
11974%                                                                             %
11975%   M a g i c k W r i t e I m a g e s                                         %
11976%                                                                             %
11977%                                                                             %
11978%                                                                             %
11979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11980%
11981%  MagickWriteImages() writes an image or image sequence.
11982%
11983%  The format of the MagickWriteImages method is:
11984%
11985%      MagickBooleanType MagickWriteImages(MagickWand *wand,
11986%        const char *filename,const MagickBooleanType adjoin)
11987%
11988%  A description of each parameter follows:
11989%
11990%    o wand: the magick wand.
11991%
11992%    o filename: the image filename.
11993%
11994%    o adjoin: join images into a single multi-image file.
11995%
11996*/
11997WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11998  const char *filename,const MagickBooleanType adjoin)
11999{
12000  ImageInfo
12001    *write_info;
12002
12003  MagickBooleanType
12004    status;
12005
12006  assert(wand != (MagickWand *) NULL);
12007  assert(wand->signature == WandSignature);
12008  if (wand->debug != MagickFalse)
12009    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12010  if (wand->images == (Image *) NULL)
12011    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12012  write_info=CloneImageInfo(wand->image_info);
12013  write_info->adjoin=adjoin;
12014  status=WriteImages(write_info,wand->images,filename,wand->exception);
12015  if (status == MagickFalse)
12016    InheritException(wand->exception,&wand->images->exception);
12017  write_info=DestroyImageInfo(write_info);
12018  return(status);
12019}
12020
12021/*
12022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12023%                                                                             %
12024%                                                                             %
12025%                                                                             %
12026%   M a g i c k W r i t e I m a g e s F i l e                                 %
12027%                                                                             %
12028%                                                                             %
12029%                                                                             %
12030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12031%
12032%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12033%
12034%  The format of the MagickWriteImagesFile method is:
12035%
12036%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12037%
12038%  A description of each parameter follows:
12039%
12040%    o wand: the magick wand.
12041%
12042%    o file: the file descriptor.
12043%
12044*/
12045WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12046{
12047  ImageInfo
12048    *write_info;
12049
12050  MagickBooleanType
12051    status;
12052
12053  assert(wand != (MagickWand *) NULL);
12054  assert(wand->signature == WandSignature);
12055  if (wand->debug != MagickFalse)
12056    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12057  if (wand->images == (Image *) NULL)
12058    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12059  write_info=CloneImageInfo(wand->image_info);
12060  SetImageInfoFile(write_info,file);
12061  write_info->adjoin=MagickTrue;
12062  status=WriteImages(write_info,wand->images,(const char *) NULL,
12063    wand->exception);
12064  write_info=DestroyImageInfo(write_info);
12065  if (status == MagickFalse)
12066    InheritException(wand->exception,&wand->images->exception);
12067  return(status);
12068}
12069